Skip to content

Commit 74692b4

Browse files
AbhiPrasadlucas-zimerman
authored andcommitted
feat(js): Switch to non experimental option for logs (#14460)
Builds on top of #14449, catches a bunch of stuff that I missed.
1 parent 13ee9e6 commit 74692b4

File tree

26 files changed

+216
-150
lines changed

26 files changed

+216
-150
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ You need:
2424
Choose the features you want to configure, and this guide will show you how:
2525

2626
<OnboardingOptionButtons
27-
options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]}
27+
options={[
28+
"error-monitoring",
29+
"performance",
30+
"session-replay",
31+
"user-feedback",
32+
"logs",
33+
]}
2834
/>
2935

3036
<PlatformContent includePath="getting-started-features-expandable" />
@@ -133,7 +139,7 @@ Sentry.init({
133139
// ___PRODUCT_OPTION_START___ logs
134140

135141
// Enable logs to be sent to Sentry
136-
_experiments: { enableLogs: true },
142+
enableLogs: true,
137143
// ___PRODUCT_OPTION_END___ logs
138144
});
139145

@@ -198,7 +204,7 @@ Sentry.init({
198204
// ___PRODUCT_OPTION_START___ logs
199205

200206
// Enable logs to be sent to Sentry
201-
_experiments: { enableLogs: true },
207+
enableLogs: true,
202208
// ___PRODUCT_OPTION_END___ logs
203209
});
204210

docs/platforms/javascript/guides/astro/index.mdx

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,25 @@ This page walks you through adding Sentry to your Astro project, configuring it,
1717

1818
Before we get started, make sure you have the following:
1919

20-
* You need a Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
21-
* An Astro project that uses Astro `3.0.0` or newer.
22-
* A Node runtime:
23-
* This SDK currently only works on Node runtimes (e.g. Node adapter, Vercel with Lambda functions).
24-
Non-Node runtimes, like Vercel's Edge runtime or Cloudflare Pages, are currently not supported.
25-
* If you're using Astro's Netflify adapter (`@astrojs/netlify`), you need version `5.0.0` or newer.
20+
- You need a Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
21+
- An Astro project that uses Astro `3.0.0` or newer.
22+
- A Node runtime:
23+
- This SDK currently only works on Node runtimes (e.g. Node adapter, Vercel with Lambda functions).
24+
Non-Node runtimes, like Vercel's Edge runtime or Cloudflare Pages, are currently not supported.
25+
- If you're using Astro's Netflify adapter (`@astrojs/netlify`), you need version `5.0.0` or newer.
2626

2727
## Install
2828

29-
<OnboardingOptionButtons options={["error-monitoring", "performance", "profiling", "session-replay", "user-feedback", "logs"]} />
29+
<OnboardingOptionButtons
30+
options={[
31+
"error-monitoring",
32+
"performance",
33+
"profiling",
34+
"session-replay",
35+
"user-feedback",
36+
"logs",
37+
]}
38+
/>
3039

3140
Sentry captures data by using an SDK within your application's runtime.
3241

@@ -70,7 +79,6 @@ To set up the Sentry SDK, register the Sentry integration and initialize the SDK
7079

7180
### Astro Integration Setup
7281

73-
7482
```javascript {filename:astro.config.mjs}
7583
import { defineConfig } from "astro/config";
7684
import sentry from "@sentry/astro";
@@ -89,8 +97,12 @@ export default defineConfig({
8997
```
9098

9199
<Alert level="warning">
92-
Passing runtime-specific configuration options (`dsn`, `release`, `environment`, `sampleRate`, `tracesSampleRate`, `replaysSessionSampleRate`, `replaysOnErrorSampleRate`) to the Sentry integration will be deprecated in future versions.
93-
We recommend passing your configuration directly to the respective `Sentry.init()` calls in `sentry.client.config.js` and `sentry.server.config.js` instead.
100+
Passing runtime-specific configuration options (`dsn`, `release`,
101+
`environment`, `sampleRate`, `tracesSampleRate`, `replaysSessionSampleRate`,
102+
`replaysOnErrorSampleRate`) to the Sentry integration will be deprecated in
103+
future versions. We recommend passing your configuration directly to the
104+
respective `Sentry.init()` calls in `sentry.client.config.js` and
105+
`sentry.server.config.js` instead.
94106
</Alert>
95107

