Skip to main content

Module span

Module span 

Source
Expand description

Span helpers that pull connection / transaction / tenant / auth context out of the runtime thread-locals and attach them to a tracing::Span. Any log emitted while the span is entered picks up these fields automatically — the caller never has to pass conn_id / xid / tenant as parameters down through the call graph.

Usage:

use reddb::telemetry::span;
let _g = span::query_span(query).entered();
// subsequent tracing::info!/warn!/error! carry conn_id+xid+tenant

Functions§

connection_span
Span for a new wire/gRPC/HTTP connection. Call at accept time so every log inside that connection’s lifetime carries the remote peer and transport kind.
listener_span
Span for a listener bind — emits once at startup to mark the transport as ready.
query_span
Span wrapping a single execute_query call. Stamps the current connection id, transaction xid (0 when autocommit), tenant, and authenticated user so every downstream event (filter eval, scan, CDC emit, error) inherits correlation context.