Tapper v0.2.0 Tapper.Tracer.Server
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.
Summary
Functions
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
Functions
Handles time-out.
Invoked if ttl expires between messages: automatically ends trace, annotating any un-finished spans.
See also
Tapper.start/1
andTapper.join/6
- setting the TTL for a trace using thettl
option.Tapper.finish/2
andTapper.async/1
- declaring a trace or span asynchronous.Tapper.Tracer.Timeout
- timeout behaviour.
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 calledTapper.start/1
orTapper.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 byTapper.Tracer.annotation_delta/2
etc.type
(:client
or:server
) - determines whether the first annotation should becs
(:client
) orsr
(:server
).endpoint
(Tapper.Endpoint
) - sets the endpoint for the initialcr
orsr
annotation, defaults to one derived from Tapper configuration (seeTapper.Application
).remote
(Tapper.Endpoint
) - an endpoint to set as thesa
(:client) orca
(: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
.
prepare the SpanInfo of the initial span in this Tracer
Starts a Tracer, registering a name derived from the Tapper.Id
.
Arguments
config
- worker config fromTapper.Tracer.Supervisor
worker spec.trace_init
- trace parameters (trace_id, span_id, etc.)pid
- pid of process that calledTapper.start/1
orTapper.join/6
.timestamp
(Tapper.Timestamp.t
) - timestamp of trace receive/start event.opts
- options which were passed to start or join, seeTapper.Tracer.Server.init/1
.
NB called by Tapper.Tracer.Supervisor
when starting a trace with start_tracer/2
.
See also
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
.