(ctx context.Context, id common.ID, opts common.SearchOptions)
| 531 | } |
| 532 | |
| 533 | func (b *walBlock) FindTraceByID(ctx context.Context, id common.ID, opts common.SearchOptions) (*tempopb.TraceByIDResponse, error) { |
| 534 | trs := make([]*tempopb.Trace, 0) |
| 535 | |
| 536 | for _, page := range b.readFlushes() { |
| 537 | if rowNumber, ok := page.ids.Get(id); ok { |
| 538 | file, err := page.file(ctx) |
| 539 | if err != nil { |
| 540 | return nil, fmt.Errorf("error opening file %s: %w", page.path, err) |
| 541 | } |
| 542 | |
| 543 | defer file.Close() |
| 544 | pf := file.parquetFile |
| 545 | |
| 546 | r := parquet.NewReader(pf) |
| 547 | defer r.Close() |
| 548 | |
| 549 | err = r.SeekToRow(rowNumber) |
| 550 | if err != nil { |
| 551 | return nil, fmt.Errorf("seek to row: %w", err) |
| 552 | } |
| 553 | |
| 554 | tr := new(Trace) |
| 555 | err = r.Read(tr) |
| 556 | if err != nil { |
| 557 | return nil, fmt.Errorf("error reading row from backend: %w", err) |
| 558 | } |
| 559 | |
| 560 | trp := ParquetTraceToTempopbTrace(b.meta, tr) |
| 561 | |
| 562 | trs = append(trs, trp) |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | combiner := trace.NewCombiner(opts.MaxBytes, false) |
| 567 | for i, tr := range trs { |
| 568 | _, err := combiner.ConsumeWithFinal(tr, i == len(trs)-1) |
| 569 | if err != nil { |
| 570 | return nil, err |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | tr, _ := combiner.Result() |
| 575 | return &tempopb.TraceByIDResponse{Trace: tr, Metrics: &tempopb.TraceByIDMetrics{}}, nil |
| 576 | } |
| 577 | |
| 578 | func (b *walBlock) Search(ctx context.Context, req *tempopb.SearchRequest, _ common.SearchOptions) (*tempopb.SearchResponse, error) { |
| 579 | results := &tempopb.SearchResponse{ |
nothing calls this directly
no test coverage detected