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
Datadog version.
-
.vm ⇒ String?
Ruby VM name and version.
Class Method Details
.collect_config! ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 62 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.
81 82 83 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 81 def date Time.now.utc.iso8601 end |
.dd_version ⇒ String
Returns configured application version.
119 120 121 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 119 def dd_version Datadog.configuration.version end |
.debug ⇒ Boolean?
Returns debug mode enabled in configuration.
124 125 126 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 124 def debug !!Datadog.configuration.diagnostics.debug end |
.env ⇒ String
Returns configured application environment.
109 110 111 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 109 def env Datadog.configuration.env end |
.health_metrics_enabled ⇒ Boolean?
Returns health metrics enabled in configuration.
156 157 158 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 156 def health_metrics_enabled !!Datadog.configuration.health_metrics.enabled end |
.lang ⇒ String
Returns “ruby”.
97 98 99 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 97 def lang Core::Environment::Ext::LANG end |
.lang_version ⇒ String
Supported Ruby language version. Will be distinct from VM version for non-MRI environments.
104 105 106 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 104 def lang_version Core::Environment::Ext::LANG_VERSION end |
.os_name ⇒ String
Best portable guess of OS information.
87 88 89 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 87 def os_name RbConfig::CONFIG['host'] end |
.runtime_metrics_enabled ⇒ Boolean?
Returns runtime metrics enabled in configuration.
137 138 139 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 137 def runtime_metrics_enabled Datadog.configuration.runtime_metrics.enabled end |
.service ⇒ String
Returns configured application service name.
114 115 116 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 114 def service Datadog.configuration.service end |
.tags ⇒ Hash?
Returns concatenated list of global tracer tags configured.
129 130 131 132 133 134 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 129 def = Datadog.configuration. return nil if .empty? hash_serializer() end |
.version ⇒ String
Returns datadog version.
92 93 94 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 92 def version Datadog::VERSION::STRING end |
.vm ⇒ String?
Ruby VM name and version. Examples: “ruby-2.7.1”, “jruby-9.2.11.1”, “truffleruby-20.1.0”
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/datadog/core/diagnostics/environment_logger.rb', line 144 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 |