Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esmj/monitor

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esmj/monitor

Node.js performance measurement metrics (cpu, memory, event loop, gc)

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by38.89%
Maintainers
1
Weekly downloads
 
Created
Source

Monitor

The @esmj/monitor is module for collecting node metrics from native node API.

Requirements

  • Node 18+

Install

npm install @esmj/monitor

Usage

It works for both Javascript modules (ESM and CJS).

// server.js
import { createMonitor } from '@esmj/monitor';

const { monitor } = new createMonitor();

const unsubscribe = monitor.subscribe((metrics) => {
  console.log(metrics);
});

monitor.start();

setTimeout(() => {
  unsubscribe();
  monitor.stop();
}, 15000);

API

monitor = new Monitor(options?)

Create a new instance of Monitor.

options?

Type: object

Configure the new instance of Monitor.

options.interval?

Type: integer Default: 1000

Measure interval metric.

start()

Monitoring start measure node metric.

stop()

Monitoring stop measure node metric.

subscribe(listener)

Subscribe listener for metrics.

Returns an unsubscribe method.

unsubscribe(listener)

Remove subscription.

add(metric)

Monitoring start measure node metric.

metric

Type: Metric

Add new metric to monitoring.

remove(metric)

Remove defined metric from monitoring.

Keywords

FAQs

Package last updated on 09 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc