Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: auto-populate metadata of log entries at write() #803

Merged
merged 4 commits into from
Dec 22, 2021

Conversation

minherz
Copy link
Contributor

@minherz minherz commented Dec 21, 2021

Implements auto-population of metadata (resource info, http requests, trace and span ids, source location).
Respects auto-population LoggingOptions configuration and WriteOption flag.

change visibility of constants in LoggingImpl and MonitoredResourceUtil to use in tests.
resolve warning in BaseSystemTest by removing unused var.
@minherz minherz requested a review from losalex December 21, 2021 14:26
@minherz minherz self-assigned this Dec 21, 2021
@minherz minherz requested review from a team as code owners December 21, 2021 14:26
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: logging Issues related to the googleapis/java-logging API. labels Dec 21, 2021
Copy link
Contributor

@losalex losalex left a comment

Choose a reason for hiding this comment

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

Overall looks good, just asking you to shorten a write function

builder.setTrace(context.getTraceId());
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This function becomes too bulky and hard to follow - perhaps you can export the part dealing with context into private function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will look into it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks

Copy link
Contributor Author

@minherz minherz Dec 22, 2021

Choose a reason for hiding this comment

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

the trace metadata formatting is moved to a stand-alone method

move the trace metadata formatting to a standalone method.
add comments.
add unit tests to validate resource metadata prioritizing when passed as WriteOption.
fix Context.Builder.setRequest() when passing null.
@minherz minherz merged commit cfa3db5 into minherz/structured_logging Dec 22, 2021
@minherz minherz deleted the minherz/691 branch December 22, 2021 13:26
minherz added a commit that referenced this pull request Dec 30, 2021
Populate empty metadata fields of each log entry on write().
minherz added a commit that referenced this pull request Jan 4, 2022
Populate empty metadata fields of each log entry on write().
minherz added a commit that referenced this pull request Jan 5, 2022
Populate empty metadata fields of each log entry on write().
minherz added a commit that referenced this pull request Jan 7, 2022
…ogs redirection to stdout in JUL handler (#808)

Aggregates the following work:
- #821
- #812
- #807
- #803
- #798

Fixes #689, #691, #799 and #800

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants