module Datadog::Tracing::Contrib::Httprb::Instrumentation::InstanceMethods

def perform(req, options)

def perform(req, options)
  host = req.uri.host if req.respond_to?(:uri) && req.uri
  request_options = datadog_configuration(host)
  client_config = Datadog.configuration_for(self)
  Tracing.trace(Ext::SPAN_REQUEST, on_error: method(:annotate_span_with_error!)) do |span, trace|
    begin
      span.service = service_name(host, request_options, client_config)
      span.span_type = Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
      if Tracing.enabled? && !should_skip_distributed_tracing?(client_config)
        Tracing::Propagation::HTTP.inject!(trace, req)
      end
      # Add additional request specific tags to the span.
      annotate_span_with_request!(span, req, request_options)
    rescue StandardError => e
      logger.error("error preparing span for http.rb request: #{e}, Source: #{e.backtrace}")
    ensure
      res = super(req, options)
    end
    # Add additional response specific tags to the span.
    annotate_span_with_response!(span, res, request_options)
    res
  end
end