Module: Datadog::AppSec::TraceKeeper
- Defined in:
- lib/datadog/appsec/trace_keeper.rb
Overview
This class is used to mark trace as manual keep and tag it as ASM product.
Class Method Summary collapse
Class Method Details
.keep!(trace) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/datadog/appsec/trace_keeper.rb', line 7 def self.keep!(trace) return unless trace previous_dm = trace.get_tag(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER) # NOTE: This action will not set correct decision maker value, so the # trace keeping must be done with additional steps below trace.keep! # NOTE: Preserve decision maker if already set by another product. # As `trace.keep!` resets `_dd.p.dm` to `MANUAL`, we restore the # previous value when another product has already claimed the # decision maker. if previous_dm.nil? || previous_dm == Tracing::Sampling::Ext::Decision::MANUAL trace.set_tag( Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, Tracing::Sampling::Ext::Decision::ASM ) else trace.set_tag( Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER, previous_dm, ) end trace.set_distributed_source(Ext::PRODUCT_BIT) end |