GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(logging): add ability to filter MDC labels by codyoss · Pull Request #6430 · googleapis/google-cloud-java

Conversation

@codyoss

@codyoss codyoss commented Oct 3, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Currently all MDC values are being written as labels in a LogEntry.
This is not desirable for everyone. By adding MDCEventEnhancer a user
now has the ability to easily filter which MDC entries get converted
into labels. To maintain backwards compatability the default
implementation is to write all entries as labels. If a user wants to
filter these, they just need to extend MDCEventEnhancer, override the
filtering, and add the new classpath to their logback.xml.

Fixes #6320

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 3, 2019
@codyoss
codyoss requested a review from a team October 3, 2019 15:31
chingor13
chingor13 reviewed Oct 3, 2019
View reviewed changes
Comment thread ...e-cloud-logging-logback/src/main/java/com/google/cloud/logging/logback/MDCEventEnhancer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...oud-logging-logback/src/test/java/com/google/cloud/logging/logback/MDCEventEnhancerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...oud-logging-logback/src/test/java/com/google/cloud/logging/logback/MDCEventEnhancerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

BenWhitehead
BenWhitehead reviewed Oct 3, 2019
View reviewed changes
Comment thread ...logging-logback/src/test/java/com/google/cloud/logging/logback/FilteredMVCEventEnhancer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...oud-logging-logback/src/test/java/com/google/cloud/logging/logback/MDCEventEnhancerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Oct 3, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #6430 into master will increase coverage by 0.26%.
The diff coverage is 90.9%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6430      +/-   ##
============================================
+ Coverage     46.35%   46.61%   +0.26%     
- Complexity    27995    28428     +433     
============================================
  Files          2613     2615       +2     
  Lines        288066   290015    +1949     
  Branches      33776    34179     +403     
============================================
+ Hits         133524   135200    +1676     
- Misses       144303   144502     +199     
- Partials      10239    10313      +74
Impacted Files Coverage Δ Complexity Δ
.../google/cloud/logging/logback/LoggingAppender.java 68.5% <100%> (+4.72%) 30 <3> (+2) ⬆️
...google/cloud/logging/logback/MDCEventEnhancer.java 83.33% <83.33%> (ø) 4 <4> (?)
.../com/google/cloud/bigquery/spi/v2/BigQueryRpc.java 71.42% <0%> (-9.53%) 0% <0%> (ø)
.../main/java/com/google/cloud/bigquery/BigQuery.java 72% <0%> (-5.56%) 0% <0%> (ø)
...google/cloud/bigquery/ExternalTableDefinition.java 56% <0%> (-2.7%) 18% <0%> (+2%)
...c/main/java/com/google/cloud/bigquery/Routine.java 80.59% <0%> (-1.76%) 18% <0%> (+7%)
...google/cloud/bigquery/StandardTableDefinition.java 90.69% <0%> (-1.49%) 15% <0%> (+1%)
.../java/com/google/cloud/bigquery/JobStatistics.java 92.54% <0%> (-1.38%) 29% <0%> (+16%)
...c/main/java/com/google/cloud/bigquery/Dataset.java 87.8% <0%> (-0.91%) 27% <0%> (+11%)
...main/java/com/google/cloud/firestore/Internal.java 0% <0%> (ø) 0% <0%> (ø) ⬇️
... and 19 more

Continue to review full report at Codecov.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chingor13
chingor13 requested changes Oct 3, 2019
View reviewed changes

@chingor13 chingor13 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I thought of a possible behavior breaking change: if a user already added an additional LoggingEventEnhancer, they would now lose the default label setting behavior.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codyoss

codyoss commented Oct 3, 2019

Copy link
Copy Markdown
Member Author

I thought of a possible behavior breaking change: if a user already added an additional LoggingEventEnhancer, they would now lose the default label setting behavior.

@chingor13 That is a good point. I did document this behavior on the class, but I suppose it is technically breaking. Short of exposing a custom hook that only relates specifically to MDCs I don't know a good way around this. I am open to suggestions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codyoss

