allow admins to inspect index/metadata caches

pull/1/head
ansuz 5 years ago
parent c8c98b5747
commit 6d0dee979a

@ -19,6 +19,26 @@ var getFileDescriptorLimit = function (env, server, cb) {
Ulimit(cb); Ulimit(cb);
}; };
var getCacheStats = function (env, server, cb) {
var metaCount = 0;
var channelCount = 0;
var meta = env.metadata_cache;
for (var x in meta) {
if (meta.hasOwnProperty(x)) { metaCount++; }
}
var channels = env.channel_cache;
for (var y in channels) {
if (channels.hasOwnProperty(y)) { channelCount++; }
}
cb(void 0, {
metadata: metaCount,
channel: channelCount,
});
};
var getActiveSessions = function (Env, Server, cb) { var getActiveSessions = function (Env, Server, cb) {
var stats = Server.getSessionStats(); var stats = Server.getSessionStats();
cb(void 0, [ cb(void 0, [
@ -137,6 +157,7 @@ var commands = {
GET_FILE_DESCRIPTOR_COUNT: getFileDescriptorCount, GET_FILE_DESCRIPTOR_COUNT: getFileDescriptorCount,
GET_FILE_DESCRIPTOR_LIMIT: getFileDescriptorLimit, GET_FILE_DESCRIPTOR_LIMIT: getFileDescriptorLimit,
SET_DEFAULT_STORAGE_LIMIT: setDefaultStorageLimit, SET_DEFAULT_STORAGE_LIMIT: setDefaultStorageLimit,
GET_CACHE_STATS: getCacheStats,
}; };
Admin.command = function (Env, safeKey, data, _cb, Server) { Admin.command = function (Env, safeKey, data, _cb, Server) {

Loading…
Cancel
Save