//! The seam between the tracing spans and a W3C trace context. //! //! Every function is a no-op in a build without the `otel` feature, so callers carry the context //! unconditionally: the command's root span is parented from the environment, a request received over //! MCP or the comms protocol parents the span that serves it, and a request forwarded to the daemon //! carries the current context. With the feature, [`crate::otel`] supplies the real implementation. /// The W3C `traceparent` the process was started under (`TRACEPARENT`), if it is well formed. pub fn traceparent_from_env() -> Option { #[cfg(feature = "otel")] { crate::otel::traceparent_from_env() } #[cfg(not(feature = "otel"))] { None } } /// Make `traceparent` (a W3C `traceparent` header value) the parent of `span`. Ignores a value that /// is not well formed. pub fn set_parent(span: &tracing::Span, traceparent: &str) { #[cfg(feature = "otel")] crate::otel::set_parent(span, traceparent); #[cfg(not(feature = "otel"))] let _ = (span, traceparent); } /// The W3C `traceparent` of the span current on this thread, if it belongs to a sampled trace. pub fn current_traceparent() -> Option { #[cfg(feature = "otel")] { crate::otel::current_traceparent() } #[cfg(not(feature = "otel"))] { None } }