Skip to content

Commit ded1cbc

Browse files
committed
Add ability to set options, merge
2 parents 799b7ef + f2819ae commit ded1cbc

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ Allows custom monitoring events to be added into the Node Application Metrics ag
208208
* `type` (String) the name you wish to use for the data. A subsequent event of that type will be raised, allowing callbacks to be registered for it.
209209
* `data` (Object) the data to be made available with the event. The object must not contain circular references, and by convention should contain a `time` value representing the milliseconds when the event occurred.
210210

211+
### appmetrics.writeHeapSnapshot([filename],[callback])
212+
Dumps the v8 heap via `heapdump`. For more information, see [the heapdump README](https://github.com/bnoordhuis/node-heapdump/blob/master/README.md)
213+
214+
### appmetrics.nodereport()
215+
Provides an instance of `nodereport` that can be used to obtain a human-readable diagnostic summary. For more information, see [the nodereport README](https://github.com/nodejs/nodereport/blob/master/README.md)
216+
211217
### appmetrics.monitor()
212218
Creates a Node Application Metrics agent client instance. This can subsequently be used to get environment data and subscribe to data events. This function will start the appmetrics monitoring agent if it is not already running.
213219

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var os = require("os")
2020
var aspect = require('./lib/aspect.js');
2121
var request = require('./lib/request.js');
2222
var fs = require('fs');
23+
var nodereport = require('nodereport');
2324
var agent = require("./appmetrics")
2425

2526
agent.spath(path.join(module_dir, "plugins"))
@@ -285,5 +286,10 @@ module.exports.start = function () {
285286
agent.setOptions(propertyMappings['applicationID'], main_filename);
286287
agent.start();
287288
}
289+
module.exports.nodereport = function() {
290+
return nodereport;
291+
}
288292

289-
293+
module.exports.writeHeapSnapshot = function() {
294+
return require('heapdump').writeSnapshot.apply(null, arguments);
295+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"node-hc": "bin/appmetrics-cli.js"
77
},
88
"dependencies": {
9+
"heapdump": "0.x",
910
"nan": "2.x",
11+
"nodereport": "1.x",
1012
"tar": "2.x"
1113
},
1214
"bundleDependencies": [

0 commit comments

Comments
 (0)