Sha256: df911df4169cd98c6fed022cbab524aff6175fcca954553d7b88c7823077c1dd

Contents?: true

Size: 941 Bytes

Versions: 350

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

module Appsignal
  class Hooks
    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

350 entries across 350 versions & 1 rubygems

Version Path
appsignal-3.10.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.10.0 lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.3-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.3 lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.2-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.2 lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.1 lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.9.0 lib/appsignal/integrations/data_mapper.rb
appsignal-3.8.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.8.1 lib/appsignal/integrations/data_mapper.rb
appsignal-3.8.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.8.0 lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.6-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.6 lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.2-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.2 lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-3.7.1 lib/appsignal/integrations/data_mapper.rb