Saturday, February 8, 2025

APM - New Relic | Overview & Hands-On.

Application Performance Monitoring (APM) - New Relic - Overview

Focus:

    • Framed for:
      • DevOps  
      • Cloud  
      • SRE

Scope:

  • Intro,
  • Key Features and Functionality,
  • Management and Configuration,
  • key questions addressed by APM.
  • Summary of New Relic APM Features
  • Application Performance & Bottlenecks questions,
  • Infrastructure & Resource Utilization questions,
  • Errors & Failures questions,
  • Distributed Tracing & Dependencies questions,
  • Alerting & Incident Response questions,
  • Deployment & Change Analysis questions,
  • User Experience & Business Impact questions,
  • Security & Compliance questions,
  • Project: Hands-On.

Intro:

    • New Relic application performance monitoring (APM) is a solution used to instrument, monitor, and optimize the performance of software applications and microservices.
    •  New Relic application performance monitoring (APM) is part of the broader New Relic observability platform, which helps twtech engineering teams to understand everything in their software stack, from the end-user experience to server-side performance.
    • APM (Application Performance Monitoring) in New Relic is therefore, a powerful tool for 
      • Monitoring application performance, 
      • Identifying bottlenecks, 
      • Improving system reliability. 
    • New Relic provides deep insights into how applications perform in real-time, helping developers and DevOps teams optimize performance and troubleshoot issues efficiently.
Key Features and Functionality
Code-Level Visibility
    •  The platform uses language-specific APM agents (for Ruby, Java, PHP, Go, etc.) installed within an application's code to collect detailed metrics and trace slow database queries, third-party API calls, and background jobs.
Performance Metrics 
    • New Relic captures critical performance data, allowing users to track Apdex scores (a measure of user satisfaction), response times, and error rates.
Alerting and Notification
    •  twtech-Users configure alerts based on specific performance thresholds and integrate with various communication platforms like Slack, PagerDuty, and OpsGenie to notify teams when applications are misbehaving.
Data Security 
    • New Relic provides default security settings and a "high-security mode" to ensure sensitive data is not inadvertently reported. 
    • Options include obfuscating SQL queries and managing which attributes (like request headers or parameters) are sent to New Relic collectors.
Logs in Context
    •  APM logs in context feature integrates log data with performance metrics, providing a unified view for troubleshooting.
Key Transactions
    •  twtech-Users can track specific, critical business transactions independently of the main application, setting custom alert thresholds and Apdex values for them.

Summary of New Relic APM Features:

    1. Real-time Monitoring – Tracks application performance metrics like response times, throughput, and error rates.
    2. Distributed Tracing – Helps visualize request flows across microservices and pinpoint latency issues.
    3. Error Tracking & Logging – Captures detailed error analytics and logs to aid debugging.
    4. Custom Instrumentation – Allows developers to add custom metrics to monitor specific application behavior.
    5. Database Performance Monitoring – Identifies slow queries and inefficient database interactions.
    6. Alerting & Anomaly Detection – Provides alerts on performance degradation using AI-driven anomaly detection.
    7. Service Maps – Offers a graphical view of how different services interact within an application.
    8. Infrastructure Integration – Works with cloud platforms like AWS, Azure, and Kubernetes.
Management and Configuration
Installation/Deployment
    •  Agents can be deployed manually into the application's existing directory. The only required setting for mobile monitoring agents is the application token.
Disabling/Removal 
    • The APM agent can be temporarily disabled by changing configuration settings and restarting the application's process, or the application can be deleted from the New Relic UI to stop data ingestion.
Cost Management
    •  twtech-Users can manage data ingestion costs by using data drop rules, normalization rules, and configuring agent settings to limit the amount of data sent to New Relic.

 key questions addressed by APM - New Relic:

1. Application Performance & Bottlenecks questions

    • What are the key performance metrics (response time, throughput, error rate) for my application?
    • Which transactions or endpoints are the slowest?
    • What external dependencies (databases, APIs, caches) are causing latency?
    • Are there any trends in performance degradation over time?

2. Infrastructure & Resource Utilization questions

    • How are CPU, memory, and disk I/O performing on my hosts and containers?
    • Are there any resource bottlenecks affecting application performance?
    • Are Kubernetes pods or cloud instances running at optimal capacity?

3. Errors & Failures questions

    • What are the most frequent and critical errors in my application?
    • Which transactions or services are generating the most errors?
    • Can twtech trace these errors back to specific deployments or code changes?
    • Are there patterns in error occurrences (e.g., specific regions, times of day)?

4. Distributed Tracing & Dependencies questions

    • How are requests flowing through twtech microservices or distributed systems?
    • Where are the slowest points in the request lifecycle?
    • Are database queries or third-party services slowing down twtech application?
    • Are there any unusual spikes in dependency failures?

5. Alerting & Incident Response questions

    • Are alerts configured properly to detect anomalies before they impact users?
    • Are alert thresholds optimized to minimize noise but still catch real issues?
    • What is the Mean Time to Detect (MTTD) and Mean Time to Resolve (MTTR)?
    • How can I integrate New Relic with Slack, PagerDuty, or other incident response tools?

6. Deployment & Change Analysis questions

    • Did a recent deployment introduce a performance regression?
    • What impact did a new release have on error rates and response times?
    • Are there performance trends linked to specific code changes?

