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,6 +65,7 @@ template(name='statistics')
|
|||
tr
|
||||
th {{_ 'OS_Cpus'}}
|
||||
td {{statistics.os.cpus.length}}
|
||||
unless isSandstorm
|
||||
tr
|
||||
th {{_ 'Node_heap_total_heap_size'}}
|
||||
td {{bytesToSize statistics.nodeHeapStats.totalHeapSize}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
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) {
|
||||
Meteor.methods({
|
||||
getStatistics() {
|
||||
|
|
@ -28,6 +33,11 @@ if (Meteor.isServer) {
|
|||
pid: process.pid,
|
||||
uptime: process.uptime(),
|
||||
};
|
||||
// Start: Show Nodejs heap stats 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.
|
||||
if (!isSandstorm) {
|
||||
const v8 = require('v8'); // Import the v8 module
|
||||
statistics.nodeHeapStats = {
|
||||
totalHeapSize: v8.getHeapStatistics().total_heap_size,
|
||||
|
|
@ -49,6 +59,9 @@ if (Meteor.isServer) {
|
|||
heapUsed: memoryUsage.heapUsed,
|
||||
external: memoryUsage.external,
|
||||
};
|
||||
}
|
||||
// End: Show Nodejs heap stats at Standalone WeKan.
|
||||
//
|
||||
// Remove beginning of Meteor release text METEOR@
|
||||
let meteorVersion = Meteor.release;
|
||||
meteorVersion = meteorVersion.replace('METEOR@', '');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue