Skip to content

Commit

Permalink
Merge branch '2373-iss-k8sprom-nodelocal' into 'dev'
Browse files Browse the repository at this point in the history
修复 KubernetesPrometheus 一个资源泄露问题

See merge request cloudcare-tools/datakit!3187
  • Loading branch information
谭彪 committed Aug 28, 2024
2 parents bf21fd1 + cbc97ca commit f832b63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/plugins/inputs/kubernetesprometheus/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (*Input) Terminate() { /* TODO */ }
func (ipt *Input) Run() {
klog = logger.SLogger("kubernetesprometheus")

tick := time.NewTicker(time.Second * 10)
defer tick.Stop()

for {
// enable nodeLocal model or election success
if ipt.NodeLocal || !ipt.pause.Load() {
Expand Down Expand Up @@ -70,7 +73,8 @@ func (ipt *Input) Run() {
ipt.stop()
ipt.runOnce = sync.Once{} // reset runOnce
}
default:

case <-tick.C:
// next
}
}
Expand Down

0 comments on commit f832b63

Please sign in to comment.