feat: stdout logging#2288
Draft
kkovaacs wants to merge 11 commits into
Draft
Conversation
Instead of using RUST_LOG to control _both_ telemetry export and what is printed to stdout this change splits configuration into two environment variables (both with reasonable defaults): MIDEN_STDOUT_FILTER is used to set the EnvFilter filter expression for what is printed to stdout. If not specified, it falls back to using RUST_LOG, then a reasonable default for output that is usable for a local development setup. (More on that later.) MIDEN_OTEL_FILTER is the name of the environmet variable controlling what gets exported via OpenTelemetry. This also falls back to using RUST_LOG if not configured explicitly and has the same default value we've been using previously. Configuration for the stdout layer has also changed: no file names / line numbers are printed, no log lines for closing spans. The idea is that we'll add _explicit_ debug!() events with a specific target (prefixed with `user::`) so that it's easy to filter for these explicit events. These events should cover all state changes relevant during development, all gRPC queries received, etc.
Only events we explicitly want to show up on stdout by default should be emitted on DEBUG level (or above). Also adds some spans so that proper context is available when applying the block.
Add per-handler spans with all relevant information so that the events emitted from handlers have proper context. Clean up emitted events so that only events we'd like to print to stdout with the default config should be using DEBUG (or above).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This separates user-visible stdout logging from production telemetry by giving stdout its own filter and moving local-development messages onto
user::log targets.Changes
MIDEN_STDOUT_FILTER, falling back toRUST_LOG, theninfo,user=debugMIDEN_OTEL_FILTER, falling back toRUST_LOG, theninfo,axum::rejection=traceuser::...log targets for node, remote prover, validator, block producer, RPC, and store components.debug!events onuser::targets.trace!.ret(level = "debug")instrumented return logs from store queries.Notes
The default stdout behavior now shows normal
infologs plus user-targeteddebugevents, without raising debug verbosity for production telemetry. OpenTelemetry keeps its own independent filter so span export behavior can be tuned separately from local console output.Changelog