From 4a46856cba6f9f2f5d857b43f1a83237e51e138f Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Fri, 20 Sep 2024 01:33:51 +0200 Subject: [PATCH 1/2] ruler: use native histograms for client metrics Signed-off-by: Pedro Tanaka --- pkg/extprom/http/instrument_client.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/extprom/http/instrument_client.go b/pkg/extprom/http/instrument_client.go index 75d33243c7..ebdda5fbe1 100644 --- a/pkg/extprom/http/instrument_client.go +++ b/pkg/extprom/http/instrument_client.go @@ -27,6 +27,8 @@ type ClientMetrics struct { // e.g. 1 ClientMetrics should be used for all the clients that talk to Alertmanager. func NewClientMetrics(reg prometheus.Registerer) *ClientMetrics { var m ClientMetrics + const maxBucketNumber = 256 + const bucketFactor = 1.1 m.inFlightGauge = promauto.With(reg).NewGauge(prometheus.GaugeOpts{ Subsystem: "http_client", @@ -46,6 +48,9 @@ func NewClientMetrics(reg prometheus.Registerer) *ClientMetrics { Name: "dns_duration_seconds", Help: "Trace dns latency histogram.", Buckets: []float64{0.025, .05, .1, .5, 1, 5, 10}, + + NativeHistogramBucketFactor: bucketFactor, + NativeHistogramMaxBucketNumber: maxBucketNumber, }, []string{"event"}, ) @@ -56,6 +61,9 @@ func NewClientMetrics(reg prometheus.Registerer) *ClientMetrics { Name: "tls_duration_seconds", Help: "Trace tls latency histogram.", Buckets: []float64{0.025, .05, .1, .5, 1, 5, 10}, + + NativeHistogramBucketFactor: bucketFactor, + NativeHistogramMaxBucketNumber: maxBucketNumber, }, []string{"event"}, ) @@ -66,6 +74,9 @@ func NewClientMetrics(reg prometheus.Registerer) *ClientMetrics { Name: "request_duration_seconds", Help: "A histogram of request latencies.", Buckets: []float64{0.025, .05, .1, .5, 1, 5, 10}, + + NativeHistogramBucketFactor: bucketFactor, + NativeHistogramMaxBucketNumber: maxBucketNumber, }, []string{"code", "method"}, ) From 91a20eb9802e858542e1a3ac14855e811ecbc7f0 Mon Sep 17 00:00:00 2001 From: Pedro Tanaka Date: Fri, 20 Sep 2024 01:37:28 +0200 Subject: [PATCH 2/2] adding changelog Signed-off-by: Pedro Tanaka --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c39767b6c4..fa1367c41b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7679](https://github.com/thanos-io/thanos/pull/7679) Query: respect store.limit.* flags when evaluating queries ### Added - +- [#7763](https://github.com/thanos-io/thanos/pull/7763) Ruler: use native histograms for client latency metrics. - [#7609](https://github.com/thanos-io/thanos/pull/7609) API: Add limit param to metadata APIs (series, label names, label values). - [#7429](https://github.com/thanos-io/thanos/pull/7429): Reloader: introduce `TolerateEnvVarExpansionErrors` to allow suppressing errors when expanding environment variables in the configuration file. When set, this will ensure that the reloader won't consider the operation to fail when an unset environment variable is encountered. Note that all unset environment variables are left as is, whereas all set environment variables are expanded as usual. - [#7560](https://github.com/thanos-io/thanos/pull/7560) Query: Added the possibility of filtering rules by rule_name, rule_group or file to HTTP api.