devops4 min read

New Relic Tutorial: Learn APM from Scratch (2026)

New Relic Tutorial: Learn APM from Scratch (2026)

Published:  |  Category: Devops  |  Reading time: ~15 min
New Relic Tutorial: Learn APM from Scratch (2026)

When troubleshooting a production performance issue that only happens under real traffic, application-level metrics are essential. New Relic provides Application Performance Monitoring (APM) that traces every transaction, identifies slow database queries, and maps service dependencies.

By the end of this tutorial, you will know how to instrument applications with New Relic agents, set up distributed tracing, create custom dashboards with NRQL, and configure alerts for application performance degradation.

New Relic Architecture and Agent Installation

New Relic uses agents that instrument applications and send telemetry to the New Relic platform. Agents are available for Java, .NET, Node.js, Python, Ruby, PHP, and Go. Installation adds the agent library and configuration with a license key or API key. The agent starts collecting transactions, errors, and system metrics automatically.

npm install newrelic
# Add to main file: require('newrelic');
export NEW_RELIC_LICENSE_KEY=your_license_key
export NEW_RELIC_APP_NAME=MyApp
# Verify: tail -f newrelic_agent.log

Distributed Tracing and Service Maps

Distributed tracing tracks requests across microservices. New Relic traces propagate headers between services and show the complete request path in the Distributed Tracing UI. Service maps visualize dependencies between services, showing request rates, error rates, and latency at each hop.

# Enable distributed tracing in newrelic.js or env vars:
export NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true
# View: APM -> Select service -> Distributed tracing
# Service map: APM -> Service Map

Transaction Monitoring and Transaction Traces

Transactions represent the key operations in your application — web requests, background jobs, database calls. New Relic shows throughput, error rate, and average/apdex response time for each transaction. Transaction traces capture a detailed waterfall of every call within a slow transaction.

# Query transaction traces via NRQL:
SELECT * FROM TransactionTrace WHERE appName = 'MyApp'
LIMIT 10 SINCE 1 hour ago
# View in UI: APM -> Select app -> Transactions -> Traces

Custom Metrics, Events, and NRQL

NRQL (New Relic Query Language) queries all telemetry data. Custom metrics and events can be reported via the agent API or the Metric API. I use custom events for business metrics: signups, orders, payment failures. NRQL supports aggregation, filtering, faceting, and time-series queries.

SELECT average(duration) FROM Transaction
WHERE appName = 'MyApp' FACET name
TIMESERIES auto SINCE 1 hour ago
# Custom event:
newrelic.recordCustomEvent('Order', { amount: 49.99, currency: 'USD' })

New Relic Infrastructure and Browser Monitoring

New Relic Infrastructure monitors hosts and containers without separate agents — it uses the same agent as APM. Browser monitoring captures frontend performance: page load timing, JavaScript errors, AJAX call durations. Session trace shows individual user interactions.

# Infrastructure: install infrastructure agent
curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash
# Browser monitoring: add JavaScript snippet
# APM -> App -> Settings -> Browser monitoring -> Copy snippet

Alerts, Workflows, and AIOps

New Relic alert policies define conditions that trigger notifications. NRQL alert conditions write a query and set thresholds. Workflows route alerts to destinations: email, Slack, PagerDuty, webhooks. Applied Intelligence correlates related alerts into incidents and uses AI to reduce noise.

# NRQL alert condition:
SELECT average(duration) FROM Transaction
WHERE appName = 'MyApp' FACET name
EXTRAPOLATE SINCE 5 minutes ago
# UI: Alerts & AI -> Alert Conditions -> Create NRQL condition
# Configure workflows and notification channels

Frequently Asked Questions

What is the difference between New Relic and Datadog?

Both are full-stack observability platforms. New Relic originated with APM and has strong application-level tracing. Datadog has stronger infrastructure monitoring and log management. Pricing models differ significantly.

How much does New Relic cost?

New Relic offers a free tier with 100 GB/month of data ingestion. Paid plans start at $0.25 per GB ingested. APM Pro includes all features with per-host pricing for higher volumes.

Does New Relic support OpenTelemetry?

Yes. New Relic accepts OTLP data from OpenTelemetry SDKs and collectors. This allows you to use OpenTelemetry instrumentation and send data to New Relic without the proprietary agent.

How do I reduce New Relic data ingestion costs?

Use sampling for traces, drop high-volume low-value metrics, set up cap management in the UI, and use NRQL to query only necessary data. The data management dashboard shows ingestion breakdown.

Originally published on Ayodhyyya. Last updated June 1, 2026.