Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
7c275777
Commit
7c275777
authored
May 05, 2018
by
Miek Gieben
Committed by
GitHub
May 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin/metrics: add panic counter (#1778)
Count and export number of panics we see. Fixes #1294
parent
41f1a143
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
7 deletions
+14
-7
core/dnsserver/server.go
core/dnsserver/server.go
+1
-0
plugin/metrics/README.md
plugin/metrics/README.md
+1
-0
plugin/metrics/metrics.go
plugin/metrics/metrics.go
+6
-7
plugin/metrics/vars/vars.go
plugin/metrics/vars/vars.go
+6
-0
No files found.
core/dnsserver/server.go
View file @
7c275777
...
@@ -208,6 +208,7 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
...
@@ -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
// In case the user doesn't enable error plugin, we still
// need to make sure that we stay alive up here
// need to make sure that we stay alive up here
if
rec
:=
recover
();
rec
!=
nil
{
if
rec
:=
recover
();
rec
!=
nil
{
vars
.
Panic
.
Inc
()
DefaultErrorFunc
(
ctx
,
w
,
r
,
dns
.
RcodeServerFailure
)
DefaultErrorFunc
(
ctx
,
w
,
r
,
dns
.
RcodeServerFailure
)
}
}
}()
}()
...
...
plugin/metrics/README.md
View file @
7c275777
...
@@ -11,6 +11,7 @@ The default location for the metrics is `localhost:9153`. The metrics path is fi
...
@@ -11,6 +11,7 @@ The default location for the metrics is `localhost:9153`. The metrics path is fi
The following metrics are exported:
The following metrics are exported:
*
`coredns_build_info{version, revision, goversion}`
- info about CoreDNS itself.
*
`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_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}`
- duration to process each query.
*
`coredns_dns_request_size_bytes{server, zone, proto}`
- size of the request in bytes.
*
`coredns_dns_request_size_bytes{server, zone, proto}`
- size of the request in bytes.
...
...
plugin/metrics/metrics.go
View file @
7c275777
...
@@ -41,6 +41,7 @@ func New(addr string) *Metrics {
...
@@ -41,6 +41,7 @@ func New(addr string) *Metrics {
// Add all of our collectors
// Add all of our collectors
met
.
MustRegister
(
buildInfo
)
met
.
MustRegister
(
buildInfo
)
met
.
MustRegister
(
vars
.
Panic
)
met
.
MustRegister
(
vars
.
RequestCount
)
met
.
MustRegister
(
vars
.
RequestCount
)
met
.
MustRegister
(
vars
.
RequestDuration
)
met
.
MustRegister
(
vars
.
RequestDuration
)
met
.
MustRegister
(
vars
.
RequestSize
)
met
.
MustRegister
(
vars
.
RequestSize
)
...
@@ -137,10 +138,8 @@ func keys(m map[string]bool) []string {
...
@@ -137,10 +138,8 @@ func keys(m map[string]bool) []string {
// we listen on "localhost:0" and need to retrieve the actual address.
// we listen on "localhost:0" and need to retrieve the actual address.
var
ListenAddr
string
var
ListenAddr
string
var
(
var
buildInfo
=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
buildInfo
=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
plugin
.
Namespace
,
Namespace
:
plugin
.
Namespace
,
Name
:
"build_info"
,
Name
:
"build_info"
,
Help
:
"A metric with a constant '1' value labeled by version, revision, and goversion from which CoreDNS was built."
,
Help
:
"A metric with a constant '1' value labeled by version, revision, and goversion from which CoreDNS was built."
,
},
[]
string
{
"version"
,
"revision"
,
"goversion"
})
},
[]
string
{
"version"
,
"revision"
,
"goversion"
})
)
plugin/metrics/vars/vars.go
View file @
7c275777
...
@@ -59,6 +59,12 @@ var (
...
@@ -59,6 +59,12 @@ var (
Name
:
"response_rcode_count_total"
,
Name
:
"response_rcode_count_total"
,
Help
:
"Counter of response status codes."
,
Help
:
"Counter of response status codes."
,
},
[]
string
{
"server"
,
"zone"
,
"rcode"
})
},
[]
string
{
"server"
,
"zone"
,
"rcode"
})
Panic
=
prometheus
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
plugin
.
Namespace
,
Name
:
"panic_count_total"
,
Help
:
"A metrics that counts the number of panics."
,
})
)
)
const
(
const
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment