(ctx context.Context, r backend.Reader, _ backend.Compactor, blockNum int, id uuid.UUID, tenantID string, traceID common.ID)
| 139 | } |
| 140 | |
| 141 | func queryBlock(ctx context.Context, r backend.Reader, _ backend.Compactor, blockNum int, id uuid.UUID, tenantID string, traceID common.ID) (*queryResults, error) { |
| 142 | fmt.Print(".") |
| 143 | if blockNum%100 == 0 { |
| 144 | fmt.Print(strconv.Itoa(blockNum)) |
| 145 | } |
| 146 | |
| 147 | meta, err := r.BlockMeta(context.Background(), id, tenantID) |
| 148 | if err != nil && !errors.Is(err, backend.ErrDoesNotExist) { |
| 149 | return nil, err |
| 150 | } |
| 151 | |
| 152 | if errors.Is(err, backend.ErrDoesNotExist) { |
| 153 | // tempo proper searches compacted blocks, b/c each querier has a different view of the backend blocks. |
| 154 | // however, with a single snaphot of the backend, we can only search the noncompacted blocks. |
| 155 | return nil, nil |
| 156 | } |
| 157 | |
| 158 | block, err := encoding.OpenBlock(meta, r) |
| 159 | if err != nil { |
| 160 | return nil, err |
| 161 | } |
| 162 | |
| 163 | searchOpts := common.SearchOptions{} |
| 164 | tempodb.SearchConfig{}.ApplyToOptions(&searchOpts) |
| 165 | |
| 166 | res, err := block.FindTraceByID(ctx, traceID, searchOpts) |
| 167 | if err != nil { |
| 168 | return nil, err |
| 169 | } |
| 170 | if res == nil || res.Trace == nil { |
| 171 | return nil, nil |
| 172 | } |
| 173 | |
| 174 | return &queryResults{ |
| 175 | blockID: id, |
| 176 | trace: res.Trace, |
| 177 | }, nil |
| 178 | } |
no test coverage detected