Tapper Plug v0.2.0 Tapper.Plug.Trace
Intercept B3 headers and join a sampled trace, or run a sampler to determine whether to start a new trace.
If starting a trace, a ‘server receive’ (sr) annotation will be added to the root span, as well
as details about the request. A call-back is installed to finish the trace at the end of the request,
adding additional http.status_code and a ‘server send’ (ss) annotations.
plug Tapper.Plug.Trace, sampler: Tapper.Plug.Sampler.Simple, percent: 25
or e.g.
plug Tapper.Plug.Trace, sampler: fn(conn, _config) -> String.starts_with?(conn.request_path, ["/foo", "/bar"]) end
Options
sampler- name of module withsample?/2, or a fun with arity 2, to call to determine whether to sample a request; seeTapper.Plug.Sampler.debug- if set totrueall requests, joined or started, will be sampled.tapper- keyword list passed on toTapper.start/1orTapper.join/6(useful for testing/debugging, but use with caution since overrides options set by this module).
All options, including custom ones, will be passed to the sampler function (as a map), which means it can be configured here too.
Annotations
Tapper.Plug sets the following annotations:
sr- server receive on starting or joining a trace.ca- client address, fromconn.remote_ip.http.host,http.method,http.path- from correspondingPlug.Connfields.ss- server send when finishing a trace.
Summary
Functions
Callback implementation for Plug.call/2
Callback implementation for Plug.init/1
join a trace, running the sampler if ‘sampled’ not expicitly sent
start a trace, running the sampler
Functions
Callback implementation for Plug.call/2.
Callback implementation for Plug.init/1.
join a trace, running the sampler if ‘sampled’ not expicitly sent