lib/index.js
function (time, metrics) {
    /**
     * Iterate over every kind of metric we want to send to new relic
     */
    options.dispatchMetrics.forEach(function (metricType) {
        var statsdKeysForType = metrics[metricType],
            statsdKey,
            statsdValue,
            dispatchMetric = function (dispatcherType) {
                dispatcher[dispatcherType](metricType, statsdKey, statsdValue);
            };

        for (statsdKey in statsdKeysForType) {
            if (statsdKeysForType.hasOwnProperty(statsdKey)) {
                statsdValue = metrics[metricType][statsdKey];
                options.dispatchers.forEach(dispatchMetric);
            }
        }

    });
}
function (time, metrics) {
    /**
     * Iterate over every kind of metric we want to send to new relic
     */
    options.dispatchMetrics.forEach(function (metricType) {
        var statsdKeysForType = metrics[metricType],
            statsdKey,
            statsdValue,
            dispatchMetric = function (dispatcherType) {
                dispatcher[dispatcherType](metricType, statsdKey, statsdValue);
            };

        for (statsdKey in statsdKeysForType) {
            if (statsdKeysForType.hasOwnProperty(statsdKey)) {
                statsdValue = metrics[metricType][statsdKey];
                options.dispatchers.forEach(dispatchMetric);
            }
        }

    });
}
function ( time , metrics ) { /**
     * Iterate over every kind of metric we want to send to new relic
     */ options . dispatchMetrics . forEach ( function ( metricType ) { var statsdKeysForType = metrics [ metricType ] , statsdKey , statsdValue , dispatchMetric = function ( dispatcherType ) { dispatcher [ dispatcherType ] ( metricType , statsdKey , statsdValue ) ; } ; for ( statsdKey in statsdKeysForType ) { if ( statsdKeysForType . hasOwnProperty ( statsdKey ) ) { statsdValue = metrics [ metricType ] [ statsdKey ] ; options . dispatchers . forEach ( dispatchMetric ) ; } } } ) ; }
Handle the flush event triggered by StatsD.
This handler will read the gauges and counters data and send them to New Relic as Custom Metrics
through the agent API recordMetric.

Unless other names are provided as part of the configuration, the Custom Metrics naming
follows the New Relic suggested convention:
- Custom/[gauge.key.metric]
- Custom/[counter.key.metric]
...
Handle the flush event triggered by StatsD . This handler will read the gauges and counters data and send them to New Relic as Custom Metrics through the agent API recordMetric .