offworld-heapdumper

0.1.1 • Public • Published

offworld-heapdumper

An NPM module that makes it easy to save NodeJS heapdumps to an external storage service (starting with Amazon S3). Useful for troubleshooting memory issues on PaaS environments such as Heroku.

build status Coverage Status dependency status

Installation

npm install offworld-heapdumper --save

Usage

At some point, there might be multiple Destinations for your heapdump, but for now there is only Amazon S3. The following examples will be using S3.

Let's start with a simple example

Uploading to S3 with minimal configuration

In this scenario, we push the heapdump to the S3 bucket of your choice with default settings, which are:

Code
var HeapdumpOffworld = require("offworld-heapdumper");
var S3Destination = HeapdumpOffworld.Destinations.S3;

var destination = new S3Destination({bucket:"hyacinth"});
var heapdumper = new HeapdumpOffworld(destination);

heapdumper.writeSnapshot(function(err, details) {
    if (err) throw err;

    //Since we're using S3 as the destination, the details parameter contains:
    {
       Location: 'https://bucketName.s3.amazonaws.com/filename.ext',
       Bucket: 'bucketName',
       Key: 'filename.ext',
       ETag: '"bf2acbedf84207d696c8da7dbb205b9f-5"'
    }
});
Other examples:

TODO: multi environment using KeyPrefix

Reference

See the reference for a full description of how to use this module.

Credits

Adam Creeger

Readme

Keywords

none

Package Sidebar

Install

npm i offworld-heapdumper

Weekly Downloads

2

Version

0.1.1

License

ISC

Last publish

Collaborators

  • acreeger