Sha256: c6878ca911094ffc25d7c9df349d9d4f3e8505aff16e321a5ba059b2a87c812b

Contents?: true

Size: 1.01 KB

Versions: 22

Compression:

Stored size: 1.01 KB

Contents

require 'ddtrace/contrib/active_support/notifications/event'

module Datadog
  module Contrib
    module ActionView
      # Defines basic behavior for an ActionView event.
      module Event
        def self.included(base)
          base.send(:include, ActiveSupport::Notifications::Event)
          base.send(:extend, ClassMethods)
        end

        # Class methods for ActionView events.
        module ClassMethods
          def span_options
            { service: configuration[:service_name] }
          end

          def tracer
            -> { configuration[:tracer] }
          end

          def configuration
            Datadog.configuration[:action_view]
          end

          def record_exception(span, payload)
            if payload [:exception_object]
              span.set_error(payload[:exception_object])
            elsif payload[:exception]
              # Fallback for ActiveSupport < 5.0
              span.set_error(payload[:exception])
            end
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
ddtrace-0.43.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.42.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.41.0 lib/ddtrace/contrib/action_view/event.rb
ls-trace-0.2.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.40.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.39.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.38.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.37.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.36.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.35.2 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.35.1 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.35.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.34.2 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.34.1 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.34.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.33.1 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.33.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.32.0 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.31.1 lib/ddtrace/contrib/action_view/event.rb
ddtrace-0.31.0 lib/ddtrace/contrib/action_view/event.rb