(ctx context.Context, tenantID string, id common.ID, blockStart string, blockEnd string, timeStart int64, timeEnd int64, opts common.SearchOptions)
| 330 | } |
| 331 | |
| 332 | func (rw *readerWriter) Find(ctx context.Context, tenantID string, id common.ID, blockStart string, blockEnd string, timeStart int64, timeEnd int64, opts common.SearchOptions) ([]*tempopb.TraceByIDResponse, []error, error) { |
| 333 | // tracing instrumentation |
| 334 | logger := log.WithContext(ctx, log.Logger) |
| 335 | ctx, span := tracer.Start(ctx, "store.Find") |
| 336 | defer span.End() |
| 337 | |
| 338 | blockStartUUID, err := uuid.Parse(blockStart) |
| 339 | if err != nil { |
| 340 | return nil, nil, err |
| 341 | } |
| 342 | blockStartBytes, err := blockStartUUID.MarshalBinary() |
| 343 | if err != nil { |
| 344 | return nil, nil, err |
| 345 | } |
| 346 | blockEndUUID, err := uuid.Parse(blockEnd) |
| 347 | if err != nil { |
| 348 | return nil, nil, err |
| 349 | } |
| 350 | blockEndBytes, err := blockEndUUID.MarshalBinary() |
| 351 | if err != nil { |
| 352 | return nil, nil, err |
| 353 | } |
| 354 | |
| 355 | // gather appropriate blocks |
| 356 | blocklist := rw.blocklist.Metas(tenantID) |
| 357 | compactedBlocklist := rw.blocklist.CompactedMetas(tenantID) |
| 358 | copiedBlocklist := make([]interface{}, 0, len(blocklist)) |
| 359 | blocksSearched := 0 |
| 360 | compactedBlocksSearched := 0 |
| 361 | |
| 362 | for _, b := range blocklist { |
| 363 | if includeBlock(b, id, blockStartBytes, blockEndBytes, timeStart, timeEnd) { |
| 364 | copiedBlocklist = append(copiedBlocklist, b) |
| 365 | blocksSearched++ |
| 366 | } |
| 367 | } |
| 368 | for _, c := range compactedBlocklist { |
| 369 | if includeCompactedBlock(c, id, blockStartBytes, blockEndBytes, rw.cfg.BlocklistPoll, timeStart, timeEnd) { |
| 370 | copiedBlocklist = append(copiedBlocklist, &c.BlockMeta) |
| 371 | compactedBlocksSearched++ |
| 372 | } |
| 373 | } |
| 374 | if len(copiedBlocklist) == 0 { |
| 375 | return nil, nil, nil |
| 376 | } |
| 377 | |
| 378 | if rw.cfg != nil && rw.cfg.Search != nil { |
| 379 | rw.cfg.Search.ApplyToOptions(&opts) |
| 380 | } |
| 381 | |
| 382 | partialTraces, funcErrs, err := rw.pool.RunJobs(ctx, copiedBlocklist, func(ctx context.Context, payload interface{}) (interface{}, error) { |
| 383 | meta := payload.(*backend.BlockMeta) |
| 384 | block, err := encoding.OpenBlock(meta, rw.r) |
| 385 | if err != nil { |
| 386 | return nil, fmt.Errorf("error opening block for reading, blockID: %s: %w", meta.BlockID.String(), err) |
| 387 | } |
| 388 | |
| 389 | foundObject, err := block.FindTraceByID(ctx, id, opts) |
nothing calls this directly
no test coverage detected