improvement(module:metrics): add websocket clients and memory caches

This commit is contained in:
Alexis Tyler
2019-11-09 12:12:17 +10:30
parent 50d96ea16c
commit efaa84afde

30
app/metrics.js Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright 2019 Lime Technology Inc. All rights reserved.
* Written by: Alexis Tyler
*/
/**
* The Graphql pm2 metrics reporters.
*/
module.exports = function ($injector) {
const websocketClients = {
name: 'Websocket clients',
value: () => $injector.resolve('ws-clients').size
};
const memoryCaches = {
name: 'Memory caches',
value: () => {
const caches = $injector.resolve('caches');
const keys = caches.keys();
// Return amount of caches that exist
return keys.length;
}
};
return {
websocketClients,
memoryCaches
};
}