dbader/node-datadog-metrics — pull request #3 by dbader (2014-12-17 19:07:11+00:00)
Title: API refactoring

Not everybody wants to use this as a singleton. Let's give people some flexibility. Here's what I have in mind:

**Use case 1: Just let me track some metrics already!**
```js
// Use case 1: Just let me track some metrics already!
var metrics = require('datadog-metrics');
metrics.gauge('mygauge', 42);
```
* Calling `gauge` for the first time would lazily create a singleton `BufferedMetricsLogger` instance .

**Use case 2: I want some control, but I'm also lazy!**
```js
var metrics = require('datadog-metrics');
metrics.init({host: 'myhost', keyPrefix: 'myapp.'});
metrics.gauge('mygauge', 42);
```
* Call `init` before anything else to configure the singleton `BufferedMetricsLogger` instance.

**Use case 3: Must. Control. Everything.**
```js
var metrics = require('datadog-metrics');
var metricsLogger = new metrics.BufferedMetricsLogger({
apiKey: 'TESTKEY',
host: 'myhost',
keyPrefix: 'myapp.',
flushIntervalSeconds: 15
});
metricsLogger.gauge('mygauge', 42);
```
* Create your own logger instance, or multiple instances and use them directly.