mirror of https://github.com/prometheus/prometheus
Merge pull request #6116 from simonpasquier/fix-sd-error-logs-on-cancel
discovery: don't log errors on context cancelationpull/6118/head
commit
6b22997791
|
@ -128,7 +128,9 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
defer e.queue.ShutDown()
|
defer e.queue.ShutDown()
|
||||||
|
|
||||||
if !cache.WaitForCacheSync(ctx.Done(), e.endpointsInf.HasSynced, e.serviceInf.HasSynced, e.podInf.HasSynced) {
|
if !cache.WaitForCacheSync(ctx.Done(), e.endpointsInf.HasSynced, e.serviceInf.HasSynced, e.podInf.HasSynced) {
|
||||||
level.Error(e.logger).Log("msg", "endpoints informer unable to sync cache")
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(e.logger).Log("msg", "endpoints informer unable to sync cache")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,9 @@ func (i *Ingress) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
defer i.queue.ShutDown()
|
defer i.queue.ShutDown()
|
||||||
|
|
||||||
if !cache.WaitForCacheSync(ctx.Done(), i.informer.HasSynced) {
|
if !cache.WaitForCacheSync(ctx.Done(), i.informer.HasSynced) {
|
||||||
level.Error(i.logger).Log("msg", "ingress informer unable to sync cache")
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(i.logger).Log("msg", "ingress informer unable to sync cache")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,9 @@ func (n *Node) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
defer n.queue.ShutDown()
|
defer n.queue.ShutDown()
|
||||||
|
|
||||||
if !cache.WaitForCacheSync(ctx.Done(), n.informer.HasSynced) {
|
if !cache.WaitForCacheSync(ctx.Done(), n.informer.HasSynced) {
|
||||||
level.Error(n.logger).Log("msg", "node informer unable to sync cache")
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(n.logger).Log("msg", "node informer unable to sync cache")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,9 @@ func (p *Pod) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
defer p.queue.ShutDown()
|
defer p.queue.ShutDown()
|
||||||
|
|
||||||
if !cache.WaitForCacheSync(ctx.Done(), p.informer.HasSynced) {
|
if !cache.WaitForCacheSync(ctx.Done(), p.informer.HasSynced) {
|
||||||
level.Error(p.logger).Log("msg", "pod informer unable to sync cache")
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(p.logger).Log("msg", "pod informer unable to sync cache")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,9 @@ func (s *Service) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
defer s.queue.ShutDown()
|
defer s.queue.ShutDown()
|
||||||
|
|
||||||
if !cache.WaitForCacheSync(ctx.Done(), s.informer.HasSynced) {
|
if !cache.WaitForCacheSync(ctx.Done(), s.informer.HasSynced) {
|
||||||
level.Error(s.logger).Log("msg", "service informer unable to sync cache")
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(s.logger).Log("msg", "service informer unable to sync cache")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,9 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
// Get an initial set right away.
|
// Get an initial set right away.
|
||||||
tgs, err := d.refresh(ctx)
|
tgs, err := d.refresh(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
select {
|
select {
|
||||||
case ch <- tgs:
|
case ch <- tgs:
|
||||||
|
@ -92,7 +94,9 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
tgs, err := d.refresh(ctx)
|
tgs, err := d.refresh(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
if ctx.Err() != context.Canceled {
|
||||||
|
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue