module Datadog::Tracing::Contrib::HTTPX::Plugin::RequestMethods

  1. lib/httpx/adapters/datadog.rb

Methods

Public Class

  1. new

Public Instance

  1. init_time
  2. response=

Attributes

init_time [R]

Public Class methods

new(*)

intercepts request initialization to inject the tracing logic.

[show source]
    # File lib/httpx/adapters/datadog.rb
186 def initialize(*)
187   super
188 
189   @init_time = nil
190 
191   return unless Datadog::Tracing.enabled?
192 
193   RequestTracer.call(self)
194 end

Public Instance methods

response=(response)
[show source]
    # File lib/httpx/adapters/datadog.rb
196 def response=(response)
197   if response.is_a?(::HTTPX::ErrorResponse) && response.error.respond_to?(:connection)
198     # handles the case when the +error+ happened during name resolution, which means
199     # that the tracing start point hasn't been triggered yet; in such cases, the approximate
200     # initial resolving time is collected from the connection, and used as span start time,
201     # and the tracing object in inserted before the on response callback is called.
202     @init_time = response.error.connection.init_time
203   end
204   super
205 end