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
e41e8683
Commit
e41e8683
authored
Apr 03, 2016
by
Miek Gieben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prometheus: add docs and fix varz a little
parent
f58f1e42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
middleware/prometheus/README.md
middleware/prometheus/README.md
+30
-0
middleware/prometheus/metrics.go
middleware/prometheus/metrics.go
+2
-2
No files found.
middleware/prometheus/README.md
0 → 100644
View file @
e41e8683
# prometheus
This module enables prometheus metrics for CoreDNS.
The following metrics are exported:
*
coredns_dns_request_count_total
*
coredns_dns_request_duration_seconds
*
coredns_dns_response_size_bytes
*
coredns_dns_response_rcode_count_total
Each counter has a label
`zone`
which is the zonename used for the request/response.
The
`request_count`
metrics has an extra label
`qtype`
which holds the qtype. And
`rcode_count`
has an extra label which has the rcode.
Restarting CoreDNS will stop the monitoring. This is a bug. Also [this upstream
Caddy bug](https://github.com/mholt/caddy/issues/675).
## Syntax
~~~
prometheus
~~~
For each zone that you want to see metrics for.
It optionally takes an address where the metrics are exported, the default
is
`localhost:9153`
. The metrics path is fixed to
`/metrics`
.
## Examples
middleware/prometheus/metrics.go
View file @
e41e8683
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus"
)
)
const
namespace
=
"
daddy
"
const
namespace
=
"
coredns
"
var
(
var
(
requestCount
*
prometheus
.
CounterVec
requestCount
*
prometheus
.
CounterVec
...
@@ -74,7 +74,7 @@ func define(subsystem string) {
...
@@ -74,7 +74,7 @@ func define(subsystem string) {
responseRcode
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
responseRcode
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
namespace
,
Namespace
:
namespace
,
Subsystem
:
subsystem
,
Subsystem
:
subsystem
,
Name
:
"r
code_
code_count_total"
,
Name
:
"r
esponse_r
code_count_total"
,
Help
:
"Counter of response status codes."
,
Help
:
"Counter of response status codes."
,
},
[]
string
{
"zone"
,
"rcode"
})
},
[]
string
{
"zone"
,
"rcode"
})
}
}
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