aboutsummaryrefslogtreecommitdiff
path: root/plugin/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/proxy')
-rw-r--r--plugin/proxy/README.md12
-rw-r--r--plugin/proxy/metrics.go4
-rw-r--r--plugin/proxy/proxy.go5
3 files changed, 12 insertions, 9 deletions
diff --git a/plugin/proxy/README.md b/plugin/proxy/README.md
index d81a2ebc1..1da0ef4b7 100644
--- a/plugin/proxy/README.md
+++ b/plugin/proxy/README.md
@@ -102,13 +102,15 @@ payload over HTTPS). Note that with `https_google` the entire transport is encry
If monitoring is enabled (via the *prometheus* directive) then the following metric is exported:
-* `coredns_proxy_request_duration_seconds{proto, proto_proxy, family, to}` - duration per upstream
- interaction.
-* `coredns_proxy_request_count_total{proto, proto_proxy, family, to}` - query count per upstream.
+* `coredns_proxy_request_duration_seconds{server, proto, proto_proxy, family, to}` - duration per
+ upstream interaction.
+* `coredns_proxy_request_count_total{server, proto, proto_proxy, family, to}` - query count per
+ upstream.
Where `proxy_proto` is the protocol used (`dns`, `grpc`, or `https_google`) and `to` is **TO**
-specified in the config, `proto` is the protocol used by the incoming query ("tcp" or "udp").
-and family the transport family ("1" for IPv4, and "2" for IPv6).
+specified in the config, `proto` is the protocol used by the incoming query ("tcp" or "udp"), family
+the transport family ("1" for IPv4, and "2" for IPv6). `Server` is the server responsible for the
+request (and metric). See the documention in the metrics plugin.
## Examples
diff --git a/plugin/proxy/metrics.go b/plugin/proxy/metrics.go
index e0dd3fe98..e5d6139b4 100644
--- a/plugin/proxy/metrics.go
+++ b/plugin/proxy/metrics.go
@@ -15,14 +15,14 @@ var (
Subsystem: "proxy",
Name: "request_count_total",
Help: "Counter of requests made per protocol, proxy protocol, family and upstream.",
- }, []string{"proto", "proxy_proto", "family", "to"})
+ }, []string{"server", "proto", "proxy_proto", "family", "to"})
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: plugin.Namespace,
Subsystem: "proxy",
Name: "request_duration_seconds",
Buckets: plugin.TimeBuckets,
Help: "Histogram of the time (in seconds) each request took.",
- }, []string{"proto", "proxy_proto", "family", "to"})
+ }, []string{"server", "proto", "proxy_proto", "family", "to"})
)
// familyToString returns the string form of either 1, or 2. Returns
diff --git a/plugin/proxy/proxy.go b/plugin/proxy/proxy.go
index af61f424f..eae9953df 100644
--- a/plugin/proxy/proxy.go
+++ b/plugin/proxy/proxy.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/coredns/coredns/plugin"
+ "github.com/coredns/coredns/plugin/metrics"
"github.com/coredns/coredns/plugin/pkg/healthcheck"
"github.com/coredns/coredns/request"
@@ -87,7 +88,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
atomic.AddInt64(&host.Conns, 1)
- RequestCount.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Add(1)
+ RequestCount.WithLabelValues(metrics.WithServer(ctx), state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Add(1)
reply, backendErr = upstream.Exchanger().Exchange(ctx, host.Name, state)
@@ -110,7 +111,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
w.WriteMsg(reply)
- RequestDuration.WithLabelValues(state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Observe(time.Since(start).Seconds())
+ RequestDuration.WithLabelValues(metrics.WithServer(ctx), state.Proto(), upstream.Exchanger().Protocol(), familyToString(state.Family()), host.Name).Observe(time.Since(start).Seconds())
return 0, taperr
}