Special Man Logo

Nodejs app Monitoring on dev and production environment using new relic APM

Application performance Monitoring helps you monitor whether an app meets performance standards, identify bugs and potential issues, and provide flawless user experience via close monitoring of applications.

What do APM solutions measure?

  1. Observing whether your app behaves as it should.
  2. Collecting data on the source of the problem and alerting you of problems (app, app dependencies, or infrastructure).
  3. Modifying your application to fix problems before they have an heavy impact on your business 

APM features on New Relic

  1. App Performance
  • Web transactions time: Average time it takes the service to process requests/transactions, broken down by process type. e.g database queries, queuing in the app server etc.
  • Transaction traces: gives you information about which requests or transactions are the slowest.
  • Throughput: Number of requests per minute this service processes.
  • Error rate: ratio of errors to the number of requests this service processes I.e errors divided by transactions.
  • Hosts: impact the processes have on CPU usage, memory etc.. 
  • Apdex score: this gives user satisfaction from 0-1 based on response times for app servers and load times for end users. The more those times stay near your target thresholds, and the fewer errors you have, the higher your score. The closer your score is to 1, the better your app is performing.
  1. Distributed Tracing

This gives you visibility across distributed systems, showing you the path of a request as it travels between services. This is a valuable feature for large distributed systems that rely on many small services and microservices.

  1. APM and Infrastructure 

Infrastructure accounts and APM accounts can be linked together and you will have access to them on the infrastructure UI pages(hosts, network, storage and processes).

  1. Logs

Logs can be correlated with other telemetry data, enable logs in context in New Relic. Logs adds metadata that links your logs with related APM data, like errors or distributed traces.

  1. Service Maps

This shows your apps connections and dependencies, including databases and external services. Health indicators and performance metrics show you the current operational status for every part of your architecture.

  1. Query your data

You can query and visualize your data.

  • Sample and search APM transaction and error data.
  • Browse your data visually with the data explorer.
  • Create custom SQL-like queries of your data using the NRQL.
  • Use dashboards to build advanced data visualizations, contextualize data, and understand what is going on in real time.

Collect data from any source

New Relic products report a lot of data. When you use products like APM, Browser, Mobile, infrastructure monitoring by default you receive performance data. Also you can bring data into New Relic that isn’t collected by default.

Install the Node.js agent.

  1. Create a New Relic account.
  2. Use the command npm install newrelic –save for each application you want to monitor.
  3. From node_modules/newrelic, copy newrelic.js into the root directory of your app.
  4. The agent can be configured via the newrelic.js file or via environment variable. You need to edit the license_key and app_name variables. 
  5. Add require(“newrelic”); as the first line of your app’s main module.
  6. Generate some traffic, then wait a few minutes for data to appear in the APM UI

Add your Node.js application data (From APM UI)

  1. Give your application a name
  2. Install the agent (npm install newrelic –save)
  3. Download your custom configuration file and add it to your Node folder
  4. Add New Relic to your application’s main module (require(‘newrelic`);)
  5. Start your application
  6. Check for data

Starting a new project?

Turn your ideas into incredible products

Related

Setting up CI/CD on a NextJs Application To Netlify Using GitHub Actions
Github actions is an easy and user friendly Continuous integration and continuous delivery tool to make...
Setting up CI/CD on a NodeJs Application To A Docker Environment Using Github Actions
Github Actions is an example of a simple and effective solution for Continuous Integration and Continuous...