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: Add support for library instrumentation #789

Merged
merged 5 commits into from Jun 28, 2022

Conversation

losalex
Copy link
Contributor

@losalex losalex commented Jun 27, 2022

This feature provides an ability to log extra entry with diagnostics structure which contains logging library information. Such entry is logged only once when first entry is written by a process using logging library.

Fixes #<788> ☕️

@losalex losalex added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jun 27, 2022
@losalex losalex requested a review from a team as a code owner June 27, 2022 20:56
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: logging Issues related to the googleapis/java-logging-logback API. labels Jun 27, 2022
@losalex losalex requested a review from a team as a code owner June 27, 2022 20:58
@losalex losalex added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 27, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 27, 2022
Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

The duplication of the instrumentation status flags raises concerns about possible duplicated flows. It also may lead to incorrect behavior in the future because the logic is maintained in multiple libraries. I would suggest to keep instrumentation logic in the core library and allow to the logback library to pass additional attributes instead.

@losalex
Copy link
Contributor Author

losalex commented Jun 28, 2022

The duplication of the instrumentation status flags raises concerns about possible duplicated flows. It also may lead to incorrect behavior in the future because the logic is maintained in multiple libraries. I would suggest to keep instrumentation logic in the core library and allow to the logback library to pass additional attributes instead.

As I mentioned earlier, I would like to prevent this flag to be manipulated externally and there is no good way to restrict access in Java to specific functionality to some packages only - please let me know if you think otherwise. I do believe maintaining a separate flag is not an issue - we do set instrumentation only on first write attempt and base library also inspects the payload. Actually, maintaining a separate flag provides an ability in base library to avoid log entries payload inspection once instrumentation is written, so we do save cycles.

Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

lgtm. we will need to add an integration test that validating sending a single instrumentation entry when the app uses both logback and JUL and/or explicit log writing.

@losalex
Copy link
Contributor Author

losalex commented Jun 28, 2022

lgtm. we will need to add an integration test that validating sending a single instrumentation entry when the app uses both logback and JUL and/or explicit log writing.

Yep, integration tests should be added - will open a work item to work on this.

@losalex losalex merged commit 3a08dac into main Jun 28, 2022
@losalex losalex deleted the losalex/feat-instrumentation branch June 28, 2022 21:45
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-logback API. priority: p2 Moderately-important priority. Fix may not be included in next release. size: m Pull request size is medium. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants