Skip to content

Commit

Permalink
refactor(server/v2/telemetry): swap redirects (#22520)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Nov 13, 2024
1 parent 276a667 commit e74799e
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 e74799e

Please sign in to comment.