Skip to content

Commit

Permalink
docs(astro): Update getting started page (#11953)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Nov 28, 2024
1 parent 8f2fb15 commit 09bdfb3
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 258 deletions.
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

```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

```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
});
```
23 changes: 22 additions & 1 deletion platform-includes/getting-started-install/javascript.astro.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<OnboardingOptionButtons
options={["error-monitoring", "performance", "profiling", "session-replay"]}
/>

Install the SDK by using the `astro` CLI:

```bash {tabTitle:npm}
Expand All @@ -14,4 +18,21 @@ pnpm astro add @sentry/astro

The `astro` CLI installs the SDK package and adds the Sentry integration to your `astro.config.mjs` file.

To finish the setup, configure the Sentry integration.

<OnboardingOption optionId="profiling">

```bash {tabTitle:npm}
npm install @sentry/profiling-node
```

```bash {tabTitle:yarn}
yarn add @sentry/profiling-node
```

```bash {tabTitle:pnpm}
pnpm add @sentry/profiling-node
```

</OnboardingOption>

To finish the setup, configure the Sentry integration.
Loading

0 comments on commit 09bdfb3

Please sign in to comment.