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
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 48 49 50 51 52 53 54 55 |
# File 'lib/datadog/tracing/contrib/httpclient/instrumentation.rb', line 23 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.type = Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND if Datadog::AppSec::Utils::TraceOperation.appsec_standalone_reject?(trace) trace.sampling_priority = Tracing::Sampling::Ext::Priority::AUTO_REJECT end if Tracing.enabled? && !should_skip_distributed_tracing?(client_config) Contrib::HTTP.inject(trace, req.header) end # Add additional request specific tags to the span. annotate_span_with_request!(span, req, ) rescue StandardError => e Datadog.logger.error("error preparing span for httpclient request: #{e}, Source: #{e.backtrace}") Datadog::Core::Telemetry::Logger.report(e) ensure res = super end # Add additional response specific tags to the span. annotate_span_with_response!(span, res, ) res end end |