Skip to content

Commit

Permalink
refactor: keymetrics examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed May 18, 2018
1 parent f8c8bd9 commit 109b331
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/test-all-keymetrics-features/actions-fibonacci.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function fib(n) {
}


var axm = require('pmx');
var axm = require('@pm2/io');

axm.action('load:start', function(reply) {
fib(50000);
Expand Down
2 changes: 1 addition & 1 deletion examples/test-all-keymetrics-features/custom_action.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var axm = require('pmx');
var axm = require('@pm2/io');

axm.action('getEnv', function(reply) {
reply(process.env);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var axm = require('pmx');
var axm = require('@pm2/io');

axm.action('refresh:db', { comment : 'Refresh the database' }, function(reply) {
console.log('Refreshing');
Expand Down
2 changes: 1 addition & 1 deletion examples/test-all-keymetrics-features/event.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var axm = require('pmx');
var axm = require('@pm2/io');

setInterval(function() {

Expand Down
4 changes: 2 additions & 2 deletions examples/test-all-keymetrics-features/http_app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


var pmx = require('pmx').init({ http : true });
var probe = pmx.probe();
var io = require('@pm2/io').init({ http : true });
var probe = io.probe();

var http = require('http');

Expand Down
4 changes: 2 additions & 2 deletions examples/test-all-keymetrics-features/http_transaction.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


var axm = require('pmx');
var axm = require('@pm2/io');

var probe = axm.probe();

Expand All @@ -17,7 +17,7 @@ http.createServer(function(req, res) {
setTimeout(function() {
res.end('transaction');
}, 1000);
}).listen(9010);
}).listen(10010);

setInterval(function() {
request(['/user', '/bla', '/user/lol/delete', '/POST/POST'][Math.floor((Math.random() * 4))]);
Expand Down
7 changes: 3 additions & 4 deletions examples/test-all-keymetrics-features/pm2_probe.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
var pmx = require('pmx');
var io = require('@pm2/io');
var pm2 = require('../..');
var fs = require('fs');
var path = require('path');

var conf = pmx.initModule({
var conf = io.initModule({
comment : 'This module monitors PM2',
errors : true,
latency : false,
versioning : false,
show_module_meta : false,
module_type : 'database',
pid : pmx.getPID(path.join(process.env.HOME, '.pm2', 'pm2.pid')),

widget : {
theme : ['#111111', '#1B2228', '#807C7C', '#807C7C'],
logo : 'https://keymetrics.io/assets/images/pm2.20d3ef.png?v=0b71a506ce'
}
});

var probe = pmx.probe();
var probe = io.probe();

var pm2_procs = 0;

Expand Down
4 changes: 2 additions & 2 deletions examples/test-all-keymetrics-features/probes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


var axm = require('pmx');
var axm = require('@pm2/io');

var probe = axm.probe();

Expand Down Expand Up @@ -84,7 +84,7 @@ setInterval(function() {
}, 1500);


axm.catchAll();
//axm.catchAll();

axm.action('throw error', function(reply) {
setTimeout(function() {
Expand Down
28 changes: 14 additions & 14 deletions examples/test-all-keymetrics-features/process-transpose.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

var Probe = require('pmx').probe();
var Probe = require('@pm2/io').probe();

var counter = 0;

var metric = Probe.transpose({
name : 'data-flow',
data : function() {
return {
a : {
b : {
data : 'textflow',
array : [ 'yes', 'it', 'is' ]
}
}
}
}
});
// var metric = Probe.transpose({
// name : 'data-flow',
// data : function() {
// return {
// a : {
// b : {
// data : 'textflow',
// array : [ 'yes', 'it', 'is' ]
// }
// }
// }
// }
// });

setInterval(function() {
}, 100);
6 changes: 3 additions & 3 deletions examples/test-all-keymetrics-features/scoped-actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

var pmx = require('pmx');
var io = require('@pm2/io');

pmx.scopedAction('simple test', function(data, emitter) {
io.scopedAction('simple test', function(data, emitter) {
var i = setInterval(function() {
emitter.send('output-stream');
}, 100);
Expand All @@ -13,7 +13,7 @@ pmx.scopedAction('simple test', function(data, emitter) {
}, 3000);
});

pmx.scopedAction('throwing error', function(data, emitter) {
io.scopedAction('throwing error', function(data, emitter) {
var i = setInterval(function() {
emitter.send('output-stream');
}, 100);
Expand Down
4 changes: 1 addition & 3 deletions examples/test-all-keymetrics-features/throw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

var axm = require('pmx');

axm.catchAll();
var axm = require('@pm2/io');

setTimeout(function() {
console.log('log message from echo auto kill');
Expand Down

0 comments on commit 109b331

Please sign in to comment.