Skip to content

Allow excluding Logback MDC attributes from being copied#14926

Closed
cfredri4 wants to merge 3 commits into
open-telemetry:mainfrom
cfredri4:excluding-logback-mdc-attributes
Closed

Allow excluding Logback MDC attributes from being copied#14926
cfredri4 wants to merge 3 commits into
open-telemetry:mainfrom
cfredri4:excluding-logback-mdc-attributes

Conversation

@cfredri4

@cfredri4 cfredri4 commented Oct 8, 2025

Copy link
Copy Markdown

Closes #14925

This change adds a setting to the Logback appender to exclude MDC attributes when all attributes are being copied.
@cfredri4 cfredri4 requested a review from a team as a code owner October 8, 2025 20:13
@otelbot-java-instrumentation

Copy link
Copy Markdown
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@trask

trask commented Oct 8, 2025

Copy link
Copy Markdown
Member

my initial thought is that this should be the default behavior (for both javaagent and library instrumentation), and you should have to opt in somehow if you want the duplication (e.g. #14897 / #14904)

@cfredri4

cfredri4 commented Oct 8, 2025

Copy link
Copy Markdown
Author

@trask additional context: I use Micrometer for tracing which adds the MDC values traceId, spanId (i.e. different from trace_id and span_id exported by the appender).

@laurit

laurit commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

@cfredri4 if your intention is to get this merged then you firstly need to fix the compilation errors in your PR. Secondly you'll have to add tests. Ideally this functionality should be present for both the library and javaagent instrumentation in all relevant logging instrumentations.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Oct 13, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been labeled as stale due to lack of activity and needing author feedback. It will be automatically closed if there is no further activity over the next 7 days.

@github-actions github-actions Bot added the stale label Oct 20, 2025
@cfredri4

Copy link
Copy Markdown
Author

@laurit I'll take a look at the other logging instrumentations, and tests.

Ideally this functionality should be present for both the library and javaagent instrumentation

Can you elaborate on what this means specifically?

@github-actions github-actions Bot removed stale needs author feedback Waiting for additional feedback from the author labels Oct 26, 2025
@laurit

laurit commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

Can you elaborate on what this means specifically?

Besides logback library instrumentation (by library instrumentation we mean standalone instrumetnation that can be used without the agent) capturing mdc attributes is also implemented in the logback javaagent instrumentation (uses the library instrumentation, but is configured differently), log4j 1&2 and jboss logmanager. Search for capture-mdc-attribute. Ideally there should be feature parity between these instrumentations.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 14 days.

@github-actions github-actions Bot added the stale label Jan 24, 2026
@cfredri4

cfredri4 commented Feb 5, 2026

Copy link
Copy Markdown
Author

Still working on this.

@jaydeluca jaydeluca removed the stale label Feb 5, 2026
@trask

trask commented May 3, 2026

Copy link
Copy Markdown
Member

Just doing some housekeeping, marking this as draft, just switch it back to "ready for review" once you're ready

@trask trask marked this pull request as draft May 3, 2026 15:19
@philsttr

philsttr commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

I just found this PR after filing a similar PR (#18912), which covers all logging instrumentations.

@cfredri4

cfredri4 commented Jun 6, 2026

Copy link
Copy Markdown
Author

Closed in favor of #18912

@cfredri4 cfredri4 closed this Jun 6, 2026
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.

Allow excluding Logback MDC attributes from being copied

5 participants