def LocalContext.flags

bend-trace-context@0.2.0.0 · trace_context.bend:673

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

673# The trace flags of the context as a number from 0 to 3: bit 0 is its sampled
674# indication and bit 1 its trace ID's randomness assertion. It is the flag
675# byte of the traceparent that the context emits, 00 to 03, so an exporter
676# that writes it, into OTLP's Span.flags field for example, agrees with what
677# the context propagates. The Booleans stay the canonical form. Law:
678# local_flags.
679def LocalContext.flags(context: LocalContext) -> U32:
680  match context:
681    case LocalContext{trace_id, span_id, sampled}:
682      Flags.known(sampled, TraceId.is_random(trace_id))

Uses (4)

Used by (0)

No other definition uses this definition.