1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-12-01 23:12:29 +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

@@ -107,9 +107,9 @@ func main() {
err := tracer.WithSpan(ctx, "operation", func(ctx context.Context) error {
trace.CurrentSpan(ctx).AddEvent(ctx, "Nice operation!", key.New("bogons").Int(100))
trace.SpanFromContext(ctx).AddEvent(ctx, "Nice operation!", key.New("bogons").Int(100))
trace.CurrentSpan(ctx).SetAttributes(anotherKey.String("yes"))
trace.SpanFromContext(ctx).SetAttributes(anotherKey.String("yes"))
gauge.Set(ctx, 1)
@@ -126,9 +126,9 @@ func main() {
ctx,
"Sub operation...",
func(ctx context.Context) error {
trace.CurrentSpan(ctx).SetAttributes(lemonsKey.String("five"))
trace.SpanFromContext(ctx).SetAttributes(lemonsKey.String("five"))
trace.CurrentSpan(ctx).AddEvent(ctx, "Sub span event")
trace.SpanFromContext(ctx).AddEvent(ctx, "Sub span event")
measure.Record(ctx, 1.3)