Sha256: 7b126d11e1cee49b38cf85134f6cd4bdb98e16182c8ef09a929fb743d7224a94

Contents?: true

Size: 729 Bytes

Versions: 10

Compression:

Stored size: 729 Bytes

Contents

require "sentry/rails/tracing/abstract_subscriber"

module Sentry
  module Rails
    module Tracing
      class ActiveRecordSubscriber < AbstractSubscriber
        EVENT_NAMES = ["sql.active_record"].freeze
        EXCLUDED_EVENTS = ["SCHEMA", "TRANSACTION"].freeze

        def self.subscribe!
          subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
            next if EXCLUDED_EVENTS.include? payload[:name]

            record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:sql], duration: duration) do |span|
              span.set_data(:connection_id, payload[:connection_id])
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sentry-rails-5.0.2 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-5.0.1 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-5.0.0 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.9.2 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.9.1 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.9.0 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.8.3 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.8.2 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.8.1 lib/sentry/rails/tracing/active_record_subscriber.rb
sentry-rails-4.8.0 lib/sentry/rails/tracing/active_record_subscriber.rb