grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
22.71k stars 3.3k forks source link

feat: convert WalSegmentWriter to io.ReadSeeker #13340

Closed vlad-diachenko closed 4 days ago

vlad-diachenko commented 4 days ago

What this PR does / why we need it: Implemented logic to convert WalSegmentWriter to a reader that implements io.ReadSeekCloser that satisfies the type required by ObjectClient.PutObject() function.

Special notes for your reviewer: Benchmark results:

goos: darwin
goarch: arm64
pkg: github.com/grafana/loki/v3/pkg/storage/wal
BenchmarkWrites
BenchmarkWrites/WriteTo
BenchmarkWrites/WriteTo-12               330       3546897 ns/op       45038 B/op        229 allocs/op
BenchmarkWrites/Reader
BenchmarkWrites/Reader-12                333       3507544 ns/op       51875 B/op        232 allocs/op
PASS

Checklist