npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

epsagon

1.22.1 • Public • Published

Epsagon Instrumentation for Node.js

Build Status npm version semantic-release

This package provides an instrumentation to Node.js code running on functions for collection of distributed tracing and performance monitoring.

Installation

From your project directory:

npm install --save epsagon

Getting started

Simply use the wrapper to send traces from your code:

const epsagon = require('epsagon');
epsagon.init({
    token: 'my-secret-token',
    appName: 'my-app-name',
    metadataOnly: false, // Optional, send more trace data
});
 
function handler(event, context, callback) {
    callback(null, 'It worked!')
}
 
handler = epsagon.lambdaWrapper(handler)

Custom labels

You can add custom labels to your traces. Filters can later be used for filtering traces that contains specific labels:

function handler(event, context, callback) {
    epsagon.label('myCustomLabel', 'labelValue');
    callback(null, 'It worked!')
}

Custom errors

You can set a trace as an error (although handled correctly) by catching an error:

function handler(event, context, callback) {
    try {
        // something bad happens
    } catch (err) {
        epsagon.setError(err);
    }
 
    callback(null, 'It worked!')
}

Or manually specify Error object:

function handler(event, context, callback) {
    epsagon.setError(Error('My custom error'));
    callback(null, 'It worked!')
}

Web frameworks

Support for Express, Hapi, and other frameworks is done through epsagon-frameworks

Copyright

Provided under the MIT license. See LICENSE for details.

Copyright 2019, Epsagon

install

npm i epsagon

Downloadsweekly downloads

2,408

version

1.22.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability