Module: Datadog::Tracing::Distributed::PropagationPolicy
- Defined in:
- lib/datadog/tracing/distributed/propagation_policy.rb
Overview
Helper method to decide when to skip distributed tracing
Class Method Summary collapse
-
.enabled?(pin_config: nil, global_config: nil, trace: nil) ⇒ Boolean
Skips distributed tracing if disabled for this instrumentation or if APM is disabled unless there is an AppSec event (from upstream distributed trace or local).
Class Method Details
.enabled?(pin_config: nil, global_config: nil, trace: nil) ⇒ Boolean
Skips distributed tracing if disabled for this instrumentation or if APM is disabled unless there is an AppSec event (from upstream distributed trace or local)
Both pin_config and global_config are configuration for integrations. pin_config is a Datadog::Core::Pin object, which gives the configuration of a single instance of an integration. global_config is the config for all instances of an integration.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/datadog/tracing/distributed/propagation_policy.rb', line 16 def enabled?(pin_config: nil, global_config: nil, trace: nil) return false unless Tracing.enabled? unless ::Datadog.configuration.apm.tracing.enabled return false if trace.nil? trace_source = trace.get_tag(::Datadog::Tracing::Metadata::Ext::Distributed::TAG_TRACE_SOURCE)&.to_i(16) return false if trace_source.nil? # If AppSec is enabled and AppSec bit is set in the trace, we should not skip distributed tracing # Other products that will use dd.p.ts should implement similar behavior here if ::Datadog.configuration.appsec.enabled && (trace_source & ::Datadog::AppSec::Ext::PRODUCT_BIT) != 0 return true end return false end return pin_config[:distributed_tracing] if pin_config && pin_config.key?(:distributed_tracing) return global_config[:distributed_tracing] if global_config true end |