@@ -124,6 +124,7 @@ func seriesSetFromResponseStream(s *mockQueryStreamServer) (storage.SeriesSet, e
124
124
125
125
func TestMatcherCache (t * testing.T ) {
126
126
limits := defaultLimitsTestConfig ()
127
+ limits .EnableNativeHistograms = true
127
128
userID := "1"
128
129
tenantLimits := newMockTenantLimits (map [string ]* validation.Limits {userID : & limits })
129
130
registry := prometheus .NewRegistry ()
@@ -135,7 +136,7 @@ func TestMatcherCache(t *testing.T) {
135
136
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
136
137
cfg := defaultIngesterTestConfig (t )
137
138
cfg .MatchersCacheMaxItems = 50
138
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry , true )
139
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry )
139
140
require .NoError (t , err )
140
141
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
141
142
@@ -204,7 +205,7 @@ func TestIngesterDeletionRace(t *testing.T) {
204
205
require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
205
206
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
206
207
207
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry , false )
208
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry )
208
209
require .NoError (t , err )
209
210
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
210
211
defer services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
@@ -254,6 +255,7 @@ func TestIngesterDeletionRace(t *testing.T) {
254
255
255
256
func TestIngesterPerLabelsetLimitExceeded (t * testing.T ) {
256
257
limits := defaultLimitsTestConfig ()
258
+ limits .EnableNativeHistograms = true
257
259
userID := "1"
258
260
registry := prometheus .NewRegistry ()
259
261
@@ -287,7 +289,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
287
289
require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
288
290
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
289
291
290
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry , true )
292
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry )
291
293
require .NoError (t , err )
292
294
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
293
295
// Wait until it's ACTIVE
@@ -630,7 +632,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
630
632
// Should persist between restarts
631
633
services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
632
634
registry = prometheus .NewRegistry ()
633
- ing , err = prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry , true )
635
+ ing , err = prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry )
634
636
require .NoError (t , err )
635
637
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
636
638
ing .updateActiveSeries (ctx )
@@ -661,6 +663,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
661
663
func TestPushRace (t * testing.T ) {
662
664
cfg := defaultIngesterTestConfig (t )
663
665
l := defaultLimitsTestConfig ()
666
+ l .EnableNativeHistograms = true
664
667
cfg .LabelsStringInterningEnabled = true
665
668
cfg .LifecyclerConfig .JoinAfter = 0
666
669
@@ -686,7 +689,7 @@ func TestPushRace(t *testing.T) {
686
689
blocksDir := filepath .Join (dir , "blocks" )
687
690
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
688
691
689
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , l , nil , blocksDir , prometheus .NewRegistry (), true )
692
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , l , nil , blocksDir , prometheus .NewRegistry ())
690
693
require .NoError (t , err )
691
694
defer services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
692
695
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
@@ -747,6 +750,7 @@ func TestPushRace(t *testing.T) {
747
750
748
751
func TestIngesterUserLimitExceeded (t * testing.T ) {
749
752
limits := defaultLimitsTestConfig ()
753
+ limits .EnableNativeHistograms = true
750
754
limits .MaxLocalSeriesPerUser = 1
751
755
limits .MaxLocalMetricsWithMetadataPerUser = 1
752
756
@@ -778,7 +782,7 @@ func TestIngesterUserLimitExceeded(t *testing.T) {
778
782
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
779
783
780
784
blocksIngesterGenerator := func (reg prometheus.Registerer ) * Ingester {
781
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , nil , blocksDir , reg , true )
785
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , nil , blocksDir , reg )
782
786
require .NoError (t , err )
783
787
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
784
788
// Wait until it's ACTIVE
@@ -878,6 +882,7 @@ func benchmarkData(nSeries int) (allLabels []labels.Labels, allSamples []cortexp
878
882
879
883
func TestIngesterMetricLimitExceeded (t * testing.T ) {
880
884
limits := defaultLimitsTestConfig ()
885
+ limits .EnableNativeHistograms = true
881
886
limits .MaxLocalSeriesPerMetric = 1
882
887
limits .MaxLocalMetadataPerMetric = 1
883
888
@@ -909,7 +914,7 @@ func TestIngesterMetricLimitExceeded(t *testing.T) {
909
914
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
910
915
911
916
blocksIngesterGenerator := func (reg prometheus.Registerer ) * Ingester {
912
- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , nil , blocksDir , reg , true )
917
+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , nil , blocksDir , reg )
913
918
require .NoError (t , err )
914
919
require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
915
920
// Wait until it's ACTIVE
@@ -1933,6 +1938,7 @@ func TestIngester_Push(t *testing.T) {
1933
1938
cfg .ActiveSeriesMetricsEnabled = ! testData .disableActiveSeries
1934
1939
1935
1940
limits := defaultLimitsTestConfig ()
1941
+ limits .EnableNativeHistograms = ! testData .disableNativeHistogram
1936
1942
limits .MaxExemplars = testData .maxExemplars
1937
1943
limits .OutOfOrderTimeWindow = model .Duration (testData .oooTimeWindow )
1938
1944
limits .LimitsPerLabelSet = []validation.LimitsPerLabelSet {
@@ -1945,7 +1951,7 @@ func TestIngester_Push(t *testing.T) {
1945
1951
Hash : 1 ,
1946
1952
},
1947
1953
}
1948
- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry , ! testData . disableNativeHistogram )
1954
+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry )
1949
1955
require .NoError (t , err )
1950
1956
require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
1951
1957
defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
@@ -2174,7 +2180,8 @@ func TestIngester_PushNativeHistogramErrors(t *testing.T) {
2174
2180
cfg .LifecyclerConfig .JoinAfter = 0
2175
2181
2176
2182
limits := defaultLimitsTestConfig ()
2177
- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry , true )
2183
+ limits .EnableNativeHistograms = true
2184
+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry )
2178
2185
require .NoError (t , err )
2179
2186
require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
2180
2187
defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
@@ -2662,6 +2669,7 @@ func Benchmark_Ingester_PushOnError(b *testing.B) {
2662
2669
cfg .LifecyclerConfig .JoinAfter = 0
2663
2670
2664
2671
limits := defaultLimitsTestConfig ()
2672
+ limits .EnableNativeHistograms = true
2665
2673
if ! testData .prepareConfig (& limits , instanceLimits ) {
2666
2674
b .SkipNow ()
2667
2675
}
@@ -2670,7 +2678,7 @@ func Benchmark_Ingester_PushOnError(b *testing.B) {
2670
2678
return instanceLimits
2671
2679
}
2672
2680
2673
- ingester , err := prepareIngesterWithBlocksStorageAndLimits (b , cfg , limits , nil , "" , registry , true )
2681
+ ingester , err := prepareIngesterWithBlocksStorageAndLimits (b , cfg , limits , nil , "" , registry )
2674
2682
require .NoError (b , err )
2675
2683
require .NoError (b , services .StartAndAwaitRunning (context .Background (), ingester ))
2676
2684
defer services .StopAndAwaitTerminated (context .Background (), ingester ) //nolint:errcheck
@@ -3947,10 +3955,12 @@ func mockHistogramWriteRequest(t *testing.T, lbls labels.Labels, value int64, ti
3947
3955
}
3948
3956
3949
3957
func prepareIngesterWithBlocksStorage (t testing.TB , ingesterCfg Config , registerer prometheus.Registerer ) (* Ingester , error ) {
3950
- return prepareIngesterWithBlocksStorageAndLimits (t , ingesterCfg , defaultLimitsTestConfig (), nil , "" , registerer , true )
3958
+ limits := defaultLimitsTestConfig ()
3959
+ limits .EnableNativeHistograms = true
3960
+ return prepareIngesterWithBlocksStorageAndLimits (t , ingesterCfg , limits , nil , "" , registerer )
3951
3961
}
3952
3962
3953
- func prepareIngesterWithBlocksStorageAndLimits (t testing.TB , ingesterCfg Config , limits validation.Limits , tenantLimits validation.TenantLimits , dataDir string , registerer prometheus.Registerer , nativeHistograms bool ) (* Ingester , error ) {
3963
+ func prepareIngesterWithBlocksStorageAndLimits (t testing.TB , ingesterCfg Config , limits validation.Limits , tenantLimits validation.TenantLimits , dataDir string , registerer prometheus.Registerer ) (* Ingester , error ) {
3954
3964
// Create a data dir if none has been provided.
3955
3965
if dataDir == "" {
3956
3966
dataDir = t .TempDir ()
@@ -3966,7 +3976,6 @@ func prepareIngesterWithBlocksStorageAndLimits(t testing.TB, ingesterCfg Config,
3966
3976
ingesterCfg .BlocksStorageConfig .TSDB .Dir = dataDir
3967
3977
ingesterCfg .BlocksStorageConfig .Bucket .Backend = "filesystem"
3968
3978
ingesterCfg .BlocksStorageConfig .Bucket .Filesystem .Directory = bucketDir
3969
- ingesterCfg .BlocksStorageConfig .TSDB .EnableNativeHistograms = nativeHistograms
3970
3979
3971
3980
ingester , err := New (ingesterCfg , overrides , registerer , log .NewNopLogger (), nil )
3972
3981
if err != nil {
@@ -6432,15 +6441,16 @@ func TestIngester_MaxExemplarsFallBack(t *testing.T) {
6432
6441
dir := t .TempDir ()
6433
6442
blocksDir := filepath .Join (dir , "blocks" )
6434
6443
limits := defaultLimitsTestConfig ()
6435
- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , blocksDir , prometheus .NewRegistry (), true )
6444
+ limits .EnableNativeHistograms = true
6445
+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , blocksDir , prometheus .NewRegistry ())
6436
6446
require .NoError (t , err )
6437
6447
6438
6448
maxExemplars := i .getMaxExemplars ("someTenant" )
6439
6449
require .Equal (t , maxExemplars , int64 (2 ))
6440
6450
6441
6451
// set max exemplars value in limits, and re-initialize the ingester
6442
6452
limits .MaxExemplars = 5
6443
- i , err = prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , blocksDir , prometheus .NewRegistry (), true )
6453
+ i , err = prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , blocksDir , prometheus .NewRegistry ())
6444
6454
require .NoError (t , err )
6445
6455
6446
6456
// validate this value is picked up now
@@ -6815,6 +6825,7 @@ func TestIngester_UpdateLabelSetMetrics(t *testing.T) {
6815
6825
cfg .BlocksStorageConfig .TSDB .BlockRanges = []time.Duration {2 * time .Hour }
6816
6826
reg := prometheus .NewRegistry ()
6817
6827
limits := defaultLimitsTestConfig ()
6828
+ limits .EnableNativeHistograms = true
6818
6829
userID := "1"
6819
6830
ctx := user .InjectOrgID (context .Background (), userID )
6820
6831
@@ -6839,7 +6850,7 @@ func TestIngester_UpdateLabelSetMetrics(t *testing.T) {
6839
6850
require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
6840
6851
require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
6841
6852
6842
- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , reg , false )
6853
+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , reg )
6843
6854
require .NoError (t , err )
6844
6855
require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
6845
6856
defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
0 commit comments