Add a minimal tracing-subscriber configuration #104
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.
While debugging why running azure-init in a local VM hung forever, I added some minimal log configuration to figure out what was happening. Note that this only logs to stderr and is only configurable via the
AZURE_INIT_LOGenvironment variable. The most minimal usage is like this:AZURE_INIT_LOG=info azure-init
Which emits anything at info level or high. Refer to the tracing-subscriber documentation[0] for more complex examples.
Logs look like this:
It's configured to emit logs when a span opens and closes in addition to any explicit
tracing::{debug,info,warn,error}!call, although we can disable that if folks don't like it. I also added spans to most of the library functions. All the spans are at the defaultINFOlevel and the default log configuration is to write logs for warning or higher, so running this without specifyingAZURE_INIT_LOGresults in the same behavior as before.This doesn't try to integrate with OpenTelemetry or pipe logs to KVP; those are being wired up in #83.
[0] https://docs.rs/tracing-subscriber/0.3.18/tracing_subscriber/filter/struct.EnvFilter.html#directives