node-heap-gc-cloudwatch
v2.2.0
Published
Report v8 heap usage and gc activity to CloudWatch
Downloads
58
Readme
node-heap-gc-cloudwatch
Send v8 heap statistics and garbage collection statistics to CloudWatch.
Getting started
Install the module:
npm install node-heap-gc-cloudwatch
In your app, create and start an agent:
var config = {};
require("node-heap-gc-cloudwatch")(config, function(err, agent) {
if (err) {
throw err;
} else {
agent.on("error", function(err) {
console.log("error", err);
});
agent.start(function(err) {
if (err) {
throw err;
} else {
console.log("started");
}
});
}
});
After ~1 minute you will see the first metrics in CloudWatch under the node
name space.
Make sure to allow the cloudwatch:PutMetricData
Action in your IAM policy.
Configuration
collectInterval
: Number - Collect new heap statistics everycollectInterval
ms (default1000
)writeInterval
: Number - Send metric to CloudWatch everywriteInterval
ms (default60000
)heapStatistics
: Array[String] - Values to report to CloudWatch from v8.getHeapStatistics() (default["total_heap_size", "total_heap_size_executable", "total_physical_size", "total_available_size", "used_heap_size", "heap_size_limit"]
)heapSpaceStatistics
: Array[String] - Values to report to CloudWatch from v8.getHeapSpaceStatistics() (default["space_size", "space_used_size", "space_available_size", "physical_space_size"]
)cloudwatch
: AWS.CloudWatch - CloudWatch service object (defaultnew AWS.CloudWatch()
)namespace
: String - The namespace for the metric data (defaultnode
)dimensions
: Object[String, String] - Add additional dimensions like{Application: "webshop", Environment: "production"}
. (default{}
)addProcessIdDimension
: Boolean - If true, adds theProcessId
dimension with the value ofprocess.pid
(defaultfalse
)addInstanceIdDimension
: Boolean - If true, adds theInstanceId
dimension with the value of the EC2 instance id (defaultfalse
)omitGCPauseMetrics
: Boolean - If true, omits thegc_pause
metrics (defaultfalse
)
Important
CloudWatch treats each unique combination of dimensions as a separate metric. For information on how this affects pricing, see the Amazon CloudWatch product information page.