New Relic's Metric API can be used to send metric data to New Relic from a variety of sources. This API is how metrics from some of our integrations and exporters get into New Relic.
What is the Metric API?
The Metric API is a way to get metric data into New Relic. The API works by sending a POST request to our HTTP endpoint with a JSON payload containing the metric data.
The Metric API is how metrics are ingested from some of our integrations, including our open source exporters (like DropWizard, OpenCensus, and Prometheus). The Metric API is also used by our Telemetry SDKs, which are language-specific tools that make it easier to use our data-ingest APIs.
The Metric API can be used to:
- Report metric data to New Relic without a New Relic agent.
- Integrate metric data from an open source or in-house developed tool, library, or framework.
- Fully control the metric data you're sending, including the resolution and associated dimensions.
- Leverage the power of NRQL, New Relic's query language, for querying your metric data.
- Set up alerts for your metric data.
If we don't have an existing integration that meets your metric-reporting needs, you have two options:
- Use our Telemetry SDKs, which are language-specific tools that help you send us metrics and other data.
- Use the Metric API directly.
Access and requirements
Find and use your data
You can find data sent via the Metric API (including from integrations that use this API) in these locations:
From one.newrelic.com, select Entity explorer and look for your service.
By querying the
Metricdata type. For example, you can use NRQL to run:
SELECT * FROM Metric
Alert on metric data
To alert on metrics created with the Metric API, use NRQL alert conditions: Select the NRQL category when defining your condition, then use the
FROM Metric ... NRQL query syntax to express it. When you create these alert conditions, Alerts automatically uses the finest granularity data available (the raw metric data points) to evaluate alerts.
All raw metric data points will be retained for 30 days. All additional aggregated data derived from the raw metric data points (for example, one-minute rollups) will be retained for 13 months. Any change to the retention period beyond such periods may result in a charge to you.
If receive an
NrIntegrationError, see Troubleshoot a