summaryrefslogtreecommitdiffstats
path: root/ml
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-11-22 04:52:15 +0200
committerGitHub <noreply@github.com>2022-11-22 04:52:15 +0200
commit2d5f3acf71f0c759056a3269987fee484566bc4c (patch)
tree5246e1080ea721ba84e5f749f8d8e98d978d81c8 /ml
parent147552807bc19af949fe3cb315c4743dadfa7f0b (diff)
Do not force internal collectors to call rrdset_next. (#13926)
* Remove calls to rrdset_next(). * Rm checks plugin * Update documentantion * Call rrdset_next from within rrdset_done This wraps up the removal of rrdset_next from internal collectors, which removes a lot of unecessary code and the need for if/else clauses in every place. The pluginsd parser is the only component that calls rrdset_next*() functions because it's not strictly speaking a collector but more of a collector manager/proxy. With the current changes it's possible to simplify the API we expose from RRD significantly, but this will be follow-up work in the future. * Remove stale reference to checks.plugin * Fix RRD unit test rrdset_next is not meant to be called from these tests. * Fix db engine unit test. * Schedule rrdset_next when we have completed at least one collection. * Mark chart creation clauses as unlikely. * Add missing brace to fix FreeBSD plugin.
Diffstat (limited to 'ml')
-rw-r--r--ml/ADCharts.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/ml/ADCharts.cc b/ml/ADCharts.cc
index 5c207ed199..edf1cbe57d 100644
--- a/ml/ADCharts.cc
+++ b/ml/ADCharts.cc
@@ -44,8 +44,7 @@ void ml::updateDimensionsChart(RRDHOST *RH,
1, 1, RRD_ALGORITHM_ABSOLUTE);
NumAnomalousDimensionsRD = rrddim_add(RS, "anomalous", NULL,
1, 1, RRD_ALGORITHM_ABSOLUTE);
- } else
- rrdset_next(RS);
+ }
rrddim_set_by_pointer(RS, NumTotalDimensionsRD, NumNormalDimensions + NumAnomalousDimensions);
rrddim_set_by_pointer(RS, NumTrainedDimensionsRD, NumTrainedDimensions);
@@ -84,8 +83,7 @@ void ml::updateHostAndDetectionRateCharts(RRDHOST *RH, collected_number AnomalyR
AnomalyRateRD = rrddim_add(HostRateRS, "anomaly_rate", NULL,
1, 100, RRD_ALGORITHM_ABSOLUTE);
- } else
- rrdset_next(HostRateRS);
+ }
rrddim_set_by_pointer(HostRateRS, AnomalyRateRD, AnomalyRate);
rrdset_done(HostRateRS);
@@ -121,8 +119,7 @@ void ml::updateHostAndDetectionRateCharts(RRDHOST *RH, collected_number AnomalyR
1, 1, RRD_ALGORITHM_ABSOLUTE);
NewAnomalyEventRD = rrddim_add(AnomalyDetectionRS, "new_anomaly_event", NULL,
1, 1, RRD_ALGORITHM_ABSOLUTE);
- } else
- rrdset_next(AnomalyDetectionRS);
+ }
/*
* Compute the values of the dimensions based on the host rate chart
@@ -189,8 +186,7 @@ void ml::updateDetectionChart(RRDHOST *RH) {
UserRD = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
SystemRD = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
- } else
- rrdset_next(RS);
+ }
struct rusage TRU;
getrusage(RUSAGE_THREAD, &TRU);
@@ -228,8 +224,7 @@ void ml::updateTrainingChart(RRDHOST *RH, struct rusage *TRU) {
UserRD = rrddim_add(RS, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
SystemRD = rrddim_add(RS, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
- } else
- rrdset_next(RS);
+ }
rrddim_set_by_pointer(RS, UserRD, TRU->ru_utime.tv_sec * 1000000ULL + TRU->ru_utime.tv_usec);
rrddim_set_by_pointer(RS, SystemRD, TRU->ru_stime.tv_sec * 1000000ULL + TRU->ru_stime.tv_usec);