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

@dnlup/doc

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnlup/doc

Get usage and health data about your Node.js process

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
319
increased by11.54%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Tests

doc brown

doc

Get usage and health data about your Node.js process

Usage

const Doc = require('@dnlup/doc');

const doc = Doc(); // Use the default sample interval
doc.on('data', data => {
  doStuffWithCpuUsage(data.cpu)
  doStuffWithMemoryUsage(data.memory)
  doStuffWithEventLoopDelay(data.eventLoopDelay)
})

API

Doc([options])

Create a new Doc instance with the given options.

  • options: Object. Optional. Configuration object
  • options.sampleInterval: Number. Optional. Sample interval (ms), each sampleInterval ms a data event is emitted. On Node 10 the default value is 500 while on Node >= 12 is 1000. Under the hood the package uses monitorEventLoopDelay where available to sample the event loop and this allows to increase the default sample interval on Node >= 12.
  • options.eventLoopOptions: Object. Optional. Options to setup monitorEventLoopDelay
events
data

Process data event.

Properties:

NameDescription
eventLoopDelayEvent loop delay (ms)
memoryObject containing memory usage stats
memory.rssRSS memory (bytes)
memory.heapTotalTotal heap Memory (bytes)
memory.heapUsedHeap memory used (bytes)
memory.externalExtarnal memory (bytes)
cpuCpu usage percentage
rawObject containing raw values
raw.cpuObject containing the raw values returned from process.cpuUsage()
raw.eventLoopDelayRaw representation of the event loop delay, on Node 10 it is the delay in nanoseconds, on Node >= 12 is a Histogram instance

Keywords

FAQs

Package last updated on 31 Mar 2020

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