(ctx context.Context, traceID common.ID, opts common.SearchOptions)
| 101 | } |
| 102 | |
| 103 | func (b *backendBlock) FindTraceByID(ctx context.Context, traceID common.ID, opts common.SearchOptions) (_ *tempopb.TraceByIDResponse, err error) { |
| 104 | derivedCtx, span := tracer.Start(ctx, "parquet.backendBlock.FindTraceByID", |
| 105 | trace.WithAttributes( |
| 106 | attribute.String("blockID", b.meta.BlockID.String()), |
| 107 | attribute.String("tenantID", b.meta.TenantID), |
| 108 | attribute.Int64("blockSize", int64(b.meta.Size_)), |
| 109 | )) |
| 110 | defer span.End() |
| 111 | |
| 112 | found, err := b.checkBloom(derivedCtx, traceID) |
| 113 | if err != nil { |
| 114 | return nil, err |
| 115 | } |
| 116 | if !found { |
| 117 | return nil, nil |
| 118 | } |
| 119 | |
| 120 | ok, rowGroup, err := b.checkIndex(derivedCtx, traceID) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | if !ok { |
| 125 | return nil, nil |
| 126 | } |
| 127 | |
| 128 | pf, rr, err := b.openForSearch(derivedCtx, opts) |
| 129 | if err != nil { |
| 130 | return nil, fmt.Errorf("unexpected error opening parquet file: %w", err) |
| 131 | } |
| 132 | |
| 133 | foundTrace, err := findTraceByID(derivedCtx, traceID, b.meta, pf, rowGroup) |
| 134 | |
| 135 | result := &tempopb.TraceByIDResponse{ |
| 136 | Trace: foundTrace, |
| 137 | Metrics: &tempopb.TraceByIDMetrics{}, |
| 138 | } |
| 139 | bytesRead := rr.BytesRead() |
| 140 | result.Metrics.InspectedBytes += bytesRead |
| 141 | span.SetAttributes(attribute.Int64("inspectedBytes", int64(bytesRead))) |
| 142 | |
| 143 | return result, err |
| 144 | } |
| 145 | |
| 146 | func findTraceByID(ctx context.Context, traceID common.ID, meta *backend.BlockMeta, pf *parquet.File, rowGroup int) (*tempopb.Trace, error) { |
| 147 | // traceID column index |
nothing calls this directly
no test coverage detected