Skip to content

Conversation

martosaur
Copy link
Contributor

Hi 👋

Elixir 1.19 will change how log translation works. Instead of replacing structured reports elixir will inject string translation into the report and wrap the report_cb callback. This enables logging libraries like Sentry to access report data directly instead of parsing iodata like they do now. But it also breaks the parsing.

This PR introduces a bare minimum change to make Sentry work with the new translations – whenever we detect a report with elixir_translation key, we replace the report with the translation, effectively restoring pre-1.19 behaviour.

Feel free to close this PR and replace it with a more sophisticated solution that takes advantage of the new structure 🙏

assert [exception] = event.exception
assert exception.type == "KeyError"
assert exception.value == "key :foo not found in: []"
assert exception.value == "key :foo not found in:\n\n []"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's unrelated to the translation: elixir-lang/elixir#14269

@martosaur martosaur force-pushed the am-handle-1.19-translations branch from 81ea297 to ae9b9e5 Compare May 2, 2025 17:10
@martosaur martosaur force-pushed the am-handle-1.19-translations branch from ae9b9e5 to d136ad2 Compare May 2, 2025 17:22
@whatyouhide
Copy link
Collaborator

I think this is totally fine for the time being. Great catch, thank you @martosaur 💟

@whatyouhide whatyouhide merged commit 14e2069 into getsentry:master May 6, 2025
4 checks passed
@martosaur martosaur deleted the am-handle-1.19-translations branch May 6, 2025 14:51
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.

2 participants