Skip to content

Commit 2fc39db

Browse files
authored
feat(js): Add new onboarding for all JavaScript guides (#10241)
1 parent 9205185 commit 2fc39db

27 files changed

+395
-191
lines changed

docs/platforms/javascript/common/index.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,30 @@ If you prefer to follow video instructions, see [How to Install the Sentry Next.
4141

4242
</PlatformSection>
4343

44-
4544
<PlatformSection notSupported={["javascript.deno"]}>
4645

4746
## Install
4847

48+
<PlatformCategorySection notSupported={["server"]}>
49+
<PlatformSection notSupported={["javascript", 'javascript.cordova']}>
50+
<OnboardingOptionButtons
51+
options={["error-monitoring", "performance", "session-replay"]}
52+
/>
53+
</PlatformSection>
54+
</PlatformCategorySection>
55+
56+
<PlatformCategorySection notSupported={["browser"]}>
57+
<PlatformSection notSupported={["javascript.bun"]}>
58+
<OnboardingOptionButtons
59+
options={["error-monitoring", "performance", "profiling"]}
60+
/>
61+
</PlatformSection>
62+
63+
<PlatformSection supported={["javascript.bun"]}>
64+
<OnboardingOptionButtons options={["error-monitoring", "performance"]} />
65+
</PlatformSection>
66+
</PlatformCategorySection>
67+
4968
Sentry captures data by using an SDK within your application’s runtime.
5069

5170
<PlatformContent includePath="getting-started-install" />

docs/platforms/javascript/common/performance/index.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@ If you’re adopting Performance in a high-throughput environment, we recommend
1717

1818
</PlatformCategorySection>
1919

20+
<PlatformContent supported={['javascript']}>
2021
## Enable Tracing
2122

2223
<PlatformContent includePath="performance/enable-tracing" />
2324

25+
</PlatformContent>
26+
2427
## Configure
2528

29+
<PlatformSection supported={['javascript']}>
2630
First, enable tracing and configure the sampling rate for transactions. Set the sample rate for your transactions by either:
31+
</PlatformSection>
32+
33+
<PlatformSection notSupported={['javascript']}>
34+
First, configure the sampling rate for transactions. Set the sample rate for your transactions by either:
35+
</PlatformSection>
2736

2837
- Setting a uniform sample rate for all transactions using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set <PlatformIdentifier name="traces-sample-rate" /> to `0.2`.)
2938
- Controlling the sample rate based on the transaction itself and the context in which it's captured, by providing a function to the <PlatformIdentifier name="traces-sampler" /> config option.

docs/platforms/javascript/guides/aws-lambda/index.mdx

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,25 @@ Before you begin, note:
1919
- You need to have experience with AWS console and a basic understanding of Lambda.
2020
- You'll need an AWS account and you have to create an [IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html).
2121

22-
<Note>
23-
This guide is for version 8.0.0 and up of `@sentry/aws-serverless`.
24-
</Note>
22+
<Note>This guide is for version 8.0.0 and up of `@sentry/aws-serverless`.</Note>
2523

26-
Create a deployment package on your local machine and install the required dependencies in the deployment package. For more information, see [Building an AWS Lambda deployment package for Node.js](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-deployment-package-nodejs/).
24+
## Install
2725

28-
Add `@sentry/aws-serverless` as a dependency:
26+
<OnboardingOptionButtons
27+
options={["error-monitoring", "performance", "profiling"]}
28+
/>
2929

30-
```bash {tabTitle:npm}
31-
npm install --save @sentry/aws-serverless
32-
```
30+
Create a deployment package on your local machine and install the required dependencies in the deployment package. For more information, see [Building an AWS Lambda deployment package for Node.js](https://aws.amazon.com/premiumsupport/knowledge-center/lambda-deployment-package-nodejs/).
3331

34-
```bash {tabTitle:Yarn}
35-
yarn add @sentry/aws-serverless
36-
```
32+
<PlatformContent includePath="getting-started-install" />
3733

3834
We also support [installing Sentry as a Container Image](/platforms/javascript/guides/aws-lambda/container-image/) and [installing Sentry in Lambda Layer](/platforms/javascript/guides/aws-lambda/layer/).
3935

40-
You can use the AWS Lambda integration for the Node like this:
41-
42-
<SignInNote />
43-
44-
```javascript {tabTitle:async}
45-
const Sentry = require("@sentry/aws-serverless");
46-
47-
Sentry.init({
48-
dsn: "___PUBLIC_DSN___",
49-
50-
// Add Performance Monitoring by setting tracesSampleRate and adding integration
51-
// Set tracesSampleRate to 1.0 to capture 100% of transactions
52-
// We recommend adjusting this value in production
53-
tracesSampleRate: 1.0,
54-
});
55-
56-
exports.handler = Sentry.wrapHandler(async (event, context) => {
57-
// Your handler code
58-
});
59-
```
60-
61-
```javascript {tabTitle:sync}
62-
const Sentry = require("@sentry/aws-serverless");
63-
64-
Sentry.init({
65-
dsn: "___PUBLIC_DSN___",
36+
## Configure
6637

67-
// We recommend adjusting this value in production, or using tracesSampler
68-
// for finer control
69-
tracesSampleRate: 1.0,
70-
});
71-
72-
exports.handler = Sentry.wrapHandler((event, context, callback) => {
73-
// Your handler code
74-
});
75-
```
38+
You can use the AWS Lambda integration for the Node like this:
7639

77-
{/* <!-- TODO-ADD-VERIFICATION-EXAMPLE --> */}
40+
<PlatformContent includePath="getting-started-config" />
7841

7942
## Enable Timeout Warning
8043

docs/platforms/javascript/guides/azure-functions/index.mdx

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,21 @@ categories:
77
- serverless
88
---
99

10-
Add `@sentry/node` as a dependency:
10+
## Install
1111

12-
```bash {tabTitle:npm}
13-
npm install --save @sentry/node
14-
```
12+
<OnboardingOptionButtons
13+
options={["error-monitoring", "performance", "profiling"]}
14+
/>
1515

16-
```bash {tabTitle:Yarn}
17-
yarn add @sentry/node
18-
```
16+
Sentry captures data by using an SDK within your application’s runtime. This means that you have to add `@sentry/node` as a runtime dependency to your application:
17+
18+
<PlatformContent includePath="getting-started-install" />
19+
20+
## Configure
1921

2022
To set up Sentry error logging for an Azure Function:
2123

22-
<SignInNote />
23-
24-
```javascript
25-
"use strict";
26-
27-
const Sentry = require("@sentry/node");
28-
29-
Sentry.init({
30-
dsn: "___PUBLIC_DSN___",
31-
});
32-
33-
module.exports = async function (context, req) {
34-
try {
35-
await notExistFunction();
36-
} catch (e) {
37-
Sentry.withScope((scope) => {
38-
scope.setSDKProcessingMetadata({ request: req });
39-
Sentry.captureException(e);
40-
});
41-
await Sentry.flush(2000);
42-
}
43-
44-
context.res = {
45-
status: 200,
46-
body: "Hello from Azure Cloud Function!",
47-
};
48-
};
49-
```
24+
<PlatformContent includePath="getting-started-config" />
5025

5126
You can obtain the DSN using your Sentry account from your organization's _Settings > Projects > Client Keys (DSN)_ in the Sentry web UI.
5227

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
title: Bun
22
sdk: sentry.javascript.bun
33
categories:
4-
- browser
54
- server

docs/platforms/javascript/guides/electron/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ categories:
1010

1111
## Install
1212

13+
<OnboardingOptionButtons
14+
options={["error-monitoring", "performance", "session-replay"]}
15+
/>
16+
1317
<PlatformContent includePath="getting-started-install" />
1418

1519
## Configure

docs/platforms/javascript/guides/gatsby/index.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ categories:
88

99
## Install
1010

11+
<OnboardingOptionButtons
12+
options={["error-monitoring", "performance", "session-replay"]}
13+
/>
14+
1115
To use Sentry with your Gatsby application, you will need to use `@sentry/gatsby` (Sentry’s Gatsby SDK):
1216

1317
```bash {tabTitle:npm}
@@ -42,12 +46,15 @@ Then, configure your `Sentry.init`:
4246

4347
<SignInNote />
4448

45-
```javascript {filename:sentry.config.(js|ts)}
49+
```javascript {filename:sentry.config.(js|ts)} {"onboardingOptions": {"performance": "6, 9-13", "session-replay": "7, 14-18"}}
4650
import * as Sentry from "@sentry/gatsby";
4751

4852
Sentry.init({
4953
dsn: "___PUBLIC_DSN___",
50-
integrations: [Sentry.replayIntegration()],
54+
integrations: [
55+
Sentry.browserTracingIntegration(),
56+
Sentry.replayIntegration(),
57+
],
5158

5259
// Set tracesSampleRate to 1.0 to capture 100%
5360
// of transactions for performance monitoring.

docs/platforms/javascript/guides/gcp-functions/index.mdx

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,21 @@ categories:
1111
This guide is for version 8.0.0 and up of `@sentry/google-cloud-serverless`.
1212
</Note>
1313

14-
Add `@sentry/google-cloud-serverless` as a dependency to `package.json`:
15-
16-
```bash
17-
"@sentry/google-cloud-serverless": "^{{@inject packages.version('sentry.javascript.node') }}"
18-
```
19-
20-
To set up Sentry for a Google Cloud Function:
21-
22-
<SignInNote />
23-
24-
```javascript {tabTitle:Http functions}
25-
const Sentry = require("@sentry/google-cloud-serverless");
14+
## Install
2615

27-
Sentry.init({
28-
dsn: "___PUBLIC_DSN___",
16+
<OnboardingOptionButtons
17+
options={["error-monitoring", "performance", "profiling"]}
18+
/>
2919

30-
// Add Performance Monitoring by setting tracesSampleRate and adding integration
31-
// Set tracesSampleRate to 1.0 to capture 100% of transactions
32-
// We recommend adjusting this value in production
33-
tracesSampleRate: 1.0,
34-
});
35-
36-
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
37-
throw new Error("oh, hello there!");
38-
});
39-
```
40-
41-
```javascript {tabTitle:Background functions}
42-
const Sentry = require("@sentry/google-cloud-serverless");
43-
44-
Sentry.init({
45-
dsn: "___PUBLIC_DSN___",
46-
tracesSampleRate: 1.0,
47-
});
20+
Add `@sentry/google-cloud-serverless` as a dependency to `package.json`:
4821

