An express app to serve your segmentio/metrics as an internal API.
$ npm install metrics-express
var Metrics = require('metrics');
var serve = require('metrics-express');
var metrics = Metrics()
.every('10m', charges('stripe-key')
.every('10m', subscriptions('stripe-key')
.every('1d', awsBilling(accountId, key, secret, bucket, region))
.every('10m', helpscout('helpscout-key', ['mailbox']));
express()
.use('/', serve(metrics))
.listen(7002);
After your server starts, you'll be able to access a list of your metrics at:
GET /
And get the detailed metric value at this route:
GET /:name
POST /:name/:newVal
Posts values to the server. For example, let's say your current Monthly Recurring Revenue is $5000.
When you make a sale, you can add to your current MRR from the terminal using:
curl -X POST https://localhost:7002/MRR/10000
This will bring your total MRR to $15000
MIT