summaryrefslogtreecommitdiffstats
path: root/exporting/process_data.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-30 18:47:00 +0000
commit03bf87dcb06f7021bfb2df2fa8691593c6148aff (patch)
treee16b06711a2ed77cafb4b7754be0220c3d14a9d7 /exporting/process_data.c
parentAdding upstream version 1.36.1. (diff)
downloadnetdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.tar.xz
netdata-03bf87dcb06f7021bfb2df2fa8691593c6148aff.zip
Adding upstream version 1.37.0.upstream/1.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'exporting/process_data.c')
-rw-r--r--exporting/process_data.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/exporting/process_data.c b/exporting/process_data.c
index d5138b78..fbcda0d9 100644
--- a/exporting/process_data.c
+++ b/exporting/process_data.c
@@ -77,10 +77,10 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
time_t before = instance->before;
// find the edges of the rrd database for this chart
- time_t first_t = rd->tiers[0]->query_ops.oldest_time(rd->tiers[0]->db_metric_handle);
- time_t last_t = rd->tiers[0]->query_ops.latest_time(rd->tiers[0]->db_metric_handle);
+ time_t first_t = rd->tiers[0]->query_ops->oldest_time(rd->tiers[0]->db_metric_handle);
+ time_t last_t = rd->tiers[0]->query_ops->latest_time(rd->tiers[0]->db_metric_handle);
time_t update_every = st->update_every;
- struct rrddim_query_handle handle;
+ struct storage_engine_query_handle handle;
// step back a little, to make sure we have complete data collection
// for all metrics
@@ -110,9 +110,9 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
debug(
D_EXPORTING,
"EXPORTING: %s.%s.%s: aligned timeframe %lu to %lu is outside the chart's database range %lu to %lu",
- host->hostname,
- st->id,
- rd->id,
+ rrdhost_hostname(host),
+ rrdset_id(st),
+ rrddim_id(rd),
(unsigned long)after,
(unsigned long)before,
(unsigned long)first_t,
@@ -122,11 +122,13 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
*last_timestamp = before;
+ size_t points_read = 0;
size_t counter = 0;
NETDATA_DOUBLE sum = 0;
- for (rd->tiers[0]->query_ops.init(rd->tiers[0]->db_metric_handle, &handle, after, before, TIER_QUERY_FETCH_SUM); !rd->tiers[0]->query_ops.is_finished(&handle);) {
- STORAGE_POINT sp = rd->tiers[0]->query_ops.next_metric(&handle);
+ for (rd->tiers[0]->query_ops->init(rd->tiers[0]->db_metric_handle, &handle, after, before); !rd->tiers[0]->query_ops->is_finished(&handle);) {
+ STORAGE_POINT sp = rd->tiers[0]->query_ops->next_metric(&handle);
+ points_read++;
if (unlikely(storage_point_is_empty(sp))) {
// not collected
@@ -136,15 +138,16 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
sum += sp.sum;
counter += sp.count;
}
- rd->tiers[0]->query_ops.finalize(&handle);
+ rd->tiers[0]->query_ops->finalize(&handle);
+ global_statistics_exporters_query_completed(points_read);
if (unlikely(!counter)) {
debug(
D_EXPORTING,
"EXPORTING: %s.%s.%s: no values stored in database for range %lu to %lu",
- host->hostname,
- st->id,
- rd->id,
+ rrdhost_hostname(host),
+ rrdset_id(st),
+ rrddim_id(rd),
(unsigned long)after,
(unsigned long)before);
return NAN;
@@ -338,26 +341,22 @@ void prepare_buffers(struct engine *engine)
rrd_rdlock();
RRDHOST *host;
- rrdhost_foreach_read(host)
- {
- rrdhost_rdlock(host);
+ rrdhost_foreach_read(host) {
start_host_formatting(engine, host);
RRDSET *st;
- rrdset_foreach_read(st, host)
- {
- rrdset_rdlock(st);
+ rrdset_foreach_read(st, host) {
start_chart_formatting(engine, st);
RRDDIM *rd;
rrddim_foreach_read(rd, st)
metric_formatting(engine, rd);
+ rrddim_foreach_done(rd);
end_chart_formatting(engine, st);
- rrdset_unlock(st);
}
+ rrdset_foreach_done(st);
variables_formatting(engine, host);
end_host_formatting(engine, host);
- rrdhost_unlock(host);
}
rrd_unlock();
netdata_thread_enable_cancelability();