Sha256: c4ce991020d65ef1e3e9a23df00b46aff645413adc2067f13b82313795cdc99f

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

module Rails
  module Instrumentation
    module ActiveJobSubscriber
      include Subscriber

      EVENT_NAMESPACE = 'active_job'.freeze

      EVENTS = %w[
        enqueue_at
        enqueue
        perform_start
        perform
      ].freeze

      # rubocop:disable Style/MutableConstant
      BASE_TAGS = { 'component' => 'ActiveJob' }
      # rubocop:enable Style/MutableConstant.

      class << self
        def enqueue_at(event)
          tags = span_tags(
            'adapter' => event.payload[:adapter],
            'job' => event.payload[:job]
          )

          Utils.trace_notification(event: event, tags: tags)
        end

        def enqueue(event)
          tags = span_tags(
            'adapter' => event.payload[:adapter],
            'job' => event.payload[:job]
          )

          Utils.trace_notification(event: event, tags: tags)
        end

        def perform_start(event)
          tags = span_tags(
            'adapter' => event.payload[:adapter],
            'job' => event.payload[:job]
          )

          Utils.trace_notification(event: event, tags: tags)
        end

        def perform(event)
          tags = span_tags(
            'adapter' => event.payload[:adapter],
            'job' => event.payload[:job]
          )

          Utils.trace_notification(event: event, tags: tags)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
signalfx-rails-instrumentation-0.2.1 lib/rails/instrumentation/subscribers/active_job_subscriber.rb
signalfx-rails-instrumentation-0.2.0 lib/rails/instrumentation/subscribers/active_job_subscriber.rb
rails-instrumentation-0.1.5 lib/rails/instrumentation/subscribers/active_job_subscriber.rb
rails-instrumentation-0.1.4 lib/rails/instrumentation/subscribers/active_job_subscriber.rb
rails-instrumentation-0.1.3 lib/rails/instrumentation/subscribers/active_job_subscriber.rb
rails-instrumentation-0.1.2 lib/rails/instrumentation/subscribers/active_job_subscriber.rb