mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Merge pull request #6843 from simonpasquier/simplify-send-func
discovery/kubernetes: remove extraneous parameters from send()
This commit is contained in:
commit
20a94e62ca
|
@ -169,7 +169,7 @@ func (e *Endpoints) process(ctx context.Context, ch chan<- []*targetgroup.Group)
|
|||
return true
|
||||
}
|
||||
if !exists {
|
||||
send(ctx, e.logger, RoleEndpoint, ch, &targetgroup.Group{Source: endpointsSourceFromNamespaceAndName(namespace, name)})
|
||||
send(ctx, ch, &targetgroup.Group{Source: endpointsSourceFromNamespaceAndName(namespace, name)})
|
||||
return true
|
||||
}
|
||||
eps, err := convertToEndpoints(o)
|
||||
|
@ -177,7 +177,7 @@ func (e *Endpoints) process(ctx context.Context, ch chan<- []*targetgroup.Group)
|
|||
level.Error(e.logger).Log("msg", "converting to Endpoints object failed", "err", err)
|
||||
return true
|
||||
}
|
||||
send(ctx, e.logger, RoleEndpoint, ch, e.buildEndpoints(eps))
|
||||
send(ctx, ch, e.buildEndpoints(eps))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ func (i *Ingress) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
|
|||
return true
|
||||
}
|
||||
if !exists {
|
||||
send(ctx, i.logger, RoleIngress, ch, &targetgroup.Group{Source: ingressSourceFromNamespaceAndName(namespace, name)})
|
||||
send(ctx, ch, &targetgroup.Group{Source: ingressSourceFromNamespaceAndName(namespace, name)})
|
||||
return true
|
||||
}
|
||||
eps, err := convertToIngress(o)
|
||||
|
@ -117,7 +117,7 @@ func (i *Ingress) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
|
|||
level.Error(i.logger).Log("msg", "converting to Ingress object failed", "err", err)
|
||||
return true
|
||||
}
|
||||
send(ctx, i.logger, RoleIngress, ch, i.buildIngress(eps))
|
||||
send(ctx, ch, i.buildIngress(eps))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ func lv(s string) model.LabelValue {
|
|||
return model.LabelValue(s)
|
||||
}
|
||||
|
||||
func send(ctx context.Context, l log.Logger, role Role, ch chan<- []*targetgroup.Group, tg *targetgroup.Group) {
|
||||
func send(ctx context.Context, ch chan<- []*targetgroup.Group, tg *targetgroup.Group) {
|
||||
if tg == nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ func (n *Node) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
|
|||
return true
|
||||
}
|
||||
if !exists {
|
||||
send(ctx, n.logger, RoleNode, ch, &targetgroup.Group{Source: nodeSourceFromName(name)})
|
||||
send(ctx, ch, &targetgroup.Group{Source: nodeSourceFromName(name)})
|
||||
return true
|
||||
}
|
||||
node, err := convertToNode(o)
|
||||
|
@ -126,7 +126,7 @@ func (n *Node) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
|
|||
level.Error(n.logger).Log("msg", "converting to Node object failed", "err", err)
|
||||
return true
|
||||
}
|
||||
send(ctx, n.logger, RoleNode, ch, n.buildNode(node))
|
||||
send(ctx, ch, n.buildNode(node))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ func (p *Pod) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
|
|||
return true
|
||||
}
|
||||
if !exists {
|
||||
send(ctx, p.logger, RolePod, ch, &targetgroup.Group{Source: podSourceFromNamespaceAndName(namespace, name)})
|
||||
send(ctx, ch, &targetgroup.Group{Source: podSourceFromNamespaceAndName(namespace, name)})
|
||||
return true
|
||||
}
|
||||
eps, err := convertToPod(o)
|
||||
|
@ -129,7 +129,7 @@ func (p *Pod) process(ctx context.Context, ch chan<- []*targetgroup.Group) bool
|
|||
level.Error(p.logger).Log("msg", "converting to Pod object failed", "err", err)
|
||||
return true
|
||||
}
|
||||
send(ctx, p.logger, RolePod, ch, p.buildPod(eps))
|
||||
send(ctx, ch, p.buildPod(eps))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ func (s *Service) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
|
|||
return true
|
||||
}
|
||||
if !exists {
|
||||
send(ctx, s.logger, RoleService, ch, &targetgroup.Group{Source: serviceSourceFromNamespaceAndName(namespace, name)})
|
||||
send(ctx, ch, &targetgroup.Group{Source: serviceSourceFromNamespaceAndName(namespace, name)})
|
||||
return true
|
||||
}
|
||||
eps, err := convertToService(o)
|
||||
|
@ -122,7 +122,7 @@ func (s *Service) process(ctx context.Context, ch chan<- []*targetgroup.Group) b
|
|||
level.Error(s.logger).Log("msg", "converting to Service object failed", "err", err)
|
||||
return true
|
||||
}
|
||||
send(ctx, s.logger, RoleService, ch, s.buildService(eps))
|
||||
send(ctx, ch, s.buildService(eps))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue