Spindle_http.TraceSpans: what a request did, and how long each part of it took, recorded under the W3C trace Log already carries, so a server, the calls it makes and the statements it runs are one trace.
Nothing is recorded unless an exporter is given where the request begins, and the trace is kept: a trace begun here at the exporter's ratio, one joined from a caller as the caller's traceparent says. Everything else is one lookup that finds nothing to record.
A secret has no span. No header value, body, query string or statement parameter is ever an attribute, as none is ever a log field.
An attribute's value, as a log field's is (Log.value).
Which side of an exchange a span is: a request this server answered, a call it made -- to another server, or a statement to its database -- or work of its own.
Whether it went wrong: Unset unless it did, and Error naming how -- a raise's constructor, or a server's 5xx.
type span = {trace_id : string;thirty-two lowercase hex digits
*)span_id : string;sixteen
*)parent_id : string option;None for a trace's root
name : string;kind : kind;start : Ptime.t;by the wall clock
*)duration : Mtime.Span.t;on the monotonic clock, so a wall clock that jumps moves a span and never lengthens one
*)attributes : (string * value) list;status : status;}A span as it is recorded, once it has ended.
val exporter :
?ratio:float ->
clock:_ Eio.Time.clock ->
mono_clock:_ Eio.Time.Mono.t ->
(span -> unit) ->
exporterexporter ~clock ~mono_clock record: record is handed every span of a kept trace as it ends, on whichever fiber and domain ended it, so it is quick and synchronised -- a queue another fiber sends from, as Spindle_client.Otlp keeps -- and never waits, since a span whose fiber is being cancelled is ended there too. ratio (1.0) is the share of the traces begun here that are kept; a trace joined from a caller is kept exactly when the caller's is, so a trace is whole or absent.
span name f runs f as a span of its own, a child of the one the fiber is in -- the request's, or another span around it -- and records it when f returns or raises; a raise is its status, by constructor, and passes. A call made inside it, and a statement run, are its children.
Spindle.Trace.span "price the order" (fun () -> price order)kind is Internal unless given. Outside a kept trace it is f ().
What a server and a client record theirs with: the request's span is named once a route has answered it.
A span begun and not yet ended -- or, outside a kept trace, nothing, which everything below does nothing to.
span, handing f the span it records.
val current : unit -> recordingThe span the fiber is in: inside a request, that request's own until a span is begun inside it.
val rename : recording -> string -> unitval fail : recording -> string -> unitIts status Error, saying how.