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

fix: nested json with structured log handler #636

Merged
merged 9 commits into from
Sep 30, 2022
Merged

Conversation

daniel-sanche
Copy link
Contributor

Fixes #632

I found a formatting issue with instrumentation logs using the StructuredLogHandler. This came down to two root issues:

  • the entire diagnostic log was being sent as the payload, not just the intended payload data
  • there was a bug with nested json logs in the StructuredLogHandler. .rstrip("}") was stripping out all "}" characters at the end of the string-encoded JSON, not just the last one

This PR fixes both of these issues, and adds a number of additional unit tests testing against nested JSON and instrumentation functions

@daniel-sanche daniel-sanche requested review from a team as code owners September 29, 2022 18:07
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Sep 29, 2022
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/python-logging API. label Sep 29, 2022
@daniel-sanche daniel-sanche merged commit b840435 into main Sep 30, 2022
@daniel-sanche daniel-sanche deleted the fix-nested-json branch September 30, 2022 20:31
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/python-logging API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

instrumentation: investigate badly formatted instrumentation logs
2 participants