Use the DebugTrace in the server middleware stack
@@ -19,6 +19,7 @@ import (
"github.com/hellofresh/janus/pkg/web"
"github.com/hellofresh/stats-go/client"
log "github.com/sirupsen/logrus"
+ "go.opencensus.io/plugin/ochttp/propagation/b3"
)
// Server is the Janus server
@@ -281,6 +282,11 @@ func (s *Server) createRouter() router.Router {
r.Use(middleware.RequestID)
}
+ // Add DebugTraceKey middleware which returns debug header with the Trace ID
+ if s.globalConfig.Tracing.DebugTraceKey != "" {
+ r.Use(middleware.DebugTrace(&b3.HTTPFormat{}, s.globalConfig.Tracing.DebugTraceKey))
+ }
+
r.Use(
middleware.NewStats(s.statsClient).Handler,
middleware.NewLogger().Handler,
