knockprobe

2.0.0 • Public • Published

Knock Probes

NPM version Build Status Package Quality Coverage Status

This library contains a class to send business probe to knock daemon.

https://knocKnock.center

Requirements

  • NodeJS +4.6
  • Knockdaemon installed
  • An account on Knock

Install

npm install knockprobe

Type of probe

Gauge

A simple counter, storing a current instant value. Last value provided wins. Gauges are used in quantity cases. For example, a gauge could be defined by the amount of basket being processed.

Increment

A simple counter, storing cumulative values and graphing them as delta per second. Increment is typically an recurrent event. For example, an increment could be defined by the number of basket validated.

Delay

A simple counter, storing execution time and graphing them by execution time interval. For example, a delay could be defined by the time of execution of external request.

Example

Connect

Connect to the Knock daemon first.

var Knock = require('knockprobe');
Knock.connect();

Push a Gauge Probe

You can push a gauge probe one by one without declaring it first.

Knock.gauge('apple', 2);
Knock.gauge('orange', 3);
Knock.commit();

Push a Counter Probe

You can push an increment probe.

Knock.increment('action1', 1);
Knock.commit();

Delay to Count

Delay to count is a special probe. This probe aggregate all execution time in a dictionnary of range of time.

timecode = Knock.start_delay('api_facebook_request');
// do something
Knock.stop_delay(timecode);
Knock.commit();

Commit

All data are sent calling commit command. You also can use the autocommit feature:

Knock.autocommit(2000); // commit will be called each 2000ms

Disconnecting

When disconnecting, a disableable commit is processed first.

Knock.disconnect();
// or
Knock.disconnect(false); // do not commit latest data

Readme

Keywords

none

Package Sidebar

Install

npm i knockprobe

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • jbdemonte