Don't double report metrics on error (#2719)

* Don't double report metrics on error

When there is an error use a different function to report the metrics,
in case the plugin chain handled the request the metrics are already
reported.

Fixes: #2717

Signed-off-by: Miek Gieben <miek@miek.nl>

* Compile again

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2019-03-25 19:04:03 +00:00
committed by GitHub
parent 9a8c301a42
commit 93f635023a
2 changed files with 18 additions and 8 deletions

View File

@@ -8,7 +8,9 @@ import (
"github.com/miekg/dns"
)
// Report reports the metrics data associated with request.
// Report reports the metrics data associated with request. This function is exported because it is also
// called from core/dnsserver to report requests hitting the server that should not be handled and are thus
// not sent down the plugin chain.
func Report(server string, req request.Request, zone, rcode string, size int, start time.Time) {
// Proto and Family.
net := req.Proto()