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_debug!, 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
29
30
# File 'lib/datadog/tracing/diagnostics/environment_logger.rb', line 15

def self.collect_and_log!(responses: nil)
  if log?
    log_configuration!("TRACING", EnvironmentCollector.collect_config!.to_json)
    log_debug!("TRACING INTEGRATIONS", EnvironmentCollector.collect_integrations_settings!.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.class}: #{e.message} Location: #{Array(e.backtrace).first}"
  )
end