Module: Datadog::Tracing::Contrib::Httprb::Instrumentation::InstanceMethods
- Defined in:
- lib/datadog/tracing/contrib/httprb/instrumentation.rb
Overview
Instance methods for configuration
Instance Method Summary collapse
Methods included from Datadog::Tracing::Contrib::HttpAnnotationHelper
Instance Method Details
#perform(req, options) ⇒ 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/httprb/instrumentation.rb', line 20 def perform(req, ) host = req.uri.host if req.respond_to?(:uri) && req.uri = 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) end # Add additional request specific tags to the span. annotate_span_with_request!(span, req, ) rescue StandardError => e logger.error("error preparing span for http.rb request: #{e}, Source: #{e.backtrace}") ensure res = super(req, ) end # Add additional response specific tags to the span. annotate_span_with_response!(span, res, ) res end end |