diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3ea0a2e1..a0e3b60d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ * [8953](https://github.com/grafana/loki/pull/8953) **dannykopping**: Querier: block queries by hash. * [8851](https://github.com/grafana/loki/pull/8851) **jeschkies**: Introduce limit to require a set of labels for selecting streams. +##### Fixes + +* [8971](https://github.com/grafana/loki/pull/8971) **dannykopping**: Stats: fix `Cache.Chunk.BytesSent` statistic and loki_chunk_fetcher_fetched_size_bytes metric with correct chunk size. + ### All Changes #### Promtail diff --git a/pkg/storage/chunk/fetcher/fetcher.go b/pkg/storage/chunk/fetcher/fetcher.go index 0e81554729..5cc8e98916 100644 --- a/pkg/storage/chunk/fetcher/fetcher.go +++ b/pkg/storage/chunk/fetcher/fetcher.go @@ -201,9 +201,10 @@ func (c *Fetcher) FetchChunks(ctx context.Context, chunks []chunk.Chunk, keys [] // to the cache asynchronously in the background and we lose the context var bytes int for _, c := range fromStorage { - bytes += c.Size() + size := c.Data.Size() + bytes += size - chunkFetchedSize.WithLabelValues("store").Observe(float64(c.Size())) + chunkFetchedSize.WithLabelValues("store").Observe(float64(size)) } st := stats.FromContext(ctx)