(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions)
| 711 | } |
| 712 | |
| 713 | func (b *walBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansResponse, error) { |
| 714 | ctx, span := tracer.Start(ctx, "walBlock.Fetch") |
| 715 | defer span.End() |
| 716 | |
| 717 | // todo: this same method is called in backendBlock.Fetch. is there anyway to share this? |
| 718 | err := checkConditions(req.Conditions) |
| 719 | if err != nil { |
| 720 | return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err) |
| 721 | } |
| 722 | |
| 723 | var ( |
| 724 | blockFlushes = b.readFlushes() |
| 725 | readers = make([]*walReaderAt, 0, len(blockFlushes)) |
| 726 | iters = make([]traceql.CommonIterator[*traceql.Spanset], 0, len(blockFlushes)) |
| 727 | ) |
| 728 | |
| 729 | for _, page := range blockFlushes { |
| 730 | file, err := page.file(ctx) |
| 731 | if err != nil { |
| 732 | return traceql.FetchSpansResponse{}, fmt.Errorf("error opening file %s: %w", page.path, err) |
| 733 | } |
| 734 | |
| 735 | iter, err := fetch(ctx, req, file.parquetFile, file.parquetFile.RowGroups(), b.meta.DedicatedColumns) |
| 736 | if err != nil { |
| 737 | return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err) |
| 738 | } |
| 739 | |
| 740 | iters = append(iters, &pageFileClosingIterator[*traceql.Spanset]{iter: iter, pageFile: file}) |
| 741 | readers = append(readers, file.r) |
| 742 | } |
| 743 | |
| 744 | return traceql.FetchSpansResponse{ |
| 745 | Results: &mergeIterator[*traceql.Spanset]{ |
| 746 | iters: iters, |
| 747 | }, |
| 748 | // FIXME: can this be simplified with the common.MetadataCallback?? and Metrics Collector?? |
| 749 | Bytes: func() uint64 { |
| 750 | // read value when callback is called |
| 751 | var totalBytesRead uint64 |
| 752 | for _, r := range readers { |
| 753 | totalBytesRead += r.BytesRead() |
| 754 | } |
| 755 | return totalBytesRead |
| 756 | }, |
| 757 | }, nil |
| 758 | } |
| 759 | |
| 760 | func (b *walBlock) FetchSpans(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansOnlyResponse, error) { |
| 761 | ctx, span := tracer.Start(ctx, "walBlock.FetchSpans") |
nothing calls this directly
no test coverage detected