def TracePlan.generate_with

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

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

1507# The local context of the new trace of a plan, from a caller's source: a
1508# trace ID that excludes the plan's (TraceId.generate_with), then, from the
1509# source's next state, the span ID of the root's span plan with the plan's
1510# sampled indication (Draw.root_span_with).
1511def TracePlan.generate_with(~S: Type, ~read: S -> IO(S & Result<&1, &1, U32 & String, U32>), source: S,
1512  plan: TracePlan) -> IO(S & Result<&2, &2, GenerationError, LocalContext>):
1513  match plan:
1514    case TracePlan{excluded, sampled}:
1515      IO.bind(S & Result<&2, &2, GenerationError, TraceId>, S & Result<&2, &2, GenerationError, LocalContext>,
1516        TraceId.generate_with(~S, ~read, source, excluded), outcome => Draw.root_span_with(~S, ~read, sampled, outcome))

Uses (12)

Used by (2)