From af0a635d1f444eef10ec2027242d2f43666e6275 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Fri, 18 Mar 2016 15:56:39 +0100 Subject: [PATCH] Added node names to Prometheus metrics link_tq. --- hopglass-server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hopglass-server.js b/hopglass-server.js index 559fc56..ea420d2 100755 --- a/hopglass-server.js +++ b/hopglass-server.js @@ -514,7 +514,10 @@ function getMetrics(stream) { if (source === undefined) { source = src.replace(/:/g, '') } - stream.write('link_tq{source="' + source + '",target="' + target + '"} ' + tq + '\n') + var source_name = _.get(data, [source, 'nodeinfo', 'hostname'], source) + var target_name = _.get(data, [target, 'nodeinfo', 'hostname'], target) + stream.write('link_tq{source="' + source + '",target="' + target + + '",source_name="' + source_name + '",target_name="' + target_name + '"} ' + tq + '\n') } } }