7. User Experience & Business Impact questions

    • How is application latency affecting user experience?
    • What percentage of transactions meet Service Level Agreements (SLAs)  and Service Level Objectives (SLOs)?
    • How does performance correlate with business metrics like conversion rates?

8. Security & Compliance questions

    • Are there any anomalies or unexpected spikes in traffic?
    • Is sensitive data properly monitored for security breaches?
    • How can I use New Relic logs and traces for security audits?

Project: Hands-On

How twtech Installs and Use New Relic APM in its environment.

Ste-by-Step:
  1. Install the New Relic Agent (available for Java, Node.js, Python, Ruby, .NET, Go, and PHP).
  2. Configure the Agent with twtech New Relic license key.
  3. Deploy and Run the application to start collecting performance data.
  4. Access the New Relic Dashboard from the browser to analyze metrics, set alerts, and optimize performance.

How to Install and Configure New Relic APM Agent

    • New Relic APM supports multiple programming languages like Java, Node.js, Python, .NET, PHP, Go, and Ruby. 
    • Below are the general steps to install, configure, and start monitoring an application using New Relic.

Step-1:

Sign Up and Get twtech New Relic License Key

  1. Go to New Relic's website and create an account at:  https://newrelic.com/
  2. Navigate to APM & Services Click on Add a New Service.
  3. Copy twtech New Relic License Key from the dashboard.

Step-2

 Install the New Relic APM Agent (CLI)

This works Seamlessly For Java Applications

  1. Download the latest New Relic Java agent:
    curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
  2. Unzip and move it to your application directory:
    unzip newrelic-java.zip -d /path/to/your/app
  3. Add the agent to twtech JVM options:
    -javaagent:/path/to/your/app/newrelic/newrelic.jar
  4. Modify the newrelic.yml configuration file to include twtech license key and application name.
Step-3:
  • Install infrastructure agent in a linux (ubuntu) environment.


Download the latest New Relic Java agent:

curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip




Step-4:
  • twtech may be asket to follow a link to complete installation.
  • use the URL to Access the New Relic Agent on the browser.



Operating systems Supported by New Relic.

Operating systems 

  • The infrastructure agent supports the following operating systems up to their manufacturer's end-of-life. 

https://docs.newrelic.com/docs/infrastructure/infrastructure-agent/requirements-infrastructure-agent/

Installing New Relic Agent for Linux:


Installing agent on the windows environment:
    • Open Powershell on the windows computer & Start (run) as administrator.
    • Run the command generated from New Relic documentation: created key.

Go back to New Relic on Browser to finish installation.


Use New Relic to see data from:  window system


twtech-metrics:  Scrapped by New Relic Agent.

Expand the metrics to get insights: 

  • How twtech gets insights (better understanding)

Security and Associated Permissions:

  • We can also Create dashboards, alerts, predict trends, and many more…


How twtech Team Query logs using log aggregation.


Additional installation For Node.js Applications

  1. Install the New Relic agent using npm:
    npm install newrelic --save
  2. Create a newrelic.js file in your project root:
    # js

    exports.config = { app_name: ["twtechAppName"], license_key: "twtech_NEW_RELIC_LICENSE_KEY", logging: { level: "info" } };
  3. Require New Relic at the top of your main app file (e.g., server.js or app.js):
    # js

    require('newrelic');

Additional installation For Python Applications

  1. Install the New Relic Python agent:
    pip install newrelic
  2. Generate a New Relic config file:
    newrelic-admin generate-config YOUR_NEW_RELIC_LICENSE_KEY newrelic.ini
  3. Start your application with New Relic:
    NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program python my_app.py

Additional installation For .NET Applications

  1. Download and install the .NET agent from the New Relic website.
  2. Open the newrelic.config file and add your license key.
  3. Restart your application.

Step 5  : Deploy and Run the Application

After installing and configuring the agent:

  1. Restart twtech application to apply the changes.
  2. The agent will automatically start collecting performance data and send it to New Relic.

Step 6: Access the New Relic Dashboard

  1. Log in to New Relic One.
  2. Go to APM & Services.
  3. twtech sees its application listed. Click on it to:
    • View response times, throughput, and error rates.
    • Analyze database performance and slow transactions.
    • Monitor distributed traces and logs.

Step 7: Set Alerts and Optimize Performance

  1. Set Alerts
    • Go to Alerts & AI → Click Create a new alert condition.
    • Define conditions for CPU, memory, response time, error rates, etc.
    • Add notification channels (email, Slack, PagerDuty).
  2. Optimize Performance
    • Identify slow API calls, database queries, and code-level bottlenecks.
    • Use Service Maps to visualize dependencies.
    • Implement caching, query optimization, or scaling based on insights.

twtech Final thoughts:

  • By continuously asking questions listed above, twtech proactively monitor, troubleshoot, and optimize its applications with New Relic APM
  • Integrate New Relic with Kubernetes, Docker, or cloud platforms (AWS,).
  • Enable distributed tracing for microservices.
  • Use New Relic Logs to monitor application logs.






No comments:

Post a Comment

Amazon EventBridge | Overview.

Amazon EventBridge - Overview. Scope: Intro, Core Concepts, Key Benefits, Link to official documentation, What EventBridge  Really  Is (Deep...