From eb01156ac67997a649af70d76b99262cf7bac8cf Mon Sep 17 00:00:00 2001 From: Erik Baranowski <39704712+erikbaranowski@users.noreply.github.com> Date: Tue, 21 May 2024 15:37:18 -0400 Subject: [PATCH] fix for panic with snmp exporter from the recent version upgrade (#6921) * fix for panic with snmp exporter from the recent version upgrade Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> --------- Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ static/integrations/snmp_exporter/snmp_exporter.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fab777b98ea..7ea545a3531d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,10 @@ Main (unreleased) ### Bugfixes +- Fix panic for `prometheus.exporter.snmp` and snmp_exporter integration + introduced in v0.40.5 with a version upgrade. This was due to an + uninitialized new metric for the exporter. (@erikbaranowski) + - Fix an issue where JSON string array elements were not parsed correctly in `loki.source.cloudflare`. (@thampiotr) - Fix SSRF vulnerability in `faro.receiver` by disabling source map download. (@hainenber) diff --git a/static/integrations/snmp_exporter/snmp_exporter.go b/static/integrations/snmp_exporter/snmp_exporter.go index c71fab3a3d5d..47754801e02a 100644 --- a/static/integrations/snmp_exporter/snmp_exporter.go +++ b/static/integrations/snmp_exporter/snmp_exporter.go @@ -155,6 +155,13 @@ func NewSNMPMetrics(reg prometheus.Registerer) collector.Metrics { Help: "Number of SNMP packet retries.", }, ), + SNMPInflight: promauto.With(reg).NewGauge( + prometheus.GaugeOpts{ + Namespace: namespace, + Name: "request_in_flight", + Help: "Current number of SNMP scrapes being requested.", + }, + ), } }