Skip to content

Commit e6bb76f

Browse files
Merge branch '9.x.x' into sync/main-to-9.x.x-2026-10-15
Resolve .craft.yml: keep main's registry metadata for sentry-jul and drop the sentry-apache-http-client-5 entry removed on 9.x.x (#6214). Fix SentryClientInternalEventProcessorTest (added on main in #6140) to stop using logs/metrics isEnabled, which 9.x.x removed (#5939). Co-Authored-By: Alexander Dinauer <alexander.dinauer@sentry.io>
2 parents e9f7568 + 48e97fb commit e6bb76f

108 files changed

Lines changed: 1233 additions & 1617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.craft.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ targets:
9595
packageUrl: https://central.sonatype.com/artifact/io.sentry/sentry-jul
9696
mainDocsUrl: https://docs.sentry.io/platforms/java/guides/jul/
9797
apiDocsUrl: https://javadoc.io/doc/io.sentry
98-
maven:io.sentry:sentry-apache-http-client-5:
99-
name: io.sentry:sentry-apache-http-client-5
100-
packageUrl: https://central.sonatype.com/artifact/io.sentry/sentry-apache-http-client-5
101-
mainDocsUrl: https://docs.sentry.io/platforms/java/
102-
apiDocsUrl: https://javadoc.io/doc/io.sentry
10398
maven:io.sentry:sentry-android:
10499
name: io.sentry:sentry-android
105100
packageUrl: https://central.sonatype.com/artifact/io.sentry/sentry-android

‎.cursor/rules/options.mdc‎

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ description: Adding and modifying SDK options
44
---
55
# Adding Options to the SDK
66

7-
New features must be **opt-in by default**. Options control whether a feature is enabled and how it behaves.
7+
New automatic capture features must be **opt-in by default**. Deliberate API calls such as
8+
`Sentry.logger()` and `Sentry.metrics()` capture whenever the SDK is enabled and do not have
9+
aggregate signal enable flags. Options control signal behavior and whether individual automatic
10+
sources are enabled.
811

912
## Namespaced Options
1013

1114
Newer features use namespaced option classes nested inside `SentryOptions`, e.g.:
1215
- `SentryOptions.getLogs()` → `SentryOptions.Logs`
1316
- `SentryOptions.getMetrics()` → `SentryOptions.Metrics`
1417

15-
Each namespaced options class is a `public static final class` inside `SentryOptions` with its own fields, getters/setters, and callbacks (e.g. `BeforeSendLogCallback`, `BeforeSendMetricCallback`).
18+
Each namespaced options class is a `public static final class` inside `SentryOptions` with its own fields, getters/setters, factories, and callbacks (e.g. `BeforeSendLogCallback`, `BeforeSendMetricCallback`).
1619

17-
A typical namespaced options class contains:
18-
- `enabled` boolean (default `false` for opt-in)
19-
- `sampleRate` double (if the feature supports sampling)
20-
- `beforeSend` callback interface (nested inside the options class)
20+
Do not assume that a namespaced signal needs an aggregate `enabled` field. In particular, Logs and
21+
Metrics are available through deliberate API calls whenever the SDK is enabled. Their namespaced
22+
options contain signal-specific behavior such as `beforeSend`, limits, and processor factories. Add
23+
options such as sampling only when the signal supports them. Automatic capture integrations use
24+
source-local enable options that default to `false`.
2125

2226
To add a new namespaced options class:
2327
1. Create the `public static final class` inside `SentryOptions` with fields, getters/setters, and any callback interfaces
@@ -47,21 +51,18 @@ The core options class. Add the field (or nested class) with getter/setter here.
4751
Allows setting options via `sentry.properties` file or system properties. Fields use nullable wrapper types (`@Nullable Boolean`, `@Nullable Double`) since unset means "don't override the default."
4852

