You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a weak reference to sqlalchemy Engine to avoid memory leak (#1771)
* Use a weak reference to sqlalchemy Engine to avoid memory leak
Closes#1761
By using a weak reference to the `Engine` object, we can avoid the memory leak as disposed `Engines` get properly deallocated. Whenever `SQLAlchemy` is uninstrumented, we only trigger a removal for those event listeners which are listening for objects that haven't been garbage-collected yet.
* Made a mistake in resolving the weak reference
* Fixed formatting issues
* Updated changelog
* Added unit test to check that engine was garbage collected
* Do not save engine in EngineTracer to avoid memory leak
* Add an empty line to satisfy black formatter
* Fix isort complaints
* Fixed the issue when pool name is not set and =None
* Fix formatting issue
* Rebased after changes in a recent commit
* Updated PR number in changelog
---------
Co-authored-by: Shalev Roda <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
40
40
-`opentelemetry-instrumentation-system-metrics` Add `process.` prefix to `runtime.memory`, `runtime.cpu.time`, and `runtime.gc_count`. Change `runtime.memory` from count to UpDownCounter. ([#1735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1735))
41
41
- Add request and response hooks for GRPC instrumentation (client only)
Copy file name to clipboardExpand all lines: instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py
0 commit comments