class OpenTelemetry::Trace::SpanContext

extracted from the wire.
{TraceFlags}, a system-specific tracestate, and a boolean indicating that the SpanContext was
It contains the identifiers (a trace ID and span ID) associated with the {Span}, a set of
A SpanContext contains the state that must propagate to child {Span}s and across process boundaries.

def hex_span_id

Returns:
  • (String) - A 16-hex-character lowercase string.
def hex_span_id
  @span_id.unpack1('H*')
end

def hex_trace_id

Returns:
  • (String) - A 32-hex-character lowercase string.
def hex_trace_id
  @trace_id.unpack1('H*')
end

def initialize(

Returns:
  • (SpanContext) -

Parameters:
  • remote (optional Boolean) -- Whether the {SpanContext} was extracted from the wire.
  • tracestate (optional Tracestate) -- The tracestate associated with a {Span}. May be nil.
  • trace_flags (optional TraceFlags) -- The trace flags associated with a {Span}.
  • span_id (optional String) -- The span ID associated with a {Span}.
  • trace_id (optional String) -- The trace ID associated with a {Span}.
def initialize(
  trace_id: Trace.generate_trace_id,
  span_id: Trace.generate_span_id,
  trace_flags: TraceFlags::DEFAULT,
  tracestate: Tracestate::DEFAULT,
  remote: false
)
  @trace_id = trace_id
  @span_id = span_id
  @trace_flags = trace_flags
  @tracestate = tracestate
  @remote = remote
end

def remote?

Returns:
  • (Boolean) -
def remote?
  @remote
end

def valid?

Returns:
  • (Boolean) -
def valid?
  @trace_id != INVALID_TRACE_ID && @span_id != INVALID_SPAN_ID
end