RousselTMLEARNING

Article · New Relic: from discovery to expertise

APM: agents, OpenTelemetry and traces

1. APM agents #

Automatic instrumentation per language.

Principle #

Agent cycle

An APM agent loads into the application process and automatically instruments known frameworks (web servers, HTTP clients, databases, message queues). It aggregates measurements and sends them roughly every minute (harvest cycle).

LanguageInstallationSpecifics
Java-javaagent:newrelic.jarbytecode instrumentation
.NETCLR profiler (installer or NuGet package).NET Framework and .NET Core
Node.jsnpm install newrelic + node -r newrelicmust load before any other module
Pythonpip install newrelic + newrelic-admin run-programno code change
Ruby, PHPgem / PHP extension + daemonthe PHP daemon batches sends
GoGo modulemanual in-code instrumentation (no dynamic loading)

Configuring a Python agent #

pip install newrelic==14.3.0
export NEW_RELIC_LICENSE_KEY=<license key>
export NEW_RELIC_APP_NAME=boutique
newrelic-admin run-program gunicorn app:app --bind 0.0.0.0:8000
  • Configuration uses a file (newrelic.ini, newrelic.yml…) or NEW_RELIC_* variables, handier in containers.
  • The application name groups every instance reporting under the same name; several names separated by ; allow an extra rollup.
  • The region (US or EU) is derived from the license key.
Best practice : Pin the agent version in your dependencies and update it regularly: each release adds frameworks and fixes vulnerabilities.

2. Transactions, Apdex and errors #

Measuring what the user experiences.

Transactions and Apdex #

A transaction is a complete unit of work: web request or background job. It breaks down into segments (code, database, external calls) visible in the breakdown and in transaction traces captured for the slowest ones (by default above 4 × T).

Apdex classCondition (T = 0.5 s by default)
Satisfied≤ T
Toleratingbetween T and 4T
Frustrated> 4T or error

Score = (satisfied + tolerating / 2) / total, between 0 and 1. Adjust T per application to the expected latency.

Errors #

  • Unhandled exceptions and HTTP error codes are recorded as TransactionError.
  • Expected errors (validation, business 404) stay visible but affect neither error rate nor Apdex; ignored errors are not recorded.
  • Errors inbox groups errors by fingerprint across services, lets you assign them, mark them resolved and be notified if they come back.

3. Distributed tracing #

Following a request end to end.

Propagation #

Distributed trace
  • Recent agents enable distributed tracing by default and propagate W3C Trace Context (traceparent, tracestate) alongside the newrelic header: a trace can cross services instrumented by New Relic and by OpenTelemetry.
  • Default sampling is adaptive head-based; Infinite Tracing sends every span to a trace observer that keeps interesting traces (errors, slowness) afterwards (tail-based).
  • The service map and Dependencies view are built from this data.

Enriching data #

import newrelic.agent

@app.post('/order')
def order():
    newrelic.agent.add_custom_attribute('customer.plan', customer.plan)       # attribute on the Transaction
    newrelic.agent.record_custom_event('Order', {'amount': total, 'country': country})  # new NRQL event
    ...

Custom attributes become NRQL dimensions (FACET customer.plan); custom events create a new queryable type (FROM Order).

Watch out : Do not record personal data (e-mail, card) in attributes: use agent exclusion rules or obfuscation rules.

4. OpenTelemetry with New Relic #

The open standard, natively accepted.

Sending OTLP #

export OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net        # EU: https://otlp.eu01.nr-data.net
export OTEL_EXPORTER_OTLP_HEADERS="api-key=$NEW_RELIC_LICENSE_KEY"
export OTEL_SERVICE_NAME=payment
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
opentelemetry-instrument python app.py
  • Ports 4317 (gRPC) and 4318 (HTTP); the api-key header carries a license key.
  • New Relic recommends delta temporality for metrics; with a Collector, the cumulativetodelta processor does the conversion.
  • The service entity is created from the service.name resource attribute.

Agent or OpenTelemetry? #

CriterionNew Relic agentOpenTelemetry
Getting startedvery simple, full experiencesSDK and Collector to configure
Specific featuresthread profiler, application security, automatic logs in contextdepends on instrumentation libraries
PortabilityNew Relic specificswitch backend without re-instrumenting
Best practice : Both mix fine in the same system thanks to W3C context: keep agents where they bring the most, OpenTelemetry for new services.

Deployments #

Record every release (change tracking) from CI, via NerdGraph or the CLI: markers appear on APM charts and the comparison view shows the impact on latency and errors.

Commands to know #

Commands to know
  • newrelic-admin run-program <commande> : run an instrumented Python application
  • java -javaagent:/opt/newrelic/newrelic.jar -jar app.jar : load the Java agent
  • node -r newrelic server.js : load the Node.js agent
  • OTEL_EXPORTER_OTLP_HEADERS="api-key=…" : authenticate OTLP export
  • SELECT apdex(duration, t: 0.5) FROM Transaction FACET appName : Apdex per application

Sources #

Checked in November 2026: New Relic evolves its platform continuously (UI, plans, limits); check the documentation before relying on a detail.

📄 New Relic APM: agents, OpenTelemetry and distributed traces →

My progress

  • ⏱ Estimated time : ≈ 7 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

New Relic: the observability platform at a glance

Discover New Relic: history, the unified platform and NRDB, MELT data types, entities and golden ...

Datadog APM and OpenTelemetry: traces, services and correlation with logs

Instrument applications for Datadog APM (dd-trace, single step instrumentation, OpenTelemetry), u...

Infrastructure, logs and Kubernetes with New Relic

Monitoring servers, containers and Kubernetes with New Relic: infrastructure agent, on-host integ...

OpenTelemetry: automatic vs manual instrumentation

Understand the differences between automatic and manual instrumentation with OpenTelemetry, their...

Sending traces to Tempo: OpenTelemetry instrumentation and Alloy

Produce and route traces to Tempo: Python/Java/Node auto-instrumentation, the manual SDK, OTEL en...

OpenTelemetry traces in Elasticsearch and Kibana APM

Instrument applications with OpenTelemetry or EDOT SDKs, send traces to Elasticsearch, get Kibana...

OpenTelemetry traces in depth: spans, status, events, links and sampling

Master the trace signal: anatomy of a distributed trace, span and SpanKind, attributes, status an...

OpenTelemetry and Dynatrace: OTLP, collector and instrumentation

Integrate OpenTelemetry with Dynatrace: OTLP endpoint and tokens, Dynatrace OTel Collector, trace...

Elastic Observability: logs, infrastructure, APM and synthetics

Elastic Observability features: log exploration, infrastructure inventory with Elastic Agent and ...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!