3
#include "ADCharts.h"
4
#include "Config.h"
5
6
-void ml::updateDimensionsChart(RRDHOST *RH,
7
- collected_number NumTrainedDimensions,
8
- collected_number NumNormalDimensions,
9
- collected_number NumAnomalousDimensions) {
10
- static thread_local RRDSET *RS = nullptr;
11
- static thread_local RRDDIM *NumTotalDimensionsRD = nullptr;
12
- static thread_local RRDDIM *NumTrainedDimensionsRD = nullptr;
13
- static thread_local RRDDIM *NumNormalDimensionsRD = nullptr;
14
- static thread_local RRDDIM *NumAnomalousDimensionsRD = nullptr;
15
-
16
- if (!RS) {
17
- std::stringstream IdSS, NameSS;
6
+void ml::updateDimensionsChart(RRDHOST *RH, const MachineLearningStats &MLS) {
7
+ /*
8
+ * Machine learning status
9
+ */
10
+ {
11
+ static thread_local RRDSET *MachineLearningStatusRS = nullptr;
12
+
13
+ static thread_local RRDDIM *Enabled = nullptr;
14
+ static thread_local RRDDIM *DisabledUE = nullptr;
15
+ static thread_local RRDDIM *DisabledSP = nullptr;
16
+
17
+ if (!MachineLearningStatusRS) {
18
+ std::stringstream IdSS, NameSS;
19
+
20
+ IdSS << "machine_learning_status_for_" << localhost->machine_guid;
21
+ NameSS << "machine_learning_status_for_" << localhost->hostname;
22
+
23
+ MachineLearningStatusRS = rrdset_create_localhost(
24
+ "netdata", // type
25
+ IdSS.str().c_str(), // id
26
+ NameSS.str().c_str(), // name
27
+ "ml", // family
28
+ "netdata.machine_learning_status", // ctx
29
+ "Machine learning status", // title
30
+ "dimensions", // units
31
+ "netdata", // plugin
32
+ "ml", // module
33
+ NETDATA_ML_CHART_PRIO_MACHINE_LEARNING_STATUS, // priority
34
+ RH->rrd_update_every, // update_every
35
+ RRDSET_TYPE_LINE // chart_type
36
+ );
37
+ rrdset_flag_set(MachineLearningStatusRS , RRDSET_FLAG_ANOMALY_DETECTION);
38
+
39
+ Enabled = rrddim_add(MachineLearningStatusRS, "enabled", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
40
+ DisabledUE = rrddim_add(MachineLearningStatusRS, "disabled-ue", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
41
+ DisabledSP = rrddim_add(MachineLearningStatusRS, "disabled-sp", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
42
+ }
43
+
44
+ rrddim_set_by_pointer(MachineLearningStatusRS, Enabled, MLS.NumMachineLearningStatusEnabled);
45
+ rrddim_set_by_pointer(MachineLearningStatusRS, DisabledUE, MLS.NumMachineLearningStatusDisabledUE);
46
+ rrddim_set_by_pointer(MachineLearningStatusRS, DisabledSP, MLS.NumMachineLearningStatusDisabledSP);
47
+
48
+ rrdset_done(MachineLearningStatusRS);
49
+ }
50
19
- IdSS << "dimensions_on_" << localhost->machine_guid;
20
- NameSS << "dimensions_on_" << localhost->hostname;
51
+ /*
52
+ * Metric type
53
+ */
54
+ {
55
+ static thread_local RRDSET *MetricTypesRS = nullptr;
56
+
57
+ static thread_local RRDDIM *Constant = nullptr;
58
+ static thread_local RRDDIM *Variable = nullptr;
59
+
60
+ if (!MetricTypesRS) {
61
+ std::stringstream IdSS, NameSS;
62
+
63
+ IdSS << "metric_types_for_" << localhost->machine_guid;
64
+ NameSS << "metric_types_for_" << localhost->hostname;
65
+
66
+ MetricTypesRS = rrdset_create_localhost(
67
+ "netdata", // type
68
+ IdSS.str().c_str(), // id
69
+ NameSS.str().c_str(), // name
70
+ "ml", // family
71
+ "netdata.metric_types", // ctx
72
+ "Dimensions by metric type", // title
73
+ "dimensions", // units
74
+ "netdata", // plugin
75
+ "ml", // module
76
+ NETDATA_ML_CHART_PRIO_METRIC_TYPES, // priority
77
+ RH->rrd_update_every, // update_every
78
+ RRDSET_TYPE_LINE // chart_type
79
+ );
80
+ rrdset_flag_set(MetricTypesRS, RRDSET_FLAG_ANOMALY_DETECTION);
81
+
82
+ Constant = rrddim_add(MetricTypesRS, "constant", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
83
+ Variable = rrddim_add(MetricTypesRS, "variable", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
84
+ }
85
+
86
+ rrddim_set_by_pointer(MetricTypesRS, Constant, MLS.NumMetricTypeConstant);
87
+ rrddim_set_by_pointer(MetricTypesRS, Variable, MLS.NumMetricTypeVariable);
88
+
89
+ rrdset_done(MetricTypesRS);
90
+ }
91
22
- RS = rrdset_create(
23
- RH,
24
- "anomaly_detection", // type
25
- IdSS.str().c_str(), // id
26
- NameSS.str().c_str(), // name
27
- "dimensions", // family
28
- "anomaly_detection.dimensions", // ctx
29
- "Anomaly detection dimensions", // title
30
- "dimensions", // units
31
- "netdata", // plugin
32
- "ml", // module
33
- 39183, // priority
34
- RH->rrd_update_every, // update_every
35
- RRDSET_TYPE_LINE // chart_type
36
- );
37
- rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
38
-
39
- NumTotalDimensionsRD = rrddim_add(RS, "total", NULL,
40
- 1, 1, RRD_ALGORITHM_ABSOLUTE);
41
- NumTrainedDimensionsRD = rrddim_add(RS, "trained", NULL,
42
- 1, 1, RRD_ALGORITHM_ABSOLUTE);
43
- NumNormalDimensionsRD = rrddim_add(RS, "normal", NULL,
44
- 1, 1, RRD_ALGORITHM_ABSOLUTE);
45
- NumAnomalousDimensionsRD = rrddim_add(RS, "anomalous", NULL,
46
- 1, 1, RRD_ALGORITHM_ABSOLUTE);
92
+ /*
93
+ * Training status
94
+ */
95
+ {
96
+ static thread_local RRDSET *TrainingStatusRS = nullptr;
97
+
98
+ static thread_local RRDDIM *Untrained = nullptr;
99
+ static thread_local RRDDIM *PendingWithoutModel = nullptr;
100
+ static thread_local RRDDIM *Trained = nullptr;
101
+ static thread_local RRDDIM *PendingWithModel = nullptr;
102
+
103
+ if (!TrainingStatusRS) {
104
+ std::stringstream IdSS, NameSS;
105
+
106
+ IdSS << "training_status_for_" << localhost->machine_guid;
107
+ NameSS << "training_status_for_" << localhost->hostname;
108
+
109
+ TrainingStatusRS = rrdset_create_localhost(
110
+ "netdata", // type
111
+ IdSS.str().c_str(), // id
112
+ NameSS.str().c_str(), // name
113
+ "ml", // family
114
+ "netdata.training_status", // ctx
115
+ "Training status of dimensions", // title
116
+ "dimensions", // units
117
+ "netdata", // plugin
118
+ "ml", // module
119
+ NETDATA_ML_CHART_PRIO_TRAINING_STATUS, // priority
120
+ RH->rrd_update_every, // update_every
121
+ RRDSET_TYPE_LINE // chart_type
122
+ );
123
+
124
+ rrdset_flag_set(TrainingStatusRS, RRDSET_FLAG_ANOMALY_DETECTION);
125
+
126
+ Untrained = rrddim_add(TrainingStatusRS, "untrained", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
127
+ PendingWithoutModel = rrddim_add(TrainingStatusRS, "pending-without-model", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
128
+ Trained = rrddim_add(TrainingStatusRS, "trained", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
129
+ PendingWithModel = rrddim_add(TrainingStatusRS, "pending-with-model", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
130
+ }
131
+
132
+ rrddim_set_by_pointer(TrainingStatusRS, Untrained, MLS.NumTrainingStatusUntrained);
133
+ rrddim_set_by_pointer(TrainingStatusRS, PendingWithoutModel, MLS.NumTrainingStatusPendingWithoutModel);
134
+ rrddim_set_by_pointer(TrainingStatusRS, Trained, MLS.NumTrainingStatusTrained);
135
+ rrddim_set_by_pointer(TrainingStatusRS, PendingWithModel, MLS.NumTrainingStatusPendingWithModel);
136
+
137
+ rrdset_done(TrainingStatusRS);
138
}
139
49
- rrddim_set_by_pointer(RS, NumTotalDimensionsRD, NumNormalDimensions + NumAnomalousDimensions);
50
- rrddim_set_by_pointer(RS, NumTrainedDimensionsRD, NumTrainedDimensions);
51
- rrddim_set_by_pointer(RS, NumNormalDimensionsRD, NumNormalDimensions);
52
- rrddim_set_by_pointer(RS, NumAnomalousDimensionsRD, NumAnomalousDimensions);
140
+ /*
141
+ * Prediction status
142
+ */
143
+ {
144
+ static thread_local RRDSET *PredictionRS = nullptr;
145
+
146
+ static thread_local RRDDIM *Anomalous = nullptr;
147
+ static thread_local RRDDIM *Normal = nullptr;
148
+
149
+ if (!PredictionRS) {
150
+ std::stringstream IdSS, NameSS;
151
+
152
+ IdSS << "dimensions_on_" << localhost->machine_guid;
153
+ NameSS << "dimensions_on_" << localhost->hostname;
154
+
155
+ PredictionRS = rrdset_create(
156
+ RH,
157
+ "anomaly_detection", // type
158
+ IdSS.str().c_str(), // id
159
+ NameSS.str().c_str(), // name
160
+ "dimensions", // family
161
+ "anomaly_detection.dimensions", // ctx
162
+ "Anomaly detection dimensions", // title
163
+ "dimensions", // units
164
+ "netdata", // plugin
165
+ "ml", // module
166
+ ML_CHART_PRIO_DIMENSIONS, // priority
167
+ RH->rrd_update_every, // update_every
168
+ RRDSET_TYPE_LINE // chart_type
169
+ );
170
+ rrdset_flag_set(PredictionRS, RRDSET_FLAG_ANOMALY_DETECTION);
171
+
172
+ Anomalous = rrddim_add(PredictionRS, "anomalous", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
173
+ Normal = rrddim_add(PredictionRS, "normal", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
174
+ }
175
+
176
+ rrddim_set_by_pointer(PredictionRS, Anomalous, MLS.NumAnomalousDimensions);
177
+ rrddim_set_by_pointer(PredictionRS, Normal, MLS.NumNormalDimensions);
178
+
179
+ rrdset_done(PredictionRS);
180
+ }
181
54
- rrdset_done(RS);
182
}
183
184
void ml::updateHostAndDetectionRateCharts(RRDHOST *RH, collected_number AnomalyRate) {
202
"percentage", // units
203
"netdata", // plugin
204
"ml", // module
78
- 39184, // priority
205
+ ML_CHART_PRIO_ANOMALY_RATE, // priority
206
RH->rrd_update_every, // update_every
207
RRDSET_TYPE_LINE // chart_type
208
);
236
"percentage", // units
237
"netdata", // plugin
238
"ml", // module
112
- 39185, // priority
239
+ ML_CHART_PRIO_DETECTOR_EVENTS, // priority
240
RH->rrd_update_every, // update_every
241
RRDSET_TYPE_LINE // chart_type
242
);
270
0, /* tier */
271
QUERY_SOURCE_ML
272
);
273
+
274
if(R) {
275
assert(R->d == 1 && R->n == 1 && R->rows == 1);
276
285
286
rrdr_free(OWA, R);
287
}
288
+
289
onewayalloc_destroy(OWA);
290
}
291
163
-void ml::updateDetectionChart(RRDHOST *RH) {
164
- static thread_local RRDSET *RS = nullptr;
165
- static thread_local RRDDIM *UserRD, *SystemRD = nullptr;
166
-
167
- if (!RS) {
168
- std::stringstream IdSS, NameSS;
169
-
170
- IdSS << "prediction_stats_" << RH->machine_guid;
171
- NameSS << "prediction_stats_for_" << RH->hostname;
172
-
173
- RS = rrdset_create_localhost(
174
- "netdata", // type
175
- IdSS.str().c_str(), // id
176
- NameSS.str().c_str(), // name
177
- "ml", // family
178
- "netdata.prediction_stats", // ctx
179
- "Prediction thread CPU usage", // title
180
- "milliseconds/s", // units
181
- "netdata", // plugin
182
- "ml", // module
183
- 136000, // priority
184
- RH->rrd_update_every, // update_every
185
- RRDSET_TYPE_STACKED // chart_type
186
- );
187
-
188
- UserRD = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
189
- SystemRD = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
292
+void ml::updateResourceUsageCharts(RRDHOST *RH, const struct rusage &PredictionRU, const struct rusage &TrainingRU) {
293
+ /*
294
+ * prediction rusage
295
+ */
296
+ {
297
+ static thread_local RRDSET *RS = nullptr;
298
+
299
+ static thread_local RRDDIM *User = nullptr;
300
+ static thread_local RRDDIM *System = nullptr;
301
+
302
+ if (!RS) {
303
+ std::stringstream IdSS, NameSS;
304
+
305
+ IdSS << "prediction_usage_for_" << localhost->machine_guid;
306
+ NameSS << "prediction_usage_for_" << localhost->hostname;
307
+
308
+ RS = rrdset_create_localhost(
309
+ "netdata", // type
310
+ IdSS.str().c_str(), // id
311
+ NameSS.str().c_str(), // name
312
+ "ml", // family
313
+ "netdata.prediction_usage", // ctx
314
+ "Prediction resource usage", // title
315
+ "milliseconds/s", // units
316
+ "netdata", // plugin
317
+ "ml", // module
318
+ NETDATA_ML_CHART_PRIO_PREDICTION_USAGE, // priority
319
+ RH->rrd_update_every, // update_every
320
+ RRDSET_TYPE_STACKED // chart_type
321
+ );
322
+ rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
323
+
324
+ User = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
325
+ System = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
326
+ }
327
+
328
+ rrddim_set_by_pointer(RS, User, PredictionRU.ru_utime.tv_sec * 1000000ULL + PredictionRU.ru_utime.tv_usec);
329
+ rrddim_set_by_pointer(RS, System, PredictionRU.ru_stime.tv_sec * 1000000ULL + PredictionRU.ru_stime.tv_usec);
330
+
331
+ rrdset_done(RS);
332
}
333
192
- struct rusage TRU;
193
- getrusage(RUSAGE_THREAD, &TRU);
194
-
195
- rrddim_set_by_pointer(RS, UserRD, TRU.ru_utime.tv_sec * 1000000ULL + TRU.ru_utime.tv_usec);
196
- rrddim_set_by_pointer(RS, SystemRD, TRU.ru_stime.tv_sec * 1000000ULL + TRU.ru_stime.tv_usec);
197
- rrdset_done(RS);
334
+ /*
335
+ * training rusage
336
+ */
337
+ {
338
+ static thread_local RRDSET *RS = nullptr;
339
+
340
+ static thread_local RRDDIM *User = nullptr;
341
+ static thread_local RRDDIM *System = nullptr;
342
+
343
+ if (!RS) {
344
+ std::stringstream IdSS, NameSS;
345
+
346
+ IdSS << "training_usage_for_" << localhost->machine_guid;
347
+ NameSS << "training_usage_for_" << localhost->hostname;
348
+
349
+ RS = rrdset_create_localhost(
350
+ "netdata", // type
351
+ IdSS.str().c_str(), // id
352
+ NameSS.str().c_str(), // name
353
+ "ml", // family
354
+ "netdata.training_usage", // ctx
355
+ "Training resource usage", // title
356
+ "milliseconds/s", // units
357
+ "netdata", // plugin
358
+ "ml", // module
359
+ NETDATA_ML_CHART_PRIO_TRAINING_USAGE, // priority
360
+ RH->rrd_update_every, // update_every
361
+ RRDSET_TYPE_STACKED // chart_type
362
+ );
363
+ rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
364
+
365
+ User = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
366
+ System = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
367
+ }
368
+
369
+ rrddim_set_by_pointer(RS, User, TrainingRU.ru_utime.tv_sec * 1000000ULL + TrainingRU.ru_utime.tv_usec);
370
+ rrddim_set_by_pointer(RS, System, TrainingRU.ru_stime.tv_sec * 1000000ULL + TrainingRU.ru_stime.tv_usec);
371
+
372
+ rrdset_done(RS);
373
+ }
374
}
375
200
-void ml::updateTrainingChart(RRDHOST *RH, struct rusage *TRU) {
201
- static thread_local RRDSET *RS = nullptr;
202
- static thread_local RRDDIM *UserRD = nullptr;
203
- static thread_local RRDDIM *SystemRD = nullptr;
204
-
205
- if (!RS) {
206
- std::stringstream IdSS, NameSS;
207
-
208
- IdSS << "training_stats_" << RH->machine_guid;
209
- NameSS << "training_stats_for_" << RH->hostname;
210
-
211
- RS = rrdset_create_localhost(
212
- "netdata", // type
213
- IdSS.str().c_str(), // id
214
- NameSS.str().c_str(), // name
215
- "ml", // family
216
- "netdata.training_stats", // ctx
217
- "Training thread CPU usage", // title
218
- "milliseconds/s", // units
219
- "netdata", // plugin
220
- "ml", // module
221
- 136001, // priority
222
- RH->rrd_update_every, // update_every
223
- RRDSET_TYPE_STACKED // chart_type
224
- );
376
+void ml::updateTrainingStatisticsChart(RRDHOST *RH, const TrainingStats &TS) {
377
+ /*
378
+ * queue stats
379
+ */
380
+ {
381
+ static thread_local RRDSET *RS = nullptr;
382
+
383
+ static thread_local RRDDIM *QueueSize = nullptr;
384
+ static thread_local RRDDIM *PoppedItems = nullptr;
385
+
386
+ if (!RS) {
387
+ std::stringstream IdSS, NameSS;
388
+
389
+ IdSS << "queue_stats_for_" << localhost->machine_guid;
390
+ NameSS << "queue_stats_for_" << localhost->hostname;
391
+
392
+ RS = rrdset_create_localhost(
393
+ "netdata", // type
394
+ IdSS.str().c_str(), // id
395
+ NameSS.str().c_str(), // name
396
+ "ml", // family
397
+ "netdata.queue_stats", // ctx
398
+ "Training queue stats", // title
399
+ "items", // units
400
+ "netdata", // plugin
401
+ "ml", // module
402
+ NETDATA_ML_CHART_PRIO_QUEUE_STATS, // priority
403
+ RH->rrd_update_every, // update_every
404
+ RRDSET_TYPE_LINE// chart_type
405
+ );
406
+ rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
407
+
408
+ QueueSize = rrddim_add(RS, "queue_size", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
409
+ PoppedItems = rrddim_add(RS, "popped_items", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
410
+ }
411
+
412
+ rrddim_set_by_pointer(RS, QueueSize, TS.QueueSize);
413
+ rrddim_set_by_pointer(RS, PoppedItems, TS.NumPoppedItems);
414
+
415
+ rrdset_done(RS);
416
+ }
417
226
- UserRD = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
227
- SystemRD = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
418
+ /*
419
+ * training stats
420
+ */
421
+ {
422
+ static thread_local RRDSET *RS = nullptr;
423
+
424
+ static thread_local RRDDIM *Allotted = nullptr;
425
+ static thread_local RRDDIM *Consumed = nullptr;
426
+ static thread_local RRDDIM *Remaining = nullptr;
427
+
428
+ if (!RS) {
429
+ std::stringstream IdSS, NameSS;
430
+
431
+ IdSS << "training_time_stats_for_" << localhost->machine_guid;
432
+ NameSS << "training_time_stats_for_" << localhost->hostname;
433
+
434
+ RS = rrdset_create_localhost(
435
+ "netdata", // type
436
+ IdSS.str().c_str(), // id
437
+ NameSS.str().c_str(), // name
438
+ "ml", // family
439
+ "netdata.training_time_stats", // ctx
440
+ "Training time stats", // title
441
+ "milliseconds", // units
442
+ "netdata", // plugin
443
+ "ml", // module
444
+ NETDATA_ML_CHART_PRIO_TRAINING_TIME_STATS, // priority
445
+ RH->rrd_update_every, // update_every
446
+ RRDSET_TYPE_LINE// chart_type
447
+ );
448
+ rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
449
+
450
+ Allotted = rrddim_add(RS, "allotted", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
451
+ Consumed = rrddim_add(RS, "consumed", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
452
+ Remaining = rrddim_add(RS, "remaining", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
453
+ }
454
+
455
+ rrddim_set_by_pointer(RS, Allotted, TS.AllottedUT);
456
+ rrddim_set_by_pointer(RS, Consumed, TS.ConsumedUT);
457
+ rrddim_set_by_pointer(RS, Remaining, TS.RemainingUT);
458
+
459
+ rrdset_done(RS);
460
}
461
230
- rrddim_set_by_pointer(RS, UserRD, TRU->ru_utime.tv_sec * 1000000ULL + TRU->ru_utime.tv_usec);
231
- rrddim_set_by_pointer(RS, SystemRD, TRU->ru_stime.tv_sec * 1000000ULL + TRU->ru_stime.tv_usec);
232
- rrdset_done(RS);
462
+ /*
463
+ * training result stats
464
+ */
465
+ {
466
+ static thread_local RRDSET *RS = nullptr;
467
+
468
+ static thread_local RRDDIM *Ok = nullptr;
469
+ static thread_local RRDDIM *InvalidQueryTimeRange = nullptr;
470
+ static thread_local RRDDIM *NotEnoughCollectedValues = nullptr;
471
+ static thread_local RRDDIM *NullAcquiredDimension = nullptr;
472
+ static thread_local RRDDIM *ChartUnderReplication = nullptr;
473
+
474
+ if (!RS) {
475
+ std::stringstream IdSS, NameSS;
476
+
477
+ IdSS << "training_results_for_" << localhost->machine_guid;
478
+ NameSS << "training_results_for_" << localhost->hostname;
479
+
480
+ RS = rrdset_create_localhost(
481
+ "netdata", // type
482
+ IdSS.str().c_str(), // id
483
+ NameSS.str().c_str(), // name
484
+ "ml", // family
485
+ "netdata.training_results", // ctx
486
+ "Training results", // title
487
+ "events", // units
488
+ "netdata", // plugin
489
+ "ml", // module
490
+ NETDATA_ML_CHART_PRIO_TRAINING_RESULTS, // priority
491
+ RH->rrd_update_every, // update_every
492
+ RRDSET_TYPE_LINE// chart_type
493
+ );
494
+ rrdset_flag_set(RS, RRDSET_FLAG_ANOMALY_DETECTION);
495
+
496
+ Ok = rrddim_add(RS, "ok", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
497
+ InvalidQueryTimeRange = rrddim_add(RS, "invalid-queries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
498
+ NotEnoughCollectedValues = rrddim_add(RS, "not-enough-values", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
499
+ NullAcquiredDimension = rrddim_add(RS, "null-acquired-dimensions", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
500
+ ChartUnderReplication = rrddim_add(RS, "chart-under-replication", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
501
+ }
502
+
503
+ rrddim_set_by_pointer(RS, Ok, TS.TrainingResultOk);
504
+ rrddim_set_by_pointer(RS, InvalidQueryTimeRange, TS.TrainingResultInvalidQueryTimeRange);
505
+ rrddim_set_by_pointer(RS, NotEnoughCollectedValues, TS.TrainingResultNotEnoughCollectedValues);
506
+ rrddim_set_by_pointer(RS, NullAcquiredDimension, TS.TrainingResultNullAcquiredDimension);
507
+ rrddim_set_by_pointer(RS, ChartUnderReplication, TS.TrainingResultChartUnderReplication);
508
+
509
+ rrdset_done(RS);
510
+ }
511
}