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`



13
14
15
# File 'lib/datadog/core/environment/platform.rb', line 13

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`



18
19
20
# File 'lib/datadog/core/environment/platform.rb', line 18

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`.



24
25
26
# File 'lib/datadog/core/environment/platform.rb', line 24

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`



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

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`



38
39
40
# File 'lib/datadog/core/environment/platform.rb', line 38

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