From 07a1ede6dcac906d81b973e2cedb6512c821c55c Mon Sep 17 00:00:00 2001 From: Alex Le Date: Wed, 29 Nov 2023 13:46:00 -0800 Subject: [PATCH] removed stop duration metric replaced it by log Signed-off-by: Alex Le --- CHANGELOG.md | 2 +- pkg/compactor/compactor.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c38cf7c12e..dd788f6e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * [CHANGE] Index Cache: Multi level cache backfilling operation becomes async. Added `-blocks-storage.bucket-store.index-cache.multilevel.max-async-concurrency` and `-blocks-storage.bucket-store.index-cache.multilevel.max-async-buffer-size` configs and metric `cortex_store_multilevel_index_cache_backfill_dropped_items_total` for number of dropped items. #5661 * [FEATURE] Ingester: Add per-tenant new metric `cortex_ingester_tsdb_data_replay_duration_seconds`. #5477 * [ENHANCEMENT] Store Gateway: Added `-store-gateway.enabled-tenants` and `-store-gateway.disabled-tenants` to explicitly enable or disable store-gateway for specific tenants. #5638 -* [ENHANCEMENT] Compactor: Add compactor start and stop duration in seconds metrics. #5683 +* [ENHANCEMENT] Compactor: Add new compactor metric `cortex_compactor_start_duration_seconds`. #5683 ## 1.16.0 2023-11-20 diff --git a/pkg/compactor/compactor.go b/pkg/compactor/compactor.go index 19f34aeccd..06f242103a 100644 --- a/pkg/compactor/compactor.go +++ b/pkg/compactor/compactor.go @@ -322,7 +322,6 @@ type Compactor struct { // Metrics. CompactorStartDurationSeconds prometheus.Gauge - CompactorStopDurationSeconds prometheus.Gauge compactionRunsStarted prometheus.Counter compactionRunsInterrupted prometheus.Counter compactionRunsCompleted prometheus.Counter @@ -409,10 +408,6 @@ func newCompactor( Name: "cortex_compactor_start_duration_seconds", Help: "Time in seconds spent by compactor running start function", }), - CompactorStopDurationSeconds: promauto.With(registerer).NewGauge(prometheus.GaugeOpts{ - Name: "cortex_compactor_stop_duration_seconds", - Help: "Time in seconds spent by compactor running stop function", - }), compactionRunsStarted: promauto.With(registerer).NewCounter(prometheus.CounterOpts{ Name: "cortex_compactor_runs_started_total", Help: "Total number of compaction runs started.", @@ -498,6 +493,7 @@ func (c *Compactor) starting(ctx context.Context) error { begin := time.Now() defer func() { c.CompactorStartDurationSeconds.Set(time.Since(begin).Seconds()) + level.Info(c.logger).Log("msg", "compactor started", "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds()) }() var err error @@ -598,7 +594,7 @@ func (c *Compactor) starting(ctx context.Context) error { func (c *Compactor) stopping(_ error) error { begin := time.Now() defer func() { - c.CompactorStopDurationSeconds.Set(time.Since(begin).Seconds()) + level.Info(c.logger).Log("msg", "compactor stopped", "duration", time.Since(begin), "duration_ms", time.Since(begin).Milliseconds()) }() ctx := context.Background()