Skip to content

Sentry performance monitoring through @sentry/tracing #31

@clorichel

Description

@clorichel

Thanks for your work on serverless-sentry-* ❤️


Sentry now offers performance monitoring through @sentry/tracing, and using it is a breeze. How about integrating it?

Extracts from Sentry onboarding : start by adding @sentry/tracing as a dependency:

# Using yarn
yarn add @sentry/node @sentry/tracing

# Using npm
npm install --save @sentry/node @sentry/tracing

Capture both error and performance data:

const Sentry = require("@sentry/node");
// or use es6 import statements
// import * as Sentry from '@sentry/node';

const Tracing = require("@sentry/tracing");
// or use es6 import statements
// import * as Tracing from '@sentry/tracing';

Sentry.init({
  dsn: "you know what to put there,

  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: 1.0,
});

const transaction = Sentry.startTransaction({
  op: "test",
  name: "My First Test Transaction",
});

setTimeout(() => {
  try {
    foo();
  } catch (e) {
    Sentry.captureException(e);
  } finally {
    transaction.finish();
  }
}, 99);

More info here: https://docs.sentry.io/platforms/node/#monitor-performance

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions