Check for chart obsoletion on children re-connections (#12707)
* check for chart obsoletion on children connections * use rrdset_is_obsolete
This commit is contained in:
parent
22863c42b9
commit
0996abc7c0
|
@ -827,6 +827,8 @@ struct rrdhost {
|
|||
|
||||
struct receiver_state *receiver;
|
||||
netdata_mutex_t receiver_lock;
|
||||
time_t trigger_chart_obsoletion_check; // set when child connects, will instruct parent to
|
||||
// trigger a check for obsoleted charts since previous connect
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// health monitoring options
|
||||
|
|
|
@ -1528,6 +1528,16 @@ restart_after_removal:
|
|||
}
|
||||
}
|
||||
|
||||
void rrdset_check_obsoletion(RRDHOST *host)
|
||||
{
|
||||
RRDSET *st;
|
||||
rrdset_foreach_write(st, host) {
|
||||
if (rrdset_last_entry_t(st) < host->trigger_chart_obsoletion_check) {
|
||||
rrdset_is_obsolete(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rrd_cleanup_obsolete_charts()
|
||||
{
|
||||
rrd_rdlock();
|
||||
|
@ -1547,6 +1557,15 @@ void rrd_cleanup_obsolete_charts()
|
|||
#endif
|
||||
rrdhost_unlock(host);
|
||||
}
|
||||
|
||||
if (host != localhost &&
|
||||
host->trigger_chart_obsoletion_check &&
|
||||
host->trigger_chart_obsoletion_check + 120 < now_realtime_sec()) {
|
||||
rrdhost_wrlock(host);
|
||||
rrdset_check_obsoletion(host);
|
||||
rrdhost_unlock(host);
|
||||
host->trigger_chart_obsoletion_check = 0;
|
||||
}
|
||||
}
|
||||
|
||||
rrd_unlock();
|
||||
|
|
|
@ -808,7 +808,6 @@ void *health_main(void *ptr) {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (unlikely(!rrdcalc_isrunnable(rc, now, &next_run))) {
|
||||
|
|
|
@ -646,6 +646,7 @@ static int rrdpush_receive(struct receiver_state *rpt)
|
|||
rpt->host->hostname);
|
||||
}
|
||||
}
|
||||
rpt->host->trigger_chart_obsoletion_check = now_realtime_sec();
|
||||
rrdhost_unlock(rpt->host);
|
||||
|
||||
// call the plugins.d processor to receive the metrics
|
||||
|
@ -686,6 +687,7 @@ static int rrdpush_receive(struct receiver_state *rpt)
|
|||
if(health_enabled == CONFIG_BOOLEAN_AUTO)
|
||||
rpt->host->health_enabled = 0;
|
||||
}
|
||||
rpt->host->trigger_chart_obsoletion_check = 0;
|
||||
rrdhost_unlock(rpt->host);
|
||||
if (rpt->host->receiver == rpt) {
|
||||
rrdpush_sender_thread_stop(rpt->host);
|
||||
|
|
Loading…
Reference in New Issue