Do not attempt to end a span if ctx wasn't found (#59)
* Do not attempt to end a span if ctx is undefined
This commit is contained in:
parent
f281a90f3c
commit
fb2595d2fb
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixes
|
||||
|
||||
* Do not attempt to end a span with if the ctx is undefined.
|
||||
|
||||
## 1.0.0-beta.7
|
||||
|
||||
### Changes
|
||||
|
|
|
@ -56,10 +56,15 @@ set_current_telemetry_span(TracerId, EventMetadata) ->
|
|||
|
||||
-spec end_telemetry_span(atom(), telemetry:event_metadata()) -> ok.
|
||||
end_telemetry_span(TracerId, EventMetadata) ->
|
||||
{ParentCtx, Ctx} = pop_ctx(TracerId, EventMetadata),
|
||||
otel_span:end_span(Ctx),
|
||||
Ctx = pop_ctx(TracerId, EventMetadata),
|
||||
case Ctx of
|
||||
{ParentCtx, SpanCtx} ->
|
||||
otel_span:end_span(SpanCtx),
|
||||
otel_tracer:set_current_span(ParentCtx),
|
||||
ok.
|
||||
ok;
|
||||
undefined ->
|
||||
ok
|
||||
end.
|
||||
|
||||
-spec store_ctx(ctx_set(), atom(), telemetry:event_metadata()) -> ok.
|
||||
store_ctx(SpanCtxSet, TracerId, EventMetadata) ->
|
||||
|
|
Loading…
Reference in New Issue