You can collect StatsD metrics with the OpenTelemetry collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability backend).
Complete the steps below to collect StatsD metrics:
The collector will use the StatsD receiver component. It requires permission to listen on the configured endpoint (
localhost:8125 by default).
Download and install the OpenTelemetry collector following the OpenTelemetry docs.
You will need to install OpenTelemetry Collector Contrib Distro or other distribution including, at least, these components:
Update or create a new file called
config.yaml from the example below.
NEW_RELIC_LICENSE_KEY in the file with your own values. For more info, see the New Relic License key.
receivers:statsd:is_monotonic_counter: trueexporters:otlp:endpoint: https://otlp.nr-data.net:443headers:api-key: NEW_RELIC_LICENSE_KEYservice:telemetry:logs:pipelines:metrics:receivers: [statsd]exporters: [otlp]
For further configuration options, please review:
Run the OpenTelemetry collector (the way to run it may vary depending on the chosen installation method). Example:
/usr/bin/otelcol-contrib --config ./config.yaml
The collector will report the metrics ingested using StatsD messages, please review:
You can list the metrics being reported by the statsd receiver:
FROM Metric SELECT uniques(metricName) WHERE otel.library.name = 'otelcol/statsdreceiver' LIMIT MAX