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

docs(astro): Update getting started page #11953

Merged
merged 9 commits into from
Nov 28, 2024
254 changes: 0 additions & 254 deletions docs/platforms/javascript/guides/astro/manual-setup.mdx

This file was deleted.

60 changes: 57 additions & 3 deletions platform-includes/getting-started-config/javascript.astro.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Get started by adding your DSN to your Astro config file (`astro.config.mjs`):
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:

### Astro Integration Setup


```javascript {filename:astro.config.mjs}
Expand All @@ -8,7 +10,6 @@ import sentry from "@sentry/astro";
export default defineConfig({
integrations: [
sentry({
dsn: "___PUBLIC_DSN___",
sourceMapsUploadOptions: {
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
Expand All @@ -18,4 +19,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 (`dsn`, `release`, `environment`, `sampleRate`, `tracesSampleRate`, `replaysSessionSampleRate`, `replaysOnErrorSampleRate`) 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.
</Alert>

### Client-side Setup

chargome marked this conversation as resolved.
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

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### Server-side Setup
### Server-Side Setup

```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
});
```
31 changes: 25 additions & 6 deletions platform-includes/getting-started-install/javascript.astro.mdx
Copy link
Member

Choose a reason for hiding this comment

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

m/h: What is our rationale behind moving away from npx astro add @sentry/astro? Despite us instructing people to declare separate client|server config files, the astro CLI would still automatically register the intgration in astro.config.mjs for users.

Users are probably familiar with adding Astro integrations and we're also listed in their official integrations directory: https://astro.build/integrations/?search=sentry

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, I'll update that

Copy link
Member Author

Choose a reason for hiding this comment

The 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.
Loading
Loading