Konpeki-Discord-Bot/utils/pm2-metrics.js

35 lines
771 B
JavaScript
Raw Normal View History

2022-12-16 03:58:49 -06:00
/*
* Konpeki Discord Bot - Utility Definition File
2022-12-16 03:58:49 -06:00
* pm2-metrics.js - A place to keep all pm2 metrics and error definitions
*/
2022-12-16 02:42:59 -06:00
const io = require('@pm2/io');
const interactionErrors = io.counter({
name: 'Interaction Errors (Since last restart)',
});
const interactionSuccessCounter = io.counter({
name: 'Interaction Successful Runs (Since last restart)',
});
const interactionSuccessMeter = io.meter({
name: 'Successful Interactions per Second',
});
const websocketHeartbeatHist = io.histogram({
name: 'Websocket Heartbeat (ms)',
measurement: 'mean',
2022-12-16 02:42:59 -06:00
});
const interactionSuccess = function() {
interactionSuccessCounter.inc();
interactionSuccessMeter.mark();
};
module.exports = {
io,
interactionErrors,
interactionSuccess,
websocketHeartbeatHist,
2022-12-16 02:42:59 -06:00
};