Class: StackifyRubyAPM::Spies::SqliteAdapterSpy Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Spies::SqliteAdapterSpy
- Defined in:
- lib/stackify_apm/spies/sinatra_activerecord/sqlite_adapter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- TYPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'db.sinatra_active_record.sql'.freeze
Instance Method Summary collapse
- #install ⇒ Object private
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/stackify_apm/spies/sinatra_activerecord/sqlite_adapter.rb', line 12 def install ActiveRecord::ConnectionAdapters::SQLite3Adapter.class_eval do alias_method 'exec_query_without_apm', 'exec_query' # rubocop:disable Lint/UnusedMethodArgument def exec_query(sql, name = 'SQL', binds = [], prepare: false) result = nil unless StackifyRubyAPM.current_transaction exec_query_without_apm(sql, name, binds) end ctx = Span::Context.new( CATEGORY: 'Database', SUBCATEGORY: 'Execute', COMPONENT_CATEGORY: 'DB Query', COMPONENT_DETAIL: 'Execute SQL Query', SQL: sql, PROVIDER: 'generic' ) result = exec_query_without_apm(sql, name, binds) StackifyRubyAPM.span name, TYPE, context: ctx do return result end end # rubocop:enable Lint/UnusedMethodArgument end end |