ExStatsD

Settings are taken from the ex_statsd application configuration.

The following are used to connect to your statsd server:

  • host: The hostname or IP address (default: 127.0.0.1)
  • port: The port number (default: 8125)

You can also provide an optional namespace to automatically nest all stats.

Summary

Types

options :: [port: statsd_port, host: host, namespace: namespace, sink: sink, tags: tags, name: name]
statsd_port :: number
tags :: [String.t]

Functions

count(collection, metric, options \\ default_options())

Record the Enum.count/1 of an enumerable.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the collection given as its first argument, making it suitable for pipelining.

counter(amount, metric, options \\ default_options())

Record a counter metric.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the amount given as its first argument, making it suitable for pipelining.

decrement(metric, options \\ default_options())

Record a decrement to a counter metric.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

Returns nil.

event(title, text \\ "", options \\ [tags: []])

Emit event.

text supports line breaks, only first 4KB will be transmitted.

Available options:

  • tags: Add tags to entry (DogStatsD-only)
  • priority: Can be normal or low, default normal
  • alert_type: Can be error, warning, info or success, default info
  • aggregation_key: Assign an aggregation key to the event, to group it with some others
  • hostname: Assign a hostname to the event
  • source_type_name: Assign a source type to the event
  • date_happened: Assign a timestamp to the event, default current time

It returns the title of the event, making it suitable for pipelining.

flush(name \\ __MODULE__)

Ensure the metrics are sent.

gauge(amount, metric, options \\ [tags: []])

Record a gauge entry.

  • tags: Add tags to entry (DogStatsD-only)

It returns the amount given as its first argument, making it suitable for pipelining.

histogram(amount, metric, options \\ default_options())

Record a histogram value (DogStatsD-only).

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the value given as the first argument, making it suitable for pipelining.

histogram_timing(metric, fun, options \\ default_options())

Time a function using a histogram metric (DogStatsD-only).

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the result of the function call, making it suitable for pipelining.

increment(metric, options \\ default_options())

Record an increment to a counter metric.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

Returns nil.

set(member, metric, options \\ [tags: []])

Record a set metric.

  • tags: Add tags to entry (DogStatsD-only)

It returns the value given as its first argument, making it suitable for pipelining.

start_link(options \\ [])

Specs

start_link(options) :: {:ok, pid}

Start the server.

stop(name \\ __MODULE__)

Stop the server.

timer(amount, metric, options \\ default_options())

Record a timer metric.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the value given as its first argument, making it suitable for pipelining.

timing(metric, fun, options \\ default_options())

Measure a function call.

  • sample_rate: Limit how often the metric is collected
  • tags: Add tags to entry (DogStatsD-only)

It returns the result of the function call, making it suitable for pipelining.