summaryrefslogtreecommitdiffstats
path: root/database/rrdhost.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
commit89f3604407aff8f4cb2ed958252c61e23c767e24 (patch)
tree7fbf408102cab051557d38193524d8c6e991d070 /database/rrdhost.c
parentAdding upstream version 1.34.1. (diff)
downloadnetdata-89f3604407aff8f4cb2ed958252c61e23c767e24.tar.xz
netdata-89f3604407aff8f4cb2ed958252c61e23c767e24.zip
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/rrdhost.c')
-rw-r--r--database/rrdhost.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/database/rrdhost.c b/database/rrdhost.c
index 649736ca4..cb56bf353 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -181,6 +181,8 @@ RRDHOST *rrdhost_create(const char *hostname,
host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0;
host->rrdpush_send_destination = (host->rrdpush_send_enabled)?strdupz(rrdpush_destination):NULL;
+ if (host->rrdpush_send_destination)
+ host->destinations = destinations_init(host->rrdpush_send_destination);
host->rrdpush_send_api_key = (host->rrdpush_send_enabled)?strdupz(rrdpush_api_key):NULL;
host->rrdpush_send_charts_matching = simple_pattern_create(rrdpush_send_charts_matching, NULL, SIMPLE_PATTERN_EXACT);
@@ -390,6 +392,7 @@ RRDHOST *rrdhost_create(const char *hostname,
if (is_localhost && host->system_info) {
host->system_info->ml_capable = ml_capable();
host->system_info->ml_enabled = ml_enabled(host);
+ host->system_info->mc_version = enable_metric_correlations ? metric_correlations_version : 0;
}
ml_new_host(host);
@@ -698,7 +701,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info) {
if (gap_when_lost_iterations_above < 1)
gap_when_lost_iterations_above = 1;
- if (unlikely(sql_init_database(DB_CHECK_NONE))) {
+ if (unlikely(sql_init_database(DB_CHECK_NONE, 0))) {
if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE)
fatal("Failed to initialize SQLite");
info("Skipping SQLITE metadata initialization since memory mode is not db engine");
@@ -1488,9 +1491,8 @@ restart_after_removal:
continue;
}
#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
- else {
- aclk_send_dimension_update(rd);
- }
+ else
+ queue_dimension_to_aclk(rd, rd->last_collected_time.tv_sec);
#endif
}
last = rd;
@@ -1528,6 +1530,18 @@ restart_after_removal:
}
}
+void rrdset_check_obsoletion(RRDHOST *host)
+{
+ RRDSET *st;
+ time_t last_entry_t;
+ rrdset_foreach_read(st, host) {
+ last_entry_t = rrdset_last_entry_t(st);
+ if (last_entry_t && last_entry_t < host->senders_connect_time) {
+ rrdset_is_obsolete(st);
+ }
+ }
+}
+
void rrd_cleanup_obsolete_charts()
{
rrd_rdlock();
@@ -1547,6 +1561,16 @@ void rrd_cleanup_obsolete_charts()
#endif
rrdhost_unlock(host);
}
+
+ if (host != localhost &&
+ host->trigger_chart_obsoletion_check &&
+ host->senders_last_chart_command &&
+ host->senders_last_chart_command + 120 < now_realtime_sec()) {
+ rrdhost_rdlock(host);
+ rrdset_check_obsoletion(host);
+ rrdhost_unlock(host);
+ host->trigger_chart_obsoletion_check = 0;
+ }
}
rrd_unlock();