New Relic

monitoring platformAPMobservabilityperformance monitoringapplication monitoringinfrastructure monitoring

Monitoring Platform

New Relic

Overview

New Relic is a cloud-based observability platform that provides a comprehensive solution integrating Application Performance Monitoring (APM), infrastructure monitoring, and digital experience monitoring. As a veteran in the APM field, it maintains a stable position with high ratings for UI usability and easy setup, particularly popular among mid-sized enterprises.

Details

New Relic leads the industry as a pioneer in Application Performance Monitoring (APM), particularly excelling in deep code-level diagnostics and unified user interface design that correlates user experience with backend performance.

Key Features

  • APM (Application Performance Monitoring): Deep code-level diagnostics and performance analysis
  • Infrastructure Monitoring: Comprehensive monitoring of servers, containers, and cloud services
  • Browser Monitoring: Real User Monitoring (RUM) and frontend performance
  • Synthetic Monitoring: Automated website and API availability monitoring
  • Mobile Monitoring: iOS/Android app performance and crash analysis
  • AI/Machine Learning: Anomaly detection and incident correlation
  • Distributed Tracing: Detailed transaction tracking across microservices

Technical Features

  • Unified Platform: Single-pane-of-glass operation with all features integrated
  • Easy Deployment: Simple agent-based setup process
  • Predictable Pricing: Usage-based yet predictable pricing structure
  • Rich Query Capabilities: Flexible data analysis with NRQL (New Relic Query Language)
  • Dashboards: Customizable real-time dashboards

Pros and Cons

Pros

  • Rich track record and mature functionality in APM field
  • Intuitive and user-friendly interface
  • Quick and easy setup process
  • Unified platform managing all features
  • Predictable pricing structure
  • Powerful query language (NRQL)
  • Correlation analysis between user experience and backend performance

Cons

  • Limited infrastructure monitoring compared to Datadog
  • Cost escalation in large-scale environments
  • Somewhat limited customization capabilities
  • Slower adoption of newer technologies
  • Data retention period limitations

References

Setup and Monitoring Examples

Basic Setup

# New Relic agent setup for Ruby applications
gem 'newrelic_rpm'

# Manual start (if needed)
NewRelic::Agent.manual_start

Metrics Collection

# Custom metrics submission in Python
import newrelic.agent

# Record custom metrics
newrelic.agent.record_custom_metric('Custom/Users/SignupCount', 1)

# Transaction tracing
@newrelic.agent.function_trace(name='Custom/MyFunction')
def my_function():
    # Business logic
    pass

# Background task monitoring
@newrelic.agent.background_task(name='Custom/BackgroundTask')
def background_task():
    # Background processing
    pass

Alerting Configuration

// Create alert condition via New Relic API
const alertCondition = {
  "condition": {
    "type": "apm_app_metric",
    "name": "High Response Time",
    "enabled": true,
    "entities": ["12345"],
    "metric": "response_time_web",
    "condition_scope": "application",
    "terms": [
      {
        "duration": "5",
        "operator": "above",
        "priority": "critical",
        "threshold": "0.5",
        "time_function": "all"
      }
    ]
  }
};

Dashboard Creation

// New Relic One Dashboard creation
const dashboard = {
  "dashboard": {
    "title": "Application Performance Dashboard",
    "description": "Monitor application key metrics",
    "permissions": "PUBLIC_READ_WRITE",
    "pages": [
      {
        "name": "Application Overview",
        "widgets": [
          {
            "title": "Response Time",
            "visualization": {
              "id": "viz.line"
            },
            "rawConfiguration": {
              "nrqlQueries": [
                {
                  "query": "SELECT average(duration) FROM Transaction WHERE appName = 'MyApp' TIMESERIES"
                }
              ]
            }
          }
        ]
      }
    ]
  }
};

Log Analysis

# New Relic Logs configuration
# Using fluentd plugin example
<match **>
  @type newrelic
  license_key YOUR_LICENSE_KEY
  <buffer>
    @type file
    path /var/log/fluentd-buffers/newrelic.buffer
    flush_mode interval
    flush_interval 5s
  </buffer>
</match>

Integration Setup

# New Relic Infrastructure Agent configuration
# /etc/newrelic-infra/integrations.d/nginx-config.yml
integration_name: com.newrelic.nginx

instances:
  - name: nginx-server-metrics
    command: status_url
    arguments:
      status_url: http://127.0.0.1/nginx_status
      remote_monitoring: true
    labels:
      env: production
      role: load_balancer
      
  - name: nginx-server-inventory
    command: inventory
    arguments:
      config_path: /etc/nginx/nginx.conf
    labels:
      env: production
      role: load_balancer

NRQL Query Examples

-- Monitor application error rate
SELECT percentage(count(*), WHERE error IS true) 
FROM Transaction 
WHERE appName = 'MyApp' 
SINCE 1 hour ago 
TIMESERIES

-- Database query performance
SELECT average(duration) 
FROM DatabaseSample 
WHERE provider = 'MySQL' 
FACET query 
SINCE 1 day ago 
LIMIT 10

-- Infrastructure resource utilization
SELECT average(cpuPercent), average(memoryUsedPercent) 
FROM SystemSample 
WHERE hostname LIKE 'web-%' 
SINCE 30 minutes ago 
TIMESERIES