rollbar / pyrollbar

Error tracking and logging from Python to Rollbar
https://docs.rollbar.com/docs/python/
MIT License
213 stars 133 forks source link

Limit number of elements processed by `traverse` #404

Open mikhail-iurkov opened 2 years ago

mikhail-iurkov commented 2 years ago

Description of the change

When rollbar is called, transformations are applied to arguments and local variables, which can contain large structures, leading to cpu and memory consumption (for example multi-gigabyte memoryview in locals).

This PR adds limit to maximum number of elements processed - so structures are effectively cropped past that limit.

Type of change

Related issues

Checklists

Development

Code review

danielmorell commented 10 months ago

Hi @mikhail-iurkov! My apologies that this has sat dormant as long as it has. I like the idea. I think this is a good idea. However, this could be a breaking change for anyone who wants those larger structures included.

What do you think about making this a configuration option with a default that does not deviate from the current behavior?

homm commented 10 months ago

a default that does not deviate from the current behavior?

Current behavior is sending multi-gigabyte memoryview from locals (with no success). I doubt anyone relies on this.

danielmorell commented 10 months ago

@homm You are totally correct. However, I can also see a senario where a user may need to reduce the maximum even further than 100. Let's say to 20. This is probably more likely than someone wanting to send a 100+ element list.

homm commented 10 months ago

So your code suggestions are? (except that it's obviously should be rebased)