mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Middleware chaining fixes
For prometheus use the plain value, not a pointer and change all usages. Allow AXFR to be requested over udp as well and some other more log printed when commencing an AXFR.
This commit is contained in:
@@ -51,8 +51,8 @@ var directiveOrder = []directive{
|
||||
{"shutdown", setup.Shutdown},
|
||||
|
||||
// Directives that inject handlers (middleware)
|
||||
{"log", setup.Log},
|
||||
{"prometheus", setup.Prometheus},
|
||||
{"log", setup.Log},
|
||||
{"rewrite", setup.Rewrite},
|
||||
{"loadbalance", setup.Loadbalance},
|
||||
{"file", setup.File},
|
||||
|
||||
@@ -32,17 +32,17 @@ func Prometheus(c *Controller) (middleware.Middleware, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func parsePrometheus(c *Controller) (*prom.Metrics, error) {
|
||||
func parsePrometheus(c *Controller) (prom.Metrics, error) {
|
||||
var (
|
||||
metrics *prom.Metrics
|
||||
metrics prom.Metrics
|
||||
err error
|
||||
)
|
||||
|
||||
for c.Next() {
|
||||
if metrics != nil {
|
||||
return nil, c.Err("prometheus: can only have one metrics module per server")
|
||||
if metrics.Addr != "" {
|
||||
return prom.Metrics{}, c.Err("prometheus: can only have one metrics module per server")
|
||||
}
|
||||
metrics = &prom.Metrics{ZoneNames: c.ServerBlockHosts}
|
||||
metrics = prom.Metrics{ZoneNames: c.ServerBlockHosts}
|
||||
args := c.RemainingArgs()
|
||||
|
||||
switch len(args) {
|
||||
@@ -50,18 +50,18 @@ func parsePrometheus(c *Controller) (*prom.Metrics, error) {
|
||||
case 1:
|
||||
metrics.Addr = args[0]
|
||||
default:
|
||||
return nil, c.ArgErr()
|
||||
return prom.Metrics{}, c.ArgErr()
|
||||
}
|
||||
for c.NextBlock() {
|
||||
switch c.Val() {
|
||||
case "address":
|
||||
args = c.RemainingArgs()
|
||||
if len(args) != 1 {
|
||||
return nil, c.ArgErr()
|
||||
return prom.Metrics{}, c.ArgErr()
|
||||
}
|
||||
metrics.Addr = args[0]
|
||||
default:
|
||||
return nil, c.Errf("prometheus: unknown item: %s", c.Val())
|
||||
return prom.Metrics{}, c.Errf("prometheus: unknown item: %s", c.Val())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user