I want to research a bit about how can i attach a hook in Python to the instrumentation layer. I want this for Flask mainly. Let me explain a bit more in deep:
Imagine i have a a very dumb Flask application, it exposes an endpoint via POST, that receives a number and returns the square.
What i want to do is develop a piece of code (not part of the actual application) that can see the request that is sent to the endpoint, which method is being called, which part of the code is being executed, etc…
I dont want to dinamically modify anything, i just want to monitor and listen which parts of the code are being executed. It is similar to what IAST agents do, but not so sofisticated
Any help on this? Where can i read documentation about how to do it and any simple example?