Sha256: 9750b4e2504ddd120871f379a899b5abfc75374762ca21b613f8e3f5f6011850

Contents?: true

Size: 910 Bytes

Versions: 38

Compression:

Stored size: 910 Bytes

Contents

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

38 entries across 38 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.3 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.3.alpha.2 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.3.alpha.1 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.2-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.2 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.1 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.1.beta.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.1.beta.1 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0.beta.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0.beta.1 lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0.alpha.1-java lib/appsignal/integrations/data_mapper.rb
appsignal-2.5.0.alpha.1 lib/appsignal/integrations/data_mapper.rb
appsignal-2.4.3 lib/appsignal/integrations/data_mapper.rb
appsignal-2.4.2 lib/appsignal/integrations/data_mapper.rb