Class: Datadog::DI::Transport::HTTP::Client Private
- Inherits:
-
Object
- Object
- Datadog::DI::Transport::HTTP::Client
- Includes:
- Diagnostics::Client, Input::Client
- Defined in:
- lib/datadog/di/transport/http/client.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Routes, encodes, and sends DI data to the trace agent via HTTP.
Instance Attribute Summary collapse
- #api ⇒ Object readonly private
- #logger ⇒ Object readonly private
Instance Method Summary collapse
- #build_env(request) ⇒ Object private
-
#initialize(api, logger:) ⇒ Client
constructor
private
A new instance of Client.
- #send_request(request, &block) ⇒ Object private
Methods included from Input::Client
Methods included from Diagnostics::Client
Constructor Details
#initialize(api, logger:) ⇒ Client
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Client.
19 20 21 22 |
# File 'lib/datadog/di/transport/http/client.rb', line 19 def initialize(api, logger:) @api = api @logger = logger end |
Instance Attribute Details
#api ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/datadog/di/transport/http/client.rb', line 17 def api @api end |
#logger ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/datadog/di/transport/http/client.rb', line 17 def logger @logger end |
Instance Method Details
#build_env(request) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/datadog/di/transport/http/client.rb', line 40 def build_env(request) Datadog::Core::Transport::HTTP::Env.new(request) end |
#send_request(request, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/datadog/di/transport/http/client.rb', line 24 def send_request(request, &block) # Build request into env env = build_env(request) # Get responses from API yield(api, env) rescue => e = "Internal error during #{self.class.name} request. Cause: #{e.class.name} #{e.message} " \ "Location: #{Array(e.backtrace).first}" logger.debug() Datadog::Core::Transport::InternalErrorResponse.new(e) end |