49-
exports.helloEvents = Sentry.wrapEventFunction(
50-
(data, context, callback) => {
51-
throw new Error("oh, hello there!");
52-
}
53-
);
54-
```
22+
<PlatformContent includePath="getting-started-install" />
5523

56-
```javascript {tabTitle:CloudEvent functions}
57-
const Sentry = require("@sentry/google-cloud-serverless");
24+
## Configure
5825

59-
Sentry.init({
60-
dsn: "___PUBLIC_DSN___",
61-
tracesSampleRate: 1.0,
62-
});
26+
To set up Sentry for a Google Cloud Function:
6327

64-
exports.helloEvents = Sentry.wrapCloudEventFunction(
65-
(context, callback) => {
66-
throw new Error("oh, hello there!");
67-
}
68-
);
69-
```
28+
<PlatformContent includePath="getting-started-config" />
7029

7130
<Alert level="warning" title="Note">
7231

platform-includes/getting-started-config/javascript.angular.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Once this is done, Sentry's Angular SDK captures all unhandled exceptions and tr
22

33
<SignInNote />
44

5-
```typescript {filename: main.ts} {3, 6-30}
5+
```typescript {filename: main.ts} {3, 6-30} {"onboardingOptions": {"performance": "9-12, 17-24", "session-replay": "13-15, 25-29"}}
66
import { enableProdMode } from "@angular/core";
77
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
88
import * as Sentry from "@sentry/angular";
@@ -43,7 +43,7 @@ platformBrowserDynamic()
4343

4444
The Sentry Angular SDK exports a couple of Angular providers that are necessary to fully instrument your application. We recommend registering them in your main `AppModule`:
4545

46-
```typescript {filename: app.module.ts} {4, 9-22}
46+
```typescript {filename: app.module.ts} {4, 9-22} {"onboardingOptions": {"performance": "13-22"}}
4747
import { APP_INITIALIZER, ErrorHandler, NgModule } from "@angular/core";
4848
import { Router } from "@angular/router";
4949

@@ -74,6 +74,7 @@ export class AppModule {}
7474

7575
The `Sentry.createErrorHandler` function initializes a Sentry-specific `ErrorHandler` that automatically sends errors caught by Angular to Sentry. You can also customize the behavior by setting a couple of handler [options](https://github.com/getsentry/sentry-javascript/blob/master/packages/angular/src/errorhandler.ts).
7676

77+
<OnboardingOption optionId="performance">
7778
The `Sentry.TraceService` listens to the Angular router for performance monitoring and tracing. To inject `TraceService`, register the `APP_INITIALIZER` provider as shown above. Alternatively, you can also require the `TraceService` from inside your `AppModule` constructor:
7879

7980
```javascript {filename: app.module.ts} {5}
@@ -84,3 +85,4 @@ export class AppModule {
8485
constructor(trace: Sentry.TraceService) {}
8586
}
8687
```
88+
</OnboardingOption>

platform-includes/getting-started-config/javascript.aws-lambda.mdx

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)