Skip to content

Commit 962b37a

Browse files
authored
Little query tee enhancements (#2799)
* Higher granularity for the query-tee duration metrics Signed-off-by: Marco Pracucci <[email protected]> * Fast fail if the preferred backend is misconfigured Signed-off-by: Marco Pracucci <[email protected]> * Added CHANGELOG entry Signed-off-by: Marco Pracucci <[email protected]>
1 parent 79481c3 commit 962b37a

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* [FEATURE] Introduced `ruler.for-grace-period`, Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. #2783
1212
* [FEATURE] Introduced `ruler.resend-delay`, Minimum amount of time to wait before resending an alert to Alertmanager. #2783
1313
* [ENHANCEMENT] Experimental: Querier can now optionally query secondary store. This is specified by using `-querier.second-store-engine` option, with values `chunks` or `tsdb`. Standard configuration options for this store are used. Additionally, this querying can be configured to happen only for queries that need data older than `-querier.use-second-store-before-time`. Default value of zero will always query secondary store. #2747
14+
* [ENHANCEMENT] Query-tee: increased the `cortex_querytee_request_duration_seconds` metric buckets granularity. #2799
15+
* [ENHANCEMENT] Query-tee: fail to start if the configured `-backend.preferred` is unknown. #2799
1416
* [ENHANCEMENT] Ruler: Added the following metrics: #2786
1517
* `cortex_prometheus_notifications_latency_seconds`
1618
* `cortex_prometheus_notifications_errors_total`

tools/querytee/proxy.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,21 @@ func NewProxy(cfg ProxyConfig, logger log.Logger, routes []Route, registerer pro
107107
return nil, errMinBackends
108108
}
109109

110+
// If the preferred backend is configured, then it must exists among the actual backends.
111+
if cfg.PreferredBackend != "" {
112+
exists := false
113+
for _, b := range p.backends {
114+
if b.preferred {
115+
exists = true
116+
break
117+
}
118+
}
119+
120+
if !exists {
121+
return nil, fmt.Errorf("the preferred backend (hostname) has not been found among the list of configured backends")
122+
}
123+
}
124+
110125
if cfg.CompareResponses && len(p.backends) != 2 {
111126
return nil, fmt.Errorf("when enabling comparison of results number of backends should be 2 exactly")
112127
}
@@ -159,6 +174,7 @@ func (p *Proxy) Start() error {
159174
}
160175
}()
161176

177+
level.Info(p.logger).Log("msg", "The proxy is up and running.")
162178
return nil
163179
}
164180

tools/querytee/proxy_metrics.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package querytee
33
import (
44
"github.com/prometheus/client_golang/prometheus"
55
"github.com/prometheus/client_golang/prometheus/promauto"
6-
"github.com/weaveworks/common/instrument"
76
)
87

98
const (
@@ -23,7 +22,7 @@ func NewProxyMetrics(registerer prometheus.Registerer) *ProxyMetrics {
2322
Namespace: "cortex_querytee",
2423
Name: "request_duration_seconds",
2524
Help: "Time (in seconds) spent serving HTTP requests.",
26-
Buckets: instrument.DefBuckets,
25+
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 0.75, 1, 1.5, 2, 3, 4, 5, 10, 25, 50, 100},
2726
}, []string{"backend", "method", "route", "status_code"}),
2827
responsesTotal: promauto.With(registerer).NewCounterVec(prometheus.CounterOpts{
2928
Namespace: "cortex_querytee",

0 commit comments

Comments
 (0)