def Draw.root_span_with

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

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

1495# The span ID of a root or a restart with the sampled indication `sampled`,
1496# from the source's next state, once its trace ID is generated: the trace
1497# ID's failure is the generation's, and otherwise the local context of the
1498# root's span plan (SpanPlan.root).
1499def Draw.root_span_with(~S: Type, ~read: S -> IO(S & Result<&1, &1, U32 & String, U32>), sampled: Bool,
1500  outcome: S & Result<&2, &2, GenerationError, TraceId>) -> IO(S & Result<&2, &2, GenerationError, LocalContext>):
1501  match outcome:
1502    case Tuple{state, Fail{error}}:
1503      IO.pure(S & Result<&2, &2, GenerationError, LocalContext>, (state, Fail{error}))
1504    case Tuple{state, Done{trace_id}}:
1505      SpanPlan.generate_with(~S, ~read, state, SpanPlan.root(trace_id, sampled))

Uses (13)

Used by (1)