@sentry/angular 7.107.0 → 8.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -23
- package/bundles/sentry-angular.umd.js +99 -126
- package/bundles/sentry-angular.umd.js.map +1 -1
- package/bundles/sentry-angular.umd.min.js +1 -1
- package/bundles/sentry-angular.umd.min.js.map +1 -1
- package/errorhandler.d.ts +2 -2
- package/esm2015/errorhandler.js +4 -5
- package/esm2015/index.js +2 -9
- package/esm2015/sdk.js +4 -4
- package/esm2015/tracing.js +87 -111
- package/fesm2015/sentry-angular.js +94 -118
- package/fesm2015/sentry-angular.js.map +1 -1
- package/index.d.ts +1 -3
- package/package.json +12 -6
- package/sentry-angular.metadata.json +1 -1
- package/tracing.d.ts +45 -20
package/README.md
CHANGED
|
@@ -17,11 +17,14 @@
|
|
|
17
17
|
|
|
18
18
|
## Angular Version Compatibility
|
|
19
19
|
|
|
20
|
-
**Important**: This package is not compatible with Angular 16 or newer. Please use
|
|
20
|
+
**Important**: This package is not compatible with Angular 16 or newer. Please use
|
|
21
|
+
[`@sentry/angular-ivy`](https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy) instead.
|
|
21
22
|
|
|
22
|
-
If you're using Angular 12 or newer, we recommend using `@sentry/angular-ivy` for native support with Angular's
|
|
23
|
+
If you're using Angular 12 or newer, we recommend using `@sentry/angular-ivy` for native support with Angular's
|
|
24
|
+
rendering engine Ivy.
|
|
23
25
|
|
|
24
|
-
This SDK still officially supports Angular 10-15. If you are using an older version of Angular and experience problems
|
|
26
|
+
This SDK still officially supports Angular 10-15. If you are using an older version of Angular and experience problems
|
|
27
|
+
with the Angular SDK, we recommend downgrading the SDK to version 6.x.
|
|
25
28
|
|
|
26
29
|
## General
|
|
27
30
|
|
|
@@ -80,26 +83,23 @@ see `ErrorHandlerOptions` interface in `src/errorhandler.ts`.
|
|
|
80
83
|
|
|
81
84
|
### Tracing
|
|
82
85
|
|
|
83
|
-
`@sentry/angular` exports a Trace Service, Directive and Decorators that leverage the tracing
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
`@sentry/angular` exports a Trace Service, Directive and Decorators that leverage the tracing features to add
|
|
87
|
+
Angular-related spans to transactions. If tracing is not enabled, this functionality will not work. The SDK's
|
|
88
|
+
`TraceService` itself tracks route changes and durations, while directive and decorators are tracking components
|
|
89
|
+
initializations.
|
|
87
90
|
|
|
88
91
|
#### Install
|
|
89
92
|
|
|
90
93
|
Registering a Trace Service is a 3-step process.
|
|
91
94
|
|
|
92
|
-
1. Register and configure the `BrowserTracing` integration, including custom Angular routing
|
|
93
|
-
instrumentation:
|
|
95
|
+
1. Register and configure the `BrowserTracing` integration, including custom Angular routing instrumentation:
|
|
94
96
|
|
|
95
97
|
```javascript
|
|
96
98
|
import { init, browserTracingIntegration } from '@sentry/angular';
|
|
97
99
|
|
|
98
100
|
init({
|
|
99
101
|
dsn: '__DSN__',
|
|
100
|
-
integrations: [
|
|
101
|
-
browserTracingIntegration(),
|
|
102
|
-
],
|
|
102
|
+
integrations: [browserTracingIntegration()],
|
|
103
103
|
tracePropagationTargets: ['localhost', 'https://yourserver.io/api'],
|
|
104
104
|
tracesSampleRate: 1,
|
|
105
105
|
});
|
|
@@ -181,39 +181,40 @@ Then, inside your component's template (keep in mind that the directive's name a
|
|
|
181
181
|
<app-footer trace="footer"></app-footer>
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
_TraceClass:_ used to track a duration between `OnInit` and `AfterViewInit` lifecycle hooks in components:
|
|
185
185
|
|
|
186
186
|
```javascript
|
|
187
187
|
import { Component } from '@angular/core';
|
|
188
|
-
import {
|
|
188
|
+
import { TraceClass } from '@sentry/angular';
|
|
189
189
|
|
|
190
190
|
@Component({
|
|
191
191
|
selector: 'layout-header',
|
|
192
192
|
templateUrl: './header.component.html',
|
|
193
193
|
})
|
|
194
|
-
@
|
|
194
|
+
@TraceClass()
|
|
195
195
|
export class HeaderComponent {
|
|
196
196
|
// ...
|
|
197
197
|
}
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
_TraceMethod:_ used to track a specific lifecycle hooks as point-in-time spans in components:
|
|
201
201
|
|
|
202
202
|
```javascript
|
|
203
203
|
import { Component, OnInit } from '@angular/core';
|
|
204
|
-
import {
|
|
204
|
+
import { TraceMethod } from '@sentry/angular';
|
|
205
205
|
|
|
206
206
|
@Component({
|
|
207
207
|
selector: 'app-footer',
|
|
208
208
|
templateUrl: './footer.component.html',
|
|
209
209
|
})
|
|
210
210
|
export class FooterComponent implements OnInit {
|
|
211
|
-
@
|
|
211
|
+
@TraceMethod()
|
|
212
212
|
ngOnInit() {}
|
|
213
213
|
}
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
You can also add your own custom spans via `startSpan()`. For example, if you'd like to track the duration of Angular
|
|
216
|
+
You can also add your own custom spans via `startSpan()`. For example, if you'd like to track the duration of Angular
|
|
217
|
+
boostraping process, you can do it as follows:
|
|
217
218
|
|
|
218
219
|
```javascript
|
|
219
220
|
import { enableProdMode } from '@angular/core';
|
|
@@ -223,12 +224,13 @@ import { init, startSpan } from '@sentry/angular';
|
|
|
223
224
|
import { AppModule } from './app/app.module';
|
|
224
225
|
|
|
225
226
|
// ...
|
|
226
|
-
startSpan(
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
startSpan(
|
|
228
|
+
{
|
|
229
|
+
name: 'platform-browser-dynamic',
|
|
230
|
+
op: 'ui.angular.bootstrap',
|
|
229
231
|
},
|
|
230
232
|
async () => {
|
|
231
233
|
await platformBrowserDynamic().bootstrapModule(AppModule);
|
|
232
|
-
}
|
|
234
|
+
},
|
|
233
235
|
);
|
|
234
236
|
```
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
*/
|
|
43
43
|
function init(options) {
|
|
44
44
|
var opts = Object.assign({
|
|
45
|
-
// Filter out
|
|
46
|
-
//
|
|
45
|
+
// Filter out BrowserApiErrors integration as it interferes with our Angular `ErrorHandler`:
|
|
46
|
+
// BrowserApiErrors would catch certain errors before they reach the `ErrorHandler` and thus provide a
|
|
47
47
|
// lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.
|
|
48
48
|
// see:
|
|
49
49
|
// - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097
|
|
50
50
|
// - https://github.com/getsentry/sentry-javascript/issues/2744
|
|
51
51
|
defaultIntegrations: Sentry.getDefaultIntegrations(options).filter(function (integration) {
|
|
52
|
-
return integration.name !== '
|
|
52
|
+
return integration.name !== 'BrowserApiErrors';
|
|
53
53
|
})
|
|
54
54
|
}, options);
|
|
55
55
|
core.applySdkMetadata(opts, 'angular');
|
|
@@ -154,17 +154,16 @@
|
|
|
154
154
|
// Optionally show user dialog to provide details on what happened.
|
|
155
155
|
if (this._options.showDialog) {
|
|
156
156
|
var client = Sentry__namespace.getClient();
|
|
157
|
-
if (client &&
|
|
157
|
+
if (client && !this._registeredAfterSendEventHandler) {
|
|
158
158
|
client.on('afterSendEvent', function (event) {
|
|
159
|
-
if (!event.type) {
|
|
160
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
159
|
+
if (!event.type && event.event_id) {
|
|
161
160
|
Sentry__namespace.showReportDialog(Object.assign(Object.assign({}, _this._options.dialogOptions), { eventId: event.event_id }));
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
163
|
// We only want to register this hook once in the lifetime of the error handler
|
|
165
164
|
this._registeredAfterSendEventHandler = true;
|
|
166
165
|
}
|
|
167
|
-
else if (!client
|
|
166
|
+
else if (!client) {
|
|
168
167
|
Sentry__namespace.showReportDialog(Object.assign(Object.assign({}, this._options.dialogOptions), { eventId: eventId }));
|
|
169
168
|
}
|
|
170
169
|
}
|
|
@@ -217,41 +216,8 @@
|
|
|
217
216
|
var ANGULAR_OP = 'ui.angular';
|
|
218
217
|
|
|
219
218
|
var instrumentationInitialized;
|
|
220
|
-
var stashedStartTransaction;
|
|
221
|
-
var stashedStartTransactionOnLocationChange;
|
|
222
|
-
var hooksBasedInstrumentation = false;
|
|
223
219
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* @deprecated Use `browserTracingIntegration()` instead, which includes Angular-specific instrumentation out of the box.
|
|
227
|
-
*/
|
|
228
|
-
function routingInstrumentation(customStartTransaction, startTransactionOnPageLoad, startTransactionOnLocationChange) {
|
|
229
|
-
var _a;
|
|
230
|
-
if (startTransactionOnPageLoad === void 0) { startTransactionOnPageLoad = true; }
|
|
231
|
-
if (startTransactionOnLocationChange === void 0) { startTransactionOnLocationChange = true; }
|
|
232
|
-
instrumentationInitialized = true;
|
|
233
|
-
stashedStartTransaction = customStartTransaction;
|
|
234
|
-
stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;
|
|
235
|
-
if (startTransactionOnPageLoad && Sentry.WINDOW && Sentry.WINDOW.location) {
|
|
236
|
-
customStartTransaction({
|
|
237
|
-
name: Sentry.WINDOW.location.pathname,
|
|
238
|
-
op: 'pageload',
|
|
239
|
-
origin: 'auto.pageload.angular',
|
|
240
|
-
attributes: (_a = {},
|
|
241
|
-
_a[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'url',
|
|
242
|
-
_a),
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Creates routing instrumentation for Angular Router.
|
|
248
|
-
*
|
|
249
|
-
* @deprecated Use `browserTracingIntegration()` instead, which includes Angular-specific instrumentation out of the box.
|
|
250
|
-
*/
|
|
251
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
252
|
-
var instrumentAngularRouting = routingInstrumentation;
|
|
253
|
-
/**
|
|
254
|
-
* A custom BrowserTracing integration for Angular.
|
|
220
|
+
* A custom browser tracing integration for Angular.
|
|
255
221
|
*
|
|
256
222
|
* Use this integration in combination with `TraceService`
|
|
257
223
|
*/
|
|
@@ -261,18 +227,19 @@
|
|
|
261
227
|
// That way, the TraceService will not actually do anything, functionally disabling this.
|
|
262
228
|
if (options.instrumentNavigation !== false) {
|
|
263
229
|
instrumentationInitialized = true;
|
|
264
|
-
hooksBasedInstrumentation = true;
|
|
265
230
|
}
|
|
266
231
|
return Sentry.browserTracingIntegration(Object.assign(Object.assign({}, options), { instrumentNavigation: false }));
|
|
267
232
|
}
|
|
268
233
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
234
|
+
* This function is extracted to make unit testing easier.
|
|
272
235
|
*/
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
236
|
+
function _updateSpanAttributesForParametrizedUrl(route, span) {
|
|
237
|
+
var attributes = (span && Sentry.spanToJSON(span).data) || {};
|
|
238
|
+
if (span && attributes[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') {
|
|
239
|
+
span.updateName(route);
|
|
240
|
+
span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
|
|
241
|
+
span.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto." + Sentry.spanToJSON(span).op + ".angular");
|
|
242
|
+
}
|
|
276
243
|
}
|
|
277
244
|
/**
|
|
278
245
|
* Angular's Service responsible for hooking into Angular Router and tracking current navigation process.
|
|
@@ -293,53 +260,35 @@
|
|
|
293
260
|
_this._routingSpan.end();
|
|
294
261
|
_this._routingSpan = null;
|
|
295
262
|
}
|
|
296
|
-
var client =
|
|
263
|
+
var client = Sentry.getClient();
|
|
297
264
|
var strippedUrl = utils.stripUrlQueryAndFragment(navigationEvent.url);
|
|
298
|
-
if (client
|
|
299
|
-
|
|
265
|
+
if (client) {
|
|
266
|
+
// see comment in `_isPageloadOngoing` for rationale
|
|
267
|
+
if (!_this._isPageloadOngoing()) {
|
|
300
268
|
Sentry.startBrowserTracingNavigationSpan(client, {
|
|
301
269
|
name: strippedUrl,
|
|
302
|
-
origin: 'auto.navigation.angular',
|
|
303
270
|
attributes: (_a = {},
|
|
304
|
-
_a[
|
|
271
|
+
_a[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = 'auto.navigation.angular',
|
|
272
|
+
_a[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'url',
|
|
305
273
|
_a),
|
|
306
274
|
});
|
|
307
275
|
}
|
|
308
|
-
|
|
276
|
+
else {
|
|
277
|
+
// The first time we end up here, we set the pageload flag to false
|
|
278
|
+
// Subsequent navigations are going to get their own navigation root span
|
|
279
|
+
// even if the pageload root span is still ongoing.
|
|
280
|
+
_this._pageloadOngoing = false;
|
|
281
|
+
}
|
|
309
282
|
_this._routingSpan =
|
|
310
|
-
|
|
283
|
+
Sentry.startInactiveSpan({
|
|
311
284
|
name: "" + navigationEvent.url,
|
|
312
285
|
op: ANGULAR_ROUTING_OP,
|
|
313
|
-
|
|
314
|
-
tags: Object.assign({ 'routing.instrumentation': '@sentry/angular', url: strippedUrl }, (navigationEvent.navigationTrigger && {
|
|
286
|
+
attributes: Object.assign((_b = {}, _b[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = 'auto.ui.angular', _b[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'url', _b.url = strippedUrl, _b), (navigationEvent.navigationTrigger && {
|
|
315
287
|
navigationTrigger: navigationEvent.navigationTrigger,
|
|
316
288
|
})),
|
|
317
289
|
}) || null;
|
|
318
290
|
return;
|
|
319
291
|
}
|
|
320
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
321
|
-
var activeTransaction = getActiveTransaction();
|
|
322
|
-
if (!activeTransaction && stashedStartTransactionOnLocationChange) {
|
|
323
|
-
activeTransaction = stashedStartTransaction({
|
|
324
|
-
name: strippedUrl,
|
|
325
|
-
op: 'navigation',
|
|
326
|
-
origin: 'auto.navigation.angular',
|
|
327
|
-
attributes: (_b = {},
|
|
328
|
-
_b[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'url',
|
|
329
|
-
_b),
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
if (activeTransaction) {
|
|
333
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
334
|
-
_this._routingSpan = activeTransaction.startChild({
|
|
335
|
-
description: "" + navigationEvent.url,
|
|
336
|
-
op: ANGULAR_ROUTING_OP,
|
|
337
|
-
origin: 'auto.ui.angular',
|
|
338
|
-
tags: Object.assign({ 'routing.instrumentation': '@sentry/angular', url: strippedUrl }, (navigationEvent.navigationTrigger && {
|
|
339
|
-
navigationTrigger: navigationEvent.navigationTrigger,
|
|
340
|
-
})),
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
292
|
}));
|
|
344
293
|
// The ResolveEnd event is fired when the Angular router has resolved the URL and
|
|
345
294
|
// the parameter<->value mapping. It holds the new resolved router state with
|
|
@@ -351,15 +300,12 @@
|
|
|
351
300
|
// a navigation.
|
|
352
301
|
this.resEnd$ = this._router.events.pipe(operators.filter(function (event) { return event instanceof i1.ResolveEnd; }), operators.tap(function (event) {
|
|
353
302
|
var route = getParameterizedRouteFromSnapshot(event.state.root);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
// TODO (v8 / #5416): revisit the source condition. Do we want to make the parameterized route the default?
|
|
357
|
-
var attributes = (transaction && core.spanToJSON(transaction).data) || {};
|
|
358
|
-
if (transaction && attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') {
|
|
359
|
-
transaction.updateName(route);
|
|
360
|
-
transaction.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');
|
|
361
|
-
transaction.setAttribute(core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto." + core.spanToJSON(transaction).op + ".angular");
|
|
303
|
+
if (route) {
|
|
304
|
+
Sentry.getCurrentScope().setTransactionName(route);
|
|
362
305
|
}
|
|
306
|
+
var activeSpan = Sentry.getActiveSpan();
|
|
307
|
+
var rootSpan = activeSpan && Sentry.getRootSpan(activeSpan);
|
|
308
|
+
_updateSpanAttributesForParametrizedUrl(route, rootSpan);
|
|
363
309
|
}));
|
|
364
310
|
this.navEnd$ = this._router.events.pipe(operators.filter(function (event) { return event instanceof i1.NavigationEnd || event instanceof i1.NavigationCancel || event instanceof i1.NavigationError; }), operators.tap(function () {
|
|
365
311
|
if (_this._routingSpan) {
|
|
@@ -371,6 +317,7 @@
|
|
|
371
317
|
}
|
|
372
318
|
}));
|
|
373
319
|
this._routingSpan = null;
|
|
320
|
+
this._pageloadOngoing = true;
|
|
374
321
|
this._subscription = new rxjs.Subscription();
|
|
375
322
|
this._subscription.add(this.navStart$.subscribe());
|
|
376
323
|
this._subscription.add(this.resEnd$.subscribe());
|
|
@@ -383,6 +330,41 @@
|
|
|
383
330
|
TraceService.prototype.ngOnDestroy = function () {
|
|
384
331
|
this._subscription.unsubscribe();
|
|
385
332
|
};
|
|
333
|
+
/**
|
|
334
|
+
* We only _avoid_ creating a navigation root span in one case:
|
|
335
|
+
*
|
|
336
|
+
* There is an ongoing pageload span AND the router didn't yet emit the first navigation start event
|
|
337
|
+
*
|
|
338
|
+
* The first navigation start event will create the child routing span
|
|
339
|
+
* and update the pageload root span name on ResolveEnd.
|
|
340
|
+
*
|
|
341
|
+
* There's an edge case we need to avoid here: If the router fires the first navigation start event
|
|
342
|
+
* _after_ the pageload root span finished. This is why we check for the pageload root span.
|
|
343
|
+
* Possible real-world scenario: Angular application and/or router is bootstrapped after the pageload
|
|
344
|
+
* idle root span finished
|
|
345
|
+
*
|
|
346
|
+
* The overall rationale is:
|
|
347
|
+
* - if we already avoided creating a navigation root span once, we don't avoid it again
|
|
348
|
+
* (i.e. set `_pageloadOngoing` to `false`)
|
|
349
|
+
* - if `_pageloadOngoing` is already `false`, create a navigation root span
|
|
350
|
+
* - if there's no active/pageload root span, create a navigation root span
|
|
351
|
+
* - only if there's an ongoing pageload root span AND `_pageloadOngoing` is still `true,
|
|
352
|
+
* don't create a navigation root span
|
|
353
|
+
*/
|
|
354
|
+
TraceService.prototype._isPageloadOngoing = function () {
|
|
355
|
+
if (!this._pageloadOngoing) {
|
|
356
|
+
// pageload is already finished, no need to update
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
var activeSpan = Sentry.getActiveSpan();
|
|
360
|
+
if (!activeSpan) {
|
|
361
|
+
this._pageloadOngoing = false;
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
var rootSpan = Sentry.getRootSpan(activeSpan);
|
|
365
|
+
this._pageloadOngoing = Sentry.spanToJSON(rootSpan).op === 'pageload';
|
|
366
|
+
return this._pageloadOngoing;
|
|
367
|
+
};
|
|
386
368
|
return TraceService;
|
|
387
369
|
}());
|
|
388
370
|
TraceService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TraceService_Factory() { return new TraceService(i0__namespace.ɵɵinject(i1__namespace.Router)); }, token: TraceService, providedIn: "root" });
|
|
@@ -404,17 +386,15 @@
|
|
|
404
386
|
* @inheritdoc
|
|
405
387
|
*/
|
|
406
388
|
TraceDirective.prototype.ngOnInit = function () {
|
|
389
|
+
var _a;
|
|
407
390
|
if (!this.componentName) {
|
|
408
391
|
this.componentName = UNKNOWN_COMPONENT;
|
|
409
392
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
414
|
-
this._tracingSpan = activeTransaction.startChild({
|
|
415
|
-
description: "<" + this.componentName + ">",
|
|
393
|
+
if (Sentry.getActiveSpan()) {
|
|
394
|
+
this._tracingSpan = Sentry.startInactiveSpan({
|
|
395
|
+
name: "<" + this.componentName + ">",
|
|
416
396
|
op: ANGULAR_INIT_OP,
|
|
417
|
-
|
|
397
|
+
attributes: (_a = {}, _a[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = 'auto.ui.angular.trace_directive', _a),
|
|
418
398
|
});
|
|
419
399
|
}
|
|
420
400
|
};
|
|
@@ -452,28 +432,26 @@
|
|
|
452
432
|
/**
|
|
453
433
|
* Decorator function that can be used to capture initialization lifecycle of the whole component.
|
|
454
434
|
*/
|
|
455
|
-
function
|
|
435
|
+
function TraceClass(options) {
|
|
456
436
|
var tracingSpan;
|
|
457
437
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
458
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
459
438
|
return function (target) {
|
|
460
439
|
var originalOnInit = target.prototype.ngOnInit;
|
|
461
440
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
462
441
|
target.prototype.ngOnInit = function () {
|
|
442
|
+
var _a;
|
|
463
443
|
var args = [];
|
|
464
444
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
465
445
|
args[_i] = arguments[_i];
|
|
466
446
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
});
|
|
476
|
-
}
|
|
447
|
+
tracingSpan = Sentry.startInactiveSpan({
|
|
448
|
+
onlyIfParent: true,
|
|
449
|
+
name: "<" + (options && options.name ? options.name : 'unnamed') + ">",
|
|
450
|
+
op: ANGULAR_INIT_OP,
|
|
451
|
+
attributes: (_a = {},
|
|
452
|
+
_a[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = 'auto.ui.angular.trace_class_decorator',
|
|
453
|
+
_a),
|
|
454
|
+
});
|
|
477
455
|
if (originalOnInit) {
|
|
478
456
|
return originalOnInit.apply(this, args);
|
|
479
457
|
}
|
|
@@ -498,29 +476,27 @@
|
|
|
498
476
|
/**
|
|
499
477
|
* Decorator function that can be used to capture a single lifecycle methods of the component.
|
|
500
478
|
*/
|
|
501
|
-
function
|
|
502
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
479
|
+
function TraceMethod(options) {
|
|
480
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
503
481
|
return function (target, propertyKey, descriptor) {
|
|
504
482
|
var originalMethod = descriptor.value;
|
|
505
483
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
506
484
|
descriptor.value = function () {
|
|
485
|
+
var _a;
|
|
507
486
|
var args = [];
|
|
508
487
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
509
488
|
args[_i] = arguments[_i];
|
|
510
489
|
}
|
|
511
490
|
var now = utils.timestampInSeconds();
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
startTimestamp: now,
|
|
522
|
-
});
|
|
523
|
-
}
|
|
491
|
+
Sentry.startInactiveSpan({
|
|
492
|
+
onlyIfParent: true,
|
|
493
|
+
name: "<" + (options && options.name ? options.name : 'unnamed') + ">",
|
|
494
|
+
op: ANGULAR_OP + "." + String(propertyKey),
|
|
495
|
+
startTime: now,
|
|
496
|
+
attributes: (_a = {},
|
|
497
|
+
_a[Sentry.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = 'auto.ui.angular.trace_method_decorator',
|
|
498
|
+
_a),
|
|
499
|
+
}).end(now);
|
|
524
500
|
if (originalMethod) {
|
|
525
501
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
526
502
|
return originalMethod.apply(this, args);
|
|
@@ -558,17 +534,14 @@
|
|
|
558
534
|
*/
|
|
559
535
|
|
|
560
536
|
exports.SentryErrorHandler = SentryErrorHandler;
|
|
561
|
-
exports.
|
|
537
|
+
exports.TraceClass = TraceClass;
|
|
562
538
|
exports.TraceDirective = TraceDirective;
|
|
563
|
-
exports.
|
|
539
|
+
exports.TraceMethod = TraceMethod;
|
|
564
540
|
exports.TraceModule = TraceModule;
|
|
565
541
|
exports.TraceService = TraceService;
|
|
566
542
|
exports.browserTracingIntegration = browserTracingIntegration;
|
|
567
543
|
exports.createErrorHandler = createErrorHandler;
|
|
568
|
-
exports.getActiveTransaction = getActiveTransaction;
|
|
569
544
|
exports.init = init;
|
|
570
|
-
exports.instrumentAngularRouting = instrumentAngularRouting;
|
|
571
|
-
exports.routingInstrumentation = routingInstrumentation;
|
|
572
545
|
Object.keys(Sentry).forEach(function (k) {
|
|
573
546
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
574
547
|
enumerable: true,
|