Module: InstStatsd::Distribution
- Included in:
- Statsd
- Defined in:
- lib/inst_statsd/distribution.rb
Overview
Mix-in methods for supporting DataDog events See docs.datadoghq.com/metrics/types/?tab=distribution#metric-types
Instance Method Summary collapse
-
#distributed_increment(metric, tags: {}) ⇒ Object
Increments the specified distribution metric by 1.
-
#distribution(metric, value, tags: {}) ⇒ Object
Sends a distribution metric to DataDog if the instance and DataDog are configured.
Instance Method Details
#distributed_increment(metric, tags: {}) ⇒ Object
Increments the specified distribution metric by 1.
31 32 33 34 35 36 |
# File 'lib/inst_statsd/distribution.rb', line 31 def distributed_increment(metric, tags: {}) # Non-Datadog clients don't support distribution metrics, so we use fall back to increment return increment(metric, tags: ) if instance && !data_dog? distribution(metric, 1, tags: ) end |
#distribution(metric, value, tags: {}) ⇒ Object
Sends a distribution metric to DataDog if the instance and DataDog are configured.
Distributions are aggregated globally and are appropriate when a metric sourced from multiple hosts need to be considered in a global statistical distribution.
18 19 20 21 22 |
# File 'lib/inst_statsd/distribution.rb', line 18 def distribution(metric, value, tags: {}) return unless instance && data_dog? instance.distribution(metric, value, { tags: .merge() }.compact) end |