Skip to content

Commit a2fdf8b

Browse files
committed
update astro setup
1 parent 7432e6c commit a2fdf8b

File tree

5 files changed

+180
-263
lines changed

5 files changed

+180
-263
lines changed

docs/platforms/javascript/guides/astro/manual-setup.mdx

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

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

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
Get started by adding your DSN to your Astro config file (`astro.config.mjs`):
1+
Configuration should happen as early as possible in your application's lifecycle.
2+
3+
To set up the Sentry SDK, register the Sentry integration and initialize the SDK for client and server in the root directory of your project:
4+
5+
- Client-Side: `sentry.client.config.ts` containing a `Sentry.init` call
6+
- Server-Side: `sentry.server.config.ts` containing a `Sentry.init` call
7+
8+
### Astro Integration Setup
29

310

411
```javascript {filename:astro.config.mjs}
@@ -8,7 +15,6 @@ import sentry from "@sentry/astro";
815
export default defineConfig({
916
integrations: [
1017
sentry({
11-
dsn: "___PUBLIC_DSN___",
1218
sourceMapsUploadOptions: {
1319
project: "___PROJECT_SLUG___",
1420
authToken: process.env.SENTRY_AUTH_TOKEN,
@@ -18,4 +24,57 @@ export default defineConfig({
1824
});
1925
```
2026

21-
Once you've added your `dsn`, the SDK will automatically capture and send errors and performance events to Sentry.
27+
<Alert level="warning">
28+
Passing runtime-specific configuration options other than `release`, and `environment` to the Sentry integration will be deprecated in future versions.
29+
We recommend passing your configuration directly to the respective `Sentry.init()` calls in `sentry.client.config.js` and `sentry.server.config.js` instead.
30+
</Alert>
31+
32+
### Client-side Setup
33+
34+
```javascript {filename:sentry.client.config.js} {"onboardingOptions": {"performance": "7,11-13", "session-replay": "8,14-21"}}
35+
import * as Sentry from "@sentry/astro";
36+
37+
Sentry.init({
38+
dsn: "___PUBLIC_DSN___",
39+
40+
integrations: [
41+
Sentry.browserTracingIntegration(),
42+
Sentry.replayIntegration(),
43+
],
44+
45+
// Define how likely traces are sampled. Adjust this value in production,
46+
// or use tracesSampler for greater control.
47+
tracesSampleRate: 1.0,
48+
49+
// This sets the sample rate to be 10%. You may want this to be 100% while
50+
// in development and sample at a lower rate in production
51+
replaysSessionSampleRate: 0.1,
52+
53+
// If the entire session is not sampled, use the below sample rate to sample
54+
// sessions when an error occurs.
55+
replaysOnErrorSampleRate: 1.0,
56+
});
57+
```
58+
59+
### Server-side Setup
60+
61+
```javascript {filename:sentry.server.config.js} {"onboardingOptions": {"performance": "10-13", "profiling": "2,6-9,14-17"}}
62+
import * as Sentry from "@sentry/astro";
63+
import { nodeProfilingIntegration } from '@sentry/profiling-node';
64+
65+
Sentry.init({
66+
dsn: "___PUBLIC_DSN___",
67+
integrations: [
68+
// Add our Profiling integration
69+
nodeProfilingIntegration(),
70+
],
71+
72+
// Define how likely traces are sampled. Adjust this value in production,
73+
// or use tracesSampler for greater control.
74+
tracesSampleRate: 1.0,
75+
76+
// Set sampling rate for profiling
77+
// This is relative to tracesSampleRate
78+
profilesSampleRate: 1.0
79+
});
80+
```

platform-includes/getting-started-install/javascript.astro.mdx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
Install the SDK by using the `astro` CLI:
1+
<OnboardingOptionButtons
2+
options={["error-monitoring", "performance", "profiling", "session-replay"]}
3+
/>
4+
5+
<OnboardingOption optionId="profiling" hideForThisOption>
6+
7+
```bash {tabTitle:npm}
8+
npm install @sentry/astro --save
9+
```
10+
11+
```bash {tabTitle:yarn}
12+
yarn add @sentry/astro
13+
```
14+
15+
```bash {tabTitle:pnpm}
16+
pnpm add @sentry/astro
17+
```
18+
19+
</OnboardingOption>
20+
21+
<OnboardingOption optionId="profiling">
222

323
```bash {tabTitle:npm}
4-
npx astro add @sentry/astro
24+
npm install @sentry/astro @sentry/profiling-node --save
525
```
626

727
```bash {tabTitle:yarn}
8-
yarn astro add @sentry/astro
28+
yarn add @sentry/astro @sentry/profiling-node
929
```
1030

1131
```bash {tabTitle:pnpm}
12-
pnpm astro add @sentry/astro
32+
pnpm add @sentry/astro @sentry/profiling-node
1333
```
1434

15-
The `astro` CLI installs the SDK package and adds the Sentry integration to your `astro.config.mjs` file.
35+
</OnboardingOption>
1636

17-
To finish the setup, configure the Sentry integration.

0 commit comments

Comments
 (0)