Skip to content

Commit ef9e72e

Browse files
authored
Update dskit to support loading runtime configs from HTTP endpoints (#15052)
#### What this PR does Update dskit to get grafana/dskit#926. That change lets the runtimeconfig Manager load configuration from `http://` and `https://` URLs in addition to local files, so `-runtime-config.file` now accepts URLs. It also adds the `-runtime-config.http-client-timeout` flag (default `30s`) for the HTTP fetch timeout. #### Which issue(s) this PR fixes or relates to N/A #### Checklist - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes runtime-config loading to perform HTTP requests and adds new timeout/metrics, which can affect startup/reload behavior and introduce network-related failure modes. > > **Overview** > **Runtime config loading now supports remote sources.** `-runtime-config.file` can point to `http://`/`https://` URLs as well as local files, via a new provider abstraction in the vendored `dskit` runtimeconfig manager. > > Adds `-runtime-config.http-client-timeout` (default `30s`) and a `runtime_config_http_request_duration_seconds` metric for HTTP fetch latency, and updates generated config/help docs plus `CHANGELOG.md` accordingly. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1dd09da. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 37b04a0 commit ef9e72e

11 files changed

Lines changed: 201 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* [CHANGE] Ingest storage: The `cortex_ingest_storage_writer_latency_seconds` metric now tracks the latency to write an incoming request to all Kafka partitions in a single call, instead of tracking latency individually for each partition. #14898
3535
* [CHANGE] Ingest storage: deprecated `-ingest-storage.kafka.write-clients` CLI flag. The flag is now ignored and Mimir always uses a single Kafka write client. The flag will be removed in Mimir 3.3. #14903
3636
* [CHANGE] Alertmanager: `-alertmanager.grafana-alertmanager-idle-grace-period` renamed to `-alertmanager.strict-initialization-idle-grace-period`. #14960
37+
* [FEATURE] Runtime config: Support loading configuration from `http://` and `https://` URLs in addition to local files via `-runtime-config.file`. Added `-runtime-config.http-client-timeout` (default `30s`) to control the HTTP fetch timeout. #15052
3738
* [FEATURE] Distributor: Derive limits based on tenant metadata. Supported limits are `max_active_series_per_user`, `ingestion_rate`, `ingestion_burst_size`, `ingestion_burst_factor`, `otel_metric_suffixes_enabled`, `name_validation_scheme` and `otel_translation_strategy`. #14289
3839
* [FEATURE] Distributor: add `cortex_distributor_request_body_compression_ratio` histogram that tracks the compression of write requests. #14232
3940
* [FEATURE] Distributor: add `-distributor.otel-label-name-underscore-sanitization` and `-distributor.otel-label-name-preserve-underscores` that control sanitization of underscores during OTLP translation. #13133

cmd/mimir/config-descriptor.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18683,11 +18683,22 @@
1868318683
"kind": "field",
1868418684
"name": "file",
1868518685
"required": false,
18686-
"desc": "Comma separated list of yaml files with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.",
18686+
"desc": "Comma separated list of yaml files or URLs with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.",
1868718687
"fieldValue": null,
1868818688
"fieldDefaultValue": "",
1868918689
"fieldFlag": "runtime-config.file",
1869018690
"fieldType": "string"
18691+
},
18692+
{
18693+
"kind": "field",
18694+
"name": "http_client_timeout",
18695+
"required": false,
18696+
"desc": "HTTP client timeout when fetching runtime config from URLs.",
18697+
"fieldValue": null,
18698+
"fieldDefaultValue": 30000000000,
18699+
"fieldFlag": "runtime-config.http-client-timeout",
18700+
"fieldType": "duration",
18701+
"fieldCategory": "advanced"
1869118702
}
1869218703
],
1869318704
"fieldValue": null,

cmd/mimir/help-all.txt.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3282,7 +3282,9 @@ Usage of ./cmd/mimir/mimir:
32823282
-ruler.tenant-shard-size int
32833283
The tenant's shard size when sharding is used by ruler. Value of 0 disables shuffle sharding for the tenant, and tenant rules will be sharded across all ruler replicas.
32843284
-runtime-config.file comma-separated-list-of-strings
3285-
Comma separated list of yaml files with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.
3285+
Comma separated list of yaml files or URLs with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.
3286+
-runtime-config.http-client-timeout duration
3287+
HTTP client timeout when fetching runtime config from URLs. (default 30s)
32863288
-runtime-config.reload-period duration
32873289
How often to check runtime config files. (default 10s)
32883290
-server.cluster-validation.additional-labels comma-separated-list-of-strings

