Node.js Performance Monitoring: Moving Beyond The Hype

These days it is impossible to find a single developer who doesn’t know about Node.js.

Beyond the hype of the last couple of years, it must seem to a lot of people that Node.js is dead since not every conference is packed with node.js talks anymore. After all those years, however, it has finally made it to the mainstream.

But with bigger projects and more companies using Node.js in their enterprise systems, comes new responsibilities and challenges. Over the course of the next few years the way we write applications for Node.js will have to change though. Not only in terms of investing more thought into which dependencies we use, but also looking into how to keep those systems maintained for years. Furthermore a better package manager which provides support for dependency trees and licensing will be a necessity, too – common requirements in the enterprise world.

There is another set of major challenge though…

Node js Application Monitoring,Visibility and Observability

Running large scale enterprise applications requires not only scalability and a critical mass of users, but also making sure the services are available and performing as expected.

We have to understand how services perform, we need to understand when to scale up or down (cost effectiveness), and we need to understand if there are issues with the systems – not tomorrow, not in an hour but right now.

This is not as easy as it might sound, especially looking at source code already written, but also new programming work.

No developer loves to clutter their just finished piece of art (we all know we produce art, don’t we?) with monitoring code and performance metrics. We want it to stay as clean as possible, while maximizing the insight that is possible to gain.

Another common issue occurs when a problem crops up and we begin our analysis. If we manually added monitoring code, you can bet that some important metrics were forgotten and will need to be added for the next time there is a problem. That doesn’t help now though. This happens to all … of … us, unless we use automatic monitoring 🙂

Automatic Node.js Monitoring for Developers

By utilizing Instana’s Node. js monitoring tool, we can get the full picture of our infrastructure. The full monitoring picture includes information and performance metrics of our JavaScript runtime (V8), performance and behavior insight into our services, and service dependencies of all of our services, databases, and messaging systems as distributed traces.

Instana Distributed Trace for Node.js application with multiple Sub-Spans
Figure 1 – Instana Distributed Trace for Node.js application with multiple Sub-Spans

Best of all, as a developer, we have minimal code changes – to be precise, 2 lines of code. The only changes we need to make are one line of code in our package.json and one line in our main JavaScript file.

To our package.json we add the Instana sensor dependency:

  "dependencies": {
    "instana-nodejs-sensor": "^1.55.0"

And in the main application file, we instantiate the sensor, and maybe add some configuration to override defaults. Remember to make the Instana sensor instantiation the first thing in your application for automatic instrumentation to work:

'use strict'

// your application code

And that’s it. Monitoring as it is supposed to be, from the point of view of a developer. Why would you clutter your code with monitoring and metrics samplings when you don’t have to?

Node.js V8 VM Runtime Metrics in Instana Dashboard
Figure 2 – Node.js V8 VM Runtime Metrics in Instana Dashboard

One Sensor To Monitor Them All

In fact the Instana sensor supports plenty of commonly used dependencies and database, messaging, and other clients from the NPM repositories.

That said, Instana, by only adding two lines of code, is able to gather performance metrics, distributed traces, and service dependencies in a fully automatic fashion, no matter if you use MySQL, PostgreSQL, rabbitMQ or anything else.

For further details on supported libraries see the Instana Node.js Sensor documentation. If you want to try Instana on your own Node.js applications you can sign up for a free trial. It will take a few minutes and you will get full access to Instana for 2 weeks.

Play with Instana’s APM Observability Sandbox

If you've been following Instana, you probably know about Robot-Shop, which is a microservice demo application that’s easy to launch and makes for a good showcase for Instana. Robot-Shop got a little...
It was 3:38 am and our smoke alarm blared loudly and proudly somewhere in our house. My husband and I jolted from bed and into emergency mode. I rushed into our son’s...
Announcement, Engineering
Written with Willian Carvalho Since Instana Node.js collector version 1.134.0 in September, the Node.js tracer includes the Instana OpenTelemetry exporter for Node.js. You can find a guide for using the Instana Node.js...

Start your FREE TRIAL today!

Instana, an IBM company, provides an Enterprise Observability Platform with automated application monitoring capabilities to businesses operating complex, modern, cloud-native applications no matter where they reside – on-premises or in public and private clouds, including mobile devices or IBM Z.

Control hybrid modern applications with Instana’s AI-powered discovery of deep contextual dependencies inside hybrid applications. Instana also gives visibility into development pipelines to help enable closed-loop DevOps automation.

This provides actionable feedback needed for clients as they to optimize application performance, enable innovation and mitigate risk, helping Dev+Ops add value and efficiency to software delivery pipelines while meeting their service and business level objectives.

For further information, please visit