In my infrastructure I need to trace my queries to the execution location from AMAZON performance insights in case of a huge database load so I can refactor them. Each query is dynamically generated hence in my codebase are hard to be traced, also we are in a refactorring process as well.
Therefore I want to place on each query extra metadata so I can trace them better from my RDS perfomrance insights panel in case of a high load. Do you have any idea how I can do this?
The trace needs to be in the following 3 axis:
- Project
- File
- Line
So if I could provide this info at query execution level in my code I could trace them better.
Best Answer
In many cases, the application_name setting is shown for connections. If your database driver does not allow to set it when creating the connection, you can execute
at any time.
If your panel shows only the query text, then you have to add the information to the query text: