plugin/metrics: support HTTPS qType in requests count metric label (#4934)

Automatically submitted.
This commit is contained in:
Pavol Lieskovský
2021-10-28 10:50:23 +02:00
committed by GitHub
parent de21fb2436
commit 5934c7e89e
3 changed files with 5 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ Extra labels used are:
* `proto` which holds the transport of the response ("udp" or "tcp")
* The address family (`family`) of the transport (1 = IP (IP version 4), 2 = IP6 (IP version 6)).
* `type` which holds the query type. It holds most common types (A, AAAA, MX, SOA, CNAME, PTR, TXT,
NS, SRV, DS, DNSKEY, RRSIG, NSEC, NSEC3, IXFR, AXFR and ANY) and "other" which lumps together all
NS, SRV, DS, DNSKEY, RRSIG, NSEC, NSEC3, HTTPS, IXFR, AXFR and ANY) and "other" which lumps together all
other types.
If monitoring is enabled, queries that do not enter the plugin chain are exported under the fake

View File

@@ -19,6 +19,7 @@ var monitorType = map[uint16]struct{}{
dns.TypeSOA: {},
dns.TypeSRV: {},
dns.TypeTXT: {},
dns.TypeHTTPS: {},
// Meta Qtypes
dns.TypeIXFR: {},
dns.TypeAXFR: {},
@@ -26,7 +27,7 @@ var monitorType = map[uint16]struct{}{
}
// qTypeString returns the RR type based on monitorType. It returns the text representation
// of thosAe types. RR types not in that list will have "other" returned.
// of those types. RR types not in that list will have "other" returned.
func qTypeString(qtype uint16) string {
if _, known := monitorType[qtype]; known {
return dns.Type(qtype).String()

View File

@@ -21,8 +21,8 @@ func Report(server string, req request.Request, zone, rcode string, size int, st
RequestDo.WithLabelValues(server, zone).Inc()
}
qtype := qTypeString(req.QType())
RequestCount.WithLabelValues(server, zone, net, fam, qtype).Inc()
qType := qTypeString(req.QType())
RequestCount.WithLabelValues(server, zone, net, fam, qType).Inc()
RequestDuration.WithLabelValues(server, zone).Observe(time.Since(start).Seconds())