Sha256: a47d684eb9cdd4f84ead1e192b31c2bc09de9d1393fdd321132757265e4f16bf

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 KB

Contents

module Rails
  module Instrumentation
    module ActiveSupportSubscriber
      include Subscriber

      EVENT_NAMESPACE = 'active_support'.freeze

      EVENTS = %w[
        cache_read
        cache_generate
        cache_fetch_hit
        cache_write
        cache_delete
        cache_exist?
      ].freeze

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

      class << self
        def cache_read(event)
          tags = span_tags(
            'key' => event.payload[:key],
            'hit' => event.payload[:hit],
            'super_operation' => event.payload[:super_operation]
          )

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

        def cache_generate(event)
          tags = span_tags(
            'key' => event.payload[:key]
          )

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

        def cache_fetch_hit(event)
          tags = span_tags(
            'key' => event.payload[:key]
          )

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

        def cache_write(event)
          tags = span_tags(
            'key' => event.payload[:key]
          )

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

        def cache_delete(event)
          tags = span_tags(
            'key' => event.payload[:key]
          )

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

        def cache_exist?(event)
          tags = span_tags(
            'key' => event.payload[:key]
          )

          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_support_subscriber.rb
signalfx-rails-instrumentation-0.2.0 lib/rails/instrumentation/subscribers/active_support_subscriber.rb
rails-instrumentation-0.1.5 lib/rails/instrumentation/subscribers/active_support_subscriber.rb
rails-instrumentation-0.1.4 lib/rails/instrumentation/subscribers/active_support_subscriber.rb
rails-instrumentation-0.1.3 lib/rails/instrumentation/subscribers/active_support_subscriber.rb
rails-instrumentation-0.1.2 lib/rails/instrumentation/subscribers/active_support_subscriber.rb