aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-02-07 21:28:47 +0000
committerGravatar Miek Gieben <miek@miek.nl> 2017-02-07 21:28:47 +0000
commitfa0abe747327b7dda0b2566f45dcea649f26fb0b (patch)
treed18a3f6309367faab920ee3b7567cc051a7d09b7
parentdbe1b2510d609bf37b0874f0aafa91e982cdc5c2 (diff)
downloadcoredns-fa0abe747327b7dda0b2566f45dcea649f26fb0b.tar.gz
coredns-fa0abe747327b7dda0b2566f45dcea649f26fb0b.tar.zst
coredns-fa0abe747327b7dda0b2566f45dcea649f26fb0b.zip
middleware/proxy: sane(r) metrics
Add proxy_proto and re-instate proto to be the protocol of the incoming query ("tcp" or "udp").
-rw-r--r--middleware/proxy/README.md6
-rw-r--r--middleware/proxy/metrics.go2
-rw-r--r--middleware/proxy/proxy.go6
3 files changed, 7 insertions, 7 deletions
diff --git a/middleware/proxy/README.md b/middleware/proxy/README.md
index 20fbef720..56469cb74 100644
--- a/middleware/proxy/README.md
+++ b/middleware/proxy/README.md
@@ -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:
-* 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
-the config.
+Where `proxy_proto` is the protocol used (`dns`, or `https_google`) and `from` is **FROM** specified in
+the config, `proto` is the protocol used by the incoming query ("tcp" or "udp").
## Examples
diff --git a/middleware/proxy/metrics.go b/middleware/proxy/metrics.go
index 485b594c7..1b238148b 100644
--- a/middleware/proxy/metrics.go
+++ b/middleware/proxy/metrics.go
@@ -16,7 +16,7 @@ var (
Name: "request_duration_milliseconds",
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.",
- }, []string{"proto", "from"})
+ }, []string{"proto", "proxy_proto", "from"})
)
// OnStartupMetrics sets up the metrics on startup. This is done for all proxy protocols.
diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go
index b8b50adc6..1a595d99e 100644
--- a/middleware/proxy/proxy.go
+++ b/middleware/proxy/proxy.go
@@ -93,7 +93,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
host := upstream.Select()
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
}
@@ -116,7 +116,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
if backendErr == nil {
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
}
@@ -131,7 +131,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
}(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
}