Sha256: 2c8ab5d08922f0d596e31ff16c3b34cfd12fe110706d230658e4ef48c41054e1

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

# typed: false

require 'securerandom'

require 'datadog/core/environment/ext'
require 'datadog/core/utils/forking'

module Datadog
  module Core
    module Environment
      # For runtime identity
      # @public_api
      module Identity
        extend Core::Utils::Forking

        module_function

        # Retrieves number of classes from runtime
        def id
          @id ||= ::SecureRandom.uuid.freeze

          # Check if runtime has changed, e.g. forked.
          after_fork! { @id = ::SecureRandom.uuid.freeze }

          @id
        end

        def pid
          ::Process.pid
        end

        def lang
          Core::Environment::Ext::LANG
        end

        def lang_engine
          Core::Environment::Ext::LANG_ENGINE
        end

        def lang_interpreter
          Core::Environment::Ext::LANG_INTERPRETER
        end

        def lang_platform
          Core::Environment::Ext::LANG_PLATFORM
        end

        def lang_version
          Core::Environment::Ext::LANG_VERSION
        end

        def tracer_version
          Core::Environment::Ext::TRACER_VERSION
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddtrace-1.2.0 lib/datadog/core/environment/identity.rb
ddtrace-1.1.0 lib/datadog/core/environment/identity.rb
ddtrace-1.0.0 lib/datadog/core/environment/identity.rb
ddtrace-1.0.0.beta2 lib/datadog/core/environment/identity.rb