Skip to content

Commit

Permalink
store: Use Histograms for bucket metrics
Browse files Browse the repository at this point in the history
Convert store bucket metrics from Summary to Histogram so that they can
be aggregated over multiple instances.

Signed-off-by: SuperQ <[email protected]>
  • Loading branch information
SuperQ committed Feb 16, 2023
1 parent acabb6e commit 2571fcf
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ type bucketStoreMetrics struct {
lastLoadedBlock prometheus.Gauge
blockDrops prometheus.Counter
blockDropFailures prometheus.Counter
seriesDataTouched *prometheus.SummaryVec
seriesDataFetched *prometheus.SummaryVec
seriesDataSizeTouched *prometheus.SummaryVec
seriesDataSizeFetched *prometheus.SummaryVec
seriesBlocksQueried prometheus.Summary
seriesDataTouched *prometheus.HistogramVec
seriesDataFetched *prometheus.HistogramVec
seriesDataSizeTouched *prometheus.HistogramVec
seriesDataSizeFetched *prometheus.HistogramVec
seriesBlocksQueried prometheus.Histogram
seriesGetAllDuration prometheus.Histogram
seriesMergeDuration prometheus.Histogram
resultSeriesCount prometheus.Summary
resultSeriesCount prometheus.Histogram
chunkSizeBytes prometheus.Histogram
postingsSizeBytes prometheus.Histogram
queriesDropped *prometheus.CounterVec
Expand Down Expand Up @@ -173,31 +173,32 @@ func newBucketStoreMetrics(reg prometheus.Registerer) *bucketStoreMetrics {
Help: "Timestamp when last block got loaded.",
})

m.seriesDataTouched = promauto.With(reg).NewSummaryVec(prometheus.SummaryOpts{
m.seriesDataTouched = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_data_touched",
Help: "Number of items of a data type touched to fulfill a single Store API series request.",
Objectives: map[float64]float64{0.50: 0.1, 0.95: 0.1, 0.99: 0.001},
Buckets: prometheus.ExponentialBuckets(200, 2, 15),
}, []string{"data_type"})
m.seriesDataFetched = promauto.With(reg).NewSummaryVec(prometheus.SummaryOpts{
m.seriesDataFetched = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_data_fetched",
Help: "Number of items of a data type retrieved to fulfill a single Store API series request.",
Objectives: map[float64]float64{0.50: 0.1, 0.95: 0.1, 0.99: 0.001},
Buckets: prometheus.ExponentialBuckets(200, 2, 15),
}, []string{"data_type"})

m.seriesDataSizeTouched = promauto.With(reg).NewSummaryVec(prometheus.SummaryOpts{
m.seriesDataSizeTouched = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_data_size_touched_bytes",
Help: "Total size of items of a data type touched to fulfill a single Store API series request in Bytes.",
Objectives: map[float64]float64{0.50: 0.1, 0.95: 0.1, 0.99: 0.001},
Buckets: prometheus.ExponentialBuckets(1024, 2, 15),
}, []string{"data_type"})
m.seriesDataSizeFetched = promauto.With(reg).NewSummaryVec(prometheus.SummaryOpts{
m.seriesDataSizeFetched = promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_data_size_fetched_bytes",
Help: "Total size of items of a data type fetched to fulfill a single Store API series request in Bytes.",
Objectives: map[float64]float64{0.50: 0.1, 0.95: 0.1, 0.99: 0.001},
Buckets: prometheus.ExponentialBuckets(1024, 2, 15),
}, []string{"data_type"})

m.seriesBlocksQueried = promauto.With(reg).NewSummary(prometheus.SummaryOpts{
m.seriesBlocksQueried = promauto.With(reg).NewHistogram(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_blocks_queried",
Help: "Number of blocks in a bucket store that were touched to satisfy a query.",
Buckets: prometheus.ExponentialBuckets(1, 2, 10),
})
m.seriesGetAllDuration = promauto.With(reg).NewHistogram(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_get_all_duration_seconds",
Expand All @@ -209,9 +210,10 @@ func newBucketStoreMetrics(reg prometheus.Registerer) *bucketStoreMetrics {
Help: "Time it takes to merge sub-results from all queried blocks into a single result.",
Buckets: []float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120},
})
m.resultSeriesCount = promauto.With(reg).NewSummary(prometheus.SummaryOpts{
m.resultSeriesCount = promauto.With(reg).NewHistogram(prometheus.HistogramOpts{
Name: "thanos_bucket_store_series_result_series",
Help: "Number of series observed in the final result of a query.",
Buckets: prometheus.ExponentialBuckets(1, 2, 15),
})

m.chunkSizeBytes = promauto.With(reg).NewHistogram(prometheus.HistogramOpts{
Expand Down

0 comments on commit 2571fcf

Please sign in to comment.