MCPcopy
hub / github.com/grafana/tempo / Search

Method Search

tempodb/encoding/vparquet3/wal_block.go:578–606  ·  view source on GitHub ↗
(ctx context.Context, req *tempopb.SearchRequest, _ common.SearchOptions)

Source from the content-addressed store, hash-verified

576}
577
578func (b *walBlock) Search(ctx context.Context, req *tempopb.SearchRequest, _ common.SearchOptions) (*tempopb.SearchResponse, error) {
579 results := &tempopb.SearchResponse{
580 Metrics: &tempopb.SearchMetrics{},
581 }
582
583 for i, blockFlush := range b.readFlushes() {
584 file, err := blockFlush.file(ctx)
585 if err != nil {
586 return nil, fmt.Errorf("error opening file %s: %w", blockFlush.path, err)
587 }
588
589 defer file.Close()
590 pf := file.parquetFile
591
592 r, err := searchParquetFile(ctx, pf, req, pf.RowGroups(), b.meta.DedicatedColumns)
593 if err != nil {
594 return nil, fmt.Errorf("error searching block [%s %d]: %w", b.meta.BlockID.String(), i, err)
595 }
596
597 results.Traces = append(results.Traces, r.Traces...)
598 results.Metrics.InspectedBytes += file.r.BytesRead()
599 results.Metrics.InspectedTraces += uint32(pf.NumRows())
600 if len(results.Traces) >= int(req.Limit) {
601 break
602 }
603 }
604
605 return results, nil
606}
607
608func (b *walBlock) SearchTags(ctx context.Context, scope traceql.AttributeScope, cb common.TagsCallback, mcb common.MetricsCallback, _ common.SearchOptions) error {
609 for i, blockFlush := range b.readFlushes() {

Callers

nothing calls this directly

Calls 6

readFlushesMethod · 0.95
searchParquetFileFunction · 0.70
CloseMethod · 0.65
fileMethod · 0.45
StringMethod · 0.45
BytesReadMethod · 0.45

Tested by

no test coverage detected