middleware/proxy: sane(r) metrics
Add proxy_proto and re-instate proto to be the protocol of the incoming query ("tcp" or "udp").
This commit is contained in:
parent
dbe1b2510d
commit
fa0abe7473
3 changed files with 7 additions and 7 deletions
|
@ -87,10 +87,10 @@ example.org. 1799 IN SOA sns.dns.icann.org. noc.dns.icann.org. 2016110711 7200
|
||||||
|
|
||||||
If monitoring is enabled (via the *prometheus* directive) then the following metric is exported:
|
If monitoring is enabled (via the *prometheus* directive) then the following metric is exported:
|
||||||
|
|
||||||
* coredns_proxy_request_count_total{proto, from}
|
* coredns_proxy_request_count_total{proto, proxy_proto, from}
|
||||||
|
|
||||||
Where `proto` is the protocol used (`dns`, or `https_google`) and `from` is **FROM** specified in
|
Where `proxy_proto` is the protocol used (`dns`, or `https_google`) and `from` is **FROM** specified in
|
||||||
the config.
|
the config, `proto` is the protocol used by the incoming query ("tcp" or "udp").
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ var (
|
||||||
Name: "request_duration_milliseconds",
|
Name: "request_duration_milliseconds",
|
||||||
Buckets: append(prometheus.DefBuckets, []float64{50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000, 10000}...),
|
Buckets: append(prometheus.DefBuckets, []float64{50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000, 10000}...),
|
||||||
Help: "Histogram of the time (in milliseconds) each request took.",
|
Help: "Histogram of the time (in milliseconds) each request took.",
|
||||||
}, []string{"proto", "from"})
|
}, []string{"proto", "proxy_proto", "from"})
|
||||||
)
|
)
|
||||||
|
|
||||||
// OnStartupMetrics sets up the metrics on startup. This is done for all proxy protocols.
|
// OnStartupMetrics sets up the metrics on startup. This is done for all proxy protocols.
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
host := upstream.Select()
|
host := upstream.Select()
|
||||||
if host == nil {
|
if host == nil {
|
||||||
|
|
||||||
RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
||||||
|
|
||||||
return dns.RcodeServerFailure, errUnreachable
|
return dns.RcodeServerFailure, errUnreachable
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
if backendErr == nil {
|
if backendErr == nil {
|
||||||
w.WriteMsg(reply)
|
w.WriteMsg(reply)
|
||||||
|
|
||||||
RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
||||||
|
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||||
}(host, timeout)
|
}(host, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestDuration.WithLabelValues(upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond))
|
||||||
|
|
||||||
return dns.RcodeServerFailure, errUnreachable
|
return dns.RcodeServerFailure, errUnreachable
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue