added netdata_host_tags_info; https://github.com/firehol/netdata/issues/3519#issuecomment-372254704
Costa Tsaousis (ktsaou) committed
Mar 12, 2018 at 12:13 UTC
0ff11cf2019cd189485439f256e0088567c4ccb5
1 file changed
+10
-2
src/backend_prometheus.c
+10
-2
@@ -120,16 +120,24 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
120
if(allhosts) {
121
buffer_sprintf(wb, "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"}\n", hostname, host->program_name, host->program_version);
122
123
- if(host->tags && *(host->tags))
123
+ if(host->tags && *(host->tags)) {
124
+ buffer_sprintf(wb, "netdata_host_tags_info{instance=\"%s\",%s} 1 %llu\n", hostname, host->tags, now_realtime_usec() / USEC_PER_MS);
125
+
126
+ // deprecated, exists only for compatibility with older queries
127
buffer_sprintf(wb, "netdata_host_tags{instance=\"%s\",%s} 1 %llu\n", hostname, host->tags, now_realtime_usec() / USEC_PER_MS);
128
+ }
129
130
snprintfz(labels, PROMETHEUS_LABELS_MAX, ",instance=\"%s\"", hostname);
131
}
132
else {
133
buffer_sprintf(wb, "netdata_info{application=\"%s\",version=\"%s\"}\n", host->program_name, host->program_version);
134
131
- if(host->tags && *(host->tags))
135
+ if(host->tags && *(host->tags)) {
136
+ buffer_sprintf(wb, "netdata_host_tags_info{%s} 1 %llu\n", host->tags, now_realtime_usec() / USEC_PER_MS);
137
+
138
+ // deprecated, exists only for compatibility with older queries
139
buffer_sprintf(wb, "netdata_host_tags{%s} 1 %llu\n", host->tags, now_realtime_usec() / USEC_PER_MS);
140
+ }
141
}
142
143
// for each chart