Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replay: onboarding specific per sdk #7883

Merged
merged 6 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```bash {tabTitle:npm}
# Angular 12 and newer:
npm install --save @sentry/angular-ivy
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved

# Angular 10 and 11:
npm install --save @sentry/angular
```

```bash {tabTitle:Yarn}
# Angular 12 and newer:
yarn add @sentry/angular-ivy

# Angular 10 and 11:
yarn add @sentry/angular
```

### Angular Version Compatibility

Because of the way Angular libraries are compiled, you need to use a specific version of the Sentry SDK for each corresponding version of Angular as shown below:

| Angular version | Recommended Sentry SDK |
| --------------- | ---------------------- |
| 12 and newer | `@sentry/angular-ivy` |
| 10, 11 | `@sentry/angular` |
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
```bash {tabTitle: Yarn}
yarn add @sentry/capacitor @sentry/replay
Install the Sentry Capacitor SDK alongside the corresponding Sentry SDK for the framework you're using, such as Angular in this example:

```bash {tabTitle:Angular}
# npm
npm install --save @sentry/capacitor @sentry/angular-ivy @sentry/replay

# yarn
yarn add @sentry/capacitor @sentry/angular-ivy @sentry/replay
```

Comment on lines +3 to 9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the user need to install @sentry/replay if they're already doing @sentry/angular-ivy or @sentry/vue or whatever the framework is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```html {tabTitle: npm}
```bash {tabTitle:Other Frameworks}
# npm
npm install --save @sentry/capacitor @sentry/replay

# yarn
yarn add @sentry/capacitor @sentry/replay
```
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
The Replay integration is **already included** with the Electron SDK package.

```bash {tabTitle: npm}
npm install --save @sentry/electron
```

```bash {tabTitle: Yarn}
yarn add @sentry/electron
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash {tabTitle:ember-cli}
ember install @sentry/ember
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Replay integration is **already included** with the Gatsby SDK package.

```bash {tabTitle: npm}
npm install --save @sentry/gatsby
```

```bash {tabTitle: Yarn}
yarn add @sentry/gatsby
```
2 changes: 0 additions & 2 deletions src/platform-includes/session-replay/install/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
The Replay integration is **already included** in your browser or framework SDK NPM packages. If you're using CDN bundles instead of NPM packages, you need to load the Replay integration CDN bundle in addition to your browser bundle:

```bash {tabTitle: npm}
# Make sure to have @sentry/browser or a Framework SDK (e.g. @sentry/react) installed
npm install --save @sentry/browser
```

```bash {tabTitle: Yarn}
# Make sure to have @sentry/browser or a Framework SDK (e.g. @sentry/react) installed
yarn add @sentry/browser
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Replay integration is already included with the Sentry SDK. We recommend installing the SDK through our installation wizard:

```bash
npx @sentry/wizard@latest -i nextjs
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Replay integration is **already included** with the React SDK package.

```bash {tabTitle:npm}
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
npm install --save @sentry/react
```

```bash {tabTitle:Yarn}
yarn add @sentry/react
```
23 changes: 23 additions & 0 deletions src/platform-includes/session-replay/install/javascript.remix.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The Replay integration is already included with the Sentry SDK. We recommend installing the SDK through our installation wizard:

```bash
npx @sentry/wizard@latest -i remix
```

The wizard will prompt you to log in to Sentry. It will then automatically do the following steps for you:

- create two files in the root directory of your project, `entry.client.tsx` and `entry.server.tsx` (if they don't already exist).
- add the default `Sentry.init()` for the client in `entry.client.tsx` and the server in `entry.server.tsx`.
- create `.sentryclirc` with an auth token to upload source maps (this file is automatically added to `.gitignore`).
- adjust your `build` script in `package.json` to automatically upload source maps to Sentry when you build your application.

If you use [Remix future flags](https://remix.run/docs/en/main/pages/api-development-strategy#current-future-flags), the wizard will instrument your application accordingly to support Remix v2 features.

After the wizard setup is completed, the SDK will automatically capture unhandled errors, and monitor performance.
You can also <PlatformLink to="/usage/">manually capture errors</PlatformLink>.

<Note>

If the wizard setup isn't working for you, you can <PlatformLink to="/manual-setup/">set up the SDK manually</PlatformLink>.

</Note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Replay integration is **already included** with the Svelte SDK package.

```bash {tabTitle:npm}
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
npm install --save @sentry/svelte
```

```bash {tabTitle:Yarn}
yarn add @sentry/svelte
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The Replay integration is already included with the Sentry SDK. We recommend installing the SDK by running our installation wizard in the root directory of your project:

```bash
npx @sentry/wizard@latest -i sveltekit
```

The wizard will prompt you to log in to Sentry. It will then automatically do the following steps for you:

