From 5a49b85b2a8ba0ade97bcd32d95904f690ffacd9 Mon Sep 17 00:00:00 2001 From: Zach Leslie Date: Thu, 26 Aug 2021 16:05:52 -0600 Subject: [PATCH] Include additional detail when searching for traces --- CHANGELOG.md | 1 + modules/querier/querier.go | 1 + tempodb/tempodb.go | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6e962b490..8cd998b51c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## main / unreleased * [ENHANCEMENT] Make s3 backend readError logic more robust [#905](https://github.com/grafana/tempo/pull/905) (@wei840222) +* [ENHANCEMENT] Include additional detail when searching for traces [#916](https://github.com/grafana/tempo/pull/916) (@zalegrala) ## v1.1.0 / 2021-08-26 diff --git a/modules/querier/querier.go b/modules/querier/querier.go index a2bb319eb14..e5c5383dbd3 100644 --- a/modules/querier/querier.go +++ b/modules/querier/querier.go @@ -219,6 +219,7 @@ func (q *Querier) FindTraceByID(ctx context.Context, req *tempopb.TraceByIDReque traceCountTotal++ span.LogFields(ot_log.String("msg", "combined trace protos from store"), + ot_log.Bool("found", completeTrace != nil), ot_log.Int("combinedSpans", spanCountTotal), ot_log.Int("combinedTraces", traceCountTotal)) } diff --git a/tempodb/tempodb.go b/tempodb/tempodb.go index 88ae202eda4..9be627f42dd 100644 --- a/tempodb/tempodb.go +++ b/tempodb/tempodb.go @@ -291,15 +291,19 @@ func (rw *readerWriter) Find(ctx context.Context, tenantID string, id common.ID, blocklist := rw.blocklist.Metas(tenantID) compactedBlocklist := rw.blocklist.CompactedMetas(tenantID) copiedBlocklist := make([]interface{}, 0, len(blocklist)) + blocksSearched := 0 + compactedBlocksSearched := 0 for _, b := range blocklist { if includeBlock(b, id, blockStartBytes, blockEndBytes) { copiedBlocklist = append(copiedBlocklist, b) + blocksSearched++ } } for _, c := range compactedBlocklist { if includeCompactedBlock(c, id, blockStartBytes, blockEndBytes, rw.cfg.BlocklistPoll) { copiedBlocklist = append(copiedBlocklist, &c.BlockMeta) + compactedBlocksSearched++ } } if len(copiedBlocklist) == 0 { @@ -325,7 +329,12 @@ func (rw *readerWriter) Find(ctx context.Context, tenantID string, id common.ID, ot_log.String("msg", "searching for trace in block"), ot_log.String("blockID", meta.BlockID.String()), ot_log.Bool("found", foundObject != nil), - ot_log.Int("bytes", len(foundObject))) + ot_log.Int("bytes", len(foundObject)), + ot_log.Int("live blocks", len(blocklist)), + ot_log.Int("live blocks searched", blocksSearched), + ot_log.Int("compacted blocks", len(compactedBlocklist)), + ot_log.Int("compacted blocks searched", compactedBlocksSearched), + ) return foundObject, meta.DataEncoding, nil })