log: make span enter/exit targets always TRACE #833
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently,
tracing
'slog
feature emits log records for creating,entering, exiting, and dropping a
Span
at thelog
equivalent of thatspan's
tracing
level. If the span has any fields, the span creationlogs are sent to the same target that the span would have, since the
fields provide high-value information that users enabling that target
will probably want to see. However, the other events for entering,
exiting, and dropping a span do not include fields, and are much more
verbose, so they are sent to a special
tracing::span
target. Thisallows them to be filtered independently, and only enabled when needed.
However, some
log
users have noted that when using blanketlog
filters, like setting the level to
info
globally, the more verboseactivity logs will still be enabled for spans whose level matches. This
can be annoying.
Solution
Therefore, this branch changes the span activity and lifecycle logs to
always have the
Trace
log
level, even when the span that generatedthem has a less-verbose level. When fields are recorded, the emitted log
records are sent to the span's target instead, since users probably want
this information if they have enabled the span's level for its target.
Additionally, I've added a sub-target of
tracing::span
for theenter/exit logs in particular (
tracing::span::active
). This allowsthem to be filtered independently of the less frequent creation/drop
logs.
Signed-off-by: Eliza Weisman eliza@buoyant.io