Skip to content

Commit

Permalink
add tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Apr 27, 2023
1 parent ebe2eb6 commit 84de11a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/chunk/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ func (f *File) Sorted(ctx context.Context, descending bool, fn func(ts time.Time
}
}

sort.Slice(tsList, sf)
trace.WithRegion(ctx, "sorted.sort", func() {
sort.Slice(tsList, sf)
})

var (
prevOffset int64 // previous chunk offset, used to avoid seeking
Expand All @@ -420,7 +422,10 @@ func (f *File) Sorted(ctx context.Context, descending bool, fn func(ts time.Time
}
prevOffset = tmOff.Offset
}
if err := fn(structures.Int2Time(ts).UTC(), &chunk.Messages[tmOff.Index]); err != nil {
rgn := trace.StartRegion(ctx, "sorted.callback")
err = fn(structures.Int2Time(ts).UTC(), &chunk.Messages[tmOff.Index])
rgn.End()
if err != nil {
return err
}
}
Expand Down

0 comments on commit 84de11a

Please sign in to comment.