You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-25 22:41:46 +02:00
Rename CurrentSpan to SpanFromContext & SetCurrentSpan to ContextWithSpan (#379)
Signed-off-by: vineeth <vineethpothulapati@outlook.com>
This commit is contained in:
committed by
rghetia
parent
658dd7d1b9
commit
b863b8f6ab
@@ -220,9 +220,9 @@ func setAfterServeAttributes(span trace.Span, read, wrote, statusCode int64, rer
|
||||
// RouteKey Tag.
|
||||
func WithRouteTag(route string, h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
span := trace.CurrentSpan(r.Context())
|
||||
span := trace.SpanFromContext(r.Context())
|
||||
//TODO: Why doesn't tag.Upsert work?
|
||||
span.SetAttributes(RouteKey.String(route))
|
||||
h.ServeHTTP(w, r.WithContext(trace.SetCurrentSpan(r.Context(), span)))
|
||||
h.ServeHTTP(w, r.WithContext(trace.ContextWithSpan(r.Context(), span)))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user