Module: Datadog::Core::Diagnostics::EnvironmentCollector
- Defined in:
- lib/datadog/core/diagnostics/environment_logger.rb
Overview
Collects environment information for Core diagnostic logging
Class Method Summary collapse
- .collect_config! ⇒ Object
-
.date ⇒ String
Current time in ISO8601 format.
-
.dd_version ⇒ String
Configured application version.
-
.debug ⇒ Boolean?
Debug mode enabled in configuration.
-
.env ⇒ String
Configured application environment.
-
.health_metrics_enabled ⇒ Boolean?
Health metrics enabled in configuration.
-
.lang ⇒ String
“ruby”.
-
.lang_version ⇒ String
Supported Ruby language version.
-
.os_name ⇒ String
Best portable guess of OS information.
-
.runtime_metrics_enabled ⇒ Boolean?
Runtime metrics enabled in configuration.
-
.service ⇒ String
Configured application service name.
-
.tags ⇒ Hash?
Concatenated list of global tracer tags configured.
-
.version ⇒ String
Ddtrace version.
-
.vm ⇒ String?
Ruby VM name and version.
Class Method Details
.collect_config! ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 75 def collect_config! { date: date, os_name: os_name, version: version, lang: lang, lang_version: lang_version, env: env, service: service, dd_version: dd_version, debug: debug, tags: , runtime_metrics_enabled: runtime_metrics_enabled, vm: vm, health_metrics_enabled: health_metrics_enabled } end |
.date ⇒ String
Returns current time in ISO8601 format.
94 95 96 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 94 def date Time.now.utc.iso8601 end |
.dd_version ⇒ String
Returns configured application version.
132 133 134 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 132 def dd_version Datadog.configuration.version end |
.debug ⇒ Boolean?
Returns debug mode enabled in configuration.
137 138 139 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 137 def debug !!Datadog.configuration.diagnostics.debug end |
.env ⇒ String
Returns configured application environment.
122 123 124 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 122 def env Datadog.configuration.env end |
.health_metrics_enabled ⇒ Boolean?
Returns health metrics enabled in configuration.
169 170 171 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 169 def health_metrics_enabled !!Datadog.configuration.diagnostics.health_metrics.enabled end |
.lang ⇒ String
Returns “ruby”.
110 111 112 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 110 def lang Core::Environment::Ext::LANG end |
.lang_version ⇒ String
Supported Ruby language version. Will be distinct from VM version for non-MRI environments.
117 118 119 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 117 def lang_version Core::Environment::Ext::LANG_VERSION end |
.os_name ⇒ String
Best portable guess of OS information.
100 101 102 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 100 def os_name RbConfig::CONFIG['host'] end |
.runtime_metrics_enabled ⇒ Boolean?
Returns runtime metrics enabled in configuration.
150 151 152 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 150 def runtime_metrics_enabled Datadog.configuration.runtime_metrics.enabled end |
.service ⇒ String
Returns configured application service name.
127 128 129 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 127 def service Datadog.configuration.service end |
.tags ⇒ Hash?
Returns concatenated list of global tracer tags configured.
142 143 144 145 146 147 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 142 def = Datadog.configuration. return nil if .empty? hash_serializer() end |
.version ⇒ String
Returns ddtrace version.
105 106 107 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 105 def version DDTrace::VERSION::STRING end |
.vm ⇒ String?
Ruby VM name and version. Examples: “ruby-2.7.1”, “jruby-9.2.11.1”, “truffleruby-20.1.0”
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 157 def vm # RUBY_ENGINE_VERSION returns the VM version, which # will differ from RUBY_VERSION for non-mri VMs. if defined?(RUBY_ENGINE_VERSION) "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" else # Ruby < 2.3 doesn't support RUBY_ENGINE_VERSION "#{RUBY_ENGINE}-#{RUBY_VERSION}" end end |