Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
fix: use correct spec for oc_span:finish_span/2
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth committed May 2, 2019
1 parent 10fa099 commit 67221ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/oc_span.erl
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
%% Finish a span, setting the end_time and sending to the reporter.
%% @end
%%--------------------------------------------------------------------
-spec finish_span(opencensus:span_ctx(), maybe(opencensus:span())) -> true.
-spec finish_span(opencensus:span_ctx(), maybe(opencensus:span())) -> ok | {error, term()}.
finish_span(#span_ctx{tracestate=Tracestate}, Span=#span{}) ->
EndTime = wts:timestamp(),
%% update tracestate to what the context has when finished
Span1 = Span#span{end_time=EndTime,
tracestate=Tracestate},
oc_trace_reporter:store_span(Span1);
finish_span(_, _) ->
true.
ok.

%%--------------------------------------------------------------------
%% @doc
Expand Down
4 changes: 2 additions & 2 deletions test/oc_span_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ modifications(_Config) ->
?assertEqual({error, no_report_buffer}, oc_span:finish_span(#span_ctx{}, Span6)),

{ok, _} = application:ensure_all_started(opencensus),
?assertEqual(true, oc_span:finish_span(#span_ctx{}, Span6)),
?assertEqual(true, oc_span:finish_span(#span_ctx{}, undefined)),
?assertEqual(ok, oc_span:finish_span(#span_ctx{}, Span6)),
?assertEqual(ok, oc_span:finish_span(#span_ctx{}, undefined)),

application:stop(opencensus).

0 comments on commit 67221ee

Please sign in to comment.