Description
Feature Request
Crates
tracing
Motivation
Currently, the callsites constructed by the enabled!
macro count as neither spans nor events, so that they are not effected by filtering configurations that specifically enable spans or specifically enable events. This reduces false positives. In some situations, though, a user may wish to check specifically if a span would be enabled, or if an event would be enabled. See #1821 (comment) for details.
Proposal
PR #1891 makes a change in tracing-core
to allow constructing callsite kinds that are spans/events and hints at the same time. This can be used to add support for checking if specific kinds of callsite would be enabled.
We should add new span_enabled!
and event_enabled!
macros that use this API. These macros would behave like enabled!
but would create SPAN | HINT
and EVENT | HINT
callsites, respectively.
Alternatives
Alternatively, we could add this to the existing enabled!
macro, like enabled!(span, ...)
and enabled!(event, ...)
. IMO, just making separate macros is a bit more obvious from a UX perspective, but I'm open to being convinced otherwise.