1
0
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:
Vineeth Pothulapati
2019-12-11 22:21:32 +05:30
committed by rghetia
parent 658dd7d1b9
commit b863b8f6ab
22 changed files with 45 additions and 45 deletions

View File

@@ -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)))
})
}