Class: Datadog::Core::Remote::Client
- Inherits:
-
Object
- Object
- Datadog::Core::Remote::Client
- Defined in:
- lib/datadog/core/remote/client.rb,
lib/datadog/core/remote/client/capabilities.rb
Overview
Client communicates with the agent and sync remote configuration
Defined Under Namespace
Classes: Capabilities, SyncError, TransportError
Instance Attribute Summary collapse
-
#dispatcher ⇒ Object
readonly
Returns the value of attribute dispatcher.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(transport, capabilities, repository: Configuration::Repository.new) ⇒ Client
constructor
A new instance of Client.
- #sync ⇒ Object
Constructor Details
#initialize(transport, capabilities, repository: Configuration::Repository.new) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 23 24 25 |
# File 'lib/datadog/core/remote/client.rb', line 18 def initialize(transport, capabilities, repository: Configuration::Repository.new) @transport = transport @repository = repository @id = SecureRandom.uuid @capabilities = capabilities @dispatcher = Dispatcher.new(@capabilities.receivers) end |
Instance Attribute Details
#dispatcher ⇒ Object (readonly)
Returns the value of attribute dispatcher.
16 17 18 |
# File 'lib/datadog/core/remote/client.rb', line 16 def dispatcher @dispatcher end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/datadog/core/remote/client.rb', line 16 def id @id end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
16 17 18 |
# File 'lib/datadog/core/remote/client.rb', line 16 def repository @repository end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
16 17 18 |
# File 'lib/datadog/core/remote/client.rb', line 16 def transport @transport end |
Instance Method Details
#sync ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/core/remote/client.rb', line 27 def sync # TODO: Skip sync if no capabilities are registered response = transport.send_config(payload) if response.ok? process_response(response) elsif response.internal_error? raise TransportError, response.to_s end end |