From 6c95e8842034853396cfb763d5014122ecd18338 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Thu, 22 Jan 2026 20:33:41 +0900 Subject: [PATCH] delete user label in timeout push timeout metric Signed-off-by: SungJin1212 --- CHANGELOG.md | 2 +- pkg/distributor/distributor.go | 44 ++++++++++++++--------------- pkg/distributor/distributor_test.go | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccd4d0ee2cf..e749c3372c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ * [ENHANCEMENT] Ingester: Add support for ingesting Native Histogram with Custom Buckets. #7191 * [ENHANCEMENT] Ingester: Optimize labels out-of-order (ooo) check by allowing the iteration to terminate immediately upon finding the first unsorted label. #7186 * [ENHANCEMENT] Distributor: Skip attaching `__unit__` and `__type__` labels when `-distributor.enable-type-and-unit-labels` is enabled, as these are appended from metadata. #7145 -* [ENHANCEMENT] Distributor: Add `cortex_distributor_ingester_push_timeouts_total` metric to track the number of push requests to ingesters that were canceled due to timeout. #7155 +* [ENHANCEMENT] Distributor: Add `cortex_distributor_ingester_push_timeouts_total` metric to track the number of push requests to ingesters that were canceled due to timeout. #7155 #7229 * [ENHANCEMENT] StoreGateway: Add tracings to parquet mode. #7125 * [ENHANCEMENT] Alertmanager: Upgrade alertmanger to 0.29.0 and add a new incidentIO integration. #7092 * [ENHANCEMENT] Querier: Add a `-querier.parquet-queryable-shard-cache-ttl` flag to add TTL to parquet shard cache. #7098 diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 30e8b7a05bc..6ac313200a0 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -111,25 +111,25 @@ type Distributor struct { inflightClientRequests atomic.Int64 // Metrics - queryDuration *instrument.HistogramCollector - receivedSamples *prometheus.CounterVec - receivedSamplesPerLabelSet *prometheus.CounterVec - receivedExemplars *prometheus.CounterVec - receivedMetadata *prometheus.CounterVec - incomingSamples *prometheus.CounterVec - incomingExemplars *prometheus.CounterVec - incomingMetadata *prometheus.CounterVec - nonHASamples *prometheus.CounterVec - dedupedSamples *prometheus.CounterVec - labelsHistogram prometheus.Histogram - ingesterAppends *prometheus.CounterVec - ingesterAppendFailures *prometheus.CounterVec - ingesterQueries *prometheus.CounterVec - ingesterQueryFailures *prometheus.CounterVec - ingesterPartialDataQueries prometheus.Counter - replicationFactor prometheus.Gauge - latestSeenSampleTimestampPerUser *prometheus.GaugeVec - distributorIngesterPushTimeoutPerUser *prometheus.CounterVec + queryDuration *instrument.HistogramCollector + receivedSamples *prometheus.CounterVec + receivedSamplesPerLabelSet *prometheus.CounterVec + receivedExemplars *prometheus.CounterVec + receivedMetadata *prometheus.CounterVec + incomingSamples *prometheus.CounterVec + incomingExemplars *prometheus.CounterVec + incomingMetadata *prometheus.CounterVec + nonHASamples *prometheus.CounterVec + dedupedSamples *prometheus.CounterVec + labelsHistogram prometheus.Histogram + ingesterAppends *prometheus.CounterVec + ingesterAppendFailures *prometheus.CounterVec + ingesterQueries *prometheus.CounterVec + ingesterQueryFailures *prometheus.CounterVec + ingesterPartialDataQueries prometheus.Counter + replicationFactor prometheus.Gauge + latestSeenSampleTimestampPerUser *prometheus.GaugeVec + distributorIngesterPushTimeout prometheus.Counter validateMetrics *validation.ValidateMetrics @@ -410,10 +410,10 @@ func New(cfg Config, clientConfig ingester_client.Config, limits *validation.Ove Name: "cortex_distributor_latest_seen_sample_timestamp_seconds", Help: "Unix timestamp of latest received sample per user.", }, []string{"user"}), - distributorIngesterPushTimeoutPerUser: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ + distributorIngesterPushTimeout: promauto.With(reg).NewCounter(prometheus.CounterOpts{ Name: "cortex_distributor_ingester_push_timeouts_total", Help: "The total number of push requests to ingesters that were canceled due to timeout.", - }, []string{"user"}), + }), validateMetrics: validation.NewValidateMetrics(reg), asyncExecutor: util.NewNoOpExecutor(), @@ -939,7 +939,7 @@ func (d *Distributor) doBatch(ctx context.Context, req *cortexpb.WriteRequest, s localCtx, cancel := context.WithTimeout(context.Background(), d.cfg.RemoteTimeout) defer func() { if errors.Is(localCtx.Err(), context.DeadlineExceeded) { - d.distributorIngesterPushTimeoutPerUser.WithLabelValues(userID).Inc() + d.distributorIngesterPushTimeout.Inc() } }() diff --git a/pkg/distributor/distributor_test.go b/pkg/distributor/distributor_test.go index 5c32e4d74bf..9cfc6a1501c 100644 --- a/pkg/distributor/distributor_test.go +++ b/pkg/distributor/distributor_test.go @@ -4554,6 +4554,6 @@ func TestDistributor_BatchTimeoutMetric(t *testing.T) { require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(` # HELP cortex_distributor_ingester_push_timeouts_total The total number of push requests to ingesters that were canceled due to timeout. # TYPE cortex_distributor_ingester_push_timeouts_total counter - cortex_distributor_ingester_push_timeouts_total{user="user-1"} 5 + cortex_distributor_ingester_push_timeouts_total 5 `), "cortex_distributor_ingester_push_timeouts_total")) }