You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref(angular): Update Angular SDK docs for @sentry/angular-ivy (#6356)
To ensure first-class compatibility with Angular's "new" rendering engine, Ivy, we needed to create a new SDK package that's compiled differently than the original `@sentry/angular` package. This new SDK is compatible with Angular 12 and newer and hence we're going to make it the default SDK in the docs going forward.
This PR
* Updates the Angular version <-> Sentry SDK compatibility description with a table
* I added entries for Angular 1/AngularJS (this came up recently in a Slack convo) and Angular 2-9 with a message that we do not support these versions anymore in v7 of the SDKs. Happy to make changes here if reviewers think this shouldn't be promoted.
* Updates imports and code snippets with versions for Angular 12+ (ivy) and Angular 10/11
* Updates the SDK onboarding wizard docs (+ Replay onboarding)
* Adds an Angular-specific verify code snippet which was missing before
* Adds file names to all angular code snippets (this came up in #6326 and it was easiest to just do it in this PR)
* streamlines the Angular "Getting started" page and fixes a few typos/wording issues
Co-authored-by: Andrea Canciani <[email protected]>
Co-authored-by: Liza Mock <[email protected]>
Copy file name to clipboardExpand all lines: src/platform-includes/capture-error/javascript.angular.mdx
+11-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,16 @@
1
1
You can pass an `Error` object to `captureException()` to get it captured as event. It's also possible to pass non-`Error` objects and strings, but be aware that the resulting events in Sentry may be missing a stacktrace.
You can also configure `@sentry/angular` to catch any Angular-specific exceptions reported through the [@angular/core/ErrorHandler](https://angular.io/api/core/ErrorHandler) provider.
// We recommend adjusting this value in production
56
+
tracesSampleRate: 1.0,
57
+
});
36
58
37
-
`@sentry/angular` exports a Trace Service, Directive, and Decorators that leverages the `@sentry/tracing`, Sentry's Tracing integration, to add Angular-related spans to transactions. The service itself tracks route changes and durations, where directive and decorators are tracking component initializations.
`@sentry/angular` exports a function to instantiate an `ErrorHandler` provider that will automatically send JavaScript errors captured by the Angular's error handler.
67
+
The Angular SDK exports a function to instantiate an `ErrorHandler` provider that will automatically send JavaScript errors captured by Angular's error handler.
<Alertlevel="info"title="Angular Version Compatibility" >
17
+
### Angular Version Compatibility
18
+
19
+
Because of the way Angular libraries are compiled, you need to use a specific version of the Sentry SDK for each corresponding version of Angular as shown below:
10
20
11
-
The latest version of the Sentry Angular SDK officially supports Angular 10 and newer.
12
-
If you need to use Angular 9 or older and you experience problems with the latest version of the Sentry SDK,
13
-
try downgrading the SDK to version 6 (`@sentry/angular@^6.x`). If you are using Sentry Tracing,
14
-
be sure to also downgrade it to the same version (`@sentry/tracing@^6.x`).
15
-
Version 6 of the Sentry SDK was compiled differently and might work with older versions of Angular.
16
-
Please note that this combination of packages is not being maintained or tested.
21
+
| Angular version | Recommended Sentry SDK |
22
+
| --------------- | ---------------------- |
23
+
| 12 and newer |`@sentry/angular-ivy`|
24
+
| 10, 11 |`@sentry/angular`|
25
+
| Older versions | See note below |
17
26
27
+
<Alertlevel="warning">
28
+
Support for any Angular version below 10 was discontinued in version 7 of the SDK.
29
+
If you need to use Angular 9 or older, try version 6 (<code>@sentry/angular@^6.x</code>) of the SDK.
30
+
For AngularJS/1.x, use <code>@sentry/browser@^6.x</code> and our <ahref="./angular1">AngularJS integration</a>.
31
+
Note, that these versions of the SDK are no longer maintained or tested.
`TraceMethodDecorator` tracks specific component lifecycle hooks as point-in-time spans. The added spans are called **`ui.angular.[methodname]`** (like, `ui.angular.ngOnChanges`). For example, you can use this decorator to track how often component changes are detected during an ongoing transaction:
@@ -96,7 +135,25 @@ You can combine our tracking utilities and track the bootstrapping duration of y
96
135
97
136
To get the best insights into your components' performance, you can combine `TraceDirective`, `TraceClassDecorator`, and `TraceMethodDecorator`. This allows you to track component initialization durations as well as arbitrary lifecycle events, such as change and destroy events:
User `TraceDirective` if you only want to track components in certain instances or locations:
118
175
119
-
```html {user-card.component.html}
176
+
```html {filename: user-card.component.html}
120
177
<div>
121
178
<app-icontrace="user-icon">user</app-icon>
122
179
<label>{{ user.name }}</label>
@@ -130,7 +187,35 @@ User `TraceDirective` if you only want to track components in certain instances
130
187
You can add your own custom spans by attaching them to the currently active transaction using the `getActiveTransaction`
131
188
helper. For example, you can track the duration of the Angular bootstrapping process to find out how long your app takes to bootstrap on your users' devices:
0 commit comments