Module: Datadog::Tracing::Contrib::Httpclient::Instrumentation::InstanceMethods
- Defined in:
- lib/datadog/tracing/contrib/httpclient/instrumentation.rb
Overview
Instance methods for configuration
Instance Method Summary collapse
Methods included from Datadog::Tracing::Contrib::HttpAnnotationHelper
Instance Method Details
#do_get_block(req, proxy, conn, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/datadog/tracing/contrib/httpclient/instrumentation.rb', line 20 def do_get_block(req, proxy, conn, &block) host = req.header.request_uri.host = 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, , 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.header) end # Add additional request specific tags to the span. annotate_span_with_request!(span, req, ) rescue StandardError => e logger.error("error preparing span for httpclient request: #{e}, Source: #{e.backtrace}") ensure res = super end # Add additional response specific tags to the span. annotate_span_with_response!(span, res, ) res end end |