getsentry / sentry-docs

Sentry's documentation (and tools to build it)
https://docs.sentry.io
Other
326 stars 1.43k forks source link

Sentry for Capacitor > Configure #11085

Open alirahimifachr opened 1 month ago

alirahimifachr commented 1 month ago

Core or SDK?

Platform/SDK

Which part? Which one?

Capacitor

Description

import * as Sentry from "@sentry/capacitor";
import * as SentryAngular from "@sentry/angular";

Sentry.init(
  {
    dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

    // Set your release version, such as "getsentry@1.0.0"
    release: "my-project-name@<release-name>",
    // Set your dist version, such as "1"
    dist: "<dist>",
    integrations: [
      // Registers and configures the Tracing integration,
      // which automatically instruments your application to monitor its
      // performance, including custom Angular routing instrumentation
      SentryAngular.browserTracingIntegration(),
      // Registers the Replay integration,
      // which automatically captures Session Replays
      Sentry.replayIntegration(),  !!!!
    ],

    // Set tracesSampleRate to 1.0 to capture 100%
    // of transactions for tracing.
    // We recommend adjusting this value in production
    tracesSampleRate: 1.0,

    // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
    tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],

    // Capture Replay for 10% of all sessions,
    // plus for 100% of sessions with an error
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
  },
  // Forward the init method from @sentry/angular
  SentryAngular.init
);

Suggested Solution

Sentry.init(
  {
    dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

    // Set your release version, such as "getsentry@1.0.0"
    release: "my-project-name@<release-name>",
    // Set your dist version, such as "1"
    dist: "<dist>",
    integrations: [
      // Registers and configures the Tracing integration,
      // which automatically instruments your application to monitor its
      // performance, including custom Angular routing instrumentation
      SentryAngular.browserTracingIntegration(),
      // Registers the Replay integration,
      // which automatically captures Session Replays
      SentryAngular.replayIntegration(),
    ],

    // Set tracesSampleRate to 1.0 to capture 100%
    // of transactions for tracing.
    // We recommend adjusting this value in production
    tracesSampleRate: 1.0,

    // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
    tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],

    // Capture Replay for 10% of all sessions,
    // plus for 100% of sessions with an error
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
  },
  // Forward the init method from @sentry/angular
  SentryAngular.init
);
getsantry[bot] commented 1 month ago

Assigning to @getsentry/support for routing ⏲️

lucas-zimerman commented 1 week ago

Thank you for opening this issue, the current docs will be valid for version 1.0, but it doesn't hurt to make it compatible with the previous version while it doesn't leave the release candidate version.