Skip to content

Commit

Permalink
refactor(server/v2/telemetry): swap redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Nov 13, 2024
1 parent f1bd0d8 commit 4b4fe7a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/v2/api/telemetry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ func (s *Server[T]) Start(ctx context.Context) error {
}

mux := http.NewServeMux()
mux.HandleFunc("/", s.metricsHandler)
// keeping /metrics for backwards compatibility
mux.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusMovedPermanently)
// /metrics is the default standard path for Prometheus metrics.
mux.HandleFunc("/metrics", s.metricsHandler)
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/metrics", http.StatusMovedPermanently)
})

s.server = &http.Server{
Expand Down

0 comments on commit 4b4fe7a

Please sign in to comment.