Monitoring Node.js Applications with SignalFx

Amit Sharma
signalfx
Published in
5 min readMar 15, 2019

Over the last decade, JavaScript has evolved from a browser-centric scripting language to a great general-purpose programming language suitable for server-side execution. Managed and supported by the Node.js foundation, an industry consortium with an open governance model, Node.js is an asynchronous, event-driven JavaScript runtime.

Modern Node applications are modular and distributed, with requests flowing through a series of distributed services, web frameworks, caches, queues, and databases. When the performance of such requests breach Service Level Objectives (SLOs), SREs and service owners must understand a number of underlying issues to determine the root cause and restore the Service Level Indicators (SLIs), such as:

  • Which services did requests go through?
  • Which operations were executed?
  • Which service caused performance degradation?
  • What was different in the execution path for the outlier traces?
  • Did the performance degradation happen due to the code execution, edge condition, runtime event, i.e. garbage collection or infrastructure issue, i.e. container running hot or disk space reaching the limit?

In previous blogs, we showed how traditional APM approaches no longer provide reliable visibility into modern distributed environments. You need to rethink how to monitor and troubleshoot microservices performance. In the following sections, we will cover various instrumentation approaches to building a robust observability strategy for your Node applications:

  1. Auto-instrumentation for most popular frameworks, and packages
  2. OpenTracing compliant custom instrumentation
  3. Custom metrics to record and analyze infrastructure, application or business KPIs

Introducing the SignalFx Tracing Library for JavaScript: Auto-instrumentation for Node.js applications

To accelerate the adoption of distributed tracing for our customers, we are now making the SignalFx JavaScript Tracing Library available in beta. This library provides an OpenTracing-compatible tracer and automatically configurable instrumentations for many popular JavaScript server-side libraries and frameworks.

Modern Node applications leverage dozens of modules as transactions pass through distributed services, caches, queues, or databases. Manual instrumentation is burdensome and impractical when you need real-time visibility into how these frameworks are impacting the performance of the service. The SignalFx library for Node.js can automatically instrument many popular modules such as Express, MySQL or Redis etc. For a complete list of supported modules, refer to the documentation.

Installation:

SignalFx tracing library for JavaScript can be installed in one step using package manager:

$ npm install signalfx-tracing

Using Auto-Instrumentation:

To start using auto-instrumentation, the Tracer needs to be initialized before any target package is imported:

Complete examples on how to leverage auto-instrumentation for express and Mongo DB in your Node applications are available on our Github repository

OpenTracing-compliant custom instrumentation

SignalFx auto-instrumentation library will automatically instrument key modules in your application, but can also be customized based on your business logic. Not only can you capture span tags, you can also capture error events and descriptions. OpenTracing specification lists all the standard span tags and log events. The code snippet below shows how to start a span and send span tags:

Customers leverage the auto-instrumentation library as well as use manual instrumentation to get end-to-end visibility. Once the services are instrumented and SignalFx Microservices APM is deployed, you start to get the following benefits:

Out-of-the-box service monitoring

SignalFx provides pre-built service dashboards with performance characteristics such as rate, error, and duration (RED) metrics. SignalFx NoSample™ Distributed Tracing analyzes every transaction, so the performance characteristics are always accurate

Trace and Span Visualization

Now you can visualize traces with thousands of spans using a Google maps-like experience to quickly zoom-in and zoom-out and display only the inter-service spans to isolate the right traces. The level of auto instrumentation surfaces granular information from instrumented modules such as MySQL queries, errors, Redis connected_clients, etc.

Accurately understand top contributing function calls to latency and errors. With a quick glance, you can validate every node code release whether the performance has improved, stayed the same or degraded by comparing with historical benchmarks.

Infrastructure and application correlation

SignalFx provides a unified, single-pane-of-glass view of infrastructure and application monitoring — all contextualized and fully correlated. By quickly visualizing the host metrics such as CPU, memory, network and disk usage alongside application RED metrics as shown in the dashboard above, DevOps teams can quickly determine how the infrastructure performance is impacting the application performance.

Guided Troubleshooting

SignalFx Outlier Analyzer™simplifies the troubleshooting process by automatically uncovering patterns in anomalous traces, thereby enabling SRE teams with prescriptive troubleshooting to reduce MTTR

Leverage SignalFx Client Library for Node.js to capture custom metrics

SignalFx Client Library for Node.js is a programmable interface that allows you to access SignalFx metadata and ingest APIs. You can leverage the Node.js client library to capture application or business metrics such as orders placed, logins from a particular location, carts abandoned, etc. for analysis and visualization in SignalFx

Installation:

SignalFx Client Library for Node.js can be installed by one-step npm installer:

$ npm install signalfx

Using Client Library

Collecting relevant data using custom metrics enables you to conduct high-cardinality analytics and create custom dashboards to get real-time insights on business KPIs

You can link the Business KPI dashboard from the service maps so you have the real-time correlation into how application performance is impacting business performance. More details on how to ingest custom metrics types are available on SignalFx Client Library for Node.js documentation site and Github repository.

Get Started with SignalFx:

SignalFx is the only solution which analyzes every transaction across distributed services and provides directed troubleshooting to significantly reduce MTTR while giving complete flexibility for instrumentation so our customers can remain vendor-neutral. Get started by signing up for a free trial of SignalFx or join our weekly Live Demo to see the platform in action

Originally published at www.signalfx.com.

--

--

Amit Sharma
signalfx

Product | Marketing | Growth @signalfx. Previously @AppDynamics, @cisco. Posts are my views and they do not express the views or opinions of my employer.