Skip to content

Commit efc9ef7

Browse files
authored
refactor: remove ability to set downstream-url in query-frontend (#12191)
#### What this PR does Remove the ability to set a downstream-url in the query-frontend which allowed the query-frontend to act as a frontend for any Prometheus compatible server. The functionality is not used internally and complicates maintenance of the query-frontend. #### Which issue(s) this PR fixes or relates to Fixes #11883 #### Checklist - [X] Tests updated. - [X] Documentation added. - [x] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [ ] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
1 parent 32ad667 commit efc9ef7

7 files changed

Lines changed: 1 addition & 533 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [CHANGE] Querier: Add support for UTF-8 label and metric names in `label_join`, `label_replace` and `count_values` PromQL functions. #11848.
99
* [CHANGE] Remove support for Redis as a cache backend. #12163
1010
* [CHANGE] Memcached: Remove experimental `-<prefix>.memcached.addresses-provider` flag to use alternate DNS service discovery backends. The more reliable backend introduced in 2.16.0 (#10895) is now the default. As a result of this change, DNS-based cache service discovery no longer supports search domains. #12175
11+
* [CHANGE] Query-frontend: Remove the CLI flag `-query-frontend.downstream-url` and corresponding YAML configuration and the ability to use the query-frontend to proxy arbitrary Prometheus backends. #12191
1112
* [FEATURE] Distributor: Add experimental `-distributor.otel-native-delta-ingestion` option to allow primitive delta metrics ingestion via the OTLP endpoint. #11631
1213
* [FEATURE] MQE: Add support for experimental `sort_by_label` and `sort_by_label_desc` PromQL functions. #11930
1314
* [FEATURE] Ingester/Block-builder: Handle the created timestamp field for remote-write requests. #11977

cmd/mimir/config-descriptor.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7494,17 +7494,6 @@
74947494
"fieldFlag": "query-frontend.cache-samples-processed-stats",
74957495
"fieldType": "boolean"
74967496
},
7497-
{
7498-
"kind": "field",
7499-
"name": "downstream_url",
7500-
"required": false,
7501-
"desc": "URL of downstream Prometheus.",
7502-
"fieldValue": null,
7503-
"fieldDefaultValue": "",
7504-
"fieldFlag": "query-frontend.downstream-url",
7505-
"fieldType": "string",
7506-
"fieldCategory": "advanced"
7507-
},
75087497
{
75097498
"kind": "block",
75107499
"name": "client_cluster_validation",

cmd/mimir/help-all.txt.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,8 +2187,6 @@ Usage of ./cmd/mimir/mimir:
21872187
Cache requests that are not step-aligned.
21882188
-query-frontend.client-cluster-validation.label string
21892189
[experimental] Optionally define the cluster validation label.
2190-
-query-frontend.downstream-url string
2191-
URL of downstream Prometheus.
21922190
-query-frontend.enable-query-engine-fallback
21932191
[experimental] If set to true and the Mimir query engine is in use, fall back to using the Prometheus query engine for any queries not supported by the Mimir query engine. (default true)
21942192
-query-frontend.enabled-promql-experimental-functions comma-separated-list-of-strings

docs/sources/mimir/configure/configuration-parameters/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,10 +1826,6 @@ results_cache:
18261826
# CLI flag: -query-frontend.cache-samples-processed-stats
18271827
[cache_samples_processed_stats: <boolean> | default = false]
18281828

1829-
# (advanced) URL of downstream Prometheus.
1830-
# CLI flag: -query-frontend.downstream-url
1831-
[downstream_url: <string> | default = ""]
1832-
18331829
client_cluster_validation:
18341830
# (experimental) Optionally define the cluster validation label.
18351831
# CLI flag: -query-frontend.client-cluster-validation.label

pkg/frontend/config.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ type CombinedFrontendConfig struct {
3434

3535
QueryMiddleware querymiddleware.Config `yaml:",inline"`
3636

37-
DownstreamURL string `yaml:"downstream_url" category:"advanced"`
38-
3937
ClusterValidationConfig clusterutil.ClusterValidationConfig `yaml:"client_cluster_validation" category:"experimental"`
4038

4139
QueryEngine string `yaml:"query_engine" category:"experimental"`
@@ -49,7 +47,6 @@ func (cfg *CombinedFrontendConfig) RegisterFlags(f *flag.FlagSet, logger log.Log
4947
cfg.QueryMiddleware.RegisterFlags(f)
5048
cfg.ClusterValidationConfig.RegisterFlagsWithPrefix("query-frontend.client-cluster-validation.", f)
5149

52-
f.StringVar(&cfg.DownstreamURL, "query-frontend.downstream-url", "", "URL of downstream Prometheus.")
5350
f.StringVar(&cfg.QueryEngine, "query-frontend.query-engine", querier.PrometheusEngine, fmt.Sprintf("Query engine to use, either '%v' or '%v'", querier.PrometheusEngine, querier.MimirEngine))
5451
f.BoolVar(&cfg.EnableQueryEngineFallback, "query-frontend.enable-query-engine-fallback", true, "If set to true and the Mimir query engine is in use, fall back to using the Prometheus query engine for any queries not supported by the Mimir query engine.")
5552
}
@@ -80,11 +77,6 @@ func InitFrontend(
8077
codec querymiddleware.Codec,
8178
) (http.RoundTripper, *v1.Frontend, *v2.Frontend, error) {
8279
switch {
83-
case cfg.DownstreamURL != "":
84-
// If the user has specified a downstream Prometheus, then we should use that.
85-
rt, err := NewDownstreamRoundTripper(cfg.DownstreamURL)
86-
return httpRoundTripper(cfg, rt, reg, log), nil, nil, err
87-
8880
case cfg.FrontendV2.SchedulerAddress != "" || cfg.FrontendV2.QuerySchedulerDiscovery.Mode == schedulerdiscovery.ModeRing:
8981
// Query-scheduler is enabled when its address is configured or ring-based service discovery is configured.
9082
if cfg.FrontendV2.Addr == "" {
@@ -118,16 +110,6 @@ func invalidClusterValidationReporter(cfg CombinedFrontendConfig, reg prometheus
118110
return util.NewInvalidClusterValidationReporter(cfg.ClusterValidationConfig.Label, invalidClusterValidation, logger)
119111
}
120112

121-
func httpRoundTripper(cfg CombinedFrontendConfig, rt http.RoundTripper, reg prometheus.Registerer, logger log.Logger) http.RoundTripper {
122-
if rt == nil {
123-
return nil
124-
}
125-
if cfg.ClusterValidationConfig.Label != "" {
126-
return middleware.ClusterValidationRoundTripper(cfg.ClusterValidationConfig.Label, invalidClusterValidationReporter(cfg, reg, logger), rt)
127-
}
128-
return rt
129-
}
130-
131113
func grpcToHTTPRoundTripper(cfg CombinedFrontendConfig, grpcRoundTripper transport.GrpcRoundTripper, reg prometheus.Registerer, logger log.Logger) http.RoundTripper {
132114
if grpcRoundTripper == nil {
133115
return nil

pkg/frontend/downstream_roundtripper.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)