strong-agent-statsd

strong-agent middleware for publishing metrics via statsd protocol.

Usage no npm install needed!

<script type="module">
  import strongAgentStatsd from 'https://cdn.skypack.dev/strong-agent-statsd';
</script>

README

strong-agent-statsd

strong-agent middleware for publishing metrics via statsd protocol.

The statsd protocol is supported by large ecosystem of servers and plugins, allowing publishing into on-premise or custom infrastructure.

See strong-agent.

Integration points

There are a number of integration points where strong-agent metrics can be published into hosted or on-premise monitoring and reporting infrastructure.

  1. strong-agent metrics can be collected directly using the require('strong-agent').use() API, the strong-agent-statsd source may be used as an example.
  2. strong-agent-statsd can publish metrics using the statsd protocol to any of a number of servers
    1. statsd is the original server, it has:
      1. a built-in graphite backend, where graphite might be local or hosted
      2. other backends, such as for Zabbix, etc.
      3. support for custom backends, they are easy to write, one of the above backends can be used as an example
    2. other metrics consumers, such as datadog, have agents that support the statsd-protocol
  3. strong-agent-statd can publish into a custom server written to support existing on-premise infrastructure, the statsd protocol is quite simple.

Most metrics reported by strong-agent are 'gauges', a measured value, but a few metrics are best reported as 'counts', values that count events. There are other statsd data types, but none are relevant to the metrics currently published by strong-agent.

This publisher uses the lynx client.

publisher = require('strong-agent-statsd')([options])

Module returns a constructor for a publisher function. The publisher requires no options, but the following are allowed:

  • options.host (String) The host to connect to, the default is localhost, as statsd servers usually run on the same host as the client.
  • options.port (Number) The port to connect to, the default is 8125, the default port used by the original statsd server and by most others.
  • options.scope (String) A scope to prepend to the metric name before publication, default is none.

Metrics names are hierarchical dot-seperated strings. When reported by statsd, they will most likely need to fit into a larger hierarchy of all the applications, or perhaps an entire system or company.

Statsd servers usually have the ability to scope metrics reported to them, but if there are multiple clients reporting to the same server, or if the scope should contain information best known to the client (process ID, application name, cluster worker ID) the scoping can occur at source.

Example

Example integration with strong-agent:

require('strong-agent').use(
  require('strong-agent-statsd')()
);