Skip to content

Commit

Permalink
Merge pull request #2756 from DataDog/check-info-endpoint-for-config-…
Browse files Browse the repository at this point in the history
…availability

Check info endpoint for remote configuration availability in the agent
  • Loading branch information
lloeki authored Apr 14, 2023
2 parents 8626b2f + 2795b2f commit 0e30c42
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/datadog/core/remote/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,31 @@ class << self
def build(settings, agent_settings)
return unless settings.remote.enabled

transport_options = {}
transport_options[:agent_settings] = agent_settings if agent_settings

transport_root = Datadog::Core::Transport::HTTP.root(**transport_options.dup)

res = transport_root.send_info
if res.ok?
if res.endpoints.include?('/v0.7/config')
Datadog.logger.debug { 'agent reachable and reports remote configuration endpoint' }
else
Datadog.logger.error do
'agent reachable but does not report remote configuration endpoint: ' \
'disabling remote configuration for this process.'
end

return
end
else
Datadog.logger.error do
'agent unreachable: disabling remote configuration for this process.'
end

return
end

new(settings, agent_settings)
end
end
Expand Down

0 comments on commit 0e30c42

Please sign in to comment.