mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Show Nodejs heap stats only at Standalone WeKan.
Not shown at Sandstorm WeKan, because there's a bunch of machine performance data Sandstorm doesn't expose to apps to prevent side channel attacks. Thanks to ocdtrekkie and xet7 ! Fixes #4154
This commit is contained in:
parent
6d719b8a98
commit
02b6df320f
2 changed files with 80 additions and 66 deletions
|
|
@ -65,48 +65,49 @@ template(name='statistics')
|
||||||
tr
|
tr
|
||||||
th {{_ 'OS_Cpus'}}
|
th {{_ 'OS_Cpus'}}
|
||||||
td {{statistics.os.cpus.length}}
|
td {{statistics.os.cpus.length}}
|
||||||
tr
|
unless isSandstorm
|
||||||
th {{_ 'Node_heap_total_heap_size'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.totalHeapSize}}
|
th {{_ 'Node_heap_total_heap_size'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.totalHeapSize}}
|
||||||
th {{_ 'Node_heap_total_heap_size_executable'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.totalHeapSizeExecutable}}
|
th {{_ 'Node_heap_total_heap_size_executable'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.totalHeapSizeExecutable}}
|
||||||
th {{_ 'Node_heap_total_physical_size'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.totalPhysicalSize}}
|
th {{_ 'Node_heap_total_physical_size'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.totalPhysicalSize}}
|
||||||
th {{_ 'Node_heap_total_available_size'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.totalAvailableSize}}
|
th {{_ 'Node_heap_total_available_size'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.totalAvailableSize}}
|
||||||
th {{_ 'Node_heap_used_heap_size'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.usedHeapSize}}
|
th {{_ 'Node_heap_used_heap_size'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.usedHeapSize}}
|
||||||
th {{_ 'Node_heap_heap_size_limit'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.heapSizeLimit}}
|
th {{_ 'Node_heap_heap_size_limit'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.heapSizeLimit}}
|
||||||
th {{_ 'Node_heap_malloced_memory'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.mallocedMemory}}
|
th {{_ 'Node_heap_malloced_memory'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.mallocedMemory}}
|
||||||
th {{_ 'Node_heap_peak_malloced_memory'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeHeapStats.peakMallocedMemory}}
|
th {{_ 'Node_heap_peak_malloced_memory'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeHeapStats.peakMallocedMemory}}
|
||||||
th {{_ 'Node_heap_does_zap_garbage'}}
|
tr
|
||||||
td {{statistics.nodeHeapStats.doesZapGarbage}}
|
th {{_ 'Node_heap_does_zap_garbage'}}
|
||||||
tr
|
td {{statistics.nodeHeapStats.doesZapGarbage}}
|
||||||
th {{_ 'Node_heap_number_of_native_contexts'}}
|
tr
|
||||||
td {{statistics.nodeHeapStats.numberOfNativeContexts}}
|
th {{_ 'Node_heap_number_of_native_contexts'}}
|
||||||
tr
|
td {{statistics.nodeHeapStats.numberOfNativeContexts}}
|
||||||
th {{_ 'Node_heap_number_of_detached_contexts'}}
|
tr
|
||||||
td {{statistics.nodeHeapStats.numberOfDetachedContexts}}
|
th {{_ 'Node_heap_number_of_detached_contexts'}}
|
||||||
tr
|
td {{statistics.nodeHeapStats.numberOfDetachedContexts}}
|
||||||
th {{_ 'Node_memory_usage_rss'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeMemoryUsage.rss}}
|
th {{_ 'Node_memory_usage_rss'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeMemoryUsage.rss}}
|
||||||
th {{_ 'Node_memory_usage_heap_total'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeMemoryUsage.heapTotal}}
|
th {{_ 'Node_memory_usage_heap_total'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeMemoryUsage.heapTotal}}
|
||||||
th {{_ 'Node_memory_usage_heap_used'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeMemoryUsage.heapUsed}}
|
th {{_ 'Node_memory_usage_heap_used'}}
|
||||||
tr
|
td {{bytesToSize statistics.nodeMemoryUsage.heapUsed}}
|
||||||
th {{_ 'Node_memory_usage_external'}}
|
tr
|
||||||
td {{bytesToSize statistics.nodeMemoryUsage.external}}
|
th {{_ 'Node_memory_usage_external'}}
|
||||||
|
td {{bytesToSize statistics.nodeMemoryUsage.external}}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
import { MongoInternals } from 'meteor/mongo';
|
import { MongoInternals } from 'meteor/mongo';
|
||||||
|
|
||||||
|
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
|
||||||
|
// in the package definition.
|
||||||
|
const isSandstorm =
|
||||||
|
Meteor.settings && Meteor.settings.public && Meteor.settings.public.sandstorm;
|
||||||
|
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
getStatistics() {
|
getStatistics() {
|
||||||
|
|
@ -28,27 +33,35 @@ if (Meteor.isServer) {
|
||||||
pid: process.pid,
|
pid: process.pid,
|
||||||
uptime: process.uptime(),
|
uptime: process.uptime(),
|
||||||
};
|
};
|
||||||
const v8 = require('v8'); // Import the v8 module
|
// Start: Show Nodejs heap stats at Standalone WeKan.
|
||||||
statistics.nodeHeapStats = {
|
//
|
||||||
totalHeapSize: v8.getHeapStatistics().total_heap_size,
|
// Not shown at Sandstorm WeKan, because there's a bunch of machine performance data
|
||||||
totalHeapSizeExecutable: v8.getHeapStatistics().total_heap_size_executable,
|
// Sandstorm doesn't expose to apps to prevent side channel attacks.
|
||||||
totalPhysicalSize: v8.getHeapStatistics().total_physical_size,
|
if (!isSandstorm) {
|
||||||
totalAvailableSize: v8.getHeapStatistics().total_available_size,
|
const v8 = require('v8'); // Import the v8 module
|
||||||
usedHeapSize: v8.getHeapStatistics().used_heap_size,
|
statistics.nodeHeapStats = {
|
||||||
heapSizeLimit: v8.getHeapStatistics().heap_size_limit,
|
totalHeapSize: v8.getHeapStatistics().total_heap_size,
|
||||||
mallocedMemory: v8.getHeapStatistics().malloced_memory,
|
totalHeapSizeExecutable: v8.getHeapStatistics().total_heap_size_executable,
|
||||||
peakMallocedMemory: v8.getHeapStatistics().peak_malloced_memory,
|
totalPhysicalSize: v8.getHeapStatistics().total_physical_size,
|
||||||
doesZapGarbage: v8.getHeapStatistics().does_zap_garbage,
|
totalAvailableSize: v8.getHeapStatistics().total_available_size,
|
||||||
numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts,
|
usedHeapSize: v8.getHeapStatistics().used_heap_size,
|
||||||
numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts,
|
heapSizeLimit: v8.getHeapStatistics().heap_size_limit,
|
||||||
};
|
mallocedMemory: v8.getHeapStatistics().malloced_memory,
|
||||||
let memoryUsage = process.memoryUsage();
|
peakMallocedMemory: v8.getHeapStatistics().peak_malloced_memory,
|
||||||
statistics.nodeMemoryUsage = {
|
doesZapGarbage: v8.getHeapStatistics().does_zap_garbage,
|
||||||
rss: memoryUsage.rss,
|
numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts,
|
||||||
heapTotal: memoryUsage.heapTotal,
|
numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts,
|
||||||
heapUsed: memoryUsage.heapUsed,
|
};
|
||||||
external: memoryUsage.external,
|
let memoryUsage = process.memoryUsage();
|
||||||
};
|
statistics.nodeMemoryUsage = {
|
||||||
|
rss: memoryUsage.rss,
|
||||||
|
heapTotal: memoryUsage.heapTotal,
|
||||||
|
heapUsed: memoryUsage.heapUsed,
|
||||||
|
external: memoryUsage.external,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// End: Show Nodejs heap stats at Standalone WeKan.
|
||||||
|
//
|
||||||
// Remove beginning of Meteor release text METEOR@
|
// Remove beginning of Meteor release text METEOR@
|
||||||
let meteorVersion = Meteor.release;
|
let meteorVersion = Meteor.release;
|
||||||
meteorVersion = meteorVersion.replace('METEOR@', '');
|
meteorVersion = meteorVersion.replace('METEOR@', '');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue