From 5e5ba819cb52e0a63b8a37815a4a898b483ee64e Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Fri, 30 Jan 2026 15:12:39 +0900 Subject: [PATCH 1/3] Add source label to incoming/received data Signed-off-by: SungJin1212 --- CHANGELOG.md | 1 + pkg/cortexpb/cortex.pb.go | 200 ++++++++++++++-------------- pkg/cortexpb/cortex.proto | 1 + pkg/distributor/distributor.go | 82 ++++++++---- pkg/distributor/distributor_test.go | 112 +++++++++++----- pkg/util/push/push.go | 9 +- pkg/util/push/push_test.go | 14 +- 7 files changed, 247 insertions(+), 172 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f2b02e6a64..1ee9937f0f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * [FEATURE] Distributor: Add a per-tenant flag `-distributor.enable-type-and-unit-labels` that enables adding `__unit__` and `__type__` labels for remote write v2 and OTLP requests. This is a breaking change; the `-distributor.otlp.enable-type-and-unit-labels` flag is now deprecated, operates as a no-op, and has been consolidated into this new flag. #7077 * [FEATURE] Querier: Add experimental projection pushdown support in Parquet Queryable. #7152 * [FEATURE] Ingester: Add experimental active series queried metric. #7173 +* [ENHANCEMENT] Distributor: Add `source` label to `cortex_distributor_samples_in_total`, `cortex_distributor_received_samples_total`, and related metadata/exemplar metrics to distinguish between Prometheus Remote Write v1 (`rw1`) and v2 (`rw2`) traffic. * [ENHANCEMENT] Querier: Add `-querier.store-gateway-series-batch-size` flag to configure the maximum number of series to be batched in a single gRPC response message from Store Gateways. #7203 * [ENHANCEMENT] HATracker: Add `-distributor.ha-tracker.enable-startup-sync` flag. If enabled, the ha-tracker fetches all tracked keys on startup to populate the local cache. #7213 * [ENHANCEMENT] Ingester: Add support for ingesting Native Histogram with Custom Buckets. #7191 diff --git a/pkg/cortexpb/cortex.pb.go b/pkg/cortexpb/cortex.pb.go index e3bd3e51bf3..cd49eb37cfe 100644 --- a/pkg/cortexpb/cortex.pb.go +++ b/pkg/cortexpb/cortex.pb.go @@ -31,18 +31,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type SourceEnum int32 const ( - API SourceEnum = 0 - RULE SourceEnum = 1 + API SourceEnum = 0 + RULE SourceEnum = 1 + API_V2 SourceEnum = 2 ) var SourceEnum_name = map[int32]string{ 0: "API", 1: "RULE", + 2: "API_V2", } var SourceEnum_value = map[string]int32{ - "API": 0, - "RULE": 1, + "API": 0, + "RULE": 1, + "API_V2": 2, } func (SourceEnum) EnumDescriptor() ([]byte, []int) { @@ -1358,100 +1361,101 @@ func init() { func init() { proto.RegisterFile("cortex.proto", fileDescriptor_893a47d0a749d749) } var fileDescriptor_893a47d0a749d749 = []byte{ - // 1477 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xf8, 0x7b, 0x9f, 0x3f, 0xba, 0x99, 0xba, 0xed, 0x36, 0x6d, 0xd7, 0xa9, 0x2b, 0x20, - 0x2a, 0x55, 0x40, 0xa9, 0x28, 0x50, 0x55, 0x48, 0x76, 0xea, 0x34, 0x56, 0x6b, 0x27, 0x1a, 0x3b, - 0xa9, 0xca, 0xc5, 0xda, 0x38, 0xe3, 0x78, 0xd5, 0xfd, 0x30, 0x3b, 0xeb, 0xaa, 0xe1, 0xc4, 0x09, - 0x71, 0xe4, 0xc2, 0x85, 0x1b, 0xe2, 0xc2, 0x95, 0x33, 0xff, 0x40, 0x8f, 0xb9, 0x51, 0x55, 0x22, - 0xa2, 0xee, 0xa5, 0xdc, 0x7a, 0x80, 0x3b, 0x9a, 0xd9, 0x4f, 0xc7, 0xa9, 0x0a, 0xa8, 0x07, 0x6e, - 0x33, 0xbf, 0xf7, 0x66, 0xe6, 0x37, 0x6f, 0x7e, 0xef, 0xb7, 0x36, 0x14, 0x07, 0xb6, 0xe3, 0xd2, - 0xc7, 0x2b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, 0xe0, 0x9c, - 0x44, 0x7d, 0xab, 0x25, 0x27, 0xb8, 0x75, 0x90, 0xed, 0x7b, 0x4d, 0x19, 0x35, 0x3e, 0x3b, 0x7c, - 0xae, 0x26, 0x9e, 0x3e, 0x57, 0x13, 0xaf, 0x9e, 0xab, 0xe8, 0xab, 0xa9, 0x8a, 0x7e, 0x9a, 0xaa, - 0xe8, 0xc9, 0x54, 0x45, 0x87, 0x53, 0x15, 0xfd, 0x3e, 0x55, 0xd1, 0xcb, 0xa9, 0x9a, 0x78, 0x35, - 0x55, 0xd1, 0xb7, 0x2f, 0xd4, 0xc4, 0xe1, 0x0b, 0x35, 0xf1, 0xf4, 0x85, 0x9a, 0xf8, 0x3c, 0xfc, - 0x2b, 0xb8, 0x9b, 0x15, 0xff, 0xfd, 0xae, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x68, 0x4f, 0xef, - 0xc4, 0x2b, 0x0e, 0x00, 0x00, + // 1491 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xbd, 0x6f, 0x1b, 0x47, + 0x16, 0xe7, 0xf0, 0x7b, 0x1f, 0x3f, 0xbc, 0x1a, 0xd3, 0xf6, 0x5a, 0xb6, 0x97, 0x32, 0x8d, 0xbb, + 0x13, 0x6c, 0x43, 0x77, 0x90, 0x71, 0xbe, 0x3b, 0xc3, 0x38, 0x80, 0x94, 0x29, 0x8b, 0xb0, 0x49, + 0x09, 0x43, 0x4a, 0x86, 0xd3, 0x2c, 0x56, 0xd4, 0x50, 0x5c, 0x78, 0x3f, 0x98, 0x9d, 0xa5, 0x61, + 0xa5, 0x4a, 0x15, 0xa4, 0x4c, 0x93, 0x26, 0x5d, 0x90, 0x26, 0x6d, 0xea, 0xfc, 0x03, 0x2e, 0xd5, + 0xc5, 0x30, 0x10, 0x21, 0x96, 0x1b, 0xa7, 0x73, 0x91, 0xf4, 0xc1, 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0xd5, 0x2d, 0x16, 0x88, 0xed, 0x6c, 0xbc, 0x68, 0x23, 0x8c, 0x05, + 0xeb, 0x12, 0xc9, 0xf8, 0xbf, 0x20, 0xd1, 0x67, 0xd4, 0x9a, 0x98, 0xba, 0xeb, 0xbf, 0xe5, 0x4c, + 0x93, 0xb4, 0x83, 0xd0, 0xce, 0x6a, 0xb0, 0x34, 0x4e, 0xc6, 0xb7, 0x13, 0xfa, 0xce, 0x89, 0x5a, + 0xd5, 0x66, 0xf4, 0x2d, 0x22, 0xd1, 0xc2, 0x58, 0xdb, 0x37, 0x60, 0x61, 0xe8, 0x52, 0xdd, 0xa3, + 0x7b, 0x9a, 0x78, 0x61, 0x4f, 0xb7, 0x26, 0xe2, 0x59, 0x33, 0x44, 0x0e, 0x02, 0x83, 0x10, 0x6f, + 0xe8, 0x00, 0x31, 0x87, 0xf7, 0x97, 0xae, 0x06, 0xb9, 0xa7, 0xba, 0x39, 0xf5, 0x1b, 0x14, 0x11, + 0x7f, 0x82, 0x2f, 0x83, 0x14, 0x9f, 0x94, 0x11, 0x27, 0xc5, 0x00, 0x37, 0x0e, 0x88, 0xe9, 0xe2, + 0x5b, 0x90, 0xf5, 0x0e, 0x26, 0x54, 0x41, 0x42, 0x68, 0xf5, 0xd3, 0xae, 0x14, 0x74, 0xef, 0xe0, + 0x60, 0x42, 0x89, 0x48, 0xc6, 0x17, 0xa1, 0x38, 0xa6, 0xe6, 0x84, 0xd3, 0x12, 0x07, 0x54, 0x48, + 0x81, 0xcf, 0x09, 0x1d, 0xf1, 0xd0, 0xd4, 0x36, 0x3c, 0x11, 0xca, 0xfa, 0x21, 0x3e, 0xe7, 0xd2, + 0xf8, 0x11, 0x89, 0x93, 0x83, 0xad, 0xf0, 0x25, 0xb8, 0xd0, 0x6d, 0x0f, 0x48, 0x67, 0x4d, 0x1b, + 0x3c, 0xde, 0x6a, 0x6b, 0xdb, 0xbd, 0xfe, 0x56, 0x7b, 0xad, 0xb3, 0xde, 0x69, 0x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0x6b, 0xd4, 0x19, 0x8d, 0x18, 0xf5, 0x45, 0xbf, 0x40, 0x82, + 0x19, 0xc7, 0x4d, 0x6a, 0xef, 0x7b, 0x63, 0xa1, 0xf5, 0x0a, 0x09, 0x66, 0xd7, 0x6f, 0x00, 0xc4, + 0xbf, 0xc1, 0x39, 0x89, 0xe6, 0x56, 0x47, 0x4e, 0x71, 0xeb, 0x20, 0xdb, 0x0f, 0xdb, 0x32, 0xc2, + 0x00, 0xf9, 0xe6, 0x56, 0x47, 0xdb, 0x59, 0x95, 0xd3, 0xad, 0xff, 0x1f, 0xbe, 0x52, 0x53, 0x2f, + 0x5e, 0xa9, 0xa9, 0xb7, 0xaf, 0x54, 0xf4, 0xe9, 0xb1, 0x8a, 0xbe, 0x3d, 0x56, 0xd1, 0xf3, 0x63, + 0x15, 0x1d, 0x1e, 0xab, 0xe8, 0xa7, 0x63, 0x15, 0xbd, 0x39, 0x56, 0x53, 0x6f, 0x8f, 0x55, 0xf4, + 0xc5, 0x6b, 0x35, 0x75, 0xf8, 0x5a, 0x4d, 0xbd, 0x78, 0xad, 0xa6, 0x3e, 0x8a, 0xfe, 0x16, 0xee, + 0xe6, 0xc5, 0xff, 0xc0, 0x5b, 0xbf, 0x05, 0x00, 0x00, 0xff, 0xff, 0x26, 0x07, 0x65, 0x46, 0x37, + 0x0e, 0x00, 0x00, } func (x SourceEnum) String() string { diff --git a/pkg/cortexpb/cortex.proto b/pkg/cortexpb/cortex.proto index 8e27aa1ffa8..7276046d760 100644 --- a/pkg/cortexpb/cortex.proto +++ b/pkg/cortexpb/cortex.proto @@ -11,6 +11,7 @@ option (gogoproto.unmarshaler_all) = true; enum SourceEnum { API = 0; RULE = 1; + API_V2 = 2; } message MessageWithBufRef { diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 6ac313200a0..f958e94869a 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -329,7 +329,7 @@ func New(cfg Config, clientConfig ingester_client.Config, limits *validation.Ove Namespace: "cortex", Name: "distributor_received_samples_total", Help: "The total number of received samples, excluding rejected and deduped samples.", - }, []string{"user", "type"}), + }, []string{"user", "type", "source"}), receivedSamplesPerLabelSet: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_received_samples_per_labelset_total", @@ -339,27 +339,27 @@ func New(cfg Config, clientConfig ingester_client.Config, limits *validation.Ove Namespace: "cortex", Name: "distributor_received_exemplars_total", Help: "The total number of received exemplars, excluding rejected and deduped exemplars.", - }, []string{"user"}), + }, []string{"user", "source"}), receivedMetadata: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_received_metadata_total", Help: "The total number of received metadata, excluding rejected.", - }, []string{"user"}), + }, []string{"user", "source"}), incomingSamples: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_samples_in_total", Help: "The total number of samples that have come in to the distributor, including rejected or deduped samples.", - }, []string{"user", "type"}), + }, []string{"user", "type", "source"}), incomingExemplars: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_exemplars_in_total", Help: "The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars.", - }, []string{"user"}), + }, []string{"user", "source"}), incomingMetadata: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_metadata_in_total", Help: "The total number of metadata that have come in to the distributor, including rejected.", - }, []string{"user"}), + }, []string{"user", "source"}), nonHASamples: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{ Namespace: "cortex", Name: "distributor_non_ha_samples_received_total", @@ -518,25 +518,42 @@ func (d *Distributor) running(ctx context.Context) error { func (d *Distributor) cleanupInactiveUser(userID string) { d.ingestersRing.CleanupShuffleShardCache(userID) - d.HATracker.CleanupHATrackerMetricsForUser(userID) - d.receivedSamples.DeleteLabelValues(userID, sampleMetricTypeFloat) - d.receivedSamples.DeleteLabelValues(userID, sampleMetricTypeHistogram) - d.receivedExemplars.DeleteLabelValues(userID) - d.receivedMetadata.DeleteLabelValues(userID) - d.incomingSamples.DeleteLabelValues(userID, sampleMetricTypeFloat) - d.incomingSamples.DeleteLabelValues(userID, sampleMetricTypeHistogram) - d.incomingExemplars.DeleteLabelValues(userID) - d.incomingMetadata.DeleteLabelValues(userID) + labelsToMatch := map[string]string{"user": userID} + + if err := util.DeleteMatchingLabels(d.receivedSamples, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_received_samples_total metric for user", "user", userID, "err", err) + } + + if err := util.DeleteMatchingLabels(d.receivedExemplars, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_received_exemplars_total metric for user", "user", userID, "err", err) + } + + if err := util.DeleteMatchingLabels(d.receivedMetadata, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_received_metadata_total metric for user", "user", userID, "err", err) + } + + if err := util.DeleteMatchingLabels(d.incomingSamples, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_samples_in_total metric for user", "user", userID, "err", err) + } + + if err := util.DeleteMatchingLabels(d.incomingExemplars, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_exemplars_in_total metric for user", "user", userID, "err", err) + } + + if err := util.DeleteMatchingLabels(d.incomingMetadata, labelsToMatch); err != nil { + level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_metadata_in_total metric for user", "user", userID, "err", err) + } + d.nonHASamples.DeleteLabelValues(userID) d.latestSeenSampleTimestampPerUser.DeleteLabelValues(userID) - if err := util.DeleteMatchingLabels(d.dedupedSamples, map[string]string{"user": userID}); err != nil { + if err := util.DeleteMatchingLabels(d.dedupedSamples, labelsToMatch); err != nil { level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_deduped_samples_total metric for user", "user", userID, "err", err) } - if err := util.DeleteMatchingLabels(d.receivedSamplesPerLabelSet, map[string]string{"user": userID}); err != nil { + if err := util.DeleteMatchingLabels(d.receivedSamplesPerLabelSet, labelsToMatch); err != nil { level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_received_samples_per_labelset_total metric for user", "user", userID, "err", err) } @@ -742,12 +759,14 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co numHistogramSamples += len(ts.Histograms) numExemplars += len(ts.Exemplars) } + sourceLabel := getSourceLabel(req.Source) + // Count the total samples, exemplars in, prior to validation or deduplication, for comparison with other metrics. - d.incomingSamples.WithLabelValues(userID, sampleMetricTypeFloat).Add(float64(numFloatSamples)) - d.incomingSamples.WithLabelValues(userID, sampleMetricTypeHistogram).Add(float64(numHistogramSamples)) - d.incomingExemplars.WithLabelValues(userID).Add(float64(numExemplars)) + d.incomingSamples.WithLabelValues(userID, sampleMetricTypeFloat, sourceLabel).Add(float64(numFloatSamples)) + d.incomingSamples.WithLabelValues(userID, sampleMetricTypeHistogram, sourceLabel).Add(float64(numHistogramSamples)) + d.incomingExemplars.WithLabelValues(userID, sourceLabel).Add(float64(numExemplars)) // Count the total number of metadata in. - d.incomingMetadata.WithLabelValues(userID).Add(float64(len(req.Metadata))) + d.incomingMetadata.WithLabelValues(userID, sourceLabel).Add(float64(len(req.Metadata))) if d.cfg.InstanceLimits.MaxInflightPushRequests > 0 && inflight > int64(d.cfg.InstanceLimits.MaxInflightPushRequests) { return nil, httpgrpc.Errorf(http.StatusServiceUnavailable, "too many inflight push requests in distributor") @@ -798,10 +817,10 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co } metadataKeys, validatedMetadata, firstPartialErr := d.prepareMetadataKeys(req, limits, userID, firstPartialErr) - d.receivedSamples.WithLabelValues(userID, sampleMetricTypeFloat).Add(float64(validatedFloatSamples)) - d.receivedSamples.WithLabelValues(userID, sampleMetricTypeHistogram).Add(float64(validatedHistogramSamples)) - d.receivedExemplars.WithLabelValues(userID).Add(float64(validatedExemplars)) - d.receivedMetadata.WithLabelValues(userID).Add(float64(len(validatedMetadata))) + d.receivedSamples.WithLabelValues(userID, sampleMetricTypeFloat, sourceLabel).Add(float64(validatedFloatSamples)) + d.receivedSamples.WithLabelValues(userID, sampleMetricTypeHistogram, sourceLabel).Add(float64(validatedHistogramSamples)) + d.receivedExemplars.WithLabelValues(userID, sourceLabel).Add(float64(validatedExemplars)) + d.receivedMetadata.WithLabelValues(userID, sourceLabel).Add(float64(len(validatedMetadata))) if len(seriesKeys) == 0 && len(nhSeriesKeys) == 0 && len(metadataKeys) == 0 { return &cortexpb.WriteResponse{}, firstPartialErr @@ -1757,3 +1776,16 @@ func getLimitFromSelectHints(hints *storage.SelectHints) int { } return 0 } + +func getSourceLabel(s cortexpb.SourceEnum) string { + switch s { + case cortexpb.API: + return "rw1" + case cortexpb.API_V2: + return "rw2" + case cortexpb.RULE: + return "rule" + default: + return "unknown" + } +} diff --git a/pkg/distributor/distributor_test.go b/pkg/distributor/distributor_test.go index 9cfc6a1501c..262e682a2c1 100644 --- a/pkg/distributor/distributor_test.go +++ b/pkg/distributor/distributor_test.go @@ -294,8 +294,8 @@ func TestDistributor_Push(t *testing.T) { cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.004 # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0 - cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5 + cortex_distributor_received_samples_total{source="rw1", type="float",user="userDistributorPush"} 0 + cortex_distributor_received_samples_total{source="rw1", type="histogram",user="userDistributorPush"} 5 `, }, "A push to 2 happy ingesters should succeed, histograms": { @@ -312,8 +312,8 @@ func TestDistributor_Push(t *testing.T) { cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.004 # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0 - cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5 + cortex_distributor_received_samples_total{source="rw1", type="float",user="userDistributorPush"} 0 + cortex_distributor_received_samples_total{source="rw1", type="histogram",user="userDistributorPush"} 5 `, }, "A push to 1 happy ingesters should fail, histograms": { @@ -329,8 +329,8 @@ func TestDistributor_Push(t *testing.T) { cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.009 # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0 - cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 10 + cortex_distributor_received_samples_total{source="rw1", type="float",user="userDistributorPush"} 0 + cortex_distributor_received_samples_total{source="rw1", type="histogram",user="userDistributorPush"} 10 `, }, "A push exceeding burst size should fail, histograms": { @@ -347,8 +347,8 @@ func TestDistributor_Push(t *testing.T) { cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.024 # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0 - cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 25 + cortex_distributor_received_samples_total{source="rw1", type="float",user="userDistributorPush"} 0 + cortex_distributor_received_samples_total{source="rw1", type="histogram",user="userDistributorPush"} 25 `, }, } { @@ -400,6 +400,44 @@ func TestDistributor_Push(t *testing.T) { } } +func TestDistributor_Push_RWV2_Source(t *testing.T) { + t.Parallel() + ctx := user.InjectOrgID(context.Background(), "userV2") + + ds, _, regs, _ := prepare(t, prepConfig{ + numIngesters: 3, + happyIngesters: 3, + numDistributors: 1, + }) + + request := makeWriteRequest(0, 10, 5, 10) + request.Source = cortexpb.API_V2 + + _, err := ds[0].Push(ctx, request) + require.NoError(t, err) + + expected := ` + # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. + # TYPE cortex_distributor_received_samples_total counter + cortex_distributor_received_samples_total{source="rw2",type="float",user="userV2"} 10 + cortex_distributor_received_samples_total{source="rw2",type="histogram",user="userV2"} 10 + # HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected. + # TYPE cortex_distributor_received_metadata_total counter + cortex_distributor_received_metadata_total{source="rw2",user="userV2"} 5 + # HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples. + # TYPE cortex_distributor_samples_in_total counter + cortex_distributor_samples_in_total{source="rw2",type="float",user="userV2"} 10 + cortex_distributor_samples_in_total{source="rw2",type="histogram",user="userV2"} 10 + ` + + test.Poll(t, time.Second, nil, func() any { + return testutil.GatherAndCompare(regs[0], strings.NewReader(expected), + "cortex_distributor_received_samples_total", + "cortex_distributor_received_metadata_total", + "cortex_distributor_samples_in_total") + }) +} + func TestDistributor_MetricsCleanup(t *testing.T) { t.Parallel() dists, _, regs, r := prepare(t, prepConfig{ @@ -431,17 +469,17 @@ func TestDistributor_MetricsCleanup(t *testing.T) { allMetrics := append(removedMetrics, permanentMetrics...) - d.receivedSamples.WithLabelValues("userA", sampleMetricTypeFloat).Add(5) - d.receivedSamples.WithLabelValues("userB", sampleMetricTypeFloat).Add(10) - d.receivedSamples.WithLabelValues("userC", sampleMetricTypeHistogram).Add(15) - d.receivedExemplars.WithLabelValues("userA").Add(5) - d.receivedExemplars.WithLabelValues("userB").Add(10) - d.receivedMetadata.WithLabelValues("userA").Add(5) - d.receivedMetadata.WithLabelValues("userB").Add(10) - d.incomingSamples.WithLabelValues("userA", sampleMetricTypeFloat).Add(5) - d.incomingSamples.WithLabelValues("userB", sampleMetricTypeHistogram).Add(6) - d.incomingExemplars.WithLabelValues("userA").Add(5) - d.incomingMetadata.WithLabelValues("userA").Add(5) + d.receivedSamples.WithLabelValues("userA", sampleMetricTypeFloat, "rw1").Add(5) + d.receivedSamples.WithLabelValues("userB", sampleMetricTypeFloat, "rw2").Add(10) + d.receivedSamples.WithLabelValues("userC", sampleMetricTypeHistogram, "rw2").Add(15) + d.receivedExemplars.WithLabelValues("userA", "rw1").Add(5) + d.receivedExemplars.WithLabelValues("userB", "rw2").Add(10) + d.receivedMetadata.WithLabelValues("userA", "rw1").Add(5) + d.receivedMetadata.WithLabelValues("userB", "rw2").Add(10) + d.incomingSamples.WithLabelValues("userA", sampleMetricTypeFloat, "rw1").Add(5) + d.incomingSamples.WithLabelValues("userB", sampleMetricTypeHistogram, "rw2").Add(6) + d.incomingExemplars.WithLabelValues("userA", "rw1").Add(5) + d.incomingMetadata.WithLabelValues("userA", "rw1").Add(5) d.nonHASamples.WithLabelValues("userA").Add(5) d.dedupedSamples.WithLabelValues("userA", "cluster1").Inc() // We cannot clean this metric d.latestSeenSampleTimestampPerUser.WithLabelValues("userA").Set(1111) @@ -471,7 +509,7 @@ func TestDistributor_MetricsCleanup(t *testing.T) { # HELP cortex_distributor_metadata_in_total The total number of metadata that have come in to the distributor, including rejected. # TYPE cortex_distributor_metadata_in_total counter - cortex_distributor_metadata_in_total{user="userA"} 5 + cortex_distributor_metadata_in_total{source="rw1", user="userA"} 5 # HELP cortex_distributor_non_ha_samples_received_total The total number of received samples for a user that has HA tracking turned on, but the sample didn't contain both HA labels. # TYPE cortex_distributor_non_ha_samples_received_total counter @@ -479,8 +517,8 @@ func TestDistributor_MetricsCleanup(t *testing.T) { # HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected. # TYPE cortex_distributor_received_metadata_total counter - cortex_distributor_received_metadata_total{user="userA"} 5 - cortex_distributor_received_metadata_total{user="userB"} 10 + cortex_distributor_received_metadata_total{source="rw1", user="userA"} 5 + cortex_distributor_received_metadata_total{source="rw2", user="userB"} 10 # HELP cortex_distributor_received_samples_per_labelset_total The total number of received samples per label set, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_per_labelset_total counter @@ -489,23 +527,23 @@ func TestDistributor_MetricsCleanup(t *testing.T) { # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userA"} 5 - cortex_distributor_received_samples_total{type="float",user="userB"} 10 - cortex_distributor_received_samples_total{type="histogram",user="userC"} 15 + cortex_distributor_received_samples_total{source="rw1", type="float",user="userA"} 5 + cortex_distributor_received_samples_total{source="rw2", type="float",user="userB"} 10 + cortex_distributor_received_samples_total{source="rw2", type="histogram",user="userC"} 15 # HELP cortex_distributor_received_exemplars_total The total number of received exemplars, excluding rejected and deduped exemplars. # TYPE cortex_distributor_received_exemplars_total counter - cortex_distributor_received_exemplars_total{user="userA"} 5 - cortex_distributor_received_exemplars_total{user="userB"} 10 + cortex_distributor_received_exemplars_total{source="rw1", user="userA"} 5 + cortex_distributor_received_exemplars_total{source="rw2", user="userB"} 10 # HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples. # TYPE cortex_distributor_samples_in_total counter - cortex_distributor_samples_in_total{type="float",user="userA"} 5 - cortex_distributor_samples_in_total{type="histogram",user="userB"} 6 + cortex_distributor_samples_in_total{source="rw1", type="float",user="userA"} 5 + cortex_distributor_samples_in_total{source="rw2", type="histogram",user="userB"} 6 # HELP cortex_distributor_exemplars_in_total The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars. # TYPE cortex_distributor_exemplars_in_total counter - cortex_distributor_exemplars_in_total{user="userA"} 5 + cortex_distributor_exemplars_in_total{source="rw1", user="userA"} 5 # HELP cortex_distributor_ingester_append_failures_total The total number of failed batch appends sent to ingesters. # TYPE cortex_distributor_ingester_append_failures_total counter @@ -544,20 +582,20 @@ func TestDistributor_MetricsCleanup(t *testing.T) { require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(` # HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected. # TYPE cortex_distributor_received_metadata_total counter - cortex_distributor_received_metadata_total{user="userB"} 10 + cortex_distributor_received_metadata_total{source="rw2", user="userB"} 10 # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter - cortex_distributor_received_samples_total{type="float",user="userB"} 10 - cortex_distributor_received_samples_total{type="histogram",user="userC"} 15 + cortex_distributor_received_samples_total{source="rw2", type="float",user="userB"} 10 + cortex_distributor_received_samples_total{source="rw2", type="histogram",user="userC"} 15 # HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples. # TYPE cortex_distributor_samples_in_total counter - cortex_distributor_samples_in_total{type="histogram",user="userB"} 6 + cortex_distributor_samples_in_total{source="rw2", type="histogram",user="userB"} 6 # HELP cortex_distributor_received_exemplars_total The total number of received exemplars, excluding rejected and deduped exemplars. # TYPE cortex_distributor_received_exemplars_total counter - cortex_distributor_received_exemplars_total{user="userB"} 10 + cortex_distributor_received_exemplars_total{source="rw2", user="userB"} 10 # HELP cortex_distributor_ingester_append_failures_total The total number of failed batch appends sent to ingesters. # TYPE cortex_distributor_ingester_append_failures_total counter @@ -4364,8 +4402,8 @@ func TestDistributor_Push_RelabelDropWillExportMetricOfDroppedSamples(t *testing require.Equal(t, testutil.ToFloat64(ds[0].validateMetrics.DiscardedSamples.WithLabelValues(validation.DroppedByRelabelConfiguration, id)), float64(1)) require.Equal(t, testutil.ToFloat64(ds[0].validateMetrics.DiscardedExemplars.WithLabelValues(validation.DroppedByRelabelConfiguration, id)), float64(2)) - receivedFloatSamples := testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "float")) - receivedHistogramSamples := testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "histogram")) + receivedFloatSamples := testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "float", "rw1")) + receivedHistogramSamples := testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "histogram", "rw1")) if histogramEnabled { require.Equal(t, receivedFloatSamples, float64(0)) require.Equal(t, receivedHistogramSamples, float64(1)) diff --git a/pkg/util/push/push.go b/pkg/util/push/push.go index d15c5e51e2b..edd0672f33c 100644 --- a/pkg/util/push/push.go +++ b/pkg/util/push/push.go @@ -101,11 +101,6 @@ func Handler(remoteWrite2Enabled bool, maxRecvMsgSize int, overrides *validation return } - req.SkipLabelNameValidation = false - if req.Source == 0 { - req.Source = cortexpb.API - } - v1Req, err := convertV2RequestToV1(&req, overrides.EnableTypeAndUnitLabels(userID)) if err != nil { level.Error(logger).Log("err", err.Error()) @@ -114,9 +109,7 @@ func Handler(remoteWrite2Enabled bool, maxRecvMsgSize int, overrides *validation } v1Req.SkipLabelNameValidation = false - if v1Req.Source == 0 { - v1Req.Source = cortexpb.API - } + v1Req.Source = cortexpb.API_V2 if resp, err := push(ctx, &v1Req.WriteRequest); err != nil { resp, ok := httpgrpc.HTTPResponseFromError(err) diff --git a/pkg/util/push/push_test.go b/pkg/util/push/push_test.go index bf21863eea4..3f88ea09e99 100644 --- a/pkg/util/push/push_test.go +++ b/pkg/util/push/push_test.go @@ -463,7 +463,7 @@ func TestHandler_remoteWrite(t *testing.T) { ctx := context.Background() ctx = user.InjectOrgID(ctx, "user-1") - handler := Handler(true, 100000, overrides, nil, verifyWriteRequestHandler(t, cortexpb.API)) + handler := Handler(true, 100000, overrides, nil, verifyWriteRequestHandler(t, cortexpb.API_V2)) req := createRequest(t, createPrometheusRemoteWriteV2Protobuf(t), true) req = req.WithContext(ctx) resp := httptest.NewRecorder() @@ -484,7 +484,6 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) { overrides := validation.NewOverrides(limits, nil) sourceIPs, _ := middleware.NewSourceIPs("SomeField", "(.*)") - handler := Handler(true, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, cortexpb.API)) tests := []struct { description string @@ -587,6 +586,12 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) { for _, test := range tests { t.Run(test.description, func(t *testing.T) { + expectedSource := cortexpb.API + if test.isV2 { + expectedSource = cortexpb.API_V2 + } + handler := Handler(true, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, expectedSource)) + if test.isV2 { ctx := context.Background() ctx = user.InjectOrgID(ctx, "user-1") @@ -612,9 +617,9 @@ func TestHandler_cortexWriteRequest(t *testing.T) { overrides := validation.NewOverrides(limits, nil) sourceIPs, _ := middleware.NewSourceIPs("SomeField", "(.*)") - handler := Handler(true, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, cortexpb.API)) t.Run("remote write v1", func(t *testing.T) { + handler := Handler(true, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, cortexpb.API)) req := createRequest(t, createCortexWriteRequestProtobuf(t, false, cortexpb.API), false) resp := httptest.NewRecorder() handler.ServeHTTP(resp, req) @@ -624,7 +629,8 @@ func TestHandler_cortexWriteRequest(t *testing.T) { ctx := context.Background() ctx = user.InjectOrgID(ctx, "user-1") - req := createRequest(t, createCortexRemoteWriteV2Protobuf(t, false, cortexpb.API), true) + handler := Handler(true, 100000, overrides, sourceIPs, verifyWriteRequestHandler(t, cortexpb.API_V2)) + req := createRequest(t, createCortexRemoteWriteV2Protobuf(t, false, cortexpb.API_V2), true) req = req.WithContext(ctx) resp := httptest.NewRecorder() handler.ServeHTTP(resp, req) From ce531cbc46c91e77eea7c32763e199712e92f797 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Fri, 30 Jan 2026 15:15:58 +0900 Subject: [PATCH 2/3] changelog Signed-off-by: SungJin1212 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ee9937f0f6..417308daf27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ * [FEATURE] Distributor: Add a per-tenant flag `-distributor.enable-type-and-unit-labels` that enables adding `__unit__` and `__type__` labels for remote write v2 and OTLP requests. This is a breaking change; the `-distributor.otlp.enable-type-and-unit-labels` flag is now deprecated, operates as a no-op, and has been consolidated into this new flag. #7077 * [FEATURE] Querier: Add experimental projection pushdown support in Parquet Queryable. #7152 * [FEATURE] Ingester: Add experimental active series queried metric. #7173 -* [ENHANCEMENT] Distributor: Add `source` label to `cortex_distributor_samples_in_total`, `cortex_distributor_received_samples_total`, and related metadata/exemplar metrics to distinguish between Prometheus Remote Write v1 (`rw1`) and v2 (`rw2`) traffic. +* [ENHANCEMENT] Distributor: Add `source` label to `cortex_distributor_samples_in_total`, `cortex_distributor_received_samples_total`, and related metadata/exemplar metrics to distinguish between Prometheus Remote Write v1 (`rw1`) and v2 (`rw2`) traffic. #7237 * [ENHANCEMENT] Querier: Add `-querier.store-gateway-series-batch-size` flag to configure the maximum number of series to be batched in a single gRPC response message from Store Gateways. #7203 * [ENHANCEMENT] HATracker: Add `-distributor.ha-tracker.enable-startup-sync` flag. If enabled, the ha-tracker fetches all tracked keys on startup to populate the local cache. #7213 * [ENHANCEMENT] Ingester: Add support for ingesting Native Histogram with Custom Buckets. #7191 From cdd8931f8c550c9e54b9c9acd997290fa448e018 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Fri, 30 Jan 2026 16:01:48 +0900 Subject: [PATCH 3/3] update test Signed-off-by: SungJin1212 --- pkg/distributor/distributor_test.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkg/distributor/distributor_test.go b/pkg/distributor/distributor_test.go index 262e682a2c1..1e13a0e4a8d 100644 --- a/pkg/distributor/distributor_test.go +++ b/pkg/distributor/distributor_test.go @@ -416,6 +416,12 @@ func TestDistributor_Push_RWV2_Source(t *testing.T) { _, err := ds[0].Push(ctx, request) require.NoError(t, err) + request = makeWriteRequestExemplar([]string{model.MetricNameLabel, "test"}, 1000, []string{"foo", "bar"}) + request.Source = cortexpb.API_V2 + + _, err = ds[0].Push(ctx, request) + require.NoError(t, err) + expected := ` # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples. # TYPE cortex_distributor_received_samples_total counter @@ -424,17 +430,30 @@ func TestDistributor_Push_RWV2_Source(t *testing.T) { # HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected. # TYPE cortex_distributor_received_metadata_total counter cortex_distributor_received_metadata_total{source="rw2",user="userV2"} 5 + # HELP cortex_distributor_received_exemplars_total The total number of received exemplars, excluding rejected and deduped exemplars. + # TYPE cortex_distributor_received_exemplars_total counter + cortex_distributor_received_exemplars_total{source="rw2",user="userV2"} 1 # HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples. # TYPE cortex_distributor_samples_in_total counter cortex_distributor_samples_in_total{source="rw2",type="float",user="userV2"} 10 cortex_distributor_samples_in_total{source="rw2",type="histogram",user="userV2"} 10 + # HELP cortex_distributor_metadata_in_total The total number of metadata that have come in to the distributor, including rejected. + # TYPE cortex_distributor_metadata_in_total counter + cortex_distributor_metadata_in_total{source="rw2",user="userV2"} 5 + # HELP cortex_distributor_exemplars_in_total The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars. + # TYPE cortex_distributor_exemplars_in_total counter + cortex_distributor_exemplars_in_total{source="rw2",user="userV2"} 1 ` test.Poll(t, time.Second, nil, func() any { return testutil.GatherAndCompare(regs[0], strings.NewReader(expected), "cortex_distributor_received_samples_total", + "cortex_distributor_received_exemplars_total", "cortex_distributor_received_metadata_total", - "cortex_distributor_samples_in_total") + "cortex_distributor_samples_in_total", + "cortex_distributor_exemplars_in_total", + "cortex_distributor_metadata_in_total", + ) }) }