do not send netdata_info with timestamps when timestamps=no
Costa Tsaousis (ktsaou) committed
Mar 13, 2018 at 19:33 UTC
00e13dd0b5ee577fbd399b43c942d6b78301e06b
1 file changed
+8
-2
src/backend_prometheus.c
+8
-2
@@ -118,7 +118,10 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
118
119
char labels[PROMETHEUS_LABELS_MAX + 1] = "";
120
if(allhosts) {
121
- 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);
121
+ if(timestamps)
122
+ 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);
123
+ else
124
+ buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1\n", hostname, host->program_name, host->program_version);
125
126
if(host->tags && *(host->tags)) {
127
if(timestamps) {
@@ -139,7 +142,10 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
142
snprintfz(labels, PROMETHEUS_LABELS_MAX, ",instance=\"%s\"", hostname);
143
}
144
else {
142
- buffer_sprintf(wb, "netdata_info{application=\"%s\",version=\"%s\"} 1 %llu\n", host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS);
145
+ if(timestamps)
146
+ 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);
147
+ else
148
+ buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1\n", hostname, host->program_name, host->program_version);
149
150
if(host->tags && *(host->tags)) {
151
if(timestamps) {