Sha256: a2b3e606ff66b7efcca9f1a6b21f5dc7a0a1415baa5cf89a2c429eaaa26007f6

Contents?: true

Size: 1.58 KB

Versions: 28

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

require_relative 'core/extensions'

# We must load core extensions to make certain global APIs
# accessible: both for Datadog features and the core itself.
module Datadog
  # Common, lower level, internal code used (or usable) by two or more
  # products. It is a dependency of each product. Contrast with Datadog::Kit
  # for higher-level features.
  module Core
    class << self
      # Records the occurrence of a deprecated operation in this library.
      #
      # Currently, these operations are logged to `Datadog.logger` at `warn` level.
      #
      # `disallowed_next_major` adds a message informing that the deprecated operation
      # won't be allowed in the next major release.
      #
      # @yieldreturn [String] a String with the lazily evaluated deprecation message.
      # @param [Boolean] disallowed_next_major whether this deprecation will be enforced in the next major release.
      def log_deprecation(disallowed_next_major: true)
        Datadog.logger.warn do
          message = yield
          message += ' This will be enforced in the next major release.' if disallowed_next_major
          message
        end
        nil
      end
    end
  end

  extend Core::Extensions

  # Add shutdown hook:
  # Ensures the Datadog components have a chance to gracefully
  # shut down and cleanup before terminating the process.
  at_exit do
    if Interrupt === $! # rubocop:disable Style/SpecialGlobalVars is process terminating due to a ctrl+c or similar?
      Datadog.send(:handle_interrupt_shutdown!)
    else
      Datadog.shutdown!
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
ddtrace-1.23.3 lib/datadog/core.rb
ddtrace-1.23.2 lib/datadog/core.rb
datadog-2.1.0 lib/datadog/core.rb
datadog-2.0.0 lib/datadog/core.rb
ddtrace-1.23.1 lib/datadog/core.rb
datadog-2.0.0.beta2 lib/datadog/core.rb
ddtrace-1.22.0 lib/datadog/core.rb
datadog-2.0.0.beta1 lib/datadog/core.rb
ddtrace-1.21.1 lib/datadog/core.rb
ddtrace-1.21.0 lib/datadog/core.rb
ddtrace-1.20.0 lib/datadog/core.rb
ddtrace-1.19.0 lib/datadog/core.rb
ddtrace-1.18.0 lib/datadog/core.rb
ddtrace-1.17.0 lib/datadog/core.rb
ddtrace-1.16.2 lib/datadog/core.rb
ddtrace-1.16.1 lib/datadog/core.rb
ddtrace-1.16.0 lib/datadog/core.rb
ddtrace-1.15.0 lib/datadog/core.rb
ddtrace-1.14.0 lib/datadog/core.rb
ddtrace-1.13.1 lib/datadog/core.rb