Socket
Socket
Sign inDemoInstall

event-loop-chart

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-loop-chart

Create charts form event loop lag to measure the performance of your app.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

Event-loop-chart

Visualize the lag of the event loop of your Nodejs application.

example

What is event loop lag?

It is a metric that can help to spot synchronous functions in your Nodejs application. The event loop allows to execute non blocking i/o operations as long as this operations are asynchronous. Please check better explanations of the event loop functionality but in short, there is a queue of operations to be executed, if any of those operations is synchronous like fs.readFileSync('/file.md') the event loop is blocked until the operation is finished. The time that the event loop is blocked is called event loop lag.

How do you use Event-loop-chart?

Install the npm dependency:

npm install event-loop-chart

Init the library with data collection interval time and outpug path of the chart:

const elc = require('event-loop-chart');
// set the interval of collection of the event loop lag percentiles for 5000ms
elc.init(5000,"/path/output.png");

And that is it! Every 5 seconds, you application will output a line chart with the percentil values p10, p25, p50, p95 and p99.

To trigger a snapshot:

elc.snapshot("/path/output.png");

The unit used to measure the lag is nanoseconds. You can have a look at this documentation if you want to know more.

Keywords

FAQs

Package last updated on 04 Apr 2021

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