Skip to main content
This guide shows how to route New Relic telemetry from a Python app through Sawmills. For collector endpoint exposure, first complete How to send data to the Sawmills collector.
Note: This guide covers the New Relic Python APM language agent (and, optionally, the standalone Telemetry SDK). It does not cover the New Relic Infrastructure agent. For Infrastructure setup, see New Relic Infrastructure agent.

Prerequisites

  • A running Sawmills Collector with a New Relic source configured
  • A New Relic license key
  • A Python app instrumented with the New Relic Python agent (newrelic)

Environment Variables

Unlike the Java agent — which splits timeslice and dimensional metrics across two hosts — the New Relic Python agent sends its telemetry to a single host, so one variable, NEW_RELIC_HOST, points the agent at Sawmills. Your <collector-id> is shown in the Sawmills UI under your pipeline’s collector details.
The New Relic source processes the APM agent’s timeslice metrics (metric_data) and forwards them to New Relic. Other APM payloads the agent sends over this connection — transaction traces, custom/analytics events, error data, and span events — are acknowledged by the collector but not forwarded. Route through Sawmills for APM metrics; if you depend on traces, events, or errors in New Relic, those are not preserved on this path today.
NEW_RELIC_HOST for the Python agent is a hostname only — do not include a scheme (https://) or a :port suffix. The Python agent does not read NEW_RELIC_METRICS_HOST (that variable is Java/Telemetry-SDK only); setting it here has no effect.

Port

The Sawmills collector receives the New Relic protocols on a dedicated port (the source’s default is 14275; your collector may differ). Find the exact value under New Relic ingestion endpoints → APM agent in the collector details in the Sawmills UI — copy the host:port shown there. The Python agent takes the host and port as separate settings and defaults to 443 when no port is given, so set the port explicitly to match your collector endpoint. In newrelic.ini:
Or via environment variable:

Configure the Python app

Start the app under the New Relic admin wrapper so the agent is initialized:
For Kubernetes, inject the values from a ConfigMap and Secret:
Restart the deployment after changes:

Telemetry SDK (optional)

If your app uses the standalone New Relic Telemetry SDK for Python (newrelic-telemetry-sdk) to send dimensional metrics directly to the Metric API — separate from the APM agent — point its client host at the collector when you construct it:
Most Python APM users do not use the Telemetry SDK; skip this section if you only instrument with the newrelic agent.

Verify

  1. Check application logs for the agent connecting to your Sawmills collector endpoint (look for a line reporting the reporting host on agent startup).
  2. Validate data in New Relic. The New Relic source forwards only the APM agent’s metric_data (timeslice metrics), which New Relic stores as Metric — so query the Metric type, not Transaction:

Troubleshooting