Skip to content

[Logging] Truncate extras when dumped as a string in labels#4852

Merged
ViniciustCosta merged 1 commit into
masterfrom
fix/truncate_log_extras_dump
Jun 30, 2025
Merged

[Logging] Truncate extras when dumped as a string in labels#4852
ViniciustCosta merged 1 commit into
masterfrom
fix/truncate_log_extras_dump

Conversation

@ViniciustCosta

@ViniciustCosta ViniciustCosta commented Jun 30, 2025

Copy link
Copy Markdown
Collaborator

Background: As commented in other PRs (#4845, #4752), we have a recurring issue with oversized logs.

This PR adds the truncate method in another part of the code, where the extras field from python logging is dumped as a json string in the labels from GCP logging. I'm not sure if this label is useful and/or being used anymore, but to avoid removing for now, just inserting the truncate function after doing the json.dumps is enough.

This can be done because the value in labels is not interpreted as a json by the GCP logging afterward, but as a raw string, as seen here: https://screenshot.googleplex.com/8RG3K5aryJsjudm.png

b/414397533

@ViniciustCosta ViniciustCosta changed the title [Logging] Truncate extras when dumped as a string in labels. [Logging] Truncate extras when dumped as a string in labels Jun 30, 2025
@ViniciustCosta ViniciustCosta marked this pull request as ready for review June 30, 2025 14:48
@ViniciustCosta ViniciustCosta merged commit 3304c90 into master Jun 30, 2025
7 checks passed
@ViniciustCosta ViniciustCosta deleted the fix/truncate_log_extras_dump branch June 30, 2025 16:32
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.

4 participants