Skip to content

Commit ae62fcf

Browse files
adinauercodex
andauthored
feat(core): Disable OPTIONS request tracing by default (#6254)
* feat(core): Disable OPTIONS request tracing by default Skip tracing HTTP OPTIONS requests by default in v9 to avoid creating transactions for CORS preflight traffic. Applications can opt back in with traceOptionsRequests. Fixes #4163 Co-Authored-By: Codex <noreply@openai.com> * changelog --------- Co-authored-by: Codex <noreply@openai.com>
1 parent 4a9986d commit ae62fcf

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
`logsEnabled` argument. The deprecated constructor without `minimumLevel` is removed.
4343
- Manually constructed `SentryTimberIntegration` and `SentryTimberTree` instances require a
4444
`logsEnabled` argument. Pass `false` to keep Sentry Logs disabled.
45+
- Disable tracing for HTTP `OPTIONS` requests by default. Set `traceOptionsRequests` to `true` to
46+
preserve the previous behavior ([#6254](https://github.com/getsentry/sentry-java/pull/6254))
4547
- Remove the Apache HttpClient transport and stop publishing `sentry-apache-http-client-5` ([#6214](https://github.com/getsentry/sentry-java/pull/6214))
4648
- Remove deprecated OpenTelemetry integration classes and the legacy `SentrySpanStorage` ([#6243](https://github.com/getsentry/sentry-java/pull/6243))
4749
- Decide whether foregrounding the app starts a new session on a monotonic clock instead of the wall clock, so that a device time change no longer starts a session that should have been resumed, or resumes one that should have ended. This affects session counts ([#6096](https://github.com/getsentry/sentry-java/pull/6096))

‎sentry/src/main/java/io/sentry/SentryOptions.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,8 @@ public class SentryOptions implements RateLimiterConfig {
520520

521521
private @NotNull IThreadChecker threadChecker = NoOpThreadChecker.getInstance();
522522

523-
// TODO [MAJOR] this should default to false on the next major
524523
/** Whether OPTIONS requests should be traced. */
525-
private boolean traceOptionsRequests = true;
524+
private boolean traceOptionsRequests = false;
526525

527526
/** Whether database transaction spans (BEGIN, COMMIT, ROLLBACK) should be traced. */
528527
private boolean enableDatabaseTransactionTracing = false;

‎sentry/src/test/java/io/sentry/SentryOptionsTest.kt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ class SentryOptionsTest {
308308
assertFalse(options.isTracingEnabled)
309309
}
310310

311+
@Test
312+
fun `traceOptionsRequests defaults to false`() {
313+
assertThat(SentryOptions().isTraceOptionsRequests).isFalse()
314+
}
315+
311316
@Test
312317
fun `when there's no cacheDirPath, outboxPath returns null`() {
313318
val options = SentryOptions()

0 commit comments

Comments
 (0)