Spindle_http.LogWhat a line is made of, on either end of a call: the framework's source, a line's structured fields, and the request a fiber runs for.
The reporter that writes a line is Spindle.Log's; this is what a server and a client both write lines with, so that a call made while a request is answered logs under that request.
spindle-http: the framework's own lines -- the access log, a refusal's detail, a connection that failed.
val pp_value : Stdlib.Format.formatter -> value -> unitval fields : (string * value) list Logs.Tag.defStructured fields on a line. A shipper filters on a field; it cannot filter on something interpolated into the message.
val tags : (string * value) list -> Logs.Tag.set~tags:(Spindle.Log.tags [ ("status", `Int 202) ])
val raised : exn -> Stdlib.Printexc.raw_backtrace -> (string * value) listA caught exception as fields: error.kind, its constructor, and error.stack, left out when nothing was recorded -- the names an error tracker groups a failure by. Never its message, which is whatever its raiser wrote, a credential or a card number among it. Take the backtrace first thing in the handler, Printexc.get_raw_backtrace (), since the next raise on the domain replaces it.
Its id, and where it stands in a W3C trace: a trace id every server the request reaches shares, and a span id of this server's own. Every line logged for it carries all three, and a call made for it carries the trace onward in traceparent.
val with_request_id :
?traceparent:string ->
?tracestate:string ->
?trace:Trace.exporter ->
string ->
(unit -> 'a) ->
'aRuns f as part of that request: every line it and the fibers it forks log carries the id. traceparent is the value of the header a caller sent: the request joins that trace as a span of its own. Without one, or with one that is not a W3C traceparent, it begins a trace. tracestate is the caller's too, passed on to every call as it came, where it came with a trace and is no longer than the 512 characters W3C Trace Context asks be passed on.
With trace, the request's span is recorded, a Trace.kind.Server span named request until Trace.rename names it, when the trace is kept (Trace.exporter).
The traceparent a call made for the current request sends: its trace, and the span the call is -- recorded, inside a Trace.span of the call's own, or a fresh id nothing records. None outside a request.
The tracestate a call sends beside it: the caller's, where it sent one.
carry f is f, taking the current request's id, trace and span with it to whichever fiber or thread runs it -- a fiber on another domain, or a call handed to a systhread, where a fiber's bindings cannot be read. Capture where the request is, run where the work is.