Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenTelemetry.Tracer.end_span return type spec #796

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RudolfMan
Copy link

Hi there!

Based on the specs of otel_span:end_span/0,1 this Tracer.end_span/0,1 is supposed to always return span context (:undefined is not an option for the return)

See here:

-spec end_span(SpanCtx) -> SpanCtx when
SpanCtx :: opentelemetry:span_ctx().
end_span(SpanCtx=#span_ctx{span_sdk={Module, _}}) when ?is_recording(SpanCtx) ->
_ = Module:end_span(SpanCtx, undefined),
SpanCtx#span_ctx{is_recording=false};
end_span(SpanCtx) ->
SpanCtx.
%% @doc Ends the given span context with the given timestamp.
%%
%% If `SpanCtx' is not recording, this function doesn't do anything.
%% If `Timestamp' is `undefined', this is equivalent to {@link end_span/1}.
%% Returns the updated span context.
-spec end_span(SpanCtx, Timestamp) -> SpanCtx when
SpanCtx :: opentelemetry:span_ctx(),
Timestamp :: integer() | undefined.

@tsloughter
Copy link
Member

I believe the otel_tracer.erl may be the incorrect one as SpanCtx could be undefined. Not positive yet, but that is my guess here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants