Module: StatsD
- Extended by:
- Forwardable
- Defined in:
- lib/statsd/instrument.rb,
lib/statsd/instrument/client.rb,
lib/statsd/instrument/strict.rb,
lib/statsd/instrument/helpers.rb,
lib/statsd/instrument/railtie.rb,
lib/statsd/instrument/version.rb,
lib/statsd/instrument/datagram.rb,
lib/statsd/instrument/log_sink.rb,
lib/statsd/instrument/matchers.rb,
lib/statsd/instrument/udp_sink.rb,
lib/statsd/instrument/null_sink.rb,
lib/statsd/instrument/assertions.rb,
lib/statsd/instrument/environment.rb,
lib/statsd/instrument/expectation.rb,
lib/statsd/instrument/capture_sink.rb,
lib/statsd/instrument/datagram_builder.rb,
lib/statsd/instrument/dogstatsd_datagram.rb,
lib/statsd/instrument/statsd_datagram_builder.rb,
lib/statsd/instrument/dogstatsd_datagram_builder.rb
Overview
The StatsD
module contains low-level metrics for collecting metrics and
sending them to the backend.
Defined Under Namespace
Modules: Instrument
Class Attribute Summary collapse
-
.logger ⇒ Logger
The logger to use in case of any errors.
-
.singleton_client ⇒ StatsD::Instrument::Client
The StatsD client that handles method calls on the StatsD singleton.
Class Method Summary collapse
-
.distribution(name, value = nil, sample_rate: nil, tags: nil, &block) ⇒ void
Emits a distribution metric, which builds a histogram of the reported values.
-
.event(title, text, tags: nil, hostname: nil, timestamp: nil, aggregation_key: nil, priority: nil, source_type_name: nil, alert_type: nil) ⇒ void
Emits an event.
-
.gauge(name, value, sample_rate: nil, tags: nil) ⇒ void
Emits a gauge metric.
-
.histogram(name, value, sample_rate: nil, tags: nil) ⇒ void
Emits a histogram metric, which builds a histogram of the reported values.
-
.increment(name, value = 1, sample_rate: nil, tags: nil) ⇒ void
Emits a counter metric.
-
.measure(name, value = nil, sample_rate: nil, tags: nil, &block) ⇒ void
Emits a timing metric.
-
.service_check(name, status, tags: nil, hostname: nil, timestamp: nil, message: nil) ⇒ void
Emits a service check.
-
.set(name, value, sample_rate: nil, tags: nil) ⇒ void
Emits a set metric, which counts distinct values.
Class Attribute Details
.logger ⇒ Logger
The logger to use in case of any errors.
306 307 308 |
# File 'lib/statsd/instrument.rb', line 306 def logger @logger end |
.singleton_client ⇒ StatsD::Instrument::Client
The StatsD client that handles method calls on the StatsD singleton
317 318 319 |
# File 'lib/statsd/instrument.rb', line 317 def singleton_client @singleton_client ||= StatsD::Instrument::Environment.current.client end |
Class Method Details
.distribution(name, value = nil, sample_rate: nil, tags: nil, &block) ⇒ void
The distribution metric type is not available on all implementations.
A NotImplementedError
will be raised if you call this method, but
the active implementation does not support it.
This method returns an undefined value.
Emits a distribution metric, which builds a histogram of the reported values.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.event(title, text, tags: nil, hostname: nil, timestamp: nil, aggregation_key: nil, priority: nil, source_type_name: nil, alert_type: nil) ⇒ void
Supported by the Datadog implementation only.
This method returns an undefined value.
Emits an event. An event represents any record of activity noteworthy for engineers.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.gauge(name, value, sample_rate: nil, tags: nil) ⇒ void
This method returns an undefined value.
Emits a gauge metric.
You should use a gauge if you are reporting the current value of something that can only have one value at the time. E.g., the speed of your car. A newly reported value will replace the previously reported value.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.histogram(name, value, sample_rate: nil, tags: nil) ⇒ void
The histogram metric type is not available on all implementations.
A NotImplementedError
will be raised if you call this method, but
the active implementation does not support it.
This method returns an undefined value.
Emits a histogram metric, which builds a histogram of the reported values.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.increment(name, value = 1, sample_rate: nil, tags: nil) ⇒ void
This method returns an undefined value.
Emits a counter metric.
You should use a counter metric to count the frequency of something happening. As a
result, the value should generally be set to 1 (the default), unless you reporting
about a batch of activity. E.g. increment('messages.processed', messages.size)
For values that are not frequencies, you should use another metric type, e.g.
#histogram or #distribution.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.measure(name, value = nil, sample_rate: nil, tags: nil, &block) ⇒ void
This method returns an undefined value.
Emits a timing metric.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.service_check(name, status, tags: nil, hostname: nil, timestamp: nil, message: nil) ⇒ void
Supported by the Datadog implementation only.
This method returns an undefined value.
Emits a service check. Services Checks allow you to characterize the status of a service in order to monitor it within Datadog.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |
.set(name, value, sample_rate: nil, tags: nil) ⇒ void
This method returns an undefined value.
Emits a set metric, which counts distinct values.
345 346 |
# File 'lib/statsd/instrument.rb', line 345 def_delegators :singleton_client, :increment, :gauge, :set, :measure, :histogram, :distribution, :event, :service_check |