The second version of our StatsD integration was released on May 25 2020. It's an improvement on our first StatsD integration. Improvements include: simpler configuration, and a simpler method for adding tags (key-value pairs).
Our StatsD integration (version 2) lets you easily get StatsD-format data into New Relic. You can also add any arbitrary tags (key-value pairs) to your data. Once your metrics are in New Relic, you can query your data and create custom charts and dashboards.
The integration adheres to the Metric API requirements and data limits. The default rate limit is 100,000 data points per minute (DPM). If you think you're missing metrics or sending more than 100K DPM, see Request data changes. To see if your account is hitting the rate limit, run the following NRQL query:
SELECT count(*) FROM NrIntegrationErrorWHERE newRelicFeature ='Metrics'FACET category, messageLIMIT 100 since 1 day ago
This section will explain how to do a standard install. If you want to run StatsD in Kubernetes, see Kubernetes install.
docker run \ -d --restart unless-stopped \ --name newrelic-statsd \ -h $(hostname) \ -e NR_ACCOUNT_ID=YOUR_ACCOUNT_ID \ -e NR_API_KEY=YOUR_INSERT_API_KEY \ -p 8125:8125/udp \ newrelic/nri-statsd:2.0.0
If your account is in the EU data center region, add this to the above command:
-e NR_EU_REGION=true \
After installing, you can:
Here are examples of Kubernetes manifests for deployment and service objects:
In the install procedure, you run
nri-statsd with environment variables, and this generates a TOML configuration file. Additionally, you can set these configuration options:
If a metric is not updated for this amount of time, we stop reporting that metric. Default is
If you want to send the metrics only if the value was updated between the flush intervals, configure this to
list of integers
Specifies the percentiles used for metrics aggregation. Default:
Indicates address on which to listen for metrics. Default:
To ensure FedRAMP compliance when using the StatsD integration you must define the following endpoints in the custom configuration:
address = 'https://gov-insights-collector.newrelic.com/v1/accounts/ $NR_ACCOUNT_ID/events'
address-metrics = 'https://gov-infra-api.newrelic.com/metric/v1'
Here are some examples of customizing configuration by overwriting the default configuration:
The integration receives metrics using the StatsD protocol. Optionally, the sample rate can be configured and tags can be added.
Here's the metric data format we use:
<metric name>:<value>|<type>|@<sample rate>|#<tags>
Here are explanations of these fields:
Required. Name of the metric.
Required. The metric type:
Optional for simple counters or timer counters. When many metrics must be sent, you can use sampling to reduce network traffic. The downside is a reduction in the resolution of the data.
An example of how this would work for sample rates below
Optional. Tags attached to your metrics are converted into attributes (key-value pairs). For more on tagging options, see Tags.
Here are the types of metrics and how to format them:
You can add tags to your data, which we save as attributes (key-value pairs). There are two options for adding tags:
- Add default tags that apply to all metrics: These apply to all metrics. They are fixed and don't change over time.
- Add metric-level tags: These apply to specific metrics and allow the value to be changed between two submits.
Here's an example NRQL query that includes a custom tag:
SELECT count(*) FROM Metric WHERE environment = 'production'
You can alert on StatsD data using NRQL alert conditions.
SELECT count(*) FROM Metric WHERE metricName = 'myMetric' and environment = 'production'
For more on how to query the
Metric data type, see Query metric data.
This integration is open source software. That means you can browse its source code and send improvements, or create your own fork and build it.