def Context.extract

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

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

3027# Extract the trace context of a received message from its carrier, with
3028# `base` as the context to keep when the message has no usable traceparent
3029# (spec #1, user stories 14, 15, 16, 24 and 25):
3030#   - no traceparent field keeps the base, TraceParentAbsent{};
3031#   - more than one traceparent field, whatever the case of their names, is
3032#     refused, and so is a single value that TraceParent.read refuses; the
3033#     base is kept, TraceParentRejected{error};
3034#   - an accepted value gives the incoming context and replaces the base: its
3035#     tracestate fields, whatever the case of their names, are read in
3036#     arrival order as their comma-joined combination, within the tracestate
3037#     input budget; refused fields are discarded whole, keeping the
3038#     traceparent;
3039#   - without an accepted traceparent, tracestate fields are not read.
3040# Laws: extract_absent, extract_repeated, extract_refused, extract_read,
3041# state_independent and received_bounds.
3042def Context.extract(+limits: Limits, +carrier: List<&2, Header>, base: Maybe<&2, BaseContext>) -> Extraction:
3043  Extract.parents(limits, Carrier.values(carrier, Carrier.traceparent_name()),
3044    Carrier.values(carrier, Carrier.tracestate_name()), base)

Uses (10)

Used by (1)