Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 44 lines (27 sloc) 2.316 kb
a5e3f73 @jonjlee Update a bunch of docs and examples
jonjlee authored
1 **This document is out-of-date. See [`lib/reporting.js`](https://github.com/benschmaus/nodeload/tree/master/lib/reporting.js).**
2
3 ## Web-based Reports ##
4
5 Functions for manipulating the report that is available during the test at http://localhost:8000/ and that is written to `results-{timestamp}-summary.html`.
6
7 **Interface:**
8
9 * `REPORT_MANAGER.reports`: All of the reports that are displayed in the summary webpage.
10 * `REPORT_MANAGER.addReport(Report)`: Add a report object to the webpage.
11 * `Report(name, updater(Report))`: A report consists of a set of charts, displayed in the main body of the webpage, and a summary object displayed on the right side bar. A report has a name and an updater function. Calling `updater(Report)` should update the report's chart and summary. When tests are running, REPORT_MANAGER calls each report's `updater` periodically.
12 * `Report.summary`: A JSON object displayed in table form in the summary webpage right side bar.
13 * `Report.getChart(name)`: Gets or creates a chart with the title `name` to the report and returns a `Chart` object. See `Chart.put(data)` below.
14 * `Chart.put(data)`: Add the data, which is a map of { 'trend-1': value, 'trend-2': value, ... }, to the chart, which tracks the values for each trend over time.
15
16 **Usage:**
17
18 An HTTP server is started on port 8000 by default. Use:
19
20 `var nl = require('./lib/nodeloadlib).disableServer()`
21
22 to disable the HTTP server, or
23
24 `var nl = require('./lib/nodeloadlib).usePort(port)`
25
26 to change the port binding. The file `results-{timestamp}-summary.html` is written to the current directory. Use
27
28 `var nl = require('./lib/nodeloadlib).disableLogs()`
29
30 to disable creation of this file.
31
32 A report is automatically added for each test created by `addTest()` or `runTest()`. To add additional charts to the summary webpage:
33
34 var mycounter = 0;
35 REPORT_MANAGER.addReport(new Report("My Report", function(report) {
36 chart = report.getChart("My Chart");
37 chart.put({ 'counter': mycounter++ });
38 chart.summary = { 'Total increments': mycounter };
39 }));
40
41 The webpage automatically issues an AJAX request to refresh the text and chart data every 2 seconds by default. Change the refresh period using:
42
43 `var nl = require('./lib/nodeloadlib).setAjaxRefreshIntervalMs(milliseconds)`
Something went wrong with that request. Please try again.