Module: Datadog::Core::Environment::Platform

Defined in:
lib/datadog/core/environment/platform.rb

Overview

For gathering information about the platform

Class Method Summary collapse

Class Method Details

.architectureString

Returns ISA of host; ‘uname -m`.

Returns:

  • (String)

    ISA of host; ‘uname -m`



15
16
17
# File 'lib/datadog/core/environment/platform.rb', line 15

def architecture
  Identity.lang_version >= '2.2' ? Etc.uname[:machine] : Gem::Platform.local.cpu
end

.hostnameString

Returns name of host; ‘uname -n`.

Returns:

  • (String)

    name of host; ‘uname -n`



20
21
22
# File 'lib/datadog/core/environment/platform.rb', line 20

def hostname
  Identity.lang_version >= '2.2' ? Etc.uname[:nodename] : nil
end

.kernel_nameString

System name, normally ‘Linux` or `Darwin` (but ’Mac OS X’ on JRuby);

Returns:

  • (String)

    name of kernel; ‘uname -s`.



26
27
28
# File 'lib/datadog/core/environment/platform.rb', line 26

def kernel_name
  Identity.lang_version >= '2.2' ? Etc.uname[:sysname] : Gem::Platform.local.os.capitalize
end

.kernel_releaseString

Returns kernel release; ‘uname -r`.

Returns:

  • (String)

    kernel release; ‘uname -r`



31
32
33
34
35
36
37
# File 'lib/datadog/core/environment/platform.rb', line 31

def kernel_release
  if Identity.lang_engine == 'jruby'
    Etc.uname[:version] # Java's `os.version` maps to `uname -r`
  elsif Identity.lang_version >= '2.2'
    Etc.uname[:release]
  end
end

.kernel_versionString

Returns kernel version; ‘uname -v`.

Returns:

  • (String)

    kernel version; ‘uname -v`



40
41
42
# File 'lib/datadog/core/environment/platform.rb', line 40

def kernel_version
  Etc.uname[:version] if Identity.lang_engine != 'jruby' && Identity.lang_version >= '2.2'
end