@@ -124,6 +124,7 @@ func seriesSetFromResponseStream(s *mockQueryStreamServer) (storage.SeriesSet, e
124124
125125func TestMatcherCache (t * testing.T ) {
126126 limits := defaultLimitsTestConfig ()
127+ limits .EnableNativeHistograms = true
127128 userID := "1"
128129 tenantLimits := newMockTenantLimits (map [string ]* validation.Limits {userID : & limits })
129130 registry := prometheus .NewRegistry ()
@@ -135,7 +136,7 @@ func TestMatcherCache(t *testing.T) {
135136 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
136137 cfg := defaultIngesterTestConfig (t )
137138 cfg .MatchersCacheMaxItems = 50
138- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry , true )
139+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry )
139140 require .NoError (t , err )
140141 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
141142
@@ -204,7 +205,7 @@ func TestIngesterDeletionRace(t *testing.T) {
204205 require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
205206 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
206207
207- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry , false )
208+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , registry )
208209 require .NoError (t , err )
209210 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
210211 defer services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
@@ -254,6 +255,7 @@ func TestIngesterDeletionRace(t *testing.T) {
254255
255256func TestIngesterPerLabelsetLimitExceeded (t * testing.T ) {
256257 limits := defaultLimitsTestConfig ()
258+ limits .EnableNativeHistograms = true
257259 userID := "1"
258260 registry := prometheus .NewRegistry ()
259261
@@ -287,7 +289,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
287289 require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
288290 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
289291
290- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry , true )
292+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , defaultIngesterTestConfig (t ), limits , tenantLimits , blocksDir , registry )
291293 require .NoError (t , err )
292294 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
293295 // Wait until it's ACTIVE
@@ -630,7 +632,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
630632 // Should persist between restarts
631633 services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
632634 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 )
634636 require .NoError (t , err )
635637 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
636638 ing .updateActiveSeries (ctx )
@@ -661,6 +663,7 @@ func TestIngesterPerLabelsetLimitExceeded(t *testing.T) {
661663func TestPushRace (t * testing.T ) {
662664 cfg := defaultIngesterTestConfig (t )
663665 l := defaultLimitsTestConfig ()
666+ l .EnableNativeHistograms = true
664667 cfg .LabelsStringInterningEnabled = true
665668 cfg .LifecyclerConfig .JoinAfter = 0
666669
@@ -686,7 +689,7 @@ func TestPushRace(t *testing.T) {
686689 blocksDir := filepath .Join (dir , "blocks" )
687690 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
688691
689- ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , l , nil , blocksDir , prometheus .NewRegistry (), true )
692+ ing , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , l , nil , blocksDir , prometheus .NewRegistry ())
690693 require .NoError (t , err )
691694 defer services .StopAndAwaitTerminated (context .Background (), ing ) //nolint:errcheck
692695 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
@@ -747,6 +750,7 @@ func TestPushRace(t *testing.T) {
747750
748751func TestIngesterUserLimitExceeded (t * testing.T ) {
749752 limits := defaultLimitsTestConfig ()
753+ limits .EnableNativeHistograms = true
750754 limits .MaxLocalSeriesPerUser = 1
751755 limits .MaxLocalMetricsWithMetadataPerUser = 1
752756
@@ -778,7 +782,7 @@ func TestIngesterUserLimitExceeded(t *testing.T) {
778782 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
779783
780784 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 )
782786 require .NoError (t , err )
783787 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
784788 // Wait until it's ACTIVE
@@ -878,6 +882,7 @@ func benchmarkData(nSeries int) (allLabels []labels.Labels, allSamples []cortexp
878882
879883func TestIngesterMetricLimitExceeded (t * testing.T ) {
880884 limits := defaultLimitsTestConfig ()
885+ limits .EnableNativeHistograms = true
881886 limits .MaxLocalSeriesPerMetric = 1
882887 limits .MaxLocalMetadataPerMetric = 1
883888
@@ -909,7 +914,7 @@ func TestIngesterMetricLimitExceeded(t *testing.T) {
909914 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
910915
911916 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 )
913918 require .NoError (t , err )
914919 require .NoError (t , services .StartAndAwaitRunning (context .Background (), ing ))
915920 // Wait until it's ACTIVE
@@ -1933,6 +1938,7 @@ func TestIngester_Push(t *testing.T) {
19331938 cfg .ActiveSeriesMetricsEnabled = ! testData .disableActiveSeries
19341939
19351940 limits := defaultLimitsTestConfig ()
1941+ limits .EnableNativeHistograms = ! testData .disableNativeHistogram
19361942 limits .MaxExemplars = testData .maxExemplars
19371943 limits .OutOfOrderTimeWindow = model .Duration (testData .oooTimeWindow )
19381944 limits .LimitsPerLabelSet = []validation.LimitsPerLabelSet {
@@ -1945,7 +1951,7 @@ func TestIngester_Push(t *testing.T) {
19451951 Hash : 1 ,
19461952 },
19471953 }
1948- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry , ! testData . disableNativeHistogram )
1954+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , nil , "" , registry )
19491955 require .NoError (t , err )
19501956 require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
19511957 defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
@@ -2174,7 +2180,8 @@ func TestIngester_PushNativeHistogramErrors(t *testing.T) {
21742180 cfg .LifecyclerConfig .JoinAfter = 0
21752181
21762182 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 )
21782185 require .NoError (t , err )
21792186 require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
21802187 defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
@@ -2662,6 +2669,7 @@ func Benchmark_Ingester_PushOnError(b *testing.B) {
26622669 cfg .LifecyclerConfig .JoinAfter = 0
26632670
26642671 limits := defaultLimitsTestConfig ()
2672+ limits .EnableNativeHistograms = true
26652673 if ! testData .prepareConfig (& limits , instanceLimits ) {
26662674 b .SkipNow ()
26672675 }
@@ -2670,7 +2678,7 @@ func Benchmark_Ingester_PushOnError(b *testing.B) {
26702678 return instanceLimits
26712679 }
26722680
2673- ingester , err := prepareIngesterWithBlocksStorageAndLimits (b , cfg , limits , nil , "" , registry , true )
2681+ ingester , err := prepareIngesterWithBlocksStorageAndLimits (b , cfg , limits , nil , "" , registry )
26742682 require .NoError (b , err )
26752683 require .NoError (b , services .StartAndAwaitRunning (context .Background (), ingester ))
26762684 defer services .StopAndAwaitTerminated (context .Background (), ingester ) //nolint:errcheck
@@ -3947,10 +3955,12 @@ func mockHistogramWriteRequest(t *testing.T, lbls labels.Labels, value int64, ti
39473955}
39483956
39493957func 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 )
39513961}
39523962
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 ) {
39543964 // Create a data dir if none has been provided.
39553965 if dataDir == "" {
39563966 dataDir = t .TempDir ()
@@ -3966,7 +3976,6 @@ func prepareIngesterWithBlocksStorageAndLimits(t testing.TB, ingesterCfg Config,
39663976 ingesterCfg .BlocksStorageConfig .TSDB .Dir = dataDir
39673977 ingesterCfg .BlocksStorageConfig .Bucket .Backend = "filesystem"
39683978 ingesterCfg .BlocksStorageConfig .Bucket .Filesystem .Directory = bucketDir
3969- ingesterCfg .BlocksStorageConfig .TSDB .EnableNativeHistograms = nativeHistograms
39703979
39713980 ingester , err := New (ingesterCfg , overrides , registerer , log .NewNopLogger (), nil )
39723981 if err != nil {
@@ -6432,15 +6441,16 @@ func TestIngester_MaxExemplarsFallBack(t *testing.T) {
64326441 dir := t .TempDir ()
64336442 blocksDir := filepath .Join (dir , "blocks" )
64346443 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 ())
64366446 require .NoError (t , err )
64376447
64386448 maxExemplars := i .getMaxExemplars ("someTenant" )
64396449 require .Equal (t , maxExemplars , int64 (2 ))
64406450
64416451 // set max exemplars value in limits, and re-initialize the ingester
64426452 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 ())
64446454 require .NoError (t , err )
64456455
64466456 // validate this value is picked up now
@@ -6815,6 +6825,7 @@ func TestIngester_UpdateLabelSetMetrics(t *testing.T) {
68156825 cfg .BlocksStorageConfig .TSDB .BlockRanges = []time.Duration {2 * time .Hour }
68166826 reg := prometheus .NewRegistry ()
68176827 limits := defaultLimitsTestConfig ()
6828+ limits .EnableNativeHistograms = true
68186829 userID := "1"
68196830 ctx := user .InjectOrgID (context .Background (), userID )
68206831
@@ -6839,7 +6850,7 @@ func TestIngester_UpdateLabelSetMetrics(t *testing.T) {
68396850 require .NoError (t , os .Mkdir (chunksDir , os .ModePerm ))
68406851 require .NoError (t , os .Mkdir (blocksDir , os .ModePerm ))
68416852
6842- i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , reg , false )
6853+ i , err := prepareIngesterWithBlocksStorageAndLimits (t , cfg , limits , tenantLimits , blocksDir , reg )
68436854 require .NoError (t , err )
68446855 require .NoError (t , services .StartAndAwaitRunning (context .Background (), i ))
68456856 defer services .StopAndAwaitTerminated (context .Background (), i ) //nolint:errcheck
0 commit comments