4953
**File:** `sentry/src/main/java/io/sentry/ExternalOptions.java`
50-
- Add `@Nullable` fields with getter/setter for each externally configurable option (e.g. `enableMetrics`, `logsSampleRate`)
51-
- Wire them in the static `from(PropertiesProvider)` method:
52-
- Boolean: `propertiesProvider.getBooleanProperty("metrics.enabled")`
53-
- Double: `propertiesProvider.getDoubleProperty("logs.sample-rate")`
54+
- Add `@Nullable` fields with getter/setter for each externally configurable option (e.g. `logsSampleRate`)
55+
- Wire them in the static `from(PropertiesProvider)` method, for example:
56+
`propertiesProvider.getDoubleProperty("logs.sample-rate")`
5457

5558
**File:** `sentry/src/main/java/io/sentry/SentryOptions.java` — `merge()` method
5659
- Add null-check blocks to apply each external option onto the namespaced options class:
5760
```java
58-
if (options.isEnableMetrics() != null) {
59-
getMetrics().setEnabled(options.isEnableMetrics());
60-
}
6161
if (options.getLogsSampleRate() != null) {
6262
getLogs().setSampleRate(options.getLogsSampleRate());
6363
}
6464
```
65+
- Do not add or restore `logs.enabled` or `metrics.enabled`; these aggregate options are obsolete.
6566

6667
**Tests:**
6768
- `sentry/src/test/java/io/sentry/ExternalOptionsTest.kt` — test true/false/null for booleans, valid values and null for doubles
@@ -72,9 +73,12 @@ Allows setting options via `sentry.properties` file or system properties. Fields
7273
Allows setting options via `AndroidManifest.xml` `<meta-data>` tags.
7374

7475
**File:** `sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java`
75-
- Add a `static final String` constant for the key (e.g. `"io.sentry.metrics.enabled"`)
76+
- Add a `static final String` constant for the key
7677
- Read it in `applyMetadata()` using `readBool(metadata, logger, CONSTANT, defaultValue)`
77-
- Apply to the namespaced options, e.g. `options.getMetrics().setEnabled(...)`
78+
- Apply automatic-source options directly, for example
79+
`options.setLogcatLogCaptureEnabled(...)` for `io.sentry.logcat.log-capture.enabled`
80+
- Do not add or restore `io.sentry.logs.enabled` or `io.sentry.metrics.enabled`; those aggregate
81+
keys are obsolete.
7882

7983
**Tests:** `sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt`
8084
- Test default value preserved when not in manifest
@@ -83,21 +87,37 @@ Allows setting options via `AndroidManifest.xml` `<meta-data>` tags.
8387

8488
### 4. Spring Boot Properties (Spring Boot only)
8589

86-
`SentryProperties` extends `SentryOptions`, so namespaced options (nested classes) are automatically available as Spring Boot properties without extra code. For example, `SentryOptions.Logs` is automatically mapped to `sentry.logs.enabled` in `application.properties`.
90+
`SentryProperties` extends `SentryOptions`, so bindable namespaced behavior options are available
91+
through the `SentryOptions` class hierarchy. Spring-owned integration controls belong to a Spring
92+
namespace instead. For example, `SentryProperties.Logging.logsEnabled` binds to
93+
`sentry.logging.logs-enabled` and controls Logs forwarding from the auto-configured Logback
94+
appender. `sentry.logging.enabled` separately controls whether that appender is installed.
8795

88-
No additional code is needed for namespaced options — Spring Boot auto-configuration handles this via property binding on the `SentryOptions` class hierarchy.
96+
Do not add or restore `sentry.logs.enabled` or `sentry.metrics.enabled`; those aggregate properties
97+
are obsolete.
8998

9099
**Tests:** `sentry-spring-boot*/src/test/kotlin/.../SentryAutoConfigurationTest.kt`
91-
- Add the property (e.g. `"sentry.logs.enabled=true"`) to the existing `resolves all properties` test
100+
- Add the new property to the existing binding test
92101
- Assert the value is set on the resolved `SentryProperties` bean
102+
- Test default, explicit `true`, explicit `false`, and propagation into the owning integration
93103
- There are three Spring Boot modules with separate test files: `sentry-spring-boot`, `sentry-spring-boot-jakarta`, `sentry-spring-boot-4`
94104

