-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(astro): Update getting started page #11953
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
Changes from 2 commits
a2fdf8b
7d59d37
4df6ea2
7f1a1d2
6d96162
71565dc
f02cdec
0038e56
6ad298d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,11 @@ | ||||||
| Get started by adding your DSN to your Astro config file (`astro.config.mjs`): | ||||||
| Configuration should happen as early as possible in your application's lifecycle. | ||||||
|
|
||||||
| 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: | ||||||
|
|
||||||
| - Client-Side: `sentry.client.config.ts` containing a `Sentry.init` call | ||||||
| - Server-Side: `sentry.server.config.ts` containing a `Sentry.init` call | ||||||
chargome marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ### Astro Integration Setup | ||||||
|
|
||||||
|
|
||||||
| ```javascript {filename:astro.config.mjs} | ||||||
|
|
@@ -8,7 +15,6 @@ import sentry from "@sentry/astro"; | |||||
| export default defineConfig({ | ||||||
| integrations: [ | ||||||
| sentry({ | ||||||
| dsn: "___PUBLIC_DSN___", | ||||||
| sourceMapsUploadOptions: { | ||||||
| project: "___PROJECT_SLUG___", | ||||||
| authToken: process.env.SENTRY_AUTH_TOKEN, | ||||||
|
|
@@ -18,4 +24,57 @@ export default defineConfig({ | |||||
| }); | ||||||
| ``` | ||||||
|
|
||||||
| Once you've added your `dsn`, the SDK will automatically capture and send errors and performance events to Sentry. | ||||||
| <Alert level="warning"> | ||||||
| Passing runtime-specific configuration options to the Sentry integration will be deprecated in future versions. | ||||||
| We recommend passing your configuration directly to the respective `Sentry.init()` calls in `sentry.client.config.js` and `sentry.server.config.js` instead. | ||||||
chargome marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| </Alert> | ||||||
|
|
||||||
| ### Client-side Setup | ||||||
chargome marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ```javascript {filename:sentry.client.config.js} {"onboardingOptions": {"performance": "7,11-13", "session-replay": "8,14-21"}} | ||||||
| import * as Sentry from "@sentry/astro"; | ||||||
|
|
||||||
| Sentry.init({ | ||||||
| dsn: "___PUBLIC_DSN___", | ||||||
|
|
||||||
| integrations: [ | ||||||
| Sentry.browserTracingIntegration(), | ||||||
| Sentry.replayIntegration(), | ||||||
| ], | ||||||
|
|
||||||
| // Define how likely traces are sampled. Adjust this value in production, | ||||||
| // or use tracesSampler for greater control. | ||||||
| tracesSampleRate: 1.0, | ||||||
|
|
||||||
| // 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, | ||||||
| }); | ||||||
| ``` | ||||||
|
|
||||||
| ### Server-side Setup | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```javascript {filename:sentry.server.config.js} {"onboardingOptions": {"performance": "10-13", "profiling": "2,6-9,14-17"}} | ||||||
| import * as Sentry from "@sentry/astro"; | ||||||
| import { nodeProfilingIntegration } from '@sentry/profiling-node'; | ||||||
|
|
||||||
| Sentry.init({ | ||||||
| dsn: "___PUBLIC_DSN___", | ||||||
| integrations: [ | ||||||
| // Add our Profiling integration | ||||||
| nodeProfilingIntegration(), | ||||||
| ], | ||||||
|
|
||||||
| // Define how likely traces are sampled. Adjust this value in production, | ||||||
| // or use tracesSampler for greater control. | ||||||
| tracesSampleRate: 1.0, | ||||||
|
|
||||||
| // Set sampling rate for profiling | ||||||
| // This is relative to tracesSampleRate | ||||||
| profilesSampleRate: 1.0 | ||||||
| }); | ||||||
| ``` | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m/h: What is our rationale behind moving away from Users are probably familiar with adding Astro integrations and we're also listed in their official integrations directory: https://astro.build/integrations/?search=sentry There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, I'll update that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the only thing that bugged me here is that we have another code snippet for adding profiling |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,36 @@ | ||
| Install the SDK by using the `astro` CLI: | ||
| <OnboardingOptionButtons | ||
| options={["error-monitoring", "performance", "profiling", "session-replay"]} | ||
| /> | ||
|
|
||
| <OnboardingOption optionId="profiling" hideForThisOption> | ||
|
|
||
| ```bash {tabTitle:npm} | ||
| npm install @sentry/astro --save | ||
| ``` | ||
|
|
||
| ```bash {tabTitle:yarn} | ||
| yarn add @sentry/astro | ||
| ``` | ||
|
|
||
| ```bash {tabTitle:pnpm} | ||
| pnpm add @sentry/astro | ||
| ``` | ||
|
|
||
| </OnboardingOption> | ||
|
|
||
| <OnboardingOption optionId="profiling"> | ||
|
|
||
| ```bash {tabTitle:npm} | ||
| npx astro add @sentry/astro | ||
| npm install @sentry/astro @sentry/profiling-node --save | ||
| ``` | ||
|
|
||
| ```bash {tabTitle:yarn} | ||
| yarn astro add @sentry/astro | ||
| yarn add @sentry/astro @sentry/profiling-node | ||
| ``` | ||
|
|
||
| ```bash {tabTitle:pnpm} | ||
| pnpm astro add @sentry/astro | ||
| pnpm add @sentry/astro @sentry/profiling-node | ||
| ``` | ||
|
|
||
| The `astro` CLI installs the SDK package and adds the Sentry integration to your `astro.config.mjs` file. | ||
| </OnboardingOption> | ||
|
|
||
| To finish the setup, configure the Sentry integration. |
Uh oh!
There was an error while loading. Please reload this page.