Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

feat(#64) added multiple aggregate levels #66

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
npm-debug.log
coverage
.vscode
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change log

## [Unreleased] - 2017-07-24
- **Added:** Longer history for graphs [\#64]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to include the PR reference at the bottom of the file.


## [v0.4.1] - 2017-03-21
- **Added:** Historical memory usage graph [\#63]
- **Added:** Support for log filtering - see README [\#62]
Expand Down
52 changes: 52 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use strict";

// these define the time levels that data will be aggregated into
// each number is in milliseconds
//
// since these are used as object keys, they are strings
//
// For example, 5000 = 5s and means that one of the aggregate levels
// will be at 5s increments of time
//
// 300000 = 30s and the corresponding zoom will show 30s aggregates
var AGGREGATE_TIME_LEVELS = [
"5000",
"10000",
"15000",
"30000",
"60000",
"300000",
"600000",
"900000",
"1800000",
"3600000"
];

// this array object is used to reduce ms to its highest human-readable form
// see lib/providers/metrics-provider.js::getTimeIndexLabel
var TIME_SCALES = [
{
units: "ms",
divisor: 1
}, {
units: "s",
divisor: 1000
}, {
units: "m",
divisor: 60
}, {
units: "h",
divisor: 60
}, {
units: "d",
divisor: 24
}, {
units: "y",
divisor: 365.24
}
];

module.exports = {
AGGREGATE_TIME_LEVELS: AGGREGATE_TIME_LEVELS,
TIME_SCALES: TIME_SCALES
};
6 changes: 6 additions & 0 deletions lib/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ Dashboard.prototype._configureKeys = function () {
this.screen.key(["q", "C-c"], function () {
process.exit(0); // eslint-disable-line no-process-exit
});

this.screen.key(["up", "down"], _.throttle(function (ch, key) {
var zoom = key.name === "down" ? -1 : 1;
this.screen.emit("zoomGraphs", zoom);
this.screen.render();
}.bind(this), THROTTLE_TIMEOUT));
};

Dashboard.prototype.onEvent = function (event) {
Expand Down
Loading