From d36372a528067d29c44a2be9bcd87e7cf9528b22 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 9 Dec 2025 11:07:39 +0200 Subject: [PATCH] rdt: correct prometheus metric types Align with the the OTEL metrics. --- pkg/rdt/prometheus.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/rdt/prometheus.go b/pkg/rdt/prometheus.go index 8a74ef4..8300bf5 100644 --- a/pkg/rdt/prometheus.go +++ b/pkg/rdt/prometheus.go @@ -127,10 +127,22 @@ func (c *collector) collectGroupMetrics(ch chan<- prometheus.Metric, g ResctrlGr for feature, value := range data { ch <- prometheus.MustNewConstMetric( c.describeL3(feature), - prometheus.CounterValue, + promValueTypeL3(feature), float64(value), labels..., ) } } } + +// promValueTypeL3 returns Prometheus value type for given L3 metric. +func promValueTypeL3(feature string) prometheus.ValueType { + switch feature { + case "llc_occupancy": + return prometheus.GaugeValue + case "mbm_local_bytes", "mbm_total_bytes": + return prometheus.CounterValue + default: + return prometheus.GaugeValue + } +}