Module: Datadog::Tracing::Contrib::Analytics
- Defined in:
- lib/datadog/tracing/contrib/analytics.rb
Overview
Defines analytics behavior for integrations
Class Method Summary collapse
-
.enabled?(flag = nil) ⇒ Boolean
Checks whether analytics should be enabled.
- .set_measured(span, value = true) ⇒ Object
-
.set_rate!(span, configuration) ⇒ Object
Applies Analytics sampling rate, if applicable for this Contrib::Configuration.
- .set_sample_rate(span, sample_rate) ⇒ Object
Class Method Details
.enabled?(flag = nil) ⇒ Boolean
Checks whether analytics should be enabled.
flag is a truthy/falsey value that represents a setting on the integration.
17 18 19 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 17 def self.enabled?(flag = nil) (Datadog.configuration.tracing.analytics.enabled && flag != false) || flag == true end |
.set_measured(span, value = true) ⇒ Object
25 26 27 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 25 def self.set_measured(span, value = true) Tracing::Analytics.set_measured(span, value) end |
.set_rate!(span, configuration) ⇒ Object
Applies Analytics sampling rate, if applicable for this Contrib::Configuration.
11 12 13 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 11 def self.set_rate!(span, configuration) set_sample_rate(span, configuration[:analytics_sample_rate]) if enabled?(configuration[:analytics_enabled]) end |
.set_sample_rate(span, sample_rate) ⇒ Object
21 22 23 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 21 def self.set_sample_rate(span, sample_rate) Tracing::Analytics.set_sample_rate(span, sample_rate) end |