Add NodeJS statistics - part 2 - memory usage

This commit is contained in:
Ben0it-T 2021-11-06 22:49:41 +01:00
parent 790a82c4b1
commit d04e9bbabd
3 changed files with 24 additions and 1 deletions

View file

@ -98,3 +98,15 @@ template(name='statistics')
tr
th {{_ 'Node_heap_number_of_detached_contexts'}}
td {{statistics.nodeHeapStats.numberOfDetachedContexts}}
tr
th {{_ 'Node_memory_usage_rss'}}
td {{bytesToSize statistics.nodeMemoryUsage.rss}}
tr
th {{_ 'Node_memory_usage_heap_total'}}
td {{bytesToSize statistics.nodeMemoryUsage.heapTotal}}
tr
th {{_ 'Node_memory_usage_heap_used'}}
td {{bytesToSize statistics.nodeMemoryUsage.heapUsed}}
tr
th {{_ 'Node_memory_usage_external'}}
td {{bytesToSize statistics.nodeMemoryUsage.external}}

View file

@ -1109,5 +1109,9 @@
"Node_heap_peak_malloced_memory": "Node heap : peak malloced memory",
"Node_heap_does_zap_garbage": "Node heap : does zap garbage",
"Node_heap_number_of_native_contexts": "Node heap : number of native contexts",
"Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts"
"Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts",
"Node_memory_usage_rss": "Node memory usage : Resident Set Size",
"Node_memory_usage_heap_total": "Node memory usage : total size of the allocated heap",
"Node_memory_usage_heap_used": "Node memory usage : actual memory used",
"Node_memory_usage_external": "Node memory usage : external"
}

View file

@ -42,6 +42,13 @@ if (Meteor.isServer) {
numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts,
numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts,
};
let memoryUsage = process.memoryUsage();
statistics.nodeMemoryUsage = {
rss: memoryUsage.rss,
heapTotal: memoryUsage.heapTotal,
heapUsed: memoryUsage.heapUsed,
external: memoryUsage.external,
};
// Remove beginning of Meteor release text METEOR@
let meteorVersion = Meteor.release;
meteorVersion = meteorVersion.replace('METEOR@', '');