def SpanId.generate_with

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

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

1245# A span ID alone, from a caller's source, as an OpenTelemetry SDK generates
1246# one once its sampler has decided. The source's shape is that of
1247# TraceId.generate_with. It reads two words per candidate, most significant
1248# first, for at most eight candidates, so at most 16 words; rejects all-zero
1249# candidates and `excluded`, when there is one, such as the span ID of a
1250# child's parent; and fails with SourceFailure or ExhaustedSpanId.
1251# Laws: span_id_tape, span_id_failure, span_id_candidate, span_id_ends,
1252# span_id_exhaustion and generated_span_id.
1253def SpanId.generate_with(~S: Type, ~read: S -> IO(S & Result<&1, &1, U32 & String, U32>), source: S,
1254  excluded: Maybe<&2, SpanId>) -> IO(S & Result<&2, &2, GenerationError, SpanId>):
1255  +start = SpanDraw.start(excluded)
1256  Drive.finished(~SpanStep, ~SpanId, ~SpanDraw.result, ~S, Drive.read(~SpanStep, ~SpanDraw, ~SpanStep.waiting,
1257    ~SpanDraw.next, ~S, ~read, 16n, (source, (start, SpanStep.waiting(start)))))

Uses (17)

Used by (2)