plugin/metrics: add panic counter (#1778)

Count and export number of panics we see.

Fixes #1294
This commit is contained in:
Miek Gieben
2018-05-05 19:47:41 +02:00
committed by GitHub
parent 41f1a1434a
commit 7c27577707
4 changed files with 14 additions and 7 deletions

View File

@@ -208,6 +208,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
// In case the user doesn't enable error plugin, we still
// need to make sure that we stay alive up here
if rec := recover(); rec != nil {
vars.Panic.Inc()
DefaultErrorFunc(ctx, w, r, dns.RcodeServerFailure)
}
}()