Tapper v0.6.0 Tapper.Tracer.Trace.Convert View Source

Converts Trace to Protocol spans.

Link to this section Summary

Functions

calculate span duration

convert an internal span to a protocol span, setting duration

convert an internal trace to a list of protocol spans

Link to this section Functions

Link to this function

span_duration(span, trace) View Source
span_duration(
  span :: Tapper.Tracer.Trace.SpanInfo.t(),
  trace :: Tapper.Tracer.Trace.t()
) :: nil | pos_integer()

calculate span duration.

Handles special cases of:

  • shared spans, for which we force a nil duration (http://zipkin.io/pages/instrumenting.html#timestamps-and-duration)
  • spans which were never formally closed, which get the trace's end_timestamp
  • calculated durations < 1 microsecond, which we round up to 1 microsecond
Link to this function

to_protocol_span(span, trace) View Source

convert an internal span to a protocol span, setting duration

Link to this function

to_protocol_spans(trace) View Source
to_protocol_spans(Tapper.Tracer.Trace.t()) :: [
  %Tapper.Protocol.Span{
    annotations: term(),
    binary_annotations: term(),
    debug: term(),
    duration: term(),
    id: term(),
    name: term(),
    parent_id: term(),
    timestamp: term(),
    trace_id: term()
  }
]

convert an internal trace to a list of protocol spans