diff --git a/integration/e2e/api_test.go b/integration/e2e/api_test.go index babc5d2bf0b..2942edcfbc5 100644 --- a/integration/e2e/api_test.go +++ b/integration/e2e/api_test.go @@ -155,11 +155,16 @@ func TestSearchTagValuesV2(t *testing.T) { } // Wait to block flushed to backend, 20 seconds is the complete_block_timeout configuration on all in one, we add - // 1s for security. + // 2s for security. callFlush(t, tempo) - time.Sleep(time.Second * 30) + time.Sleep(time.Second * 22) callFlush(t, tempo) + // test metrics + require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total")) + require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempodb_blocklist_length"}, e2e.WaitMissingMetrics)) + require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_cleared_total")) + // Assert no more on the ingester for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { @@ -168,7 +173,7 @@ func TestSearchTagValuesV2(t *testing.T) { } // Wait to blocklist_poll to be completed - time.Sleep(time.Second * 2) + require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempodb_blocklist_length"}, e2e.WaitMissingMetrics)) // Assert tags on storage backend now := time.Now() @@ -239,8 +244,13 @@ func TestSearchTagValues(t *testing.T) { callSearchTagValuesAndAssert(t, tempo, "service.name", searchTagValuesResponse{TagValues: []string{"my-service"}}, 0, 0) callFlush(t, tempo) - time.Sleep(time.Second * 30) + time.Sleep(time.Second * 22) callFlush(t, tempo) + + require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total")) + require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempodb_blocklist_length"}, e2e.WaitMissingMetrics)) + require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_cleared_total")) + callSearchTagValuesAndAssert(t, tempo, "service.name", searchTagValuesResponse{}, 0, 0) // Assert no more on the ingester // Wait to blocklist_poll to be completed diff --git a/modules/frontend/tagsharding.go b/modules/frontend/tagsharding.go index 1c04faae200..e89079c7acb 100644 --- a/modules/frontend/tagsharding.go +++ b/modules/frontend/tagsharding.go @@ -66,7 +66,6 @@ type tagResults struct { marshallErr error } - func (r *tagResultCollector) shouldQuit() bool { r.mtx.Lock() defer r.mtx.Unlock() @@ -354,8 +353,6 @@ func (s searchTagSharder) buildBackendRequests(ctx context.Context, tenantID str // ingesterRequest returns a new start and end time range for the backend as well as a http request // that covers the ingesters. If nil is returned for the http.Request then there is no ingesters query. -// since this function modifies searchReq.Start and End we are taking a value instead of a pointer to prevent it from -// unexpectedly changing the passed searchReq. func (s searchTagSharder) ingesterRequest(ctx context.Context, tenantID string, parent *http.Request, searchReq tagSearchReq) (*http.Request, error) { // request without start or end, search only in ingester if searchReq.start() == 0 || searchReq.end() == 0 {