Class: Datadog::Core::Environment::AgentInfo
- Inherits:
-
Object
- Object
- Datadog::Core::Environment::AgentInfo
- Defined in:
- lib/datadog/core/environment/agent_info.rb
Overview
Retrieves the agent’s ‘/info` endpoint data. This data can be used to determine the capabilities of the local Datadog agent.
Instance Attribute Summary collapse
-
#agent_settings ⇒ Object
readonly
Returns the value of attribute agent_settings.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#fetch ⇒ Datadog::Core::Remote::Transport::HTTP::Negotiation::Response?
Fetches the information from the agent.
-
#initialize(agent_settings, logger: Datadog.logger) ⇒ AgentInfo
constructor
A new instance of AgentInfo.
Constructor Details
#initialize(agent_settings, logger: Datadog.logger) ⇒ AgentInfo
Returns a new instance of AgentInfo.
56 57 58 59 60 |
# File 'lib/datadog/core/environment/agent_info.rb', line 56 def initialize(agent_settings, logger: Datadog.logger) @agent_settings = agent_settings @logger = logger @client = Remote::Transport::HTTP.root(agent_settings: agent_settings, logger: logger) end |
Instance Attribute Details
#agent_settings ⇒ Object (readonly)
Returns the value of attribute agent_settings.
54 55 56 |
# File 'lib/datadog/core/environment/agent_info.rb', line 54 def agent_settings @agent_settings end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
54 55 56 |
# File 'lib/datadog/core/environment/agent_info.rb', line 54 def logger @logger end |
Instance Method Details
#==(other) ⇒ Object
72 73 74 |
# File 'lib/datadog/core/environment/agent_info.rb', line 72 def ==(other) other.is_a?(self.class) && other.agent_settings == agent_settings end |
#fetch ⇒ Datadog::Core::Remote::Transport::HTTP::Negotiation::Response?
Fetches the information from the agent.
65 66 67 68 69 70 |
# File 'lib/datadog/core/environment/agent_info.rb', line 65 def fetch res = @client.send_info return unless res.ok? res end |