Skip to content

Commit e47e433

Browse files
committed
chore: /v2/metrics -> /metrics
Signed-off-by: Eoghan Lawless <[email protected]>
1 parent 38e324a commit e47e433

File tree

5 files changed

+83
-86
lines changed

5 files changed

+83
-86
lines changed

api/openapi/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ paths:
618618
"500":
619619
$ref: '#/components/responses/500-InternalServerError'
620620

621-
/v2/metrics:
621+
/metrics:
622622
get:
623623
description: Gets the Cluster Manager REST API prometheus metrics.
624624
security: [] # skips authentication

deployment/charts/cluster-manager/templates/metrics-service.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ spec:
1414
- path: /metrics
1515
port: metrics
1616
scheme: http
17-
- path: /v2/metrics
18-
port: metrics
19-
scheme: http
2017
namespaceSelector:
2118
matchNames:
2219
- {{ .Release.Namespace }}

internal/rest/middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
var (
1616
ignoredPaths = []string{
1717
"/v2/healthz",
18-
"/v2/metrics",
18+
"/metrics",
1919
}
2020
)
2121

@@ -35,7 +35,7 @@ func appendMiddlewares(mw ...middleware) func(http.Handler) http.Handler {
3535
// logger logs the request and response
3636
func logger(next http.Handler) http.Handler {
3737
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
38-
if r.URL.Path != "/v2/healthz" { // reduce log spam
38+
if !slices.Contains(ignoredPaths, r.URL.Path) { // reduce log spam
3939
slog.Debug("received request", "method", r.Method, "path", r.URL.Path)
4040
}
4141
next.ServeHTTP(w, r)

internal/rest/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (s *Server) getServerHandler() (http.Handler, error) {
122122
router := http.NewServeMux()
123123

124124
if !s.config.DisableMetrics {
125-
router.Handle("/v2/metrics", promhttp.HandlerFor(metrics.GetRegistry(), promhttp.HandlerOpts{}))
125+
router.Handle("/metrics", promhttp.HandlerFor(metrics.GetRegistry(), promhttp.HandlerOpts{}))
126126
}
127127

128128
// create the openapi handler with existing router

pkg/api/spec.gen.go

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

0 commit comments

Comments
 (0)