@sentry/ember 8.0.0-alpha.2 → 8.0.0-alpha.4
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
CHANGED
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
## General
|
|
15
15
|
|
|
16
|
-
This package is an Ember addon that wraps `@sentry/browser`, with added functionality related to Ember. All methods
|
|
17
|
-
`@sentry/browser` can be imported from `@sentry/ember`.
|
|
16
|
+
This package is an Ember addon that wraps `@sentry/browser`, with added functionality related to Ember. All methods
|
|
17
|
+
available in `@sentry/browser` can be imported from `@sentry/ember`.
|
|
18
18
|
|
|
19
19
|
### Installation
|
|
20
20
|
|
|
21
|
-
As with other Ember addons, run:
|
|
22
|
-
`ember install @sentry/ember`
|
|
21
|
+
As with other Ember addons, run: `ember install @sentry/ember`
|
|
23
22
|
|
|
24
23
|
Then add the following to your `<your-app>/app.js`
|
|
25
24
|
|
|
@@ -38,8 +37,9 @@ Then add the following to your `<your-app>/app.js`
|
|
|
38
37
|
|
|
39
38
|
### Usage
|
|
40
39
|
|
|
41
|
-
To use this SDK, call `Sentry.init` before the application is initialized, in `app.js`. This will allow Sentry to
|
|
42
|
-
Any additional SDK settings can be modified via the usual config in
|
|
40
|
+
To use this SDK, call `Sentry.init` before the application is initialized, in `app.js`. This will allow Sentry to
|
|
41
|
+
capture information while your app is starting. Any additional SDK settings can be modified via the usual config in
|
|
42
|
+
`environment.js` for you, see the Additional Configuration section for more details.
|
|
43
43
|
|
|
44
44
|
```javascript
|
|
45
45
|
import Application from '@ember/application';
|
|
@@ -66,7 +66,8 @@ export default class App extends Application {
|
|
|
66
66
|
|
|
67
67
|
### Additional Configuration
|
|
68
68
|
|
|
69
|
-
Aside from configuration passed from this addon into `@sentry/browser` via the `sentry` property, there is also the
|
|
69
|
+
Aside from configuration passed from this addon into `@sentry/browser` via the `sentry` property, there is also the
|
|
70
|
+
following Ember specific configuration:
|
|
70
71
|
|
|
71
72
|
```javascript
|
|
72
73
|
ENV['@sentry/ember'] = {
|
|
@@ -93,8 +94,8 @@ ENV['@sentry/ember'] = {
|
|
|
93
94
|
|
|
94
95
|
#### Disabling Performance
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
`@sentry/ember` captures performance by default, if you would like to disable the automatic performance instrumentation,
|
|
98
|
+
you can add the following to your `config/environment.js`:
|
|
98
99
|
|
|
99
100
|
```javascript
|
|
100
101
|
ENV['@sentry/ember'] = {
|
|
@@ -102,7 +103,6 @@ ENV['@sentry/ember'] = {
|
|
|
102
103
|
};
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
|
|
106
106
|
### Performance
|
|
107
107
|
|
|
108
108
|
#### Routes
|
|
@@ -149,8 +149,8 @@ ENV['@sentry/ember'] = {
|
|
|
149
149
|
};
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
Additionally, components whose render time is below a threshold (by default 2ms) will not be included as spans.
|
|
153
|
-
|
|
152
|
+
Additionally, components whose render time is below a threshold (by default 2ms) will not be included as spans. If you
|
|
153
|
+
would like to change this threshold, add the following to your config:
|
|
154
154
|
|
|
155
155
|
```javascript
|
|
156
156
|
ENV['@sentry/ember'] = {
|
|
@@ -172,8 +172,8 @@ ENV['@sentry/ember'] = {
|
|
|
172
172
|
|
|
173
173
|
### Supported Versions
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
- **Ember.js**: v4.0 or above
|
|
176
|
+
- **Node**: v14.18 or above
|
|
177
177
|
|
|
178
178
|
### Previous Integration
|
|
179
179
|
|
|
@@ -182,8 +182,8 @@ this Ember addon to offer more Ember-specific error and performancing monitoring
|
|
|
182
182
|
|
|
183
183
|
## Testing
|
|
184
184
|
|
|
185
|
-
For this package itself, you can find example instrumentation in the `dummy` application, which is also used for
|
|
186
|
-
To test with the dummy application, you must pass the dsn as an environment variable.
|
|
185
|
+
For this package itself, you can find example instrumentation in the `dummy` application, which is also used for
|
|
186
|
+
testing. To test with the dummy application, you must pass the dsn as an environment variable.
|
|
187
187
|
|
|
188
188
|
```javascript
|
|
189
189
|
SENTRY_DSN=__DSN__ ember serve
|
|
@@ -6,20 +6,21 @@ import type RouterService from '@ember/routing/router-service';
|
|
|
6
6
|
import { _backburner, run, scheduleOnce } from '@ember/runloop';
|
|
7
7
|
import type { EmberRunQueues } from '@ember/runloop/-private/types';
|
|
8
8
|
import { getOwnConfig, isTesting, macroCondition } from '@embroider/macros';
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import type {
|
|
10
|
+
BrowserClient,
|
|
11
|
+
startBrowserTracingNavigationSpan as startBrowserTracingNavigationSpanType,
|
|
12
|
+
startBrowserTracingPageLoadSpan as startBrowserTracingPageLoadSpanType,
|
|
13
|
+
} from '@sentry/browser';
|
|
14
14
|
import {
|
|
15
15
|
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
|
|
16
16
|
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
|
|
17
17
|
getActiveSpan,
|
|
18
18
|
getClient,
|
|
19
|
-
startBrowserTracingNavigationSpan,
|
|
20
|
-
startBrowserTracingPageLoadSpan,
|
|
21
19
|
startInactiveSpan,
|
|
22
20
|
} from '@sentry/browser';
|
|
21
|
+
import type { ExtendedBackburner } from '@sentry/ember/runloop';
|
|
22
|
+
import type { Span } from '@sentry/types';
|
|
23
|
+
import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils';
|
|
23
24
|
import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
|
|
24
25
|
|
|
25
26
|
function getSentryConfig(): EmberSentryConfig {
|
|
@@ -99,6 +100,8 @@ export function _instrumentEmberRouter(
|
|
|
99
100
|
routerService: RouterService,
|
|
100
101
|
routerMain: EmberRouterMain,
|
|
101
102
|
config: EmberSentryConfig,
|
|
103
|
+
startBrowserTracingPageLoadSpan: typeof startBrowserTracingPageLoadSpanType,
|
|
104
|
+
startBrowserTracingNavigationSpan: typeof startBrowserTracingNavigationSpanType,
|
|
102
105
|
): void {
|
|
103
106
|
const { disableRunloopPerformance } = config;
|
|
104
107
|
const location = routerMain.location;
|
|
@@ -119,9 +122,9 @@ export function _instrumentEmberRouter(
|
|
|
119
122
|
const routeInfo = routerService.recognize(url);
|
|
120
123
|
activeRootSpan = startBrowserTracingPageLoadSpan(client, {
|
|
121
124
|
name: `route:${routeInfo.name}`,
|
|
122
|
-
origin: 'auto.pageload.ember',
|
|
123
125
|
attributes: {
|
|
124
126
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
127
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.ember',
|
|
125
128
|
url,
|
|
126
129
|
toRoute: routeInfo.name,
|
|
127
130
|
},
|
|
@@ -146,9 +149,9 @@ export function _instrumentEmberRouter(
|
|
|
146
149
|
|
|
147
150
|
activeRootSpan = startBrowserTracingNavigationSpan(client, {
|
|
148
151
|
name: `route:${toRoute}`,
|
|
149
|
-
origin: 'auto.navigation.ember',
|
|
150
152
|
attributes: {
|
|
151
153
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
154
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.ember',
|
|
152
155
|
fromRoute,
|
|
153
156
|
toRoute,
|
|
154
157
|
},
|
|
@@ -220,7 +223,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
|
|
|
220
223
|
},
|
|
221
224
|
name: 'runloop',
|
|
222
225
|
op: `ui.ember.runloop.${queue}`,
|
|
223
|
-
|
|
226
|
+
startTime: currentQueueStart,
|
|
224
227
|
})?.end(now);
|
|
225
228
|
}
|
|
226
229
|
currentQueueStart = undefined;
|
|
@@ -292,8 +295,10 @@ function processComponentRenderAfter(
|
|
|
292
295
|
startInactiveSpan({
|
|
293
296
|
name: payload.containerKey || payload.object,
|
|
294
297
|
op,
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
startTime: begin.now,
|
|
299
|
+
attributes: {
|
|
300
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
|
|
301
|
+
},
|
|
297
302
|
})?.end(now);
|
|
298
303
|
}
|
|
299
304
|
}
|
|
@@ -369,8 +374,8 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
|
|
|
369
374
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
370
375
|
const measure = measures[0]!;
|
|
371
376
|
|
|
372
|
-
const
|
|
373
|
-
const
|
|
377
|
+
const startTime = (measure.startTime + browserPerformanceTimeOrigin) / 1000;
|
|
378
|
+
const endTime = startTime + measure.duration / 1000;
|
|
374
379
|
|
|
375
380
|
startInactiveSpan({
|
|
376
381
|
op: 'ui.ember.init',
|
|
@@ -378,8 +383,8 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
|
|
|
378
383
|
attributes: {
|
|
379
384
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
|
|
380
385
|
},
|
|
381
|
-
|
|
382
|
-
})?.end(
|
|
386
|
+
startTime,
|
|
387
|
+
})?.end(endTime);
|
|
383
388
|
performance.clearMarks(startName);
|
|
384
389
|
performance.clearMarks(endName);
|
|
385
390
|
|
|
@@ -411,7 +416,8 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
|
|
|
411
416
|
// Maintaining backwards compatibility with config.browserTracingOptions, but passing it with Sentry options is preferred.
|
|
412
417
|
const browserTracingOptions = config.browserTracingOptions || config.sentry.browserTracingOptions || {};
|
|
413
418
|
|
|
414
|
-
const { browserTracingIntegration } =
|
|
419
|
+
const { browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } =
|
|
420
|
+
await import('@sentry/browser');
|
|
415
421
|
|
|
416
422
|
const idleTimeout = config.transitionTimeout || 5000;
|
|
417
423
|
|
|
@@ -431,7 +437,7 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
|
|
|
431
437
|
}
|
|
432
438
|
|
|
433
439
|
// We _always_ call this, as it triggers the page load & navigation spans
|
|
434
|
-
_instrumentNavigation(appInstance, config);
|
|
440
|
+
_instrumentNavigation(appInstance, config, startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan);
|
|
435
441
|
|
|
436
442
|
// Skip instrumenting the stuff below again in tests, as these are not reset between tests
|
|
437
443
|
if (isAlreadyInitialized) {
|
|
@@ -443,7 +449,12 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
|
|
|
443
449
|
_instrumentInitialLoad(config);
|
|
444
450
|
}
|
|
445
451
|
|
|
446
|
-
function _instrumentNavigation(
|
|
452
|
+
function _instrumentNavigation(
|
|
453
|
+
appInstance: ApplicationInstance,
|
|
454
|
+
config: EmberSentryConfig,
|
|
455
|
+
startBrowserTracingPageLoadSpan: typeof startBrowserTracingPageLoadSpanType,
|
|
456
|
+
startBrowserTracingNavigationSpan: typeof startBrowserTracingNavigationSpanType,
|
|
457
|
+
): void {
|
|
447
458
|
// eslint-disable-next-line ember/no-private-routing-service
|
|
448
459
|
const routerMain = appInstance.lookup('router:main') as EmberRouterMain;
|
|
449
460
|
let routerService = appInstance.lookup('service:router') as RouterService & {
|
|
@@ -465,7 +476,13 @@ function _instrumentNavigation(appInstance: ApplicationInstance, config: EmberSe
|
|
|
465
476
|
}
|
|
466
477
|
|
|
467
478
|
routerService._hasMountedSentryPerformanceRouting = true;
|
|
468
|
-
_instrumentEmberRouter(
|
|
479
|
+
_instrumentEmberRouter(
|
|
480
|
+
routerService,
|
|
481
|
+
routerMain,
|
|
482
|
+
config,
|
|
483
|
+
startBrowserTracingPageLoadSpan,
|
|
484
|
+
startBrowserTracingNavigationSpan,
|
|
485
|
+
);
|
|
469
486
|
}
|
|
470
487
|
|
|
471
488
|
export default {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type ApplicationInstance from '@ember/application/instance';
|
|
2
2
|
import type RouterService from '@ember/routing/router-service';
|
|
3
|
+
import type { startBrowserTracingNavigationSpan as startBrowserTracingNavigationSpanType, startBrowserTracingPageLoadSpan as startBrowserTracingPageLoadSpanType } from '@sentry/browser';
|
|
3
4
|
import type { EmberRouterMain, EmberSentryConfig } from '../types';
|
|
4
5
|
export declare function initialize(appInstance: ApplicationInstance): void;
|
|
5
|
-
export declare function _instrumentEmberRouter(routerService: RouterService, routerMain: EmberRouterMain, config: EmberSentryConfig): void;
|
|
6
|
+
export declare function _instrumentEmberRouter(routerService: RouterService, routerMain: EmberRouterMain, config: EmberSentryConfig, startBrowserTracingPageLoadSpan: typeof startBrowserTracingPageLoadSpanType, startBrowserTracingNavigationSpan: typeof startBrowserTracingNavigationSpanType): void;
|
|
6
7
|
export declare function instrumentForPerformance(appInstance: ApplicationInstance): Promise<void>;
|
|
7
8
|
declare const _default: {
|
|
8
9
|
initialize: typeof initialize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/ember",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.4",
|
|
4
4
|
"description": "Official Sentry SDK for Ember.js",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/ember",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@embroider/macros": "^1.9.0",
|
|
35
|
-
"@sentry/browser": "8.0.0-alpha.
|
|
36
|
-
"@sentry/core": "8.0.0-alpha.
|
|
37
|
-
"@sentry/types": "8.0.0-alpha.
|
|
38
|
-
"@sentry/utils": "8.0.0-alpha.
|
|
35
|
+
"@sentry/browser": "8.0.0-alpha.4",
|
|
36
|
+
"@sentry/core": "8.0.0-alpha.4",
|
|
37
|
+
"@sentry/types": "8.0.0-alpha.4",
|
|
38
|
+
"@sentry/utils": "8.0.0-alpha.4",
|
|
39
39
|
"ember-auto-import": "^1.12.1 || ^2.4.3",
|
|
40
40
|
"ember-cli-babel": "^7.26.11",
|
|
41
41
|
"ember-cli-htmlbars": "^6.1.1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"webpack": "~5.74.0"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
|
-
"node": ">=14.
|
|
86
|
+
"node": ">=14.18"
|
|
87
87
|
},
|
|
88
88
|
"ember": {
|
|
89
89
|
"edition": "octane"
|