Module: RailsOtelContext::Adapters::PG
- Defined in:
- lib/rails_otel_context/adapters/pg.rb
Class Method Summary collapse
Class Method Details
.exec_methods ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rails_otel_context/adapters/pg.rb', line 22 def exec_methods return [] unless defined?(::PG::Constants::EXEC_ISH_METHODS) return [] unless defined?(::PG::Constants::EXEC_PREPARED_ISH_METHODS) (::PG::Constants::EXEC_ISH_METHODS + ::PG::Constants::EXEC_PREPARED_ISH_METHODS).uniq end |
.install!(app_root:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_otel_context/adapters/pg.rb', line 8 def install!(app_root:) return unless defined?(::PG::Connection) methods = exec_methods return if methods.empty? patch_module = patch_module_for(methods) patch_module.configure(app_root: app_root) return if ::PG::Connection.ancestors.include?(patch_module) ::PG::Connection.prepend(patch_module) end |
.patch_module_for(methods) ⇒ Object
29 30 31 |
# File 'lib/rails_otel_context/adapters/pg.rb', line 29 def patch_module_for(methods) @patch_module ||= build_patch_module(methods) end |