aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Chernavin <achernavin@netgate.com>2021-09-17 12:37:48 +0000
committerOle Tr�an <otroan@employees.org>2021-09-28 13:01:32 +0000
commit2430bad8951a321e0fcb50eafb562ecbdbecbb5b (patch)
treed679a9552708e4baa7e8ceb4f7cfc90dd34a9adf /src
parentca92091f95b34c75c5f810b6f967ca115671d907 (diff)
stats: add name vectors to prometheus exporter output
Type: improvement Counters are labeled with interface indices in the Prometheus exporter output. For example: # TYPE _if_drops counter _if_drops{thread="0",interface="0"} 0 _if_drops{thread="0",interface="1"} 0 _if_drops{thread="0",interface="2"} 2112 [..] Currently, it's unable to map interface indices to the interface names using only output provided by the Prometheus exporter. However, this mapping is present in the vpp_get_stats output: # vpp_get_stats dump /if/names [0]: local0 /if/names [1]: GigabitEthernet0/8/0 /if/names [2]: GigabitEthernet0/9/0 /if/names [..] With this change, add name vectors to Prometheus exporter output as info metrics. Thus exposing interfaces and their indices: # TYPE _if_names_info gauge _if_names_info{index="0",name="local0"} 1 _if_names_info{index="1",name="GigabitEthernet0/8/0"} 1 _if_names_info{index="2",name="GigabitEthernet0/9/0"} 1 [..] Signed-off-by: Alexander Chernavin <achernavin@netgate.com> Change-Id: Iff86c4d6fea8805e71fb04fccf278bae855e88d1
Diffstat (limited to 'src')
-rw-r--r--src/vpp/app/vpp_prometheus_export.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vpp/app/vpp_prometheus_export.c b/src/vpp/app/vpp_prometheus_export.c
index 99944917766..e2bd9521a2f 100644
--- a/src/vpp/app/vpp_prometheus_export.c
+++ b/src/vpp/app/vpp_prometheus_export.c
@@ -112,6 +112,15 @@ retry:
res[i].scalar_value);
break;
+ case STAT_DIR_TYPE_NAME_VECTOR:
+ fformat (stream, "# TYPE %s_info gauge\n",
+ prom_string (res[i].name));
+ for (k = 0; k < vec_len (res[i].name_vector); k++)
+ if (res[i].name_vector[k])
+ fformat (stream, "%s_info{index=\"%d\",name=\"%s\"} 1\n",
+ prom_string (res[i].name), k, res[i].name_vector[k]);
+ break;
+
case STAT_DIR_TYPE_EMPTY:
break;