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

Method Search

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

Source from the content-addressed store, hash-verified

597}
598
599func (b *walBlock) Search(ctx context.Context, req *tempopb.SearchRequest, _ common.SearchOptions) (*tempopb.SearchResponse, error) {
600 ctx, span := tracer.Start(ctx, "walBlock.Search")
601 defer span.End()
602
603 results := &tempopb.SearchResponse{
604 Metrics: &tempopb.SearchMetrics{},
605 }
606
607 for i, blockFlush := range b.readFlushes() {
608 file, err := blockFlush.file(ctx)
609 if err != nil {
610 return nil, fmt.Errorf("error opening file %s: %w", blockFlush.path, err)
611 }
612
613 defer file.Close()
614 pf := file.parquetFile
615
616 r, err := searchParquetFile(ctx, pf, req, pf.RowGroups(), b.meta.DedicatedColumns)
617 if err != nil {
618 return nil, fmt.Errorf("error searching block [%s %d]: %w", b.meta.BlockID.String(), i, err)
619 }
620
621 results.Traces = append(results.Traces, r.Traces...)
622 results.Metrics.InspectedBytes += file.r.BytesRead()
623 results.Metrics.InspectedTraces += uint32(pf.NumRows())
624 if len(results.Traces) >= int(req.Limit) {
625 break
626 }
627 }
628
629 return results, nil
630}
631
632func (b *walBlock) SearchTags(ctx context.Context, scope traceql.AttributeScope, cb common.TagsCallback, mcb common.MetricsCallback, _ common.SearchOptions) error {
633 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