diff --git a/plugins/inputs/prometheus/prometheus.go b/plugins/inputs/prometheus/prometheus.go index 84fc31800..eaadf1452 100644 --- a/plugins/inputs/prometheus/prometheus.go +++ b/plugins/inputs/prometheus/prometheus.go @@ -305,7 +305,9 @@ func (p *Prometheus) Start(a telegraf.Accumulator) error { } func (p *Prometheus) Stop() { - p.cancel() + if p.MonitorPods { + p.cancel() + } p.wg.Wait() }