diff options
Diffstat (limited to 'plugin/forward')
-rw-r--r-- | plugin/forward/README.md | 2 | ||||
-rw-r--r-- | plugin/forward/connect.go | 5 | ||||
-rw-r--r-- | plugin/forward/metrics.go | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/plugin/forward/README.md b/plugin/forward/README.md index 52625249c..64e561106 100644 --- a/plugin/forward/README.md +++ b/plugin/forward/README.md @@ -107,7 +107,7 @@ If monitoring is enabled (via the *prometheus* plugin) then the following metric * `coredns_forward_requests_total{to}` - query count per upstream. * `coredns_forward_responses_total{to}` - Counter of responses received per upstream. -* `coredns_forward_request_duration_seconds{to}` - duration per upstream interaction. +* `coredns_forward_request_duration_seconds{to, rcode, type}` - duration per upstream, RCODE, type * `coredns_forward_responses_total{to, rcode}` - count of RCODEs per upstream. * `coredns_forward_healthcheck_failures_total{to}` - number of failed health checks per upstream. * `coredns_forward_healthcheck_broken_total{}` - counter of when all upstreams are unhealthy, diff --git a/plugin/forward/connect.go b/plugin/forward/connect.go index c181c98cb..7e34837e1 100644 --- a/plugin/forward/connect.go +++ b/plugin/forward/connect.go @@ -11,6 +11,7 @@ import ( "sync/atomic" "time" + "github.com/coredns/coredns/plugin/pkg/dnsutil" "github.com/coredns/coredns/request" "github.com/miekg/dns" @@ -129,9 +130,11 @@ func (p *Proxy) Connect(ctx context.Context, state request.Request, opts options rc = strconv.Itoa(ret.Rcode) } + qtype := dnsutil.QTypeMonitorLabel(state.QType()) + RequestCount.WithLabelValues(p.addr).Add(1) RcodeCount.WithLabelValues(rc, p.addr).Add(1) - RequestDuration.WithLabelValues(p.addr).Observe(time.Since(start).Seconds()) + RequestDuration.WithLabelValues(p.addr, rc, qtype).Observe(time.Since(start).Seconds()) return ret, nil } diff --git a/plugin/forward/metrics.go b/plugin/forward/metrics.go index 98f2805c1..51685a599 100644 --- a/plugin/forward/metrics.go +++ b/plugin/forward/metrics.go @@ -27,7 +27,7 @@ var ( Name: "request_duration_seconds", Buckets: plugin.TimeBuckets, Help: "Histogram of the time each request took.", - }, []string{"to"}) + }, []string{"to", "rcode", "type"}) HealthcheckFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: plugin.Namespace, Subsystem: "forward", |