Add with_tracing_filter for custom/reloadable tracing filters#122
Closed
Add with_tracing_filter for custom/reloadable tracing filters#122
Conversation
Allow consumers to provide their own tracing filter (e.g. a `reload::Layer<EnvFilter>`) instead of the default `EnvFilter` that Logfire constructs. This enables dynamic filter reloading at runtime without requiring `local()` mode or manual subscriber composition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
Closing this one off for now, it looks like this probably won't work for tracing & needs a bit of a refactor |
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
LogfireConfigBuilder::with_tracing_filter()method that accepts anyF: Filter<Registry>, allowing consumers to replace the defaultEnvFilterwith a custom filter (e.g.reload::Layer<EnvFilter>for dynamic reloading)LogfireTracingLayer::newto acceptArc<dyn Filter<S>>instead ofArc<EnvFilter>(internal API only)local()mode required — the custom filter integrates into the normalfinish()flow, so the global subscriber, log bridge, console output, and meter provider all work as beforeTest plan
test_with_tracing_filter_custom_filter— verifies a staticLevelFilter::WARNreplaces the default, filtering out lower-level eventstest_with_tracing_filter_reload— verifies areload::Layer<EnvFilter>can dynamically switch INFO→DEBUG→INFO, with events correctly filtered at each phase🤖 Generated with Claude Code