sitemon-js

0.1.0 • Public • Published

Sitemon JS

A node client for sending statistics to sitemon.

Usage

var Sitemon = require('sitemon-js');
var apiLogger = new Sitemon('apitable', '1.2.3.4:5678');
apiLogger.send({ method: 'tagged.user.getInfo' }, { calls: 1, process_time_ms: 20 });      // sends message to sitemon over UDP

Round-robin target hosts

var apiLogger = new Sitemon('api', [
    '1.2.3.4:5678',
    '2.3.4.5:6789',
    '3.4.5.6:7890'
]);
apiLogger.send({ method: 'tagged.user.getInfo' }, { calls: 1, process_time_ms: 20 });      // sends to 1.2.3.4:5678
apiLogger.send({ method: 'tagged.profile.update' }, { calls: 1, process_time_ms: 20 });    // sends to 2.3.4.5:6789
apiLogger.send({ method: 'tagged.stuff.do' }, { calls: 1, process_time_ms: 20 });          // sends to 3.4.5.6:7890
apiLogger.send({ method: 'tagged.photo.info' }, { calls: 1, process_time_ms: 20 });        // sends to 1.2.3.4:5678

Files and Directory Structure

The following describes the various files in this repo and the directory structure.

Note: Files and directories prefixed by * are auto-generated and excluded from the repository via .gitignore.

.
├── Gruntfile.js            # grunt task configuration
├── README.md               # this file
├── *docs                   # autogenerated documentation
│   └── *index.html         # each JS file in `./lib` has a corresponding HTML file for documentation
├── lib                     # all code for this library will be placed here
│   └── index.js            # main entry point for your npm package
├── *node_modules           # all dependencies will be installed here by npm
├── package.json            # description of this package for npm, including dependency lists
└── test                    # unit test configuration, reports, and specs
    ├── *coverage.html      # code coverage report
    ├── lib                 # specs go here, preferably with a 1:1 mapping to code in `./lib`
    │   └── index_test.js   # example spec for `./lib/index.js`
    ├── mocha.opts          # runtime options for mocha
    └── test_runner.js      # configures mocha environment (e.g. chai, sinon, etc.)

What's Included?

Grunt

Grunt is a JavaScript task runner to automate common actions. The Tagged NPM Package Seed supports the following built-in grunt tasks:

test

Runs all unit tests through mocha.

$ grunt test

coverage

Runs all unit tests and generates a code coverage report in ./test/coverage.html

$ grunt coverage

watch

Automatically runs mocha tests each time a file changes in ./lib or ./test.

$ grunt watch

docs

Generates documentation for all JS files within ./lib using docco. Documentation is written to ./docs.

$ grunt docs

clean

Deletes all auto-generated files, including ./docs and ./test/coverage.html

Mocha, Sinon, Chai, Blanket

The ultimate TDD environment for node. Place your specs in ./test/lib, and run grunt test.

See ./test/lib/index_test.js for examples.

Readme

Keywords

Package Sidebar

Install

npm i sitemon-js

Weekly Downloads

8

Version

0.1.0

License

MIT

Unpacked Size

15.7 kB

Total Files

7

Last publish

Collaborators

  • djvirgen