numbat-powered metrics emitter
var Emitter = ;var emitter =uri: 'tcp://localhost:8000'app: 'www'node: 'www:8081';emitter;emitter;emitter;// if you don't have a reference to an emitter, you// can broadcast a metric to all extant emitters:process;
examples/ directory for working examples.
The constructor requires an options object with an app name in the
app field and some manner of specifying where to emit the metrics. You can specify the protocol, host, and port in handy url-parseable format:
ws://localhost:5000. Do this in the
uri field of the options object.
|uri||uri of the metrics collector||either this or path|
|path||path to the unix domain socket where the collector is listening||either this or uri|
|app||name of this service or app; every metric name will be prefixed with it||y|
|node||name of this specific app instance|
|maxretries||number of times to retry connecting before giving up||100|
|maxbacklog||max number of metrics to hold in backlog during reconnects||1000|
|shouldUnref||should numbat avoid holding the process open if its the only active conn?||true|
uri: 'udp://localhost:8000'app: 'udp-emitter'node: 'emitter-1'maxretries: 10maxbacklog: 200
Or numbat might be listening via a unix domain socket:
path: '/tmp/numbat-collector.sock'app: 'socket-emitter'
Valid events look like this:
name: 'name.of.metric'value: 42status: 'okay' | 'warning' | 'critical' | 'unknown'description: 'textual description'ttl: ms-to-live// fields provided for youapp: 'appname-from-options'host: oshostnametime: ts-in-ms
You can add any fields you like & they will be persisted in InfluxDB. However, only the fields listed above are meaningful to the analyzer. Those fields are described in detail below.
NOTE: You can of course emit any events you like! The style of events required/expected by numbat's analyzer, however, might change in development.
String. Required. Name of this event or metric. Use dots
. to separate namespaces. If you do not prefix the metric name with
yourapp., numbat will do this for you.
Number. Optional. Timestamp in milliseconds since the epoch. If you do not pass a time field, one will be created for you with
Number. Optional. The value of this metric, if appropriate. If you do not pass a value field, it will be defaulted to
String. Optional. One of
unknown. Use this to trigger alerts if this event represents a known-bad condition.
Textual description of the event. Max 255 bytes. Optional.
Number. Optional. Milliseconds that this event is considered valid. The analyzer will expire the event after
See also the example emitter in example.js.
var e1 =name: 'request.latency'value: 42status: 'okay';var e2 =name: 'request.latency'value: 5023status: 'warning';var e3 = name: 'heartbeat' ttl: 30000 ;
Yes, please do! See our contributing guide for basic rules of engagement.