diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-03-13 19:33:34 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-03-13 19:33:34 +0200 |
commit | 00e13dd0b5ee577fbd399b43c942d6b78301e06b (patch) | |
tree | 4321c9961b38fe4eeb18176683fd9ebbfe33b2d9 | |
parent | a00edb835974a8e2e36fef2d3e6b37708446402d (diff) |
do not send netdata_info with timestamps when timestamps=no
-rw-r--r-- | src/backend_prometheus.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend_prometheus.c b/src/backend_prometheus.c index 0f84b34323..bfcda9297a 100644 --- a/src/backend_prometheus.c +++ b/src/backend_prometheus.c @@ -118,7 +118,10 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER char labels[PROMETHEUS_LABELS_MAX + 1] = ""; if(allhosts) { - buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1 %llu\n", hostname, host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS); + if(timestamps) + buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1 %llu\n", hostname, host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS); + else + buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1\n", hostname, host->program_name, host->program_version); if(host->tags && *(host->tags)) { if(timestamps) { @@ -139,7 +142,10 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER snprintfz(labels, PROMETHEUS_LABELS_MAX, ",instance=\"%s\"", hostname); } else { - buffer_sprintf(wb, "netdata_info{application=\"%s\",version=\"%s\"} 1 %llu\n", host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS); + if(timestamps) + buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1 %llu\n", hostname, host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS); + else + buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1\n", hostname, host->program_name, host->program_version); if(host->tags && *(host->tags)) { if(timestamps) { |