Tapper Plug v0.5.0 Tapper.Plug.HeaderPropagation.B3Multi View Source

Supports encoding and decoding a Tapper trace context in the original B3 propagation format, typically represented in HTTP(S) as a set of x-b3-* headers.

Link to this section Summary

Functions

decode x-b3-* headers to a tagged trace context

Encode a Tapper id into a list of B3 propagation headers

Link to this section Functions

Link to this function decode(headers) View Source
decode(headers :: %{required(String.t()) => String.t()}) :: tuple()

decode x-b3-* headers to a tagged trace context.

Link to this function encode(idOrDestructed) View Source
encode(Tapper.Id.t() | tuple()) :: [{binary(), binary()}]

Encode a Tapper id into a list of B3 propagation headers.

i.e. a list of 2-tuples like {"x-b3-traceid", "463ac35c9f6413ad48485a3953bb6124"}.

This encodes headers in the original B3 multi-header format, to use the B3 Single format, use Tapper.Plug.HeaderPropagation.B3Single.encode_value/1.

Example

  id = Tapper.start_span(id, name: "foo")
...
  headers = Tapper.Plug.HeaderPropagation.B3Multi.encode(id)
  response = HTTPoison.get("http://some.service.com/some/api", headers)