96108
### Client-Side Setup
@@ -122,7 +134,7 @@ Sentry.init({
122134
// ___PRODUCT_OPTION_START___ logs
123135

124136
// Enable logs to be sent to Sentry
125-
_experiments: { enableLogs: true },
137+
enableLogs: true,
126138
// ___PRODUCT_OPTION_END___ logs
127139

128140
// ___PRODUCT_OPTION_START___ performance
@@ -148,7 +160,7 @@ Sentry.init({
148160
```javascript {filename:sentry.server.config.js}
149161
import * as Sentry from "@sentry/astro";
150162
// ___PRODUCT_OPTION_START___ profiling
151-
import { nodeProfilingIntegration } from '@sentry/profiling-node';
163+
import { nodeProfilingIntegration } from "@sentry/profiling-node";
152164
// ___PRODUCT_OPTION_END___ profiling
153165

154166
Sentry.init({
@@ -167,7 +179,7 @@ Sentry.init({
167179
// ___PRODUCT_OPTION_START___ logs
168180

169181
// Enable logs to be sent to Sentry
170-
_experiments: { enableLogs: true },
182+
enableLogs: true,
171183
// ___PRODUCT_OPTION_END___ logs
172184

173185
// ___PRODUCT_OPTION_START___ performance
@@ -179,7 +191,7 @@ Sentry.init({
179191

180192
// Set sampling rate for profiling
181193
// This is relative to tracesSampleRate
182-
profilesSampleRate: 1.0
194+
profilesSampleRate: 1.0,
183195
// ___PRODUCT_OPTION_END___ profiling
184196
});
185197
```
@@ -211,13 +223,13 @@ Trigger a test error somewhere in your Astro app, for example in one of your pag
211223
```
212224

213225
<Alert>
214-
Errors triggered from within Browser DevTools are sandboxed and won't trigger an error handler.
215-
Place the snippet directly in your code instead.
226+
Errors triggered from within Browser DevTools are sandboxed and won't trigger
227+
an error handler. Place the snippet directly in your code instead.
216228
</Alert>
217229

218230
<Alert>
219-
Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage
220-
documentation</PlatformLink>.
231+
Learn more about manually capturing an error or message in our{" "}
232+
<PlatformLink to="/usage/">Usage documentation</PlatformLink>.
221233
</Alert>
222234

223235
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
@@ -245,7 +257,7 @@ export default defineConfig({
245257

246258
<Alert>
247259

248-
Auto instrumentation only works for Astro 3.5.2 or newer. If you're using an older version, you need to [manually add the Sentry middleware](#manually-add-server-instrumentation) instead.
260+
Auto instrumentation only works for Astro 3.5.2 or newer. If you're using an older version, you need to [manually add the Sentry middleware](#manually-add-server-instrumentation) instead.
249261

250262
</Alert>
251263

docs/platforms/javascript/guides/cloudflare/index.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ categories:
99
- serverless
1010
---
1111

12-
1312
You can use the Sentry Cloudflare SDK with popular frameworks running on Cloudflare:
1413

15-
- **[Astro](frameworks/astro/)**
14+
- **[Astro](frameworks/astro/)**
1615
- **[Hono](frameworks/hono/)**
1716
- **[Remix](frameworks/remix/)**
1817
- **[SvelteKit](frameworks/sveltekit/)**
@@ -41,7 +40,10 @@ Select which Sentry features you'd like to install in addition to Error Monitori
4140

4241
### Setup (Cloudflare Workers)
4342

44-
<PlatformContent includePath="getting-started-config" platform="javascript.cloudflare.workers" />
43+
<PlatformContent
44+
includePath="getting-started-config"
45+
platform="javascript.cloudflare.workers"
46+
/>
4547

4648
If you do not have access to the `onRequest` middleware API, you can use the `wrapRequestHandler` API instead. For example:
4749

@@ -81,14 +83,14 @@ export const onRequest = [
8183
dsn: "___PUBLIC_DSN___",
8284

8385
release: versionId,
84-
86+
8587
// Adds request headers and IP for users, for more info visit:
8688
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#sendDefaultPii
8789
sendDefaultPii: true,
8890
// ___PRODUCT_OPTION_START___ logs
8991

9092
// Enable logs to be sent to Sentry
91-
_experiments: { enableLogs: true },
93+
enableLogs: true,
9294
// ___PRODUCT_OPTION_END___ logs
9395

9496
// ___PRODUCT_OPTION_START___ performance
@@ -97,7 +99,7 @@ export const onRequest = [
9799
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
98100
tracesSampleRate: 1.0,
99101
// ___PRODUCT_OPTION_END___ performance
100-
}
102+
};
101103
}),
102104
// Add more middlewares here
103105
];

docs/platforms/javascript/guides/ember/index.mdx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ categories:
88

99
<Alert>
1010

11-
Sentry's Ember addon enables automatic reporting of errors, exceptions, and transactions.
11+
Sentry's Ember addon enables automatic reporting of errors, exceptions, and transactions.
1212

1313
</Alert>
1414

@@ -24,7 +24,15 @@ Select which Sentry features you'd like to install in addition to Error Monitori
2424

2525
## Install
2626

27-
<OnboardingOptionButtons options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]} />
27+
<OnboardingOptionButtons
28+
options={[
29+
"error-monitoring",
30+
"performance",
31+
"session-replay",
32+
"user-feedback",
33+
"logs",
34+
]}
35+
/>
2836

2937
Sentry captures data by using an SDK within your application's runtime.
3038

@@ -46,11 +54,11 @@ import * as Sentry from "@sentry/ember";
4654

4755
Sentry.init({
4856
dsn: "___PUBLIC_DSN___",
49-
57+
5058
// Adds request headers and IP for users, for more info visit:
5159
// https://docs.sentry.io/platforms/javascript/guides/ember/configuration/options/#sendDefaultPii
5260
sendDefaultPii: true,
53-
61+
5462
// ___PRODUCT_OPTION_START___ session-replay
5563
integrations: [
5664
Sentry.replayIntegration(),
@@ -65,7 +73,7 @@ Sentry.init({
6573
// ___PRODUCT_OPTION_START___ logs
6674

6775
// Enable logs to be sent to Sentry
68-
_experiments: { enableLogs: true },
76+
enableLogs: true,
6977
// ___PRODUCT_OPTION_END___ logs
7078

7179
// ___PRODUCT_OPTION_START___ performance
@@ -96,7 +104,7 @@ export default class App extends Application {
96104

97105
<Alert>
98106

99-
This SDK uses Ember configuration conventions to manage its automatic instrumentation and other Sentry options. This additional configuration can be found under <PlatformLink to="/configuration/ember-options/">Ember options</PlatformLink>.
107+
This SDK uses Ember configuration conventions to manage its automatic instrumentation and other Sentry options. This additional configuration can be found under <PlatformLink to="/configuration/ember-options/">Ember options</PlatformLink>.
100108

101109
</Alert>
102110

docs/platforms/javascript/guides/gatsby/index.mdx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ Select which Sentry features you'd like to install in addition to Error Monitori
1515

1616
## Install
1717

18-
<OnboardingOptionButtons options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]} />
18+
<OnboardingOptionButtons
19+
options={[
20+
"error-monitoring",
21+
"performance",
22+
"session-replay",
23+
"user-feedback",
24+
"logs",
25+
]}
26+
/>
1927

2028
To use Sentry with your Gatsby application, you will need to use `@sentry/gatsby` (Sentry's Gatsby SDK):
2129

@@ -53,17 +61,16 @@ module.exports = {
5361

5462
Then, configure your `Sentry.init`. For this, create a new file called `sentry.config.js` in the root of your project and add the following code:
5563

56-
5764
```javascript {filename:sentry.config.(js|ts)}
5865
import * as Sentry from "@sentry/gatsby";
5966

6067
Sentry.init({
6168
dsn: "___PUBLIC_DSN___",
62-
69+
6370
// Adds request headers and IP for users, for more info visit:
6471
// https://docs.sentry.io/platforms/javascript/guides/gatsby/configuration/options/#sendDefaultPii
6572
sendDefaultPii: true,
66-
73+
6774
integrations: [
6875
// ___PRODUCT_OPTION_START___ performance
6976
Sentry.browserTracingIntegration(),
@@ -81,7 +88,7 @@ Sentry.init({
8188
// ___PRODUCT_OPTION_START___ logs
8289

8390
// Enable logs to be sent to Sentry
84-
_experiments: { enableLogs: true },
91+
enableLogs: true,
8592
// ___PRODUCT_OPTION_END___ logs
8693

8794
// ___PRODUCT_OPTION_START___ performance

docs/platforms/javascript/guides/nextjs/index.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ In addition to capturing errors, you can monitor interactions between multiple s
2020
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
2121

2222
<OnboardingOptionButtons
23-
options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]}
23+
options={[
24+
"error-monitoring",
25+
"performance",
26+
"session-replay",
27+
"user-feedback",
28+
"logs",
29+
]}
2430
/>
2531

2632
## Step 1: Install
@@ -82,7 +88,7 @@ Sentry.init({
8288
// ___PRODUCT_OPTION_START___ logs
8389

8490
// Enable logs to be sent to Sentry
85-
_experiments: { enableLogs: true },
91+
enableLogs: true,
8692
// ___PRODUCT_OPTION_END___ logs
8793

8894
// ___PRODUCT_OPTION_START___ performance
@@ -94,7 +100,7 @@ Sentry.init({
94100
tracesSampleRate: 1.0,
95101
// ___PRODUCT_OPTION_END___ performance
96102
// ___PRODUCT_OPTION_START___ session-replay
97-
// Capture Replay for 10% of all
103+
// Capture Replay for 10% of all
98104
// plus for 100% of sessions with an error
99105
// Learn more at
100106
// https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
@@ -118,7 +124,7 @@ Sentry.init({
118124
// ___PRODUCT_OPTION_START___ logs
119125

120126
// Enable logs to be sent to Sentry
121-
_experiments: { enableLogs: true },
127+
enableLogs: true,
122128
// ___PRODUCT_OPTION_END___ logs
123129

124130
// ___PRODUCT_OPTION_START___ performance

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Sentry.init({
151151
// ___PRODUCT_OPTION_START___ logs
152152

153153
// Enable logs to be sent to Sentry
154-
_experiments: { enableLogs: true },
154+
enableLogs: true,
155155
// ___PRODUCT_OPTION_END___ logs
156156
// Note: if you want to override the automatic release value, do not set a
157157
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
@@ -184,7 +184,7 @@ Sentry.init({
184184
// ___PRODUCT_OPTION_START___ logs
185185

186186
// Enable logs to be sent to Sentry
187-
_experiments: { enableLogs: true },
187+
enableLogs: true,
188188
// ___PRODUCT_OPTION_END___ logs
189189

190190
// ...
@@ -216,7 +216,7 @@ Sentry.init({
216216
// ___PRODUCT_OPTION_START___ logs
217217

218218
// Enable logs to be sent to Sentry
219-
_experiments: { enableLogs: true },
219+
enableLogs: true,
220220
// ___PRODUCT_OPTION_END___ logs
221221

222222
// ...
@@ -459,6 +459,7 @@ Make sure to keep your auth token secret and out of version control.
459459
You can prevent ad blockers from blocking Sentry events using tunneling. Use the `tunnelRoute` option to add an API endpoint in your application that forwards Sentry events to Sentry servers.
460460

461461
For better ad-blocker evasion, you can either:
462+
462463
- Set `tunnelRoute: true` to automatically generate a random tunnel route for each build, making it harder for ad-blockers to detect and block monitoring requests
463464
- Set `tunnelRoute: "/my-tunnel-route"` to use a static route of your choosing
464465

@@ -481,9 +482,12 @@ module.exports = withSentryConfig(nextConfig, {
481482
```
482483

483484
<Expandable level="warning" title="Using Next.js middleware on Turbopack">
484-
If you're using Turbopack, client-side event recording will fail if your Next.js middleware intercepts the configured tunnel route. To fix this, set the route to a fixed string (like `/error-monitoring`) and add a negative matcher like `(?!error-monitoring)` in your middleware to exclude the tunnel route.
485-
486-
If you're not using Turbopack, Sentry will automatically skip the tunnel route in your middleware.
485+
If you're using Turbopack, client-side event recording will fail if your
486+
Next.js middleware intercepts the configured tunnel route. To fix this, set
487+
the route to a fixed string (like `/error-monitoring`) and add a negative
488+
matcher like `(?!error-monitoring)` in your middleware to exclude the tunnel
489+
route. If you're not using Turbopack, Sentry will automatically skip the
490+
tunnel route in your middleware.
487491
</Expandable>
488492

489493
## Step 6: Instrument Vercel Cron Jobs (Optional)

0 commit comments

Comments
 (0)