0.3.0 • Published 1 year ago

socket.io-prometheus v0.3.0

Weekly downloads
303
License
MIT
Repository
github
Last release
1 year ago

socket.io-prometheus

NPM Version

Collect socket.io server metrics with Prometheus.

Example Usage

This module has a peer dependency on prom-client, version 10 and up.

Pass the socket.io instance to the socket.io-prometheus module.

const app = require('express')();
const server = require('http').Server(app);
const io = require('socket.io')(server);
const ioMetrics = require('socket.io-prometheus')
const promRegister = require('prom-client').register

// start collecting socket.io metrics
ioMetrics(io);

// expose metrics endpoint
app.get('/metrics', (req, res) => {
  res.set('Content-Type', promRegister.contentType)
  res.end(promRegister.metrics())
})

Metrics exposed

all metrics have socket_io_ prefix in their names.

NameHelpLabels
socket_io_connectedNumber of currently connected sockets
socket_io_connect_totalTotal count of socket.io connection requests
socket_io_disconnect_totalTotal count of socket.io disconnections
socket_io_events_received_totalTotal count of socket.io recieved eventsevent
socket_io_events_sent_totalTotal count of socket.io sent eventsevent
socket_io_recieve_bytesTotal socket.io bytes recievedevent
socket_io_transmit_bytesTotal socket.io bytes transmittedevent

License

Licensed under the MIT License. See the LICENSE file for details.

0.3.0

1 year ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago