Skip to content

Commit

Permalink
Add metric to track number of chunk refetches (#6593)
Browse files Browse the repository at this point in the history
* add metrics to track number of chunk refetches

Signed-off-by: Ben Ye <[email protected]>

* update changelog

Signed-off-by: Ben Ye <[email protected]>

---------

Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 authored Aug 9, 2023
1 parent c492ce9 commit 93cb319
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6528](https://github.com/thanos-io/thanos/pull/6528) Index Cache: Add histogram metric `thanos_store_index_cache_stored_data_size_bytes` for item size.
- [#6560](https://github.com/thanos-io/thanos/pull/6560) Thanos ruler: add flag to optionally disable adding Thanos params when querying metrics
- [#6574](https://github.com/thanos-io/thanos/pull/6574) Tools: Add min and max compactions range flags to `bucket replicate` command.
- [#6593](https://github.com/thanos-io/thanos/pull/6574) Store: Add `thanos_bucket_store_chunk_refetches_total` metric to track number of chunk refetches.

### Fixed
- [#6503](https://github.com/thanos-io/thanos/pull/6503) *: Change the engine behind `ContentPathReloader` to be completely independent of any filesystem concept. This effectively fixes this configuration reload when used with Kubernetes ConfigMaps, Secrets, or other volume mounts.
Expand Down
6 changes: 6 additions & 0 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ type bucketStoreMetrics struct {
postingsSizeBytes prometheus.Histogram
queriesDropped *prometheus.CounterVec
seriesRefetches prometheus.Counter
chunkRefetches prometheus.Counter
emptyPostingCount prometheus.Counter

cachedPostingsCompressions *prometheus.CounterVec
Expand Down Expand Up @@ -241,6 +242,10 @@ func newBucketStoreMetrics(reg prometheus.Registerer) *bucketStoreMetrics {
Name: "thanos_bucket_store_series_refetches_total",
Help: "Total number of cases where configured estimated series bytes was not enough was to fetch series from index, resulting in refetch.",
})
m.chunkRefetches = promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "thanos_bucket_store_chunk_refetches_total",
Help: "Total number of cases where configured estimated chunk bytes was not enough was to fetch chunks from object store, resulting in refetch.",
})

m.cachedPostingsCompressions = promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
Name: "thanos_bucket_store_cached_postings_compressions_total",
Expand Down Expand Up @@ -3316,6 +3321,7 @@ func (r *bucketChunkReader) loadChunks(ctx context.Context, res []seriesEntry, a
continue
}

r.block.metrics.chunkRefetches.Inc()
// If we didn't fetch enough data for the chunk, fetch more.
fetchBegin = time.Now()
// Read entire chunk into new buffer.
Expand Down

0 comments on commit 93cb319

Please sign in to comment.