@cryptotaxi247 / netdata-1 / commits / 7a55bfdc7

WEIGHTS: use node_id when available, otherwise host_id (#18579)

use node_id when available, otherwise host_id

Costa Tsaousis committed Sep 18, 2024 at 15:42 UTC 7a55bfdc72a58c4c50ba693937ed0da4a2b1fcdb
1 file changed +8 -2
src/web/api/queries/weights.c
+8 -2
@@ -976,6 +976,12 @@ static size_t registered_results_to_json_multinode_group_by(
976 BUFFER *key = buffer_create(0, NULL);
977 BUFFER *name = buffer_create(0, NULL);
978 dfe_start_read(results, t) {
979 + char node_uuid[UUID_STR_LEN];
980 +
981 + if(UUIDiszero(t->host->node_id))
982 + uuid_unparse_lower(t->host->host_id.uuid, node_uuid);
983 + else
984 + uuid_unparse_lower(t->host->node_id.uuid, node_uuid);
985
986 buffer_flush(key);
987 buffer_flush(name);
@@ -996,7 +1002,7 @@ static size_t registered_results_to_json_multinode_group_by(
1002 if(!(qwd->qwr->group_by.group_by & RRDR_GROUP_BY_NODE)) {
1003 buffer_fast_strcat(key, "@", 1);
1004 buffer_fast_strcat(name, "@", 1);
999 - buffer_strcat(key, t->host->machine_guid);
1005 + buffer_strcat(key, node_uuid);
1006 buffer_strcat(name, rrdhost_hostname(t->host));
1007 }
1008 }
@@ -1006,7 +1012,7 @@ static size_t registered_results_to_json_multinode_group_by(
1012 buffer_fast_strcat(name, ",", 1);
1013 }
1014
1009 - buffer_strcat(key, t->host->machine_guid);
1015 + buffer_strcat(key, node_uuid);
1016 buffer_strcat(name, rrdhost_hostname(t->host));
1017 }
1018 if(qwd->qwr->group_by.group_by & RRDR_GROUP_BY_CONTEXT) {