<commit_before># node-instrument
Library to instrument your node application for graphite reporting<commit_msg>updated the README.md with installation instructions and examples<commit_after># node-instrument
Library to instrument your node application for graphite reporting


## Installation 
`npm install jdbranham/node-instrument`


## Usage
`var instrument = require('node-instrument')();`


## Options
	var options = {
		carbonHost : '127.0.0.1',
		carbonPort : 2003,
		type : 'udp4',
		prefix : '',
		suffix : '',
		verbose : false,
		interval : 5000,
		callback : null
	};
	
## Manual Reporting

    var instrument = require('node-instrument')({prefix: 'localhost'});
    instrument.addObject({myMetric: 1});
    instrument.send();
    
## Automated Interval Reporting

    var instrument = require('node-instrument')({prefix: 'localhost'});
    instrument.start();
    instrument.addObject({myMetric: 1});
    
When using the interval reporting, the 'put' and 'add' methods act slightly different.  
`put` and `putObject` - replaces the value of a metric if it already exists in the queue.  
`add` and `addObject` - adds the metric value to any existing metric in the queue.
    
## Name/Value metrics

    instrument.add('server.metric1', 1);
    
## Object/nested metrics

    instrument.addObject({myMetric: 1});
    // or
    instrument.addObject({myMetric: {sub: 1}});
    // or 
    instrument.addObject({myMetric: {sub: 1}, 
    								deep: {
    								   down: 1
    								   }
    								});
{'fraction_non_alphanumeric': 0.12145214521452145, 'fraction_numerical': 0.015181518151815182, 'mean_word_length': 3.2824858757062145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6730261', 'n_tokens_mistral': 500, 'n_tokens_neox': 439, 'n_words': 134}