mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 17:33:09 -06:00
Set the span in the request context
This commit is contained in:
parent
7fdc8c2bdc
commit
d35dd8b0d9
|
|
@ -32,6 +32,7 @@ func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse
|
||||||
withSpan := func(w http.ResponseWriter, req *http.Request) {
|
withSpan := func(w http.ResponseWriter, req *http.Request) {
|
||||||
span := opentracing.StartSpan(metricsName)
|
span := opentracing.StartSpan(metricsName)
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span))
|
||||||
h.ServeHTTP(w, req)
|
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))
|
span = tracer.StartSpan(metricsName, ext.RPCServerOption(clientContext))
|
||||||
}
|
}
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span))
|
||||||
h.ServeHTTP(w, req)
|
h.ServeHTTP(w, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue