Collect data from any source

Open source emitters. APIs. New Relic agents. Get data from anywhere. 

New Relic products report a lot of data “out of the box.” When you use New Relic products like APM, Browser, MobileInfrastructure, 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. 

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

See the agent APIs.

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 New Relic 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.

Trace API

New Relic's 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)
    curl -i -H "Content-Type: application/json" \
     -H "Api-Key: [API KEY HERE]" \
     -H 'Data-Format: newrelic' \
     -H 'Data-Format-Version: 1' \
     -X POST \
     -d '[
             "common": {
               "attributes": {
                 "": "Test Service A",
                 "host": ""
             "spans": [
                 "": "123456",
                 "id": "ABC",
                 "attributes": {
                   "": 12.53,
                   "name": "/home"
                 "": "123456",
                 "id": "DEF",
                 "attributes": {
                   "": "Test Service A",
                   "host": "",
                   "": 2.97,
                   "name": "/auth",
                   "": "ABC"
         ]' ''

Metric API

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

curl -vvv -k -H "Content-Type: application/json" -H "Api-Key: ADD_KEY_HERE" -X POST --data ‘[{ "metrics":[{

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 in New Relic via NRQL. (Eventually, the Telemetry SDKs will support the Event API.)

# Hook into the runtime 'at_exit' event
at_exit do
  # Name the custom event
  payload = { 'eventType' => 'CLIRun' }

  # Check to see if the process is exiting due to an error
  if $!.nil? || $!.is_a?(SystemExit) && $!.success?
    payload[:status] = 0
    # Gather any known errors
    errors = ""
    (Thread.current[:errors] ||= []).each do |err|
      errors += "#{err}\n"
    payload[:errors] = errors

  # Send the errors to New Relic as a custom event
  insights_url = URI.parse("")
  headers = { "x-insert-key" => "YOUR_API_KEY", "content-type" => "application/json" }

  http =, insights_url.port)
  http.use_ssl = true
  request =, headers)
  request.body = payload.to_json

  puts "Sending run summary to Insights: #{payload.to_json}"
    response = http.request(request)
    puts "Response from Insights: #{response.body}"
  rescue Exception => e
    puts "There was an error posting to Insights. Error: #{e.inspect}"

Integrations SDK

Build out your own agent to get deep visibility into highly customized, unique, or legacy systems.

Using the Infrastructure Integrations SDK, you can get data from specific entities into New Relic without having to worry about timings of harvest cycles. The following example shows a custom Apache Integration built atop the Infrastructure Integrations SDK.


Code snippet from the Apache integration's main method in Go.

func main() {
  log.Debug("Starting Apache integration")
  defer log.Debug("Apache integration exited")

  integration, err := sdk.NewIntegration(integrationName, integrationVersion, &args)

  if args.All || args.Inventory {
    log.Debug("Fetching data for '%s' integration", integrationName+"-inventory")

  if args.All || args.Metrics {
    log.Debug("Fetching data for '%s' integration", integrationName+"-metrics")
    ms := integration.NewMetricSet("ApacheSample")
    provider := &Status{
      CABundleDir:  args.CABundleDir,
      CABundleFile: args.CABundleFile,
      HTTPTimeout:  defaultHTTPTimeout,
    fatalIfErr(getMetricsData(provider, ms))



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

Example of a JSON POST request.

   POST /log/v1 HTTP/1.1
   Content-Type: application/json
   Accept: */*
   Content-Length: 133
     "timestamp": 1550086450124,
     "message": "User 'xyz' logged in",
     "service": "login-service",
     "hostname": ""