You've already forked opentelemetry-go
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:
committed by
rghetia
parent
658dd7d1b9
commit
b863b8f6ab
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user