-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix(Capacitor): Expand configure setup to other frameworks #11255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| Then forward the `init` method from the sibling Sentry SDK for the framework you use, such as Angular in this example: | ||
|
|
||
|
|
||
| ```typescript {tabTitle: Angular} {filename: app.module.ts} {"onboardingOptions": {"performance": "13-16, 21-28, 46-55", "session-replay": "17-19, 29-33"}} | ||
| ```typescript {tabTitle: Angular 14 Or higher} {filename: app.module.ts} {"onboardingOptions": {"performance": "13-16, 21-28, 46-55", "session-replay": "17-19, 29-33"}} | ||
| import * as Sentry from "@sentry/capacitor"; | ||
| import * as SentryAngular from "@sentry/angular"; | ||
|
|
||
|
|
@@ -17,7 +17,7 @@ Sentry.init( | |
| // Registers and configures the Tracing integration, | ||
| // which automatically instruments your application to monitor its | ||
| // performance, including custom Angular routing instrumentation | ||
| SentryAngular.browserTracingIntegration(), | ||
| Sentry.browserTracingIntegration(), | ||
| // Registers the Replay integration, | ||
| // which automatically captures Session Replays | ||
| Sentry.replayIntegration(), | ||
|
|
@@ -61,17 +61,149 @@ Sentry.init( | |
| }) | ||
| ``` | ||
|
|
||
| ```javascript {tabTitle: Other Frameworks} | ||
| ```typescript {tabTitle: Angular 12, 13} {filename: app.module.ts} {"onboardingOptions": {"performance": "14-17, 22-29, 47-56", "session-replay": "18-20, 30-34"}} | ||
| // Requires @sentry/capacitor V0. | ||
| import * as Sentry from "@sentry/capacitor"; | ||
| import * as SentryAngular from "@sentry/angular-ivy"; | ||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| Sentry.init( | ||
| { | ||
| dsn: "___PUBLIC_DSN___", | ||
|
|
||
| // Set your release version, such as "[email protected]" | ||
| 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 | ||
| new Sentry.BrowserTracing(), | ||
| // Registers the Replay integration, | ||
| // which automatically captures Session Replays | ||
| new Sentry.Replay(), | ||
| ], | ||
|
|
||
| // 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 | ||
| ); | ||
|
|
||
| @NgModule({ | ||
| providers: [ | ||
| { | ||
| provide: ErrorHandler, | ||
| // Attach the Sentry ErrorHandler | ||
| useValue: SentryAngular.createErrorHandler(), | ||
| }, | ||
| { | ||
| provide: SentryAngular.TraceService, | ||
| deps: [Router], | ||
| }, | ||
| { | ||
| provide: APP_INITIALIZER, | ||
| useFactory: () => () => {}, | ||
| deps: [SentryAngular.TraceService], | ||
| multi: true, | ||
| }, | ||
| ], | ||
| }) | ||
| ``` | ||
|
|
||
| ```typescript {tabTitle: React} {filename: index.tsx} {"onboardingOptions": {"performance": "13-16, 21-28, 46-55", "session-replay": "17-19, 29-33"}} | ||
| import * as Sentry from "@sentry/capacitor"; | ||
| import * as SentryReact from "@sentry/react"; | ||
|
|
||
| Sentry.init( | ||
| { | ||
| dsn: "___PUBLIC_DSN___", | ||
|
|
||
| // Set your release version, such as "[email protected]" | ||
| 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 | ||
| Sentry.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 | ||
| SentryReact.init | ||
| ); | ||
| ``` | ||
|
|
||
| ```typescript {tabTitle: Vue} {filename: main.ts} {"onboardingOptions": {"performance": "17-20, 25-32, 50-59", "session-replay": "21-23, 33-37 "}} | ||
| import * as Sentry from "@sentry/capacitor"; | ||
| import * as SentryVue from "@sentry/vue"; | ||
| import { createApp } from 'vue' | ||
|
|
||
| const app = createApp(App) | ||
|
|
||
| Sentry.init( | ||
| { | ||
| app, | ||
| dsn: "___PUBLIC_DSN___", | ||
|
|
||
| // Set your release version, such as "[email protected]" | ||
| 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 | ||
| Sentry.browserTracingIntegration(), | ||
| // Registers the Replay integration, | ||
| // which automatically captures Session Replays | ||
| Sentry.replayIntegration(), | ||
| ], | ||
|
|
||
| // Set your release version, such as "[email protected]" | ||
| release: "my-project-name@<release-name>", | ||
| // Set your dist version, such as "1" | ||
| dist: "<dist>", | ||
| }); | ||
| // 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 | ||
| SentryVue.init | ||
| ); | ||
| ``` | ||
|
|
||
| You can also use the features available with the Sentry SDK for the framework you use, such as [Angular](/platforms/javascript/guides/angular/). | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.