Skip to content

Commit 5ca28f8

Browse files
authored
feat: New Ember docs (#2124)
* feat: New Ember docs This updates the documentation to point at the new Ember addon
1 parent cf1d79a commit 5ca28f8

File tree

10 files changed

+222
-109
lines changed

10 files changed

+222
-109
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Options are passed to `sentry` inside your environment:
2+
3+
```javascript
4+
ENV['@sentry/ember'] = {
5+
sentry: {
6+
dsn: '___PUBLIC_DSN___',
7+
tracesSampleRate: 1.0, // We recommend adjusting this in production
8+
maxBreadcrumbs: 50,
9+
debug: true,
10+
}
11+
};
12+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
This snippet includes automatic instrumentation to monitor the performance of your application, which registers and configures the Tracing integration, including custom [Ember instrumentation](./configuration/ember-options/).
3+
4+
```javascript
5+
import Application from '@ember/application';
6+
import Resolver from 'ember-resolver';
7+
import loadInitializers from 'ember-load-initializers';
8+
import config from './config/environment';
9+
10+
import { InitSentryForEmber } from '@sentry/ember';
11+
12+
InitSentryForEmber();
13+
14+
export default class App extends Application {
15+
modulePrefix = config.modulePrefix;
16+
podModulePrefix = config.podModulePrefix;
17+
Resolver = Resolver;
18+
}
19+
```
20+
21+
Then add the following config to your `config/environment.js`:
22+
23+
```javascript
24+
ENV['@sentry/ember'] = {
25+
sentry: {
26+
dsn: '___PUBLIC_DSN___',
27+
28+
// Set tracesSampleRate to 1.0 to capture 100%
29+
// of transactions for performance monitoring.
30+
// We recommend adjusting this value in production,
31+
tracesSampleRate: 1.0,
32+
}
33+
};
34+
```
35+
36+
<Note><markdown>
37+
38+
This SDK uses Ember configuration conventions to manage its automatic instrumentation and other Sentry options, this additional configuration can be found under <PlatformLink to="/configuration/ember-options/">Ember options</PlatformLink>.
39+
40+
</markdown></Note>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```bash {tabTitle:ember-cli}
2+
ember install @sentry/ember
3+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Note>
2+
<markdown>
3+
4+
_Sentry's Ember addon enables automatic reporting of errors, exceptions, and transactions._
5+
6+
</markdown>
7+
</Note>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: Ember
2+
categories:
3+
- browser
4+
redirect_from:
5+
- /clients/javascript/integrations/ember/
6+
- /platforms/javascript/ember/
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Ember Options
3+
description: "Additional configuration options for the Ember addon."
4+
sidebar_order: 1
5+
---
6+
7+
The `@sentry/ember` addon includes options to manage Ember specific instrumentation; these options are set on the addon config directly. All Sentry SDK options that would be passed to `init` should instead be set in the `sentry` key inside your addon config as in this example:
8+
9+
```javascript
10+
ENV['@sentry/ember'] = {
11+
// Ember specific options
12+
sentry: {
13+
// Sentry options
14+
}
15+
};
16+
```
17+
18+
The following documentation is for Ember specific configuration, for Sentry options, [see basic options](/platforms/javascript/guides/ember/configuration/options)
19+
20+
### Performance Monitoring Considerations
21+
22+
The Sentry tracing integration is already set up via the Ember addon with custom Ember instrumentation for routing, components, and the runloop. It sideloads `@sentry/tracing` as a chunk to instrument your application. If you would like to disable this automatic instrumentation and no longer receive the associated transactions, you can set `disablePerformance` in your config as in this example:
23+
24+
```javascript
25+
ENV['@sentry/ember'] = {
26+
disablePerformance: true
27+
};
28+
```
29+
30+
### Routes
31+
32+
If you would like to capture timings for the `beforeModel`, `model`, `afterModel` hooks as well as `setupController` in one of your Routes, `@sentry/ember` exports a `instrumentRoutePerformance` function which can be used by replacing the default export with a wrapped Route.
33+
34+
```javascript
35+
import Route from '@ember/routing/route';
36+
import { instrumentRoutePerformance } from '@sentry/ember';
37+
38+
class MyRoute extends Route {
39+
model() {
40+
//...
41+
}
42+
}
43+
44+
export default instrumentRoutePerformance(MyRoute);
45+
```
46+
47+
### Classic Components
48+
The render times of classic components are also enabled by default, with a setting to capture render timings only above a certain duration. To change this minimum, you can modify `minimumComponentRenderDuration` in your config.
49+
50+
```javascript
51+
ENV['@sentry/ember'] = {
52+
minimumComponentRenderDuration: 0, // Setting this to zero will capture all classic components.
53+
};
54+
```
55+
56+
To disable component instrumentation you can set `disableInstrumentComponents` in your config.
57+
```javascript
58+
ENV['@sentry/ember'] = {
59+
disableInstrumentComponents: true
60+
};
61+
```
62+
63+
### Runloop
64+
The duration of each queue in your application's runloop is instrumented by default, as long as the duration of the queue is longer than a threshold defined in your config by `minimumRunloopQueueDuration`
65+
66+
```javascript
67+
ENV['@sentry/ember'] = {
68+
minimumRunloopQueueDuration: 0, // Setting this to zero will capture all runloop queue durations
69+
};
70+
```
71+
72+
If you would like to disable runloop instrumentation you can set `disableRunloopPerformance` in your config.
73+
```javascript
74+
ENV['@sentry/ember'] = {
75+
disableRunloopPerformance: true
76+
};
77+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Ember 2.x
3+
description: "Learn how to use Sentry's Emberjs integration if you're using Ember 2.x."
4+
redirect_from:
5+
- /clients/javascript/integrations/ember/
6+
---
7+
8+
If you're using `Ember 2.x`, you can use Sentry's Ember integration.
9+
10+
To use Sentry with your Ember application, you will need to use Sentry’s browser JavaScript SDK: `@sentry/browser`.
11+
12+
On its own, `@sentry/browser` will report any uncaught exceptions triggered from your application.
13+
To use ESM imports without any additional configuration, you can use `ember-auto-import`
14+
by installing it with `ember install ember-auto-import`.
15+
16+
Starting with version `5.x` our `Ember` integration lives in its own `@sentry/integrations` package.
17+
Install the package using either `npm` or `yarn`:
18+
19+
```bash {tabTitle:npm}
20+
npm install --save @sentry/integrations
21+
```
22+
23+
```bash {tabTitle:yarn}
24+
yarn add @sentry/integrations
25+
```
26+
27+
Then add to your `app.js`:
28+
29+
```javascript
30+
import * as Sentry from "@sentry/browser";
31+
import { Ember as EmberIntegration } from "@sentry/integrations";
32+
33+
Sentry.init({
34+
dsn: "___PUBLIC_DSN___",
35+
integrations: [new EmberIntegration()],
36+
});
37+
```
38+
39+
If you are using the CDN version or the Loader, we provide a standalone file for every integration, to set it up [check out our CDN documentation](/platforms/javascript/install/cdn)
40+
41+
<!-- TODO-ADD-VERIFICATION-EXAMPLE -->
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Other Versions
3+
sidebar_order: 2
4+
---
5+
6+
<PageGrid />

src/platforms/javascript/guides/ember/index.mdx

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/wizard/javascript/ember.md

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,46 @@ support_level: production
55
type: framework
66
---
77

8-
To use Sentry with your Ember application, you will need to use Sentry’s browser JavaScript SDK: `@sentry/browser`.
9-
10-
On its own, `@sentry/browser` will report any uncaught exceptions triggered from your application.
11-
In order to use ESM imports without any additional configuration, you can use `ember-auto-import`
12-
by installing it with `ember install ember-auto-import`.
13-
14-
Starting with version `5.x` our `Ember` integration lives in it's own package `@sentry/integrations`.
15-
You can install it with `npm` / `yarn` like:
8+
To use Sentry with your Ember application, you will need to use Sentry’s Ember addon: `@sentry/ember`.
169

1710
```bash
18-
# Using yarn
19-
yarn add @sentry/browser @sentry/integrations
20-
21-
# Using npm
22-
npm install --save @sentry/browser @sentry/integrations
11+
# Using ember-cli
12+
ember install @sentry/ember
2313
```
2414

25-
Then add this to your `app.js`:
15+
You should `init` the Sentry SDK as soon as possible during your application load up in `app.js`, before initializing Ember:
2616

2717
```javascript
28-
import * as Sentry from "@sentry/browser";
29-
import { Ember as EmberIntegration } from "@sentry/integrations";
18+
import Application from '@ember/application';
19+
import Resolver from 'ember-resolver';
20+
import loadInitializers from 'ember-load-initializers';
21+
import config from './config/environment';
3022

31-
Sentry.init({
32-
dsn: "___PUBLIC_DSN___",
33-
integrations: [new EmberIntegration()],
34-
});
35-
```
23+
import { InitSentryForEmber } from '@sentry/ember';
3624

37-
In case you are using the CDN version or the Loader, we provide a standalone file for every integration, you can use it
38-
like this:
25+
InitSentryForEmber();
3926

40-
```html
41-
<!-- Note that we now also provide a es6 build only -->
42-
<!-- <script src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/bundle.es6.min.js" integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'bundle.es6.min.js', 'sha384-base64') }}" crossorigin="anonymous"></script> -->
43-
<script
44-
src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/bundle.min.js"
45-
integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'bundle.min.js', 'sha384-base64') }}"
46-
crossorigin="anonymous"
47-
></script>
27+
export default class App extends Application {
28+
modulePrefix = config.modulePrefix;
29+
podModulePrefix = config.podModulePrefix;
30+
Resolver = Resolver;
31+
}
32+
```
4833

49-
<!-- If you include the integration it will be available under Sentry.Integrations.Ember -->
50-
<script
51-
src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/ember.min.js"
52-
integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'ember.min.js', 'sha384-base64') }}"
53-
crossorigin="anonymous"
54-
></script>
34+
Then add the following config to your `config/environment.js`:
5535

56-
<script>
57-
Sentry.init({
58-
dsn: "___PUBLIC_DSN___",
59-
integrations: [new Sentry.Integrations.Ember()],
60-
});
61-
</script>
36+
```javascript
37+
ENV['@sentry/ember'] = {
38+
sentry: {
39+
dsn: '___PUBLIC_DSN___',
40+
41+
// Set tracesSampleRate to 1.0 to capture 100%
42+
// of transactions for performance monitoring.
43+
// We recommend adjusting this value in production, or using tracesSampler
44+
// for finer control
45+
tracesSampleRate: 1.0,
46+
}
47+
};
6248
```
6349

64-
<!-- TODO-ADD-VERIFICATION-EXAMPLE -->
50+
The above configuration captures both error and performance data. To reduce the volume of performance data captured, change `tracesSampleRate` to a value between 0 and 1.

0 commit comments

Comments
 (0)