Skip to content

Commit

Permalink
Move HTTP middleware to dskit
Browse files Browse the repository at this point in the history
Signed-off-by: Arve Knudsen <[email protected]>
  • Loading branch information
aknuds1 committed Jan 27, 2025
1 parent f1d9205 commit cc32ac6
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion cmd/mimir/config-descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
"kind": "field",
"name": "register_instrumentation",
"required": false,
"desc": "Register the intrumentation handlers (/metrics etc).",
"desc": "Register the instrumentation handlers (/metrics etc).",
"fieldValue": null,
"fieldDefaultValue": true,
"fieldFlag": "server.register-instrumentation",
Expand Down
2 changes: 1 addition & 1 deletion cmd/mimir/help-all.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,7 @@ Usage of ./cmd/mimir/mimir:
-server.proxy-protocol-enabled
[experimental] Enables PROXY protocol.
-server.register-instrumentation
Register the intrumentation handlers (/metrics etc). (default true)
Register the instrumentation handlers (/metrics etc). (default true)
-server.report-grpc-codes-in-instrumentation-label-enabled
If set to true, gRPC statuses will be reported in instrumentation labels with their string representations. Otherwise, they will be reported as "error". (default true)
-server.throughput.latency-cutoff duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ grpc_tls_config:
# CLI flag: -server.grpc-tls-ca-path
[client_ca_file: <string> | default = ""]
# (advanced) Register the intrumentation handlers (/metrics etc).
# (advanced) Register the instrumentation handlers (/metrics etc).
# CLI flag: -server.register-instrumentation
[register_instrumentation: <boolean> | default = true]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/gopacket v1.1.19
github.com/gorilla/mux v1.8.1
github.com/grafana/dskit v0.0.0-20250124130032-aff6c876915b
github.com/grafana/dskit v0.0.0-20250124144421-f0ea018933c4
github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/influxdata/influxdb/v2 v2.7.11
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,8 @@ github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc h1:PXZQA2WCxe85T
github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4=
github.com/grafana/alerting v0.0.0-20250113170557-b4ab2ba363a8 h1:mdI6P22PgFD7bQ0Yf4h8cfHSldak4nxogvlsTHZyZmc=
github.com/grafana/alerting v0.0.0-20250113170557-b4ab2ba363a8/go.mod h1:QsnoKX/iYZxA4Cv+H+wC7uxutBD8qi8ZW5UJvD2TYmU=
github.com/grafana/dskit v0.0.0-20250124130032-aff6c876915b h1:y34FUoHHxGMbsX8nsGdCdJGfazKlGjf/7QhvgFMn0HA=
github.com/grafana/dskit v0.0.0-20250124130032-aff6c876915b/go.mod h1:SPLNCARd4xdjCkue0O6hvuoveuS1dGJjDnfxYe405YQ=
github.com/grafana/dskit v0.0.0-20250124144421-f0ea018933c4 h1:0CvC3frl7I1DnDZKd4WMib7Amb8yX/1/Wv8QopqMzzI=
github.com/grafana/dskit v0.0.0-20250124144421-f0ea018933c4/go.mod h1:SPLNCARd4xdjCkue0O6hvuoveuS1dGJjDnfxYe405YQ=
github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc h1:BW+LjKJDz0So5LI8UZfW5neWeKpSkWqhmGjQFzcFfLM=
github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc/go.mod h1:JVmqPBe8A/pZWwRoJW5ZjyALeY5OXMzPl7LrVXOdZAI=
github.com/grafana/franz-go v0.0.0-20241009100846-782ba1442937 h1:fwwnG/NcygoS6XbAaEyK2QzMXI/BZIEJvQ3CD+7XZm8=
Expand Down
5 changes: 0 additions & 5 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ func (a *API) RegisterRoutesWithPrefix(prefix string, handler http.Handler, auth
}

func (a *API) newRoute(path string, handler http.Handler, isPrefix, auth, gzip bool, methods ...string) (route *mux.Route) {
if a.server.Cluster() != "" {
level.Debug(a.logger).Log("msg", "api: enabling cluster validation middleware", "path", path, "cluster", a.server.Cluster())
handler = ClusterValidationMiddleware(a.server.Cluster(), a.logger).Wrap(handler)
}

// Propagate the consistency level on all HTTP routes.
// They are not used everywhere, but for consistency and less surprise it's added everywhere.
handler = querierapi.ConsistencyMiddleware().Wrap(handler)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions vendor/github.com/grafana/dskit/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cc32ac6

Please sign in to comment.