summaryrefslogtreecommitdiffstats
path: root/exporting
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-06-28 23:14:10 +0300
committerGitHub <noreply@github.com>2023-06-28 23:14:10 +0300
commit5be9be74854d00879e6d52d6432ae12b5e8558cd (patch)
tree7d2c3e28db5aa1306cc480a45f1bfdd17b3c8375 /exporting
parent26ec3b119efb9271f622047259866a6083ed6269 (diff)
rewrite /api/v2/alerts (#15257)
* rewrite /api/v2/alerts * implement searching for transition * Find transition id and issue callback * Fix parameters * call and transition filter * Search with transition as well * renames and cleanup * render flags * what if scenario for moving transitions at the top level * If transition is given, limit the query appropriately * Add alert transitions * Optimize find transition to use prepared query Drop temp table properly * enabled alert instances again * Order by when key * Order by global_id * Return last X transitions * updated field names * add ati to configurations and show all keys in debug mode * Code cleanup and optimizations * Drop temp table in case of error * Finalize temp table population statement to prevent memory leak * final changes --------- Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Diffstat (limited to 'exporting')
-rw-r--r--exporting/prometheus/prometheus.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/exporting/prometheus/prometheus.c b/exporting/prometheus/prometheus.c
index 49a3c2a32d..5736efecac 100644
--- a/exporting/prometheus/prometheus.c
+++ b/exporting/prometheus/prometheus.c
@@ -627,6 +627,8 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(
static struct format_prometheus_chart_label_callback plabels = {
.labels_buffer = NULL,
};
+
+ STRING *prometheus = string_strdupz("prometheus");
rrdset_foreach_read(st, host) {
if (likely(can_send_rrdset(instance, st, filter))) {
@@ -642,16 +644,18 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(
int as_collected = (EXPORTING_OPTIONS_DATA_SOURCE(exporting_options) == EXPORTING_SOURCE_DATA_AS_COLLECTED);
int homogeneous = 1;
int prometheus_collector = 0;
+ RRDSET_FLAGS flags = __atomic_load_n(&st->flags, __ATOMIC_RELAXED);
if (as_collected) {
- if (rrdset_flag_check(st, RRDSET_FLAG_HOMOGENEOUS_CHECK))
+ if (flags & RRDSET_FLAG_HOMOGENEOUS_CHECK)
rrdset_update_heterogeneous_flag(st);
- if (rrdset_flag_check(st, RRDSET_FLAG_HETEROGENEOUS))
+ if (flags & RRDSET_FLAG_HETEROGENEOUS)
homogeneous = 0;
- if (!strcmp(rrdset_module_name(st), "prometheus"))
+ if (st->module_name == prometheus)
prometheus_collector = 1;
- } else {
+ }
+ else {
if (EXPORTING_OPTIONS_DATA_SOURCE(exporting_options) == EXPORTING_SOURCE_DATA_AVERAGE &&
!(output_options & PROMETHEUS_OUTPUT_HIDEUNITS))
prometheus_units_copy(
@@ -953,11 +957,10 @@ void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(
prometheus_exporter_instance->before,
output_options);
- rrd_rdlock();
- rrdhost_foreach_read(host)
+ dfe_start_reentrant(rrdhost_root_index, host)
{
rrd_stats_api_v1_charts_allmetrics_prometheus(
prometheus_exporter_instance, host, filter_string, wb, prefix, exporting_options, 1, output_options);
}
- rrd_unlock();
+ dfe_done(host);
}