Module: Datadog::Core::Environment::Identity
- Extended by:
- Utils::Forking
- Defined in:
- lib/datadog/core/environment/identity.rb
Overview
For runtime identity
Class Method Summary collapse
-
.id ⇒ Object
Retrieves number of classes from runtime.
- .lang ⇒ Object
- .lang_engine ⇒ Object
- .lang_interpreter ⇒ Object
- .lang_platform ⇒ Object
- .lang_version ⇒ Object
- .pid ⇒ Object
-
.tracer_version ⇒ Object
Returns tracer version, rubygems-style.
-
.tracer_version_semver2 ⇒ Object
Returns tracer version, comforming to semver.org/spec/v2.0.0.html.
Methods included from Utils::Forking
after_fork!, extended, fork_pid, forked?, included, update_fork_pid!
Class Method Details
.id ⇒ Object
Retrieves number of classes from runtime
19 20 21 22 23 24 25 26 |
# File 'lib/datadog/core/environment/identity.rb', line 19 def id @id ||= ::SecureRandom.uuid.freeze # Check if runtime has changed, e.g. forked. after_fork! { @id = ::SecureRandom.uuid.freeze } @id end |
.lang ⇒ Object
32 33 34 |
# File 'lib/datadog/core/environment/identity.rb', line 32 def lang Core::Environment::Ext::LANG end |
.lang_engine ⇒ Object
36 37 38 |
# File 'lib/datadog/core/environment/identity.rb', line 36 def lang_engine Core::Environment::Ext::LANG_ENGINE end |
.lang_interpreter ⇒ Object
40 41 42 |
# File 'lib/datadog/core/environment/identity.rb', line 40 def lang_interpreter Core::Environment::Ext::LANG_INTERPRETER end |
.lang_platform ⇒ Object
44 45 46 |
# File 'lib/datadog/core/environment/identity.rb', line 44 def lang_platform Core::Environment::Ext::LANG_PLATFORM end |
.lang_version ⇒ Object
48 49 50 |
# File 'lib/datadog/core/environment/identity.rb', line 48 def lang_version Core::Environment::Ext::LANG_VERSION end |
.pid ⇒ Object
28 29 30 |
# File 'lib/datadog/core/environment/identity.rb', line 28 def pid ::Process.pid end |
.tracer_version ⇒ Object
Returns tracer version, rubygems-style
53 54 55 |
# File 'lib/datadog/core/environment/identity.rb', line 53 def tracer_version Core::Environment::Ext::TRACER_VERSION end |
.tracer_version_semver2 ⇒ Object
Returns tracer version, comforming to semver.org/spec/v2.0.0.html
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/datadog/core/environment/identity.rb', line 58 def tracer_version_semver2 major, minor, patch, rest = tracer_version.split('.', 4) semver = "#{major}.#{minor}.#{patch}" return semver unless rest pre = '' build = '' rest.split('.').tap do |segments| if segments.length >= 4 pre = "-#{segments.shift}" build = "+#{segments.join('.')}" elsif segments.length == 1 pre = "-#{segments.shift}" else build = "+#{segments.join('.')}" end end semver + pre + build end |