fix: metric with services LB.
This commit is contained in:
parent
229402594f
commit
7536f5e83c
2 changed files with 9 additions and 2 deletions
|
@ -229,11 +229,13 @@ func OnConfigurationUpdate(dynConf dynamic.Configurations, entryPoints []string)
|
|||
|
||||
for serviceName, service := range config.HTTP.Services {
|
||||
dynamicConfig.services[fmt.Sprintf("%s@%s", serviceName, key)] = make(map[string]bool)
|
||||
if service.LoadBalancer != nil {
|
||||
for _, server := range service.LoadBalancer.Servers {
|
||||
dynamicConfig.services[fmt.Sprintf("%s@%s", serviceName, key)][server.URL] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
promState.SetDynamicConfig(dynamicConfig)
|
||||
}
|
||||
|
|
|
@ -291,6 +291,11 @@ func TestPrometheusMetricRemoval(t *testing.T) {
|
|||
th.WithLoadBalancerServices(th.WithService("bar",
|
||||
th.WithServers(th.WithServer("http://localhost:9000"))),
|
||||
),
|
||||
func(cfg *dynamic.HTTPConfiguration) {
|
||||
cfg.Services["fii"] = &dynamic.Service{
|
||||
Weighted: &dynamic.WeightedRoundRobin{},
|
||||
}
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue