Add total transactions metric

master
Excitable Aardvark 6 years ago
parent 8d2eb535c3
commit 5e27ff6313

@ -3,14 +3,21 @@
### Environment Variables
* `DAEMON_HOST` - monerod host, example: `http://localhost:18081`
* `PORT` - port to expose metrics on
* `DAEMON_HOST` - monerod host, default: `http://localhost:18081`
* `PORT` - port to expose metrics on, default: `9396`
### Metrics Exported
* `monerod_connections_incoming` - Number of incoming connections
* `monerod_connections_outgoing` - Number of outgoing connections
* `monerod_mempool_size` - Number of transactions in the mempool
* `monerod_tx_mempool` - Number of transactions in the mempool
* `monerod_tx_chain` - Number of transactions in total
### Pretty Screenshots
You can use Grafana to create a dashboard to show everyone how cool you are.
![Grafana Screenshot](https://i.imgur.com/2rqyOcY.png)
### License

@ -18,7 +18,8 @@ const daemon = new Daemon(DAEMON_HOST)
const incomingConnections = new Gauge({ name: 'monerod_connections_incoming', help: 'Number of incoming connections' })
const outgoingConnections = new Gauge({ name: 'monerod_connections_outgoing', help: 'Number of outgoing connections' })
const mempoolSize = new Gauge({ name: 'monerod_mempool_size', help: 'Number of transactions in the mempool' })
const mempoolSize = new Gauge({ name: 'monerod_tx_mempool', help: 'Number of transactions in the mempool' })
const txCount = new Gauge({ name: 'monerod_tx_chain', help: 'Number of transactions in total' })
app.get('/metrics', (req, res) => {
console.log('.')
@ -28,6 +29,7 @@ app.get('/metrics', (req, res) => {
incomingConnections.set(Number(info.incoming_connections_count))
outgoingConnections.set(Number(info.outgoing_connections_count))
txCount.set(Number(info.tx_count))
mempoolSize.set(Number(info.tx_pool_size))
res.end(prometheus.register.metrics())