From ce7dab034fa1a34fd47b285bd50f45155929aa7c Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:14:32 -0600 Subject: [PATCH 1/2] chore(inputs.prometheus): Reduce logging level for label/field selector --- plugins/inputs/prometheus/prometheus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/prometheus/prometheus.go b/plugins/inputs/prometheus/prometheus.go index 1922407fd754e..d1edbdc6c65ef 100644 --- a/plugins/inputs/prometheus/prometheus.go +++ b/plugins/inputs/prometheus/prometheus.go @@ -183,7 +183,7 @@ func (p *Prometheus) Init() error { return fmt.Errorf("the field selector %q is not supported for pods", invalidSelector) } - p.Log.Infof("Using the label selector: %v and field selector: %v", p.podLabelSelector, p.podFieldSelector) + p.Log.Debugf("Using the label selector: %v and field selector: %v", p.podLabelSelector, p.podFieldSelector) for k, vs := range p.NamespaceAnnotationPass { tagFilter := models.TagFilter{} From e6368403c2927a7951295993a9ef0d9d2b0724e5 Mon Sep 17 00:00:00 2001 From: Dane Strandboge <136023093+DStrand1@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:41:43 -0600 Subject: [PATCH 2/2] improve label and field selector logging --- plugins/inputs/prometheus/prometheus.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/prometheus/prometheus.go b/plugins/inputs/prometheus/prometheus.go index d1edbdc6c65ef..5bd058a174401 100644 --- a/plugins/inputs/prometheus/prometheus.go +++ b/plugins/inputs/prometheus/prometheus.go @@ -183,7 +183,12 @@ func (p *Prometheus) Init() error { return fmt.Errorf("the field selector %q is not supported for pods", invalidSelector) } - p.Log.Debugf("Using the label selector: %v and field selector: %v", p.podLabelSelector, p.podFieldSelector) + if p.KubernetesLabelSelector != "" { + p.Log.Infof("Using the label selector: %v", p.podLabelSelector) + } + if p.KubernetesFieldSelector != "" { + p.Log.Infof("Using the field selector: %v", p.podFieldSelector) + } for k, vs := range p.NamespaceAnnotationPass { tagFilter := models.TagFilter{}