You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sveltekit): Update docs for SDK setup with SvelteKit builtin Observability (#14770)
## DESCRIBE YOUR PR
This PR updates our SvelteKit docs to instruct users to set up the SDK
so that it takes advantage of Sveltekit's new builtin [observability
feature](https://svelte.dev/docs/kit/observability).
Specific updates:
- Getting Started page now recommends Kit@^2.31.0
- Getting Started page includes Expandable with information for anyone
on an older Kit version (we of course still support older versions but
we still recommend upgrading)
- Added versioned Manual Setup page containing the old, hooks-based
setup. This has the version range `9.x-10.7.0` because support for Kit
observability was introduced in SDK version `10.8.0`
- Adjusted `latest` Manual Setup page to show instructions for Kit-o11y
setup and requiring Kit@^2.31.0 (again with note and link to versioned
page for anyone on older kit versions)
- Adjusted a bunch of highlight line segments which were outdated (how
does this keep happening 😭)
closes#14761
## IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [x] Urgent deadline (GA date, etc.): Ideally today lol (monday/tuesday
next week also fine)
- [ ] Other deadline: Some time week ending Sept 5th
- [ ] None: Not urgent, can wait up to 1 week+
## SLA
- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!
## PRE-MERGE CHECKLIST
*Make sure you've checked the following before merging your changes:*
- [x] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)
- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
17
+
- Your application up and running
18
+
- SvelteKit version `2.31.0` or newer (see Note below)
19
+
- Vite version `4.2` or newer
20
+
21
+
<Expandabletitle="I'm on an older SvelteKit version than 2.31.0">
22
+
23
+
Version `2.31.0` of SvelteKit, introduces [official support for observability and tracing](https://svelte.dev/docs/kit/observability). This means that Sentry can now follow the official best practise for how the SDK should be set up.
24
+
For you this means:
25
+
- The Sentry SDK will be initialized at the correct, earliest possible time on the server, allowing for all its auto instrumentation to work correctly.
26
+
- The Sentry SDK picks up spans emitted from SvelteKit directly. You'll get more accurate insights into the performance of your handlers, server actions, `load` and remote functions.
27
+
28
+
SvelteKit observability is still an experimental feature in SvelteKit 2.x but we recommend giving it a try.
29
+
The Sentry wizard, as well as this guide, will use it as the default way of setting up the SDK.
30
+
31
+
If you've already set up the SDK and don't want to migrate to the new setup, or don't want to upgrade to SvelteKit `2.31.0` or higher, that's fine too. Just follow [this guide](../manual-setup__v10.7.0) instead.
32
+
33
+
</Expandable>
34
+
35
+
36
+
<Expandabletitle="Notes on SvelteKit adapter compatibility">
37
+
The SvelteKit Sentry SDK is designed to work out of the box with several SvelteKit adapters and their underlying server runtimes.
38
+
Here's an overview of the current support:
39
+
40
+
-**Fully supported Node.js runtimes**
41
+
-[Adapter-auto](https://kit.svelte.dev/docs/adapter-auto) for Vercel; other Node.js-based platforms might work, but we don't guarantee compatibility at this time
42
+
-[Adapter-vercel](https://kit.svelte.dev/docs/adapter-vercel) when used with Vercel's Node.js Lambda runtime
- Non-Node.js server runtimes, such as Vercel's edge runtime, are not yet supported.
48
+
-**Other adapters**
49
+
- Other SvelteKit adapters might work, but they're not currently officially supported. We're looking into extending first-class support to more adapters in the future.
50
+
51
+
</Expandable>
13
52
14
53
## Step 1: Install
15
54
@@ -53,7 +92,7 @@ You need to initialize and configure the Sentry SDK in three places: the client
53
92
54
93
Create a client hooks file `src/hooks.client.(js|ts)` in the `src` folder of your project if you don't have one already. In this file, import and initialize the Sentry SDK and add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError).
Create a server hooks file `src/hooks.server.(js|ts)` in the `src` folder of your project if you don't have one already. In this file, import and initialize the Sentry SDK and add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) and the Sentry request handler to the [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle).
152
+
_Requires SvelteKit `2.31.0` or higher and `@sentry/sveltekit``10.8.0` or higher._ If you're using older versions, check out [this guide](../manual-setup__v10.7.0#configure-server-side-sentry) instead.
Create a server hooks file `src/hooks.server.(js|ts)` in the `src` folder of your project if you don't have one already. In this file, add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) and the Sentry request handler to the [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle).
0 commit comments