Module: Datadog::Contrib::HTTP
- Defined in:
- lib/ddtrace/contrib/http/patcher.rb
Overview
Datadog Net/HTTP integration.
Defined Under Namespace
Modules: Patcher
Constant Summary collapse
- URL =
'http.url'.freeze
- METHOD =
'http.method'.freeze
- BODY =
'http.body'.freeze
- NAME =
'http.request'.freeze
- APP =
'net/http'.freeze
- SERVICE =
'net/http'.freeze
Class Attribute Summary collapse
-
.distributed_tracing_enabled ⇒ Object
Returns the value of attribute distributed_tracing_enabled.
Class Method Summary collapse
- .should_skip_distributed_tracing?(pin) ⇒ Boolean
- .should_skip_tracing?(req, address, port, transport, pin) ⇒ Boolean
Class Attribute Details
.distributed_tracing_enabled ⇒ Object
Returns the value of attribute distributed_tracing_enabled.
18 19 20 |
# File 'lib/ddtrace/contrib/http/patcher.rb', line 18 def distributed_tracing_enabled @distributed_tracing_enabled end |
Class Method Details
.should_skip_distributed_tracing?(pin) ⇒ Boolean
44 45 46 47 48 49 |
# File 'lib/ddtrace/contrib/http/patcher.rb', line 44 def should_skip_distributed_tracing?(pin) unless pin.config.nil? return !pin.config.fetch(:distributed_tracing_enabled, @distributed_tracing_enabled) end !@distributed_tracing_enabled end |
.should_skip_tracing?(req, address, port, transport, pin) ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ddtrace/contrib/http/patcher.rb', line 23 def should_skip_tracing?(req, address, port, transport, pin) # we don't want to trace our own call to the API (they use net/http) # when we know the host & port (from the URI) we use it, else (most-likely # called with a block) rely on the URL at the end. if req.respond_to?(:uri) && req.uri if req.uri.host.to_s == transport.hostname.to_s && req.uri.port.to_i == transport.port.to_i return true end elsif address && port && address.to_s == transport.hostname.to_s && port.to_i == transport.port.to_i return true end # we don't want a "shotgun" effect with two nested traces for one # logical get, and request is likely to call itself recursively active = pin.tracer.active_span() return true if active && (active.name == NAME) false end |