DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. JavaScript
  4. Node.js Monitoring for the Masses: Moving Beyond The Hype

Node.js Monitoring for the Masses: Moving Beyond The Hype

Learn more about performance and monitoring for Node.js applications.

Chris Engelbert user avatar by
Chris Engelbert
·
May. 01, 19 · Tutorial
Like (1)
Save
Tweet
Share
6.09K Views

Join the DZone community and get the full member experience.

Join For Free

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 challenges though…

Visibility, Observability, and Monitoring of Node.js Applications

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 to monitor our Node.js services, 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, two 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'

require('instana-nodejs-sensor')();
// 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.

Node.js

Published at DZone with permission of Chris Engelbert, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 9 Ways You Can Improve Security Posture
  • Unit of Work With Generic Repository Implementation Using .NET Core 6 Web API
  • Multi-Cloud Database Deep Dive
  • Top Five Tools for AI-based Test Automation

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: