Skip to content

Commit 5a3ce33

Browse files
committed
merge: Update Data Collection stack
2 parents 90e13a8 + 670c4a7 commit 5a3ce33

198 files changed

Lines changed: 9610 additions & 641 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.

‎.cursor/BUGBOT.md‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# PR Review Guidelines for Cursor Bugbot
2+
3+
You are reviewing a pull request for the Sentry Java/Android SDK.
4+
5+
Read [`AGENTS.md`](../AGENTS.md) for build commands and contributing rules, and the matching
6+
rule file in [`.cursor/rules/`](rules) for the area the diff touches (`api`, `options`, `scopes`,
7+
`offline`, `opentelemetry`, ...).
8+
9+
## Critical
10+
11+
### Never crash or hang the host application
12+
13+
- While we don't want to crash or hang the host application, we also don't want to leave the host
14+
application in a bad or unrecoverable state. Therefore catch the narrowest type the guarded code
15+
can throw.
16+
- Existing broad catches like `catch (Throwable)` are legacy, not precedent. Where a broad catch is
17+
genuinely unavoidable (an entry point running user code or third-party callbacks), it must call
18+
`ExceptionUtils.rethrowIfFatal(t)` first and a code comment must say why the broad catch is
19+
needed.
20+
- Code probing for an optional `compileOnly` dependency must catch the specific `LinkageError`
21+
subclass (`NoClassDefFoundError`, `NoSuchMethodError`, ...) only.
22+
- The SDK must never `captureException`/`captureMessage` for its own failures or for exceptions
23+
thrown inside user callbacks (`beforeSend`, `beforeBreadcrumb`, `tracesSampler`, ...). Log via
24+
`options.getLogger()` instead — capturing here loops. See
25+
[Never capture your own exceptions](https://develop.sentry.dev/sdk/getting-started/principles/#never-capture-your-own-exceptions).
26+
- Flag `System.out`/`System.err`, `printStackTrace()`, and `android.util.Log` in SDK source; use
27+
`options.getLogger().log(...)`.
28+
- Flag resources acquired but not released: streams, files, `ExecutorService`s,
29+
`BroadcastReceiver`s, lifecycle/activity callbacks, sensors, timers. Anything registered during
30+
init must be undone in the integration's `close()`.
31+
- Errors in instrumented user code should bubble up so the host app's handlers see them. Flag
32+
instrumentation that swallows an error without recording it, and instrumentation that captures an
33+
error that would also reach the global handlers (double reporting).
34+
35+
### Security and privacy
36+
37+
- Real secrets, tokens, or DSNs in code, logs, or configs. Obviously-fake DSNs in tests, samples,
38+
and docs are expected — do not flag those.
39+
- New code that collects user-identifiable data (headers, cookies, request/response bodies, URL
40+
query strings, IPs, usernames, file paths, device identifiers) must be gated behind
41+
`options.isSendDefaultPii()`, and must not be on by default otherwise.
42+
- Debug flags, verbose logging, or sampling overrides accidentally left enabled in production
43+
defaults.
44+
45+
### Public API and compatibility
46+
47+
- New public API must be intentional: new classes/methods not for public use need
48+
`@ApiStatus.Internal`, new unstable API needs `@ApiStatus.Experimental`.
49+
- Removing or changing the signature of public API, or silently changing a default, sampling rate,
50+
or feature toggle, without a deprecation and a `CHANGELOG.md`/`MIGRATION.md` note.
51+
- New features must be **opt-in by default** via `SentryOptions` (or a namespaced options class).
52+
If a feature is added without this, ask "are you sure" as a PR comment.
53+
- New fields on `io.sentry.protocol` classes need both serialization and deserialization, plus a
54+
round-trip test.
55+
- Raising `minSdk`, the Java level, or a supported framework version without an explicit callout.
56+
- Ensure dependency bumps are intentional. For example if a dependency is bumped in part of a
57+
matrix that isn't the newest version.
58+
59+
## Java and Android specifics
60+
61+
- The core `sentry` module is Java 8 and must not reference Android or JVM-only APIs. Reach optional
62+
platform code through `Platform`, `LoadClass`, or a separate module.
63+
- Android code calling an API newer than `minSdk` must be guarded by
64+
`BuildInfoProvider.getSdkInfoVersion()`.
65+
- `Sentry.init` can be called from any thread, and on Android it runs on the main thread during app
66+
startup. Flag disk I/O, network calls, reflection, class loading, regex compilation, or eager
67+
allocation newly added to an init path — and static mutable state that is not thread-safe.
68+
- Ensure any new reflection calls are mirrored in the proguard keep rules.
69+
70+
## Instrumentation conventions
71+
72+
- Every started span must be finished on all paths, including error paths.
73+
- Automatically instrumented spans set an origin (`SpanOptions.setOrigin`) and a standard
74+
[span op](https://develop.sentry.dev/sdk/telemetry/traces/span-operations/). Origins must match
75+
`[A-Za-z0-9_.]` — see the
76+
[trace origin spec](https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/).
77+
- New integrations register themselves with `IntegrationUtils.addIntegrationToSdkVersion(...)`.
78+
- If we're adding a feature that requires bytecode manipulation from the
79+
sentry-android-gradle-plugin, make sure the code is properly commented as such to ensure it isn't
80+
accidentally changed in the future.
81+
82+
## Concurrency
83+
84+
- The SDK uses raw java concurrency primitives. Ensure we are using them correctly.
85+
- Ensure that atomic actions are atomic.
86+
- Watch for possible deadlocks in general but especially when two locks are held and another thread
87+
can grab them in the opposite order.
88+
- Prefer using existing executors over creating new threads.
89+
- Do not block the main thread on Android with locking, synchronization or I/O calls.
90+
- Watch for ordering issues when classes can be called from different threads.
91+
- Flag a lock held across a callback into user code, an I/O call, or an `ExecutorService`
92+
submission.
93+
- Mark a field `volatile` when it is written on one thread and read on another without a lock. A
94+
plain field read is a data race, not merely a stale value.
95+
- Read mutable shared state once per operation. Re-reading the same field for several decisions in
96+
one pass lets it change mid-pass, so the results disagree with each other.
97+
- Prefer the `synchronized` keyword. Existing code that uses `AutoClosableReentrantLock` is legacy.
98+
- New classes have a clear and defined threading and concurrency model as part of the javadoc if
99+
needed.
100+
101+
## Clocks
102+
103+
- Ensure we are using a monotonic clock to measure time intervals.
104+
- Ensure we are using a wall clock for dates and timestamps.
105+
- Ensure that time manipulations are not being misused e.g. adding or subtracting wall clocks to
106+
get a duration.
107+
108+
## Tests
109+
110+
- Public behavior (customer facing) changes need tests. A `fix` PR should include a regression test
111+
that fails without the fix; if the diff doesn't make that clear, ask the author to confirm.
112+
- Prefer tests against contracts. Avoid testing implementation details.
113+
- Flag hollow tests: assertions that only prove "did not throw", or that assert on a payload without
114+
checking the newly added data.
115+
- New assertions should use Google Truth (`com.google.common.truth.Truth.assertThat`); `kotlin.test`
116+
stays for structure (`@Test`, `assertFailsWith`). Don't flag existing `kotlin.test` assertions.
117+
- Flag likely flakes: `Thread.sleep`, wall-clock or ordering assumptions, real network or filesystem
118+
access, and shared static state left dirty between tests.
119+
120+
## What NOT to flag
121+
122+
- Formatting and import order — Spotless owns it.
123+
- Contents of generated `.api` files, beyond confirming `apiDump` was run.
124+
- Conventional commit / PR title format, and missing changelog entries — CI and Danger check both.
125+
- Speculative refactors or improvements unrelated to the diff.

‎.github/workflows/agp-matrix.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
agp: [ '9.0.0', '9.1.1', '9.2.1' ]
20+
agp: [ '9.0.0', '9.2.1', '9.4.0' ]
2121
integrations: [ true, false ]
2222

2323
name: AGP Matrix Release - AGP ${{ matrix.agp }} - Integrations ${{ matrix.integrations }}

‎.github/workflows/system-tests-backend.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- sample: "sentry-samples-spring-boot-webflux"
4747
agent: "false"
4848
agent-auto-init: "true"
49+
- sample: "sentry-samples-spring-boot-jakarta-log4j2"
50+
agent: "false"
51+
agent-auto-init: "true"
4952
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry-noagent"
5053
agent: "false"
5154
agent-auto-init: "true"
@@ -73,6 +76,9 @@ jobs:
7376
- sample: "sentry-samples-spring-boot-4"
7477
agent: "false"
7578
agent-auto-init: "true"
79+
- sample: "sentry-samples-spring-boot-4-log4j2"
80+
agent: "false"
81+
agent-auto-init: "true"
7682
- sample: "sentry-samples-spring-boot-4-webflux"
7783
agent: "false"
7884
agent-auto-init: "true"

‎CHANGELOG.md‎

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,77 @@
113113

114114
See the [Data Collection documentation](https://docs.sentry.io/platforms/java/configuration/options/#dataCollection) for all configuration keys, supported integrations, and migration guidance.
115115

116+
- Add Android SDK support for reporting `MemoryLimiter` app exits recovered from `ApplicationExitInfo` ([#6111](https://github.com/getsentry/sentry-java/pull/6111)).
117+
- Sentry can now configure Log4j2 automatically for Spring Boot 4 when `sentry-log4j2` is on the classpath and Log4j2 Core is the active logging backend ([#5403](https://github.com/getsentry/sentry-java/pull/5403))
118+
- Enable automatic appender registration with:
119+
```properties
120+
sentry.logging.enabled=true
121+
```
122+
Automatic registration is disabled by default for now and will be enabled by default in the next major release.
123+
- The appender is attached to the root logger by default. To attach it to specific loggers instead, configure one or more non-overlapping logger names:
124+
```properties
125+
sentry.logging.loggers[0]=com.example
126+
sentry.logging.loggers[1]=org.example
127+
```
128+
- Configure the minimum level for creating breadcrumbs. The default is `INFO`:
129+
```properties
130+
sentry.logging.minimum-breadcrumb-level=INFO
131+
```
132+
- Configure the minimum level for creating Sentry error events. The default is `ERROR`:
133+
```properties
134+
sentry.logging.minimum-event-level=ERROR
135+
```
136+
- Configure the minimum level for sending Sentry structured logs. The default is `INFO`:
137+
```properties
138+
sentry.logging.minimum-level=INFO
139+
```
140+
Structured logs must also be enabled:
141+
```properties
142+
sentry.logs.enabled=true
143+
```
144+
- Sentry can now configure Log4j2 automatically for Spring Boot 3 when `sentry-log4j2` is on the classpath and Log4j2 Core is the active logging backend ([#6072](https://github.com/getsentry/sentry-java/pull/6072))
145+
- Disabled by default for now; enable it and configure levels the same way as described in the Spring Boot 4 entry above (`sentry.logging.enabled=true`)
146+
116147
### Fixes
117148

118149
- Support `ws` and `wss` URL parsing for WebSocket instrumentation ([#6064](https://github.com/getsentry/sentry-java/pull/6064))
150+
- Keep resolving the server name after `Sentry.close()` or a re-init. Closing the SDK shut down the shared hostname cache for the life of the process, so `server_name` silently froze at the value it had last resolved ([#6119](https://github.com/getsentry/sentry-java/pull/6119))
151+
- Order breadcrumbs by the timestamp they carry rather than by when they were created in the current process, so breadcrumbs restored from disk or handed over by a hybrid SDK no longer sort as if they had just happened ([#6097](https://github.com/getsentry/sentry-java/pull/6097))
152+
153+
### Internal
154+
155+
- Deprecate `AndroidCurrentDateProvider.getInstance()` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103))
156+
157+
## 8.56.0
158+
159+
### Behavioral Changes
160+
161+
- Measure HTTP rate-limit backoff on a monotonic clock instead of the wall clock, so that a device time change no longer lifts or extends an active rate limit ([#6030](https://github.com/getsentry/sentry-java/pull/6030))
162+
163+
### Fixes
164+
165+
- Update `SentryTraced` so that it now honors `options.setIgnoredSpanOrigins` ([#6058](https://github.com/getsentry/sentry-java/pull/6058))
166+
- `SentryTraced` now checks for its owning transaction dynamically rather than once per app process. The latter caused `SentryTraced` spans to be dropped process-wide once the original transaction finished ([#6057](https://github.com/getsentry/sentry-java/pull/6057))
167+
- Fix typos in Spring GraphQL integration names (`GrahQL` to `GraphQL`) ([#6061](https://github.com/getsentry/sentry-java/pull/6061))
168+
- Populate the Android connection status cache during the first two minutes after boot, instead of treating the empty cache as up to date ([#6029](https://github.com/getsentry/sentry-java/pull/6029))
169+
- Prevent `SentryTraced` from producing dangling spans if recomposition is abandoned or drawing fails ([#6049](https://github.com/getsentry/sentry-java/pull/6049))
170+
- Report a consistent app start type across the app start measurement, `contexts.app` and the `app.start` span attributes ([#6006](https://github.com/getsentry/sentry-java/pull/6006))
171+
172+
### Improvements
173+
174+
- Emit a single `ui.compose` span per `SentryTraced` on initial composition instead of one on every recomposition, and set the origin on `ui.render` spans ([#6051](https://github.com/getsentry/sentry-java/pull/6051))
175+
176+
### Internal
177+
178+
- Add an internal `MonotonicTicker` abstraction with `Deadline` and `Stopwatch` primitives ([#6028](https://github.com/getsentry/sentry-java/pull/6028))
179+
- Add internal `Timestamp`, `EpochClock` and `AnchoredClock`, so related instants project from one wall-clock reading instead of each reading the clock ([#6045](https://github.com/getsentry/sentry-java/pull/6045))
180+
- Deprecate `RateLimiter(ICurrentDateProvider, SentryOptions)` in favor of `RateLimiter(SentryOptions)`, whose backoff is measured on a monotonic ticker ([#6030](https://github.com/getsentry/sentry-java/pull/6030))
181+
182+
### Dependencies
183+
184+
- Bump Native SDK from v0.16.5 to v0.16.6 ([#6079](https://github.com/getsentry/sentry-java/pull/6079))
185+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0166)
186+
- [diff](https://github.com/getsentry/sentry-native/compare/0.16.5...0.16.6)
119187

120188
## 8.55.0
121189

@@ -125,20 +193,17 @@
125193

126194
### Improvements
127195

128-
- Emit a single `ui.compose` span per `SentryTraced` on initial composition instead of one on every recomposition, and set the origin on `ui.render` spans ([#6051](https://github.com/getsentry/sentry-java/pull/6051))
129196
- Move ANR profiling out of experimental ([#6042](https://github.com/getsentry/sentry-java/pull/6042))
130197

131198
### Fixes
132199

133-
- Prevent `SentryTraced` from producing dangling spans if recomposition is abandoned or drawing fails ([#6049](https://github.com/getsentry/sentry-java/pull/6049))
134200
- Keep dropped tombstone and ANR events dropped, instead of reporting the same app exit again at every app start ([#6002](https://github.com/getsentry/sentry-java/pull/6002))
135201
- Apply `Sentry.withScope` and `Sentry.withIsolationScope` data to events captured inside the callback when `globalHubMode` is enabled ([#6004](https://github.com/getsentry/sentry-java/pull/6004))
136202
- `globalHubMode` is enabled by default on Android, where tags, extras, contexts and level set inside the callback were silently dropped
137203
- Scopes that are explicitly made current, e.g. via `Sentry.setCurrentScopes` or the `SentryContext` coroutine integration, are now also honoured when `globalHubMode` is enabled
138204
- `Sentry.pushScope`, `Sentry.pushIsolationScope` and `Sentry.popScope` remain no-ops when `globalHubMode` is enabled
139205
- Drop the `profiler_id` from transactions and spans when no Perfetto profile covers them, e.g. when Android's `ProfilingManager` rate limits the profiling request ([#6015](https://github.com/getsentry/sentry-java/pull/6015))
140206
- Prevent events from being dropped when feature flags are added while an event is being captured ([#5989](https://github.com/getsentry/sentry-java/pull/5989))
141-
- Report a consistent app start type across the app start measurement, `contexts.app` and the `app.start` span attributes ([#6006](https://github.com/getsentry/sentry-java/pull/6006))
142207

143208
### Internal
144209

‎build.gradle.kts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ apiValidation {
6666
"sentry-samples-spring-boot-opentelemetry",
6767
"sentry-samples-spring-boot-opentelemetry-noagent",
6868
"sentry-samples-spring-boot-jakarta",
69+
"sentry-samples-spring-boot-jakarta-log4j2",
6970
"sentry-samples-spring-boot-jakarta-opentelemetry",
7071
"sentry-samples-spring-boot-jakarta-opentelemetry-noagent",
7172
"sentry-samples-spring-boot-webflux",
7273
"sentry-samples-spring-boot-webflux-jakarta",
7374
"sentry-samples-spring-boot-4",
75+
"sentry-samples-spring-boot-4-log4j2",
7476
"sentry-samples-spring-boot-4-opentelemetry",
7577
"sentry-samples-spring-boot-4-opentelemetry-noagent",
7678
"sentry-samples-spring-boot-4-otlp",

‎buildSrc/src/main/java/Config.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
object Config {
3-
val AGP = System.getenv("VERSION_AGP") ?: "9.2.1"
3+
val AGP = System.getenv("VERSION_AGP") ?: "9.4.0"
44
val kotlinStdLib = "stdlib-jdk8"
55
val kotlinStdLibVersionAndroid = "1.9.24"
66
val kotlinTestJunit = "test-junit"

‎gradle.properties‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ android.useAndroidX=true
1313
# AGP 9+ migration opt-outs until we remove kotlin-android plugin and adopt built-in Kotlin.
1414
android.builtInKotlin=false
1515
android.newDsl=false
16-
android.experimental.lint.version=9.2.1
16+
android.experimental.lint.version=9.4.0
1717

1818
# Release information
19-
versionName=8.55.0
19+
versionName=8.56.0
2020

2121
# Override the SDK name on native crashes on Android
2222
sentryAndroidSdkName=sentry.native.android

0 commit comments

Comments
 (0)