@sentry/ember 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 +16 -16
- package/addon/index.ts +15 -16
- package/addon/instance-initializers/sentry-performance.ts +13 -24
- package/addon/types.ts +2 -4
- package/index.d.ts +0 -7
- package/package.json +6 -6
- package/types.d.ts +2 -2
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
|
package/addon/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, applySdkMetadata } from '@sentry/core
|
|
|
9
9
|
import { GLOBAL_OBJ } from '@sentry/utils';
|
|
10
10
|
import Ember from 'ember';
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { TransactionSource } from '@sentry/types';
|
|
13
13
|
import type { EmberSentryConfig, GlobalConfig, OwnConfig } from './types';
|
|
14
14
|
|
|
15
15
|
function _getSentryInitConfig(): EmberSentryConfig['sentry'] {
|
|
@@ -60,33 +60,24 @@ export function init(_runtimeConfig?: BrowserOptions): void {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Grabs active transaction off scope.
|
|
65
|
-
*
|
|
66
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
67
|
-
*/
|
|
68
|
-
export const getActiveTransaction = (): Transaction | undefined => {
|
|
69
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
70
|
-
return Sentry.getCurrentScope().getTransaction();
|
|
71
|
-
};
|
|
72
|
-
|
|
73
63
|
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
74
64
|
|
|
75
65
|
export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute: T): T => {
|
|
76
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
67
|
const instrumentFunction = async <X extends (...args: unknown[]) => any>(
|
|
78
68
|
op: string,
|
|
79
|
-
|
|
69
|
+
name: string,
|
|
80
70
|
fn: X,
|
|
81
71
|
args: Parameters<X>,
|
|
72
|
+
source: TransactionSource,
|
|
82
73
|
): Promise<ReturnType<X>> => {
|
|
83
74
|
return startSpan(
|
|
84
75
|
{
|
|
85
76
|
attributes: {
|
|
86
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
77
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
87
78
|
},
|
|
88
79
|
op,
|
|
89
|
-
name
|
|
80
|
+
name,
|
|
90
81
|
},
|
|
91
82
|
() => {
|
|
92
83
|
return fn(...args);
|
|
@@ -105,15 +96,22 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
|
|
|
105
96
|
this.fullRouteName,
|
|
106
97
|
super.beforeModel.bind(this),
|
|
107
98
|
args,
|
|
99
|
+
'custom',
|
|
108
100
|
);
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
public async model(...args: unknown[]): Promise<unknown> {
|
|
112
|
-
return instrumentFunction('ui.ember.route.model', this.fullRouteName, super.model.bind(this), args);
|
|
104
|
+
return instrumentFunction('ui.ember.route.model', this.fullRouteName, super.model.bind(this), args, 'custom');
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
public afterModel(...args: unknown[]): void | Promise<unknown> {
|
|
116
|
-
return instrumentFunction(
|
|
108
|
+
return instrumentFunction(
|
|
109
|
+
'ui.ember.route.after_model',
|
|
110
|
+
this.fullRouteName,
|
|
111
|
+
super.afterModel.bind(this),
|
|
112
|
+
args,
|
|
113
|
+
'custom',
|
|
114
|
+
);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
public setupController(...args: unknown[]): void | Promise<unknown> {
|
|
@@ -122,6 +120,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
|
|
|
122
120
|
this.fullRouteName,
|
|
123
121
|
super.setupController.bind(this),
|
|
124
122
|
args,
|
|
123
|
+
'custom',
|
|
125
124
|
);
|
|
126
125
|
}
|
|
127
126
|
},
|
|
@@ -118,22 +118,15 @@ export function _instrumentEmberRouter(
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
if (
|
|
122
|
-
url &&
|
|
123
|
-
browserTracingOptions.startTransactionOnPageLoad !== false &&
|
|
124
|
-
browserTracingOptions.instrumentPageLoad !== false
|
|
125
|
-
) {
|
|
121
|
+
if (url && browserTracingOptions.instrumentPageLoad !== false) {
|
|
126
122
|
const routeInfo = routerService.recognize(url);
|
|
127
123
|
activeRootSpan = startBrowserTracingPageLoadSpan(client, {
|
|
128
124
|
name: `route:${routeInfo.name}`,
|
|
129
|
-
origin: 'auto.pageload.ember',
|
|
130
125
|
attributes: {
|
|
131
126
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
132
|
-
|
|
133
|
-
tags: {
|
|
127
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.ember',
|
|
134
128
|
url,
|
|
135
129
|
toRoute: routeInfo.name,
|
|
136
|
-
'routing.instrumentation': '@sentry/ember',
|
|
137
130
|
},
|
|
138
131
|
});
|
|
139
132
|
}
|
|
@@ -146,10 +139,7 @@ export function _instrumentEmberRouter(
|
|
|
146
139
|
getBackburner().off('end', finishActiveTransaction);
|
|
147
140
|
};
|
|
148
141
|
|
|
149
|
-
if (
|
|
150
|
-
browserTracingOptions.startTransactionOnLocationChange === false &&
|
|
151
|
-
browserTracingOptions.instrumentNavigation === false
|
|
152
|
-
) {
|
|
142
|
+
if (browserTracingOptions.instrumentNavigation === false) {
|
|
153
143
|
return;
|
|
154
144
|
}
|
|
155
145
|
|
|
@@ -159,14 +149,11 @@ export function _instrumentEmberRouter(
|
|
|
159
149
|
|
|
160
150
|
activeRootSpan = startBrowserTracingNavigationSpan(client, {
|
|
161
151
|
name: `route:${toRoute}`,
|
|
162
|
-
origin: 'auto.navigation.ember',
|
|
163
152
|
attributes: {
|
|
164
153
|
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
165
|
-
|
|
166
|
-
tags: {
|
|
154
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.ember',
|
|
167
155
|
fromRoute,
|
|
168
156
|
toRoute,
|
|
169
|
-
'routing.instrumentation': '@sentry/ember',
|
|
170
157
|
},
|
|
171
158
|
});
|
|
172
159
|
|
|
@@ -236,7 +223,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {
|
|
|
236
223
|
},
|
|
237
224
|
name: 'runloop',
|
|
238
225
|
op: `ui.ember.runloop.${queue}`,
|
|
239
|
-
|
|
226
|
+
startTime: currentQueueStart,
|
|
240
227
|
})?.end(now);
|
|
241
228
|
}
|
|
242
229
|
currentQueueStart = undefined;
|
|
@@ -308,8 +295,10 @@ function processComponentRenderAfter(
|
|
|
308
295
|
startInactiveSpan({
|
|
309
296
|
name: payload.containerKey || payload.object,
|
|
310
297
|
op,
|
|
311
|
-
|
|
312
|
-
|
|
298
|
+
startTime: begin.now,
|
|
299
|
+
attributes: {
|
|
300
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
|
|
301
|
+
},
|
|
313
302
|
})?.end(now);
|
|
314
303
|
}
|
|
315
304
|
}
|
|
@@ -385,8 +374,8 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
|
|
|
385
374
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
386
375
|
const measure = measures[0]!;
|
|
387
376
|
|
|
388
|
-
const
|
|
389
|
-
const
|
|
377
|
+
const startTime = (measure.startTime + browserPerformanceTimeOrigin) / 1000;
|
|
378
|
+
const endTime = startTime + measure.duration / 1000;
|
|
390
379
|
|
|
391
380
|
startInactiveSpan({
|
|
392
381
|
op: 'ui.ember.init',
|
|
@@ -394,8 +383,8 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
|
|
|
394
383
|
attributes: {
|
|
395
384
|
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.ember',
|
|
396
385
|
},
|
|
397
|
-
|
|
398
|
-
})?.end(
|
|
386
|
+
startTime,
|
|
387
|
+
})?.end(endTime);
|
|
399
388
|
performance.clearMarks(startName);
|
|
400
389
|
performance.clearMarks(endName);
|
|
401
390
|
|
package/addon/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { BrowserOptions,
|
|
1
|
+
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
2
|
import type { Transaction, TransactionContext } from '@sentry/types';
|
|
3
3
|
|
|
4
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0]
|
|
5
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
6
|
-
ConstructorParameters<typeof BrowserTracing>[0];
|
|
4
|
+
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
7
5
|
|
|
8
6
|
export type EmberSentryConfig = {
|
|
9
7
|
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };
|
package/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import type Route from '@ember/routing/route';
|
|
2
2
|
import type { BrowserOptions } from '@sentry/browser';
|
|
3
|
-
import type { Transaction } from '@sentry/types';
|
|
4
3
|
/**
|
|
5
4
|
* Initialize the Sentry SDK for Ember.
|
|
6
5
|
*/
|
|
7
6
|
export declare function init(_runtimeConfig?: BrowserOptions): void;
|
|
8
|
-
/**
|
|
9
|
-
* Grabs active transaction off scope.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
12
|
-
*/
|
|
13
|
-
export declare const getActiveTransaction: () => Transaction | undefined;
|
|
14
7
|
type RouteConstructor = new (...args: ConstructorParameters<typeof Route>) => Route;
|
|
15
8
|
export declare const instrumentRoutePerformance: <T extends RouteConstructor>(BaseRoute: T) => T;
|
|
16
9
|
export * from '@sentry/browser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/ember",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.3",
|
|
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": "
|
|
36
|
-
"@sentry/core": "
|
|
37
|
-
"@sentry/types": "
|
|
38
|
-
"@sentry/utils": "
|
|
35
|
+
"@sentry/browser": "8.0.0-alpha.3",
|
|
36
|
+
"@sentry/core": "8.0.0-alpha.3",
|
|
37
|
+
"@sentry/types": "8.0.0-alpha.3",
|
|
38
|
+
"@sentry/utils": "8.0.0-alpha.3",
|
|
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"
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BrowserOptions,
|
|
1
|
+
import type { BrowserOptions, browserTracingIntegration } from '@sentry/browser';
|
|
2
2
|
import type { Transaction, TransactionContext } from '@sentry/types';
|
|
3
|
-
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0]
|
|
3
|
+
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0];
|
|
4
4
|
export type EmberSentryConfig = {
|
|
5
5
|
sentry: BrowserOptions & {
|
|
6
6
|
browserTracingOptions?: BrowserTracingOptions;
|