@@ -93,8 +93,10 @@ type Distributor struct {
93
93
// Metrics
94
94
queryDuration * instrument.HistogramCollector
95
95
receivedSamples * prometheus.CounterVec
96
+ receivedExemplars * prometheus.CounterVec
96
97
receivedMetadata * prometheus.CounterVec
97
98
incomingSamples * prometheus.CounterVec
99
+ incomingExemplars * prometheus.CounterVec
98
100
incomingMetadata * prometheus.CounterVec
99
101
nonHASamples * prometheus.CounterVec
100
102
dedupedSamples * prometheus.CounterVec
@@ -241,6 +243,11 @@ func New(cfg Config, clientConfig ingester_client.Config, limits *validation.Ove
241
243
Name : "distributor_received_samples_total" ,
242
244
Help : "The total number of received samples, excluding rejected and deduped samples." ,
243
245
}, []string {"user" }),
246
+ receivedExemplars : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
247
+ Namespace : "cortex" ,
248
+ Name : "distributor_received_exemplars_total" ,
249
+ Help : "The total number of received exemplars, excluding rejected and deduped exemplars." ,
250
+ }, []string {"user" }),
244
251
receivedMetadata : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
245
252
Namespace : "cortex" ,
246
253
Name : "distributor_received_metadata_total" ,
@@ -251,6 +258,11 @@ func New(cfg Config, clientConfig ingester_client.Config, limits *validation.Ove
251
258
Name : "distributor_samples_in_total" ,
252
259
Help : "The total number of samples that have come in to the distributor, including rejected or deduped samples." ,
253
260
}, []string {"user" }),
261
+ incomingExemplars : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
262
+ Namespace : "cortex" ,
263
+ Name : "distributor_exemplars_in_total" ,
264
+ Help : "The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars." ,
265
+ }, []string {"user" }),
254
266
incomingMetadata : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
255
267
Namespace : "cortex" ,
256
268
Name : "distributor_metadata_in_total" ,
@@ -375,8 +387,10 @@ func (d *Distributor) cleanupInactiveUser(userID string) {
375
387
d .HATracker .cleanupHATrackerMetricsForUser (userID )
376
388
377
389
d .receivedSamples .DeleteLabelValues (userID )
390
+ d .receivedExemplars .DeleteLabelValues (userID )
378
391
d .receivedMetadata .DeleteLabelValues (userID )
379
392
d .incomingSamples .DeleteLabelValues (userID )
393
+ d .incomingExemplars .DeleteLabelValues (userID )
380
394
d .incomingMetadata .DeleteLabelValues (userID )
381
395
d .nonHASamples .DeleteLabelValues (userID )
382
396
d .latestSeenSampleTimestampPerUser .DeleteLabelValues (userID )
@@ -543,11 +557,14 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co
543
557
removeReplica := false
544
558
545
559
numSamples := 0
560
+ numExemplars := 0
546
561
for _ , ts := range req .Timeseries {
547
562
numSamples += len (ts .Samples )
563
+ numExemplars += len (ts .Exemplars )
548
564
}
549
565
// Count the total samples in, prior to validation or deduplication, for comparison with other metrics.
550
566
d .incomingSamples .WithLabelValues (userID ).Add (float64 (numSamples ))
567
+ d .incomingExemplars .WithLabelValues (userID ).Add (float64 (numExemplars ))
551
568
// Count the total number of metadata in.
552
569
d .incomingMetadata .WithLabelValues (userID ).Add (float64 (len (req .Metadata )))
553
570
@@ -675,6 +692,7 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co
675
692
}
676
693
677
694
d .receivedSamples .WithLabelValues (userID ).Add (float64 (validatedSamples ))
695
+ d .receivedExemplars .WithLabelValues (userID ).Add ((float64 (validatedExemplars )))
678
696
d .receivedMetadata .WithLabelValues (userID ).Add (float64 (len (validatedMetadata )))
679
697
680
698
if len (seriesKeys ) == 0 && len (metadataKeys ) == 0 {
@@ -692,6 +710,7 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co
692
710
// Return a 4xx here to have the client discard the data and not retry. If a client
693
711
// is sending too much data consistently we will unlikely ever catch up otherwise.
694
712
validation .DiscardedSamples .WithLabelValues (validation .RateLimited , userID ).Add (float64 (validatedSamples ))
713
+ validation .DiscardedExemplars .WithLabelValues (validation .RateLimited , userID ).Add (float64 (validatedExemplars ))
695
714
validation .DiscardedMetadata .WithLabelValues (validation .RateLimited , userID ).Add (float64 (len (validatedMetadata )))
696
715
return nil , httpgrpc .Errorf (http .StatusTooManyRequests , "ingestion rate limit (%v) exceeded while adding %d samples and %d metadata" , d .ingestionRateLimiter .Limit (now , userID ), validatedSamples , len (validatedMetadata ))
697
716
}
0 commit comments