Add NodeJS statistics - part 1 - heap statistics

This commit is contained in:
Ben0it-T 2021-11-06 21:37:18 +01:00
parent 26826b6120
commit 790a82c4b1
3 changed files with 59 additions and 1 deletions

View file

@ -28,6 +28,20 @@ if (Meteor.isServer) {
pid: process.pid,
uptime: process.uptime(),
};
const v8 = require('v8'); // Import the v8 module
statistics.nodeHeapStats = {
totalHeapSize: v8.getHeapStatistics().total_heap_size,
totalHeapSizeExecutable: v8.getHeapStatistics().total_heap_size_executable,
totalPhysicalSize: v8.getHeapStatistics().total_physical_size,
totalAvailableSize: v8.getHeapStatistics().total_available_size,
usedHeapSize: v8.getHeapStatistics().used_heap_size,
heapSizeLimit: v8.getHeapStatistics().heap_size_limit,
mallocedMemory: v8.getHeapStatistics().malloced_memory,
peakMallocedMemory: v8.getHeapStatistics().peak_malloced_memory,
doesZapGarbage: v8.getHeapStatistics().does_zap_garbage,
numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts,
numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts,
};
// Remove beginning of Meteor release text METEOR@
let meteorVersion = Meteor.release;
meteorVersion = meteorVersion.replace('METEOR@', '');