opentelemetry-python-contrib
opentelemetry-python-contrib copied to clipboard
Add callbacks for sqlalchemy events.
Description
We encountered a use case where we want to show the parameters of our sql query for better traceability. I added callbacks so we can further process sqlalchemy events, namely (before_cursor_execute, after_cursor_execute and handle_error)
I also noticed that if the engine is instrumented through the connect wrapper, the engine tracer options such as the sql commenter won't be configured. I packed these options together so users can pass the configuration regardless of which wrapper is being used.
Type of change
- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- Wrote and ran new unit tests.
Does This PR Require a Core Repo Change?
- [x] No.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
- [x] Followed the style guidelines of this project
- [x] Changelogs have been updated
- [x] Unit tests have been added
- [x] Documentation has been updated