summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2018-03-13 19:43:49 +0200
committerGitHub <noreply@github.com>2018-03-13 19:43:49 +0200
commitf78f947429afd1999678dfc153e05cd71c6d8926 (patch)
tree4321c9961b38fe4eeb18176683fd9ebbfe33b2d9
parenta00edb835974a8e2e36fef2d3e6b37708446402d (diff)
parent00e13dd0b5ee577fbd399b43c942d6b78301e06b (diff)
Merge pull request #3547 from ktsaou/master
do not send netdata_info with timestamps when timestamps=no
-rw-r--r--src/backend_prometheus.c10
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) {