Tapper v0.6.2 Tapper.Tracer.Timeout View Source
Clean up a trace after a time-out.
Synchronous Traces
If a trace which has not been marked as async
times out, this is an error.
The main span of trace will be marked with a :timeout
annotation,
as will any spans which have not been finished (end_timestamp
set).
The end_timestamp
of all unfinished spans, and the main span (which is
never finished until Tapper.finish/2
is called) will gain the timestamp
of the point where the timeout occurred.
Asynchronous Traces
If a trace which has been marked as async
times out, this is normal, so
long as all spans within the trace (except the main span), have been
finished.
If all spans are finished, the end_timestamp
of the main span will be
set to the lastest end_timestamp
of all its child spans.
If some spans are unfinished, behaviour is the same as for the non-async case.
If an async trace has no child spans, we'll pick up the trace's last_activity
time,
which may, or may not, be accurate. It's kind of an edge case that the main span is
async without any child spans, if intended, then last_activity
is probably going
to be pretty good, since it will the the time of the last annotation, e.g. an ss
,
or failing that, when finish
was called.
Link to this section Summary
Functions
Have all spans finished? expects an Enumerable of %Trace.SpanInfo{}
; returns true for empty Enumerable.
return an Enumerable of child spans, i.e. spans minus the main span
Calculates the latest finished span timestamp; false
if there are no finished spans.
apply timeout logic
Link to this section Functions
Specs
all_finished?(spans :: Enumerable.t()) :: boolean()
Have all spans finished? expects an Enumerable of %Trace.SpanInfo{}
; returns true for empty Enumerable.
Specs
child_spans(Tapper.Tracer.Trace.t()) :: Enumerable.t() | []
return an Enumerable of child spans, i.e. spans minus the main span
Specs
latest_timestamp(spans :: Enumerable.t()) :: Tapper.Timestamp.t() | false
Calculates the latest finished span timestamp; false
if there are no finished spans.
Specs
timeout_trace( trace :: Tapper.Tracer.Trace.t(), timeout_timestamp :: Tapper.Timestamp.t() ) :: Tapper.Tracer.Trace.t()
apply timeout logic