Stream and advertise metric correlations to the cloud (#12940)
* stream and advertise mc to the cloud * better reporting * remove log * remove aclk debug
Emmanuel Vasilakis committed
May 24, 2022 at 11:48 UTC
2f4b6e059bedd77b9851a4a0bd654bf86b0c6a15
8 files changed
+12
-1
aclk/aclk_tx_msgs.c
+1
@@ -459,6 +459,7 @@ uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable
459
#ifdef ENABLE_ML
460
{ .name = "ml", .version = 1, .enabled = ml_enabled(localhost) },
461
#endif
462
+ { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations },
463
{ .name = NULL, .version = 0, .enabled = 0 }
464
};
465
database/metric_correlations.c
+2
-1
@@ -4,7 +4,8 @@
4
#include "KolmogorovSmirnovDist.h"
5
6
#define MAX_POINTS 10000
7
-int enable_metric_correlations = CONFIG_BOOLEAN_YES;
7
+int enable_metric_correlations = CONFIG_BOOLEAN_NO;
8
+int metric_correlations_version = 1;
9
10
struct charts {
11
RRDSET *st;
database/metric_correlations.h
+1
@@ -4,6 +4,7 @@
4
#define NETDATA_METRIC_CORRELATIONS_H 1
5
6
extern int enable_metric_correlations;
7
+extern int metric_correlations_version;
8
9
void metric_correlations (RRDHOST *host, BUFFER *wb, long long selected_after, long long selected_before, long long reference_after, long long reference_before, long long max_points);
10
database/rrd.h
+1
@@ -718,6 +718,7 @@ struct rrdhost_system_info {
718
char *install_type;
719
char *prebuilt_arch;
720
char *prebuilt_dist;
721
+ int mc_version;
722
};
723
724
struct rrdhost {
database/rrdhost.c
+1
@@ -392,6 +392,7 @@ RRDHOST *rrdhost_create(const char *hostname,
392
if (is_localhost && host->system_info) {
393
host->system_info->ml_capable = ml_capable();
394
host->system_info->ml_enabled = ml_enabled(host);
395
+ host->system_info->mc_version = enable_metric_correlations ? metric_correlations_version : 0;
396
}
397
398
ml_new_host(host);
database/sqlite/sqlite_aclk_node.c
+2
@@ -28,6 +28,7 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
28
struct capability instance_caps[] = {
29
{ .name = "proto", .version = 1, .enabled = 1 },
30
{ .name = "ml", .version = ml_capable(localhost), .enabled = ml_enabled(wc->host) },
31
+ { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations },
32
{ .name = NULL, .version = 0, .enabled = 0 }
33
};
34
node_info.node_instance_capabilities = instance_caps;
@@ -66,6 +67,7 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
67
68
struct capability node_caps[] = {
69
{ .name = "ml", .version = host->system_info->ml_capable, .enabled = host->system_info->ml_enabled },
70
+ { .name = "mc", .version = host->system_info->mc_version ? host->system_info->mc_version : 0, .enabled = host->system_info->mc_version ? 1 : 0 },
71
{ .name = NULL, .version = 0, .enabled = 0 }
72
};
73
node_info.node_capabilities = node_caps;
streaming/rrdpush.c
+2
@@ -615,6 +615,8 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *url) {
615
system_info->ml_capable = strtoul(value, NULL, 0);
616
else if(!strcmp(name, "ml_enabled"))
617
system_info->ml_enabled = strtoul(value, NULL, 0);
618
+ else if(!strcmp(name, "mc_version"))
619
+ system_info->mc_version = strtoul(value, NULL, 0);
620
else if(!strcmp(name, "tags"))
621
tags = value;
622
else if(!strcmp(name, "ver"))
streaming/sender.c
+2
@@ -335,6 +335,7 @@ if(!s->rrdpush_compression)
335
"&hops=%d"
336
"&ml_capable=%d"
337
"&ml_enabled=%d"
338
+ "&mc_version=%d"
339
"&tags=%s"
340
"&ver=%d"
341
"&NETDATA_INSTANCE_CLOUD_TYPE=%s"
@@ -380,6 +381,7 @@ if(!s->rrdpush_compression)
381
, host->system_info->hops + 1
382
, host->system_info->ml_capable
383
, host->system_info->ml_enabled
384
+ , host->system_info->mc_version
385
, (host->tags) ? host->tags : ""
386
, s->version
387
, (host->system_info->cloud_provider_type) ? host->system_info->cloud_provider_type : ""