honeycomb-monitoring
v0.0.2
Published
Report performance and monitoring markers to HoneyComb in a consistent way.
Downloads
4
Readme
Honeycomb Monitoring
JS SDK to send performance and monitoring markers to HoneyComb in a consistent way.
Installation
npm install honeycomb-monitoring
yarn add honeycomb-monitoring
Usage
Initialization
import Monitor from 'honeycomb-monitoring';
const writeKey = 'XX-HONEY-COMB-WRITE-KEY-XX';
const dataset = 'sample-dataset';
const enabled = process.ENV === 'prod'
const monitor = Monitor(writeKey, dataset, enabled);
Reporting
// Generic event
monitor.reportGenericEvent('event-name');
// Error
monitor.reportError('event-name', new Error('uh oh'));
monitor.reportError('event-name', '401');
monitor.reportError('event-name', { error: 'danger' });
// Duration
monitor.reportDurationStart('event-name');
/** some code **/
monitor.reportDurationEnd('event-name');
// Number of events/items per interval
monitor.reportIntervalCount('event-name', 100, Interval.minute);
API Middleware
app.use(monitor.responseTimeMiddleware());
Development
Testing
yarn test
Building
yarn build