fix exporting internal charts context and family (#16683)
* fix exporting inernal charts context * update alerts * fix exporting charts family
Ilya Mashchenko committed
Dec 28, 2023 at 23:19 UTC
f6c49c4ffe6bb0516a91a388ffd01b188f2acb6b
3 files changed
+67
-23
exporting/send_internal_metrics.c
+60
-16
@@ -18,8 +18,18 @@ void create_main_rusage_chart(RRDSET **st_rusage, RRDDIM **rd_user, RRDDIM **rd_
18
return;
19
20
*st_rusage = rrdset_create_localhost(
21
- "netdata", "exporting_main_thread_cpu", NULL, "exporting", "exporting_cpu_usage", "Netdata Main Exporting Thread CPU Usage",
22
- "milliseconds/s", "exporting", NULL, 130600, localhost->rrd_update_every, RRDSET_TYPE_STACKED);
21
+ "netdata",
22
+ "exporting_main_thread_cpu",
23
+ NULL,
24
+ "exporting",
25
+ "netdata.exporting_cpu_usage",
26
+ "Netdata Main Exporting Thread CPU Usage",
27
+ "milliseconds/s",
28
+ "exporting",
29
+ NULL,
30
+ 130600,
31
+ localhost->rrd_update_every,
32
+ RRDSET_TYPE_STACKED);
33
34
*rd_user = rrddim_add(*st_rusage, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
35
*rd_system = rrddim_add(*st_rusage, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
@@ -65,16 +75,22 @@ void send_internal_metrics(struct instance *instance)
75
76
if (!stats->initialized) {
77
char id[RRD_ID_LENGTH_MAX + 1];
68
- BUFFER *family = buffer_create(0, &netdata_buffers_statistics.buffers_exporters);
69
-
70
- buffer_sprintf(family, "exporting_%s", instance->config.name);
71
-
78
snprintf(id, RRD_ID_LENGTH_MAX, "exporting_%s_metrics", instance->config.name);
79
netdata_fix_chart_id(id);
80
81
stats->st_metrics = rrdset_create_localhost(
76
- "netdata", id, NULL, buffer_tostring(family), "exporting_buffer", "Netdata Buffered Metrics", "metrics", "exporting", NULL,
77
- 130610, instance->config.update_every, RRDSET_TYPE_LINE);
82
+ "netdata",
83
+ id,
84
+ NULL,
85
+ "exporting",
86
+ "netdata.exporting_buffer",
87
+ "Netdata Buffered Metrics",
88
+ "metrics",
89
+ "exporting",
90
+ NULL,
91
+ 130610,
92
+ instance->config.update_every,
93
+ RRDSET_TYPE_LINE);
94
95
stats->rd_buffered_metrics = rrddim_add(stats->st_metrics, "buffered", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
96
stats->rd_lost_metrics = rrddim_add(stats->st_metrics, "lost", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
@@ -86,8 +102,18 @@ void send_internal_metrics(struct instance *instance)
102
netdata_fix_chart_id(id);
103
104
stats->st_bytes = rrdset_create_localhost(
89
- "netdata", id, NULL, buffer_tostring(family), "exporting_data_size", "Netdata Exporting Data Size", "KiB", "exporting", NULL,
90
- 130620, instance->config.update_every, RRDSET_TYPE_AREA);
105
+ "netdata",
106
+ id,
107
+ NULL,
108
+ "exporting",
109
+ "netdata.exporting_data_size",
110
+ "Netdata Exporting Data Size",
111
+ "KiB",
112
+ "exporting",
113
+ NULL,
114
+ 130620,
115
+ instance->config.update_every,
116
+ RRDSET_TYPE_AREA);
117
118
stats->rd_buffered_bytes = rrddim_add(stats->st_bytes, "buffered", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
119
stats->rd_lost_bytes = rrddim_add(stats->st_bytes, "lost", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
@@ -100,8 +126,18 @@ void send_internal_metrics(struct instance *instance)
126
netdata_fix_chart_id(id);
127
128
stats->st_ops = rrdset_create_localhost(
103
- "netdata", id, NULL, buffer_tostring(family), "exporting_operations", "Netdata Exporting Operations", "operations", "exporting",
104
- NULL, 130630, instance->config.update_every, RRDSET_TYPE_LINE);
129
+ "netdata",
130
+ id,
131
+ NULL,
132
+ "exporting",
133
+ "netdata.exporting_operations",
134
+ "Netdata Exporting Operations",
135
+ "operations",
136
+ "exporting",
137
+ NULL,
138
+ 130630,
139
+ instance->config.update_every,
140
+ RRDSET_TYPE_LINE);
141
142
stats->rd_transmission_successes = rrddim_add(stats->st_ops, "write", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
143
stats->rd_data_lost_events = rrddim_add(stats->st_ops, "discard", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
@@ -115,14 +151,22 @@ void send_internal_metrics(struct instance *instance)
151
netdata_fix_chart_id(id);
152
153
stats->st_rusage = rrdset_create_localhost(
118
- "netdata", id, NULL, buffer_tostring(family), "exporting_instance", "Netdata Exporting Instance Thread CPU Usage",
119
- "milliseconds/s", "exporting", NULL, 130640, instance->config.update_every, RRDSET_TYPE_STACKED);
154
+ "netdata",
155
+ id,
156
+ NULL,
157
+ "exporting",
158
+ "netdata.exporting_instance",
159
+ "Netdata Exporting Instance Thread CPU Usage",
160
+ "milliseconds/s",
161
+ "exporting",
162
+ NULL,
163
+ 130640,
164
+ instance->config.update_every,
165
+ RRDSET_TYPE_STACKED);
166
167
stats->rd_user = rrddim_add(stats->st_rusage, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
168
stats->rd_system = rrddim_add(stats->st_rusage, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
169
124
- buffer_free(family);
125
-
170
stats->initialized = 1;
171
}
172
exporting/tests/test_exporting_engine.c
+5
-5
@@ -844,7 +844,7 @@ static void test_create_main_rusage_chart(void **state)
844
expect_string(rrdset_create_custom, id, "exporting_main_thread_cpu");
845
expect_value(rrdset_create_custom, name, NULL);
846
expect_string(rrdset_create_custom, family, "exporting");
847
- expect_string(rrdset_create_custom, context, "exporting_cpu_usage");
847
+ expect_string(rrdset_create_custom, context, "netdata.exporting_cpu_usage");
848
expect_string(rrdset_create_custom, units, "milliseconds/s");
849
expect_string(rrdset_create_custom, plugin, "exporting");
850
expect_value(rrdset_create_custom, module, NULL);
@@ -912,7 +912,7 @@ static void test_send_internal_metrics(void **state)
912
expect_string(rrdset_create_custom, type, "netdata");
913
expect_string(rrdset_create_custom, id, "exporting_test_instance_metrics");
914
expect_value(rrdset_create_custom, name, NULL);
915
- expect_string(rrdset_create_custom, family, "exporting_test_instance");
915
+ expect_string(rrdset_create_custom, family, "exporting");
916
expect_string(rrdset_create_custom, context, "exporting_buffer");
917
expect_string(rrdset_create_custom, units, "metrics");
918
expect_string(rrdset_create_custom, plugin, "exporting");
@@ -936,7 +936,7 @@ static void test_send_internal_metrics(void **state)
936
expect_string(rrdset_create_custom, type, "netdata");
937
expect_string(rrdset_create_custom, id, "exporting_test_instance_bytes");
938
expect_value(rrdset_create_custom, name, NULL);
939
- expect_string(rrdset_create_custom, family, "exporting_test_instance");
939
+ expect_string(rrdset_create_custom, family, "exporting");
940
expect_string(rrdset_create_custom, context, "exporting_data_size");
941
expect_string(rrdset_create_custom, units, "KiB");
942
expect_string(rrdset_create_custom, plugin, "exporting");
@@ -960,7 +960,7 @@ static void test_send_internal_metrics(void **state)
960
expect_string(rrdset_create_custom, type, "netdata");
961
expect_string(rrdset_create_custom, id, "exporting_test_instance_ops");
962
expect_value(rrdset_create_custom, name, NULL);
963
- expect_string(rrdset_create_custom, family, "exporting_test_instance");
963
+ expect_string(rrdset_create_custom, family, "exporting");
964
expect_string(rrdset_create_custom, context, "exporting_operations");
965
expect_string(rrdset_create_custom, units, "operations");
966
expect_string(rrdset_create_custom, plugin, "exporting");
@@ -984,7 +984,7 @@ static void test_send_internal_metrics(void **state)
984
expect_string(rrdset_create_custom, type, "netdata");
985
expect_string(rrdset_create_custom, id, "exporting_test_instance_thread_cpu");
986
expect_value(rrdset_create_custom, name, NULL);
987
- expect_string(rrdset_create_custom, family, "exporting_test_instance");
987
+ expect_string(rrdset_create_custom, family, "exporting");
988
expect_string(rrdset_create_custom, context, "exporting_instance");
989
expect_string(rrdset_create_custom, units, "milliseconds/s");
990
expect_string(rrdset_create_custom, plugin, "exporting");
health/health.d/exporting.conf
+2
-2
@@ -1,6 +1,6 @@
1
2
template: exporting_last_buffering
3
- on: exporting_data_size
3
+ on: netdata.exporting_data_size
4
class: Latency
5
type: Netdata
6
component: Exporting engine
@@ -15,7 +15,7 @@ component: Exporting engine
15
to: dba
16
17
template: exporting_metrics_sent
18
- on: exporting_data_size
18
+ on: netdata.exporting_data_size
19
class: Workload
20
type: Netdata
21
component: Exporting engine