Module: Datadog::Tracing::Diagnostics::EnvironmentLogger

Extended by:
Core::Diagnostics::EnvironmentLogging
Defined in:
lib/datadog/tracing/diagnostics/environment_logger.rb

Overview

Collects and logs Tracing diagnostic and error information

Class Method Summary collapse

Methods included from Core::Diagnostics::EnvironmentLogging

log_configuration!, log_error!

Class Method Details

.collect_and_log!(responses: nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/datadog/tracing/diagnostics/environment_logger.rb', line 15

def self.collect_and_log!(responses: nil)
  log_once! do
    env_data = EnvironmentCollector.collect_config!
    log_configuration!('TRACING', env_data.to_json)

    if responses
      err_data = EnvironmentCollector.collect_errors!(responses)
      err_data.reject! { |_, v| v.nil? } # Remove empty values from hash output
      log_error!('TRACING', 'Agent Error', err_data.to_json) unless err_data.empty?
    end
  end
rescue => e
  logger.warn("Failed to collect tracing environment information: #{e} Location: #{Array(e.backtrace).first}")
end