95105
### 5. Reading Options at Runtime
96106

97-
Features check their options at usage time. For namespaced features the check typically happens in the feature's API class (e.g. `LoggerApi`, `MetricsApi`):
98-
- Check `options.getLogs().isEnabled()` early and return if disabled
99-
- Apply sampling via `options.getLogs().getSampleRate()` if applicable
100-
- Apply `beforeSend` callback in `SentryClient` before sending
107+
Deliberate APIs such as `LoggerApi` and `MetricsApi` do not check aggregate signal enable flags.
108+
They capture whenever their scopes are enabled, then apply signal behavior such as sampling and
109+
`beforeSend`.
110+
111+
Automatic integrations must check their source-local opt-in without affecting their existing event
112+
or breadcrumb paths. Current Logs controls are:
113+
- Logback: appender `logsEnabled`
114+
- Log4j2: appender `logsEnabled`
115+
- JUL: handler `logsEnabled`
116+
- Spring Boot Logback: `sentry.logging.logs-enabled`
117+
- Timber: `timberLogCaptureEnabled` / `io.sentry.timber.log-capture.enabled`
118+
- Logcat: `logcatLogCaptureEnabled` / `io.sentry.logcat.log-capture.enabled`
119+
120+
All source-local options default to `false` and gate only Sentry Logs forwarding.
101121

102122
When a feature has its own capture path (e.g. `captureLog`), the relevant classes are:
103123
- `ISentryClient` — add the capture method signature
@@ -106,10 +126,11 @@ When a feature has its own capture path (e.g. `captureLog`), the relevant classe
106126

107127
## Checklist for Adding a New Namespaced Option
108128

109-
1. `SentryOptions.java` — nested options class + getter/setter on `SentryOptions`
110-
2. `ExternalOptions.java` — `@Nullable` fields + wiring in `from()`
111-
3. `SentryOptions.java` `merge()` — apply external options to namespaced class
112-
4. `ManifestMetadataReader.java` — Android manifest support (if Android-relevant)
113-
5. `SentryAutoConfigurationTest.kt` — Spring Boot property binding tests (all three Spring Boot modules)
114-
6. Tests for all of the above (`SentryOptionsTest`, `ExternalOptionsTest`, `ManifestMetadataReaderTest`)
115-
7. Run `./gradlew apiDump` — the nested class and its methods appear in `sentry.api`
129+
1. Decide whether the option controls deliberate API behavior or an automatic capture source
130+
2. `SentryOptions.java` — nested behavior option + getter/setter where core ownership is appropriate
131+
3. `ExternalOptions.java` and `SentryOptions.merge()` — add external support if applicable
132+
4. `ManifestMetadataReader.java` — add Android support if applicable
133+
5. Spring properties — use the owning integration namespace and test all three Spring Boot modules
134+
6. Test defaults and every supported configuration layer
135+
7. Verify automatic-source opt-ins default to `false` and do not gate events or breadcrumbs
136+
8. Run `./gradlew spotlessApply apiDump`

‎.github/ISSUE_TEMPLATE/bug_report_java.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ body:
3939
- sentry-openfeign
4040
- sentry-openfeature
4141
- sentry-launchdarkly-server
42-
- sentry-apache-http-client-5
4342
- sentry-okhttp
4443
- sentry-reactor
4544
- other

‎.github/file-filters.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ high_risk_code: &high_risk_code
66
- "sentry/src/main/java/io/sentry/transport/HttpConnection.java"
77
- "sentry/src/main/java/io/sentry/transport/QueuedThreadPoolExecutor.java"
88
- "sentry/src/main/java/io/sentry/transport/RateLimiter.java"
9-
- "sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransport.java"
109

