Sha256: d3f7c702893962c9db74dab8005bcf4061635dee604b718046d97aa3186acd3b

Contents?: true

Size: 1.62 KB

Versions: 17

Compression:

Stored size: 1.62 KB

Contents

# typed: false

module Datadog
  module Tracing
    module Contrib
      # Defines registerable behavior for integrations
      module Registerable
        def self.included(base)
          base.extend(ClassMethods)
          base.include(InstanceMethods)
        end

        # Class methods for registerable behavior
        # @public_api
        module ClassMethods
          # Registers this integration in the global tracer registry.
          # Once registered, this integration can be activated with:
          #
          # ```
          # Datadog.configure do |c|
          #   c.tracing.instrument :name
          # end
          # ```
          #
          # @param [Symbol] name integration name. Used during activation.
          # @param [Datadog::Tracing::Contrib::Registry] registry a custom registry.
          #        Defaults to the global tracing registry.
          # @param [Boolean] auto_patch will this integration be activated during
          #   {file:docs/AutoInstrumentation.md Auto Instrumentation}?
          # @param [Hash] options additional keyword options passed to the initializer of
          #   a custom {Registerable} instrumentation
          # @see Datadog::Tracing::Contrib::Integration
          def register_as(name, registry: Contrib::REGISTRY, auto_patch: false, **options)
            registry.add(name, new(name, **options), auto_patch)
          end
        end

        # Instance methods for registerable behavior
        module InstanceMethods
          attr_reader \
            :name

          def initialize(name, **options)
            @name = name
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ddtrace-1.9.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.8.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.7.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.6.1 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.6.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.5.2 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.5.1 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.5.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.4.2 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.4.1 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.4.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.3.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.2.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.1.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.0.0 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.0.0.beta2 lib/datadog/tracing/contrib/registerable.rb
ddtrace-1.0.0.beta1 lib/datadog/tracing/contrib/registerable.rb