metrics: add type to latency as well (#3685)

Automatically submitted.
This commit is contained in:
Miek Gieben 2020-02-19 09:57:42 +01:00 committed by GitHub
parent c8a6b16d86
commit ed1841c36f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -13,7 +13,7 @@ The following metrics are exported:
* `coredns_build_info{version, revision, goversion}` - info about CoreDNS itself.
* `coredns_panic_count_total{}` - total number of panics.
* `coredns_dns_request_count_total{server, zone, proto, family}` - total query count.
* `coredns_dns_request_duration_seconds{server, zone}` - duration to process each query.
* `coredns_dns_request_duration_seconds{server, zone, type}` - duration to process each query.
* `coredns_dns_request_size_bytes{server, zone, proto}` - size of the request in bytes.
* `coredns_dns_request_do_count_total{server, zone}` - queries that have the DO bit set
* `coredns_dns_request_type_count_total{server, zone, type}` - counter of queries per zone and type.

View file

@ -21,7 +21,6 @@ func Report(server string, req request.Request, zone, rcode string, size int, st
typ := req.QType()
RequestCount.WithLabelValues(server, zone, net, fam).Inc()
RequestDuration.WithLabelValues(server, zone).Observe(time.Since(start).Seconds())
if req.Do() {
RequestDo.WithLabelValues(server, zone).Inc()
@ -29,8 +28,10 @@ func Report(server string, req request.Request, zone, rcode string, size int, st
if _, known := monitorType[typ]; known {
RequestType.WithLabelValues(server, zone, dns.Type(typ).String()).Inc()
RequestDuration.WithLabelValues(server, zone, dns.Type(typ).String()).Observe(time.Since(start).Seconds())
} else {
RequestType.WithLabelValues(server, zone, other).Inc()
RequestDuration.WithLabelValues(server, zone, other).Observe(time.Since(start).Seconds())
}
ResponseSize.WithLabelValues(server, zone, net).Observe(float64(size))

View file

@ -21,7 +21,7 @@ var (
Name: "request_duration_seconds",
Buckets: plugin.TimeBuckets,
Help: "Histogram of the time (in seconds) each request took.",
}, []string{"server", "zone"})
}, []string{"server", "zone", "type"})
RequestSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: plugin.Namespace,