additional stats (#13445)
Costa Tsaousis committed
Jul 28, 2022 at 15:29 UTC
68888d403f0a7eae84f474c21d086939b5543ea2
3 files changed
+23
-3
database/engine/rrdengineapi.c
+10
-3
@@ -1037,9 +1037,16 @@ RRDENG_SIZE_STATS rrdeng_size_statistics(struct rrdengine_instance *ctx) {
1037
}
1038
}
1039
1040
- internal_error(stats.metrics_pages != stats.extents_pages,
1041
- "DBENGINE: metrics pages is %zu, but extents pages is %zu",
1042
- stats.metrics_pages, stats.extents_pages);
1040
+
1041
+ stats.currently_collected_metrics = ctx->stats.metric_API_producers;
1042
+ stats.max_concurrently_collected_metrics = ctx->metric_API_max_producers;
1043
+
1044
+ internal_error(stats.metrics_pages != stats.extents_pages + stats.currently_collected_metrics,
1045
+ "DBENGINE: metrics pages is %zu, but extents pages is %zu and API consumers is %zu",
1046
+ stats.metrics_pages, stats.extents_pages, stats.currently_collected_metrics);
1047
+
1048
+ stats.disk_space = ctx->disk_space;
1049
+ stats.max_disk_space = ctx->max_disk_space;
1050
1051
stats.database_retention_secs = (time_t)(stats.last_t - stats.first_t);
1052
database/engine/rrdengineapi.h
+5
@@ -117,8 +117,13 @@ typedef struct rrdengine_size_statistics {
117
usec_t first_t;
118
usec_t last_t;
119
120
+ size_t currently_collected_metrics;
121
+ size_t max_concurrently_collected_metrics;
122
size_t estimated_concurrently_collected_metrics;
123
124
+ size_t disk_space;
125
+ size_t max_disk_space;
126
+
127
time_t database_retention_secs;
128
double average_compression_savings;
129
double average_point_duration_secs;
web/api/web_api_v1.c
+8
@@ -1573,6 +1573,10 @@ static void web_client_api_v1_dbengine_stats_for_tier(BUFFER *wb, int tier) {
1573
",\n\t\t\"ephemeral_metrics_per_day_percent\":%0.2f"
1574
",\n\t\t\"average_page_size_bytes\":%0.2f"
1575
",\n\t\t\"estimated_concurrently_collected_metrics\":%zu"
1576
+ ",\n\t\t\"currently_collected_metrics\":%zu"
1577
+ ",\n\t\t\"max_concurrently_collected_metrics\":%zu"
1578
+ ",\n\t\t\"disk_space\":%zu"
1579
+ ",\n\t\t\"max_disk_space\":%zu"
1580
, stats.default_granularity_secs
1581
, stats.sizeof_metric
1582
, stats.sizeof_metric_in_index
@@ -1604,6 +1608,10 @@ static void web_client_api_v1_dbengine_stats_for_tier(BUFFER *wb, int tier) {
1608
, stats.ephemeral_metrics_per_day_percent
1609
, stats.average_page_size_bytes
1610
, stats.estimated_concurrently_collected_metrics
1611
+ , stats.currently_collected_metrics
1612
+ , stats.max_concurrently_collected_metrics
1613
+ , stats.disk_space
1614
+ , stats.max_disk_space
1615
);
1616
}
1617
int web_client_api_request_v1_dbengine_stats(RRDHOST *host __maybe_unused, struct web_client *w, char *url __maybe_unused) {