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.
19 20 21 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 19 def enabled?(flag = nil) (Datadog.configuration.tracing.analytics.enabled && flag != false) || flag == true end |
.set_measured(span, value = true) ⇒ Object
27 28 29 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 27 def 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.
13 14 15 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 13 def 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
23 24 25 |
# File 'lib/datadog/tracing/contrib/analytics.rb', line 23 def set_sample_rate(span, sample_rate) Tracing::Analytics.set_sample_rate(span, sample_rate) end |