You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no way to guarantee that a particular span is enabled. We'd like to have the ability to force-enable the Span, regardless of the current log level.
I want to:
a) use tracing::spans fields as labels at metrics crate, see metrics-rs/metrics#87;
b) be able to test this integration.
For both use cases, it'd be pretty good to have the ability to create a span even when the env filter is set to off.
In our test code, when log level is set to off (which is the default for tests), the Span is always disabled:
#[test]fntest_labels_injection(){trace_init();// inits the tracing in the test environment, defaults to `off`let span = span!(Level::ERROR, "my span", component_name = "foobar");if span.is_disabled(){panic!("span is disabled");}// ...}
Alter the span! macro in such a way that it's possible to force the actual span being created, instead of it being Span::none().
Alternatives
There is a potential way to create such Span manually, by borrowing Callsites and doing other very implementation-specific tricks, but it's not a maintainable solution.
The text was updated successfully, but these errors were encountered:
I imagine this as something that goes entirely around the level configurations of any kind. Performance hit or not, this is some functionality that has to be on unconditionally. I think this is the whole point.
Feature Request
There's no way to guarantee that a particular span is enabled. We'd like to have the ability to force-enable the
Span
, regardless of the current log level.Crates
Motivation
I want to:
a) use
tracing::span
s fields as labels atmetrics
crate, see metrics-rs/metrics#87;b) be able to test this integration.
For both use cases, it'd be pretty good to have the ability to create a span even when the env filter is set to
off
.In our test code, when log level is set to
off
(which is the default for tests), theSpan
is always disabled:More info here: vectordotdev/vector#3888
Proposal
Alter the
span!
macro in such a way that it's possible to force the actual span being created, instead of it beingSpan::none()
.Alternatives
There is a potential way to create such
Span
manually, by borrowingCallsite
s and doing other very implementation-specific tricks, but it's not a maintainable solution.The text was updated successfully, but these errors were encountered: