Update timing histograms (#1253)
* Use seconds for bucketing. * Add template for high accuracy timing buckets to avoid copy-pasta.
This commit is contained in:
parent
9d52b5acb9
commit
06006fac56
4 changed files with 10 additions and 7 deletions
|
@ -20,7 +20,7 @@ func Report(req request.Request, zone, rcode string, size int, start time.Time)
|
||||||
typ := req.QType()
|
typ := req.QType()
|
||||||
|
|
||||||
RequestCount.WithLabelValues(zone, net, fam).Inc()
|
RequestCount.WithLabelValues(zone, net, fam).Inc()
|
||||||
RequestDuration.WithLabelValues(zone).Observe(float64(time.Since(start) / time.Millisecond))
|
RequestDuration.WithLabelValues(zone).Observe(time.Since(start).Seconds())
|
||||||
|
|
||||||
if req.Do() {
|
if req.Do() {
|
||||||
RequestDo.WithLabelValues(zone).Inc()
|
RequestDo.WithLabelValues(zone).Inc()
|
||||||
|
|
|
@ -18,9 +18,9 @@ var (
|
||||||
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
Namespace: plugin.Namespace,
|
Namespace: plugin.Namespace,
|
||||||
Subsystem: subsystem,
|
Subsystem: subsystem,
|
||||||
Name: "request_duration_milliseconds",
|
Name: "request_duration_seconds",
|
||||||
Buckets: append(prometheus.DefBuckets, []float64{50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000, 10000}...),
|
Buckets: plugin.TimeBuckets,
|
||||||
Help: "Histogram of the time (in milliseconds) each request took.",
|
Help: "Histogram of the time (in seconds) each request took.",
|
||||||
}, []string{"zone"})
|
}, []string{"zone"})
|
||||||
|
|
||||||
RequestSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
RequestSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
|
|
|
@ -100,3 +100,6 @@ func ClientWrite(rcode int) bool {
|
||||||
|
|
||||||
// Namespace is the namespace used for the metrics.
|
// Namespace is the namespace used for the metrics.
|
||||||
const Namespace = "coredns"
|
const Namespace = "coredns"
|
||||||
|
|
||||||
|
// TimeBuckets is based on Prometheus client_golang prometheus.DefBuckets
|
||||||
|
var TimeBuckets = []float64{0.00025, 0.0005, 0.001, 0.0025, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
|
||||||
|
|
|
@ -19,9 +19,9 @@ var (
|
||||||
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
Namespace: plugin.Namespace,
|
Namespace: plugin.Namespace,
|
||||||
Subsystem: "proxy",
|
Subsystem: "proxy",
|
||||||
Name: "request_duration_milliseconds",
|
Name: "request_duration_seconds",
|
||||||
Buckets: append(prometheus.DefBuckets, []float64{15, 20, 25, 30, 40, 50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000, 10000}...),
|
Buckets: plugin.TimeBuckets,
|
||||||
Help: "Histogram of the time (in milliseconds) each request took.",
|
Help: "Histogram of the time (in seconds) each request took.",
|
||||||
}, []string{"proto", "proxy_proto", "family", "to"})
|
}, []string{"proto", "proxy_proto", "family", "to"})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue