Method: OneApm::EnvironmentReport#initialize

Defined in:
lib/one_apm/support/environment_report.rb

#initializeEnvironmentReport

Returns a new instance of EnvironmentReport.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/one_apm/support/environment_report.rb', line 60

def initialize
  @data = self.class.registered_reporters.inject(Hash.new) do |data, (key, logic)|
    begin
      value = logic.call
      if value
        data[key] = value

        OneApm::Manager.record_metric("Supportability/EnvironmentReport/success", 0.0)
        OneApm::Manager.record_metric("Supportability/EnvironmentReport/success/#{key}", 0.0)
      else
        OneApm::Manager.logger.debug("EnvironmentReport ignoring value for #{key.inspect} which came back falsey: #{value.inspect}")
        OneApm::Manager.record_metric("Supportability/EnvironmentReport/empty", 0.0)
        OneApm::Manager.record_metric("Supportability/EnvironmentReport/empty/#{key}", 0.0)
      end
    rescue => e
      OneApm::Manager.logger.debug("EnvironmentReport failed to retrieve value for #{key.inspect}: #{e}")
      OneApm::Manager.record_metric("Supportability/EnvironmentReport/error", 0.0)
      OneApm::Manager.record_metric("Supportability/EnvironmentReport/error/#{key}", 0.0)
    end
    data
  end
end