Closed alexmick closed 5 years ago
Thanks, this will be fixed with #470. All events captured during serialization are disregarded. The logs still show up in breadcrumbs.
There is already a semi-private hook called global_repr_processors
that you can use to customize serialization of dangerous objects.
I'm currently having a problem with the SDKs integrated serialisation of local variables for sending with events. I have in my local variables, an object that is a
Mapping
but that sometimes raises an event when keys are accessed. This is a normal behavior, since keys are lazy loaded and my code handles these correctly. However, when an event occurs and this variable is serialized for sending to sentry, the sdk iterates over all my keys and causes an infinite recursion.Minimal code te reproduce :
The only quick solution I found is to set
with_locals=False
on the sdk but it's a pity to lack all this functionality because of this case. On the other hand, I'm not sure how the SDK could anticipate such problems, here's what I'm thinking:<failed to serialize, use init(debug=True) to see error logs>
, all logs could be disregardedserialize_ignore_classes=[MyDangerousClass]
on the SDK init could avoid interference with such classes.Happy to open a PR to follow-up on this when a proper solution is found !