Skip to content

Commit

Permalink
Merge branch 'master' of github.com:keymetrics/pmx
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Mar 9, 2017
2 parents c1ba50d + 7d84f8b commit 5dee789
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 30 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@

# 1.0.0-beta1
# 1.0.3

- alias samples to seconds
- Http probe req/s -> req/min

# 1.0.2

- add stackframe to exception

# 1.0.1

- Include transaction tracing system
- Test on Node v7
Expand Down
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
# PM2 programmatic integration

[![bitHound Overalll Score](https://www.bithound.io/github/keymetrics/pmx/badges/score.svg)](https://www.bithound.io/github/keymetrics/pmx)
![Build Status](https://api.travis-ci.org/keymetrics/pmx.png?branch=master)
[![Package Quality](http://npm.packagequality.com/shield/pmx.svg)](http://packagequality.com/#?package=pmx)
[![npm version](https://badge.fury.io/js/pmx.svg)](https://badge.fury.io/js/pmx)

PMX is a module that allows you to create advanced interactions with Keymetrics.
<div align="center">
<a href="http://pm2.keymetrics.io">
<img width=411px src="https://raw.githubusercontent.com/keymetrics/pmx/master/pres/logo.png">
</a>
<br/>
<b><a href="https://github.com/Unitech/pm2">PM2</a> programmatic integration</b>
<br/>
<br/>
<a href="https://www.bithound.io/github/keymetrics/pmx">
<img src="https://www.bithound.io/github/keymetrics/pmx/badges/score.svg"/>
</a>
<a href="https://travis-ci.org/keymetrics/pmx">
<img src="https://api.travis-ci.org/keymetrics/pmx.png?branch=master"/>
</a>
<a href="https://badge.fury.io/js/pmx">
<img src="https://www.bithound.io/github/keymetrics/pmx/badges/score.svg"/>
</a>
<br/>
<br/>
</div>


PMX allows you to create advanced interactions with [PM2](https://github.com/Unitech/pm2) and [Keymetrics.io](https://app.keymetrics.io/).

# Table of Contents

- [**Installation**](https://github.com/keymetrics/pmx/blob/master/README.md#installation)
- [**Expose Custom Metrics**](https://github.com/keymetrics/pmx#expose-metrics-measure-anything)
- [**Expose Triggerable Runtime Functions**](https://github.com/keymetrics/pmx#expose-functions-trigger-functions-remotely)
- [**Report Exceptions and Alerts**](https://github.com/keymetrics/pmx#alert-system-for-custom-metrics)
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/probes/Meter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Meter(opts) {
var self = this;

this._tickInterval = 5 * units.SECONDS;
this._samples = opts.samples || 1;
this._samples = opts.samples || opts.seconds || 1;
this._timeframe = opts.timeframe || 60;

this._rate = new EWMA(this._timeframe * units.SECONDS, this._tickInterval);
Expand Down
6 changes: 3 additions & 3 deletions lib/wrapper/simple_http.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var HttpWrap = module.exports = function(opts, http) {

gl_meter = require('../pmx').probe().meter({
name : 'HTTP',
seconds : 60,
unit : 'req/s'
samples : 60,
unit : 'req/min'
});

gl_latency = require('../pmx').probe().histogram({
Expand Down Expand Up @@ -95,4 +95,4 @@ var HttpWrap = module.exports = function(opts, http) {
};
});
return http;
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pmx",
"version": "1.0.1",
"version": "1.0.3",
"description": "PM2/Keymetrics advanced API",
"main": "index.js",
"dependencies": {
Expand Down
Binary file added pres/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 18 additions & 17 deletions test/vxx.e2e.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ describe('Programmatically test interactor', function() {
});

describe('application testing', function() {
afterEach(function() {
//console.log(sub);
//sub.unsubscribe();
});

it('should start test application', function(done) {
sub.once('message', function(data) {
var packet = JSON.parse(data);
Expand All @@ -63,11 +58,10 @@ describe('Programmatically test interactor', function() {
pm2.start({
script : 'app.js',
name : 'API',
env: {
"DEBUG": "*"
}
trace : true
}, function(err, data) {

if (err)
console.error(err);
});
});

Expand All @@ -82,6 +76,9 @@ describe('Programmatically test interactor', function() {
packet.data['axm:transaction'].length.should.eql(1);
var data = packet.data['axm:transaction'][0].data;

if (Object.keys(data.routes).length != 3)
return callAgain();

// Should only find 3 different routes
Object.keys(data.routes).length.should.eql(3);
data.routes[0].should.have.properties(['meta', 'variances', 'path']);
Expand All @@ -107,14 +104,16 @@ describe('Programmatically test interactor', function() {
if (packet.data['axm:transaction']) {
var data = packet.data['axm:transaction'][0].data;
// Should now route summary contains 4 routes
Object.keys(data.routes).length.should.eql(4);
// Object.keys(data.routes).length.should.eql(3);

var route = data.routes.filter(function (route) {
return route.path === '/db1/save';
})[0];

if (!route) return callAgain();

// Should count 10 transactions
route.variances[0].count.should.eql(10);
//console.log(packet.data['axm:transaction'][0].data.routes['/db1/save']);
route.variances[0].spans.length.should.eql(2);
route.variances[0].spans[1].name.should.eql('mongo-insert');
done();
Expand All @@ -134,13 +133,16 @@ describe('Programmatically test interactor', function() {

if (packet.data['axm:transaction']) {
var data = packet.data['axm:transaction'][0].data;
// Should now route summary contains 5 routes
Object.keys(data.routes).length.should.eql(5);

var route = data.routes.filter(function (route) {
return route.path === '/db1/get';
})[0];

if (!route) return callAgain();

// Should now route summary contains 5 routes
Object.keys(data.routes).length.should.eql(5);

// @bug: should contain only 1 transaction not 2 (only find)
route.variances[0].spans.length.should.eql(2);

Expand All @@ -161,13 +163,13 @@ describe('Programmatically test interactor', function() {

if (packet.data['axm:transaction']) {
var data = packet.data['axm:transaction'][0].data;
// Should now route summary contains 5 routes
Object.keys(data.routes).length.should.eql(6);

var route = data.routes.filter(function (route) {
return route.path === '/db1/multi';
})[0];

if (!route) return callAgain();

// @bug: should contain only 2 transactions not 3 (find + findOne)
route.variances[0].spans.length.should.eql(3);

Expand All @@ -181,7 +183,6 @@ describe('Programmatically test interactor', function() {
pm2.trigger('API', 'db1multi');
});


});

});
});

0 comments on commit 5dee789

Please sign in to comment.