@sentry/apm

Extensions for APM

Please migrate to @sentry/tracing; see: https://www.npmjs.com/package/@sentry/apm
Last updated 4 years ago by kamilogorek .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @sentry/apm 
SYNC missed versions from official npm registry.

Deprecated

The tracing integration for JavaScript SDKs has moved from @sentry/apm to @sentry/tracing. While the two packages are similar, some imports and APIs have changed slightly.

The old package @sentry/apm is deprecated in favor of @sentry/tracing. Future support for @sentry/apm is limited to bug fixes only.

Migrating from @sentry/apm to @sentry/tracing

Browser (CDN bundle)

If you were using the Browser CDN bundle, switch from the old bundle.apm.min.js to the new tracing bundle:

<script
  src="https://browser.sentry-cdn.com/xxx/bundle.tracing.min.js"
  integrity="sha384-sha"
  crossorigin="anonymous"
></script>

And then update Sentry.init:

 Sentry.init({
-  integrations: [new Sentry.Integrations.Tracing()]
+  integrations: [new Sentry.Integrations.BrowserTracing()]
 });

Browser (npm package)

If you were using automatic instrumentation, update the import statement and update Sentry.init to use the new BrowserTracing integration:

 import * as Sentry from "@sentry/browser";
-import { Integrations } from "@sentry/apm";
+import { Integrations } from "@sentry/tracing";

 Sentry.init({
   integrations: [
-    new Integrations.Tracing(),
+    new Integrations.BrowserTracing(),
   ]
 });

If you were using the beforeNavigate option from the Tracing integration, the API in BrowserTracing has changed slightly. Instead of passing in a location and returning a string representing transaction name, beforeNavigate now accepts a transaction context and is expected to return a transaction context. You can now add extra tags or change the op based on different parameters. If you want to access the location like before, you can get it from window.location.

For example, if you had a function like so that computed a custom transaction name:

import * as Sentry from "@sentry/browser";
import { Integrations } from "@sentry/apm";

Sentry.init({
  integrations: [
    new Integrations.Tracing({
      beforeNavigate: location => {
        return getTransactionName(location);
      },
    }),
  ],
});

You would now leverage the context to do the same thing:

import * as Sentry from "@sentry/browser";
import { Integrations } from "@sentry/tracing";

Sentry.init({
  integrations: [
    new Integrations.BrowserTracing({
      beforeNavigate: context => {
        return {
          ...context,
          // Can even look at context tags or other data to adjust
          // transaction name
          name: getTransactionName(window.location),
        };
      },
    }),
  ],
});

For the full diff:

 import * as Sentry from "@sentry/browser";
-import { Integrations } from "@sentry/apm";
+import { Integrations } from "@sentry/tracing";

 Sentry.init({
   integrations: [
-    new Integrations.Tracing({
-      beforeNavigate: (location) => {
-        return getTransactionName(location)
+    new Integrations.BrowserTracing({
+      beforeNavigate: (ctx) => {
+        return {
+          ...ctx,
+          name: getTransactionName(ctx.name, window.location)
+        }
       }
     }),
   ]
 });

Node

If you were using the Express integration for automatic instrumentation, the only necessary change is to update the import statement:

 import * as Sentry from "@sentry/node";
-import { Integrations } from "@sentry/apm";
+import { Integrations } from "@sentry/tracing";

 Sentry.init({
   integrations: [
     new Integrations.Express(),
   ]
 });

Current Tags

  • 5.27.1                                ...           latest (4 years ago)
  • 5.27.0-beta.1                                ...           next (4 years ago)

63 Versions

  • 5.27.1 [deprecated]           ...           4 years ago
  • 5.27.0 [deprecated]           ...           4 years ago
  • 5.27.0-beta.1                                ...           4 years ago
  • 5.27.0-beta.0                                ...           4 years ago
  • 5.26.0 [deprecated]           ...           4 years ago
  • 5.25.0 [deprecated]           ...           4 years ago
  • 5.25.0-beta.2                                ...           4 years ago
  • 5.25.0-beta.1                                ...           4 years ago
  • 5.25.0-beta.0                                ...           4 years ago
  • 5.24.2 [deprecated]           ...           4 years ago
  • 5.24.1 [deprecated]           ...           4 years ago
  • 5.24.0 [deprecated]           ...           4 years ago
  • 5.23.0 [deprecated]           ...           4 years ago
  • 5.22.3 [deprecated]           ...           4 years ago
  • 5.22.2 [deprecated]           ...           4 years ago
  • 5.22.1 [deprecated]           ...           4 years ago
  • 5.22.0 [deprecated]           ...           4 years ago
  • 5.21.4 [deprecated]           ...           4 years ago
  • 5.21.3 [deprecated]           ...           4 years ago
  • 5.21.2 [deprecated]           ...           4 years ago
  • 5.21.1 [deprecated]           ...           4 years ago
  • 5.21.0 [deprecated]           ...           4 years ago
  • 5.20.1 [deprecated]           ...           4 years ago
  • 5.20.0 [deprecated]           ...           4 years ago
  • 5.19.2 [deprecated]           ...           4 years ago
  • 5.19.1 [deprecated]           ...           4 years ago
  • 5.19.0 [deprecated]           ...           4 years ago
  • 5.18.1 [deprecated]           ...           4 years ago
  • 5.18.0 [deprecated]           ...           4 years ago
  • 5.17.0 [deprecated]           ...           5 years ago
  • 5.16.1 [deprecated]           ...           5 years ago
  • 5.16.0 [deprecated]           ...           5 years ago
  • 5.16.0-beta.5                                ...           5 years ago
  • 5.16.0-beta.4                                ...           5 years ago
  • 5.16.0-beta.3                                ...           5 years ago
  • 5.16.0-beta.2                                ...           5 years ago
  • 5.16.0-beta.1                                ...           5 years ago
  • 5.15.5 [deprecated]           ...           5 years ago
  • 5.15.4 [deprecated]           ...           5 years ago
  • 5.15.3 [deprecated]           ...           5 years ago
  • 5.15.2 [deprecated]           ...           5 years ago
  • 5.15.1 [deprecated]           ...           5 years ago
  • 5.15.0 [deprecated]           ...           5 years ago
  • 5.14.2 [deprecated]           ...           5 years ago
  • 5.14.1 [deprecated]           ...           5 years ago
  • 5.14.0 [deprecated]           ...           5 years ago
  • 5.13.2 [deprecated]           ...           5 years ago
  • 5.13.1 [deprecated]           ...           5 years ago
  • 5.13.0 [deprecated]           ...           5 years ago
  • 5.12.5 [deprecated]           ...           5 years ago
  • 5.12.4 [deprecated]           ...           5 years ago
  • 5.12.3 [deprecated]           ...           5 years ago
  • 5.12.2 [deprecated]           ...           5 years ago
  • 5.12.1 [deprecated]           ...           5 years ago
  • 5.12.0 [deprecated]           ...           5 years ago
  • 5.11.2 [deprecated]           ...           5 years ago
  • 5.11.1 [deprecated]           ...           5 years ago
  • 5.11.0 [deprecated]           ...           5 years ago
  • 5.10.2 [deprecated]           ...           5 years ago
  • 5.10.1 [deprecated]           ...           5 years ago
  • 5.10.0 [deprecated]           ...           5 years ago
  • 5.10.0-rc.0                                ...           5 years ago
  • 5.10.0-beta.4                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 3
Last Month 0
Dependencies (6)
Dev Dependencies (14)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |