Update timing histograms (#1253)

* Use seconds for bucketing.
* Add template for high accuracy timing buckets to avoid copy-pasta.
This commit is contained in:
Ben Kochie
2017-11-27 22:34:26 +01:00
committed by Miek Gieben
parent 9d52b5acb9
commit 06006fac56
4 changed files with 10 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ func Report(req request.Request, zone, rcode string, size int, start time.Time)
typ := req.QType()
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() {
RequestDo.WithLabelValues(zone).Inc()

View File

@@ -18,9 +18,9 @@ var (
RequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: plugin.Namespace,
Subsystem: subsystem,
Name: "request_duration_milliseconds",
Buckets: append(prometheus.DefBuckets, []float64{50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000, 10000}...),
Help: "Histogram of the time (in milliseconds) each request took.",
Name: "request_duration_seconds",
Buckets: plugin.TimeBuckets,
Help: "Histogram of the time (in seconds) each request took.",
}, []string{"zone"})
RequestSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{