Skip to content

Commit 73186a2

Browse files
committed
Add nodereport & heapdump calls to appmetrics API
1 parent 1e04333 commit 73186a2

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
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: 10 additions & 0 deletions
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
// Set the plugin search path
2526
agent.spath(path.join(module_dir, "plugins"))
@@ -264,3 +265,12 @@ module.exports.setJSONProfilingMode = function(val) {
264265
module.exports.getJSONProfilingMode = function() {
265266
return jsonProfilingMode;
266267
}
268+
269+
module.exports.nodereport = function() {
270+
return nodereport;
271+
}
272+
273+
module.exports.writeHeapSnapshot = function() {
274+
return require('heapdump').writeSnapshot.apply(null, arguments);
275+
}
276+

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)