Sha256: ec6c04eb0d9702a85bd18c6f21b8badbae653de48f1be03374e41a8d0def3a8d
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
# frozen_string_literal: true require_relative '../transport/http' module Datadog module Core module Remote # Endpoint negotiation class Negotiation def initialize(_settings, agent_settings) transport_options = {} transport_options[:agent_settings] = agent_settings if agent_settings @transport_root = Datadog::Core::Transport::HTTP.root(**transport_options.dup) @logged = {} end def endpoint?(path) res = @transport_root.send_info if res.internal_error? && network_error?(res.error) unless @logged[:agent_unreachable] Datadog.logger.error { "agent unreachable: cannot negotiate #{path}" } @logged[:agent_unreachable] = true end return false end if res.not_found? unless @logged[:no_info_endpoint] Datadog.logger.error { "agent reachable but has no /info endpoint: cannot negotiate #{path}" } @logged[:no_info_endpoint] = true end return false end unless res.ok? unless @logged[:unexpected_response] Datadog.logger.error { "agent reachable but unexpected response: cannot negotiate #{path}" } @logged[:unexpected_response] = true end return false end unless res.endpoints.include?(path) unless @logged[:no_config_endpoint] Datadog.logger.error { "agent reachable but does not report #{path}" } @logged[:no_config_endpoint] = true end return false end Datadog.logger.debug { "agent reachable and reports #{path}" } true end private def network_error?(error) error.is_a?(Errno::ECONNREFUSED) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ddtrace-1.14.0 | lib/datadog/core/remote/negotiation.rb |
ddtrace-1.13.1 | lib/datadog/core/remote/negotiation.rb |
ddtrace-1.13.0 | lib/datadog/core/remote/negotiation.rb |