diff --git a/CHANGELOG.md b/CHANGELOG.md index 51efc305e27..7f68231b33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ next release (yyyy-mm-dd) * [SPM] Support spanmetrics connector by default ([@albertteoh](https://github.com/albertteoh) in [#4704](https://github.com/jaegertracing/jaeger/pull/4704)) * [tracegen] Stop supporting -trace-exporter=jaeger ([@yurishkuro](https://github.com/yurishkuro) in [#4717](https://github.com/jaegertracing/jaeger/pull/4717)) * [hotrod] Stop supporting -otel-exporter=jaeger ([@yurishkuro](https://github.com/yurishkuro) in [#4719](https://github.com/jaegertracing/jaeger/pull/4719)) +* [hotrod] Metrics endpoints moved from route service (:8083) to frontend service (:8080) ([@yurishkuro](https://github.com/yurishkuro) in [#4720](https://github.com/jaegertracing/jaeger/pull/4720)) #### New Features diff --git a/examples/hotrod/services/frontend/server.go b/examples/hotrod/services/frontend/server.go index 828eae2fba1..0a874997aa7 100644 --- a/examples/hotrod/services/frontend/server.go +++ b/examples/hotrod/services/frontend/server.go @@ -18,10 +18,12 @@ package frontend import ( "embed" "encoding/json" + "expvar" "net/http" "path" "strconv" + "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" @@ -82,6 +84,8 @@ func (s *Server) createServeMux() http.Handler { mux.Handle(p, http.StripPrefix(p, http.FileServer(s.assetFS))) mux.Handle(path.Join(p, "/dispatch"), http.HandlerFunc(s.dispatch)) mux.Handle(path.Join(p, "/config"), http.HandlerFunc(s.config)) + mux.Handle(path.Join(p, "/debug/vars"), expvar.Handler()) // expvar + mux.Handle(path.Join(p, "/metrics"), promhttp.Handler()) // Prometheus return mux } diff --git a/examples/hotrod/services/route/server.go b/examples/hotrod/services/route/server.go index 9d2643f9301..94ca8e86e57 100644 --- a/examples/hotrod/services/route/server.go +++ b/examples/hotrod/services/route/server.go @@ -18,13 +18,11 @@ package route import ( "context" "encoding/json" - "expvar" "math" "math/rand" "net/http" "time" - "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" @@ -61,11 +59,15 @@ func (s *Server) Run() error { func (s *Server) createServeMux() http.Handler { mux := tracing.NewServeMux(false, s.tracer, s.logger) mux.Handle("/route", http.HandlerFunc(s.route)) - mux.Handle("/debug/vars", expvar.Handler()) // expvar - mux.Handle("/metrics", promhttp.Handler()) // Prometheus + mux.Handle("/debug/vars", http.HandlerFunc(movedToFrontend)) + mux.Handle("/metrics", http.HandlerFunc(movedToFrontend)) return mux } +func movedToFrontend(w http.ResponseWriter, r *http.Request) { + http.Error(w, "endpoint moved to the frontend service", http.StatusNotFound) +} + func (s *Server) route(w http.ResponseWriter, r *http.Request) { ctx := r.Context() s.logger.For(ctx).Info("HTTP request received", zap.String("method", r.Method), zap.Stringer("url", r.URL))