• /
  • ログイン
  • 無料アカウント

StatsD monitoring integration (version 2)

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).

Features

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.

Requirements

This integration uses our Metric API and our Event API to ingest data. To use these APIs, you'll need an Insert API key.

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 NrIntegrationError
WHERE newRelicFeature ='Metrics'
FACET category, message
LIMIT 100 since 1 day ago

Install

This section will explain how to do a standard install. If you want to run StatsD in Kubernetes, see Kubernetes install.

To install the StatsD integration, run the following command and include your New Relic account ID and New Relic Insert API key. This generates a TOML configuration file used by gostatsd.

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:

Install for Kubernetes

Here are examples of Kubernetes manifests for deployment and service objects:

Configure

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:

Configuration options

Description

expiry-interval

string

If a metric is not updated for this amount of time, we stop reporting that metric. Default is 5m.

If you want to send the metrics only if the value was updated between the flush intervals, configure this to 1ms. To never expire metrics, set it to 0.

percent-threshold

list of integers

Specifies the percentiles used for metrics aggregation. Default: 90.

metrics-addr

string

Indicates address on which to listen for metrics. Default: :8125.

ヒント

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:

Metric format

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:

Field name

Description

<metric name>
string

Required. Name of the metric.

<value>
string

Required. The metric type:

  • c = counter
  • g = gauge
  • ms = timer

@<sample rate>
float

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 1: If you set this to 0.1, the counter would send a measurement one out of every 10 times.

#<tags>
string

Optional. Tags attached to your metrics are converted into attributes (key-value pairs). For more on tagging options, see Tags.

Metric types

Here are the types of metrics and how to format them:

Add tags (attributes)

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'

Create alerts

You can alert on StatsD data using NRQL alert conditions.

Find and use data

To query your data, you'd use any New Relic query option. For example, you might run a NRQL query like:

SELECT count(*) FROM Metric WHERE metricName = 'myMetric' and environment = 'production'

For more on how to query the Metric data type, see Query metric data.

Check the source code

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.

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.