StatsD Configuration
StatsD Statistics
The statsd top-level configuration object is used to define a destination for the delivery of statistics counters in
StatsD format. Statistics counter values are only stored in memory and will be lost
when N2SVCD is restarted. If you wish to maintain a permanent record of statistics counters then you must deliver
output statistics to a separate StatsD server (such as Telegraf or Prometheus).
An example StatsD configuration using Telegraf-specific output might be:
<statsd>
<host>localhost</host>
<tags>
<tag name="foo" value="bar"/>
<tag name="foo2" value="bar2"/>
</tags>
</statsd>
Configuration Details
The statsd configuration object supports the following attributes:
| Attribute | Type | Description |
|---|---|---|
host |
String | IPv4 hostname or A.B.C.D address for the UDP StatsD destination. (Default = 127.0.0.1) |
port |
Integer | Port number for UDP StatsD destination. (Default = 8125) |
prefix |
String | Common prefix to put on all StatsD statistics. If defined and not an empty string, will have a period appended to it if not already present. Prefix population is not affected by the unique parameter/(Default = empty string, do not use prefix) |
unique |
String | Whether statistic names are forced to be unique. If truthy, application names (and indexes when repeated) are prepended to the statistic name along with the prefix, if any.Otherwise, application names/indexes are automatically sent in tags along with any other specific configured or product tags. The prefix, if any, is sent regardless.(Default: 0, do not make statistic names unique) |
tags |
Array | Additional static tags to be sent for all statistics. Each tag must specify a name and a value. Configured tags may be overridden at runtime. |
All attributes other than tags and the content of each tag value may be evaluated.
Automatic Statistic Tags
The following tags are always populated:
module: the application module.
When unique is not truthy, the following tags are populated automatically:
app: the configured application name.app_instance: the application index, if repeated.
All automatically-added tag names may not be defined manually.
Statistic Output
The configuration parameter unique is used to define the output statistic names.
For example, consider the following statistic details:
- Statistic name:
some.statistic - Raising application name:
Some Application - Raising application module:
SomeModule - Raising application index:
1(repeated) - Hostname:
somehost
With all other values as the default, this statistic would be sent in each mode as:
uniqueis truthy:n2svcd.somehost.Some Application_1.some.statisticwith tagmodule:SomeModuleuniqueis not truthy:n2svcd.somehost.some.statisticwith tags:app:Some Applicationapp_instance:1module:SomeModule
If the application were not repeated, the output would be:
uniqueis truthy:n2svcd.somehost.Some Application.some.statisticwith tagmodule:SomeModuleuniqueis not truthy:n2svcd.somehost.some.statisticwith tags:app:Some Applicationapp_instance: (not sent)module:SomeModule