tracing
tracing copied to clipboard
feature request: #[tracing::instrument(span = &self.span)]
Feature Request
Allow the span to be set to self.span
, not a new span with it as a parent.
Crates
tracing
Motivation
No value in a nested span.
Proposal
Eliza — Today at 1:03 PM personally, i would probably implement that using a new attribute, rather than adding it to #[instrument] --- #[instrument] already does a lot of stuff, and if you added something like this, a lot of the existing instrument arguments wouldn't make sense when the span already exists...
Personally, making span
and new-span-related parameters (name
, level
...) mutually exclusive seems pretty clear to me as well, especially if the two modes ("use existing span" vs create new) are cleanly explained at the top of the docs.
Alternatives
A one-line wrapper function that does original().instrument(self.span).await
.