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

Method Search

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

Source from the content-addressed store, hash-verified

614}
615
616func (b *walBlock) Search(ctx context.Context, req *tempopb.SearchRequest, _ common.SearchOptions) (*tempopb.SearchResponse, error) {
617 ctx, span := tracer.Start(ctx, "walBlock.Search")
618 defer span.End()
619
620 results := &tempopb.SearchResponse{
621 Metrics: &tempopb.SearchMetrics{},
622 }
623
624 for i, blockFlush := range b.readFlushes() {
625 file, err := blockFlush.file(ctx)
626 if err != nil {
627 return nil, fmt.Errorf("error opening file %s: %w", blockFlush.path, err)
628 }
629
630 defer file.Close()
631 pf := file.parquetFile
632
633 r, err := searchParquetFile(ctx, pf, req, pf.RowGroups(), b.meta.DedicatedColumns)
634 if err != nil {
635 return nil, fmt.Errorf("error searching block [%s %d]: %w", b.meta.BlockID.String(), i, err)
636 }
637
638 results.Traces = append(results.Traces, r.Traces...)
639 results.Metrics.InspectedBytes += file.r.BytesRead()
640 results.Metrics.InspectedTraces += uint32(pf.NumRows())
641 if len(results.Traces) >= int(req.Limit) {
642 break
643 }
644 }
645
646 return results, nil
647}
648
649func (b *walBlock) SearchTags(ctx context.Context, scope traceql.AttributeScope, cb common.TagsCallback, mcb common.MetricsCallback, _ common.SearchOptions) error {
650 ctx, span := tracer.Start(ctx, "walBlock.SearchTags")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected