summaryrefslogtreecommitdiffstats
path: root/exporting/process_data.c
diff options
context:
space:
mode:
authorboxjan <i@boxjan.li>2022-07-11 21:00:09 +0800
committerGitHub <noreply@github.com>2022-07-11 13:00:09 +0000
commit56a1808d2e72beb2cb08aea847d3e231d4eea823 (patch)
tree3cb036dfc5228c2f5f64360dcbd1aa3d5e73e341 /exporting/process_data.c
parentd0bf415190a6ebbe99533c04b2178923457edfbd (diff)
Exporting/send variables (#13221)
Diffstat (limited to 'exporting/process_data.c')
-rw-r--r--exporting/process_data.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/exporting/process_data.c b/exporting/process_data.c
index d9154f81b6..d5138b787b 100644
--- a/exporting/process_data.c
+++ b/exporting/process_data.c
@@ -259,6 +259,27 @@ void end_chart_formatting(struct engine *engine, RRDSET *st)
}
/**
+ * Format variables for every connector instance's buffer
+ *
+ * @param engine an engine data structure.
+ * @param host a data collecting host.
+ */
+void variables_formatting(struct engine *engine, RRDHOST *host)
+{
+ for (struct instance *instance = engine->instance_root; instance; instance = instance->next) {
+ if (instance->scheduled && !instance->skip_host && should_send_variables(instance)) {
+ if (instance->variables_formatting && instance->variables_formatting(instance, host) != 0){
+ error("EXPORTING: cannot format variables for %s", instance->config.name);
+ disable_instance(instance);
+ continue;
+ }
+ // sum all variables as one metrics
+ instance->stats.buffered_metrics++;
+ }
+ }
+}
+
+/**
* End host formatting for every connector instance's buffer
*
* @param engine an engine data structure.
@@ -334,7 +355,7 @@ void prepare_buffers(struct engine *engine)
end_chart_formatting(engine, st);
rrdset_unlock(st);
}
-
+ variables_formatting(engine, host);
end_host_formatting(engine, host);
rrdhost_unlock(host);
}