Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Jan 14, 2025
1 parent a679ec5 commit 91f8de3
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/datadog/core/remote/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize(settings, capabilities, agent_settings)
transport_options = {}
transport_options[:agent_settings] = agent_settings if agent_settings

@negotiation = Negotiation.new(settings, agent_settings)
negotiation = Negotiation.new(settings, agent_settings)
transport_v7 = Datadog::Core::Remote::Transport::HTTP.v7(**transport_options.dup)

@barrier = Barrier.new(settings.remote.boot_timeout_seconds)
Expand All @@ -29,7 +29,7 @@ def initialize(settings, capabilities, agent_settings)
Datadog.logger.debug { "new remote configuration client: #{@client.id}" }

@worker = Worker.new(interval: settings.remote.poll_interval_seconds) do
unless @healthy || @negotiation.endpoint?('/v0.7/config')
unless @healthy || negotiation.endpoint?('/v0.7/config')
@barrier.lift

next
Expand All @@ -47,7 +47,7 @@ def initialize(settings, capabilities, agent_settings)
# In case of unexpected errors, reset the negotiation object
# given external conditions have changed and the negotiation
# negotiation object stores error logging state that should be reset.
@negotiation = Negotiation.new(settings, agent_settings)
negotiation = Negotiation.new(settings, agent_settings)

# Transient errors due to network or agent. Logged the error but not via telemetry
Datadog.logger.error do
Expand Down
2 changes: 0 additions & 2 deletions lib/datadog/core/remote/negotiation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ module Core
module Remote
# Endpoint negotiation
class Negotiation
attr_reader :transport_root

def initialize(_settings, agent_settings, suppress_logging: {})
transport_options = {}
transport_options[:agent_settings] = agent_settings if agent_settings
Expand Down
6 changes: 3 additions & 3 deletions lib/datadog/core/remote/transport/negotiation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class Request < Datadog::Core::Transport::Request

# Negotiation response
module Response
# @!attribute [r] span_events
# Whether the agent supports the top-level span events field in flushed spans.
# @return [Boolean,nil]
# @!attribute [r] version
# The version of the agent.
# @return [String]
Expand All @@ -44,6 +41,9 @@ module Response
# @!attribute [r] config
# The agent configuration. These are configured by the user when starting the agent, as well as any defaults.
# @return [Hash]
# @!attribute [r] span_events
# Whether the agent supports the top-level span events field in flushed spans.
# @return [Boolean,nil]
attr_reader :version, :endpoints, :config, :span_events
end

Expand Down
2 changes: 0 additions & 2 deletions sig/datadog/core/remote/component.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module Datadog
class Component
BARRIER_TIMEOUT: Barrier::timeout_s

@negotiation: Negotiation

attr_reader client: Datadog::Core::Remote::Client
attr_reader worker: Datadog::Core::Remote::Worker
attr_reader healthy: bool
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/core/remote/negotiation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Datadog
module Core
module Remote
class Negotiation
attr_reader transport_root: Datadog::Core::Remote::Transport::Negotiation::Transport
@transport_root: Datadog::Core::Remote::Transport::Negotiation::Transport
@logged: ::Hash[::Symbol, bool]

def initialize: (Datadog::Core::Configuration::Settings _settings, Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings agent_settings, ?suppress_logging: ::Hash[::Symbol, bool]) -> void
Expand Down
6 changes: 3 additions & 3 deletions sig/datadog/core/remote/transport/negotiation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module Datadog
end

module Response
attr_reader version: untyped
attr_reader version: String

attr_reader endpoints: untyped
attr_reader endpoints: Array[String]

attr_reader config: untyped
attr_reader config: Hash[String,untyped]

attr_reader span_events: bool
end
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/core/transport/response.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Datadog
class InternalErrorResponse
include Response

attr_reader error: untyped
attr_reader error: Exception

def initialize: (untyped error) -> void

Expand Down

0 comments on commit 91f8de3

Please sign in to comment.