summaryrefslogtreecommitdiffstats
path: root/ml
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2022-11-28 12:22:38 +0200
committerGitHub <noreply@github.com>2022-11-28 12:22:38 +0200
commit53a13ab8e110923d097968353a6bc1e22399480f (patch)
treea22fe110436844fcc0331073d37182adefbf0edc /ml
parent1e9f2c7a2a866be27203c528067adecd283e0ceb (diff)
replication fixes No 7 (#14053)
* move global statistics workers to a separate thread; query statistics per query source; query statistics for ML, exporters, backfilling; reset replication point in time every 10 seconds, instead of every 1; fix compilation warnings; optimize the replication queries code; prevent long tail of replication requests (big sleeps); provide query statistics about replication ; optimize replication sender when most senders are full; optimize replication_request_get_first_available(); reset replication completion calculation; * remove workers utilization from global statistics thread
Diffstat (limited to 'ml')
-rw-r--r--ml/ADCharts.cc3
-rw-r--r--ml/Query.h8
2 files changed, 9 insertions, 2 deletions
diff --git a/ml/ADCharts.cc b/ml/ADCharts.cc
index edf1cbe57d..00c593c0c4 100644
--- a/ml/ADCharts.cc
+++ b/ml/ADCharts.cc
@@ -140,7 +140,8 @@ void ml::updateHostAndDetectionRateCharts(RRDHOST *RH, collected_number AnomalyR
Options, "anomaly_rate",
NULL /* group options */,
0, /* timeout */
- 0 /* tier */
+ 0, /* tier */
+ QUERY_SOURCE_ML
);
if(R) {
assert(R->d == 1 && R->n == 1 && R->rows == 1);
diff --git a/ml/Query.h b/ml/Query.h
index 5910b575b4..78d1170033 100644
--- a/ml/Query.h
+++ b/ml/Query.h
@@ -22,6 +22,7 @@ public:
void init(time_t AfterT, time_t BeforeT) {
Ops->init(RD->tiers[0]->db_metric_handle, &Handle, AfterT, BeforeT);
Initialized = true;
+ points_read = 0;
}
bool isFinished() {
@@ -29,11 +30,15 @@ public:
}
~Query() {
- if (Initialized)
+ if (Initialized) {
Ops->finalize(&Handle);
+ global_statistics_ml_query_completed(points_read);
+ points_read = 0;
+ }
}
std::pair<time_t, CalculatedNumber> nextMetric() {
+ points_read++;
STORAGE_POINT sp = Ops->next_metric(&Handle);
return { sp.start_time, sp.sum / sp.count };
}
@@ -41,6 +46,7 @@ public:
private:
RRDDIM *RD;
bool Initialized;
+ size_t points_read;
struct storage_engine_query_ops *Ops;
struct storage_engine_query_handle Handle;