@@ -37,7 +37,6 @@ import (
3737type queryFrontendTestConfig struct {
3838 testMissingMetricName bool
3939 querySchedulerEnabled bool
40- queryStatsEnabled bool
4140 remoteReadEnabled bool
4241 testSubQueryStepSize bool
4342 setup func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string )
@@ -60,7 +59,6 @@ func TestQueryFrontendWithBlocksStorageViaFlags(t *testing.T) {
6059func TestQueryFrontendWithBlocksStorageViaFlagsAndQueryStatsEnabled (t * testing.T ) {
6160 runQueryFrontendTest (t , queryFrontendTestConfig {
6261 testMissingMetricName : false ,
63- queryStatsEnabled : true ,
6462 setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
6563 flags = BlocksStorageFlags ()
6664
@@ -91,7 +89,6 @@ func TestQueryFrontendWithBlocksStorageViaFlagsAndWithQuerySchedulerAndQueryStat
9189 runQueryFrontendTest (t , queryFrontendTestConfig {
9290 testMissingMetricName : false ,
9391 querySchedulerEnabled : true ,
94- queryStatsEnabled : true ,
9592 setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
9693 flags = BlocksStorageFlags ()
9794
@@ -167,7 +164,6 @@ func TestQueryFrontendWithVerticalSharding(t *testing.T) {
167164 runQueryFrontendTest (t , queryFrontendTestConfig {
168165 testMissingMetricName : false ,
169166 querySchedulerEnabled : false ,
170- queryStatsEnabled : true ,
171167 setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
172168 require .NoError (t , writeFileToSharedDir (s , cortexConfigFile , []byte (BlocksStorageConfig )))
173169
@@ -187,7 +183,6 @@ func TestQueryFrontendWithVerticalShardingQueryScheduler(t *testing.T) {
187183 runQueryFrontendTest (t , queryFrontendTestConfig {
188184 testMissingMetricName : false ,
189185 querySchedulerEnabled : true ,
190- queryStatsEnabled : true ,
191186 setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
192187 require .NoError (t , writeFileToSharedDir (s , cortexConfigFile , []byte (BlocksStorageConfig )))
193188
@@ -207,7 +202,6 @@ func TestQueryFrontendProtobufCodec(t *testing.T) {
207202 runQueryFrontendTest (t , queryFrontendTestConfig {
208203 testMissingMetricName : false ,
209204 querySchedulerEnabled : true ,
210- queryStatsEnabled : true ,
211205 setup : func (t * testing.T , s * e2e.Scenario ) (configFile string , flags map [string ]string ) {
212206 require .NoError (t , writeFileToSharedDir (s , cortexConfigFile , []byte (BlocksStorageConfig )))
213207
@@ -273,7 +267,7 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
273267 "-querier.split-queries-by-interval" : "24h" ,
274268 "-querier.query-ingesters-within" : "12h" , // Required by the test on query /series out of ingesters time range
275269 "-frontend.memcached.addresses" : "dns+" + memcached .NetworkEndpoint (e2ecache .MemcachedPort ),
276- "-frontend.query-stats-enabled" : strconv . FormatBool ( cfg . queryStatsEnabled ),
270+ "-frontend.query-stats-enabled" : "true" , // Always enable query stats to capture regressions
277271 })
278272
279273 // Start the query-scheduler if enabled.
@@ -361,7 +355,7 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
361355 }
362356
363357 // No need to repeat the test on Server-Timing header for each user.
364- if userID == 0 && cfg . queryStatsEnabled {
358+ if userID == 0 {
365359 res , _ , err := c .QueryRaw ("{instance=~\" hello.*\" }" , time .Now (), map [string ]string {})
366360 require .NoError (t , err )
367361 require .Regexp (t , "querier_wall_time;dur=[0-9.]*, response_time;dur=[0-9.]*$" , res .Header .Values ("Server-Timing" )[0 ])
@@ -412,15 +406,11 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
412406
413407 wg .Wait ()
414408
415- extra := float64 (2 )
409+ extra := float64 (3 ) // Always include query stats test
416410 if cfg .testMissingMetricName {
417411 extra ++
418412 }
419413
420- if cfg .queryStatsEnabled {
421- extra ++
422- }
423-
424414 if cfg .remoteReadEnabled {
425415 extra ++
426416 }
@@ -437,15 +427,11 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
437427 require .NoError (t , querier .WaitSumMetricsWithOptions (e2e .Greater (numUsers * numQueriesPerUser ), []string {"cortex_request_duration_seconds" }, e2e .WithMetricCount ))
438428 require .NoError (t , querier .WaitSumMetricsWithOptions (e2e .Greater (numUsers * numQueriesPerUser ), []string {"cortex_querier_request_duration_seconds" }, e2e .WithMetricCount ))
439429
440- // Ensure query stats metrics are tracked only when enabled.
441- if cfg .queryStatsEnabled {
442- require .NoError (t , queryFrontend .WaitSumMetricsWithOptions (
443- e2e .Greater (0 ),
444- []string {"cortex_query_seconds_total" },
445- e2e .WithLabelMatchers (labels .MustNewMatcher (labels .MatchEqual , "user" , "user-1" ))))
446- } else {
447- require .NoError (t , queryFrontend .WaitRemovedMetric ("cortex_query_seconds_total" ))
448- }
430+ // Ensure query stats metrics are always tracked to capture regressions.
431+ require .NoError (t , queryFrontend .WaitSumMetricsWithOptions (
432+ e2e .Greater (0 ),
433+ []string {"cortex_query_seconds_total" },
434+ e2e .WithLabelMatchers (labels .MustNewMatcher (labels .MatchEqual , "user" , "user-1" ))))
449435
450436 // Ensure no service-specific metrics prefix is used by the wrong service.
451437 assertServiceMetricsPrefixes (t , Distributor , distributor )
0 commit comments