Commit ecb53add authored by Miek Gieben's avatar Miek Gieben

Normalize names before putting it in the handler

parent e0c4f94d
......@@ -19,9 +19,7 @@ func Prometheus(c *Controller) (middleware.Middleware, error) {
if err != nil {
return nil, err
}
if metrics.Addr == "" {
metrics.Addr = addr
}
once.Do(func() {
c.Startup = append(c.Startup, metrics.Start)
})
......@@ -39,10 +37,13 @@ func parsePrometheus(c *Controller) (prom.Metrics, error) {
)
for c.Next() {
if metrics.Addr != "" {
if len(metrics.ZoneNames) > 0 {
return prom.Metrics{}, c.Err("prometheus: can only have one metrics module per server")
}
metrics = prom.Metrics{ZoneNames: c.ServerBlockHosts}
for i, _ := range metrics.ZoneNames {
metrics.ZoneNames[i] = middleware.Host(metrics.ZoneNames[i]).Normalize()
}
args := c.RemainingArgs()
switch len(args) {
......@@ -66,5 +67,8 @@ func parsePrometheus(c *Controller) (prom.Metrics, error) {
}
}
if metrics.Addr == "" {
metrics.Addr = addr
}
return metrics, err
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment