moonzero · control plane v0.15.0 · 49 packages · 4 targets · Apache-2.0 docs / edge / tracing GitHub

14 / EDGE

tracing

A server span per request, joined to the trace the request arrived with and written to whatever sink the tracer was built over, plus the convenience x-trace-id header next to the standard traceparent.

fn trace_id_of(traceparent : String) -> String?

fnThe trace id carried by a W3C traceparent value, 00-<32 hex trace-id>-<16 hex span-id>-<2 hex flags>, or None when the value is not one.

fn tracing( tracer~ : @trace.Tracer = @telemetry.tracer(), now~ : () -> Int64 = @telemetry.trace_clock(), header~ : String = "x-trace-id", ignore_paths~ : Array[String] = []) -> Middleware

fnTracing middleware: join the trace the request arrived on, or start one, and open a server span that reaches sink when the request finishes. Paths in ignore_paths are left untraced. The span and the propagation headers come from moontel's ASGI layer; this adds the convenience x-trace-id response header on top. The defaults — a discarding sink, always sampling, ids from the platform entropy source — make tracing() a working layer with nothing configured; a service that wants spans kept hands in a tracer over its own sink.