Module: Datadog::Utils
- Defined in:
- lib/datadog/lambda/utils/logger.rb,
lib/datadog/lambda/utils/extension.rb
Overview
Utils contains utility functions shared between modules
Constant Summary collapse
- AGENT_URL =
'http://127.0.0.1:8124'- HELLO_PATH =
'/lambda/hello'- EXTENSION_CHECK_URI =
URI(AGENT_URL + HELLO_PATH).freeze
- EXTENSION_PATH =
'/opt/extensions/datadog-agent'
Class Method Summary collapse
Class Method Details
.extension_running ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/datadog/lambda/utils/extension.rb', line 20 def self.extension_running return false unless File.exist?(EXTENSION_PATH) begin Net::HTTP.get(EXTENSION_CHECK_URI) rescue StandardError => e Datadog::Utils.logger.debug "extension is not running, returned with error #{e}" return false end true end |
.logger ⇒ Object
16 17 18 |
# File 'lib/datadog/lambda/utils/logger.rb', line 16 def self.logger @logger ||= Logger.new(STDOUT) end |
.update_log_level ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/datadog/lambda/utils/logger.rb', line 20 def self.update_log_level log_level = (ENV['DD_LOG_LEVEL'] || 'error').downcase logger.level = case log_level when 'debug' Logger::DEBUG when 'info' Logger::INFO when 'warn' Logger::WARN else Logger::ERROR end end |