opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Fix instrumentation of SQLAlchemy when using sqlalchemy.engine_from_config

Open moredip opened this issue 1 year ago • 1 comments

Description

Fixes a bug where SQLAlchemy engines created via sqlalchemy.engine_from_config(...) are not instrumented by SQLAlchemyInstrumentor.

sqlalchemy.engine_from_config(...) directly calls create_engine(...) imported from sqlalchemy.engine.create. If we don't wrap that copy of the create_engine method then engines created via engine_from_config are not instrumented.

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

  • Added a unit test
  • ran it and checked that it failed
  • made the fix
  • verified that the test now passes

Does This PR Require a Core Repo Change?

  • [ ] Yes. - Link to PR:
  • [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
  • [ ] Documentation has been updated

moredip avatar Aug 23 '24 00:08 moredip