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
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Do not attempt to end a span with if the ctx is undefined.
|
||||||
|
|
||||||
## 1.0.0-beta.7
|
## 1.0.0-beta.7
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
|
@ -56,10 +56,15 @@ set_current_telemetry_span(TracerId, EventMetadata) ->
|
||||||
|
|
||||||
-spec end_telemetry_span(atom(), telemetry:event_metadata()) -> ok.
|
-spec end_telemetry_span(atom(), telemetry:event_metadata()) -> ok.
|
||||||
end_telemetry_span(TracerId, EventMetadata) ->
|
end_telemetry_span(TracerId, EventMetadata) ->
|
||||||
{ParentCtx, Ctx} = pop_ctx(TracerId, EventMetadata),
|
Ctx = pop_ctx(TracerId, EventMetadata),
|
||||||
otel_span:end_span(Ctx),
|
case Ctx of
|
||||||
otel_tracer:set_current_span(ParentCtx),
|
{ParentCtx, SpanCtx} ->
|
||||||
ok.
|
otel_span:end_span(SpanCtx),
|
||||||
|
otel_tracer:set_current_span(ParentCtx),
|
||||||
|
ok;
|
||||||
|
undefined ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
-spec store_ctx(ctx_set(), atom(), telemetry:event_metadata()) -> ok.
|
-spec store_ctx(ctx_set(), atom(), telemetry:event_metadata()) -> ok.
|
||||||
store_ctx(SpanCtxSet, TracerId, EventMetadata) ->
|
store_ctx(SpanCtxSet, TracerId, EventMetadata) ->
|
||||||
|
|
Loading…
Reference in New Issue