Collect data from any source

New Relic products report a lot of data “out of the box.” When you use monitoring solutions like APM, browser monitoring, mobile monitoring, infrastructure monitoring, or any of our integrations, by default you receive various types of performance data.

But you may want to bring data into New Relic that isn't collected by default. Maybe you want an API-based solution that doesn't require install of an agent. Maybe you want to bring telemetry data from another analysis service into New Relic. This page describes several ways to get data into New Relic.

Step 1 of 7

Agent APIs

If you use our APM, browser, or mobile agents to report data, you can use their associated APIs to report custom data. For example, if you monitor your application with our APM Python agent, you can use the Python agent API to set up custom instrumentation.

See the agent APIs.

Step 2 of 7

Telemetry SDKs

Our Telemetry SDKs are language wrappers for our ingest APIs. These SDKs let you easily send metrics and trace data to New Relic without needing to install an agent. We offer open-source exporters and integrations that use our Telemetry SDKs to report metrics and trace data. Some of these solutions are:

Want to build your own solution? See our Telemetry SDK docs.

Step 3 of 7

Report custom infrastructure data

If our infrastructure integrations don't meet your needs, you can use our Flex integration to report any type of infrastructure-related metrics or configuration settings to New Relic.

Step 4 of 7

Custom distributed tracing solutions

Our Trace API lets you send distributed tracing data to New Relic and consolidate tracing data from multiple sources in one place. We accept trace data in two formats:

  • Zipkin format
  • New Relic format (if you don’t have Zipkin-format data, you’d use this)
bash
$
curl -i -X POST https://trace-api.newrelic.com/trace/v1 \
>
-H "Content-Type: application/json" \
>
-H "Api-Key: $LICENSE_KEY" \
>
-H 'Data-Format: newrelic' \
>
-H 'Data-Format-Version: 1' \
>
-d '[
$
{
$
"common": {
$
"attributes": {
$
"service.name": "Test Service A",
$
"host": "host123.test.com"
$
}
$
},
$
"spans": [
$
{
$
"trace.id": "123456",
$
"id": "ABC",
$
"attributes": {
$
"duration.ms": 12.53,
$
"name": "/home"
$
}
$
},
$
{
$
"trace.id": "123456",
$
"id": "DEF",
$
"attributes": {
$
"service.name": "Test Service A",
$
"host": "host456.test.com",
$
"duration.ms": 2.97,
$
"name": "/auth",
$
"parent.id": "ABC"
$
}
$
}
$
]
$
}
$
]'
Step 5 of 7

Metric API

You can use our Metric API to send metric data to New Relic from any source.

bash
$
curl -i -X POST https://metric-api.newrelic.com/metric/v1 \
>
-H "Content-Type: application/json" \
>
-H "Api-Key: $LICENSE_KEY" \
>
-d '[
$
{
$
"metrics": [
$
{
$
"name": "memory.heap",
$
"type": "gauge",
$
"value": 2.3,
$
"timestamp": 1531414060739,
$
"attributes": {
$
"host.name": "dev.server.com"
$
}
$
}
$
]
$
}
$
]'
Step 6 of 7

Event API

For sending arbitrary events to New Relic, you can use our Event API. We save these events as a new event type, which can then be queried via NRQL. (Eventually, the Telemetry SDKs will support the Event API.)

bash
$
curl -i -X POST https://insights-collector.newrelic.com/v1/accounts/$ACCOUNT_ID/events \
>
-H "Content-Type: application/json" \
>
-H "Api-Key: $LICENSE_KEY" \
>
-d '[
$
{
$
"eventType": "LoginEvent",
$
"service": "login-service",
$
"customerId": "xyz"
$
}
$
]'
Step 7 of 7

Log API

If our existing logging integrations don’t meet your needs, you can use our Log API to send any arbitrary log data to New Relic. (Eventually, the Telemetry SDKs will support the Log API.)

bash
$
curl --location --request POST 'https://log-api.newrelic.com/log/v1' \
>
--header 'X-License-Key: $License_Key' \
>
--header 'Content-Type: application/json' \
>
--data-raw '[{
$
"logs": [{
$
"message": "User xyz logged in",
$
"service": "login-service",
$
"hostname": "login.example.com"
$
}]
$
}]'