From 5d1202f6bc3cb3a37200af51fc0c8bd4977d2d44 Mon Sep 17 00:00:00 2001 From: Aman Pandae Date: Sun, 23 Jun 2024 08:30:44 -0400 Subject: [PATCH] BugFix: Missing VF info and Pod info Metric Info was changed to Gauge for Device Info Openmetrics, Since "Info" keyword is not compatible with scraping tools. Modifying the same for VF Statistics and VF Pod info. Minor changes to registry name as "_info" is not suffixed by Openmetrics registry for gauge Test Plan: PASSED: Metrics consumed properly by a scraping tool without any error. PASSED: Validate necessary information is being displayed with new metric type Gauge. PASSED: API Test with SRIOV enabled, VF Pods created and verified if the information is retrieved properly Story: 2010918 Task: 50434 Change-Id: Ia8324b5f1cc390e7ca28443e045d579393527d3a Signed-off-by: Aman Pandae --- .../docker/metrics-exporter-api/openmet_handler.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metrics-exporter-api/docker/metrics-exporter-api/openmet_handler.go b/metrics-exporter-api/docker/metrics-exporter-api/openmet_handler.go index 92fd32f..c25c5f0 100644 --- a/metrics-exporter-api/docker/metrics-exporter-api/openmet_handler.go +++ b/metrics-exporter-api/docker/metrics-exporter-api/openmet_handler.go @@ -196,7 +196,7 @@ func regDevInfo( // Function to cast Pod Details data from struct to openmetrics format func podStatsOpenMetfmt(podDet map[string]string) string { var reg = openmetrics.NewRegistry() - regName := "network_interface_vf_kube_pod" + regName := "network_interface_vf_kube_pod_info" var openMetVar = regDevInfo( reg, regName, regName, []string{ "namespace", "pod", "container", "resource", "device", "vf", @@ -213,7 +213,7 @@ func podStatsOpenMetfmt(podDet map[string]string) string { podDet["Vf"], podDet["Pciaddr"], podDet["HardwareAddr"], - ) + ).Add(float64(1)) // create buffer to return var buf bytes.Buffer @@ -227,7 +227,7 @@ func podStatsOpenMetfmt(podDet map[string]string) string { // Function to cast VfDevice data from struct to openmetrics format func vfDeviceOpenMetfmt(devInfo VfDevice) string { var reg = openmetrics.NewRegistry() - regName := "network_interface_vf_device" + regName := "network_interface_vf_device_info" var openMetVar = regDevInfo( reg, regName, @@ -243,7 +243,7 @@ func vfDeviceOpenMetfmt(devInfo VfDevice) string { strconv.Itoa(devInfo.VfInfo.Vlan), BoolToOnOff(devInfo.VfInfo.Spoofchk), intToOnOff(devInfo.VfInfo.Trust), - ) + ).Add(float64(1)) statsString := vfStatsOpenMetfmt(devInfo) // create buffer to return var buf bytes.Buffer