npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

my-monitoring

v0.0.1

Published

Embedded editable monitoring dashboard for Node.js applications based in Appmetrics-dash and Appmetrics.

Downloads

3

Readme

My-monitoring

My-monitoring is an application based in Node Application Metrics Dashboard(appmetrics-dash). Provides a very easy-to-use web based dashboard to show the performance metrics of your running Node.js application.

Usage

If you want to add the dashboard to all HTTP servers created by your application then simply add:

// Before all other 'require' statements:
require('my-monitoring').attach();

to the very top of your main JavaScript source file.

If you want to add the dashboard to one specific HTTP server then use:

var dash = require('my-monitoring');
// Other 'require' statements here
// Create HTTP server 'myHttpServer' here
dash.monitor({server: myHttpServer});

If you are not creating an HTTP server then use:

// Before all other 'require' statements:
require('my-monitoring').monitor();

The data available on the dashboard is as follows:

  • CPU Profiling (via a separate tab)
  • HTTP Incoming Requests
  • HTTP Throughput
  • Average Reponse Times (top 5)
  • CPU
  • Memory
  • Heap
  • Event Loop Times
  • Environment
  • Other Requests
  • HTTP Outbound Requests

As well as displaying data, it also provides the ability to generate both Node Report and Heap Snapshots directly from the dashboard. The Node Report will display in a new tab in the browser whilst the Heap Snapshot will be written to disk for loading into the Chrome DevTools for analysis. These can both be triggered from the options menu in the top left of the screen

The dashboard uses Node Application Metrics to monitor the application.

Performance overhead

Our testing has shown that the performance overhead in terms of processing is minimal, adding less than 0.5 % to the CPU usage of your application. The additional memory required is around 30 MB to gather information about your system and application which is then visualized in the dashboard.

API Documentation

attach(options)

  • options {Object} Options are the same as for dash.monitor().

Auto-attach to all http servers created after this call, calling dash.monitor(options) for every server.

Simple example using attach

var dash = require('my-monitoring');
dash.attach();

var http = require('http');

const port = 3000;

const requestHandler = (request, response) => {  
  response.end('Hello')
}

const server = http.createServer(requestHandler);

server.listen(port, (err) => {  
  if (err) {
    return console.log('An error occurred', err)
  }
  console.log(`Server is listening on ${port}`)
});

To use options, add the object inside attach().

  var dash = require('my-monitoring');
  dash.attach({
    url: '',
    titlte: '',
    ...
  })

monitor(options)

  • options.url {String} Path to serve dashboard from. Optional, defaults to '/appmetrics-dash'.
  • options.console {Object} Some messages are printed to the console using console.log() and console.error(). Optional, defaults to the global console object.
  • options.server {Object} An instance of a node http server to serve the dashboard from. Optional, default is to create a server (see port and host).
  • options.port {String|Number} Port to listen on if creating a server. Optional, unused if server option is used.
  • options.host {String} Host to listen on if creating a server. Optional, unused if server option is used.
  • options.appmetrics {Object} An instance of require('appmetrics') can be injected if the application wants to use appmetrics, since it is a singleton module and only one can be present in an application. Optional, defaults to the appmetrics dependency of this module.
  • options.nodereport {Object} An instance of require('node-report') can be injected if the application wants to use node-report, since it is a singleton module and only one can be present in an application. Optional, defaults to the node-report dependency of this module. The ability to generate reports can be disabled by setting this to null or undefined.
  • options.title {String} Title for the dashboard.
  • options.docs {String} URL link to accompanying documentation.
  • options.middleware {Object} Pass in middleware function to be used by server.

Module Long Term Support Policy

This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:

| Module Version | Release Date | Minimum EOL | EOL With | Status | |------------------|--------------|-------------|--------------|---------| | V4.x.x | Jun 2018 | Dec 2019 | | Current |

License

This software are forked from Application Metrics Dashboard project.

The Node Application Metrics Dashboard is licensed using an Apache v2.0 License.