• Log in
  • Sign up

Collect data from any source

15 min

New Relic products report a lot of data “out of the box.” When you use products like APM, Browser, Mobile, Infrastructure monitoring, or an integration, by default you receive 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 6

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 the our APM Python agent, you can use the Python agent API to set up custom instrumentation.

See the agent APIs.

Step 2 of 6

Telemetry SDK

Our Telemetry SDKs are language wrappers for our Trace API and Metric API (and eventually our Log API and Event API). These SDKs let you easily send metrics and trace data to New Relic without needing to install an agent. For customers, we offer open-source exporters and integrations that use the Telemetry SDKs to send metrics and trace data:

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

Step 3 of 6

Trace API

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: $INSIGHTS_INSERT_API_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 4 of 6

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: $INSIGHTS_INSERT_API_KEY" \
>
-d '[
$
{
$
"metrics": [
$
{
$
"name": "memory.heap",
$
"type": "gauge",
$
"value": 2.3,
$
"timestamp": 1531414060739,
$
"attributes": {
$
"host.name": "dev.server.com"
$
}
$
}
$
]
$
}
$
]'
Step 5 of 6

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 "x-insert-key: $INSIGHTS_INSERT_API_KEY" \
>
-d '[
$
{
$
"eventType": "LoginEvent",
$
"service": "login-service",
$
"customerId": "xyz"
$
}
$
]'
Step 6 of 6

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 -i -X POST https://log-api.newrelic.com/log/v1 \
>
-H "Content-Type: application/json" \
>
-H "Api-Key: $INSIGHTS_INSERT_API_KEY" \
>
-d '[
$
"logs": [
$
{
$
"timestamp": 1593538496000,
$
"message": "User xyz logged in",
$
"service": "login-service",
$
"hostname": "login.example.com"
$
}
$
]
$
]'
Edit this pageCreate an issue
Copyright © 2020 New Relic Inc.

This site uses cookies 🍪

We use cookies and other similar technologies ("Cookies") on our websites and services to enhance your experience and to provide you with relevant content. By using our websites and services you are agreeing to the use of cookies. You can read more here. If you consent to our cookies, please click Yes.