Module: Datadog::Tracing::Metadata::Analytics

Defined in:
lib/datadog/tracing/metadata/analytics.rb

Overview

Defines analytics tagging behavior

Instance Method Summary collapse

Instance Method Details

#set_tag(key, value) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/datadog/tracing/metadata/analytics.rb', line 11

def set_tag(key, value)
  case key
  when Ext::Analytics::TAG_ENABLED
    # If true, set rate to 1.0, otherwise set 0.0.
    value = value == true ? Ext::Analytics::DEFAULT_SAMPLE_RATE : 0.0
    Tracing::Analytics.set_sample_rate(self, value)
  when Ext::Analytics::TAG_SAMPLE_RATE
    Tracing::Analytics.set_sample_rate(self, value)
  else
    super if defined?(super)
  end
end