Node.js Custom Metrics Made Simple

Easily send custom metrics to Watchlog using our lightweight Node.js library.

What are Custom Metrics?

Custom metrics let you monitor specific data points relevant to your application. With Watchlog's Node.js library, you can track anything from user activity to system performance with just a few lines of code.

Custom Metrics

How to Send Metrics with Watchlog

With the watchlog-metric library, sending custom metrics is simple and flexible. Install the package and use one of the following methods to send data:

  1. Increment: Increase a metric by a specified value (default: 1).
  2. Decrement: Decrease a metric by a specified value (default: 1).
  3. Percentage: Send percentage values (0 to 100).
  4. Gauge: Measure a specific value, like temperature or active sessions.
  5. System Byte: Send system byte data (e.g., memory usage).

Sample Code

  
  const watchlog = require("watchlog-metric");
  
  // Increment a metric
  watchlog.increment("Your_metric");
  watchlog.increment("Your_metric", 75);
  
  // Decrement a metric
  watchlog.decrement("Your_metric");
  watchlog.decrement("Your_metric", 25);
  
  // Send percentage
  watchlog.percentage("Your_metric", 12.23);
  
  // Send gauge
  watchlog.gauge("Your_metric", 12.23);
  
  // Send system byte (e.g., memory usage)
  watchlog.systembyte("Your_metric", 1024000000); // Example: 1 GB
  
        

Getting Started

To start sending custom metrics, install the library and follow the examples above. For detailed setup instructions, visit our documentation.

View Documentation

Monitor Custom Metrics with Ease

Sign up for Watchlog and start tracking your custom metrics today.

View Pricing