Skip to content

Commit 7cbad07

Browse files
committed
integrate suggestions
1 parent abf51b2 commit 7cbad07

18 files changed

+430
-442
lines changed

packages/ember/MIGRATION.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Migration Guide
2+
3+
## From v1 Addon to v2 Addon
4+
5+
`@sentry/ember` has been migrated from a v1 Ember addon to a v2 addon. This guide covers the breaking changes.
6+
7+
For full setup instructions, see [UPGRADE.md](./UPGRADE.md).
8+
9+
### Import Path Changes
10+
11+
All exports are now available from the main `@sentry/ember` entry point. The `@sentry/ember/performance` import path has been removed.
12+
13+
**Before:**
14+
15+
```typescript
16+
import { setupPerformance } from '@sentry/ember/performance';
17+
```
18+
19+
**After:**
20+
21+
```typescript
22+
import { setupPerformance } from '@sentry/ember';
23+
```
24+
25+
### Performance Instrumentation
26+
27+
In the v1 addon, performance instrumentation was automatic via a built-in instance-initializer.
28+
29+
In v2, you must create an instance-initializer yourself:
30+
31+
```typescript
32+
// app/instance-initializers/sentry-performance.ts
33+
import type ApplicationInstance from '@ember/application/instance';
34+
import { setupPerformance } from '@sentry/ember';
35+
36+
export function initialize(appInstance: ApplicationInstance): void {
37+
setupPerformance(appInstance);
38+
}
39+
40+
export default {
41+
initialize,
42+
};
43+
```
44+
45+
### Configuration
46+
47+
Configuration is now passed directly to `Sentry.init()` instead of `config/environment.js`:
48+
49+
```typescript
50+
// app/app.ts
51+
import Application from '@ember/application';
52+
import * as Sentry from '@sentry/ember';
53+
54+
Sentry.init({
55+
dsn: 'YOUR_DSN_HERE',
56+
tracesSampleRate: 1.0,
57+
});
58+
59+
export default class App extends Application {
60+
// ...
61+
}
62+
```
63+
64+
### Initial Load Scripts
65+
66+
The v2 addon no longer automatically injects scripts into your HTML. For initial load performance measurement, manually add these scripts to `app/index.html`:
67+
68+
```html
69+
<head>
70+
<script>if(window.performance&&window.performance.mark){window.performance.mark('@sentry/ember:initial-load-start');}</script>
71+
<!-- ... -->
72+
</head>
73+
<body>
74+
<!-- ... -->
75+
<script>if(window.performance&&window.performance.mark){window.performance.mark('@sentry/ember:initial-load-end');}</script>
76+
</body>
77+
```
78+
79+
CSP hashes for these scripts are exported as `INITIAL_LOAD_HEAD_SCRIPT_HASH` and `INITIAL_LOAD_BODY_SCRIPT_HASH` from `@sentry/ember`.

packages/ember/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ For automatic performance instrumentation (page loads, navigation, runloop, comp
6262
```typescript
6363
// app/instance-initializers/sentry-performance.ts
6464
import type ApplicationInstance from '@ember/application/instance';
65-
import { setupPerformance } from '@sentry/ember/performance';
65+
import { setupPerformance } from '@sentry/ember';
6666

6767
export function initialize(appInstance: ApplicationInstance): void {
6868
setupPerformance(appInstance, {

packages/ember/UPGRADE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ In v1, performance instrumentation was automatic. In v2, create an instance-init
126126

127127
```typescript
128128
import type ApplicationInstance from '@ember/application/instance';
129-
import { setupPerformance } from '@sentry/ember/performance';
129+
import { setupPerformance } from '@sentry/ember';
130130

131131
export function initialize(appInstance: ApplicationInstance): void {
132132
setupPerformance(appInstance);
@@ -141,7 +141,7 @@ export default {
141141

142142
```typescript
143143
import type ApplicationInstance from '@ember/application/instance';
144-
import { setupPerformance } from '@sentry/ember/performance';
144+
import { setupPerformance } from '@sentry/ember';
145145

146146
export function initialize(appInstance: ApplicationInstance): void {
147147
setupPerformance(appInstance, {
@@ -211,7 +211,7 @@ import { instrumentRoutePerformance } from '@sentry/ember';
211211
import { instrumentRoutePerformance } from '@sentry/ember';
212212

213213
// v2 - new import for setupPerformance
214-
import { setupPerformance } from '@sentry/ember/performance';
214+
import { setupPerformance } from '@sentry/ember';
215215
```
216216

217217
### All @sentry/browser Exports
@@ -317,7 +317,7 @@ loadInitializers(App, config.modulePrefix);
317317
**app/instance-initializers/sentry-performance.ts:**
318318
```typescript
319319
import type ApplicationInstance from '@ember/application/instance';
320-
import { setupPerformance } from '@sentry/ember/performance';
320+
import { setupPerformance } from '@sentry/ember';
321321

322322
export function initialize(appInstance: ApplicationInstance): void {
323323
setupPerformance(appInstance);
@@ -349,7 +349,7 @@ export default { initialize };
349349

350350
Make sure you're importing from the correct path:
351351
```typescript
352-
import { setupPerformance } from '@sentry/ember/performance';
352+
import { setupPerformance } from '@sentry/ember';
353353
```
354354

355355
### Performance spans not appearing

packages/ember/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
"types": "./declarations/index.d.ts",
1818
"default": "./dist/index.js"
1919
},
20-
"./performance": {
21-
"types": "./declarations/performance.d.ts",
22-
"default": "./dist/performance.js"
23-
},
2420
"./addon-main.js": "./addon-main.cjs"
2521
},
2622
"files": [

packages/ember/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
// up your addon's public API. Also make sure your package.json#exports
2626
// is aligned to the config here.
2727
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
28-
addon.publicEntrypoints(['**/*.js', 'index.js']),
28+
addon.publicEntrypoints(['index.ts']),
2929

3030
// These are the modules that should get reexported into the traditional
3131
// "app" tree. Things in here should also be in publicEntrypoints above, but

0 commit comments

Comments
 (0)