From 90a7612df334419b8b6cf4c830a339110719352a Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 12 Jun 2019 02:12:32 +0200 Subject: [PATCH] Make objectives of Summaries explicit With the next release of client_golang, Summaries will not have objectives by default. As it turns out, for prometheus_tsdb_head_gc_duration_seconds and prometheus_tsdb_wal_truncate_duration_seconds, the objective-less default makes more sense then the current default. To make sure we do the right thing before and after the upcoming release of client_golang, I have set the objectives explicitly wherever that was not the case so far: - prometheus_tsdb_head_gc_duration_seconds and prometheus_tsdb_wal_truncate_duration_seconds now have no objectives explicitly. - prometheus_tsdb_wal_fsync_duration_seconds now explicitly uses the previous default objectives. Signed-off-by: beorn7 --- head.go | 10 ++++++---- wal.go | 5 +++-- wal/wal.go | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/head.go b/head.go index b14c056f1..f9d497802 100644 --- a/head.go +++ b/head.go @@ -141,8 +141,9 @@ func newHeadMetrics(h *Head, r prometheus.Registerer) *headMetrics { Help: "Total number of chunks removed in the head", }) m.gcDuration = prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "prometheus_tsdb_head_gc_duration_seconds", - Help: "Runtime of garbage collection in the head block.", + Name: "prometheus_tsdb_head_gc_duration_seconds", + Help: "Runtime of garbage collection in the head block.", + Objectives: map[float64]float64{}, }) m.maxTime = prometheus.NewGaugeFunc(prometheus.GaugeOpts{ Name: "prometheus_tsdb_head_max_time", @@ -157,8 +158,9 @@ func newHeadMetrics(h *Head, r prometheus.Registerer) *headMetrics { return float64(h.MinTime()) }) m.walTruncateDuration = prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "prometheus_tsdb_wal_truncate_duration_seconds", - Help: "Duration of WAL truncation.", + Name: "prometheus_tsdb_wal_truncate_duration_seconds", + Help: "Duration of WAL truncation.", + Objectives: map[float64]float64{}, }) m.walCorruptionsTotal = prometheus.NewCounter(prometheus.CounterOpts{ Name: "prometheus_tsdb_wal_corruptions_total", diff --git a/wal.go b/wal.go index 86b3bf79c..81e1e2531 100644 --- a/wal.go +++ b/wal.go @@ -65,8 +65,9 @@ func newWalMetrics(wal *SegmentWAL, r prometheus.Registerer) *walMetrics { m := &walMetrics{} m.fsyncDuration = prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "prometheus_tsdb_wal_fsync_duration_seconds", - Help: "Duration of WAL fsync.", + Name: "prometheus_tsdb_wal_fsync_duration_seconds", + Help: "Duration of WAL fsync.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }) m.corruptions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "prometheus_tsdb_wal_corruptions_total", diff --git a/wal/wal.go b/wal/wal.go index f0e413f5c..e9ad327ef 100644 --- a/wal/wal.go +++ b/wal/wal.go @@ -200,8 +200,9 @@ func NewSize(logger log.Logger, reg prometheus.Registerer, dir string, segmentSi stopc: make(chan chan struct{}), } w.fsyncDuration = prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "prometheus_tsdb_wal_fsync_duration_seconds", - Help: "Duration of WAL fsync.", + Name: "prometheus_tsdb_wal_fsync_duration_seconds", + Help: "Duration of WAL fsync.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }) w.pageFlushes = prometheus.NewCounter(prometheus.CounterOpts{ Name: "prometheus_tsdb_wal_page_flushes_total",