summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2021-05-12 18:16:48 +0300
committerGitHub <noreply@github.com>2021-05-12 18:16:48 +0300
commit51a1d131f0bc62a9d8ed65903e4b2481bc21eb99 (patch)
treedab1e1efd7f256c84bd17e1cf210904de580f57a
parentfc5224329752100f823c7f3dc73a1877021db117 (diff)
Reduce the number of ACLK chart updates during chart obsoletion (#11133)
-rw-r--r--database/rrd.h3
-rw-r--r--database/rrdset.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/database/rrd.h b/database/rrd.h
index d91913864f..380ccb161f 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -764,6 +764,9 @@ struct rrdhost {
const char *os; // the O/S type of the host
const char *tags; // tags for this host
const char *timezone; // the timezone of the host
+#ifdef ENABLE_ACLK
+ long obsolete_count;
+#endif
RRDHOST_FLAGS flags; // flags about this RRDHOST
RRDHOST_FLAGS *exporting_flags; // array of flags for exporting connector instances
diff --git a/database/rrdset.c b/database/rrdset.c
index da581c0cd5..fd6605dff0 100644
--- a/database/rrdset.c
+++ b/database/rrdset.c
@@ -452,7 +452,7 @@ void rrdset_delete_custom(RRDSET *st, int db_rotated) {
#ifdef ENABLE_ACLK
if ((netdata_cloud_setting) && (db_rotated || RRD_MEMORY_MODE_DBENGINE != st->rrd_memory_mode)) {
aclk_del_collector(st->rrdhost, st->plugin_name, st->module_name);
- aclk_update_chart(st->rrdhost, st->id, ACLK_CMD_CHARTDEL);
+ st->rrdhost->obsolete_count++;
}
#endif
@@ -932,7 +932,14 @@ RRDSET *rrdset_create_custom(
store_active_chart(st->chart_uuid);
+#ifdef ENABLE_ACLK
+ host->obsolete_count = 0;
+#endif
rrdhost_cleanup_obsolete_charts(host);
+#ifdef ENABLE_ACLK
+ if (host->obsolete_count)
+ aclk_update_chart(st->rrdhost, "dummy-chart", ACLK_CMD_CHARTDEL);
+#endif
rrdhost_unlock(host);
#ifdef ENABLE_ACLK