Module: Datadog::Tracing::Contrib::HTTPX::Plugin::ConnectionMethods
- Defined in:
- lib/httpx/adapters/datadog.rb
Instance Attribute Summary collapse
-
#init_time ⇒ Object
readonly
Returns the value of attribute init_time.
Instance Method Summary collapse
-
#handle_error(error, request = nil) ⇒ Object
handles the case when the
error
happened during name resolution, which meanns that the tracing logic hasn’t been injected yet; in such cases, the approximate initial resolving time is collected from the connection, and used as span start time, and the tracing object in inserted before the on response callback is called. - #initialize ⇒ Object
Instance Attribute Details
#init_time ⇒ Object (readonly)
Returns the value of attribute init_time.
186 187 188 |
# File 'lib/httpx/adapters/datadog.rb', line 186 def init_time @init_time end |
Instance Method Details
#handle_error(error, request = nil) ⇒ Object
handles the case when the error
happened during name resolution, which meanns that the tracing logic hasn’t been injected yet; in such cases, the approximate initial resolving time is collected from the connection, and used as span start time, and the tracing object in inserted before the on response callback is called.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/httpx/adapters/datadog.rb', line 198 def handle_error(error, request = nil) return super unless Datadog::Tracing.enabled? return super unless error.respond_to?(:connection) @pending.each do |req| next if request and request == req RequestTracer.new(req).call(error.connection.init_time) end RequestTracer.new(request).call(error.connection.init_time) if request super end |
#initialize ⇒ Object
188 189 190 191 192 |
# File 'lib/httpx/adapters/datadog.rb', line 188 def initialize(*) super @init_time = ::Datadog::Core::Utils::Time.now.utc end |