Module: Datadog::Tracing::Contrib::HTTP::CircuitBreaker
- Included in:
- Datadog::Tracing::Contrib::HTTP
- Defined in:
- lib/datadog/tracing/contrib/http/circuit_breaker.rb
Overview
HTTP integration circuit breaker behavior For avoiding recursive traces.
Instance Method Summary collapse
-
#internal_request?(request) ⇒ Boolean
We don’t want to trace our own call to the API (they use net/http) TODO: We don’t want this kind of soft-check on HTTP requests.
- #should_skip_distributed_tracing?(client_config) ⇒ Boolean
- #should_skip_tracing?(request) ⇒ Boolean
Instance Method Details
#internal_request?(request) ⇒ Boolean
We don’t want to trace our own call to the API (they use net/http) TODO: We don’t want this kind of soft-check on HTTP requests.
Remove this when transport implements its own "skip tracing" mechanism.
26 27 28 29 |
# File 'lib/datadog/tracing/contrib/http/circuit_breaker.rb', line 26 def internal_request?(request) !!(request[Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION] || request[Datadog::Core::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST]) end |
#should_skip_distributed_tracing?(client_config) ⇒ Boolean
31 32 33 34 35 |
# File 'lib/datadog/tracing/contrib/http/circuit_breaker.rb', line 31 def should_skip_distributed_tracing?(client_config) return !client_config[:distributed_tracing] if client_config && client_config.key?(:distributed_tracing) !Datadog.configuration.tracing[:http][:distributed_tracing] end |
#should_skip_tracing?(request) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/datadog/tracing/contrib/http/circuit_breaker.rb', line 12 def should_skip_tracing?(request) return true if internal_request?(request) # we don't want a "shotgun" effect with two nested traces for one # logical get, and request is likely to call itself recursively active = Tracing.active_span return true if active && (active.name == Ext::SPAN_REQUEST) false end |