diff options
author | vkalintiris <vasilis@netdata.cloud> | 2022-11-22 04:52:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 04:52:15 +0200 |
commit | 2d5f3acf71f0c759056a3269987fee484566bc4c (patch) | |
tree | 5246e1080ea721ba84e5f749f8d8e98d978d81c8 /database | |
parent | 147552807bc19af949fe3cb315c4743dadfa7f0b (diff) |
Do not force internal collectors to call rrdset_next. (#13926)
* Remove calls to rrdset_next().
* Rm checks plugin
* Update documentantion
* Call rrdset_next from within rrdset_done
This wraps up the removal of rrdset_next from internal collectors, which
removes a lot of unecessary code and the need for if/else clauses in
every place.
The pluginsd parser is the only component that calls rrdset_next*()
functions because it's not strictly speaking a collector but more of a
collector manager/proxy.
With the current changes it's possible to simplify the API we expose
from RRD significantly, but this will be follow-up work in the future.
* Remove stale reference to checks.plugin
* Fix RRD unit test
rrdset_next is not meant to be called from these tests.
* Fix db engine unit test.
* Schedule rrdset_next when we have completed at least one collection.
* Mark chart creation clauses as unlikely.
* Add missing brace to fix FreeBSD plugin.
Diffstat (limited to 'database')
-rw-r--r-- | database/rrd.h | 2 | ||||
-rw-r--r-- | database/rrdset.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/database/rrd.h b/database/rrd.h index dda3e5f9a2..acd0032d47 100644 --- a/database/rrd.h +++ b/database/rrd.h @@ -1253,7 +1253,7 @@ void rrdset_next_usec(RRDSET *st, usec_t microseconds); void rrdset_timed_next(RRDSET *st, struct timeval now, usec_t microseconds); #define rrdset_next(st) rrdset_next_usec(st, 0ULL) -void rrdset_timed_done(RRDSET *st, struct timeval now); +void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next); void rrdset_done(RRDSET *st); void rrdset_is_obsolete(RRDSET *st); diff --git a/database/rrdset.c b/database/rrdset.c index d69c830bb1..fcfba94273 100644 --- a/database/rrdset.c +++ b/database/rrdset.c @@ -1386,12 +1386,15 @@ void rrdset_done(RRDSET *st) { struct timeval now; now_realtime_timeval(&now); - rrdset_timed_done(st, now); + rrdset_timed_done(st, now, /* pending_rrdset_next = */ st->counter_done != 0); } -void rrdset_timed_done(RRDSET *st, struct timeval now) { +void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next) { if(unlikely(netdata_exit)) return; + if (pending_rrdset_next) + rrdset_next(st); + debug(D_RRD_CALLS, "rrdset_done() for chart '%s'", rrdset_name(st)); RRDDIM *rd; |