(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions)
| 694 | } |
| 695 | |
| 696 | func (b *walBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansResponse, error) { |
| 697 | ctx, span := tracer.Start(ctx, "walBlock.Fetch") |
| 698 | defer span.End() |
| 699 | |
| 700 | // todo: this same method is called in backendBlock.Fetch. is there anyway to share this? |
| 701 | err := checkConditions(req.Conditions) |
| 702 | if err != nil { |
| 703 | return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err) |
| 704 | } |
| 705 | |
| 706 | blockFlushes := b.readFlushes() |
| 707 | // collect page readers to compute totalBytesRead |
| 708 | readers := make([]*walReaderAt, 0, len(blockFlushes)) |
| 709 | iters := make([]traceql.SpansetIterator, 0, len(blockFlushes)) |
| 710 | for _, page := range blockFlushes { |
| 711 | file, err := page.file(ctx) |
| 712 | if err != nil { |
| 713 | return traceql.FetchSpansResponse{}, fmt.Errorf("error opening file %s: %w", page.path, err) |
| 714 | } |
| 715 | |
| 716 | pf := file.parquetFile |
| 717 | |
| 718 | iter, err := fetch(ctx, req, pf, pf.RowGroups(), b.meta.DedicatedColumns) |
| 719 | if err != nil { |
| 720 | return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err) |
| 721 | } |
| 722 | |
| 723 | wrappedIterator := &pageFileClosingIterator{iter: iter, pageFile: file} |
| 724 | iters = append(iters, wrappedIterator) |
| 725 | readers = append(readers, file.r) |
| 726 | } |
| 727 | |
| 728 | // combine iters? |
| 729 | return traceql.FetchSpansResponse{ |
| 730 | Results: &mergeSpansetIterator{ |
| 731 | iters: iters, |
| 732 | }, |
| 733 | // FIXME: can this be simplified with the common.MetadataCallback?? and Metrics Collector?? |
| 734 | Bytes: func() uint64 { |
| 735 | // read value when callback is called |
| 736 | var totalBytesRead uint64 |
| 737 | for _, r := range readers { |
| 738 | totalBytesRead += r.BytesRead() |
| 739 | } |
| 740 | return totalBytesRead |
| 741 | }, |
| 742 | }, nil |
| 743 | } |
| 744 | |
| 745 | func (b *walBlock) FetchSpans(_ context.Context, _ traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansOnlyResponse, error) { |
| 746 | return traceql.FetchSpansOnlyResponse{}, util.ErrUnsupported |
nothing calls this directly
no test coverage detected