Skip to content

Commit

Permalink
Improve testing and comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 committed Jan 2, 2024
1 parent 07fdedc commit 59f4c43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 14 additions & 4 deletions integration/e2e/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions modules/frontend/tagsharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ type tagResults struct {
marshallErr error
}


func (r *tagResultCollector) shouldQuit() bool {
r.mtx.Lock()
defer r.mtx.Unlock()
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 59f4c43

Please sign in to comment.