mirror of
https://github.com/unraid/api.git
synced 2026-01-12 03:30:08 -06:00
improvement(module:metrics): add websocket clients and memory caches
This commit is contained in:
30
app/metrics.js
Normal file
30
app/metrics.js
Normal 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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user