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(serializer): Allow classes to short circuit serializer with sentry_repr #1322

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Jan 26, 2022

Based on the discussion in #1300 and #1296.

We do a lot of truncation magic in our serializer to not send huge payloads.
In the process, we ignore if a user/framework sets a custom __repr__ on a class.
This PR lets users add a sentry_repr that will short circuit our truncation logic and pick the user defined repr.
We cannot just go with checking if __repr__ is overridden because we still want to preserve the truncation behavior for classes out there in the wild like QueryDict.

Some notes from the TSC:

  • for now this is python only because python is the only SDK with an elaborate serializer
  • and in general, this only makes sense for dynamic languages

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@vmarkovtsev vmarkovtsev left a comment

Choose a reason for hiding this comment

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

Thanks!

@sl0thentr0py
Copy link
Member Author

@vmarkovtsev heads up, I had to change it to __sentry_repr__ in the latest release because we had some mocking problems on our end due to this change.

@vmarkovtsev
Copy link

Thank you for the update, very helpful!

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.

3 participants