Sha256: 0ceb029a8ce3e78ece9e42dbdf15760aeb2718cebf9e9ea85813d367c46fdd4a

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

module Appsignal
  class Hooks
    module DataMapperLogListener

      def log(message)
        # Attempt to find the scheme used for this message
        scheme = instance_variable_get(:@uri).scheme

        # If scheme is SQL-like, try to sanitize it, otherwise clear the body
        if %w(sqlite sqlite3 mysql postgres).include?(scheme)
          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

1 entries across 1 versions & 1 rubygems

Version Path
appsignal-1.3.0.beta.3 lib/appsignal/integrations/data_mapper.rb