send metrics to zag-daemon

The metrics agent sends raw points to the zag-daemons where they will be aggregated.

var agent = require('zag-agent')([/* list of all metrics daemon "address:ports" */])

Increment a counter.


Increment a counter by a specific value.

agent.counter("search_results", results.length)

Track a distribution of values. All histograms automatically get a heat map.

agent.histogram("HTTP_server_latency|/index.html", 123)

Often times all of the metrics in a particular module should be scoped under the same key. #scope(key) returns a MetricsAgent that automatically prepends that key:

var latency = agent.scope("http_latency")
// This is the same as `agent.counter("http_latency>/index.html")`: 

.close()ing a scoped agent will close the parent agent (they share a socket).

The socket emitted an error.

Close the socket.