- create or update SvelteKit files with the default Sentry configuration:
- `hooks.(client|server).js` to initialize the SDK and instrument [SvelteKit's hooks](https://kit.svelte.dev/docs/hooks)
- `vite.config.js` to add source maps upload and auto-instrumentation via Vite plugins.
- create a `.sentryclirc` file with an auth token to upload source maps (this file is automatically added to `.gitignore`)
- add an example page to your app to verify your Sentry setup

After the wizard setup is completed, the SDK will automatically capture unhandled errors, and monitor performance.
You can also <PlatformLink to="/usage/">manually capture errors</PlatformLink>.

<Note>

If the setup through the wizard doesn't work for you, you can also <PlatformLink to="/manual-setup/">set up the SDK manually</PlatformLink>.

</Note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Replay integration is **already included** with the Vue SDK package.

```bash {tabTitle:npm}
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
npm install --save @sentry/vue
```

```bash {tabTitle:Yarn}
yarn add @sentry/vue
```
45 changes: 45 additions & 0 deletions src/platform-includes/session-replay/setup/javascript.angular.mdx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is copy+pasted a few times (9 times). I didn't notice any errors with that, but idk if we can or should de-dupe it to make maintenance easier.

note that nextjs and remix and sveltekit have little headers at the top of the files which are nice to keep: "On your client-side NextJS app, add:"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm yeah there is some duplication. We could pull both code snippets out into their own components, but I'm not sure it's worth the extra complexity here.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```javascript
import * as Sentry from "@sentry/angular-ivy";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just copied from existing docs, but this comment is confusing. This makes it sound like if you're setting replaysSessionSampleRate to 1.0 you can downsample errors with replaysSessionSampleRate, which is the opposite of the usual use case, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry i don't see how this phrase makes it sound like it's 1.0 (also the actual value is right above it so unlikely confusing)?

That said: happy to change these comments to something that makes more sense. Due to all the copy paste we'd need a find/replace. Best as a follow up PR

replaysOnErrorSampleRate: 1.0,

integrations: [
new Sentry.Replay({
// Additional SDK configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
```

With the settings above, session replays with errors are always captured.
You can verify that with the following:

```javascript
myUndefinedFunction();
```

### Lazy-loading Replay

Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`:

```js
Sentry.init({
// Note, Replay is NOT instantiated below:
integrations: [],
});

// Sometime later
const { getCurrentHub, Replay } = await import("@sentry/angular-ivy");
getCurrentHub().getClient().addIntegration(new Replay());
```
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
To set up the integration, add the following to your Sentry initialization in
Electron renderers. Several options are supported and passable using the integration
constructor. See the [configuration
documentation](/platforms/javascript/session-replay/configuration/) for more
details.

<SignInNote />

```javascript
import * as Sentry from "@sentry/electron/renderer";

Expand Down
45 changes: 45 additions & 0 deletions src/platform-includes/session-replay/setup/javascript.ember.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```javascript
import * as Sentry from "@sentry/ember";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

integrations: [
new Sentry.Replay({
// Additional SDK configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
```

With the settings above, session replays with errors are always captured.
You can verify that with the following:

```javascript
myUndefinedFunction();
```

### Lazy-loading Replay

Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`:

```js
Sentry.init({
// Note, Replay is NOT instantiated below:
integrations: [],
});

// Sometime later
const { getCurrentHub, Replay } = await import("@sentry/ember");
getCurrentHub().getClient().addIntegration(new Replay());
```
45 changes: 45 additions & 0 deletions src/platform-includes/session-replay/setup/javascript.gatsby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```javascript
import * as Sentry from "@sentry/gatsby";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

integrations: [
new Sentry.Replay({
// Additional SDK configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
```

With the settings above, session replays with errors are always captured.
You can verify that with the following:

```javascript
myUndefinedFunction();
```

### Lazy-loading Replay

Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`:

```js
Sentry.init({
// Note, Replay is NOT instantiated below:
integrations: [],
});

// Sometime later
const { getCurrentHub, Replay } = await import("@sentry/gatsby");
getCurrentHub().getClient().addIntegration(new Replay());
```
4 changes: 0 additions & 4 deletions src/platform-includes/session-replay/setup/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
To set up the integration, add the following to your Sentry initialization. Several options are supported and passable using the integration constructor. See the [configuration documentation](/platforms/javascript/session-replay/configuration/) for more details.

<SignInNote />

```javascript
// import Sentry from your framework SDK (e.g. @sentry/react) instead of @sentry/browser
import * as Sentry from "@sentry/browser";
Expand Down
47 changes: 47 additions & 0 deletions src/platform-includes/session-replay/setup/javascript.nextjs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
On your client-side NextJS app, add:

```javascript
import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

integrations: [
new Sentry.Replay({
// Additional SDK configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
```

With the settings above, session replays with errors are always captured.
You can verify that with the following:

```javascript
myUndefinedFunction();
```

### Lazy-loading Replay

Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`:

```js
Sentry.init({
// Note, Replay is NOT instantiated below:
integrations: [],
});

// Sometime later
const { getCurrentHub, Replay } = await import("@sentry/nextjs");
getCurrentHub().getClient().addIntegration(new Replay());
```
Loading
Loading