woody v0.2.0 Woody.StatsD

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.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Record the Enum.count/1 of an enumerable

Record a decrement to a counter metric

Ensure the metrics are sent

Record a histogram value (DogStatsD-only)

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

Record an increment to a counter metric

Start the server

Stop the server

Link to this section Types

Link to this type

host()
host() :: String.t()

Link to this type

name()
name() :: String.t()

Link to this type

namespace()
namespace() :: String.t()

Link to this type

options()
options() :: [
  port: statsd_port(),
  host: host(),
  namespace: namespace(),
  sink: sink(),
  tags: tags(),
  name: name()
]

Link to this type

sink()
sink() :: String.t()

Link to this type

statsd_port()
statsd_port() :: number()

Link to this type

tags()
tags() :: [String.t()]

Link to this section Functions

Link to this function

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

flush(name \\ __MODULE__)

Ensure the metrics are sent.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

start_link(options \\ [])
start_link(options()) :: {:ok, pid()}

Start the server.

Link to this function

stop(name \\ __MODULE__)

Stop the server.

Link to this function

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.

Link to this function

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.