refactor: keymetrics examples

This commit is contained in:
Unitech 2018-05-18 20:17:59 +02:00
parent f8c8bd9072
commit 109b331ddf
11 changed files with 31 additions and 34 deletions

View File

@ -47,7 +47,7 @@ function fib(n) {
}
var axm = require('pmx');
var axm = require('@pm2/io');
axm.action('load:start', function(reply) {
fib(50000);

View File

@ -1,5 +1,5 @@
var axm = require('pmx');
var axm = require('@pm2/io');
axm.action('getEnv', function(reply) {
reply(process.env);

View File

@ -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');

View File

@ -1,5 +1,5 @@
var axm = require('pmx');
var axm = require('@pm2/io');
setInterval(function() {

View File

@ -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');

View File

@ -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))]);

View File

@ -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;

View File

@ -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() {

View File

@ -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);

View File

@ -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);

View File

@ -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');