diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2023-05-24 14:45:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 10:45:12 -0400 |
commit | 51e1185dc5adf4d40bc8557abca9156ced741fb5 (patch) | |
tree | 4b18a902eb6fcddc113a0373c3b9463f612558dd /exporting/prometheus | |
parent | 8084ad2a329f9f2535966bd34796c92b6f4d3ed4 (diff) |
Address issue with Thanos Receiver (#15094)
* fix_label_order: fix label order to export data for Thanos
* fix_label_order: Split chart and family inside generate_as_collected_prom_metric
* fix_label_order: Unify calls to buffer_sprintf and fix typo
Diffstat (limited to 'exporting/prometheus')
-rw-r--r-- | exporting/prometheus/prometheus.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/exporting/prometheus/prometheus.c b/exporting/prometheus/prometheus.c index 24bd215f40..7a1112abdd 100644 --- a/exporting/prometheus/prometheus.c +++ b/exporting/prometheus/prometheus.c @@ -470,12 +470,12 @@ static void generate_as_collected_prom_metric(BUFFER *wb, struct gen_parameters if (!homogeneous) buffer_sprintf(wb, "_%s", p->dimension); - buffer_sprintf(wb, "%s{chart=\"%s\",family=\"%s\"", p->suffix, p->chart, p->family); + buffer_sprintf(wb, "%s{chart=\"%s\"", p->suffix, p->chart); if (homogeneous) buffer_sprintf(wb, ",dimension=\"%s\"", p->dimension); - buffer_sprintf(wb, "%s} ", p->labels); + buffer_sprintf(wb, ",family=\"%s\"%s} ", p->family, p->labels); if (prometheus_collector) buffer_sprintf( @@ -713,30 +713,30 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus( if (output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) buffer_sprintf( wb, - "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " NETDATA_DOUBLE_FORMAT + "%s_%s%s%s{chart=\"%s\",dimension=\"%s\",family=\"%s\"%s} " NETDATA_DOUBLE_FORMAT " %llu\n", prefix, context, units, suffix, chart, - family, dimension, + family, labels, value, last_time * MSEC_PER_SEC); else buffer_sprintf( wb, - "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " NETDATA_DOUBLE_FORMAT + "%s_%s%s%s{chart=\"%s\",dimension=\"%s\",family=\"%s\"%s} " NETDATA_DOUBLE_FORMAT "\n", prefix, context, units, suffix, chart, - family, dimension, + family, labels, value); } |