Opencensus.SpanContext (opencensus_elixir v0.5.0)
Elixir convenience translation of :opencensus.span_ctx
.
Most likely to be of use while writing unit tests, or packages that deal with spans. Less likely to be of use while writing application code.
Link to this section Summary
Functions
Convert a span context.
Return the 16-digit hex representation of a span ID.
Return the 32-digit hex representation of a trace ID.
Link to this section Functions
Link to this function
from(record)
@spec from(:opencensus.span_ctx() | :undefined) :: %Opencensus.SpanContext{ span_id: term(), trace_id: term(), trace_options: term(), tracestate: term() }
Convert a span context.
iex> :opencensus.span_ctx()
:undefined
iex> :opencensus.span_ctx() |> Opencensus.SpanContext.from()
nil
iex> trace_id = 158162877550332985110351567058860353513
iex> span_id = 13736401818514315360
iex> span_ctx = {:span_ctx, trace_id, span_id, 1, :undefined}
iex> Opencensus.SpanContext.from(span_ctx)
%Opencensus.SpanContext{
span_id: 13736401818514315360,
trace_id: 158162877550332985110351567058860353513,
trace_options: 1,
tracestate: :undefined
}
Link to this function
hex_span_id(span_id)
Return the 16-digit hex representation of a span ID.
Link to this function
hex_trace_id(trace_id)
Return the 32-digit hex representation of a trace ID.