github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/actor/middleware/opentracing/stoppingspan.go (about) 1 package opentracing 2 3 import ( 4 "sync" 5 6 "github.com/asynkron/protoactor-go/actor" 7 "github.com/opentracing/opentracing-go" 8 ) 9 10 var stoppingSpans = sync.Map{} 11 12 func getAndClearStoppingSpan(pid *actor.PID) opentracing.Span { 13 value, ok := stoppingSpans.Load(pid) 14 if !ok { 15 return nil 16 } 17 stoppingSpans.Delete(pid) 18 return value.(opentracing.Span) 19 } 20 21 func getStoppingSpan(pid *actor.PID) opentracing.Span { 22 value, ok := stoppingSpans.Load(pid) 23 if !ok { 24 return nil 25 } 26 return value.(opentracing.Span) 27 } 28 29 func setStoppingSpan(pid *actor.PID, span opentracing.Span) { 30 stoppingSpans.Store(pid, span) 31 }