Module: Datadog::Contrib::HTTP::CircuitBreaker
- Included in:
- Datadog::Contrib::HTTP
- Defined in:
- lib/ddtrace/contrib/http/circuit_breaker.rb
Overview
HTTP integration circuit breaker behavior For avoiding recursive traces.
Instance Method Summary collapse
-
#datadog_http_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?(pin) ⇒ Boolean
- #should_skip_tracing?(request, tracer) ⇒ Boolean
Instance Method Details
#datadog_http_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.
22 23 24 25 26 27 28 |
# File 'lib/ddtrace/contrib/http/circuit_breaker.rb', line 22 def datadog_http_request?(request) if request[Datadog::Ext::Transport::HTTP::HEADER_META_TRACER_VERSION] true else false end end |
#should_skip_distributed_tracing?(pin) ⇒ Boolean
30 31 32 33 34 |
# File 'lib/ddtrace/contrib/http/circuit_breaker.rb', line 30 def should_skip_distributed_tracing?(pin) return !pin.config[:distributed_tracing] if pin.config && pin.config.key?(:distributed_tracing) !Datadog.configuration[:http][:distributed_tracing] end |
#should_skip_tracing?(request, tracer) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ddtrace/contrib/http/circuit_breaker.rb', line 8 def should_skip_tracing?(request, tracer) return true if datadog_http_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 = tracer.active_span return true if active && (active.name == Ext::SPAN_REQUEST) false end |