From 109b331ddf37e061d1890ef952f4cd167ce53f64 Mon Sep 17 00:00:00 2001 From: Unitech Date: Fri, 18 May 2018 20:17:59 +0200 Subject: [PATCH] refactor: keymetrics examples --- .../actions-fibonacci.js | 2 +- .../custom_action.js | 2 +- .../custom_action_with_params.js | 2 +- .../test-all-keymetrics-features/event.js | 2 +- .../test-all-keymetrics-features/http_app.js | 4 +-- .../http_transaction.js | 4 +-- .../test-all-keymetrics-features/pm2_probe.js | 7 ++--- .../test-all-keymetrics-features/probes.js | 4 +-- .../process-transpose.js | 28 +++++++++---------- .../scoped-actions.js | 6 ++-- .../test-all-keymetrics-features/throw.js | 4 +-- 11 files changed, 31 insertions(+), 34 deletions(-) diff --git a/examples/test-all-keymetrics-features/actions-fibonacci.js b/examples/test-all-keymetrics-features/actions-fibonacci.js index 3b2303142..608753f69 100644 --- a/examples/test-all-keymetrics-features/actions-fibonacci.js +++ b/examples/test-all-keymetrics-features/actions-fibonacci.js @@ -47,7 +47,7 @@ function fib(n) { } -var axm = require('pmx'); +var axm = require('@pm2/io'); axm.action('load:start', function(reply) { fib(50000); diff --git a/examples/test-all-keymetrics-features/custom_action.js b/examples/test-all-keymetrics-features/custom_action.js index 5a01fc633..d11d82572 100644 --- a/examples/test-all-keymetrics-features/custom_action.js +++ b/examples/test-all-keymetrics-features/custom_action.js @@ -1,5 +1,5 @@ -var axm = require('pmx'); +var axm = require('@pm2/io'); axm.action('getEnv', function(reply) { reply(process.env); diff --git a/examples/test-all-keymetrics-features/custom_action_with_params.js b/examples/test-all-keymetrics-features/custom_action_with_params.js index 8d0b66302..023c75e77 100644 --- a/examples/test-all-keymetrics-features/custom_action_with_params.js +++ b/examples/test-all-keymetrics-features/custom_action_with_params.js @@ -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'); diff --git a/examples/test-all-keymetrics-features/event.js b/examples/test-all-keymetrics-features/event.js index dca10d4fe..3c092ac14 100644 --- a/examples/test-all-keymetrics-features/event.js +++ b/examples/test-all-keymetrics-features/event.js @@ -1,5 +1,5 @@ -var axm = require('pmx'); +var axm = require('@pm2/io'); setInterval(function() { diff --git a/examples/test-all-keymetrics-features/http_app.js b/examples/test-all-keymetrics-features/http_app.js index 38653c028..2e24737a9 100644 --- a/examples/test-all-keymetrics-features/http_app.js +++ b/examples/test-all-keymetrics-features/http_app.js @@ -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'); diff --git a/examples/test-all-keymetrics-features/http_transaction.js b/examples/test-all-keymetrics-features/http_transaction.js index 87e122535..1334ea85b 100644 --- a/examples/test-all-keymetrics-features/http_transaction.js +++ b/examples/test-all-keymetrics-features/http_transaction.js @@ -1,6 +1,6 @@ -var axm = require('pmx'); +var axm = require('@pm2/io'); var probe = axm.probe(); @@ -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))]); diff --git a/examples/test-all-keymetrics-features/pm2_probe.js b/examples/test-all-keymetrics-features/pm2_probe.js index bedab4c9b..a8741ae3c 100644 --- a/examples/test-all-keymetrics-features/pm2_probe.js +++ b/examples/test-all-keymetrics-features/pm2_probe.js @@ -1,16 +1,15 @@ -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'], @@ -18,7 +17,7 @@ var conf = pmx.initModule({ } }); -var probe = pmx.probe(); +var probe = io.probe(); var pm2_procs = 0; diff --git a/examples/test-all-keymetrics-features/probes.js b/examples/test-all-keymetrics-features/probes.js index 51dc1f562..8cefdac20 100644 --- a/examples/test-all-keymetrics-features/probes.js +++ b/examples/test-all-keymetrics-features/probes.js @@ -1,6 +1,6 @@ -var axm = require('pmx'); +var axm = require('@pm2/io'); var probe = axm.probe(); @@ -84,7 +84,7 @@ setInterval(function() { }, 1500); -axm.catchAll(); +//axm.catchAll(); axm.action('throw error', function(reply) { setTimeout(function() { diff --git a/examples/test-all-keymetrics-features/process-transpose.js b/examples/test-all-keymetrics-features/process-transpose.js index a0f078da6..d02ed7e85 100644 --- a/examples/test-all-keymetrics-features/process-transpose.js +++ b/examples/test-all-keymetrics-features/process-transpose.js @@ -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); diff --git a/examples/test-all-keymetrics-features/scoped-actions.js b/examples/test-all-keymetrics-features/scoped-actions.js index 5a096dd4e..427dcc8c6 100644 --- a/examples/test-all-keymetrics-features/scoped-actions.js +++ b/examples/test-all-keymetrics-features/scoped-actions.js @@ -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); @@ -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); diff --git a/examples/test-all-keymetrics-features/throw.js b/examples/test-all-keymetrics-features/throw.js index 7351209c4..1c9dfd1f4 100644 --- a/examples/test-all-keymetrics-features/throw.js +++ b/examples/test-all-keymetrics-features/throw.js @@ -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');