Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native histograms to the main latency histogram metrics #501

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
* [ENHANCEMENT] Expose `InstancesInZoneCount` and `ZonesCount` in `ring.ReadRing` interface. #494
* [ENHANCEMENT] Add optimization to run `concurrency.ForEachJob()` with no parallelism when there's only 1 job. #486 #495
* [ENHANCEMENT] Reduced memory allocations by `user.ExtractFromGRPCRequest()`. #502
* [ENHANCEMENT] Add native histogram version of some metrics: #501
* `gate_duration_seconds`
* `kv_request_duration_seconds`
* `operation_duration_seconds`
* [BUGFIX] spanlogger: Support multiple tenant IDs. #59
* [BUGFIX] Memberlist: fixed corrupted packets when sending compound messages with more than 255 messages or messages bigger than 64KB. #85
* [BUGFIX] Ring: `ring_member_ownership_percent` and `ring_tokens_owned` metrics are not updated on scale down. #109
Expand Down
4 changes: 4 additions & 0 deletions cache/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func newClientMetrics(reg prometheus.Registerer) *clientMetrics {
Name: "operation_duration_seconds",
Help: "Duration of operations against cache.",
Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 3, 6, 10},
// Use defaults recommended by Prometheus for native histograms.
NativeHistogramBucketFactor: 1.1,
NativeHistogramMaxBucketNumber: 100,
NativeHistogramMinResetDuration: time.Hour,
}, []string{"operation"})
cm.duration.WithLabelValues(opGetMulti)
cm.duration.WithLabelValues(opSet)
Expand Down
4 changes: 4 additions & 0 deletions gate/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func NewInstrumented(reg prometheus.Registerer, maxConcurrent int, gate Gate) Ga
Name: "gate_duration_seconds",
Help: "How many seconds it took for queries to wait at the gate.",
Buckets: []float64{0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120, 240, 360, 720},
// Use defaults recommended by Prometheus for native histograms.
NativeHistogramBucketFactor: 1.1,
NativeHistogramMaxBucketNumber: 100,
NativeHistogramMinResetDuration: time.Hour,
}),
}

Expand Down
5 changes: 5 additions & 0 deletions kv/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kv
import (
"context"
"strconv"
"time"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
Expand Down Expand Up @@ -53,6 +54,10 @@ func newMetricsClient(backend string, c Client, reg prometheus.Registerer) Clien
Name: "kv_request_duration_seconds",
Help: "Time spent on kv store requests.",
Buckets: prometheus.DefBuckets,
// Use defaults recommended by Prometheus for native histograms.
NativeHistogramBucketFactor: 1.1,
NativeHistogramMaxBucketNumber: 100,
NativeHistogramMinResetDuration: time.Hour,
ConstLabels: prometheus.Labels{
"type": backend,
},
Expand Down