1110
# Class used by hybrid SDKs
1211
- "sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java"

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The repository is organized into multiple modules:
9696
### Integration Modules
9797
- **Spring Framework**: `sentry-spring*`, `sentry-spring-boot*`
9898
- **Logging**: `sentry-logback`, `sentry-log4j2`, `sentry-jul`, `sentry-android-timber`
99-
- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-openfeign`, `sentry-apache-http-client-5`
99+
- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-openfeign`
100100
- **GraphQL**: `sentry-graphql*`, `sentry-apollo*`
101101
- **Android UI**: `sentry-android-fragment`, `sentry-android-navigation`, `sentry-android-navigation3`, `sentry-compose`
102102
- **Session Replay**: `sentry-android-replay`

‎CHANGELOG.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,41 @@
3232

3333
## 8.60.0
3434

35+
### Breaking Changes
36+
37+
- Remove the aggregate Sentry Logs and Metrics enable options from all configuration surfaces:
38+
- Java API: `options.getLogs().setEnabled(...)` and `options.getMetrics().setEnabled(...)`
39+
- Properties files: `logs.enabled` and `metrics.enabled`
40+
- Environment variables: `SENTRY_LOGS_ENABLED` and `SENTRY_METRICS_ENABLED`
41+
- JVM system properties and Spring Boot: `sentry.logs.enabled` and `sentry.metrics.enabled`
42+
- Android manifest metadata: `io.sentry.logs.enabled` and `io.sentry.metrics.enabled`
43+
44+
The Java accessors are removed. Values supplied through the other configuration surfaces no
45+
longer affect capture.
46+
([#5939](https://github.com/getsentry/sentry-java/pull/5939),
47+
[#5947](https://github.com/getsentry/sentry-java/pull/5947),
48+
[#5953](https://github.com/getsentry/sentry-java/pull/5953))
49+
- **Automatic Logs capture:** Disabled by default. Enable it separately for each integration:
50+
- Spring Boot logging auto-configuration: `sentry.logging.logs-enabled`
51+
([#5946](https://github.com/getsentry/sentry-java/pull/5946))
52+
- Logback appender: `logsEnabled` ([#5940](https://github.com/getsentry/sentry-java/pull/5940))
53+
- Log4j2 appender: `logsEnabled` ([#5941](https://github.com/getsentry/sentry-java/pull/5941))
54+
- JUL handler: `logsEnabled` or `io.sentry.jul.SentryHandler.logsEnabled`
55+
([#5942](https://github.com/getsentry/sentry-java/pull/5942))
56+
- Auto-installed Timber integration: `timberLogCaptureEnabled` or
57+
`io.sentry.timber.log-capture.enabled` manifest metadata
58+
([#5943](https://github.com/getsentry/sentry-java/pull/5943))
59+
- Manually installed Timber integration or tree: `logsEnabled`
60+
([#5943](https://github.com/getsentry/sentry-java/pull/5943))
61+
- Logcat: `logcatLogCaptureEnabled` or `io.sentry.logcat.log-capture.enabled` manifest metadata
62+
([#5945](https://github.com/getsentry/sentry-java/pull/5945))
63+
- **Constructor migrations:**
64+
- The remaining Log4j2 `SentryAppender` constructor and `createAppender` factory require a
65+
`logsEnabled` argument. The deprecated constructor without `minimumLevel` is removed.
66+
- Manually constructed `SentryTimberIntegration` and `SentryTimberTree` instances require a
67+
`logsEnabled` argument. Pass `false` to keep Sentry Logs disabled.
68+
- Remove the Apache HttpClient transport and stop publishing `sentry-apache-http-client-5` ([#6214](https://github.com/getsentry/sentry-java/pull/6214))
69+
3570
### Features
3671

3772
- Add support for Android Navigation 3 through the new `sentry-android-navigation3` library ([#6233](https://github.com/getsentry/sentry-java/pull/6233))

‎README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Sentry SDK for Java and Android
3131
| sentry-compose-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose-android) | 21 |
3232
| sentry-compose-desktop | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose-desktop?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose-desktop) |
3333
| sentry-compose | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-compose) |
34-
| sentry-apache-http-client-5 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apache-http-client-5?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apache-http-client-5) |
3534
| sentry | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry) | 21 |
3635
| sentry-jul | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jul?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-jul) |
3736
| sentry-jdbc | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jdbc?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-jdbc) |

‎sentry-android-core/api/sentry-android-core.api‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,14 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
429429
public fun getBeforeViewHierarchyCaptureCallback ()Lio/sentry/android/core/SentryAndroidOptions$BeforeCaptureCallback;
430430
public fun getDebugImagesLoader ()Lio/sentry/android/core/IDebugImagesLoader;
431431
public fun getFrameMetricsCollector ()Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;
432+
public fun getLogcatLogCaptureEnabled ()Z
432433
public fun getMonotonicTicker ()Lio/sentry/time/MonotonicTicker;
433434
public fun getNativeSdkName ()Ljava/lang/String;
434435
public fun getNdkAppHangTimeoutIntervalMillis ()J
435436
public fun getNdkHandlerStrategy ()I
436437
public fun getScreenshot ()Lio/sentry/android/core/SentryScreenshotOptions;
437438
public fun getStartupCrashDurationThresholdMillis ()J
439+
public fun getTimberLogCaptureEnabled ()Z
438440
public fun getTombstoneMergeTimeThresholdMillis ()J
439441
public fun isAnrEnabled ()Z
440442
public fun isAnrProfilingEnabled ()Z
@@ -498,13 +500,15 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr
498500
public fun setEnableSystemEventBreadcrumbs (Z)V
499501
public fun setEnableSystemEventBreadcrumbsExtras (Z)V
500502
public fun setFrameMetricsCollector (Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;)V
503+
public fun setLogcatLogCaptureEnabled (Z)V
501504
public fun setMemoryLimiterEnabled (Z)V
502505
public fun setNativeHandlerStrategy (Lio/sentry/android/core/NdkHandlerStrategy;)V
503506
public fun setNativeSdkName (Ljava/lang/String;)V
504507
public fun setNdkAppHangTimeoutIntervalMillis (J)V
505508
public fun setReportHistoricalAnrs (Z)V
506509
public fun setReportHistoricalMemoryLimiterExits (Z)V
507510
public fun setReportHistoricalTombstones (Z)V
511+
public fun setTimberLogCaptureEnabled (Z)V
508512
public fun setTombstoneEnabled (Z)V
509513
public fun setTombstoneMergeTimeThresholdMillis (J)V
510514
}

‎sentry-android-core/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ dependencies {
123123
testImplementation(projects.sentrySpotlight)
124124
testImplementation(projects.sentryAndroidFragment)
125125
testImplementation(projects.sentryAndroidTimber)
126+
testImplementation(libs.timber)
126127
testImplementation(projects.sentryAndroidReplay)
127128
testImplementation(projects.sentryCompose)
128129
testImplementation(projects.sentryAndroidNdk)
@@ -133,5 +134,4 @@ dependencies {
133134
testImplementation(libs.androidx.compose.foundation.layout)
134135
testImplementation(libs.androidx.compose.material3)
135136
testRuntimeOnly(libs.androidx.fragment.ktx)
136-
testRuntimeOnly(libs.timber)
137137
}

‎sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ static void installDefaultIntegrations(
479479
}
480480

481481
if (isTimberAvailable) {
482-
options.addIntegration(new SentryTimberIntegration());
482+
options.addIntegration(
483+
new SentryTimberIntegration(() -> options.getTimberLogCaptureEnabled()));
483484
}
484485
options.addIntegration(new AppComponentsBreadcrumbsIntegration(context));
485486
options.addIntegration(new SystemEventsBreadcrumbsIntegration(context));

0 commit comments

Comments
 (0)