Skip to content

refactor: Use typed interfaces for generating EnvFilters from config - #33

Merged
RasmusRendal merged 1 commit into
mainfrom
RasmusRendal/refactor_envfilter
Sep 1, 2026
Merged

refactor: Use typed interfaces for generating EnvFilters from config#33
RasmusRendal merged 1 commit into
mainfrom
RasmusRendal/refactor_envfilter

Conversation

@RasmusRendal

@RasmusRendal RasmusRendal commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I think this is just nicer than returning a string that the consumer is
expected to parse.

I wish we could do this without any string parsing at all, but this
functionality is still missing.

This is arguably not a super important PR, but it's just something weird I spotted and wanted to fix.


Note

Low Risk
Internal refactor of filter construction with no change to telemetry export or security-sensitive paths; misconfiguration still surfaces as the same parse errors at init.

Overview
Refactors how tracing log levels from OpenTelemetry config become subscriber filters. ProviderConfig and StdoutLogsConfig no longer build a comma-separated filter string for callers to parse; get_filter now returns a Result<EnvFilter, ParseError> built via shared filter_from_config (general level, per-dependency overrides, main crate level).

In init_otel, stdout, OTLP logs, traces, and metrics layers call get_filter directly instead of EnvFilter::from_str, with parse failures still mapped through OtelInitError::EnvFilterError. Behavior should match the previous string format; the change is API shape and where parsing happens.

Reviewed by Cursor Bugbot for commit 93eac0f. Bugbot is set up for automated code reviews on this repo. Configure here.

@RasmusRendal
RasmusRendal requested a review from a team as a code owner June 17, 2026 16:20
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.53%. Comparing base (af0a8ba) to head (93eac0f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/config.rs 95.23% 1 Missing ⚠️
src/lib.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   75.83%   76.53%   +0.69%     
==========================================
  Files           5        5              
  Lines         269      277       +8     
==========================================
+ Hits          204      212       +8     
  Misses         65       65              
Files with missing lines Coverage Δ
src/config.rs 70.76% <95.23%> (+4.10%) ⬆️
src/lib.rs 88.29% <75.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af0a8ba...93eac0f. Read the comment docs.

I think this is just nicer than returning a string that the consumer is
expected to parse.

I wish we could do this without any string parsing at all, but this
functionality is still missing.
@RasmusRendal
RasmusRendal force-pushed the RasmusRendal/refactor_envfilter branch from c1d109a to 93eac0f Compare September 1, 2026 13:17

@mzaniolo mzaniolo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RasmusRendal
RasmusRendal merged commit 93eac0f into main Sep 1, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants