module Statsd::Methods

Direct including types

Defined in:

statsd/methods.cr

Constant Summary

COUNTER_TYPE = "c"
DISTRIBUTION_TYPE = "d"
GAUGE_TYPE = "g"
HISTOGRAM_TYPE = "h"
SET_TYPE = "s"
TIMING_TYPE = "ms"

Instance Method Summary

Instance Method Detail

def decrement(metric_name, sample_rate = nil, tags = nil) #

[View source]
def distribution(metric_name, value, tags = nil) #

Distributions

The DISTRIBUTION metric type is specific to DataDog (DogStatsD).

The DISTRIBUTION metric submission type represents the global statistical distribution of a set of values calculated across your entire distributed infrastructure in one time interval. A DISTRIBUTION can be used to instrument logical objects, like services, independently from the underlying hosts.

Unlike the HISTOGRAM metric type, which aggregates on the Agent during a given time interval, a DISTRIBUTION metric sends all the raw data during a time interval to Datadog. Aggregations occur on the server-side. Because the underlying data structure represents raw, un-aggregated data, distributions provide two major features:

  • Calculation of percentile aggregations
  • Customization of tagging

Like other metric types, such as GAUGE or HISTOGRAM, the DISTRIBUTION metric type has the following aggregations available: count, min, max, sum, and avg

Example:

<metric name>:<value>|d

[View source]
def gauge(metric_name, value, tags = nil) #

Gauge

A gauge is an instantaneous measurement of a value, like the gas gauge in a car. It differs from a counter by being calculated at the client rather than the server. Valid gauge values are in the range [0, 2^64^)


[View source]
def histogram(metric_name, value, tags = nil) #

Histograms

A histogram is a measure of the distribution of timer values over time, calculated at the server. As the data exported for timers and histograms is the same, this is currently an alias for a timer. Valid histogram values are in the range [0, 2^64^).

Example:

<metric name>:<value>|h

[View source]
def increment(metric_name, sample_rate = nil, tags = nil) #

[View source]
def set(metric_name, value, tags = nil) #

Sets

StatsD supports counting unique occurences of events between flushes, using a Set to store all occuring events. Example:

<metric name>:<value>|s

[View source]
def time(metric_name, tags = nil, &) #

Measure execution time of a given block, using {#timing}.


[View source]
def timing(metric_name, ms, tags = nil) #

Send a timing as a metric. This is sending a time measurement, as calculated by some other code, in milliseconds.

Example:

stastd.timing("db.query", 200)

[View source]