Tapper v0.3.1 Tapper.Tracer.Server View Source

The Trace server.

There is one server per trace, which persists until the trace is finished, at which point it sends its spans to a reporter.

Link to this section Summary

Functions

finishes the trace asynchronously: sets the async flag & annotation on the trace, and defers to the timeout mechanism to wrap up the asynchronous spans

finishes the trace: sets the trace’s end timestamp, calls the reporter and exits the tracer

via Tapper.Tracer.update/3

Handles time-out

Initializes the Tracer’s state

prepare the SpanInfo of the initial span in this Tracer

convert trace to protocol spans, and invoke reporter module or function

Starts a Tracer, registering a name derived from the Tapper.Id

update a span (identified by span id) in a trace with an updater function, taking care of case where span does not exist

locate the server via the Tapper.Id

Link to this section Functions

Link to this function apply_update(value, trace, span_id, timestamp, default_endpoint) View Source
Link to this function apply_updates(trace, deltas, span_id, timestamp, endpoint) View Source
Link to this function finish_async(trace, timestamp) View Source

finishes the trace asynchronously: sets the async flag & annotation on the trace, and defers to the timeout mechanism to wrap up the asynchronous spans.

Link to this function finish_sync(trace, timestamp) View Source

finishes the trace: sets the trace’s end timestamp, calls the reporter and exits the tracer.

via Tapper.Tracer.update/3

Handles time-out.

Invoked if ttl expires between messages: automatically ends trace, annotating any un-finished spans.

See also

Initializes the Tracer’s state.

Arguments (as list)

  • config - worker config from Tapper.Tracer.Supervisor’s worker spec.
  • trace_init - trace parameters i.e. {trace_id, span_id, parent_span_id, sample, debug}
  • pid - pid of process that called Tapper.start/1 or Tapper.join/6.
  • timestamp (Tapper.Timestamp.t) - timestamp of trace receive/start event.
  • opts - options passed to start or join, see below.

Options

  • name (String) - name of the span.
  • annotations - a list of annotations, specified by Tapper.Tracer.annotation_delta/2 etc.
  • type (:client or :server) - determines whether the first annotation should be cs (:client) or sr (:server).
  • endpoint (Tapper.Endpoint) - sets the endpoint for the initial cr or sr annotation, defaults to one derived from Tapper configuration (see Tapper.Application).
  • remote (Tapper.Endpoint) - an endpoint to set as the sa (:client) or ca (:server) binary annotation.
  • ttl (integer, ms) - set the no-activity time-out for this trace in milliseconds; defaults to 30,000 ms.
  • reporter (module atom or function) - override the configured reporter for this trace; useful for testing.

NB passed the list of arguments supplied by Tapper.Tracer.Server.start_link/5 via Tapper.Tracer.Supervisor.start_tracer/3.

Link to this function initial_span_info(span_id, parent_id, timestamp, endpoint, opts) View Source

prepare the SpanInfo of the initial span in this Tracer

convert trace to protocol spans, and invoke reporter module or function.

Link to this function start_link(config, arg, pid, timestamp, opts) View Source

Starts a Tracer, registering a name derived from the Tapper.Id.

Arguments

NB called by Tapper.Tracer.Supervisor when starting a trace with start_tracer/2.

See also

Link to this function update_span(trace, span_id, span_updater) View Source
update_span(Tapper.Tracer.Trace.t, Tapper.SpanId.t, (Tapper.Tracer.Trace.SpanInfo.t -> Tapper.Tracer.Trace.SpanInfo.t)) :: Tapper.Tracer.Trace.t

update a span (identified by span id) in a trace with an updater function, taking care of case where span does not exist.

locate the server via the Tapper.Id.