New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

monkit

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monkit

Application Metrics Toolkit for NodeJS/Typescript

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

monkit

CircleCI Code Climate Test Coverage

Small App Metrics Toolkit for NodeJS/Typescript

Some custom metrics reporters and a partial port of the java instrumentor project. Built using the metrics module in npm.

Usage

Instrumenting Methods

Instrument an async method by giving it a name and wrapping it with instrument:

const monkit = require('monkit');
const result = await monkit.instrument("my.important.method", async () => {
    return await doImportantWork();
});

// By default, metrics will be stored in the project registry available via `monkit.getRegistry()`

console.log(monkit.getRegistry().timer("my.important.method.timer").count()); // 1

Using Decorators

Methods decorated with @instrumented will be instrumented as ClassName.MethodName with timing, throughput, and error tracking:

const instrumented = require('monkit').instrumented;

class MyClass {
    @instrumented
    public async myMethod(): ImportantThing {
        return await doImportantWork();
    }
}

const result = await new MyClass().myMethod();

// By default, metrics will be stored in the project registry available via `monkit.getRegistry()`

console.log(monkit.getRegistry().timer("MyClass.myMethod.timer").count()); // 1

Reporting Metrics

Extra Reporters include

  • a StatsdReporter for reporting preagregated metrics as statsd gauges
  • a StatusPageReporter, which can be used to periodically send metrics to statuspage.io

At time of writing, still need to tweak monkit.Registry to make it compatible with other reporters from the metrics pacakge.

Keywords

FAQs

Package last updated on 12 Feb 2018

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