Tapper v0.2.0 Tapper.Tracer.Timeout

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.

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

Functions

all_finished?(spans)
all_finished?(spans :: Enumerable.t) :: boolean

Have all spans finished? expects an Enumerable of %Trace.SpanInfo{}; returns true for empty Enumerable.

child_spans(trace)
child_spans(Tapper.Tracer.Trace.t) :: Enumerable.t | []

return an Enumerable of child spans, i.e. spans minus the main span

latest_timeout(spans)
latest_timeout(spans :: Enumerable.t) ::
  Tapper.Timestamp.timestamp |
  false

Calculates the latest finished span timestamp; false if there are no finished spans.

timeout_trace(trace, timeout_timestamp)
timeout_trace(trace :: Tapper.Tracer.Trace.t, timeout_timestamp :: Tapper.Timestamp.timestamp) :: Tapper.Tracer.Trace.t

apply timeout logic