codyoss commented Oct 3, 2019

Copy link
Copy Markdown
Member Author

What is our compatibility promise for artifacts labeled alpha? The version here is 0.111.1-alpha-SNAPSHOT.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chingor13

chingor13 commented Oct 3, 2019

Copy link
Copy Markdown
Contributor

We can break the behavior, but we definitely need to document it in the release notes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codyoss

codyoss commented Oct 3, 2019

Copy link
Copy Markdown
Member Author

I vote we take the breaking behavior and document it in the release notes. I think this implementation will offer more flexibility for the users as the library. Using LoggingEventEnhancer is not well documented in our examples today so I anticipate little breakage. The commit that introduced this MDC feature fbb4776 was not from too far back.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codyoss
codyoss requested a review from chingor13 October 3, 2019 20:45
elharo
elharo reviewed Oct 5, 2019
View reviewed changes
Comment thread ...oud-logging-logback/src/test/java/com/google/cloud/logging/logback/MDCEventEnhancerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@elharo

elharo commented Oct 5, 2019

Copy link
Copy Markdown
Contributor

The alpha status is wonky. Some artifacts are alpha, some are beta, and some are GA.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codyoss codyoss added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 8, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 8, 2019
codyoss added 5 commits October 17, 2019 13:51
@codyoss
fix(logging): add ability to filter MDC labels
7a817b1
Currently all MDC values are being written as labels in a LogEntry.
This is not desirable for everyone. By adding MDCEventEnhancer a user
now has the ability to easily filter which MDC entries get converted
into labels. To maintain backwards compatability the default
implementation is to write all entries as labels. If a user wants to
filter these, they just need to extend MDCEventEnhancer, override the
filtering, and add the new classpath to their logback.xml.

Fixes googleapis#6320
@codyoss
fix pr comments
0e09205
@codyoss
update copyright date
e448857
@codyoss
try to fix flackyness
153e9d2
@codyoss
remove mdc after use
dd26744
@codyoss
codyoss force-pushed the 6320-mdc branch from c8fc456 to dd26744 Compare October 17, 2019 19:51
@codyoss codyoss added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 14, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 14, 2019
@codyoss

codyoss commented Nov 14, 2019

Copy link
Copy Markdown
Member Author

@chingor13 Thoughts on this change?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chingor13
chingor13 approved these changes Nov 14, 2019
View reviewed changes
@codyoss

codyoss commented Nov 14, 2019

Copy link
Copy Markdown
Member Author

I am going to merge this. Once done I will cherry-pick these changes to goolgeapis/java-logging

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codyoss
codyoss merged commit 6c40d9b into googleapis:master Nov 14, 2019
@codyoss
codyoss deleted the 6320-mdc branch November 14, 2019 16:40
This was referenced Dec 4, 2019
Release google-cloud-java v0.120.0 #6986
Closed
Release google-cloud-java v0.120.0 #6988
Merged
@gendolf3d

gendolf3d commented Dec 26, 2019

Copy link
Copy Markdown

Hello! I'm just curious when it's being planned to merge fix to goolgeapis/java-logging project?
Thank you in advance!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chingor13 pushed a commit that referenced this pull request Jan 6, 2026
@codyoss
fix(logging): add ability to filter MDC labels (#6430)
46c421c
Currently all MDC values are being written as labels in a LogEntry.
This is not desirable for everyone. By adding MDCEventEnhancer a user
now has the ability to easily filter which MDC entries get converted
into labels. To maintain backwards compatability the default
implementation is to write all entries as labels. If a user wants to
filter these, they just need to extend MDCEventEnhancer, override the
filtering, and add the new classpath to their logback.xml.

Fixes #6320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chingor13 chingor13 chingor13 approved these changes
+2 more reviewers
@elharo elharo elharo left review comments
@BenWhitehead BenWhitehead BenWhitehead left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add possibility to control MDC values for adding to log message

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@codyoss @chingor13 @elharo @gendolf3d @BenWhitehead @googlebot @yoshi-kokoro
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.