From d35dd8b0d9539acc3b31f7632fc719f9c88e9b24 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 28 Sep 2017 14:42:24 +0100 Subject: [PATCH] Set the span in the request context --- src/github.com/matrix-org/dendrite/common/httpapi.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/common/httpapi.go b/src/github.com/matrix-org/dendrite/common/httpapi.go index 1b8139717..67a2ac90e 100644 --- a/src/github.com/matrix-org/dendrite/common/httpapi.go +++ b/src/github.com/matrix-org/dendrite/common/httpapi.go @@ -32,6 +32,7 @@ func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse withSpan := func(w http.ResponseWriter, req *http.Request) { span := opentracing.StartSpan(metricsName) defer span.Finish() + req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span)) h.ServeHTTP(w, req) } @@ -54,6 +55,7 @@ func MakeInternalAPI(metricsName string, f func(*http.Request) util.JSONResponse span = tracer.StartSpan(metricsName, ext.RPCServerOption(clientContext)) } defer span.Finish() + req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span)) h.ServeHTTP(w, req) }