Sha256: dc0f640cd51950aee4310609a7754336d6cbad2930246efcc1f6c4de511d4463

Contents?: true

Size: 979 Bytes

Versions: 15

Compression:

Stored size: 979 Bytes

Contents

require 'ddtrace/contrib/patcher'
require 'ddtrace/ext/app_types'
require 'ddtrace/contrib/active_model_serializers/ext'
require 'ddtrace/contrib/active_model_serializers/events'

module Datadog
  module Contrib
    module ActiveModelSerializers
      # Patcher enables patching of 'active_model_serializers' module.
      module Patcher
        include Contrib::Patcher

        module_function

        def patched?
          done?(:active_model_serializers)
        end

        def patch
          do_once(:active_model_serializers) do
            begin
              # Subscribe to ActiveModelSerializers events
              Events.subscribe!
            rescue StandardError => e
              Datadog::Tracer.log.error("Unable to apply ActiveModelSerializers integration: #{e}")
            end
          end
        end

        def get_option(option)
          Datadog.configuration[:active_model_serializers].get_option(option)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
ls-trace-0.1.2 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.29.1 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.26.1 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ls-trace-0.1.1 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.29.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.28.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.27.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.26.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.25.1 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.25.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.24.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.23.3 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.23.2 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.23.1 lib/ddtrace/contrib/active_model_serializers/patcher.rb
ddtrace-0.23.0 lib/ddtrace/contrib/active_model_serializers/patcher.rb