def Draw.span_context

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

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

1472# The context of a span ID generated from a source for an operation of
1473# `trace_id` with the sampled indication `sampled`, with the source's final
1474# state: the span ID's failure is the context's.
1475def Draw.span_context(-S: Type, +trace_id: TraceId, +sampled: Bool,
1476  done: S & Result<&2, &2, GenerationError, SpanId>) -> S & Result<&2, &2, GenerationError, LocalContext>:
1477  match done:
1478    case Tuple{state, Fail{error}}:
1479      (state, Fail{error})
1480    case Tuple{state, Done{span_id}}:
1481      (state, Done{Context.from_ids(trace_id, span_id, sampled)})

Uses (9)

Used by (1)