@@ -290,10 +290,10 @@ func TestDistributor_Push(t *testing.T) {
290
290
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
291
291
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
292
292
cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.004
293
- # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
294
- # TYPE cortex_distributor_received_samples_total counter
295
- cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
296
- cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5
293
+ # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
294
+ # TYPE cortex_distributor_received_samples_total counter
295
+ cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
296
+ cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5
297
297
` ,
298
298
},
299
299
"A push to 2 happy ingesters should succeed, histograms" : {
@@ -308,10 +308,10 @@ func TestDistributor_Push(t *testing.T) {
308
308
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
309
309
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
310
310
cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.004
311
- # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
312
- # TYPE cortex_distributor_received_samples_total counter
313
- cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
314
- cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5
311
+ # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
312
+ # TYPE cortex_distributor_received_samples_total counter
313
+ cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
314
+ cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 5
315
315
` ,
316
316
},
317
317
"A push to 1 happy ingesters should fail, histograms" : {
@@ -325,10 +325,10 @@ func TestDistributor_Push(t *testing.T) {
325
325
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
326
326
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
327
327
cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.009
328
- # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
329
- # TYPE cortex_distributor_received_samples_total counter
330
- cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
331
- cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 10
328
+ # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
329
+ # TYPE cortex_distributor_received_samples_total counter
330
+ cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
331
+ cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 10
332
332
` ,
333
333
},
334
334
"A push exceeding burst size should fail, histograms" : {
@@ -343,10 +343,10 @@ func TestDistributor_Push(t *testing.T) {
343
343
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
344
344
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
345
345
cortex_distributor_latest_seen_sample_timestamp_seconds{user="userDistributorPush"} 123456789.024
346
- # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
347
- # TYPE cortex_distributor_received_samples_total counter
348
- cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
349
- cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 25
346
+ # HELP cortex_distributor_received_samples_total The total number of received samples, excluding rejected and deduped samples.
347
+ # TYPE cortex_distributor_received_samples_total counter
348
+ cortex_distributor_received_samples_total{type="float",user="userDistributorPush"} 0
349
+ cortex_distributor_received_samples_total{type="histogram",user="userDistributorPush"} 25
350
350
` ,
351
351
},
352
352
} {
@@ -3642,36 +3642,39 @@ func TestDistributor_Push_Relabel(t *testing.T) {
3642
3642
3643
3643
for _ , tc := range cases {
3644
3644
tc := tc
3645
- t .Run (tc .name , func (t * testing.T ) {
3646
- t .Parallel ()
3647
- var err error
3648
- var limits validation.Limits
3649
- flagext .DefaultValues (& limits )
3650
- limits .MetricRelabelConfigs = tc .metricRelabelConfigs
3651
-
3652
- ds , ingesters , _ , _ := prepare (t , prepConfig {
3653
- numIngesters : 2 ,
3654
- happyIngesters : 2 ,
3655
- numDistributors : 1 ,
3656
- shardByAllLabels : true ,
3657
- limits : & limits ,
3658
- })
3645
+ for _ , enableHistogram := range []bool {false , true } {
3646
+ enableHistogram := enableHistogram
3647
+ t .Run (fmt .Sprintf ("%s, histogram=%s" , tc .name , strconv .FormatBool (enableHistogram )), func (t * testing.T ) {
3648
+ t .Parallel ()
3649
+ var err error
3650
+ var limits validation.Limits
3651
+ flagext .DefaultValues (& limits )
3652
+ limits .MetricRelabelConfigs = tc .metricRelabelConfigs
3659
3653
3660
- // Push the series to the distributor
3661
- req := mockWriteRequest (tc .inputSeries , 1 , 1 , false )
3662
- _ , err = ds [0 ].Push (ctx , req )
3663
- require .NoError (t , err )
3654
+ ds , ingesters , _ , _ := prepare (t , prepConfig {
3655
+ numIngesters : 2 ,
3656
+ happyIngesters : 2 ,
3657
+ numDistributors : 1 ,
3658
+ shardByAllLabels : true ,
3659
+ limits : & limits ,
3660
+ })
3664
3661
3665
- // Since each test pushes only 1 series, we do expect the ingester
3666
- // to have received exactly 1 series
3667
- for i := range ingesters {
3668
- timeseries := ingesters [i ].series ()
3669
- assert .Equal (t , 1 , len (timeseries ))
3670
- for _ , v := range timeseries {
3671
- assert .Equal (t , tc .expectedSeries , cortexpb .FromLabelAdaptersToLabels (v .Labels ))
3662
+ // Push the series to the distributor
3663
+ req := mockWriteRequest (tc .inputSeries , 1 , 1 , enableHistogram )
3664
+ _ , err = ds [0 ].Push (ctx , req )
3665
+ require .NoError (t , err )
3666
+
3667
+ // Since each test pushes only 1 series, we do expect the ingester
3668
+ // to have received exactly 1 series
3669
+ for i := range ingesters {
3670
+ timeseries := ingesters [i ].series ()
3671
+ assert .Equal (t , 1 , len (timeseries ))
3672
+ for _ , v := range timeseries {
3673
+ assert .Equal (t , tc .expectedSeries , cortexpb .FromLabelAdaptersToLabels (v .Labels ))
3674
+ }
3672
3675
}
3673
- }
3674
- })
3676
+ })
3677
+ }
3675
3678
}
3676
3679
}
3677
3680
0 commit comments