Module: TCellAgent::Instrumentation::Rails::Database
- Defined in:
- lib/tcell_agent/rails/database.rb
Class Method Summary collapse
Class Method Details
.inspect_result_size(results) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tcell_agent/rails/database.rb', line 32 def self.inspect_result_size(results) return if results.empty? if TCellAgent.configuration.should_instrument? && TCellAgent.configuration.should_intercept_requests? request_env = TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS.fetch(Thread.current.object_id, {}) tcell_context = request_env[TCellAgent::Instrumentation::TCELL_ID] if tcell_context tcell_context.database_result_sizes.push(results.size) end end end |
.push_exception(message, result) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tcell_agent/rails/database.rb', line 14 def self.push_exception(, result) appfirewall_policy = TCellAgent.policy(TCellAgent::PolicyTypes::APPSENSOR) return unless appfirewall_policy.enabled request_env = TCellAgent::Instrumentation::Rails::Middleware::ContextMiddleware::THREADS.fetch( Thread.current.object_id, {} ) tcell_data = request_env[TCellAgent::Instrumentation::TCELL_ID] return unless tcell_data && result.is_a?(ActiveRecord::StatementInvalid) tcell_data.sql_exceptions.push( { 'exception_name' => result.class.name, 'exception_payload' => } ) end |