MCPcopy
hub / github.com/grafana/tempo / Iterator

Method Iterator

tempodb/encoding/vparquet5/wal_block.go:488–529  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

486}
487
488func (b *walBlock) Iterator(ctx context.Context) (common.Iterator, error) {
489 flushed := b.readFlushes()
490 bookmarks := make([]*bookmark[parquet.Row], 0, len(flushed))
491
492 for _, page := range flushed {
493 iter, err := page.rowIterator(ctx)
494 if err != nil {
495 return nil, fmt.Errorf("error creating iterator for %s: %w", page.path, err)
496 }
497 bookmarks = append(bookmarks, newBookmark[parquet.Row](iter))
498 }
499
500 sch, _, _ := SchemaWithDynamicChanges(b.meta.DedicatedColumns)
501
502 iter := newMultiblockIterator(bookmarks, func(rows []parquet.Row) (parquet.Row, error) {
503 if len(rows) == 1 {
504 return rows[0], nil
505 }
506
507 ts := make([]*Trace, 0, len(rows))
508 for _, row := range rows {
509 tr := &Trace{}
510 err := sch.Reconstruct(tr, row)
511 if err != nil {
512 return nil, err
513 }
514 ts = append(ts, tr)
515 completeBlockRowPool.Put(row)
516 }
517
518 // TODO: walBlock.Iterator is called when creating a complete block from a wal block. it would be
519 // nice to track trace disconnectd metrics while doing this. unfortunately there is no clean way for this
520 // code to know that it's being called in that context. perhaps find a way to do this in the future
521 t := combineTraces(ts...)
522 row := completeBlockRowPool.Get()
523 row = sch.Deconstruct(row, t)
524
525 return row, nil
526 })
527
528 return newCommonIterator(b.meta, iter, sch), nil
529}
530
531func (b *walBlock) Clear() error {
532 var errs multierror.MultiError

Callers

nothing calls this directly

Calls 8

readFlushesMethod · 0.95
SchemaWithDynamicChangesFunction · 0.85
newMultiblockIteratorFunction · 0.70
combineTracesFunction · 0.70
newCommonIteratorFunction · 0.70
GetMethod · 0.65
rowIteratorMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected