Pablo Aguilar

Aug 13, 2020

4 min read

Monkey Patching is not too bad

Designed by JavierFeria / Freepik

History

  • Success, the function computation was successfully executed
  • Failure, the function computation broke due to business logic or an Exception was raised
Result container example

Tracing Failure: feature explanation

Memory consumption without trace implemented
Memory consumption without trace implemented
Memory consumption with trace implemented
Memory consumption with trace implemented

How can we implement the tracing feature?

  • Use an environment variable
  • Use monkey patching
Example class with environment variable
collect_traces example
/returns/returns/result.py:529 in `Failure` /example_folder/example.py:5 in `get_failure` /example_folder/example.py:1 in `<module>`

Extra

pytest plugin example

Related links

Also published on: