Sha256: 5f17fa89efede937f86b5ee48ae87cff7c15352a8c2f624e12443e192858385e

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

require_relative '../active_support/notifications/event'

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

          # Class methods for ActionView events.
          module ClassMethods
            def configuration
              Datadog.configuration.tracing[: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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddtrace-1.10.1 lib/datadog/tracing/contrib/action_view/event.rb
ddtrace-1.10.0 lib/datadog/tracing/contrib/action_view/event.rb