Install New Relic on Your Application
Install and configure the New Relic monitoring agent on your application to measure and improve performance, with step-by-step instructions for multiple runtimes.
Prerequisites
- A New Relic account (create one at newrelic.com )
- Your New Relic License Key (found under Account settings)
- Access to restart or redeploy your application
Step 1 — Get Your License Key
- Log into your New Relic account.
- Navigate to Account settings.
- Copy your License Key — you'll need it for the agent configuration.
Step 2 — Install the Agent
Choose the agent for your runtime:
- Node.js
- Python
- Java
npm install newrelic --save
Create newrelic.js in the root of your project:
exports.config = {
app_name: ['Your App Name'],
license_key: process.env.NEW_RELIC_LICENSE_KEY,
logging: {
level: 'info',
},
};
Require the agent at the very top of your entry file:
require('newrelic');
// rest of your app
pip install newrelic
Generate a config file:
export NEW_RELIC_LICENSE_KEY=your-license-key
newrelic-admin generate-config $NEW_RELIC_LICENSE_KEY newrelic.ini
Run your app through the agent:
NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program python app.py
Add the agent JAR to your startup command:
java -javaagent:/path/to/newrelic.jar -jar your-app.jar
Configure newrelic.yml with your license_key and app_name.
Step 3 — Restart the Application
Once the agent is configured, restart or redeploy your application. New Relic will start sending data to your account within a few minutes.
Monitoring Alternatives
| Tool | Strengths | Considerations |
|---|---|---|
| New Relic | Easy setup, broad language support | Cost at scale |
| Datadog | Excellent multi-cloud and integrations | Can be costly at scale |
| Dynatrace | AI-driven auto-optimization | Steeper learning curve |
| AppDynamics | Deep performance analytics | Requires detailed initial config |
Best Practices
- Continuous monitoring: Regularly review metrics and configure alerts to respond quickly to incidents.
- Cost analysis: Re-evaluate your plan as application traffic grows to avoid unexpected charges.
- Keep configuration updated: Revisit agent settings after significant application changes.
- Follow official docs: Always check New Relic's documentation for the latest agent versions and configuration options.