summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2021-12-22 11:15:53 +0200
committerGitHub <noreply@github.com>2021-12-22 11:15:53 +0200
commitdf8930ddd370b2a9fec96b1cbb45e8ae530c0aad (patch)
treef745ec451109f68b1301d16bbebe74d99c3f6dd3 /database
parente167d2d2d3fed0e4f4a803ca8b0210c3ffa843fe (diff)
Send ML feature information with UpdateNodeInfo. (#11913)
* Send ML feature information with UpdateNodeInfo. We achieve this by adding the `ml_{capable,enabled}` fields in `system_info`. When streaming, these fields allow a parent to understand if the child has ML and if it runs ML for itself. The UpdateNodeInfo includes this information about a child, plus a boolean that is set to true when the parent runs ML for the child. * Fix unit test and building with --disable-ml. * Refactoring to use the new MachineLearningInfo message * Update aclk-schemas repository to include latest ML info message.
Diffstat (limited to 'database')
-rw-r--r--database/rrd.h2
-rw-r--r--database/rrdhost.c12
-rw-r--r--database/sqlite/sqlite_aclk_node.c4
3 files changed, 18 insertions, 0 deletions
diff --git a/database/rrd.h b/database/rrd.h
index 7f8b91f7d2..fe890db313 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -754,6 +754,8 @@ struct rrdhost_system_info {
char *container_detection;
char *is_k8s_node;
uint16_t hops;
+ bool ml_capable;
+ bool ml_enabled;
};
struct rrdhost {
diff --git a/database/rrdhost.c b/database/rrdhost.c
index d9608b740e..7be7ba9bd3 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -382,7 +382,19 @@ RRDHOST *rrdhost_create(const char *hostname,
else localhost = host;
}
+ // ------------------------------------------------------------------------
+ // init new ML host and update system_info to let upstreams know
+ // about ML functionality
+
ml_new_host(host);
+ if (is_localhost && host->system_info) {
+#ifndef ENABLE_ML
+ host->system_info->ml_capable = 0;
+#else
+ host->system_info->ml_capable = 1;
+#endif
+ host->system_info->ml_enabled = host->ml_host != NULL;
+ }
info("Host '%s' (at registry as '%s') with guid '%s' initialized"
", os '%s'"
diff --git a/database/sqlite/sqlite_aclk_node.c b/database/sqlite/sqlite_aclk_node.c
index ba498c2a78..6261b9af56 100644
--- a/database/sqlite/sqlite_aclk_node.c
+++ b/database/sqlite/sqlite_aclk_node.c
@@ -22,6 +22,8 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
node_info.claim_id = is_agent_claimed();
node_info.machine_guid = wc->host_guid;
node_info.child = (wc->host != localhost);
+ node_info.ml_info.ml_capable = localhost->system_info->ml_capable;
+ node_info.ml_info.ml_enabled = wc->host->ml_host != NULL;
now_realtime_timeval(&node_info.updated_at);
RRDHOST *host = wc->host;
@@ -46,6 +48,8 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
node_info.data.services = NULL; // char **
node_info.data.service_count = 0;
node_info.data.machine_guid = wc->host_guid;
+ node_info.data.ml_info.ml_capable = host->system_info->ml_capable;
+ node_info.data.ml_info.ml_enabled = host->system_info->ml_enabled;
struct label_index *labels = &host->labels;
netdata_rwlock_wrlock(&labels->labels_rwlock);