FtMetrics
FtMetrics is a node module/express middleware that allows you to simply integrate some basic metrics that comply with the Origami Metrics spec
How to use
Requireing the object
var ftMetrics = ;
There is also a configure
method that you can use to override some default settings.
var ftMetrics = ;ftMetrics;
Gathering metrics
Counter
Log a value representing a count, e.g. number of running processes, items in a queue, bytes of disk space remaining, seconds since last new content, etc
ftMetrics.count(key, optionalUnits, optionalDescription)
Examples:
ftMetrics;ftMetrics;ftMetrics;ftMetrics;
Booleans
Log a simple true/false value
ftMetrics;ftMetrics;ftMetrics;
Response time stats
The most common use case for gathering moving average statistics is to measure the response times of an endpoint. FtMetrics provides middleware that will automatically keep track of response times for a given route.
server;
You can also group multiple routes to the same key, by specifying a key to use.
server;server;
Manually tracking moving averages.
You can also manually calculate stats around some other processes that aren't routes e.g. connecting to a backend service.
var process = ftMetrics;processstart;process;
Displaying Metrics
You can get an object representation of all the gathered metrics with the getJSON
method.
var metrics = ftMetrics;
There is also an express method that can be used to handle the __metrics
endpoint as per the Origami spec.
server;