#[span]Expand description
Instrument a method as a telemetry operation span in libxmtp’s single
canonical, OTEL-safe form: #[tracing::instrument(err, skip_all, fields(operation = "<prefix>.<fn_name>", sentry.op = "<prefix>", sentry.name = "<prefix>.<fn_name>"))].
err records span status=error on an Err return; skip_all keeps every
argument off the span so a per-call id can never leak in and explode
trace-attribute cardinality. operation is the single dimension the
Collector’s span_metrics connector buckets on. Making this the only
writable form guarantees those invariants at compile time — no runtime test.
sentry.op/sentry.name are static vendor hints (same pattern as otel.*)
consumed by sentry-tracing; without them every Sentry span arrives as
op = “default”.
This is the escape hatch for a namespace without a dedicated attribute;
prefer [rpc_span] / [db_span] / [mls_span] where they apply.
#[xmtp_macro::span(prefix = "stream")]
pub async fn subscribe(&self, ..) -> Result<..> { .. }
// → operation = "stream.subscribe", sentry.op = "stream",
// sentry.name = "stream.subscribe"