mirror of
https://github.com/coredns/coredns.git
synced 2025-11-21 19:32:21 -05:00
A health middleware
Start http handler on port 8080 and return OK. Also add some documentation fixes for the prometheus middleware.
This commit is contained in:
@@ -9,9 +9,10 @@ The following metrics are exported:
|
||||
* 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.
|
||||
Each counter has a label `zone` which is the zonename used for the request/response,
|
||||
and a label `qtype` which old the query type.
|
||||
The `response_rcode_count_total` has an extra label `rcode` which holds the rcode
|
||||
of the response.
|
||||
|
||||
Restarting CoreDNS will stop the monitoring. This is a bug. Also [this upstream
|
||||
Caddy bug](https://github.com/mholt/caddy/issues/675).
|
||||
@@ -25,6 +26,6 @@ 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:9154`. The metrics path is fixed to `/metrics`.
|
||||
is `localhost:9135`. The metrics path is fixed to `/metrics`.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
@@ -39,8 +39,9 @@ func (m *Metrics) Start() error {
|
||||
|
||||
http.Handle(path, prometheus.Handler())
|
||||
go func() {
|
||||
// TODO(miek): Logging here?
|
||||
fmt.Errorf("%s", http.ListenAndServe(m.Addr, nil))
|
||||
if err := http.ListenAndServe(m.Addr, nil); err != nil {
|
||||
log.Printf("[ERROR] Failed to start prometheus handler: %s", err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user