Sha256: b7767c71af706381b042b326d3fe2022801588fb6196c4e7fe0227c0c350037e

Contents?: true

Size: 960 Bytes

Versions: 56

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

module Appsignal
  class Hooks
    # @api private
    module DataMapperLogListener
      SQL_CLASSES = [
        "DataObjects::SqlServer::Connection",
        "DataObjects::Sqlite3::Connection",
        "DataObjects::Mysql::Connection",
        "DataObjects::Postgres::Connection"
      ].freeze

      def log(message)
        # If scheme is SQL-like, try to sanitize it, otherwise clear the body
        if SQL_CLASSES.include?(self.class.to_s)
          body_content = message.query
          body_format = Appsignal::EventFormatter::SQL_BODY_FORMAT
        else
          body_content = ""
          body_format = Appsignal::EventFormatter::DEFAULT
        end

        # Record event
        Appsignal::Transaction.current.record_event(
          "query.data_mapper",
          "DataMapper Query",
          body_content,
          message.duration,
          body_format
        )
        super
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
appsignal-4.2.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.2.0 lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.3-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.3 lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.2-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.2 lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.1 lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.1.0 lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.9-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.9 lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.8-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.8 lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.7-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.7 lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.6-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.6 lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.5-java lib/appsignal/integrations/data_mapper.rb
appsignal-4.0.5 lib/appsignal/integrations/data_mapper.rb