@sentry/node

Sentry Node SDK using OpenTelemetry for performance instrumentation

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@sentry/node
8.0.03 days ago6 years agoMinified + gzip package size for @sentry/node in KB

Readme

<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">

Official Sentry SDK for Node
npm version npm dm npm dt

Installation

npm install @sentry/node

# Or yarn
yarn add @sentry/node

Usage

// CJS Syntax
const Sentry = require('@sentry/node');
// ESM Syntax
import * as Sentry from '@sentry/node';

Sentry.init({
  dsn: '__DSN__',
  // ...
});

Note that it is necessary to initialize Sentry before you import any package that may be instrumented by us.
More information on how to set up Sentry for Node in v8.

ESM Support

Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (require) applications.
There is experimental support for running OpenTelemetry with ESM ("type": "module"):
node --experimental-loader=@opentelemetry/instrumentation/hook.mjs ./app.js

You'll need to install @opentelemetry/instrumentation in your app to ensure this works.
See OpenTelemetry Instrumentation Docs for details on this - but note that this is a) experimental, and b) does not work with all integrations.

Links