cmd/mimir/help.txt.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ Usage of ./cmd/mimir/mimir:
840840
-ruler.tenant-shard-size int
841841
The tenant's shard size when sharding is used by ruler. Value of 0 disables shuffle sharding for the tenant, and tenant rules will be sharded across all ruler replicas.
842842
-runtime-config.file comma-separated-list-of-strings
843-
Comma separated list of yaml files with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.
843+
Comma separated list of yaml files or URLs with the configuration that can be updated at runtime. Runtime config files will be merged from left to right.
844844
-server.create-new-traces
845845
Creates new traces for each call rather than continuing the existing trace. A span link is used to allow navigation to the parent trace. Only works when using Open-Telemetry tracing.
846846
-server.grpc-collect-max-streams-by-conn

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,16 @@ runtime_config:
342342
# CLI flag: -runtime-config.reload-period
343343
[period: <duration> | default = 10s]
344344

345-
# Comma separated list of yaml files with the configuration that can be
346-
# updated at runtime. Runtime config files will be merged from left to right.
345+
# Comma separated list of yaml files or URLs with the configuration that can
346+
# be updated at runtime. Runtime config files will be merged from left to
347+
# right.
347348
# CLI flag: -runtime-config.file
348349
[file: <string> | default = ""]
349350

351+
# (advanced) HTTP client timeout when fetching runtime config from URLs.
352+
# CLI flag: -runtime-config.http-client-timeout
353+
[http_client_timeout: <duration> | default = 30s]
354+
350355
# The memberlist block configures the Gossip memberlist.
351356
[memberlist: <memberlist>]
352357

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/golang/snappy v1.0.0
1818
github.com/google/gopacket v1.1.19
1919
github.com/gorilla/mux v1.8.1
20-
github.com/grafana/dskit v0.0.0-20260413135140-f8fd8e188362
20+
github.com/grafana/dskit v0.0.0-20260417113503-29a3c41c2ad7
2121
github.com/grafana/e2e v0.1.2-0.20260309174126-b5393d4e610f
2222
github.com/hashicorp/golang-lru v1.0.2 // indirect
2323
github.com/influxdata/influxdb/v2 v2.8.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ github.com/gosimple/slug v1.1.1 h1:fRu/digW+NMwBIP+RmviTK97Ho/bEj/C9swrCspN3D4=
585585
github.com/gosimple/slug v1.1.1/go.mod h1:ER78kgg1Mv0NQGlXiDe57DpCyfbNywXXZ9mIorhxAf0=
586586
github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc h1:PXZQA2WCxe85Tnn+WEvr8fDpfwibmEPgfgFEaC87G24=
587587
github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4=
588-
github.com/grafana/dskit v0.0.0-20260413135140-f8fd8e188362 h1:hE4cSWYfhmUV1RBGm+caOF7QhYDVX9VTfNuhH5yZvTQ=
589-
github.com/grafana/dskit v0.0.0-20260413135140-f8fd8e188362/go.mod h1:6zFIzal2FCd0JC1pE0ZTb2ftC0Jr/zsQR4zRNRdDfZA=
588+
github.com/grafana/dskit v0.0.0-20260417113503-29a3c41c2ad7 h1:5LLRUYS/OUhGoaxY0x+6vUDtKgtlB4kLp3k9vQxcYjM=
589+
github.com/grafana/dskit v0.0.0-20260417113503-29a3c41c2ad7/go.mod h1:6zFIzal2FCd0JC1pE0ZTb2ftC0Jr/zsQR4zRNRdDfZA=
590590
github.com/grafana/e2e v0.1.2-0.20260309174126-b5393d4e610f h1:gxaqz5StufMU078tWFuf8CUi4PZtITBxjM2TZV7NOFw=
591591
github.com/grafana/e2e v0.1.2-0.20260309174126-b5393d4e610f/go.mod h1:KFvJP5m5GQ837CN7rUbWIiPdw1JZgeRJTEyp2O5U0is=
592592
github.com/grafana/go-yaml/v3 v3.0.0-20260130164322-e3c24e8f4c87 h1:Op5/Kd8Ae90IC7Ow+CNwGo/oq87cJX2iE+U8Dw4a8Bc=

operations/mimir/mimir-flags-defaults.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,7 @@
13281328
"alertmanager-storage.local.path": "",
13291329
"runtime-config.reload-period": 10000000000,
13301330
"runtime-config.file": "",
1331+
"runtime-config.http-client-timeout": 30000000000,
13311332
"memberlist.nodename": "",
13321333
"memberlist.randomize-node-name": true,
13331334
"memberlist.stream-timeout": 2000000000,

vendor/github.com/grafana/dskit/runtimeconfig/manager.go

Lines changed: 47 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/grafana/dskit/runtimeconfig/provider.go

Lines changed: 125 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)