Reduce the number of ACLK chart updates during chart obsoletion (#11133)
Stelios Fragkakis committed
May 12, 2021 at 18:16 UTC
51a1d131f0bc62a9d8ed65903e4b2481bc21eb99
2 files changed
+11
-1
database/rrd.h
+3
@@ -764,6 +764,9 @@ struct rrdhost {
764
const char *os; // the O/S type of the host
765
const char *tags; // tags for this host
766
const char *timezone; // the timezone of the host
767
+#ifdef ENABLE_ACLK
768
+ long obsolete_count;
769
+#endif
770
771
RRDHOST_FLAGS flags; // flags about this RRDHOST
772
RRDHOST_FLAGS *exporting_flags; // array of flags for exporting connector instances
database/rrdset.c
+8
-1
@@ -452,7 +452,7 @@ void rrdset_delete_custom(RRDSET *st, int db_rotated) {
452
#ifdef ENABLE_ACLK
453
if ((netdata_cloud_setting) && (db_rotated || RRD_MEMORY_MODE_DBENGINE != st->rrd_memory_mode)) {
454
aclk_del_collector(st->rrdhost, st->plugin_name, st->module_name);
455
- aclk_update_chart(st->rrdhost, st->id, ACLK_CMD_CHARTDEL);
455
+ st->rrdhost->obsolete_count++;
456
}
457
#endif
458
@@ -932,7 +932,14 @@ RRDSET *rrdset_create_custom(
932
933
store_active_chart(st->chart_uuid);
934
935
+#ifdef ENABLE_ACLK
936
+ host->obsolete_count = 0;
937
+#endif
938
rrdhost_cleanup_obsolete_charts(host);
939
+#ifdef ENABLE_ACLK
940
+ if (host->obsolete_count)
941
+ aclk_update_chart(st->rrdhost, "dummy-chart", ACLK_CMD_CHARTDEL);
942
+#endif
943
944
rrdhost_unlock(host);
945
#ifdef ENABLE_ACLK