Skip to content

Commit

Permalink
Include additional detail when searching for traces
Browse files Browse the repository at this point in the history
  • Loading branch information
zalegrala committed Aug 27, 2021
1 parent f26fac1 commit 5a49b85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions modules/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
11 changes: 10 additions & 1 deletion tempodb/tempodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
})
Expand Down

0 comments on commit 5a49b85

Please sign in to comment.