StatsD

Note

This plugin is currently being groomed to be an integration. It works, but we haven’t spent a lot of time on it yet to optimize the user experience. Feel free to try it out, just keep in mind that we will be enhancing the experience over time.

StatsD is a network daemon that runs on the Node.js platform and listens for statistics, like counters and timers, sent over UDP or TCP and sends aggregates to one or more pluggable backend services. It was originally developed as a front-end proxy for the Graphite/Carbon metrics server.

Setup

The statsd plugin is included with the AppOptics host agent by default, please follow the directions below to enable it for a host agent instance.

Prerequisites

You do not need to start up and configure the StatsD daemon beforehand. Once the statsd plugin is enabled, the listener will automatically start (default port 8125).

Configuration

The host agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent. To enable the plugin:

  1. Make a copy of the StatsD example configuration file /opt/appoptics/etc/plugins.d/statsd.yaml.example, renaming it to /opt/appoptics/etc/plugins.d/statsd.yaml:
$ sudo cp /opt/appoptics/etc/plugins.d/statsd.yaml.example /opt/appoptics/etc/plugins.d/statsd.yaml
  1. Update the /opt/appoptics/etc/plugins.d/statsd.yaml configuration file to customize settings for the StatsD listener service, for example:
collector:
# The statsd plugin runs a backgrounded statsd listener service.
statsd:
  all:
    ## Protocol, must be "tcp" or "udp" (default=udp)
    protocol: "udp"

    ## MaxTCPConnection - applicable when protocol is set to tcp (default=250)
    # max_tcp_connections: 250

    ## Address and port to host UDP listener on (default=":8125")
    service_address: ":8125"

    ## The following configuration options control when the plugin clears its cache
    ## of previous values. If set to false, then the plugin will only clear its
    ## cache when the daemon is restarted.
    ## Reset gauges every interval (default=true)
    # delete_gauges: true
    ## Reset counters every interval (default=true)
    # delete_counters: true
    ## Reset sets every interval (default=true)
    # delete_sets: true
    ## Reset timings & histograms every interval (default=true)
    # delete_timings: true

    ## Percentiles to calculate for timing & histogram stats
    # percentiles: "50,90,95,99"

    ## separator to use between elements of a statsd metric (default="_")
    # metric_separator: "_"

    ## Parses tags in the datadog statsd format (default=false)
    # parse_data_dog_tags: false

    ## Statsd data translation templates, more info can be read here:
    ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md#graphite
    # templates: |-
    #   cpu.* measurement*

    ## Number of UDP messages allowed to queue up, once filled,
    ## the statsd server will start dropping packets (default=10000)
    # allowed_pending_messages: 10000

    ## Number of timing/histogram values to track per-measurement in the
    ## calculation of percentiles. Raising this limit increases the accuracy
    ## of percentiles but also increases the memory usage and cpu time. (default=1000)
    # percentile_limit: 1000

load:
  plugin: snap-plugin-collector-bridge-statsd
  task: task-bridge-statsd.yaml
  1. Restart the host agent:
$ sudo service appoptics-snapteld restart
  1. Enable the StatsD plugin in AppOptics

    On the Integrations Page you will see the StatsD plugin available if the previous steps were successful. If you do not see the plugin, see Troubleshooting.

    Select the StatsD plugin to open the configuration menu in the UI, and enable the plugin.

Metrics

The StatsD plugin does not come with any default metrics, but supports all of the native StatsD metric types for custom metric submission.

Type Description
Counter Simple counter. At each flush the current count is sent and reset to 0
Gauge Constant data type. At each flush the last reported value during the period is sent
Set For counting the number of unique occurrences of events between flushes
Timer Tracking how long an event took, measured in milliseconds

Note

StatsD figures out percentiles, average (mean), standard deviation, sum, lower and upper bounds for the flush interval for timer metrics. In AppOptics, we group these calculations into a single measurement. This allows you to chart multiple data streams with only a single metric name.

To enable percentiles, uncomment percentiles in /opt/appoptics/etc/plugins.d/statsd.yaml.

## Percentiles to calculate for timing & histogram stats
# percentiles: "50,90,95,99"

To expose these stats as separate metrics, you can set bridge_use_json_fields to false in /opt/appoptics/etc/plugins.d/statsd.yaml.

However, please note that your monthly cost will increase as new metric streams are introduced.

Tags

The table below outlines the default set of tags provided for each metric.

Tag Name Description
hostname Name of the host. Instead of using this tag we recommend using the @host alias.
metric_type Type of the metric (one of counter, gauge, set, timing)