node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



The daemons aggregate the raw points sent by zag-agent.

It is also responsible for monitoring and alerting, though that functionality is disabled for now.

Service setup

In order to scale, metrics data can be spread across multiple daemons that are configured as a ring. A list of their address:ports needs to be passed in as the join option.

{ host:   "address:port"
, join:  ["address:port"]
, db:     "postgres://postgres:1234@localhost/postgres"
, env:    "prod" or "dev"
, backend: require('zag-backend-pg')
}).on("error", function(err) { })


zag-agent uses the UDP API.


The primary protocol for recording metrics is over UDP. Each daemon is running a UDP server on

The data should be newline-delimited lines of the form:



  • type - counter or histogram.
  • key - [>| \w/._()+:-]+
  • value - Number. Positive or negative, integer or decimal.


POST /api/metrics

The POST body should be in the same format as the UDP data. The points are recorded as the arrive, so the client can just keep sending data down a single connection instead of making repeated requests.