Skip to content

Commit

Permalink
Merge pull request #3448 from Unitech/deep_monitoring_flag
Browse files Browse the repository at this point in the history
feat: add flag to enable deep-monitoring
  • Loading branch information
Unitech authored Feb 5, 2018
2 parents 719d328 + 4d1bea5 commit 331bc74
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ commander.version(pkg.version)
.option('--sort <field_name:sort>', 'sort process according to field\'s name')
.option('--v8', 'enable v8 data collecting')
.option('--event-loop-inspector', 'enable event-loop-inspector dump in pmx')
.option('--deep-monitoring', 'enable all monitoring tools (equivalent to --v8 --event-loop-inspector --trace')
.usage('[cmd] app');

commander.on('--help', function() {
Expand Down
5 changes: 5 additions & 0 deletions lib/API/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
"boolean"
]
},
"deep_monitoring": {
"type": [
"boolean"
]
},
"increment_var": {
"type": "string"
},
Expand Down
7 changes: 4 additions & 3 deletions lib/ProcessContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ delete process.env.pm2_env;

if (process.env.pmx !== 'false') {
require('pmx').init({
transactions: (process.env.km_link === 'true' && process.env.trace === 'true') || false,
transactions: (process.env.km_link === 'true' && (process.env.trace === 'true' || process.env.deep_monitoring === 'true')) || false,
http: process.env.km_link === 'true' || false,
v8: process.env.v8 === 'true' || false,
event_loop_dump: process.env['event_loop_inspector'] === 'true' || false
v8: process.env.v8 === 'true' || process.env.deep_monitoring === 'true' || false,
event_loop_dump: process.env.event_loop_inspector === 'true' || process.env.deep_monitoring === 'true' || false,
deep_metrics: process.env.deep_monitoring === 'true' || false
});
}

Expand Down
7 changes: 4 additions & 3 deletions lib/ProcessContainerFork.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// Inject custom modules
if (process.env.pmx !== 'false') {
require('pmx').init({
transactions: (process.env.km_link === 'true' && process.env.trace === 'true') || false,
transactions: (process.env.km_link === 'true' && (process.env.trace === 'true' || process.env.deep_monitoring === 'true')) || false,
http: process.env.km_link === 'true' || false,
v8: process.env.v8 === 'true' || false,
event_loop_dump: process.env['event_loop_inspector'] === 'true' || false
v8: process.env.v8 === 'true' || process.env.deep_monitoring === 'true' || false,
event_loop_dump: process.env.event_loop_inspector === 'true' || process.env.deep_monitoring === 'true' || false,
deep_metrics: process.env.deep_monitoring === 'true' || false
});
}

Expand Down

0 comments on commit 331bc74

Please sign in to comment.