From a08aa022b4e1fc1acd00c083836de94bf7527906 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 12:49:25 +0100 Subject: [PATCH 001/391] chore(deps): update Native SDK to v0.12.7 (#5098) Co-authored-by: GitHub --- CHANGELOG.md | 6 +++--- gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b6484983d5..2334bc7169a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,9 @@ ### Dependencies -- Bump Native SDK from v0.12.4 to v0.12.6 ([#5071](https://github.com/getsentry/sentry-java/pull/5071)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0126) - - [diff](https://github.com/getsentry/sentry-native/compare/0.12.4...0.12.6) +- Bump Native SDK from v0.12.4 to v0.12.7 ([#5071](https://github.com/getsentry/sentry-java/pull/5071), [#5098](https://github.com/getsentry/sentry-java/pull/5098)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0127) + - [diff](https://github.com/getsentry/sentry-native/compare/0.12.4...0.12.7) ### Internal diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1e8e498c23b..0df43650549 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -149,7 +149,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.12.6" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.12.7" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From ad8da222b26f12907ae85a777fe43aac3c99431c Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 13 Feb 2026 13:56:57 +0100 Subject: [PATCH 002/391] fix(logs,metrics): Attach user attributes to logs and metrics regardless of sendDefaultPii (#5099) * fix: Attach user attributes to logs and metrics regardless of sendDefaultPii When a user is explicitly set on the scope, user.id, user.name, and user.email are now always attached to log and metric attributes, matching the existing behavior for error events (SentryClient.applyScope). Fixes #5078 Co-Authored-By: Claude Opus 4.6 * changelog: Add entry for user attributes fix in logs/metrics Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 1 + .../main/java/io/sentry/logger/LoggerApi.java | 4 +- .../java/io/sentry/metrics/MetricsApi.java | 4 +- sentry/src/test/java/io/sentry/ScopesTest.kt | 46 +++++++++++-------- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2334bc7169a..c34c5b48c73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - When merging tombstones with Native SDK, use the tombstone message if the Native SDK didn't explicitly provide one. ([#5095](https://github.com/getsentry/sentry-java/pull/5095)) - Fix thread leak caused by eager creation of `SentryExecutorService` in `SentryOptions` ([#5093](https://github.com/getsentry/sentry-java/pull/5093)) - There were cases where we created options that ended up unused but we failed to clean those up. +- Attach user attributes to logs and metrics regardless of `sendDefaultPii` ([#5099](https://github.com/getsentry/sentry-java/pull/5099)) - No longer log a warning if a logging integration cannot initialize Sentry due to missing DSN ([#5075](https://github.com/getsentry/sentry-java/pull/5075)) - While this may have been useful to some, it caused lots of confusion. - Session Replay: Add `androidx.camera.view.PreviewView` to default `maskedViewClasses` to mask camera previews by default. ([#5097](https://github.com/getsentry/sentry-java/pull/5097)) diff --git a/sentry/src/main/java/io/sentry/logger/LoggerApi.java b/sentry/src/main/java/io/sentry/logger/LoggerApi.java index 4b047a26e3d..37a485df315 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerApi.java @@ -243,9 +243,7 @@ private void captureLog( setServerName(attributes); } - if (scopes.getOptions().isSendDefaultPii()) { - setUser(attributes); - } + setUser(attributes); return attributes; } diff --git a/sentry/src/main/java/io/sentry/metrics/MetricsApi.java b/sentry/src/main/java/io/sentry/metrics/MetricsApi.java index 08a15100495..fc16d60e0ec 100644 --- a/sentry/src/main/java/io/sentry/metrics/MetricsApi.java +++ b/sentry/src/main/java/io/sentry/metrics/MetricsApi.java @@ -230,9 +230,7 @@ private void captureMetrics( setServerName(attributes); } - if (scopes.getOptions().isSendDefaultPii()) { - setUser(attributes); - } + setUser(attributes); return attributes; } diff --git a/sentry/src/test/java/io/sentry/ScopesTest.kt b/sentry/src/test/java/io/sentry/ScopesTest.kt index 60ef92e893d..73a14b38e71 100644 --- a/sentry/src/test/java/io/sentry/ScopesTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesTest.kt @@ -2953,7 +2953,7 @@ class ScopesTest { } @Test - fun `does not add user fields to log attributes by default`() { + fun `adds user fields to log attributes even if sendDefaultPii is false`() { val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true @@ -2975,9 +2975,17 @@ class ScopesTest { check { assertEquals("log message", it.body) - assertNull(it.attributes?.get("user.id")) - assertNull(it.attributes?.get("user.name")) - assertNull(it.attributes?.get("user.email")) + val userId = it.attributes?.get("user.id")!! + assertEquals("usrid", userId.value) + assertEquals("string", userId.type) + + val userName = it.attributes?.get("user.name")!! + assertEquals("usrname", userName.value) + assertEquals("string", userName.type) + + val userEmail = it.attributes?.get("user.email")!! + assertEquals("user@sentry.io", userEmail.value) + assertEquals("string", userEmail.type) }, anyOrNull(), ) @@ -2988,7 +2996,6 @@ class ScopesTest { val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true - it.isSendDefaultPii = true it.distinctId = "distinctId" } @@ -3012,7 +3019,6 @@ class ScopesTest { val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true - it.isSendDefaultPii = true it.distinctId = null } @@ -3919,7 +3925,7 @@ class ScopesTest { } @Test - fun `does not add user fields to metric attributes by default`() { + fun `adds user fields to metric attributes even if sendDefaultPii is false`() { val (sut, mockClient) = getEnabledScopes { it.distinctId = "distinctId" } sut.configureScope { scope -> @@ -3937,9 +3943,17 @@ class ScopesTest { check { assertEquals("metric name", it.name) - assertNull(it.attributes?.get("user.id")) - assertNull(it.attributes?.get("user.name")) - assertNull(it.attributes?.get("user.email")) + val userId = it.attributes?.get("user.id")!! + assertEquals("usrid", userId.value) + assertEquals("string", userId.type) + + val userName = it.attributes?.get("user.name")!! + assertEquals("usrname", userName.value) + assertEquals("string", userName.type) + + val userEmail = it.attributes?.get("user.email")!! + assertEquals("user@sentry.io", userEmail.value) + assertEquals("string", userEmail.type) }, anyOrNull(), anyOrNull(), @@ -3948,11 +3962,7 @@ class ScopesTest { @Test fun `unset user does provide distinct-id as user-id for metrics`() { - val (sut, mockClient) = - getEnabledScopes { - it.isSendDefaultPii = true - it.distinctId = "distinctId" - } + val (sut, mockClient) = getEnabledScopes { it.distinctId = "distinctId" } sut.metrics().count("metric name") @@ -3972,11 +3982,7 @@ class ScopesTest { @Test fun `unset user does provide null user-id when distinct-id is missing for metrics`() { - val (sut, mockClient) = - getEnabledScopes { - it.isSendDefaultPii = true - it.distinctId = null - } + val (sut, mockClient) = getEnabledScopes { it.distinctId = null } sut.metrics().count("metric name") From 20d5879bc7b24d8394423a1bce7d5801ab764d79 Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Wed, 18 Feb 2026 12:32:42 +0000 Subject: [PATCH 003/391] release: 8.33.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c34c5b48c73..b74bc0886e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.33.0 ### Features diff --git a/gradle.properties b/gradle.properties index 0cd9576e99b..3faa0216ef2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.32.0 +versionName=8.33.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 6ea4329a2cc7a4d9f0b8c620676970e14a4eb24c Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 23 Feb 2026 11:15:22 +0100 Subject: [PATCH 004/391] move contents of CLAUDE.md into AGENTS.md; force Claude to read AGENTS.md and some .cursor/skills (#5103) --- AGENTS.md | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 155 ++---------------------------------------------------- 2 files changed, 156 insertions(+), 152 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000000..5793a5e37a2 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,153 @@ +# AGENTS.md + +This file provides guidance to AI coding agents when working with code in this repository. + +## STOP — Required Reading (Do This First) + +Before doing ANYTHING else (including answering questions), you MUST use the Read tool to load these files: +1. `.cursor/rules/coding.mdc` +2. `.cursor/rules/overview_dev.mdc` + +Then identify and read any topically relevant `.cursor/rules/*.mdc` files for the area you're working on (e.g., `opentelemetry.mdc` for OTel work, `metrics.mdc` for metrics work). Use the Glob tool on `.cursor/rules/*.mdc` to discover available rule files. + +Do NOT skip this step. Do NOT proceed without reading these files first. + +## Project Overview + +This is the Sentry Java/Android SDK - a comprehensive error monitoring and performance tracking SDK for Java and Android applications. The repository contains multiple modules for different integrations and platforms. + +## Build System + +The project uses **Gradle** with Kotlin DSL. Key build files: +- `build.gradle.kts` - Root build configuration +- `settings.gradle.kts` - Multi-module project structure +- `buildSrc/` and `build-logic/` - Custom build logic and plugins +- `Makefile` - High-level build commands + +## Essential Commands + +### Development Workflow +```bash +# Format code and regenerate .api files (REQUIRED before committing) +./gradlew spotlessApply apiDump + +# Run all tests and linter +./gradlew check + +# Build entire project +./gradlew build + +# Create coverage reports +./gradlew jacocoTestReport koverXmlReportRelease + +# Generate documentation +./gradlew aggregateJavadocs +``` + +### Testing +```bash +# Run unit tests for a specific file +./gradlew '::testDebugUnitTest' --tests="**" --info + +# Run system tests (requires Python virtual env) +make systemTest + +# Run specific test suites +./gradlew :sentry-android-core:testDebugUnitTest +./gradlew :sentry:test +``` + +### Code Quality +```bash +# Check code formatting +./gradlew spotlessJavaCheck spotlessKotlinCheck + +# Apply code formatting +./gradlew spotlessApply + +# Update API dump files (after API changes) +./gradlew apiDump + +# Dependency updates check +./gradlew dependencyUpdates -Drevision=release +``` + +### Android-Specific Commands +```bash +# Assemble Android test APKs +./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease +./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest -DtestBuildType=release + +# Run critical UI tests +./scripts/test-ui-critical.sh +``` + +## Development Workflow Rules + +### Planning and Implementation Process +1. **First think through the problem**: Read the codebase for relevant files and propose a plan +2. **Check in before beginning**: Verify the plan before starting implementation +3. **Use todo tracking**: Work through todo items, marking them as complete as you go +4. **High-level communication**: Give high-level explanations of changes made, not step-by-step descriptions +5. **Simplicity first**: Make every task and code change as simple as possible. Avoid massive or complex changes. Impact as little code as possible. +6. **Format and regenerate**: Once done, format code and regenerate .api files: `./gradlew spotlessApply apiDump` +7. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command + +## Module Architecture + +The repository is organized into multiple modules: + +### Core Modules +- **`sentry`** - Core Java SDK implementation +- **`sentry-android-core`** - Core Android SDK implementation +- **`sentry-android`** - High-level Android SDK + +### Integration Modules +- **Spring Framework**: `sentry-spring*`, `sentry-spring-boot*` +- **Logging**: `sentry-logback`, `sentry-log4j2`, `sentry-jul` +- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-apache-http-client-5` +- **GraphQL**: `sentry-graphql*`, `sentry-apollo*` +- **Android UI**: `sentry-android-fragment`, `sentry-android-navigation`, `sentry-compose` +- **Reactive**: `sentry-reactor`, `sentry-ktor-client` +- **Monitoring**: `sentry-opentelemetry*`, `sentry-quartz` + +### Utility Modules +- **`sentry-test-support`** - Shared test utilities +- **`sentry-system-test-support`** - System testing infrastructure +- **`sentry-samples`** - Example applications +- **`sentry-bom`** - Bill of Materials for dependency management + +### Key Architectural Patterns +- **Multi-platform**: Supports JVM, Android, and Kotlin Multiplatform (Compose modules) +- **Modular Design**: Each integration is a separate module with minimal dependencies +- **Options Pattern**: Features are opt-in via `SentryOptions` and similar configuration classes +- **Transport Layer**: Pluggable transport implementations for different environments +- **Scope Management**: Thread-safe scope/context management for error tracking + +## Development Guidelines + +### Code Style +- **Languages**: Java 8+ and Kotlin +- **Formatting**: Enforced via Spotless - always run `./gradlew spotlessApply` before committing +- **API Compatibility**: Binary compatibility is enforced - run `./gradlew apiDump` after API changes + +### Testing Requirements +- Write comprehensive unit tests for new features +- Android modules require both unit tests and instrumented tests where applicable +- System tests validate end-to-end functionality with sample applications +- Coverage reports are generated for both JaCoCo (Java/Android) and Kover (KMP modules) + +### Contributing Guidelines +1. Follow existing code style and language +2. Do not modify API files (e.g. sentry.api) manually - run `./gradlew apiDump` to regenerate them +3. Write comprehensive tests +4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters +5. Consider backwards compatibility + +## Useful Resources + +- Main SDK documentation: https://develop.sentry.dev/sdk/overview/ +- Internal contributing guide: https://docs.sentry.io/internal/contributing/ +- Git commit message conventions: https://develop.sentry.dev/engineering-practices/commit-messages/ + +This SDK is production-ready and used by thousands of applications. Changes should be thoroughly tested and maintain backwards compatibility. diff --git a/CLAUDE.md b/CLAUDE.md index 9de4130c1a7..9c24f45b02e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,156 +1,7 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +## STOP — Required Reading (Do This First) -## Project Overview +Before doing ANYTHING else (including answering questions), you MUST use the Read tool to load [AGENTS.md](AGENTS.md) and follow ALL of its instructions, including reading the required `.cursor/rules/*.mdc` files it references. -This is the Sentry Java/Android SDK - a comprehensive error monitoring and performance tracking SDK for Java and Android applications. The repository contains multiple modules for different integrations and platforms. - -## Build System - -The project uses **Gradle** with Kotlin DSL. Key build files: -- `build.gradle.kts` - Root build configuration -- `settings.gradle.kts` - Multi-module project structure -- `buildSrc/` and `build-logic/` - Custom build logic and plugins -- `Makefile` - High-level build commands - -## Essential Commands - -### Development Workflow -```bash -# Format code and regenerate .api files (REQUIRED before committing) -./gradlew spotlessApply apiDump - -# Run all tests and linter -./gradlew check - -# Build entire project -./gradlew build - -# Create coverage reports -./gradlew jacocoTestReport koverXmlReportRelease - -# Generate documentation -./gradlew aggregateJavadocs -``` - -### Testing -```bash -# Run unit tests for a specific file -./gradlew '::testDebugUnitTest' --tests="**" --info - -# Run system tests (requires Python virtual env) -make systemTest - -# Run specific test suites -./gradlew :sentry-android-core:testDebugUnitTest -./gradlew :sentry:test -``` - -### Code Quality -```bash -# Check code formatting -./gradlew spotlessJavaCheck spotlessKotlinCheck - -# Apply code formatting -./gradlew spotlessApply - -# Update API dump files (after API changes) -./gradlew apiDump - -# Dependency updates check -./gradlew dependencyUpdates -Drevision=release -``` - -### Android-Specific Commands -```bash -# Assemble Android test APKs -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest -DtestBuildType=release - -# Run critical UI tests -./scripts/test-ui-critical.sh -``` - -## Development Workflow Rules - -### Planning and Implementation Process -1. **First think through the problem**: Read the codebase for relevant files and propose a plan -2. **Check in before beginning**: Verify the plan before starting implementation -3. **Use todo tracking**: Work through todo items, marking them as complete as you go -4. **High-level communication**: Give high-level explanations of changes made, not step-by-step descriptions -5. **Simplicity first**: Make every task and code change as simple as possible. Avoid massive or complex changes. Impact as little code as possible. -6. **Format and regenerate**: Once done, format code and regenerate .api files: `./gradlew spotlessApply apiDump` -7. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command - -## Module Architecture - -The repository is organized into multiple modules: - -### Core Modules -- **`sentry`** - Core Java SDK implementation -- **`sentry-android-core`** - Core Android SDK implementation -- **`sentry-android`** - High-level Android SDK - -### Integration Modules -- **Spring Framework**: `sentry-spring*`, `sentry-spring-boot*` -- **Logging**: `sentry-logback`, `sentry-log4j2`, `sentry-jul` -- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-apache-http-client-5` -- **GraphQL**: `sentry-graphql*`, `sentry-apollo*` -- **Android UI**: `sentry-android-fragment`, `sentry-android-navigation`, `sentry-compose` -- **Reactive**: `sentry-reactor`, `sentry-ktor-client` -- **Monitoring**: `sentry-opentelemetry*`, `sentry-quartz` - -### Utility Modules -- **`sentry-test-support`** - Shared test utilities -- **`sentry-system-test-support`** - System testing infrastructure -- **`sentry-samples`** - Example applications -- **`sentry-bom`** - Bill of Materials for dependency management - -### Key Architectural Patterns -- **Multi-platform**: Supports JVM, Android, and Kotlin Multiplatform (Compose modules) -- **Modular Design**: Each integration is a separate module with minimal dependencies -- **Options Pattern**: Features are opt-in via `SentryOptions` and similar configuration classes -- **Transport Layer**: Pluggable transport implementations for different environments -- **Scope Management**: Thread-safe scope/context management for error tracking - -## Development Guidelines - -### Code Style -- **Languages**: Java 8+ and Kotlin -- **Formatting**: Enforced via Spotless - always run `./gradlew spotlessApply` before committing -- **API Compatibility**: Binary compatibility is enforced - run `./gradlew apiDump` after API changes - -### Testing Requirements -- Write comprehensive unit tests for new features -- Android modules require both unit tests and instrumented tests where applicable -- System tests validate end-to-end functionality with sample applications -- Coverage reports are generated for both JaCoCo (Java/Android) and Kover (KMP modules) - -### Contributing Guidelines -1. Follow existing code style and language -2. Do not modify API files (e.g. sentry.api) manually - run `./gradlew apiDump` to regenerate them -3. Write comprehensive tests -4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters -5. Consider backwards compatibility - -## Domain-Specific Knowledge Areas - -For complex SDK functionality, refer to the detailed cursor rules in `.cursor/rules/`: - -- **Scopes and Hub Management**: See `.cursor/rules/scopes.mdc` for details on `IScopes`, scope types (global/isolation/current), thread-local storage, forking behavior, and v7→v8 migration patterns -- **Event Deduplication**: See `.cursor/rules/deduplication.mdc` for `DuplicateEventDetectionEventProcessor` and `enableDeduplication` option -- **Offline Behavior and Caching**: See `.cursor/rules/offline.mdc` for envelope caching, retry logic, transport behavior, and Android vs JVM differences -- **OpenTelemetry Integration**: See `.cursor/rules/opentelemetry.mdc` for agent vs agentless modes, span processing, context propagation, and configuration -- **System Testing (E2E)**: See `.cursor/rules/e2e_tests.mdc` for system test framework, mock server setup, and CI workflows - -### Usage Pattern -When working on these specific areas, read the corresponding cursor rule file first to understand the detailed architecture, then proceed with implementation. - -## Useful Resources - -- Main SDK documentation: https://develop.sentry.dev/sdk/overview/ -- Internal contributing guide: https://docs.sentry.io/internal/contributing/ -- Git commit message conventions: https://develop.sentry.dev/engineering-practices/commit-messages/ - -This SDK is production-ready and used by thousands of applications. Changes should be thoroughly tested and maintain backwards compatibility. \ No newline at end of file +Do NOT skip this step. Do NOT proceed without reading these files first. From 70118e980b52b8e8bdf5734b4b6c59db903d74b8 Mon Sep 17 00:00:00 2001 From: kollesnica1337 <159715199+kollesnica1337@users.noreply.github.com> Date: Tue, 24 Feb 2026 13:29:36 +0300 Subject: [PATCH 005/391] fix(android): unregister SystemEventsBroadcastReceiver safely (#5106) * fix: safe unregister SystemEventsBroadcastReceiver * Add changelog * Revert format changes * Fix code format * Update Changelog * Catch exception more broadly * Remove exception duplicate in logging --------- Co-authored-by: viyakovlev Co-authored-by: Markus Hintersteiner --- CHANGELOG.md | 6 ++++++ .../SystemEventsBreadcrumbsIntegration.java | 15 +++++++++++---- .../SystemEventsBreadcrumbsIntegrationTest.kt | 17 ++++++++++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b74bc0886e1..df25c4b000f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) + ## 8.33.0 ### Features diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java index a5e56fcc3f2..18ff901b0e9 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java @@ -203,13 +203,13 @@ private void scheduleUnregisterReceiver() { } try { - options.getExecutorService().submit(() -> unregisterReceiver()); + options.getExecutorService().submit(() -> unregisterReceiver(options)); } catch (RejectedExecutionException e) { - unregisterReceiver(); + unregisterReceiver(options); } } - private void unregisterReceiver() { + private void unregisterReceiver(final @NotNull SentryAndroidOptions options) { final @Nullable SystemEventsBroadcastReceiver receiverRef; try (final @NotNull ISentryLifecycleToken ignored = receiverLock.acquire()) { isStopped = true; @@ -218,7 +218,14 @@ private void unregisterReceiver() { } if (receiverRef != null) { - context.unregisterReceiver(receiverRef); + try { + context.unregisterReceiver(receiverRef); + } catch (Throwable exception) { + options + .getLogger() + .log( + SentryLevel.ERROR, exception, "Failed to unregister SystemEventsBroadcastReceiver"); + } } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt index fe5e6c775b2..2505b6f7f7d 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt @@ -52,6 +52,7 @@ class SystemEventsBreadcrumbsIntegrationTest { lateinit var shadowActivityManager: ShadowActivityManager fun getSut( + contextForSut: Context = context, enableSystemEventBreadcrumbs: Boolean = true, enableSystemEventBreadcrumbsExtras: Boolean = false, executorService: ISentryExecutorService = ImmediateExecutorService(), @@ -64,7 +65,7 @@ class SystemEventsBreadcrumbsIntegrationTest { this.executorService = executorService } return SystemEventsBreadcrumbsIntegration( - context, + contextForSut, SystemEventsBreadcrumbsIntegration.getDefaultActions().toTypedArray(), handler, ) @@ -313,6 +314,20 @@ class SystemEventsBreadcrumbsIntegrationTest { assertFalse(fixture.options.isEnableSystemEventBreadcrumbs) } + @Test + fun `Do not crash if receiver already unregistered`() { + val realContext = ApplicationProvider.getApplicationContext() + val sut = fixture.getSut(realContext) + + sut.register(fixture.scopes, fixture.options) + + realContext.unregisterReceiver(sut.receiver) + + val result = runCatching { sut.onBackground() } + + assertFalse(result.isFailure) + } + @Test fun `when str has full package, return last string after dot`() { val sut = fixture.getSut() From 2e02ebacc466462fccd7ad87231d8da8539585e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 10:16:43 +0000 Subject: [PATCH 006/391] build(deps): bump getsentry/craft from 2.21.2 to 2.21.7 (#5110) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.21.2 to 2.21.7. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/63d1636bead951f6e034ed62c2a3610965fef010...41defb379de52e5f0e3943944fa5575b22fb9f92) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.21.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Roman Zavarnitsyn --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24a9dd81cbf..0dd2ea4b92c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@63d1636bead951f6e034ed62c2a3610965fef010 # v2 + uses: getsentry/craft@41defb379de52e5f0e3943944fa5575b22fb9f92 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From 382d6c1d1af9433d54a637ef01e2588350ee28db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Feb 2026 11:22:27 +0100 Subject: [PATCH 007/391] build(deps): bump github/codeql-action from 4.32.2 to 4.32.4 (#5109) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.2 to 4.32.4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2...89a39a4e59826350b863aa6b6252a07ad50cf83e) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.32.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a49c5a1a0cc..c93a2128524 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # pin@v2 + uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # pin@v2 + uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2 From 0d66c0b0232303de347fad2543d483be0125aab5 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 26 Feb 2026 12:25:12 +0100 Subject: [PATCH 008/391] feat(screenshot): Add screenshot masking using view hierarchy (#5077) * feat(screenshot): Add screenshot masking using view hierarchy Adds masking support to error screenshots by reusing the Session Replay masking logic. This allows sensitive content (text, images) to be masked before attaching screenshots to error events. - Add SentryMaskingOptions base class for shared masking configuration - Add SentryScreenshotOptions for screenshot-specific masking settings - Create MaskRenderer utility for shared mask rendering (used by both replay and screenshots) - Add manifest metadata support for screenshot masking options - Add snapshot tests with Dropbox Differ library for visual regression - Update CLAUDE.md with dependency management guidelines Masking requires the sentry-android-replay module to be present at runtime. Without it, screenshots are captured without masking. Refs: getsentry/sentry-java#3286 Co-Authored-By: Claude Opus 4.5 * Changelog * dontwarn about classes we check via reflection at runtime * pr id * fix(screenshot): Only warn about missing replay module when masking is configured The isMaskingEnabled() method was logging a warning before checking if masking was actually configured. This caused users who never set up screenshot masking to see spurious warnings on every event. Co-Authored-By: Claude * fix(screenshot): Remove sensitive view classes when setMaskAllImages(false) is called setMaskAllImages(true) was adding WebView, VideoView, and ExoPlayer classes to maskViewClasses, but setMaskAllImages(false) only removed ImageView. This caused asymmetric toggle behavior where disabling image masking didn't restore the original state. Co-Authored-By: Claude * fix(screenshot): Recycle bitmap copy on masking failure to prevent memory leak When an exception occurred in applyMasking after creating a mutable copy of the bitmap, the catch block returned the original screenshot without recycling the copy. This caused bitmap memory to accumulate until GC runs, potentially causing OOM issues on frequent errors. Co-Authored-By: Claude * fix: Resolve merge conflicts with main and integrate trackCustomMasking Move trackCustomMasking() to SentryMaskingOptions as an abstract method so it can be called polymorphically from replay view hierarchy code. SentryReplayOptions provides the real implementation, while SentryScreenshotOptions provides a no-op. Also adds CAMERAX_PREVIEW_VIEW_CLASS_NAME to SentryMaskingOptions. Co-Authored-By: Claude Opus 4.6 * Clean up slop * fix(test): Implement abstract trackCustomMasking in test stub Co-Authored-By: Claude Opus 4.6 * fix(screenshot): Use peekDecorView instead of getDecorView peekDecorView returns null if the decor view hasn't been created yet, avoiding forced creation. This is consistent with the rest of the codebase (ScreenshotUtils, ViewHierarchyEventProcessor). Co-Authored-By: Claude Opus 4.6 * refactor(screenshot): Per-call MaskRenderer, main-thread VH capture, and don't leak unmasked screenshots - Use per-call MaskRenderer via try-with-resources instead of shared instance - Remove Closeable from ScreenshotEventProcessor (nothing to clean up) - Capture view hierarchy on main thread via runOnUiThread + CountDownLatch - Apply masking on the calling thread (only VH traversal needs main thread) - Return null on masking failure to avoid sending unmasked screenshots - Fix setMaskViewContainerClass to not trigger trackCustomMasking Co-Authored-By: Claude Opus 4.6 * Fix tests and remove slop * clean up * fix(masking): Remove from opposite set when adding mask/unmask view class addMaskViewClass now removes from unmaskViewClasses and vice versa, preventing stale entries from silently blocking masking when setMaskAllText(false)/setMaskAllImages(false) is called with defaults. Co-Authored-By: Claude Opus 4.6 * delegate to super in SentryReplayOptions * Do not capture screenshot when copy bitmap fails * fix(screenshot): Recycle bitmaps on all early-return paths to prevent memory leaks Co-Authored-By: Claude Opus 4.6 * fix(screenshot): Log missing replay module warning once in constructor instead of per event Co-Authored-By: Claude Opus 4.6 * Move PR id info to AGENTS.md * refactor: Rename getScreenshotOptions() to getScreenshot() to match getSessionReplay() pattern Co-Authored-By: Claude Opus 4.6 * docs: Move screenshot masking changelog entry to Unreleased with code snippets Co-Authored-By: Claude Opus 4.6 * fix(screenshot): Avoid crash from uncaught exception in view hierarchy traversal and unnecessary bitmap alloc in MaskRenderer.close() Co-Authored-By: Claude Opus 4.6 * fix: Fix MaskRendererTest after lazy bitmap init guard and simplify test setup Co-Authored-By: Claude Opus 4.6 * fix(screenshot): Wrap runOnUiThread in try-catch to handle destroyed activity race condition Co-Authored-By: Claude Opus 4.6 * Bail out early if replay module is not available but masking is enabled for screenshots * fix(test): Expect no screenshot when masking configured without replay module Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.5 --- AGENTS.md | 15 + CHANGELOG.md | 22 ++ CLAUDE.md | 1 - gradle/libs.versions.toml | 1 + .../api/sentry-android-core.api | 9 +- sentry-android-core/build.gradle.kts | 1 + .../core/AndroidOptionsInitializer.java | 3 +- .../android/core/ManifestMetadataReader.java | 12 + .../core/ScreenshotEventProcessor.java | 146 +++++++- .../android/core/SentryAndroidOptions.java | 18 + .../android/core/SentryScreenshotOptions.java | 60 ++++ .../core/ManifestMetadataReaderTest.kt | 72 ++++ .../core/ScreenshotEventProcessorTest.kt | 280 +++++++++++++-- .../core/SentryScreenshotOptionsTest.kt | 113 ++++++ .../src/test/resources/Tongariro.jpg | Bin 0 -> 239154 bytes .../screenshot_mask_all.png | Bin 0 -> 2673 bytes .../screenshot_mask_custom_view.png | Bin 0 -> 14948 bytes .../screenshot_mask_images.png | Bin 0 -> 9353 bytes .../screenshot_mask_text.png | Bin 0 -> 8428 bytes .../screenshot_no_masking.png | Bin 0 -> 14845 bytes .../sentry-uitest-android/proguard-rules.pro | 4 + .../replay/screenshot/PixelCopyStrategy.kt | 92 +---- .../android/replay/util/MaskRenderer.kt | 118 +++++++ .../io/sentry/android/replay/util/Views.kt | 17 +- .../viewhierarchy/ComposeViewHierarchyNode.kt | 41 ++- .../replay/viewhierarchy/ViewHierarchyNode.kt | 27 +- .../android/replay/util/MaskRendererTest.kt | 326 ++++++++++++++++++ .../replay/util/TextViewDominantColorTest.kt | 24 +- .../ComposeMaskingOptionsTest.kt | 12 +- .../ContainerMaskingOptionsTest.kt | 41 ++- .../viewhierarchy/MaskingOptionsTest.kt | 66 +++- .../src/main/AndroidManifest.xml | 8 +- sentry/api/sentry.api | 43 ++- sentry/src/main/java/io/sentry/Scopes.java | 15 + .../java/io/sentry/SentryMaskingOptions.java | 129 +++++++ .../java/io/sentry/SentryReplayOptions.java | 114 +----- .../io/sentry/SentryMaskingOptionsTest.kt | 133 +++++++ 37 files changed, 1668 insertions(+), 295 deletions(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/SentryScreenshotOptions.java create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt create mode 100644 sentry-android-core/src/test/resources/Tongariro.jpg create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_images.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_text.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_no_masking.png create mode 100644 sentry-android-replay/src/main/java/io/sentry/android/replay/util/MaskRenderer.kt create mode 100644 sentry-android-replay/src/test/java/io/sentry/android/replay/util/MaskRendererTest.kt create mode 100644 sentry/src/main/java/io/sentry/SentryMaskingOptions.java create mode 100644 sentry/src/test/java/io/sentry/SentryMaskingOptionsTest.kt diff --git a/AGENTS.md b/AGENTS.md index 5793a5e37a2..fad3dc5a54e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -144,6 +144,21 @@ The repository is organized into multiple modules: 4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters 5. Consider backwards compatibility +### Getting PR Information + +Use `gh pr view` to get PR details from the current branch. This is needed when adding changelog entries, which require the PR number. + +```bash +# Get PR number for current branch +gh pr view --json number -q '.number' + +# Get PR number for a specific branch +gh pr view --json number -q '.number' + +# Get PR URL +gh pr view --json url -q '.url' +``` + ## Useful Resources - Main SDK documentation: https://develop.sentry.dev/sdk/overview/ diff --git a/CHANGELOG.md b/CHANGELOG.md index df25c4b000f..b3de4ffc7e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ ## Unreleased +### Features + +- Add screenshot masking support using view hierarchy ([#5077](https://github.com/getsentry/sentry-java/pull/5077)) + - Masks sensitive content (text, images) in error screenshots using the same view hierarchy approach as Session Replay + - Requires the `sentry-android-replay` module to be present at runtime for masking to work + - Enable via code: + ```kotlin + SentryAndroid.init(context) { options -> + options.isAttachScreenshot = true + options.screenshot.setMaskAllText(true) + options.screenshot.setMaskAllImages(true) + // Or mask specific view classes + options.screenshot.addMaskViewClass("com.example.MyCustomView") + } + ``` + - Or via `AndroidManifest.xml`: + ```xml + + + + ``` + ### Fixes - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) diff --git a/CLAUDE.md b/CLAUDE.md index 9c24f45b02e..19507016af4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -3,5 +3,4 @@ ## STOP — Required Reading (Do This First) Before doing ANYTHING else (including answering questions), you MUST use the Read tool to load [AGENTS.md](AGENTS.md) and follow ALL of its instructions, including reading the required `.cursor/rules/*.mdc` files it references. - Do NOT skip this step. Do NOT proceed without reading these files first. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0df43650549..7e9a7af4840 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -236,3 +236,4 @@ msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } okio = { module = "com.squareup.okio:okio", version = "1.13.0" } roboelectric = { module = "org.robolectric:robolectric", version = "4.14" } +dropbox-differ = { module = "com.dropbox.differ:differ-jvm", version = "0.3.0" } diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 69b3982af8d..7e64d0bcf80 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -326,7 +326,7 @@ public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sen } public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor { - public fun (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V + public fun (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;Z)V public fun getOrder ()Ljava/lang/Long; public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent; public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction; @@ -354,6 +354,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun getFrameMetricsCollector ()Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector; public fun getNativeSdkName ()Ljava/lang/String; public fun getNdkHandlerStrategy ()I + public fun getScreenshot ()Lio/sentry/android/core/SentryScreenshotOptions; public fun getStartupCrashDurationThresholdMillis ()J public fun isAnrEnabled ()Z public fun isAnrReportInDebug ()Z @@ -450,6 +451,12 @@ public final class io/sentry/android/core/SentryPerformanceProvider { public fun shutdown ()V } +public final class io/sentry/android/core/SentryScreenshotOptions : io/sentry/SentryMaskingOptions { + public fun ()V + public fun setMaskAllImages (Z)V + public fun trackCustomMasking ()V +} + public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Button { public fun (Landroid/content/Context;)V public fun (Landroid/content/Context;Landroid/util/AttributeSet;)V diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 8d5f73fbf44..23dc964d3d6 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -108,6 +108,7 @@ dependencies { testImplementation(projects.sentryAndroidReplay) testImplementation(projects.sentryCompose) testImplementation(projects.sentryAndroidNdk) + testImplementation(libs.dropbox.differ) testRuntimeOnly(libs.androidx.compose.ui) testRuntimeOnly(libs.androidx.fragment.ktx) testRuntimeOnly(libs.timber) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index 81ac3b35d6a..5bfebaed922 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -188,7 +188,8 @@ static void initializeIntegrationsAndProcessors( options.addEventProcessor( new DefaultAndroidEventProcessor(context, buildInfoProvider, options)); options.addEventProcessor(new PerformanceAndroidEventProcessor(options, activityFramesTracker)); - options.addEventProcessor(new ScreenshotEventProcessor(options, buildInfoProvider)); + options.addEventProcessor( + new ScreenshotEventProcessor(options, buildInfoProvider, isReplayAvailable)); options.addEventProcessor(new ViewHierarchyEventProcessor(options)); options.addEventProcessor( new ApplicationExitInfoEventProcessor(context, options, buildInfoProvider)); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 17d75b39c74..66587925404 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -170,6 +170,10 @@ final class ManifestMetadataReader { static final String SPOTLIGHT_CONNECTION_URL = "io.sentry.spotlight.url"; + static final String SCREENSHOT_MASK_ALL_TEXT = "io.sentry.screenshot.mask-all-text"; + + static final String SCREENSHOT_MASK_ALL_IMAGES = "io.sentry.screenshot.mask-all-images"; + /** ManifestMetadataReader ctor */ private ManifestMetadataReader() {} @@ -659,6 +663,14 @@ static void applyMetadata( if (spotlightUrl != null) { options.setSpotlightConnectionUrl(spotlightUrl); } + + // Screenshot masking options (default to false for backwards compatibility) + options + .getScreenshot() + .setMaskAllText(readBool(metadata, logger, SCREENSHOT_MASK_ALL_TEXT, false)); + options + .getScreenshot() + .setMaskAllImages(readBool(metadata, logger, SCREENSHOT_MASK_ALL_IMAGES, false)); } options .getLogger() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java index 16e96979454..86b13309354 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java @@ -6,6 +6,7 @@ import android.app.Activity; import android.graphics.Bitmap; +import android.view.View; import io.sentry.Attachment; import io.sentry.EventProcessor; import io.sentry.Hint; @@ -14,9 +15,16 @@ import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.android.core.internal.util.ScreenshotUtils; +import io.sentry.android.replay.util.MaskRenderer; +import io.sentry.android.replay.util.ViewsKt; +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode; import io.sentry.protocol.SentryTransaction; import io.sentry.util.HintUtils; import io.sentry.util.Objects; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,10 +42,15 @@ public final class ScreenshotEventProcessor implements EventProcessor { private final @NotNull Debouncer debouncer; private static final long DEBOUNCE_WAIT_TIME_MS = 2000; private static final int DEBOUNCE_MAX_EXECUTIONS = 3; + private static final long MASKING_TIMEOUT_MS = 2000; + + private final boolean isReplayAvailable; + private final AtomicBoolean isReplayModuleAbsenceLogged = new AtomicBoolean(false); public ScreenshotEventProcessor( final @NotNull SentryAndroidOptions options, - final @NotNull BuildInfoProvider buildInfoProvider) { + final @NotNull BuildInfoProvider buildInfoProvider, + final boolean isReplayAvailable) { this.options = Objects.requireNonNull(options, "SentryAndroidOptions is required"); this.buildInfoProvider = Objects.requireNonNull(buildInfoProvider, "BuildInfoProvider is required"); @@ -47,11 +60,17 @@ public ScreenshotEventProcessor( DEBOUNCE_WAIT_TIME_MS, DEBOUNCE_MAX_EXECUTIONS); + this.isReplayAvailable = isReplayAvailable; + if (options.isAttachScreenshot()) { addIntegrationToSdkVersion("Screenshot"); } } + private boolean isMaskingEnabled() { + return !options.getScreenshot().getMaskViewClasses().isEmpty() && isReplayAvailable; + } + @Override public @NotNull SentryTransaction process( @NotNull SentryTransaction transaction, @NotNull Hint hint) { @@ -71,6 +90,15 @@ public ScreenshotEventProcessor( return event; } + if (!isReplayAvailable && !options.getScreenshot().getMaskViewClasses().isEmpty()) { + if (!isReplayModuleAbsenceLogged.getAndSet(true)) { + options + .getLogger() + .log(SentryLevel.WARNING, "Screenshot masking requires sentry-android-replay module"); + } + return event; + } + final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity(); if (activity == null || HintUtils.isFromHybridSdk(hint)) { return event; @@ -89,16 +117,32 @@ public ScreenshotEventProcessor( return event; } - final Bitmap screenshot = + Bitmap screenshot = captureScreenshot( activity, options.getThreadChecker(), options.getLogger(), buildInfoProvider); if (screenshot == null) { return event; } + // Apply masking if enabled and replay module is available + if (isMaskingEnabled()) { + final @Nullable ViewHierarchyNode rootNode = captureViewHierarchy(activity); + if (rootNode == null) { + screenshot.recycle(); + return event; + } + final @Nullable Bitmap masked = applyMasking(screenshot, rootNode); + if (masked == null) { + // applyMasking already recycles its bitmaps on failure + return event; + } + screenshot = masked; + } + + final Bitmap finalScreenshot = screenshot; hint.setScreenshot( Attachment.fromByteProvider( - () -> ScreenshotUtils.compressBitmapToPng(screenshot, options.getLogger()), + () -> ScreenshotUtils.compressBitmapToPng(finalScreenshot, options.getLogger()), "screenshot.png", "image/png", false)); @@ -106,6 +150,102 @@ public ScreenshotEventProcessor( return event; } + /** + * Captures the view hierarchy on the main thread, since view traversal requires it. If already on + * the main thread, captures directly; otherwise posts to the main thread and waits. + */ + private @Nullable ViewHierarchyNode captureViewHierarchy(final @NotNull Activity activity) { + if (options.getThreadChecker().isMainThread()) { + return buildViewHierarchy(activity); + } + + final AtomicReference result = new AtomicReference<>(null); + final CountDownLatch latch = new CountDownLatch(1); + + try { + activity.runOnUiThread( + () -> { + try { + result.set(buildViewHierarchy(activity)); + } finally { + latch.countDown(); + } + }); + + if (!latch.await(MASKING_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { + options + .getLogger() + .log( + SentryLevel.WARNING, "Timed out waiting for view hierarchy capture on main thread"); + return null; + } + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, "Failed to capture view hierarchy", e); + return null; + } + + return result.get(); + } + + private @Nullable ViewHierarchyNode buildViewHierarchy(final @NotNull Activity activity) { + try { + final @Nullable View rootView = + activity.getWindow() != null + && activity.getWindow().peekDecorView() != null + && activity.getWindow().peekDecorView().getRootView() != null + ? activity.getWindow().peekDecorView().getRootView() + : null; + if (rootView == null) { + return null; + } + + final ViewHierarchyNode rootNode = + ViewHierarchyNode.Companion.fromView(rootView, null, 0, options.getScreenshot()); + ViewsKt.traverse(rootView, rootNode, options.getScreenshot(), options.getLogger()); + return rootNode; + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, "Failed to build view hierarchy", e); + return null; + } + } + + private @Nullable Bitmap applyMasking( + final @NotNull Bitmap screenshot, final @NotNull ViewHierarchyNode rootNode) { + Bitmap mutableBitmap = screenshot; + boolean createdCopy = false; + try (final MaskRenderer maskRenderer = new MaskRenderer()) { + // Make bitmap mutable if needed + if (!screenshot.isMutable()) { + mutableBitmap = screenshot.copy(Bitmap.Config.ARGB_8888, true); + if (mutableBitmap == null) { + screenshot.recycle(); + return null; + } + createdCopy = true; + } + + maskRenderer.renderMasks(mutableBitmap, rootNode, null); + + // Recycle original if we created a copy + if (createdCopy && !screenshot.isRecycled()) { + screenshot.recycle(); + } + + return mutableBitmap; + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, "Failed to mask screenshot", e); + if (createdCopy) { + if (!mutableBitmap.isRecycled()) { + mutableBitmap.recycle(); + } + } + if (!screenshot.isRecycled()) { + screenshot.recycle(); + } + return null; + } + } + @Override public @Nullable Long getOrder() { return 10000L; diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index d106f63e75b..9630fd59618 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -243,6 +243,15 @@ public interface BeforeCaptureCallback { private boolean enableTombstone = false; + /** + * Screenshot masking options. Configure which views should be masked when capturing screenshots + * on error events. + * + *

Note: Screenshot masking requires the {@code sentry-android-replay} module to be present at + * runtime. If the replay module is not available, screenshots will be captured without masking. + */ + private final @NotNull SentryScreenshotOptions screenshot = new SentryScreenshotOptions(); + public SentryAndroidOptions() { setSentryClientName(BuildConfig.SENTRY_ANDROID_SDK_NAME + "/" + BuildConfig.VERSION_NAME); setSdkVersion(createSdkVersion()); @@ -677,6 +686,15 @@ public void setEnableSystemEventBreadcrumbsExtras( this.enableSystemEventBreadcrumbsExtras = enableSystemEventBreadcrumbsExtras; } + /** + * Returns the screenshot masking options. + * + * @return the screenshot masking options + */ + public @NotNull SentryScreenshotOptions getScreenshot() { + return screenshot; + } + static class AndroidUserFeedbackIDialogHandler implements SentryFeedbackOptions.IDialogHandler { @Override public void showDialog( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryScreenshotOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryScreenshotOptions.java new file mode 100644 index 00000000000..8680ed907d1 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryScreenshotOptions.java @@ -0,0 +1,60 @@ +package io.sentry.android.core; + +import io.sentry.SentryMaskingOptions; + +/** + * Screenshot masking options for error screenshots. Extends the base {@link SentryMaskingOptions} + * with screenshot-specific defaults. + * + *

By default, masking is disabled for screenshots. Enable masking by calling {@link + * #setMaskAllText(boolean)} and/or {@link #setMaskAllImages(boolean)}. + * + *

Note: Screenshot masking requires the {@code sentry-android-replay} module to be present at + * runtime. If the replay module is not available, screenshots will be captured without masking. + */ +public final class SentryScreenshotOptions extends SentryMaskingOptions { + + public SentryScreenshotOptions() { + // Default to NO masking until next major version. + // maskViewClasses starts empty, so nothing is masked by default. + } + + @Override + public void trackCustomMasking() { + // No-op for screenshots, custom masking tracking is only relevant for session replay. + } + + /** + * {@inheritDoc} + * + *

When enabling image masking for screenshots, this also adds masking for WebView, VideoView, + * and media player views (ExoPlayer, Media3) since they may contain sensitive content. + */ + @Override + public void setMaskAllImages(final boolean maskAllImages) { + super.setMaskAllImages(maskAllImages); + if (maskAllImages) { + addSensitiveViewClasses(); + } else { + removeSensitiveViewClasses(); + } + } + + private void addSensitiveViewClasses() { + addMaskViewClass(WEB_VIEW_CLASS_NAME); + addMaskViewClass(VIDEO_VIEW_CLASS_NAME); + addMaskViewClass(CAMERAX_PREVIEW_VIEW_CLASS_NAME); + addMaskViewClass(ANDROIDX_MEDIA_VIEW_CLASS_NAME); + addMaskViewClass(EXOPLAYER_CLASS_NAME); + addMaskViewClass(EXOPLAYER_STYLED_CLASS_NAME); + } + + private void removeSensitiveViewClasses() { + getMaskViewClasses().remove(WEB_VIEW_CLASS_NAME); + getMaskViewClasses().remove(VIDEO_VIEW_CLASS_NAME); + getMaskViewClasses().remove(CAMERAX_PREVIEW_VIEW_CLASS_NAME); + getMaskViewClasses().remove(ANDROIDX_MEDIA_VIEW_CLASS_NAME); + getMaskViewClasses().remove(EXOPLAYER_CLASS_NAME); + getMaskViewClasses().remove(EXOPLAYER_STYLED_CLASS_NAME); + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 36a0a531a64..c8e55ffc095 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -2289,4 +2289,76 @@ class ManifestMetadataReaderTest { assertTrue(fixture.options.isEnableSpotlight) assertEquals(expectedUrl, fixture.options.spotlightConnectionUrl) } + + // Screenshot masking tests + + @Test + fun `applyMetadata reads screenshot mask-all-text to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.SCREENSHOT_MASK_ALL_TEXT to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.widget.TextView")) + } + + @Test + fun `applyMetadata reads screenshot mask-all-images to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.SCREENSHOT_MASK_ALL_IMAGES to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.widget.ImageView")) + } + + @Test + fun `applyMetadata without specifying screenshot mask-all-text, stays false`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertFalse(fixture.options.screenshot.maskViewClasses.contains("android.widget.TextView")) + } + + @Test + fun `applyMetadata without specifying screenshot mask-all-images, stays false`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertFalse(fixture.options.screenshot.maskViewClasses.contains("android.widget.ImageView")) + } + + @Test + fun `applyMetadata reads both screenshot masking options`() { + // Arrange + val bundle = + bundleOf( + ManifestMetadataReader.SCREENSHOT_MASK_ALL_TEXT to true, + ManifestMetadataReader.SCREENSHOT_MASK_ALL_IMAGES to true, + ) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.widget.TextView")) + assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.widget.ImageView")) + // maskAllImages should also add WebView + assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.webkit.WebView")) + } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt index fac4fdc1891..acc38228e6b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt @@ -1,9 +1,24 @@ package io.sentry.android.core import android.app.Activity +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.drawable.Drawable +import android.os.Bundle +import android.os.Looper import android.view.View -import android.view.Window +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.LinearLayout.LayoutParams +import android.widget.RadioButton +import android.widget.TextView import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.dropbox.differ.Color as DifferColor +import com.dropbox.differ.Image +import com.dropbox.differ.SimpleImageComparator import io.sentry.Attachment import io.sentry.Hint import io.sentry.MainEventProcessor @@ -12,6 +27,7 @@ import io.sentry.SentryIntegrationPackageStorage import io.sentry.TypeCheckHint.ANDROID_ACTIVITY import io.sentry.protocol.SentryException import io.sentry.util.thread.IThreadChecker +import java.io.File import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals @@ -21,40 +37,51 @@ import kotlin.test.assertNull import kotlin.test.assertSame import kotlin.test.assertTrue import org.junit.runner.RunWith -import org.mockito.kotlin.any import org.mockito.kotlin.mock -import org.mockito.kotlin.verify import org.mockito.kotlin.whenever +import org.robolectric.Robolectric.buildActivity +import org.robolectric.Shadows.shadowOf +import org.robolectric.annotation.Config +import org.robolectric.annotation.GraphicsMode +import org.robolectric.shadows.ShadowPixelCopy @RunWith(AndroidJUnit4::class) +@Config(shadows = [ShadowPixelCopy::class], sdk = [30]) +@GraphicsMode(GraphicsMode.Mode.NATIVE) class ScreenshotEventProcessorTest { + + companion object { + /** + * Set to `true` to record/update golden images for snapshot tests. When `true`, screenshots + * will be saved to src/test/resources/snapshots/{testName}.png. Set back to `false` after + * recording to run comparison tests. + */ + private const val RECORD_SNAPSHOTS = false + + private val SNAPSHOTS_DIR = + File("src/test/resources/snapshots/ScreenshotEventProcessorTest").also { + if (RECORD_SNAPSHOTS) it.mkdirs() + } + } + private class Fixture { - val buildInfo = mock() - val activity = mock() - val window = mock() - val view = mock() - val rootView = mock() + lateinit var activity: Activity val threadChecker = mock() val options = SentryAndroidOptions().apply { dsn = "https://key@sentry.io/proj" } val mainProcessor = MainEventProcessor(options) init { - whenever(rootView.width).thenReturn(1) - whenever(rootView.height).thenReturn(1) - whenever(view.rootView).thenReturn(rootView) - whenever(window.decorView).thenReturn(view) - whenever(window.peekDecorView()).thenReturn(view) - whenever(activity.window).thenReturn(window) - whenever(activity.runOnUiThread(any())).then { it.getArgument(0).run() } - whenever(threadChecker.isMainThread).thenReturn(true) } - fun getSut(attachScreenshot: Boolean = false): ScreenshotEventProcessor { + fun getSut( + attachScreenshot: Boolean = false, + isReplayAvailable: Boolean = false, + ): ScreenshotEventProcessor { options.isAttachScreenshot = attachScreenshot options.threadChecker = threadChecker - return ScreenshotEventProcessor(options, buildInfo) + return ScreenshotEventProcessor(options, BuildInfoProvider(options.logger), isReplayAvailable) } } @@ -62,8 +89,12 @@ class ScreenshotEventProcessorTest { @BeforeTest fun `set up`() { + System.setProperty("robolectric.areWindowsMarkedVisible", "true") + System.setProperty("robolectric.pixelCopyRenderMode", "hardware") + fixture = Fixture() CurrentActivityHolder.getInstance().clearActivity() + fixture.activity = buildActivity(MaskingActivity::class.java, null).setup().get() } @Test @@ -108,7 +139,7 @@ class ScreenshotEventProcessorTest { val sut = fixture.getSut(true) val hint = Hint() - whenever(fixture.activity.isFinishing).thenReturn(true) + fixture.activity.finish() CurrentActivityHolder.getInstance().setActivity(fixture.activity) val event = fixture.mainProcessor.process(getEvent(), hint) @@ -122,8 +153,8 @@ class ScreenshotEventProcessorTest { val sut = fixture.getSut(true) val hint = Hint() - whenever(fixture.rootView.width).thenReturn(0) - whenever(fixture.rootView.height).thenReturn(0) + val root = fixture.activity.window.decorView + root.layout(0, 0, 0, 0) CurrentActivityHolder.getInstance().setActivity(fixture.activity) val event = fixture.mainProcessor.process(getEvent(), hint) @@ -165,6 +196,7 @@ class ScreenshotEventProcessorTest { } @Test + @Config(sdk = [23]) fun `when screenshot event processor is called from background thread it executes on main thread`() { val sut = fixture.getSut(true) whenever(fixture.threadChecker.isMainThread).thenReturn(false) @@ -175,7 +207,7 @@ class ScreenshotEventProcessorTest { val event = fixture.mainProcessor.process(getEvent(), hint) sut.process(event, hint) - verify(fixture.activity).runOnUiThread(any()) + shadowOf(Looper.getMainLooper()).idle() assertNotNull(hint.screenshot) } @@ -291,5 +323,209 @@ class ScreenshotEventProcessorTest { assertNotNull(hint.screenshot) } + @Test + fun `when masking is configured and VH capture fails, no screenshot is attached`() { + val sut = fixture.getSut(attachScreenshot = true, isReplayAvailable = true) + fixture.options.screenshot.setMaskAllText(true) + val hint = Hint() + + // No activity set, so VH capture will return null (no rootView) + CurrentActivityHolder.getInstance().clearActivity() + + val event = fixture.mainProcessor.process(getEvent(), hint) + sut.process(event, hint) + + assertNull(hint.screenshot) + } + + @Test + fun `when masking is configured but replay is not available, screenshot is not captured`() { + val sut = fixture.getSut(attachScreenshot = true, isReplayAvailable = false) + fixture.options.screenshot.setMaskAllText(true) + val hint = Hint() + + CurrentActivityHolder.getInstance().setActivity(fixture.activity) + + val event = fixture.mainProcessor.process(getEvent(), hint) + sut.process(event, hint) + + assertNull(hint.screenshot) + } + + @Test + fun `when masking is configured from background thread, VH is captured on main thread`() { + fixture.options.screenshot.setMaskAllText(true) + val sut = fixture.getSut(attachScreenshot = true, isReplayAvailable = true) + whenever(fixture.threadChecker.isMainThread).thenReturn(false) + + CurrentActivityHolder.getInstance().setActivity(fixture.activity) + + val hint = Hint() + val event = fixture.mainProcessor.process(getEvent(), hint) + sut.process(event, hint) + + shadowOf(Looper.getMainLooper()).idle() + assertNotNull(hint.screenshot) + } + + // region Snapshot Tests + + @Test + fun `snapshot - screenshot without masking`() { + val bytes = processEventForSnapshots("screenshot_no_masking", isReplayAvailable = false) + assertNotNull(bytes) + } + + @Test + fun `snapshot - screenshot with text masking enabled`() { + val bytes = + processEventForSnapshots("screenshot_mask_text") { it.screenshot.setMaskAllText(true) } + assertNotNull(bytes) + } + + @Test + fun `snapshot - screenshot with image masking enabled`() { + val bytes = + processEventForSnapshots("screenshot_mask_images") { it.screenshot.setMaskAllImages(true) } + assertNotNull(bytes) + } + + @Test + fun `snapshot - screenshot with all masking enabled`() { + val bytes = + processEventForSnapshots("screenshot_mask_all") { + it.screenshot.setMaskAllText(true) + it.screenshot.setMaskAllImages(true) + } + assertNotNull(bytes) + } + + @Test + fun `snapshot - screenshot with custom view masking`() { + val bytes = + processEventForSnapshots("screenshot_mask_custom_view") { + // CustomView draws white, so masking it should draw black on top + it.screenshot.addMaskViewClass(CustomView::class.java.name) + } + assertNotNull(bytes) + } + + // endregion + private fun getEvent(): SentryEvent = SentryEvent(Throwable("Throwable")) + + /** + * Helper method for snapshot testing. Processes an event and captures a screenshot, then either + * saves it as a golden image (when RECORD_SNAPSHOTS=true) or compares it against an existing + * golden image. + * + * @param testName The name used for the golden image file (without extension) + * @param attachScreenshot Whether to enable screenshot attachment + * @param isReplayAvailable Whether the replay module is available (enables masking) + * @param configureOptions Lambda to configure additional options before processing + * @return The captured screenshot bytes, or null if no screenshot was captured + */ + private fun processEventForSnapshots( + testName: String, + attachScreenshot: Boolean = true, + isReplayAvailable: Boolean = true, + configureOptions: (SentryAndroidOptions) -> Unit = {}, + ): ByteArray? { + configureOptions(fixture.options) + val sut = fixture.getSut(attachScreenshot, isReplayAvailable) + val hint = Hint() + + CurrentActivityHolder.getInstance().setActivity(fixture.activity) + + val event = fixture.mainProcessor.process(getEvent(), hint) + sut.process(event, hint) + + val screenshot = hint.screenshot ?: return null + val bytes = screenshot.bytes ?: screenshot.byteProvider?.call() ?: return null + + val snapshotFile = File(SNAPSHOTS_DIR, "$testName.png") + if (RECORD_SNAPSHOTS) { + snapshotFile.writeBytes(bytes) + println("Recorded snapshot: ${snapshotFile.absolutePath}") + } else if (snapshotFile.exists()) { + val expectedBitmap = BitmapFactory.decodeFile(snapshotFile.absolutePath) + val actualBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) + + val result = + SimpleImageComparator(maxDistance = 0.01f) + .compare(BitmapImage(expectedBitmap), BitmapImage(actualBitmap)) + assertEquals( + 0, + result.pixelDifferences, + "Screenshot does not match golden image: ${snapshotFile.absolutePath}. " + + "Pixel differences: ${result.pixelDifferences}", + ) + } + + return bytes + } + + /** Adapter to wrap Android Bitmap for use with dropbox/differ library */ + private class BitmapImage(private val bitmap: Bitmap) : Image { + override val height: Int + get() = bitmap.height + + override val width: Int + get() = bitmap.width + + override fun getPixel(x: Int, y: Int): DifferColor = DifferColor(bitmap.getPixel(x, y)) + } +} + +private class CustomView(context: Context) : View(context) { + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + canvas.drawColor(Color.WHITE) + } +} + +private class MaskingActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val linearLayout = + LinearLayout(this).apply { + setBackgroundColor(android.R.color.white) + orientation = LinearLayout.VERTICAL + layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) + } + + val textView = + TextView(this).apply { + text = "Hello, World!" + layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) + } + linearLayout.addView(textView) + + val image = this::class.java.classLoader?.getResource("Tongariro.jpg")!! + val imageView = + ImageView(this).apply { + setImageDrawable(Drawable.createFromPath(image.path)) + layoutParams = LayoutParams(50, 50).apply { setMargins(0, 16, 0, 0) } + } + linearLayout.addView(imageView) + + val radioButton = + RadioButton(this).apply { + text = "Radio Button" + layoutParams = + LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 16, 0, 0) + } + } + linearLayout.addView(radioButton) + + val customView = + CustomView(this).apply { + layoutParams = LayoutParams(50, 50).apply { setMargins(0, 16, 0, 0) } + } + linearLayout.addView(customView) + + setContentView(linearLayout) + } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt new file mode 100644 index 00000000000..ad6d29b5614 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt @@ -0,0 +1,113 @@ +package io.sentry.android.core + +import io.sentry.SentryMaskingOptions +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class SentryScreenshotOptionsTest { + + @Test + fun `maskViewClasses is empty by default`() { + val options = SentryScreenshotOptions() + assertTrue(options.maskViewClasses.isEmpty()) + } + + @Test + fun `unmaskViewClasses is empty by default`() { + val options = SentryScreenshotOptions() + assertTrue(options.unmaskViewClasses.isEmpty()) + } + + @Test + fun `setMaskAllText true only adds TextView`() { + val options = SentryScreenshotOptions() + options.setMaskAllText(true) + + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + // Should NOT add sensitive view classes (only setMaskAllImages does that) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.WEB_VIEW_CLASS_NAME)) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.VIDEO_VIEW_CLASS_NAME)) + assertEquals(1, options.maskViewClasses.size) + } + + @Test + fun `setMaskAllImages true adds ImageView and sensitive view classes`() { + val options = SentryScreenshotOptions() + options.setMaskAllImages(true) + + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.WEB_VIEW_CLASS_NAME)) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.VIDEO_VIEW_CLASS_NAME)) + assertTrue( + options.maskViewClasses.contains(SentryMaskingOptions.CAMERAX_PREVIEW_VIEW_CLASS_NAME) + ) + assertTrue( + options.maskViewClasses.contains(SentryMaskingOptions.ANDROIDX_MEDIA_VIEW_CLASS_NAME) + ) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.EXOPLAYER_CLASS_NAME)) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.EXOPLAYER_STYLED_CLASS_NAME)) + } + + @Test + fun `setMaskAllImages false does not add sensitive view classes`() { + val options = SentryScreenshotOptions() + options.setMaskAllImages(false) + + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.WEB_VIEW_CLASS_NAME)) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.VIDEO_VIEW_CLASS_NAME)) + assertTrue(options.unmaskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + } + + @Test + fun `calling setMaskAllImages true multiple times does not duplicate classes`() { + val options = SentryScreenshotOptions() + options.setMaskAllImages(true) + options.setMaskAllImages(true) + options.setMaskAllImages(true) + + // CopyOnWriteArraySet should prevent duplicates + assertEquals(7, options.maskViewClasses.size) + } + + @Test + fun `inherits addMaskViewClass from base class`() { + val options = SentryScreenshotOptions() + options.addMaskViewClass("com.example.CustomView") + + assertTrue(options.maskViewClasses.contains("com.example.CustomView")) + } + + @Test + fun `inherits addUnmaskViewClass from base class`() { + val options = SentryScreenshotOptions() + options.addUnmaskViewClass("com.example.SafeView") + + assertTrue(options.unmaskViewClasses.contains("com.example.SafeView")) + } + + @Test + fun `inherits container class methods from base class`() { + val options = SentryScreenshotOptions() + options.setMaskViewContainerClass("com.example.MaskContainer") + options.setUnmaskViewContainerClass("com.example.UnmaskContainer") + + assertEquals("com.example.MaskContainer", options.maskViewContainerClass) + assertEquals("com.example.UnmaskContainer", options.unmaskViewContainerClass) + } + + @Test + fun `setMaskAllImages false removes sensitive view classes added by true`() { + val options = SentryScreenshotOptions() + options.setMaskAllImages(true) + + // Verify classes were added + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.WEB_VIEW_CLASS_NAME)) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.VIDEO_VIEW_CLASS_NAME)) + + options.setMaskAllImages(false) + + assertTrue(options.maskViewClasses.isEmpty()) + } +} diff --git a/sentry-android-core/src/test/resources/Tongariro.jpg b/sentry-android-core/src/test/resources/Tongariro.jpg new file mode 100644 index 0000000000000000000000000000000000000000..96e2f074f0d56243385f5d0a56972d54ffc9e333 GIT binary patch literal 239154 zcmeFaWmFtZyZ75;FbuB28QcjF971pl?(XgkP7;D!&_R*_NpKDB62mPC?hz~r1P>5` zgm<{_JkN9Qz0Tg}toQ4oS=IILtFG?4s;Uc^?)j~{n7vq%R!|IbaRdNWRW1My000g^ z2m%8zj0(XdB8*00@-R%I2EhOjCQra5nm-zi(HtPiUv@A?3t;?_m^>Sk1TmTnlec4% zODyy+pLZC|8uz!>h5$eWCh2KunqcZzmsjK!5#r|ub}>Ge_53TBwfC}hK&rbqIs2i! zygZOXeEdib4I4WbPd_hTXHGznUyxryKv05T6e++jAt)#zBnGem*%5z78-)q$$se7F z(M)lFM|)WV`yXwO(foh(Wh(^#M0jZjQn3N(Wx3!D0Z8iKEy}<+LI3D7j3&ZpY>ZDQ zMic+hJs3^$M~`4M2#xrwRg)MEM*kh#B1S|0*jF(c`bTeKH0+Ph0Y+n^|Bm@`RN#L! zMglm0G!aH4{`j9^{LyIe-!Wr)6O{L#_5y|2f5m|5bO7{6U-kp2=x-m41i*jvr5*AQ zJGAKUn4y@HVSntr7$2;E_`v_6asHtZ|ImV%>sF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ZB*>Rt19UWz6GAN^& xWnT_DccqQmN{D5df1g!q;*{a(Ucdj*|Jk_m*}DJ$ literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png new file mode 100644 index 0000000000000000000000000000000000000000..31ba5f581bcfc891c1c1eef20d9106580c53c0ae GIT binary patch literal 2673 zcmeAS@N?(olHy`uVBq!ia0y~yU~~ZDYaDDq5w`UKUw{;2age(c!@6@aFM%AEVkgfK z4j`!ENaAV-MMs$sSUc?7^m;Q1e~AyZv8h7-ayn0^m)krpzqabtItHe-+ie*f zqFDqwR2v+07+I1y6$HE)8Y7rEjtDs@Ok-f$h$8j+>U*0Xcjxw|HQc;*?b@xszh9f@ zw5!$}P`bsHxR_DIEy$D?=v5_vk5$~EEZ%T&Tk-V*RwSr)USX1=g*%`_e#6A!-=<*8T=D+ z4J2x|%Z3&GsB`5>EUhi)(y6omJnz7(S!@^VzueqozG2q2)qj}lIo=Ddkqd7W|M2hc z?``f3Qd{y;KNsZMA7IV6c5ANtcHJYPi4n4XjVOUzz?gr3Uv4$a0>{_uvh41>zP|pp z9Am}=(FaW1wr>Y9FO--|n7f?czIShI{QkP!YMup-mqix@KfKv?c;SzOT)*ClM6lF9 zvu(Wk^>W*a`(C!XVzws?%o`Y1p9xLCj6aN^MUD0K&;CA}f4ko1sto_9@Am(<*)nZ# zs@tjfs+jwJe~UoIp>oEWcMpG06ks|%qmJ#zrAOgkjndiX@q?oIb*O%|>eor>?6*>Z zkrEZ(Dtblh56^+io0$luDFSZ7krD~$dR_njbN+2(om|m6wg)dG8JRX-TOId}>y_$x zzAdML3DK1Ifp?7O-Xk*`pC<#O_s-uR-Sv6@FCNq3SF3Rlu9G~_`CQEDA@eK~a8SAm zkQ|iQoV_>d3+vyy{k!hw<>uywZoj>D)vAjbA>rZSrc%AHK7HCW@!+}h=cO&rt&-qt z&+TW>etxk3=$o%qTlep`@4ct9_~MFxzh1B3wR30X6^BFR_J%EKHX04PckllC?(XhY ztEBpmmlhTVUcY|*@`NYVY2?ufA4&=Toffe_Y%A^bGHVg9jZ$|8D;j{p8WH zr%zLXHiU*={rB&m&|}6wcE-#%-ha}vgEBwRG)NgLw5FH&I8d_Rg`}ak&f1I_Y*nwgr zz^EwOefjMMwco6In}pA7ui5;t?h*Uhhz#c|&CSi#`B`$n z_^zqhbA|VcaMF+ZMeJv*3mDXY{jCGV{jFQGjuqI*UB7xY^zNNIJ039Zk>F+*NC^F* zC4;YYCy=KQN&4EmckjX;tt^-~n_K4;FgKx=A_#RTbqCR=(?Zu)GYOt|x8#@>@B%9k t!u8yMx^?h}=BNv?H;)D;*?^=z1{!- literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png new file mode 100644 index 0000000000000000000000000000000000000000..217c73490cec235b4b9a07fb87fcc4c371a5f406 GIT binary patch literal 14948 zcmeIZWmJ@J+wVVwfTRd0-GWGmbcld}l!6M1ltW5)gMt#$pmazGDqTY}1SLA|G{^CsQ!!y{P80)4}(BhA?nJC&%Dw%XS|bX zM&4gtdCt`P9&JvY&1&J15sl+IsEOf=-An$StO&iyl#r}t#dY%b&1$%%NQe0&swH!- z9!-R5e64m)3hn(8XGJnfj_+UXDg>Jx_kG6dQAdQsN2(-bGeNkcr~}ypS*?*DdIj1U zr%!5rp2DutDl5PKai1u^*1);TUh)k> zO*y6u`4nc$^Y47DnB(R(X=Z?*6E*uXl3_3`P0)ec(gD9lyqcdM73zPJTm;~ zCmHh7M5UGMghi4w_Bx!fVyUuw{`@%%ZINX3NQl-?XA0&pBONJxzCaNuXU69x_V3@n951#F5FNfF zAyA9@tIM;>v$2s83--8QVHS=Jo8pzFNA(J$#fDaq!mAX4$L*9dnaE)`4u_R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`5P_=@>aL&rV=lX^EEEH+o#e0uK+5VOMQzto4#{kld*eITu;$a?SLpqkP=!hbDD zt!?A#>+4%(>COUPEtk9k03gkPX@fXT+1D_YJBIMwz5BJX(GPxf6@nkEh^5{DuLOo( zp+&$Qn4zSGFgqzUY-M#7i&+AC*S}>2;Q1h1fM-g4etWCd8?lR22m_`GlrJnC5#ITR zkdJ}*qd}P|4zNGoz6BAxi(O?;PfrqKQ41)O<$Mu8Qc-?nYXD&`Y(3H@en=^Gv*HL6le9B6 zwmWV~Ddn-o76#-JVe~fdkEOazb{DsGV(=_c4@R*z=#&*59M*W{cJ06ZT+#p5ef|3n zGkHe}t2U5@ZU&c8ut<8 literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_images.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_images.png new file mode 100644 index 0000000000000000000000000000000000000000..bd4378a9947ef6999486f1371bee3e56f596157c GIT binary patch literal 9353 zcmeHtcT`hp*Ke@Fh-GY`ATkaJ0|*SGfPeuz1f)pss0c`?214jyK?e|!(3Gn58bm;P z8AmAsL3$0Lhn9pMI(MJveO~Wa>a}ZSkJ;K(tM2Pv$>WN2 z`>9*>^ZvB61KDVCPWxkNTB>FL7d2~8;e^z!_7NZDnjqh zv+bd>?DC8_tyd@d3R#u!`U+3*sNnXXp7SKmvY~3rZlKuS-u`d8^n}^w21@d+TNCq4 zoT`c?xLy@beRy?_=%PWEOG{7h?!yVl36VQb&jdSC%5B%?M|c#yOG!058`unW3}zvn z556589VJio$~X@GMvEVE9}B@|RJ^emBYiG8sH_hCkL#qBmOo zc2dF=H&i;()pcO4hE0wg=^?&bWBfTcUmXbw3+rJ}Dx?Vv)0PBsVN_o%Ok9u}&t(Mg21#^incbhm(H-rn6Z!#*nvh~F1eTB-GY{<*x zfUSivKV2N|lPvY9-`Y)z?uHaWhv{O-*1Z+CMV#qrLU=QVs=UNRL@?|}&v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ZHGUY7QRipR-hcj_2vk2Ur2A+SRt|nCD=Ra+iUm0O5YCUl_bOx$ z`lxYZZ}d{6lFiw7Q=HUhTZixiTC=>qUQ!MV*3uY9Ul{8v^edp}C3c*m0364T{jKpP zJNpO+1b~P!HZbVI8Q*T84ge&8!s`U6B8Atlzf5b~X2m_)4xl>-AdoonXF1c{DQR`DC^`m6nMH%dIFlw#@$qx}#%5=2!m$tUB z@k^eWCT}j`>?DvSfdb{o2m7EVlFS5Sr?*QhD^o!@rQ;Lk_qDGsJZl@ygG5~Z42p63kQ4Z$bvN9eix0xI|E>U87l(%3xioD81SHEYNBkhwBQW&-|1s_U4{}fcV@&>k zeB!^#rMOT^PR_XK|COHl-x=#a>HAavb@~4n-%9&0tNxc&|Kt7I75f+1?UPfjac%Gw PPCPAjJ+(>|+ZX>0n>sh_ literal 0 HcmV?d00001 diff --git a/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro b/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro index 5de2dac4bdb..396c9025eaf 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro +++ b/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro @@ -40,4 +40,8 @@ -dontwarn org.mockito.internal.** -dontwarn org.jetbrains.annotations.** -dontwarn io.sentry.android.replay.ReplayIntegration +-dontwarn io.sentry.android.replay.util.MaskRenderer +-dontwarn io.sentry.android.replay.util.ViewsKt +-dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode$Companion +-dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode -keep class curtains.** { *; } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt index cca6fb35be4..ec3f36647c3 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt @@ -2,12 +2,7 @@ package io.sentry.android.replay.screenshot import android.annotation.SuppressLint import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.Color import android.graphics.Matrix -import android.graphics.Paint -import android.graphics.Rect -import android.graphics.RectF import android.view.PixelCopy import android.view.View import io.sentry.SentryLevel.DEBUG @@ -19,12 +14,10 @@ import io.sentry.android.replay.ScreenshotRecorderCallback import io.sentry.android.replay.ScreenshotRecorderConfig import io.sentry.android.replay.phoneWindow import io.sentry.android.replay.util.DebugOverlayDrawable +import io.sentry.android.replay.util.MaskRenderer import io.sentry.android.replay.util.ReplayRunnable -import io.sentry.android.replay.util.getVisibleRects import io.sentry.android.replay.util.traverse import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode -import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode -import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode import java.util.concurrent.atomic.AtomicBoolean import kotlin.LazyThreadSafetyMode.NONE @@ -39,15 +32,12 @@ internal class PixelCopyStrategy( private val executor = executorProvider.getExecutor() private val mainLooperHandler = executorProvider.getMainLooperHandler() - private val singlePixelBitmap: Bitmap by - lazy(NONE) { Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) } private val screenshot = Bitmap.createBitmap(config.recordingWidth, config.recordingHeight, Bitmap.Config.ARGB_8888) - private val singlePixelBitmapCanvas: Canvas by lazy(NONE) { Canvas(singlePixelBitmap) } private val prescaledMatrix by lazy(NONE) { Matrix().apply { preScale(config.scaleFactorX, config.scaleFactorY) } } private val lastCaptureSuccessful = AtomicBoolean(false) - private val maskingPaint by lazy(NONE) { Paint() } + private val maskRenderer = MaskRenderer() private val contentChanged = AtomicBoolean(false) private val isClosed = AtomicBoolean(false) @@ -90,8 +80,8 @@ internal class PixelCopyStrategy( } // TODO: disableAllMasking here and dont traverse? - val viewHierarchy = ViewHierarchyNode.fromView(root, null, 0, options) - root.traverse(viewHierarchy, options) + val viewHierarchy = ViewHierarchyNode.fromView(root, null, 0, options.sessionReplay) + root.traverse(viewHierarchy, options.sessionReplay, options.logger) executor.submit( ReplayRunnable("screenshot_recorder.mask") { @@ -100,51 +90,7 @@ internal class PixelCopyStrategy( return@ReplayRunnable } - val debugMasks = mutableListOf() - - val canvas = Canvas(screenshot) - canvas.setMatrix(prescaledMatrix) - viewHierarchy.traverse { node -> - if (node.shouldMask && (node.width > 0 && node.height > 0)) { - node.visibleRect ?: return@traverse false - - // TODO: investigate why it returns true on RN when it shouldn't - // if (viewHierarchy.isObscured(node)) { - // return@traverse true - // } - - val (visibleRects, color) = - when (node) { - is ImageViewHierarchyNode -> { - listOf(node.visibleRect) to - screenshot.dominantColorForRect(node.visibleRect) - } - - is TextViewHierarchyNode -> { - val textColor = - node.layout?.dominantTextColor ?: node.dominantColor ?: Color.BLACK - node.layout.getVisibleRects( - node.visibleRect, - node.paddingLeft, - node.paddingTop, - ) to textColor - } - - else -> { - listOf(node.visibleRect) to Color.BLACK - } - } - - maskingPaint.setColor(color) - visibleRects.forEach { rect -> - canvas.drawRoundRect(RectF(rect), 10f, 10f, maskingPaint) - } - if (options.replayController.isDebugMaskingOverlayEnabled()) { - debugMasks.addAll(visibleRects) - } - } - return@traverse true - } + val debugMasks = maskRenderer.renderMasks(screenshot, viewHierarchy, prescaledMatrix) if (options.replayController.isDebugMaskingOverlayEnabled()) { mainLooperHandler.post { @@ -196,35 +142,9 @@ internal class PixelCopyStrategy( } } } - // since singlePixelBitmap is only used in tasks within the single threaded executor - // there won't be any concurrent access - if (!singlePixelBitmap.isRecycled) { - singlePixelBitmap.recycle() - } + maskRenderer.close() }, ) ) } - - private fun Bitmap.dominantColorForRect(rect: Rect): Int { - if (isClosed.get() || this.isRecycled || singlePixelBitmap.isRecycled) { - return Color.BLACK - } - - // TODO: maybe this ceremony can be just simplified to - // TODO: multiplying the visibleRect by the prescaledMatrix - val visibleRect = Rect(rect) - val visibleRectF = RectF(visibleRect) - - // since we take screenshot with lower scale, we also - // have to apply the same scale to the visibleRect to get the - // correct screenshot part to determine the dominant color - prescaledMatrix.mapRect(visibleRectF) - // round it back to integer values, because drawBitmap below accepts Rect only - visibleRectF.round(visibleRect) - // draw part of the screenshot (visibleRect) to a single pixel bitmap - singlePixelBitmapCanvas.drawBitmap(this, visibleRect, Rect(0, 0, 1, 1), null) - // get the pixel color (= dominant color) - return singlePixelBitmap.getPixel(0, 0) - } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/MaskRenderer.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/MaskRenderer.kt new file mode 100644 index 00000000000..5e650c9f958 --- /dev/null +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/MaskRenderer.kt @@ -0,0 +1,118 @@ +package io.sentry.android.replay.util + +import android.annotation.SuppressLint +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Matrix +import android.graphics.Paint +import android.graphics.Rect +import android.graphics.RectF +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode +import java.io.Closeable +import kotlin.LazyThreadSafetyMode.NONE + +/** + * Shared utility for rendering masks on bitmaps based on view hierarchy. Used by both Session + * Replay (PixelCopyStrategy) and Screenshot masking. + */ +@SuppressLint("UseKtx") +internal class MaskRenderer : Closeable { + + private companion object { + private const val MASK_CORNER_RADIUS = 10f + } + + // Single pixel bitmap for dominant color sampling (averaging the region) + private val lazySinglePixelBitmap: Lazy = + lazy(NONE) { Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) } + internal val singlePixelBitmap: Bitmap by lazySinglePixelBitmap + private val singlePixelBitmapCanvas: Canvas by lazy(NONE) { Canvas(singlePixelBitmap) } + private val maskingPaint by lazy(NONE) { Paint() } + + /** + * Renders masks onto the given bitmap based on the view hierarchy. + * + * @param bitmap The bitmap to render masks onto (must be mutable) + * @param viewHierarchy The root node of the view hierarchy + * @param scaleMatrix Optional matrix for scaling (used by replay for lower resolution) + * @return List of masked rectangles (for debug overlay) + */ + fun renderMasks( + bitmap: Bitmap, + viewHierarchy: ViewHierarchyNode, + scaleMatrix: Matrix? = null, + ): List { + if (bitmap.isRecycled) { + return emptyList() + } + + val maskedRects = mutableListOf() + val canvas = Canvas(bitmap) + + scaleMatrix?.let { canvas.setMatrix(it) } + + viewHierarchy.traverse { node -> + if (node.shouldMask && node.width > 0 && node.height > 0) { + node.visibleRect ?: return@traverse false + + val (visibleRects, color) = + when (node) { + is ImageViewHierarchyNode -> { + listOf(node.visibleRect) to + dominantColorForRect(bitmap, node.visibleRect, scaleMatrix) + } + is TextViewHierarchyNode -> { + val textColor = node.layout?.dominantTextColor ?: node.dominantColor ?: Color.BLACK + node.layout.getVisibleRects(node.visibleRect, node.paddingLeft, node.paddingTop) to + textColor + } + else -> { + listOf(node.visibleRect) to Color.BLACK + } + } + + maskingPaint.color = color + visibleRects.forEach { rect -> + canvas.drawRoundRect(RectF(rect), MASK_CORNER_RADIUS, MASK_CORNER_RADIUS, maskingPaint) + } + maskedRects.addAll(visibleRects) + } + return@traverse true + } + + return maskedRects + } + + /** + * Samples the dominant color from a region of the bitmap by scaling the region down to a single + * pixel (averaging all colors in the region). + */ + private fun dominantColorForRect(bitmap: Bitmap, rect: Rect, scaleMatrix: Matrix? = null): Int { + if (bitmap.isRecycled || singlePixelBitmap.isRecycled) { + return Color.BLACK + } + + val visibleRect = Rect(rect) + val visibleRectF = RectF(visibleRect) + + // Apply scale matrix if provided (for replay's lower resolution) + scaleMatrix?.mapRect(visibleRectF) + visibleRectF.round(visibleRect) + + // Draw the region scaled down to 1x1 pixel (averages the colors) + singlePixelBitmapCanvas.drawBitmap(bitmap, visibleRect, Rect(0, 0, 1, 1), null) + + // Return the averaged color + return singlePixelBitmap.getPixel(0, 0) + } + + /** Releases resources. Call when done with this renderer. */ + override fun close() { + if (lazySinglePixelBitmap.isInitialized() && !singlePixelBitmap.isRecycled) { + singlePixelBitmap.recycle() + } + } +} diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt index aecc9b0456d..80ca1beee4e 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt @@ -19,7 +19,8 @@ import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver import android.widget.TextView -import io.sentry.SentryOptions +import io.sentry.ILogger +import io.sentry.SentryMaskingOptions import io.sentry.android.replay.viewhierarchy.ComposeViewHierarchyNode import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode import java.lang.NullPointerException @@ -27,14 +28,22 @@ import java.lang.NullPointerException /** * Recursively traverses the view hierarchy and creates a [ViewHierarchyNode] for each view. * Supports Compose view hierarchy as well. + * + * @param parentNode The parent node in the view hierarchy + * @param options The masking configuration to use + * @param logger Logger for error reporting during Compose traversal */ @SuppressLint("UseKtx") -internal fun View.traverse(parentNode: ViewHierarchyNode, options: SentryOptions) { +internal fun View.traverse( + parentNode: ViewHierarchyNode, + options: SentryMaskingOptions, + logger: ILogger, +) { if (this !is ViewGroup) { return } - if (ComposeViewHierarchyNode.fromView(this, parentNode, options)) { + if (ComposeViewHierarchyNode.fromView(this, parentNode, options, logger)) { // if it's a compose view, we can skip the children as they are already traversed in // the ComposeViewHierarchyNode.fromView method return @@ -50,7 +59,7 @@ internal fun View.traverse(parentNode: ViewHierarchyNode, options: SentryOptions if (child != null) { val childNode = ViewHierarchyNode.fromView(child, parentNode, indexOfChild(child), options) childNodes.add(childNode) - child.traverse(childNode, options) + child.traverse(childNode, options, logger) } } parentNode.children = childNodes diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index a24a40a2949..2e58418c3ac 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -17,9 +17,9 @@ import androidx.compose.ui.semantics.SemanticsProperties import androidx.compose.ui.semantics.getOrNull import androidx.compose.ui.text.TextLayoutResult import androidx.compose.ui.unit.TextUnit +import io.sentry.ILogger import io.sentry.SentryLevel -import io.sentry.SentryOptions -import io.sentry.SentryReplayOptions +import io.sentry.SentryMaskingOptions import io.sentry.android.replay.SentryReplayModifiers import io.sentry.android.replay.util.ComposeTextLayout import io.sentry.android.replay.util.boundsInWindow @@ -70,36 +70,36 @@ internal object ComposeViewHierarchyNode { */ private fun getProxyClassName(isImage: Boolean, config: SemanticsConfiguration?): String = when { - isImage -> SentryReplayOptions.IMAGE_VIEW_CLASS_NAME + isImage -> SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME config != null && (config.contains(SemanticsProperties.Text) || config.contains(SemanticsActions.SetText) || config.contains(SemanticsProperties.EditableText)) -> - SentryReplayOptions.TEXT_VIEW_CLASS_NAME + SentryMaskingOptions.TEXT_VIEW_CLASS_NAME else -> "android.view.View" } private fun SemanticsConfiguration?.shouldMask( isImage: Boolean, - options: SentryOptions, + options: SentryMaskingOptions, ): Boolean { val sentryPrivacyModifier = this?.getOrNull(SentryReplayModifiers.SentryPrivacy) if (sentryPrivacyModifier == "unmask") { - options.sessionReplay.trackCustomMasking() + options.trackCustomMasking() return false } if (sentryPrivacyModifier == "mask") { - options.sessionReplay.trackCustomMasking() + options.trackCustomMasking() return true } val className = getProxyClassName(isImage, this) - if (options.sessionReplay.unmaskViewClasses.contains(className)) { + if (options.unmaskViewClasses.contains(className)) { return false } - return options.sessionReplay.maskViewClasses.contains(className) + return options.maskViewClasses.contains(className) } @Suppress("ktlint:standard:backing-property-naming") @@ -110,7 +110,8 @@ internal object ComposeViewHierarchyNode { parent: ViewHierarchyNode?, distance: Int, isComposeRoot: Boolean, - options: SentryOptions, + options: SentryMaskingOptions, + logger: ILogger, ): ViewHierarchyNode? { val isInTree = node.isPlaced && node.isAttached if (!isInTree) { @@ -129,7 +130,7 @@ internal object ComposeViewHierarchyNode { } catch (t: Throwable) { if (!semanticsRetrievalErrorLogged) { semanticsRetrievalErrorLogged = true - options.logger.log( + logger.log( SentryLevel.ERROR, t, """ @@ -259,7 +260,12 @@ internal object ComposeViewHierarchyNode { } } - fun fromView(view: View, parent: ViewHierarchyNode?, options: SentryOptions): Boolean { + fun fromView( + view: View, + parent: ViewHierarchyNode?, + options: SentryMaskingOptions, + logger: ILogger, + ): Boolean { if (!view::class.java.name.contains("AndroidComposeView")) { return false } @@ -270,9 +276,9 @@ internal object ComposeViewHierarchyNode { try { val rootNode = (view as? Owner)?.root ?: return false - rootNode.traverse(parent, isComposeRoot = true, options) + rootNode.traverse(parent, isComposeRoot = true, options, logger) } catch (e: Throwable) { - options.logger.log( + logger.log( SentryLevel.ERROR, e, """ @@ -292,7 +298,8 @@ internal object ComposeViewHierarchyNode { private fun LayoutNode.traverse( parentNode: ViewHierarchyNode, isComposeRoot: Boolean, - options: SentryOptions, + options: SentryMaskingOptions, + logger: ILogger, ) { val children = this.children if (children.isEmpty()) { @@ -302,10 +309,10 @@ internal object ComposeViewHierarchyNode { val childNodes = ArrayList(children.size) for (index in children.indices) { val child = children[index] - val childNode = fromComposeNode(child, parentNode, index, isComposeRoot, options) + val childNode = fromComposeNode(child, parentNode, index, isComposeRoot, options, logger) if (childNode != null) { childNodes.add(childNode) - child.traverse(childNode, isComposeRoot = false, options) + child.traverse(childNode, isComposeRoot = false, options, logger) } } parentNode.children = childNodes diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt index 6b66bcef4bb..f54fa79da10 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt @@ -7,7 +7,7 @@ import android.view.View import android.view.ViewParent import android.widget.ImageView import android.widget.TextView -import io.sentry.SentryOptions +import io.sentry.SentryMaskingOptions import io.sentry.android.replay.R import io.sentry.android.replay.util.AndroidTextLayout import io.sentry.android.replay.util.TextLayout @@ -286,12 +286,12 @@ internal sealed class ViewHierarchyNode( return false } - private fun View.shouldMask(options: SentryOptions): Boolean { + private fun View.shouldMask(options: SentryMaskingOptions): Boolean { if ( (tag as? String)?.lowercase()?.contains(SENTRY_UNMASK_TAG) == true || getTag(R.id.sentry_privacy) == "unmask" ) { - options.sessionReplay.trackCustomMasking() + options.trackCustomMasking() return false } @@ -299,7 +299,7 @@ internal sealed class ViewHierarchyNode( (tag as? String)?.lowercase()?.contains(SENTRY_MASK_TAG) == true || getTag(R.id.sentry_privacy) == "mask" ) { - options.sessionReplay.trackCustomMasking() + options.trackCustomMasking() return true } @@ -311,28 +311,33 @@ internal sealed class ViewHierarchyNode( return false } - if (this.javaClass.isAssignableFrom(options.sessionReplay.unmaskViewClasses)) { + if (this.javaClass.isAssignableFrom(options.unmaskViewClasses)) { return false } - return this.javaClass.isAssignableFrom(options.sessionReplay.maskViewClasses) + return this.javaClass.isAssignableFrom(options.maskViewClasses) } - private fun ViewParent.isUnmaskContainer(options: SentryOptions): Boolean { - val unmaskContainer = options.sessionReplay.unmaskViewContainerClass ?: return false + private fun ViewParent.isUnmaskContainer(options: SentryMaskingOptions): Boolean { + val unmaskContainer = options.unmaskViewContainerClass ?: return false return this.javaClass.name == unmaskContainer } - private fun View.isMaskContainer(options: SentryOptions): Boolean { - val maskContainer = options.sessionReplay.maskViewContainerClass ?: return false + private fun View.isMaskContainer(options: SentryMaskingOptions): Boolean { + val maskContainer = options.maskViewContainerClass ?: return false return this.javaClass.name == maskContainer } + /** + * Creates a ViewHierarchyNode from a View using SentryMaskingOptions directly. This allows for + * reuse with both session replay and screenshot masking. + */ + @JvmStatic fun fromView( view: View, parent: ViewHierarchyNode?, distance: Int, - options: SentryOptions, + options: SentryMaskingOptions, ): ViewHierarchyNode { val (isVisible, visibleRect) = view.isVisibleToUser() val shouldMask = isVisible && view.shouldMask(options) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/util/MaskRendererTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/MaskRendererTest.kt new file mode 100644 index 00000000000..48b98b50c03 --- /dev/null +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/MaskRendererTest.kt @@ -0,0 +1,326 @@ +package io.sentry.android.replay.util + +import android.graphics.Bitmap +import android.graphics.Color +import android.graphics.Matrix +import android.graphics.Rect +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHierarchyNode +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue +import org.junit.runner.RunWith +import org.robolectric.annotation.Config + +@RunWith(AndroidJUnit4::class) +@Config(sdk = [30]) +class MaskRendererTest { + + @Test + fun `renderMasks returns empty list for recycled bitmap`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.recycle() + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertTrue(result.isEmpty()) + renderer.close() + } + + @Test + fun `renderMasks masks GenericViewHierarchyNode`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.WHITE) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(10, 10, 90, 90), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertEquals(1, result.size) + assertEquals(Rect(10, 10, 90, 90), result[0]) + renderer.close() + } + + @Test + fun `renderMasks masks ImageViewHierarchyNode with dominant color`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.RED) + + val imageNode = + ImageViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, imageNode, null) + + assertEquals(1, result.size) + renderer.close() + } + + @Test + fun `renderMasks masks TextViewHierarchyNode with text color`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.WHITE) + + val textNode = + TextViewHierarchyNode( + layout = null, + dominantColor = Color.BLUE, + paddingLeft = 0, + paddingTop = 0, + x = 0f, + y = 0f, + width = 100, + height = 50, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 100, 50), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, textNode, null) + + assertEquals(1, result.size) + renderer.close() + } + + @Test + fun `renderMasks skips nodes with shouldMask false`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = false, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertTrue(result.isEmpty()) + renderer.close() + } + + @Test + fun `renderMasks skips nodes with zero dimensions`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 0, + height = 0, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 0, 0), + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertTrue(result.isEmpty()) + renderer.close() + } + + @Test + fun `renderMasks skips nodes with null visibleRect`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = null, + ) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertTrue(result.isEmpty()) + renderer.close() + } + + @Test + fun `renderMasks applies scale matrix when provided`() { + val bitmap = Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.WHITE) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + + val scaleMatrix = Matrix().apply { preScale(0.5f, 0.5f) } + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, scaleMatrix) + + assertEquals(1, result.size) + renderer.close() + } + + @Test + fun `renderMasks traverses child nodes`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.WHITE) + + val childNode = + GenericViewHierarchyNode( + x = 10f, + y = 10f, + width = 30, + height = 30, + elevation = 0f, + distance = 1, + shouldMask = true, + isVisible = true, + visibleRect = Rect(10, 10, 40, 40), + ) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = false, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + rootNode.children = listOf(childNode) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertEquals(1, result.size) + assertEquals(Rect(10, 10, 40, 40), result[0]) + renderer.close() + } + + @Test + fun `renderMasks masks multiple nodes`() { + val bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + bitmap.eraseColor(Color.WHITE) + + val child1 = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 40, + height = 40, + elevation = 0f, + distance = 1, + shouldMask = true, + isVisible = true, + visibleRect = Rect(0, 0, 40, 40), + ) + + val child2 = + GenericViewHierarchyNode( + x = 50f, + y = 50f, + width = 40, + height = 40, + elevation = 0f, + distance = 2, + shouldMask = true, + isVisible = true, + visibleRect = Rect(50, 50, 90, 90), + ) + + val rootNode = + GenericViewHierarchyNode( + x = 0f, + y = 0f, + width = 100, + height = 100, + elevation = 0f, + distance = 0, + shouldMask = false, + isVisible = true, + visibleRect = Rect(0, 0, 100, 100), + ) + rootNode.children = listOf(child1, child2) + + val renderer = MaskRenderer() + val result = renderer.renderMasks(bitmap, rootNode, null) + + assertEquals(2, result.size) + renderer.close() + } + + @Test + fun `close recycles internal bitmap`() { + val renderer = MaskRenderer() + // Trigger lazy initialization + renderer.singlePixelBitmap + + renderer.close() + assertTrue(renderer.singlePixelBitmap.isRecycled) + } +} diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/util/TextViewDominantColorTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/TextViewDominantColorTest.kt index 44383330f1e..bdbf31aea1e 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/util/TextViewDominantColorTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/TextViewDominantColorTest.kt @@ -33,7 +33,13 @@ class TextViewDominantColorTest { TextViewActivity.textView?.setTextColor(Color.WHITE) - val node = ViewHierarchyNode.fromView(TextViewActivity.textView!!, null, 0, SentryOptions()) + val node = + ViewHierarchyNode.fromView( + TextViewActivity.textView!!, + null, + 0, + SentryOptions().sessionReplay, + ) assertTrue(node is TextViewHierarchyNode) assertNull(node.layout?.dominantTextColor) } @@ -53,7 +59,13 @@ class TextViewDominantColorTest { shadowOf(Looper.getMainLooper()).idle() - val node = ViewHierarchyNode.fromView(TextViewActivity.textView!!, null, 0, SentryOptions()) + val node = + ViewHierarchyNode.fromView( + TextViewActivity.textView!!, + null, + 0, + SentryOptions().sessionReplay, + ) assertTrue(node is TextViewHierarchyNode) assertEquals(Color.RED, node.layout?.dominantTextColor) } @@ -74,7 +86,13 @@ class TextViewDominantColorTest { shadowOf(Looper.getMainLooper()).idle() - val node = ViewHierarchyNode.fromView(TextViewActivity.textView!!, null, 0, SentryOptions()) + val node = + ViewHierarchyNode.fromView( + TextViewActivity.textView!!, + null, + 0, + SentryOptions().sessionReplay, + ) assertTrue(node is TextViewHierarchyNode) assertEquals(Color.BLACK, node.layout?.dominantTextColor) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt index f3483057a7f..801c8b6e12b 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt @@ -32,6 +32,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.test.ext.junit.runners.AndroidJUnit4 import coil.compose.AsyncImage +import io.sentry.NoOpLogger import io.sentry.SentryOptions import io.sentry.android.replay.maskAllImages import io.sentry.android.replay.maskAllText @@ -161,7 +162,12 @@ class ComposeMaskingOptionsTest { assertNotNull(composeView) val rootNode = GenericViewHierarchyNode(0f, 0f, 0, 0, 1.0f, -1, shouldMask = true) - ComposeViewHierarchyNode.fromView(composeView, rootNode, options) + ComposeViewHierarchyNode.fromView( + composeView, + rootNode, + options.sessionReplay, + NoOpLogger.getInstance(), + ) assertEquals(1, rootNode.children?.size) @@ -275,8 +281,8 @@ class ComposeMaskingOptionsTest { private inline fun Activity.collectNodesOfType(options: SentryOptions): List { val root = window.decorView - val viewHierarchy = ViewHierarchyNode.fromView(root, null, 0, options) - root.traverse(viewHierarchy, options) + val viewHierarchy = ViewHierarchyNode.fromView(root, null, 0, options.sessionReplay) + root.traverse(viewHierarchy, options.sessionReplay, NoOpLogger.getInstance()) val nodes = mutableListOf() viewHierarchy.traverse { diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt index ae9915cf42c..5d5304555ce 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt @@ -43,7 +43,12 @@ class ContainerMaskingOptionsTest { } val textNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.textViewInUnmask!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.textViewInUnmask!!, + null, + 0, + options.sessionReplay, + ) assertFalse(textNode.shouldMask) } @@ -58,7 +63,12 @@ class ContainerMaskingOptionsTest { } val imageNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.imageViewInUnmask!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.imageViewInUnmask!!, + null, + 0, + options.sessionReplay, + ) assertFalse(imageNode.shouldMask) } @@ -70,7 +80,12 @@ class ContainerMaskingOptionsTest { SentryOptions().apply { sessionReplay.setMaskViewContainerClass(CustomMask::class.java.name) } val maskContainer = - ViewHierarchyNode.fromView(MaskingOptionsActivity.maskWithChildren!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.maskWithChildren!!, + null, + 0, + options.sessionReplay, + ) assertTrue(maskContainer.shouldMask) } @@ -86,20 +101,25 @@ class ContainerMaskingOptionsTest { } val maskContainer = - ViewHierarchyNode.fromView(MaskingOptionsActivity.unmaskWithChildren!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.unmaskWithChildren!!, + null, + 0, + options.sessionReplay, + ) val firstChild = ViewHierarchyNode.fromView( MaskingOptionsActivity.customViewInUnmask!!, maskContainer, 0, - options, + options.sessionReplay, ) val secondLevelChild = ViewHierarchyNode.fromView( MaskingOptionsActivity.secondLayerChildInUnmask!!, firstChild, 0, - options, + options.sessionReplay, ) assertFalse(maskContainer.shouldMask) @@ -118,13 +138,18 @@ class ContainerMaskingOptionsTest { } val unmaskNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.unmaskWithMaskChild!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.unmaskWithMaskChild!!, + null, + 0, + options.sessionReplay, + ) val maskNode = ViewHierarchyNode.fromView( MaskingOptionsActivity.maskAsDirectChildOfUnmask!!, unmaskNode, 0, - options, + options.sessionReplay, ) assertFalse(unmaskNode.shouldMask) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/MaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/MaskingOptionsTest.kt index 87543555243..134359aeebe 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/MaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/MaskingOptionsTest.kt @@ -46,9 +46,15 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = true } - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) val radioButtonNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.radioButton!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.radioButton!!, + null, + 0, + options.sessionReplay, + ) assertTrue(textNode is TextViewHierarchyNode) assertTrue(textNode.shouldMask) @@ -64,9 +70,15 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = false } - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) val radioButtonNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.radioButton!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.radioButton!!, + null, + 0, + options.sessionReplay, + ) assertTrue(textNode is TextViewHierarchyNode) assertFalse(textNode.shouldMask) @@ -82,7 +94,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllImages = true } - val imageNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options) + val imageNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options.sessionReplay) assertTrue(imageNode is ImageViewHierarchyNode) assertTrue(imageNode.shouldMask) @@ -95,7 +108,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllImages = false } - val imageNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options) + val imageNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options.sessionReplay) assertTrue(imageNode is ImageViewHierarchyNode) assertFalse(imageNode.shouldMask) @@ -109,7 +123,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = false } MaskingOptionsActivity.textView!!.tag = "sentry-mask" - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) assertTrue(textNode.shouldMask) } @@ -122,7 +137,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = true } MaskingOptionsActivity.textView!!.tag = "sentry-unmask" - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) assertFalse(textNode.shouldMask) } @@ -135,7 +151,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = false } MaskingOptionsActivity.textView!!.sentryReplayMask() - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) assertTrue(textNode.shouldMask) } @@ -148,7 +165,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = true } MaskingOptionsActivity.textView!!.sentryReplayUnmask() - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) assertFalse(textNode.shouldMask) } @@ -161,7 +179,8 @@ class MaskingOptionsTest { val options = SentryOptions().apply { sessionReplay.maskAllText = true } MaskingOptionsActivity.textView!!.visibility = View.GONE - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) assertFalse(textNode.shouldMask) } @@ -177,7 +196,12 @@ class MaskingOptionsTest { } val customViewNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.customView!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.customView!!, + null, + 0, + options.sessionReplay, + ) assertTrue(customViewNode.shouldMask) } @@ -193,9 +217,15 @@ class MaskingOptionsTest { sessionReplay.unmaskViewClasses.add(RadioButton::class.java.canonicalName) } - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) val radioButtonNode = - ViewHierarchyNode.fromView(MaskingOptionsActivity.radioButton!!, null, 0, options) + ViewHierarchyNode.fromView( + MaskingOptionsActivity.radioButton!!, + null, + 0, + options.sessionReplay, + ) assertTrue(textNode.shouldMask) assertFalse(radioButtonNode.shouldMask) @@ -216,10 +246,12 @@ class MaskingOptionsTest { MaskingOptionsActivity.textView!!.parent as LinearLayout, null, 0, - options, + options.sessionReplay, ) - val textNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options) - val imageNode = ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options) + val textNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.textView!!, null, 0, options.sessionReplay) + val imageNode = + ViewHierarchyNode.fromView(MaskingOptionsActivity.imageView!!, null, 0, options.sessionReplay) assertFalse(linearLayoutNode.shouldMask) assertTrue(textNode.shouldMask) diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 0acecb4ccf3..690401e44e3 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -256,7 +256,13 @@ - + + diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index a043f8fe85c..4399b191d21 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3348,6 +3348,33 @@ public final class io/sentry/SentryLongDate : io/sentry/SentryDate { public fun nanoTimestamp ()J } +public abstract class io/sentry/SentryMaskingOptions { + public static final field ANDROIDX_MEDIA_VIEW_CLASS_NAME Ljava/lang/String; + public static final field CAMERAX_PREVIEW_VIEW_CLASS_NAME Ljava/lang/String; + public static final field EXOPLAYER_CLASS_NAME Ljava/lang/String; + public static final field EXOPLAYER_STYLED_CLASS_NAME Ljava/lang/String; + public static final field IMAGE_VIEW_CLASS_NAME Ljava/lang/String; + public static final field TEXT_VIEW_CLASS_NAME Ljava/lang/String; + public static final field VIDEO_VIEW_CLASS_NAME Ljava/lang/String; + public static final field WEB_VIEW_CLASS_NAME Ljava/lang/String; + protected field maskViewClasses Ljava/util/Set; + protected field maskViewContainerClass Ljava/lang/String; + protected field unmaskViewClasses Ljava/util/Set; + protected field unmaskViewContainerClass Ljava/lang/String; + public fun ()V + public fun addMaskViewClass (Ljava/lang/String;)V + public fun addUnmaskViewClass (Ljava/lang/String;)V + public fun getMaskViewClasses ()Ljava/util/Set; + public fun getMaskViewContainerClass ()Ljava/lang/String; + public fun getUnmaskViewClasses ()Ljava/util/Set; + public fun getUnmaskViewContainerClass ()Ljava/lang/String; + public fun setMaskAllImages (Z)V + public fun setMaskAllText (Z)V + public fun setMaskViewContainerClass (Ljava/lang/String;)V + public fun setUnmaskViewContainerClass (Ljava/lang/String;)V + public abstract fun trackCustomMasking ()V +} + public final class io/sentry/SentryMetricsEvent : io/sentry/JsonSerializable, io/sentry/JsonUnknown { public fun (Lio/sentry/protocol/SentryId;Lio/sentry/SentryDate;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Double;)V public fun (Lio/sentry/protocol/SentryId;Ljava/lang/Double;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Double;)V @@ -3902,24 +3929,14 @@ public final class io/sentry/SentryReplayEvent$ReplayType$Deserializer : io/sent public synthetic fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object; } -public final class io/sentry/SentryReplayOptions { - public static final field ANDROIDX_MEDIA_VIEW_CLASS_NAME Ljava/lang/String; - public static final field CAMERAX_PREVIEW_VIEW_CLASS_NAME Ljava/lang/String; - public static final field EXOPLAYER_CLASS_NAME Ljava/lang/String; - public static final field EXOPLAYER_STYLED_CLASS_NAME Ljava/lang/String; - public static final field IMAGE_VIEW_CLASS_NAME Ljava/lang/String; +public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOptions { public static final field MAX_NETWORK_BODY_SIZE I - public static final field TEXT_VIEW_CLASS_NAME Ljava/lang/String; - public static final field VIDEO_VIEW_CLASS_NAME Ljava/lang/String; - public static final field WEB_VIEW_CLASS_NAME Ljava/lang/String; public fun (Ljava/lang/Double;Ljava/lang/Double;Lio/sentry/protocol/SdkVersion;)V public fun (ZLio/sentry/protocol/SdkVersion;)V public fun addMaskViewClass (Ljava/lang/String;)V public fun addUnmaskViewClass (Ljava/lang/String;)V public fun getErrorReplayDuration ()J public fun getFrameRate ()I - public fun getMaskViewClasses ()Ljava/util/Set; - public fun getMaskViewContainerClass ()Ljava/lang/String; public fun getNetworkDetailAllowUrls ()Ljava/util/List; public fun getNetworkDetailDenyUrls ()Ljava/util/List; public static fun getNetworkDetailsDefaultHeaders ()Ljava/util/List; @@ -3932,8 +3949,6 @@ public final class io/sentry/SentryReplayOptions { public fun getSessionDuration ()J public fun getSessionSampleRate ()Ljava/lang/Double; public fun getSessionSegmentDuration ()J - public fun getUnmaskViewClasses ()Ljava/util/Set; - public fun getUnmaskViewContainerClass ()Ljava/lang/String; public fun isDebug ()Z public fun isNetworkCaptureBodies ()Z public fun isSessionReplayEnabled ()Z @@ -3942,7 +3957,6 @@ public final class io/sentry/SentryReplayOptions { public fun setDebug (Z)V public fun setMaskAllImages (Z)V public fun setMaskAllText (Z)V - public fun setMaskViewContainerClass (Ljava/lang/String;)V public fun setNetworkCaptureBodies (Z)V public fun setNetworkDetailAllowUrls (Ljava/util/List;)V public fun setNetworkDetailDenyUrls (Ljava/util/List;)V @@ -3954,7 +3968,6 @@ public final class io/sentry/SentryReplayOptions { public fun setSdkVersion (Lio/sentry/protocol/SdkVersion;)V public fun setSessionSampleRate (Ljava/lang/Double;)V public fun setTrackConfiguration (Z)V - public fun setUnmaskViewContainerClass (Ljava/lang/String;)V public fun trackCustomMasking ()V } diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index 374ecbfdb55..ee3d55f2291 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -441,6 +441,21 @@ public void close(final boolean isRestarting) { } } } + for (EventProcessor eventProcessor : getOptions().getEventProcessors()) { + if (eventProcessor instanceof Closeable) { + try { + ((Closeable) eventProcessor).close(); + } catch (Throwable e) { + getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Failed to close the event processor {}.", + eventProcessor, + e); + } + } + } configureScope(scope -> scope.clear()); configureScope(ScopeType.ISOLATION, scope -> scope.clear()); diff --git a/sentry/src/main/java/io/sentry/SentryMaskingOptions.java b/sentry/src/main/java/io/sentry/SentryMaskingOptions.java new file mode 100644 index 00000000000..dd7c5f9a304 --- /dev/null +++ b/sentry/src/main/java/io/sentry/SentryMaskingOptions.java @@ -0,0 +1,129 @@ +package io.sentry; + +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Base class for masking configuration used by both Session Replay and Screenshot features. + * Contains common settings for which view classes should be masked or unmasked. + */ +public abstract class SentryMaskingOptions { + + public static final String TEXT_VIEW_CLASS_NAME = "android.widget.TextView"; + public static final String IMAGE_VIEW_CLASS_NAME = "android.widget.ImageView"; + public static final String WEB_VIEW_CLASS_NAME = "android.webkit.WebView"; + public static final String VIDEO_VIEW_CLASS_NAME = "android.widget.VideoView"; + public static final String CAMERAX_PREVIEW_VIEW_CLASS_NAME = "androidx.camera.view.PreviewView"; + public static final String ANDROIDX_MEDIA_VIEW_CLASS_NAME = "androidx.media3.ui.PlayerView"; + public static final String EXOPLAYER_CLASS_NAME = "com.google.android.exoplayer2.ui.PlayerView"; + public static final String EXOPLAYER_STYLED_CLASS_NAME = + "com.google.android.exoplayer2.ui.StyledPlayerView"; + + /** + * Mask all views with the specified class names. The class name is the fully qualified class name + * of the view, e.g. android.widget.TextView. The subclasses of the specified classes will be + * masked as well. + * + *

If you're using an obfuscation tool, make sure to add the respective proguard rules to keep + * the class names. + * + *

Default is empty. + */ + protected Set maskViewClasses = new CopyOnWriteArraySet<>(); + + /** + * Ignore all views with the specified class names from masking. The class name is the fully + * qualified class name of the view, e.g. android.widget.TextView. The subclasses of the specified + * classes will be ignored as well. + * + *

If you're using an obfuscation tool, make sure to add the respective proguard rules to keep + * the class names. + * + *

Default is empty. + */ + protected Set unmaskViewClasses = new CopyOnWriteArraySet<>(); + + /** The class name of the view container that masks all of its children. */ + protected @Nullable String maskViewContainerClass = null; + + /** The class name of the view container that unmasks its direct children. */ + protected @Nullable String unmaskViewContainerClass = null; + + /** + * Mask all text content. Draws a rectangle of text bounds with text color on top. By default only + * views extending TextView are masked. + * + *

Default is enabled. + */ + public void setMaskAllText(final boolean maskAllText) { + if (maskAllText) { + maskViewClasses.add(TEXT_VIEW_CLASS_NAME); + unmaskViewClasses.remove(TEXT_VIEW_CLASS_NAME); + } else { + unmaskViewClasses.add(TEXT_VIEW_CLASS_NAME); + maskViewClasses.remove(TEXT_VIEW_CLASS_NAME); + } + } + + /** + * Mask all image content. Draws a rectangle of image bounds with image's dominant color on top. + * By default only views extending ImageView with BitmapDrawable or custom Drawable type are + * masked. ColorDrawable, InsetDrawable, VectorDrawable are all considered non-PII, as they come + * from the apk. + * + *

Default is enabled. + */ + public void setMaskAllImages(final boolean maskAllImages) { + if (maskAllImages) { + maskViewClasses.add(IMAGE_VIEW_CLASS_NAME); + unmaskViewClasses.remove(IMAGE_VIEW_CLASS_NAME); + } else { + unmaskViewClasses.add(IMAGE_VIEW_CLASS_NAME); + maskViewClasses.remove(IMAGE_VIEW_CLASS_NAME); + } + } + + @NotNull + public Set getMaskViewClasses() { + return this.maskViewClasses; + } + + public void addMaskViewClass(final @NotNull String className) { + this.maskViewClasses.add(className); + this.unmaskViewClasses.remove(className); + } + + @NotNull + public Set getUnmaskViewClasses() { + return this.unmaskViewClasses; + } + + public void addUnmaskViewClass(final @NotNull String className) { + this.unmaskViewClasses.add(className); + this.maskViewClasses.remove(className); + } + + public @Nullable String getMaskViewContainerClass() { + return maskViewContainerClass; + } + + public void setMaskViewContainerClass(@NotNull String containerClass) { + maskViewClasses.add(containerClass); + maskViewContainerClass = containerClass; + } + + public @Nullable String getUnmaskViewContainerClass() { + return unmaskViewContainerClass; + } + + public void setUnmaskViewContainerClass(@NotNull String containerClass) { + unmaskViewContainerClass = containerClass; + } + + /** Hook for subclasses to track custom masking usage. */ + @ApiStatus.Internal + public abstract void trackCustomMasking(); +} diff --git a/sentry/src/main/java/io/sentry/SentryReplayOptions.java b/sentry/src/main/java/io/sentry/SentryReplayOptions.java index cc8733fd824..3c618bfee9d 100644 --- a/sentry/src/main/java/io/sentry/SentryReplayOptions.java +++ b/sentry/src/main/java/io/sentry/SentryReplayOptions.java @@ -11,26 +11,15 @@ import java.util.List; import java.util.Locale; import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public final class SentryReplayOptions { +public final class SentryReplayOptions extends SentryMaskingOptions { private static final String CUSTOM_MASKING_INTEGRATION_NAME = "ReplayCustomMasking"; private volatile boolean customMaskingTracked = false; - public static final String TEXT_VIEW_CLASS_NAME = "android.widget.TextView"; - public static final String IMAGE_VIEW_CLASS_NAME = "android.widget.ImageView"; - public static final String WEB_VIEW_CLASS_NAME = "android.webkit.WebView"; - public static final String VIDEO_VIEW_CLASS_NAME = "android.widget.VideoView"; - public static final String CAMERAX_PREVIEW_VIEW_CLASS_NAME = "androidx.camera.view.PreviewView"; - public static final String ANDROIDX_MEDIA_VIEW_CLASS_NAME = "androidx.media3.ui.PlayerView"; - public static final String EXOPLAYER_CLASS_NAME = "com.google.android.exoplayer2.ui.PlayerView"; - public static final String EXOPLAYER_STYLED_CLASS_NAME = - "com.google.android.exoplayer2.ui.StyledPlayerView"; - /** * Maximum size in bytes for network request/response bodies to be captured in replays. Bodies * larger than this will be truncated or replaced with a placeholder message. Aligned If you're using an obfuscation tool, make sure to add the respective proguard rules to keep - * the class names. - * - *

Default is empty. - */ - private Set maskViewClasses = new CopyOnWriteArraySet<>(); - - /** - * Ignore all views with the specified class names from masking. The class name is the fully - * qualified class name of the view, e.g. android.widget.TextView. The subclasses of the specified - * classes will be ignored as well. - * - *

If you're using an obfuscation tool, make sure to add the respective proguard rules to keep - * the class names. - * - *

Default is empty. - */ - private Set unmaskViewClasses = new CopyOnWriteArraySet<>(); - - /** The class name of the view container that masks all of its children. */ - private @Nullable String maskViewContainerClass = null; - - /** The class name of the view container that unmasks its direct children. */ - private @Nullable String unmaskViewContainerClass = null; - /** * Defines the quality of the session replay. The higher the quality, the more accurate the replay * will be, but also more data to transfer and more CPU load, defaults to MEDIUM. @@ -276,60 +235,32 @@ public void setSessionSampleRate(final @Nullable Double sessionSampleRate) { this.sessionSampleRate = sessionSampleRate; } - /** - * Mask all text content. Draws a rectangle of text bounds with text color on top. By default only - * views extending TextView are masked. - * - *

Default is enabled. - */ + @Override public void setMaskAllText(final boolean maskAllText) { - if (maskAllText) { - maskViewClasses.add(TEXT_VIEW_CLASS_NAME); - unmaskViewClasses.remove(TEXT_VIEW_CLASS_NAME); - } else { + if (!maskAllText) { trackCustomMasking(); - unmaskViewClasses.add(TEXT_VIEW_CLASS_NAME); - maskViewClasses.remove(TEXT_VIEW_CLASS_NAME); } + super.setMaskAllText(maskAllText); } - /** - * Mask all image content. Draws a rectangle of image bounds with image's dominant color on top. - * By default only views extending ImageView with BitmapDrawable or custom Drawable type are - * masked. ColorDrawable, InsetDrawable, VectorDrawable are all considered non-PII, as they come - * from the apk. - * - *

Default is enabled. - */ + @Override public void setMaskAllImages(final boolean maskAllImages) { - if (maskAllImages) { - maskViewClasses.add(IMAGE_VIEW_CLASS_NAME); - unmaskViewClasses.remove(IMAGE_VIEW_CLASS_NAME); - } else { + if (!maskAllImages) { trackCustomMasking(); - unmaskViewClasses.add(IMAGE_VIEW_CLASS_NAME); - maskViewClasses.remove(IMAGE_VIEW_CLASS_NAME); } + super.setMaskAllImages(maskAllImages); } - @NotNull - public Set getMaskViewClasses() { - return this.maskViewClasses; - } - + @Override public void addMaskViewClass(final @NotNull String className) { trackCustomMasking(); - this.maskViewClasses.add(className); - } - - @NotNull - public Set getUnmaskViewClasses() { - return this.unmaskViewClasses; + super.addMaskViewClass(className); } + @Override public void addUnmaskViewClass(final @NotNull String className) { trackCustomMasking(); - this.unmaskViewClasses.add(className); + super.addUnmaskViewClass(className); } @ApiStatus.Internal @@ -361,28 +292,7 @@ public long getSessionDuration() { return sessionDuration; } - @ApiStatus.Internal - public void setMaskViewContainerClass(@NotNull String containerClass) { - maskViewClasses.add(containerClass); - maskViewContainerClass = containerClass; - } - - @ApiStatus.Internal - public void setUnmaskViewContainerClass(@NotNull String containerClass) { - unmaskViewContainerClass = containerClass; - } - - @ApiStatus.Internal - public @Nullable String getMaskViewContainerClass() { - return maskViewContainerClass; - } - - @ApiStatus.Internal - public @Nullable String getUnmaskViewContainerClass() { - return unmaskViewContainerClass; - } - - @ApiStatus.Internal + @Override public void trackCustomMasking() { if (!customMaskingTracked) { customMaskingTracked = true; diff --git a/sentry/src/test/java/io/sentry/SentryMaskingOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryMaskingOptionsTest.kt new file mode 100644 index 00000000000..9f661710dc7 --- /dev/null +++ b/sentry/src/test/java/io/sentry/SentryMaskingOptionsTest.kt @@ -0,0 +1,133 @@ +package io.sentry + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class SentryMaskingOptionsTest { + + private class TestMaskingOptions : SentryMaskingOptions() { + override fun trackCustomMasking() { + // no-op for tests + } + } + + @Test + fun `maskViewClasses is empty by default`() { + val options = TestMaskingOptions() + assertTrue(options.maskViewClasses.isEmpty()) + } + + @Test + fun `unmaskViewClasses is empty by default`() { + val options = TestMaskingOptions() + assertTrue(options.unmaskViewClasses.isEmpty()) + } + + @Test + fun `addMaskViewClass adds class to set`() { + val options = TestMaskingOptions() + options.addMaskViewClass("com.example.MyView") + assertTrue(options.maskViewClasses.contains("com.example.MyView")) + } + + @Test + fun `addUnmaskViewClass adds class to set`() { + val options = TestMaskingOptions() + options.addUnmaskViewClass("com.example.MyView") + assertTrue(options.unmaskViewClasses.contains("com.example.MyView")) + } + + @Test + fun `setMaskAllText true adds TextView to maskViewClasses`() { + val options = TestMaskingOptions() + options.setMaskAllText(true) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + assertFalse(options.unmaskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllText false adds TextView to unmaskViewClasses`() { + val options = TestMaskingOptions() + options.setMaskAllText(false) + assertTrue(options.unmaskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllText true removes TextView from unmaskViewClasses`() { + val options = TestMaskingOptions() + options.addUnmaskViewClass(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME) + options.setMaskAllText(true) + assertFalse(options.unmaskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllText false removes TextView from maskViewClasses`() { + val options = TestMaskingOptions() + options.addMaskViewClass(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME) + options.setMaskAllText(false) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.TEXT_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllImages true adds ImageView to maskViewClasses`() { + val options = TestMaskingOptions() + options.setMaskAllImages(true) + assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + assertFalse(options.unmaskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllImages false adds ImageView to unmaskViewClasses`() { + val options = TestMaskingOptions() + options.setMaskAllImages(false) + assertTrue(options.unmaskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllImages true removes ImageView from unmaskViewClasses`() { + val options = TestMaskingOptions() + options.addUnmaskViewClass(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME) + options.setMaskAllImages(true) + assertFalse(options.unmaskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + } + + @Test + fun `setMaskAllImages false removes ImageView from maskViewClasses`() { + val options = TestMaskingOptions() + options.addMaskViewClass(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME) + options.setMaskAllImages(false) + assertFalse(options.maskViewClasses.contains(SentryMaskingOptions.IMAGE_VIEW_CLASS_NAME)) + } + + @Test + fun `maskViewContainerClass is null by default`() { + val options = TestMaskingOptions() + assertNull(options.maskViewContainerClass) + } + + @Test + fun `unmaskViewContainerClass is null by default`() { + val options = TestMaskingOptions() + assertNull(options.unmaskViewContainerClass) + } + + @Test + fun `setMaskViewContainerClass sets container and adds to maskViewClasses`() { + val options = TestMaskingOptions() + options.setMaskViewContainerClass("com.example.Container") + assertEquals("com.example.Container", options.maskViewContainerClass) + assertTrue(options.maskViewClasses.contains("com.example.Container")) + } + + @Test + fun `setUnmaskViewContainerClass sets container`() { + val options = TestMaskingOptions() + options.setUnmaskViewContainerClass("com.example.Container") + assertEquals("com.example.Container", options.unmaskViewContainerClass) + } +} From 8f80cf43e0e83b9a3dc18f09ffa6e24606f12944 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 27 Feb 2026 13:06:28 +0100 Subject: [PATCH 009/391] fix(test): Fix flaky tests caused by SentryOptions.activate overriding executor service (#5125) Use NonOverridableNoOpSentryExecutorService instead of NoOpSentryExecutorService.getInstance() in tests, since the latter is a sentinel value that gets replaced during activate(). Co-authored-by: Claude Opus 4.6 --- sentry-test-support/api/sentry-test-support.api | 10 ++++++++++ .../src/main/kotlin/io/sentry/test/Mocks.kt | 15 +++++++++++++++ sentry/src/test/java/io/sentry/SentryTest.kt | 5 +++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/sentry-test-support/api/sentry-test-support.api b/sentry-test-support/api/sentry-test-support.api index 8bfaaeefef1..1d8ae671216 100644 --- a/sentry-test-support/api/sentry-test-support.api +++ b/sentry-test-support/api/sentry-test-support.api @@ -55,6 +55,16 @@ public final class io/sentry/test/MocksKt { public static synthetic fun createTestScopes$default (Lio/sentry/SentryOptions;ZLio/sentry/IScope;Lio/sentry/IScope;Lio/sentry/IScope;ILjava/lang/Object;)Lio/sentry/Scopes; } +public final class io/sentry/test/NonOverridableNoOpSentryExecutorService : io/sentry/ISentryExecutorService { + public fun ()V + public fun close (J)V + public fun isClosed ()Z + public fun prewarm ()V + public fun schedule (Ljava/lang/Runnable;J)Ljava/util/concurrent/Future; + public fun submit (Ljava/lang/Runnable;)Ljava/util/concurrent/Future; + public fun submit (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future; +} + public final class io/sentry/test/ReflectionKt { public static final fun collectInterfaceHierarchy (Ljava/lang/Class;)Ljava/util/List; public static final fun containsMethod (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Class;)Z diff --git a/sentry-test-support/src/main/kotlin/io/sentry/test/Mocks.kt b/sentry-test-support/src/main/kotlin/io/sentry/test/Mocks.kt index 09d5d181ec4..da69b7cf330 100644 --- a/sentry-test-support/src/main/kotlin/io/sentry/test/Mocks.kt +++ b/sentry-test-support/src/main/kotlin/io/sentry/test/Mocks.kt @@ -79,6 +79,21 @@ class DeferredExecutorService : ISentryExecutorService { fun hasScheduledRunnables(): Boolean = scheduledRunnables.isNotEmpty() } +class NonOverridableNoOpSentryExecutorService : ISentryExecutorService { + override fun submit(runnable: Runnable): Future<*> = FutureTask { null } + + override fun submit(callable: Callable): Future = FutureTask { null } + + override fun schedule(runnable: Runnable, delayMillis: Long): Future<*> = + FutureTask { null } + + override fun close(timeoutMillis: Long) {} + + override fun isClosed(): Boolean = false + + override fun prewarm() = Unit +} + fun createSentryClientMock(enabled: Boolean = true) = mock().also { val isEnabled = AtomicBoolean(enabled) diff --git a/sentry/src/test/java/io/sentry/SentryTest.kt b/sentry/src/test/java/io/sentry/SentryTest.kt index c94375735d2..72febe35665 100644 --- a/sentry/src/test/java/io/sentry/SentryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTest.kt @@ -17,6 +17,7 @@ import io.sentry.protocol.SdkVersion import io.sentry.protocol.SentryId import io.sentry.protocol.SentryThread import io.sentry.test.ImmediateExecutorService +import io.sentry.test.NonOverridableNoOpSentryExecutorService import io.sentry.test.createSentryClientMock import io.sentry.test.initForTest import io.sentry.test.injectForField @@ -1217,7 +1218,7 @@ class SentryTest { it.profilesSampleRate = 1.0 it.tracesSampler = mockSampleTracer it.profilesSampler = mockProfilesSampler - it.executorService = NoOpSentryExecutorService.getInstance() + it.executorService = NonOverridableNoOpSentryExecutorService() it.cacheDirPath = getTempPath() } // Samplers are called with isForNextAppStart flag set to true @@ -1236,7 +1237,7 @@ class SentryTest { it.profilesSampleRate = 1.0 it.tracesSampler = mockSampleTracer it.profilesSampler = mockProfilesSampler - it.executorService = NoOpSentryExecutorService.getInstance() + it.executorService = NonOverridableNoOpSentryExecutorService() it.cacheDirPath = null } // Samplers are called with isForNextAppStart flag set to true From 9dc12d16737ed80920af98e3be081edcbf7c99b6 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 27 Feb 2026 13:46:14 +0100 Subject: [PATCH 010/391] fix(test): Fix flaky MainEventProcessorTest by checking crashed thread (#5126) Assert stacktrace on the crashed thread instead of the first thread in the list, which may not be the crashed one depending on thread ordering. Co-authored-by: Claude Opus 4.6 --- sentry/src/test/java/io/sentry/MainEventProcessorTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt b/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt index 6fc2c8c243b..229fd571871 100644 --- a/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt +++ b/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt @@ -258,7 +258,7 @@ class MainEventProcessorTest { assertNotNull(event.threads) assertEquals(1, event.threads!!.count { it.isCrashed == true }) - assertNotNull(event.threads!!.first().stacktrace) + assertNotNull(event.threads!!.first { it.isCrashed == true }.stacktrace) } @Test From 6c03ee914c096859c7dc72cdeef0265ce28793ac Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 27 Feb 2026 17:02:46 +0100 Subject: [PATCH 011/391] feat(otel): Create `sentry-opentelemetry-otlp` module for combining OpenTelemetry SDK OTLP export with Sentry SDK (#5100) * Create sentry-opentelemetry-otlp module and OTLP sample for Spring Boot 4 * Format code * also set trace id and span id for logs and metrics * Format code * add console otlp sample; some missing things; cleanup * simplify usage by adding an SPI file and propagator provider class * changelog * adapt test to modifications from original console sample * add otel dependencies to otlp module so it is easier to use * add sentry-opentelemetry-otlp-spring module * update changelog * read sentry-trace header for sampled / non sampled TraceFlags * update opentelemetry.mdc to mention otlp-spring module * convert to api dependencies * only add baggage to context if actually present --------- Co-authored-by: Sentry Github Bot --- .craft.yml | 2 + .cursor/rules/opentelemetry.mdc | 9 + .github/workflows/system-tests-backend.yml | 6 + CHANGELOG.md | 4 + README.md | 2 + build.gradle.kts | 4 +- buildSrc/src/main/java/Config.kt | 2 + gradle/libs.versions.toml | 2 + .../README.md | 7 + .../build.gradle.kts | 22 ++ .../sentry-opentelemetry-otlp/README.md | 7 + .../api/sentry-opentelemetry-otlp.api | 22 ++ .../build.gradle.kts | 84 ++++++ .../otlp/OpenTelemetryOtlpEventProcessor.java | 120 +++++++++ .../otlp/OpenTelemetryOtlpPropagator.java | 129 +++++++++ .../OpenTelemetryOtlpPropagatorProvider.java | 17 ++ ...nfigure.spi.ConfigurablePropagatorProvider | 1 + .../test/kotlin/OtelSentryPropagatorTest.kt | 184 +++++++++++++ .../sentry-samples-console-otlp/README.md | 13 + .../api/sentry-samples-console-otlp.api | 5 + .../build.gradle.kts | 87 +++++++ .../java/io/sentry/samples/console/Main.java | 244 ++++++++++++++++++ .../src/test/kotlin/io/sentry/DummyTest.kt | 12 + .../ConsoleApplicationSystemTest.kt | 107 ++++++++ .../README.md | 122 +++++++++ .../build.gradle.kts | 101 ++++++++ .../boot4/otlp/CustomEventProcessor.java | 35 +++ .../samples/spring/boot4/otlp/CustomJob.java | 25 ++ .../otlp/DistributedTracingController.java | 49 ++++ .../spring/boot4/otlp/MetricController.java | 35 +++ .../samples/spring/boot4/otlp/Person.java | 24 ++ .../spring/boot4/otlp/PersonController.java | 51 ++++ .../spring/boot4/otlp/PersonService.java | 41 +++ .../boot4/otlp/SecurityConfiguration.java | 41 +++ .../boot4/otlp/SentryDemoApplication.java | 81 ++++++ .../samples/spring/boot4/otlp/Todo.java | 25 ++ .../spring/boot4/otlp/TodoController.java | 57 ++++ .../otlp/graphql/AssigneeController.java | 34 +++ .../otlp/graphql/GreetingController.java | 17 ++ .../boot4/otlp/graphql/ProjectController.java | 140 ++++++++++ .../otlp/graphql/TaskCreatorController.java | 50 ++++ .../spring/boot4/otlp/quartz/SampleJob.java | 19 ++ .../src/main/resources/application.properties | 53 ++++ .../main/resources/graphql/schema.graphqls | 68 +++++ .../src/main/resources/quartz.properties | 1 + .../src/main/resources/schema.sql | 5 + .../src/test/kotlin/io/sentry/DummyTest.kt | 12 + .../DistributedTracingSystemTest.kt | 197 ++++++++++++++ .../systemtest/GraphqlGreetingSystemTest.kt | 46 ++++ .../systemtest/GraphqlProjectSystemTest.kt | 66 +++++ .../systemtest/GraphqlTaskSystemTest.kt | 50 ++++ .../io/sentry/systemtest/MetricsSystemTest.kt | 49 ++++ .../io/sentry/systemtest/PersonSystemTest.kt | 96 +++++++ .../io/sentry/systemtest/TodoSystemTest.kt | 61 +++++ .../src/test/resources/logback.xml | 17 ++ settings.gradle.kts | 4 + test/system-test-runner.py | 2 + 57 files changed, 2765 insertions(+), 1 deletion(-) create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp-spring/README.md create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp-spring/build.gradle.kts create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/README.md create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/api/sentry-opentelemetry-otlp.api create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpEventProcessor.java create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagatorProvider.java create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider create mode 100644 sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt create mode 100644 sentry-samples/sentry-samples-console-otlp/README.md create mode 100644 sentry-samples/sentry-samples-console-otlp/api/sentry-samples-console-otlp.api create mode 100644 sentry-samples/sentry-samples-console-otlp/build.gradle.kts create mode 100644 sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java create mode 100644 sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/DummyTest.kt create mode 100644 sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/README.md create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomEventProcessor.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomJob.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/DistributedTracingController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/MetricController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Person.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Todo.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/GreetingController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/quartz/SampleJob.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/graphql/schema.graphqls create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/quartz.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/schema.sql create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/DummyTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/DistributedTracingSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/resources/logback.xml diff --git a/.craft.yml b/.craft.yml index 6f52255dd63..cb52926ad56 100644 --- a/.craft.yml +++ b/.craft.yml @@ -48,6 +48,8 @@ targets: maven:io.sentry:sentry-opentelemetry-agentless-spring: maven:io.sentry:sentry-opentelemetry-bootstrap: maven:io.sentry:sentry-opentelemetry-core: +# maven:io.sentry:sentry-opentelemetry-otlp: +# maven:io.sentry:sentry-opentelemetry-otlp-spring: maven:io.sentry:sentry-apollo: maven:io.sentry:sentry-jdbc: maven:io.sentry:sentry-graphql: diff --git a/.cursor/rules/opentelemetry.mdc b/.cursor/rules/opentelemetry.mdc index 7a94dcf58f4..4e773233f04 100644 --- a/.cursor/rules/opentelemetry.mdc +++ b/.cursor/rules/opentelemetry.mdc @@ -14,6 +14,8 @@ The Sentry Java SDK provides comprehensive OpenTelemetry integration through mul - `sentry-opentelemetry-agentless-spring`: Spring-specific agentless integration - `sentry-opentelemetry-bootstrap`: Classes that go into the bootstrap classloader when the agent is used. For agentless they are simply used in the applications classloader. - `sentry-opentelemetry-agentcustomization`: Classes that help wire up Sentry in OpenTelemetry. These land in the agent classloader when the agent is used. For agentless they are simply used in the application classloader. +- `sentry-opentelemetry-otlp`: Classes for using OpenTelemetry to send spans to Sentry using the OTLP endpoint and have Sentry use OpenTelemetry trace and span id. +- `sentry-opentelemetry-otlp-spring`: Spring Boot convenience module that includes `sentry-opentelemetry-otlp` and the OpenTelemetry Spring Boot starter as transitive dependencies. ## Advantages over using Sentry without OpenTelemetry @@ -86,3 +88,10 @@ After creating the transaction with child spans `SentrySpanExporter` uses Sentry ## Troubleshooting To debug forking of `Scopes`, we added a reference to `parent` `Scopes` and a `creator` String to store the reason why `Scopes` were created or forked. + +# OTLP +When using `sentry-opentelemetry-otlp`, Sentry only loads trace ID and span ID from OpenTelemetry `Context` (via `OpenTelemetryOtlpEventProcessor`). Sentry does not rely on OpenTelemetry `Context` for scope storage and propagation, instead relying on its `DefaultScopesStorage`. +It is common to keep Performance in Sentry SDK disabled since that part is taken over by OpenTelemetry. +The `sentry-opentelemetry-otlp` module is not connected to the other `sentry-opentelemetry-*` modules but instead intended only when the goal is to run OpenTelemetry for creating spans and Sentry for other products like errors, logs, metrics etc. +The `sentry-opentelemetry-otlp-spring` module wraps `sentry-opentelemetry-otlp` and includes the OpenTelemetry Spring Boot starter for easier setup in Spring Boot applications. +The OTLP module does not easily work with the OpenTelemetry agent as it would require customizing the agent.JAR in order to get the propagator loaded. diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 1e668577c93..641b49f6c85 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -54,6 +54,9 @@ jobs: - sample: "sentry-samples-console" agent: "false" agent-auto-init: "true" + - sample: "sentry-samples-console-otlp" + agent: "false" + agent-auto-init: "true" - sample: "sentry-samples-logback" agent: "false" agent-auto-init: "true" @@ -78,6 +81,9 @@ jobs: - sample: "sentry-samples-spring-boot-4-opentelemetry" agent: "true" agent-auto-init: "false" + - sample: "sentry-samples-spring-boot-4-otlp" + agent: "false" + agent-auto-init: "true" - sample: "sentry-samples-spring-7" agent: "false" agent-auto-init: "true" diff --git a/CHANGELOG.md b/CHANGELOG.md index b3de4ffc7e3..bf481f1cca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Features +- Create `sentry-opentelemetry-otlp` and `sentry-opentelemetry-otlp-spring` modules for combining OpenTelemetry SDK OTLP export with Sentry SDK ([#5100](https://github.com/getsentry/sentry-java/pull/5100)) + - OpenTelemetry is configured to send spans to Sentry directly using an OTLP endpoint. + - Sentry only uses trace and span ID from OpenTelemetry (via `OpenTelemetryOtlpEventProcessor`) but will not send spans through OpenTelemetry nor use OpenTelemetry `Context` for `Scopes` propagation. + - See the OTLP setup docs for [Java](https://docs.sentry.io/platforms/java/opentelemetry/setup/otlp/) and [Spring Boot](https://docs.sentry.io/platforms/java/guides/spring-boot/opentelemetry/setup/otlp/) for installation and configuration instructions. - Add screenshot masking support using view hierarchy ([#5077](https://github.com/getsentry/sentry-java/pull/5077)) - Masks sensitive content (text, images) in error screenshots using the same view hierarchy approach as Session Replay - Requires the `sentry-android-replay` module to be present at runtime for masking to work diff --git a/README.md b/README.md index ee32d485f42..31285e2be29 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Sentry SDK for Java and Android | sentry-opentelemetry-agent | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agent?style=for-the-badge&logo=sentry&color=green) | | sentry-opentelemetry-agentcustomization | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agentcustomization?style=for-the-badge&logo=sentry&color=green) | | sentry-opentelemetry-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-core?style=for-the-badge&logo=sentry&color=green) | +| sentry-opentelemetry-otlp | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp?style=for-the-badge&logo=sentry&color=green) | +| sentry-opentelemetry-otlp-spring | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp-spring?style=for-the-badge&logo=sentry&color=green) | | sentry-okhttp | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-okhttp?style=for-the-badge&logo=sentry&color=green) | | sentry-reactor | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-reactor?style=for-the-badge&logo=sentry&color=green) | | sentry-spotlight | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spotlight?style=for-the-badge&logo=sentry&color=green) | diff --git a/build.gradle.kts b/build.gradle.kts index b89b7deed10..376d0652832 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -77,6 +77,7 @@ apiValidation { "sentry-samples-spring-boot-4", "sentry-samples-spring-boot-4-opentelemetry", "sentry-samples-spring-boot-4-opentelemetry-noagent", + "sentry-samples-spring-boot-4-otlp", "sentry-samples-spring-boot-4-webflux", "sentry-samples-ktor-client", "sentry-uitest-android", @@ -85,7 +86,8 @@ apiValidation { "test-app-plain", "test-app-sentry", "test-app-size", - "sentry-samples-netflix-dgs" + "sentry-samples-netflix-dgs", + "sentry-samples-console-otlp" ) ) } diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 3b6a08ad26b..72892df5a9a 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -64,6 +64,8 @@ object Config { val SENTRY_SPRING_BOOT_4_STARTER_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.spring-boot-4-starter" val SENTRY_OPENTELEMETRY_BOOTSTRAP_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.bootstrap" val SENTRY_OPENTELEMETRY_CORE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.core" + val SENTRY_OPENTELEMETRY_OTLP_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.otlp" + val SENTRY_OPENTELEMETRY_OTLP_SPRING_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.otlp-spring" val SENTRY_OPENTELEMETRY_AGENT_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.agent" val SENTRY_OPENTELEMETRY_AGENTLESS_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.agentless" val SENTRY_OPENTELEMETRY_AGENTLESS_SPRING_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.opentelemetry.agentless-spring" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7e9a7af4840..d283b549895 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -134,6 +134,8 @@ okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" } openfeature = { module = "dev.openfeature:sdk", version.ref = "openfeature" } otel = { module = "io.opentelemetry:opentelemetry-sdk", version.ref = "otel" } +otel-exporter-otlp = { module = "io.opentelemetry:opentelemetry-exporter-otlp", version.ref = "otel" } +otel-exporter-logging = { module = "io.opentelemetry:opentelemetry-exporter-logging", version.ref = "otel" } otel-extension-autoconfigure = { module = "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure", version.ref = "otel" } otel-extension-autoconfigure-spi = { module = "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi", version.ref = "otel" } otel-instrumentation-bom = { module = "io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom", version.ref = "otelInstrumentation" } diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/README.md b/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/README.md new file mode 100644 index 00000000000..1ce3ced134a --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/README.md @@ -0,0 +1,7 @@ +# sentry-opentelemetry-otlp-spring + +This module combines `sentry-opentelemetry-otlp` with the OpenTelemetry Spring Boot Starter for a simpler setup in Spring Boot applications. + +It is intended for setups where OpenTelemetry handles tracing (with spans exported via OTLP to Sentry) while Sentry handles errors, logs, metrics, and other products. + +Please consult the documentation on how to install and use this integration in the [Sentry Docs for Java](https://docs.sentry.io/platforms/java/opentelemetry/setup/otlp/). diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/build.gradle.kts new file mode 100644 index 00000000000..1ff16cd0a31 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp-spring/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + `java-library` + id("io.sentry.javadoc") +} + +dependencies { + api(projects.sentryOpentelemetry.sentryOpentelemetryOtlp) + implementation(libs.springboot3.otel) +} + +tasks.jar { + manifest { + attributes( + "Sentry-Version-Name" to project.version, + "Sentry-SDK-Name" to Config.Sentry.SENTRY_OPENTELEMETRY_OTLP_SPRING_SDK_NAME, + "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-opentelemetry-otlp-spring", + "Implementation-Vendor" to "Sentry", + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + ) + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/README.md b/sentry-opentelemetry/sentry-opentelemetry-otlp/README.md new file mode 100644 index 00000000000..c729ce27629 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/README.md @@ -0,0 +1,7 @@ +# sentry-opentelemetry-otlp + +This module provides a lightweight integration for using OpenTelemetry alongside the Sentry SDK. It reads trace and span IDs from the OpenTelemetry `Context` so that Sentry events (errors, logs, metrics) are correlated with OpenTelemetry traces. + +Unlike the other `sentry-opentelemetry-*` modules, this module does not rely on OpenTelemetry for scope storage or span creation. It is intended for setups where OpenTelemetry handles performance/tracing and Sentry handles errors, logs, metrics, and other products. + +Please consult the documentation on how to install and use this integration in the [Sentry Docs for Java](https://docs.sentry.io/platforms/java/). diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/api/sentry-opentelemetry-otlp.api b/sentry-opentelemetry/sentry-opentelemetry-otlp/api/sentry-opentelemetry-otlp.api new file mode 100644 index 00000000000..56e80e60ae6 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/api/sentry-opentelemetry-otlp.api @@ -0,0 +1,22 @@ +public final class io/sentry/opentelemetry/otlp/OpenTelemetryOtlpEventProcessor : io/sentry/EventProcessor { + public fun ()V + public fun getOrder ()Ljava/lang/Long; + public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent; + public fun process (Lio/sentry/SentryLogEvent;)Lio/sentry/SentryLogEvent; + public fun process (Lio/sentry/SentryMetricsEvent;Lio/sentry/Hint;)Lio/sentry/SentryMetricsEvent; +} + +public final class io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator : io/opentelemetry/context/propagation/TextMapPropagator { + public static final field SENTRY_BAGGAGE_KEY Lio/opentelemetry/context/ContextKey; + public fun ()V + public fun extract (Lio/opentelemetry/context/Context;Ljava/lang/Object;Lio/opentelemetry/context/propagation/TextMapGetter;)Lio/opentelemetry/context/Context; + public fun fields ()Ljava/util/Collection; + public fun inject (Lio/opentelemetry/context/Context;Ljava/lang/Object;Lio/opentelemetry/context/propagation/TextMapSetter;)V +} + +public final class io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagatorProvider : io/opentelemetry/sdk/autoconfigure/spi/ConfigurablePropagatorProvider { + public fun ()V + public fun getName ()Ljava/lang/String; + public fun getPropagator (Lio/opentelemetry/sdk/autoconfigure/spi/ConfigProperties;)Lio/opentelemetry/context/propagation/TextMapPropagator; +} + diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts new file mode 100644 index 00000000000..f039b3c95ef --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts @@ -0,0 +1,84 @@ +import net.ltgt.gradle.errorprone.errorprone +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `java-library` + id("io.sentry.javadoc") + alias(libs.plugins.kotlin.jvm) + jacoco + alias(libs.plugins.errorprone) + alias(libs.plugins.gradle.versions) +} + +tasks.withType().configureEach { + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 +} + +dependencies { + api(projects.sentry) + + api(libs.otel) + api(libs.otel.extension.autoconfigure) + api(libs.otel.exporter.otlp) + compileOnly(libs.otel.extension.autoconfigure.spi) + // compileOnly(libs.otel.semconv) + // compileOnly(libs.otel.semconv.incubating) + + compileOnly(libs.jetbrains.annotations) + compileOnly(libs.nopen.annotations) + errorprone(libs.errorprone.core) + errorprone(libs.nopen.checker) + errorprone(libs.nullaway) + + // tests + testImplementation(projects.sentryTestSupport) + testImplementation(kotlin(Config.kotlinStdLib)) + testImplementation(libs.awaitility.kotlin) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.mockito.kotlin) + + testImplementation(libs.otel) + // testImplementation(libs.otel.semconv) + // testImplementation(libs.otel.semconv.incubating) +} + +configure { test { java.srcDir("src/test/java") } } + +jacoco { toolVersion = libs.versions.jacoco.get() } + +tasks.jacocoTestReport { + reports { + xml.required.set(true) + html.required.set(false) + } +} + +tasks { + jacocoTestCoverageVerification { + violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } + } + check { + dependsOn(jacocoTestCoverageVerification) + dependsOn(jacocoTestReport) + } +} + +tasks.withType().configureEach { + options.errorprone { + check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) + option("NullAway:AnnotatedPackages", "io.sentry") + } +} + +tasks.jar { + manifest { + attributes( + "Sentry-Version-Name" to project.version, + "Sentry-SDK-Name" to Config.Sentry.SENTRY_OPENTELEMETRY_OTLP_SDK_NAME, + "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-opentelemetry-otlp", + "Implementation-Vendor" to "Sentry", + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + ) + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpEventProcessor.java b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpEventProcessor.java new file mode 100644 index 00000000000..ad8b672c7de --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpEventProcessor.java @@ -0,0 +1,120 @@ +package io.sentry.opentelemetry.otlp; + +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanId; +import io.opentelemetry.api.trace.TraceId; +import io.sentry.EventProcessor; +import io.sentry.Hint; +import io.sentry.IScopes; +import io.sentry.ScopesAdapter; +import io.sentry.SentryEvent; +import io.sentry.SentryLevel; +import io.sentry.SentryLogEvent; +import io.sentry.SentryMetricsEvent; +import io.sentry.SpanContext; +import io.sentry.protocol.SentryId; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; + +public final class OpenTelemetryOtlpEventProcessor implements EventProcessor { + + private final @NotNull IScopes scopes; + + public OpenTelemetryOtlpEventProcessor() { + this(ScopesAdapter.getInstance()); + } + + @TestOnly + OpenTelemetryOtlpEventProcessor(final @NotNull IScopes scopes) { + this.scopes = scopes; + } + + @Override + public @Nullable SentryEvent process(final @NotNull SentryEvent event, final @NotNull Hint hint) { + @NotNull final Span otelSpan = Span.current(); + @NotNull final String traceId = otelSpan.getSpanContext().getTraceId(); + @NotNull final String spanId = otelSpan.getSpanContext().getSpanId(); + + if (TraceId.isValid(traceId) && SpanId.isValid(spanId)) { + final @NotNull SpanContext spanContext = + new SpanContext( + new SentryId(traceId), new io.sentry.SpanId(spanId), "opentelemetry", null, null); + + event.getContexts().setTrace(spanContext); + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, + "Linking Sentry event %s to span %s created via OpenTelemetry (trace %s).", + event.getEventId(), + spanId, + traceId); + } else { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, + "Not linking Sentry event %s to any transaction created via OpenTelemetry as traceId %s or spanId %s are invalid.", + event.getEventId(), + traceId, + spanId); + } + + return event; + } + + @Override + public @Nullable SentryLogEvent process(@NotNull SentryLogEvent event) { + @NotNull final Span otelSpan = Span.current(); + @NotNull final String traceId = otelSpan.getSpanContext().getTraceId(); + @NotNull final String spanId = otelSpan.getSpanContext().getSpanId(); + + if (TraceId.isValid(traceId) && SpanId.isValid(spanId)) { + event.setTraceId(new SentryId(traceId)); + event.setSpanId(new io.sentry.SpanId(spanId)); + } else { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, + "Not linking Sentry event to any transaction created via OpenTelemetry as traceId %s or spanId %s are invalid.", + traceId, + spanId); + } + + return event; + } + + @Override + public @Nullable SentryMetricsEvent process( + @NotNull SentryMetricsEvent event, @NotNull Hint hint) { + @NotNull final Span otelSpan = Span.current(); + @NotNull final String traceId = otelSpan.getSpanContext().getTraceId(); + @NotNull final String spanId = otelSpan.getSpanContext().getSpanId(); + + if (TraceId.isValid(traceId) && SpanId.isValid(spanId)) { + event.setTraceId(new SentryId(traceId)); + event.setSpanId(new io.sentry.SpanId(spanId)); + } else { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, + "Not linking Sentry event to any transaction created via OpenTelemetry as traceId %s or spanId %s are invalid.", + traceId, + spanId); + } + + return event; + } + + @Override + public @Nullable Long getOrder() { + return 6000L; + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java new file mode 100644 index 00000000000..e6bc31ca827 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java @@ -0,0 +1,129 @@ +package io.sentry.opentelemetry.otlp; + +import static io.sentry.SentryTraceHeader.SENTRY_TRACE_HEADER; + +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanContext; +import io.opentelemetry.api.trace.TraceFlags; +import io.opentelemetry.api.trace.TraceState; +import io.opentelemetry.context.Context; +import io.opentelemetry.context.ContextKey; +import io.opentelemetry.context.propagation.TextMapGetter; +import io.opentelemetry.context.propagation.TextMapPropagator; +import io.opentelemetry.context.propagation.TextMapSetter; +import io.sentry.Baggage; +import io.sentry.BaggageHeader; +import io.sentry.IScopes; +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.exception.InvalidSentryTraceHeaderException; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public final class OpenTelemetryOtlpPropagator implements TextMapPropagator { + + private static final @NotNull List FIELDS = + Arrays.asList(SENTRY_TRACE_HEADER, BaggageHeader.BAGGAGE_HEADER); + + public static final @NotNull ContextKey SENTRY_BAGGAGE_KEY = + ContextKey.named("sentry.baggage"); + private final @NotNull IScopes scopes; + + public OpenTelemetryOtlpPropagator() { + this(ScopesAdapter.getInstance()); + } + + OpenTelemetryOtlpPropagator(final @NotNull IScopes scopes) { + this.scopes = scopes; + } + + @Override + public Collection fields() { + return FIELDS; + } + + @Override + public void inject(final Context context, final C carrier, final TextMapSetter setter) { + final @NotNull Span otelSpan = Span.fromContext(context); + final @NotNull SpanContext otelSpanContext = otelSpan.getSpanContext(); + if (!otelSpanContext.isValid()) { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, + "Not injecting Sentry tracing information for invalid OpenTelemetry span."); + return; + } + + setter.set( + carrier, + SENTRY_TRACE_HEADER, + otelSpanContext.getTraceId() + + "-" + + otelSpanContext.getSpanId() + + "-" + + (otelSpanContext.isSampled() ? "1" : "0")); + + final @Nullable Baggage baggage = context.get(SENTRY_BAGGAGE_KEY); + if (baggage != null) { + setter.set(carrier, BaggageHeader.BAGGAGE_HEADER, baggage.toHeaderString(null)); + } + } + + @Override + public Context extract( + final Context context, final C carrier, final TextMapGetter getter) { + final @Nullable String sentryTraceString = getter.get(carrier, SENTRY_TRACE_HEADER); + if (sentryTraceString == null) { + return context; + } + + try { + SentryTraceHeader sentryTraceHeader = new SentryTraceHeader(sentryTraceString); + + final @Nullable String baggageString = getter.get(carrier, BaggageHeader.BAGGAGE_HEADER); + final @NotNull TraceState traceState = TraceState.getDefault(); + + final @NotNull TraceFlags traceFlags = + Boolean.FALSE.equals(sentryTraceHeader.isSampled()) + ? TraceFlags.getDefault() + : TraceFlags.getSampled(); + + SpanContext otelSpanContext = + SpanContext.createFromRemoteParent( + sentryTraceHeader.getTraceId().toString(), + sentryTraceHeader.getSpanId().toString(), + traceFlags, + traceState); + + Span wrappedSpan = Span.wrap(otelSpanContext); + + @NotNull Context modifiedContext = context.with(wrappedSpan); + if (baggageString != null) { + modifiedContext = + modifiedContext.with(SENTRY_BAGGAGE_KEY, Baggage.fromHeader(baggageString)); + } + + scopes + .getOptions() + .getLogger() + .log(SentryLevel.DEBUG, "Continuing Sentry trace %s", sentryTraceHeader.getTraceId()); + + return modifiedContext; + } catch (InvalidSentryTraceHeaderException e) { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.ERROR, + "Unable to extract Sentry tracing information from invalid header.", + e); + return context; + } + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagatorProvider.java b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagatorProvider.java new file mode 100644 index 00000000000..503729a750d --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagatorProvider.java @@ -0,0 +1,17 @@ +package io.sentry.opentelemetry.otlp; + +import io.opentelemetry.context.propagation.TextMapPropagator; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; + +public final class OpenTelemetryOtlpPropagatorProvider implements ConfigurablePropagatorProvider { + @Override + public TextMapPropagator getPropagator(ConfigProperties config) { + return new OpenTelemetryOtlpPropagator(); + } + + @Override + public String getName() { + return "sentry"; + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider new file mode 100644 index 00000000000..0bd359e1395 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider @@ -0,0 +1 @@ +io.sentry.opentelemetry.otlp.OpenTelemetryOtlpPropagatorProvider diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt new file mode 100644 index 00000000000..e9bfe26c11d --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -0,0 +1,184 @@ +package io.sentry.opentelemetry.otlp + +import io.opentelemetry.api.trace.Span +import io.opentelemetry.api.trace.SpanContext +import io.opentelemetry.api.trace.TraceFlags +import io.opentelemetry.api.trace.TraceState +import io.opentelemetry.context.Context +import io.opentelemetry.context.propagation.TextMapGetter +import io.opentelemetry.context.propagation.TextMapSetter +import io.sentry.Baggage +import io.sentry.Sentry +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class OpenTelemetryOtlpPropagatorTest { + + @BeforeTest + fun setup() { + Sentry.init("https://key@sentry.io/proj") + } + + @Test + fun `propagator registers for sentry-trace and baggage`() { + val propagator = OpenTelemetryOtlpPropagator() + assertEquals(listOf("sentry-trace", "baggage"), propagator.fields()) + } + + @Test + fun `invalid sentry trace header returns context without modification`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf( + "sentry-trace" to "wrong", + "baggage" to + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ) + val scopeInContext = Sentry.forkedRootScopes("test") + + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + val baggage = newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY) + assertNull(baggage) + } + + @Test + fun `uses incoming headers`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ) + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + val span = Span.fromContext(newContext) + assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) + assertEquals("424cffc8f94feeee", span.spanContext.spanId) + assertTrue(span.spanContext.isSampled) + + assertEquals( + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY)?.toHeaderString(null), + ) + } + + @Test + fun `extract does not store baggage in context when baggage header is missing`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1") + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + assertNull(newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY)) + } + + @Test + fun `does not inject baggage header when baggage is missing from context`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier = mutableMapOf() + + val otelSpanContext = + SpanContext.create( + "f9118105af4a2d42b4124532cd1065ff", + "424cffc8f94feeee", + TraceFlags.getSampled(), + TraceState.getDefault(), + ) + val otelSpan = Span.wrap(otelSpanContext) + val context = Context.root().with(otelSpan) + + propagator.inject(context, carrier, MapSetter()) + + assertEquals("f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", carrier["sentry-trace"]) + assertNull(carrier["baggage"]) + } + + @Test + fun `extract sets sampled trace flag when sentry-trace has sampled=0`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-0") + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + val span = Span.fromContext(newContext) + assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) + assertEquals("424cffc8f94feeee", span.spanContext.spanId) + assertFalse(span.spanContext.isSampled) + } + + @Test + fun `extract sets sampled trace flag when sentry-trace has no sampling decision`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee") + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + val span = Span.fromContext(newContext) + assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) + assertEquals("424cffc8f94feeee", span.spanContext.spanId) + assertTrue(span.spanContext.isSampled) + } + + @Test + fun `injects headers`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier = mutableMapOf() + + val otelSpanContext = + SpanContext.create( + "f9118105af4a2d42b4124532cd1065ff", + "424cffc8f94feeee", + TraceFlags.getSampled(), + TraceState.getDefault(), + ) + val otelSpan = Span.wrap(otelSpanContext) + + val context = + Context.root() + .with(otelSpan) + .with( + OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY, + Baggage.fromHeader( + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + ), + ) + + propagator.inject(context, carrier, MapSetter()) + + assertEquals("f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", carrier["sentry-trace"]) + assertEquals( + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + carrier["baggage"], + ) + } + + @Test + fun `does not inject headers if span is invalid`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier = mutableMapOf() + + propagator.inject(Context.root().with(Span.getInvalid()), carrier, MapSetter()) + + assertNull(carrier["sentry-trace"]) + assertNull(carrier["baggage"]) + } +} + +class MapGetter : TextMapGetter> { + override fun keys(carrier: Map): MutableIterable = + carrier.keys.toMutableList() + + override fun get(carrier: Map?, key: String): String? = carrier?.get(key) +} + +class MapSetter : TextMapSetter> { + override fun set(carrier: MutableMap?, key: String, value: String) { + carrier?.set(key, value) + } +} diff --git a/sentry-samples/sentry-samples-console-otlp/README.md b/sentry-samples/sentry-samples-console-otlp/README.md new file mode 100644 index 00000000000..a1e7314fdac --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/README.md @@ -0,0 +1,13 @@ +# Sentry Sample Console OTLP + +Sample application showing how to use Sentry with OTLP without any framework integration. + +## How to run? + +To see events triggered in this sample application in your Sentry dashboard, go to `src/main/java/io/sentry/samples/console/Main.java` and replace the test DSN with your own DSN. + +Then, execute a command from the module directory: + +``` +../../gradlew run +``` diff --git a/sentry-samples/sentry-samples-console-otlp/api/sentry-samples-console-otlp.api b/sentry-samples/sentry-samples-console-otlp/api/sentry-samples-console-otlp.api new file mode 100644 index 00000000000..867869223ea --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/api/sentry-samples-console-otlp.api @@ -0,0 +1,5 @@ +public class io/sentry/samples/console/Main { + public fun ()V + public static fun main ([Ljava/lang/String;)V +} + diff --git a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts new file mode 100644 index 00000000000..18836c89555 --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts @@ -0,0 +1,87 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + java + application + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.gradle.versions) + id("com.github.johnrengelman.shadow") version "8.1.1" +} + +application { mainClass.set("io.sentry.samples.console.Main") } + +java.sourceCompatibility = JavaVersion.VERSION_17 + +java.targetCompatibility = JavaVersion.VERSION_17 + +repositories { mavenCentral() } + +configure { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType().configureEach { + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 +} + +tasks.withType().configureEach { + kotlin { + compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +dependencies { + implementation(projects.sentryOpentelemetry.sentryOpentelemetryOtlp) + implementation(projects.sentryAsyncProfiler) + implementation(libs.otel.semconv) + implementation(libs.otel.semconv.incubating) + implementation(libs.otel.exporter.logging) + + testImplementation(kotlin(Config.kotlinStdLib)) + testImplementation(projects.sentry) + testImplementation(projects.sentrySystemTestSupport) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.slf4j.api) + testImplementation(libs.slf4j.jdk14) +} + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.console.Main" } + archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR + mergeServiceFiles() +} + +// Make the regular jar task depend on shadowJar +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +// Fix the startScripts task dependency +tasks.startScripts { dependsOn(tasks.shadowJar) } + +configure { test { java.srcDir("src/test/java") } } + +tasks.register("systemTest").configure { + group = "verification" + description = "Runs the System tests" + + outputs.upToDateWhen { false } + + maxParallelForks = 1 + + // Cap JVM args per test + minHeapSize = "128m" + maxHeapSize = "1g" + + filter { includeTestsMatching("io.sentry.systemtest*") } +} + +tasks.named("test").configure { + require(this is Test) + + filter { excludeTestsMatching("io.sentry.systemtest.*") } +} diff --git a/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java new file mode 100644 index 00000000000..d973a68a907 --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java @@ -0,0 +1,244 @@ +package io.sentry.samples.console; + +import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.context.Scope; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; +import io.sentry.*; +import io.sentry.clientreport.DiscardReason; +import io.sentry.opentelemetry.otlp.OpenTelemetryOtlpEventProcessor; +import io.sentry.protocol.Message; +import io.sentry.protocol.User; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class Main { + + private static long numberOfDiscardedSpansDueToOverflow = 0; + + public static void main(String[] args) throws InterruptedException { + // Configure OpenTelemetry SDK with Sentry OTLP propagator + AutoConfiguredOpenTelemetrySdk.builder() + .setResultAsGlobal() + .addPropertiesSupplier( + () -> { + final Map properties = new HashMap<>(); + properties.put("otel.logs.exporter", "none"); + properties.put("otel.metrics.exporter", "none"); + // OTLP traces exporter configuration + properties.put("otel.traces.exporter", "otlp,logging"); + properties.put( + "otel.exporter.otlp.traces.endpoint", + "https://o447951.ingest.us.sentry.io/api/5428563/integration/otlp/v1/traces"); + properties.put("otel.exporter.otlp.traces.protocol", "http/protobuf"); + properties.put( + "otel.exporter.otlp.traces.headers", + "x-sentry-auth=sentry sentry_key=502f25099c204a2fbf4cb16edc5975d1"); + properties.put("otel.propagators", "tracecontext,baggage,sentry"); + return properties; + }) + .build(); + + Sentry.init( + options -> { + // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in + // your Sentry project/dashboard + options.setEnableExternalConfiguration(true); + options.setDsn( + "https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); + + // All events get assigned to the release. See more at + // https://docs.sentry.io/workflow/releases/ + options.setRelease("io.sentry.samples.console@3.0.0+1"); + + // Link Sentry events to OpenTelemetry spans + options.addEventProcessor(new OpenTelemetryOtlpEventProcessor()); + + // Modifications to event before it goes out. Could replace the event altogether + options.setBeforeSend( + (event, hint) -> { + // Drop an event altogether: + if (event.getTag("SomeTag") != null) { + return null; + } + return event; + }); + + options.setBeforeSendTransaction( + (transaction, hint) -> { + // Drop a transaction: + if (transaction.getTag("SomeTransactionTag") != null) { + return null; + } + + return transaction; + }); + + // Allows inspecting and modifying, returning a new or simply rejecting (returning null) + options.setBeforeBreadcrumb( + (breadcrumb, hint) -> { + // Don't add breadcrumbs with message containing: + if (breadcrumb.getMessage() != null + && breadcrumb.getMessage().contains("bad breadcrumb")) { + return null; + } + return breadcrumb; + }); + + // Record data being discarded, including the reason, type of data, and the number of + // items dropped + options.setOnDiscard( + (reason, category, number) -> { + // Only record the number of lost spans due to overflow conditions + if ((reason.equals(DiscardReason.CACHE_OVERFLOW) + || reason.equals(DiscardReason.QUEUE_OVERFLOW)) + && category.equals(DataCategory.Span)) { + numberOfDiscardedSpansDueToOverflow += number; + } + }); + + // Configure the background worker which sends events to sentry: + // Wait up to 5 seconds before shutdown while there are events to send. + options.setShutdownTimeoutMillis(5000); + + // Enable SDK logging with Debug level + options.setDebug(true); + // To change the verbosity, use: + // By default it's DEBUG. + // options.setDiagnosticLevel(SentryLevel.ERROR); + // A good option to have SDK debug log in prod is to use only level ERROR here. + + // Exclude frames from some packages from being "inApp" so are hidden by default in Sentry + // UI: + options.addInAppExclude("org.jboss"); + + // Include frames from our package + options.addInAppInclude("io.sentry.samples"); + + // Performance configuration options + // Set what percentage of traces should be collected + // options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces + + // Determine traces sample rate based on the sampling context + // options.setTracesSampler( + // context -> { + // // only 10% of transactions with "/product" prefix will be collected + // if (!context.getTransactionContext().getName().startsWith("/products")) + // { + // return 0.1; + // } else { + // return 0.5; + // } + // }); + + options.getLogs().setEnabled(true); + }); + + Sentry.addBreadcrumb( + "A 'bad breadcrumb' that will be rejected because of 'BeforeBreadcrumb callback above.'"); + + // Data added to the root scope (no PushScope called up to this point) + // The modifications done here will affect all events sent and will propagate to child scopes. + Sentry.configureScope( + scope -> { + scope.addEventProcessor(new SomeEventProcessor()); + + scope.setExtra("SomeExtraInfo", "Some value for extra info"); + }); + + // Configures a scope which is only valid within the callback + Sentry.withScope( + scope -> { + scope.setLevel(SentryLevel.FATAL); + scope.setTransaction("main"); + + // This message includes the data set to the scope in this block: + Sentry.captureMessage("Fatal message!"); + }); + + // Only data added to the scope on `configureScope` above is included. + Sentry.captureMessage("Some warning!", SentryLevel.WARNING); + + Sentry.addFeatureFlag("my-feature-flag", true); + + captureMetrics(); + + // Sending exception: + Exception exception = new RuntimeException("Some error!"); + Sentry.captureException(exception); + + // An event with breadcrumb and user data + SentryEvent evt = new SentryEvent(); + Message msg = new Message(); + msg.setMessage("Detailed event"); + evt.setMessage(msg); + evt.addBreadcrumb("Breadcrumb directly to the event"); + User user = new User(); + user.setUsername("some@user"); + evt.setUser(user); + // Group all events with the following fingerprint: + evt.setFingerprints(Collections.singletonList("NewClientDebug")); + evt.setLevel(SentryLevel.DEBUG); + Sentry.captureEvent(evt); + + int count = 10; + for (int i = 0; i < count; i++) { + String messageContent = "%d of %d items we'll wait to flush to Sentry!"; + Message message = new Message(); + message.setMessage(messageContent); + message.setFormatted(String.format(messageContent, i, count)); + SentryEvent event = new SentryEvent(); + event.setMessage(message); + + final Hint hint = new Hint(); + hint.set("level", SentryLevel.DEBUG); + Sentry.captureEvent(event, hint); + } + + // Create an OpenTelemetry span that will be linked to the Sentry trace + Span otelSpan = + GlobalOpenTelemetry.get() + .getTracer("demoTracer", "1.0.0") + .spanBuilder("otelSpan") + .startSpan(); + try (Scope innerScope = otelSpan.makeCurrent()) { + otelSpan.setAttribute("otel-attribute", "attribute-value"); + + // Every SentryEvent reported during the execution of the transaction or a span, will have + // trace + // context attached + Sentry.captureMessage("this message is connected to the outerSpan"); + + Sentry.logger().error("Some error log message"); + Sentry.metrics().count("invocations"); + + otelSpan.setStatus(StatusCode.OK); + } finally { + otelSpan.end(); + } + + // All events that have not been sent yet are being flushed on JVM exit. Events can be also + // flushed manually: + // Sentry.close(); + } + + private static void captureMetrics() { + Sentry.metrics().count("countMetric"); + Sentry.metrics().gauge("gaugeMetric", 5.0); + Sentry.metrics().distribution("distributionMetric", 7.0); + } + + private static class SomeEventProcessor implements EventProcessor { + @Override + public SentryEvent process(SentryEvent event, Hint hint) { + // Here you can modify the event as you need + if (event.getLevel() != null && event.getLevel().ordinal() > SentryLevel.INFO.ordinal()) { + event.addBreadcrumb(new Breadcrumb("Processed by " + SomeEventProcessor.class)); + } + + return event; + } + } +} diff --git a/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/DummyTest.kt b/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/DummyTest.kt new file mode 100644 index 00000000000..6f762b7e453 --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/DummyTest.kt @@ -0,0 +1,12 @@ +package io.sentry + +import kotlin.test.Test +import kotlin.test.assertTrue + +class DummyTest { + @Test + fun `the only test`() { + // only needed to have more than 0 tests and not fail the build + assertTrue(true) + } +} diff --git a/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt new file mode 100644 index 00000000000..1333fa50387 --- /dev/null +++ b/sentry-samples/sentry-samples-console-otlp/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -0,0 +1,107 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import java.util.concurrent.TimeUnit +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test + +class ConsoleApplicationSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8000") + testHelper.reset() + } + + @Test + fun `console application sends expected events when run as JAR`() { + val jarFile = testHelper.findJar("sentry-samples-console-otlp") + val process = + testHelper.launch( + jarFile, + mapOf( + "SENTRY_DSN" to testHelper.dsn, + "SENTRY_ENABLE_PRETTY_SERIALIZATION_OUTPUT" to "false", + "SENTRY_DEBUG" to "true", + ), + ) + + process.waitFor(30, TimeUnit.SECONDS) + assertEquals(0, process.exitValue()) + + // Verify that we received the expected events + verifyExpectedEvents() + } + + private fun verifyExpectedEvents() { + // Verify we received a "Fatal message!" event + testHelper.ensureErrorReceived { event -> + event.message?.formatted == "Fatal message!" && event.level?.name == "FATAL" + } + + // Verify we received a "Some warning!" event + testHelper.ensureErrorReceived { event -> + event.message?.formatted == "Some warning!" && event.level?.name == "WARNING" + } + + // Verify we received the RuntimeException + testHelper.ensureErrorReceived { event -> + event.exceptions?.any { ex -> ex.type == "RuntimeException" && ex.value == "Some error!" } == + true && testHelper.doesEventHaveFlag(event, "my-feature-flag", true) + } + + // Verify we received the detailed event with fingerprint + testHelper.ensureErrorReceived { event -> + event.message?.message == "Detailed event" && + event.fingerprints?.contains("NewClientDebug") == true && + event.level?.name == "DEBUG" + } + + // Verify we received the loop messages (should be 10 of them) + var loopMessageCount = 0 + try { + for (i in 0..9) { + testHelper.ensureErrorReceived { event -> + val matches = + event.message?.message?.contains("items we'll wait to flush to Sentry!") == true + if (matches) loopMessageCount++ + matches + } + } + } catch (e: Exception) { + // Some loop messages might be missing, but we should have at least some + } + + assertTrue( + "Should receive at least 5 loop messages, got $loopMessageCount", + loopMessageCount >= 5, + ) + + // Verify we received the message captured within the OTel span + testHelper.ensureErrorReceived { event -> + event.message?.formatted == "this message is connected to the outerSpan" + } + + // Verify we have breadcrumbs + testHelper.ensureErrorReceived { event -> + event.breadcrumbs?.any { breadcrumb -> + breadcrumb.message?.contains("Processed by") == true + } == true + } + + testHelper.ensureMetricsReceived { metricsEvents, sentryEnvelopeHeader -> + testHelper.doesContainMetric(metricsEvents, "countMetric", "counter", 1.0) && + testHelper.doesContainMetric(metricsEvents, "gaugeMetric", "gauge", 5.0) && + testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) && + testHelper.doesContainMetric(metricsEvents, "invocations", "counter", 1.0) + } + + // Verify we received the log message captured within the OTel span + testHelper.ensureLogsReceived { logs, _ -> + testHelper.doesContainLogWithBody(logs, "Some error log message") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/README.md b/sentry-samples/sentry-samples-spring-boot-4-otlp/README.md new file mode 100644 index 00000000000..58b94ba8997 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/README.md @@ -0,0 +1,122 @@ +# Sentry Sample Spring Boot 3.0+ + +Sample application showing how to use Sentry with [Spring boot](http://spring.io/projects/spring-boot) from version `3.0` onwards. + +## How to run? + +To see events triggered in this sample application in your Sentry dashboard, go to `src/main/resources/application.properties` and replace the test DSN with your own DSN. + +Then, execute a command from the module directory: + +``` +../../gradlew bootRun +``` + +Make an HTTP request that will trigger events: + +``` +curl -XPOST --user user:password http://localhost:8080/person/ -H "Content-Type:application/json" -d '{"firstName":"John","lastName":"Smith"}' +``` + +## GraphQL + +The following queries can be used to test the GraphQL integration. + +### Greeting +``` +{ + greeting(name: "crash") +} +``` + +### Greeting with variables + +``` +query GreetingQuery($name: String) { + greeting(name: $name) +} +``` +variables: +``` +{ + "name": "crash" +} +``` + +### Project + +``` +query ProjectQuery($slug: ID!) { + project(slug: $slug) { + slug + name + repositoryUrl + status + } +} +``` +variables: +``` +{ + "slug": "statuscrash" +} +``` + +### Mutation + +``` +mutation AddProjectMutation($slug: ID!) { + addProject(slug: $slug) +} +``` +variables: +``` +{ + "slug": "nocrash", + "name": "nocrash" +} +``` + +### Subscription + +``` +subscription SubscriptionNotifyNewTask($slug: ID!) { + notifyNewTask(projectSlug: $slug) { + id + name + assigneeId + assignee { + id + name + } + } +} +``` +variables: +``` +{ + "slug": "crash" +} +``` + +### Data loader + +``` +query TasksAndAssigneesQuery($slug: ID!) { + tasks(projectSlug: $slug) { + id + name + assigneeId + assignee { + id + name + } + } +} +``` +variables: +``` +{ + "slug": "crash" +} +``` diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts new file mode 100644 index 00000000000..4f3d64524fd --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -0,0 +1,101 @@ +import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + alias(libs.plugins.springboot4) + alias(libs.plugins.spring.dependency.management) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.spring) +} + +group = "io.sentry.sample.spring-boot-4-otlp" + +version = "0.0.1-SNAPSHOT" + +java.sourceCompatibility = JavaVersion.VERSION_17 + +java.targetCompatibility = JavaVersion.VERSION_17 + +repositories { mavenCentral() } + +configure { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType().configureEach { + kotlin { + explicitApi() + // skip metadata version check, as Spring 7 / Spring Boot 4 is + // compiled against a newer version of Kotlin + compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict", "-Xskip-metadata-version-check") + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + } +} + +dependencies { + implementation(libs.springboot4.starter) + implementation(libs.springboot4.starter.actuator) + implementation(libs.springboot4.starter.aspectj) + implementation(libs.springboot4.starter.graphql) + implementation(libs.springboot4.starter.jdbc) + implementation(libs.springboot4.starter.quartz) + implementation(libs.springboot4.starter.security) + implementation(libs.springboot4.starter.web) + implementation(libs.springboot4.starter.webflux) + implementation(libs.springboot4.starter.websocket) + implementation(libs.springboot4.starter.restclient) + implementation(libs.springboot4.starter.webclient) + implementation(Config.Libs.aspectj) + implementation(Config.Libs.kotlinReflect) + implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) + implementation(projects.sentrySpringBoot4Starter) + implementation(projects.sentryLogback) + implementation(projects.sentryGraphql22) + implementation(projects.sentryQuartz) + implementation(projects.sentryAsyncProfiler) + implementation(projects.sentryOpentelemetry.sentryOpentelemetryOtlpSpring) + + // database query tracing + implementation(projects.sentryJdbc) + runtimeOnly(libs.hsqldb) + + testImplementation(kotlin(Config.kotlinStdLib)) + testImplementation(projects.sentry) + testImplementation(projects.sentrySystemTestSupport) + testImplementation(libs.apollo3.kotlin) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.slf4j2.api) + testImplementation(libs.springboot4.starter.test) { + exclude(group = "org.junit.vintage", module = "junit-vintage-engine") + } + testImplementation("ch.qos.logback:logback-classic:1.5.16") + testImplementation("ch.qos.logback:logback-core:1.5.16") +} + +dependencyManagement { imports { mavenBom(libs.otel.instrumentation.bom.get().toString()) } } + +configure { test { java.srcDir("src/test/java") } } + +tasks.register("systemTest").configure { + group = "verification" + description = "Runs the System tests" + + outputs.upToDateWhen { false } + + maxParallelForks = 1 + + // Cap JVM args per test + minHeapSize = "128m" + maxHeapSize = "1g" + + filter { includeTestsMatching("io.sentry.systemtest*") } +} + +tasks.named("test").configure { + require(this is Test) + + filter { excludeTestsMatching("io.sentry.systemtest.*") } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomEventProcessor.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomEventProcessor.java new file mode 100644 index 00000000000..14df61c652f --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomEventProcessor.java @@ -0,0 +1,35 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.EventProcessor; +import io.sentry.Hint; +import io.sentry.SentryEvent; +import io.sentry.protocol.SentryRuntime; +import org.jetbrains.annotations.NotNull; +import org.springframework.boot.SpringBootVersion; +import org.springframework.stereotype.Component; + +/** + * Custom {@link EventProcessor} implementation lets modifying {@link SentryEvent}s before they are + * sent to Sentry. + */ +@Component +public class CustomEventProcessor implements EventProcessor { + private final String springBootVersion; + + public CustomEventProcessor(String springBootVersion) { + this.springBootVersion = springBootVersion; + } + + public CustomEventProcessor() { + this(SpringBootVersion.getVersion()); + } + + @Override + public @NotNull SentryEvent process(@NotNull SentryEvent event, @NotNull Hint hint) { + final SentryRuntime runtime = new SentryRuntime(); + runtime.setVersion(springBootVersion); + runtime.setName("Spring Boot"); + event.getContexts().setRuntime(runtime); + return event; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomJob.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomJob.java new file mode 100644 index 00000000000..6e6df9b2e2a --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CustomJob.java @@ -0,0 +1,25 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.spring7.checkin.SentryCheckIn; +import io.sentry.spring7.tracing.SentryTransaction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * {@link SentryTransaction} added on the class level, creates transaction around each method + * execution of every method of the annotated class. + */ +@Component +@SentryTransaction(operation = "scheduled") +public class CustomJob { + + private static final Logger LOGGER = LoggerFactory.getLogger(CustomJob.class); + + @SentryCheckIn("monitor_slug_1") + // @Scheduled(fixedRate = 3 * 60 * 1000L) + void execute() throws InterruptedException { + LOGGER.info("Executing scheduled job"); + Thread.sleep(2000L); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/DistributedTracingController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/DistributedTracingController.java new file mode 100644 index 00000000000..85e79ee1df5 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/DistributedTracingController.java @@ -0,0 +1,49 @@ +package io.sentry.samples.spring.boot4.otlp; + +import java.nio.charset.Charset; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestClient; + +@RestController +@RequestMapping("/tracing/") +public class DistributedTracingController { + private static final Logger LOGGER = LoggerFactory.getLogger(DistributedTracingController.class); + private final RestClient restClient; + + public DistributedTracingController(RestClient restClient) { + this.restClient = restClient; + } + + @GetMapping("{id}") + Person person(@PathVariable Long id) { + return restClient + .get() + .uri("http://localhost:8080/person/{id}", id) + .header( + HttpHeaders.AUTHORIZATION, + "Basic " + HttpHeaders.encodeBasicAuth("user", "password", Charset.defaultCharset())) + .retrieve() + .body(Person.class); + } + + @PostMapping + Person create(@RequestBody Person person) { + return restClient + .post() + .uri("http://localhost:8080/person/") + .body(person) + .header( + HttpHeaders.AUTHORIZATION, + "Basic " + HttpHeaders.encodeBasicAuth("user", "password", Charset.defaultCharset())) + .retrieve() + .body(Person.class); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/MetricController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/MetricController.java new file mode 100644 index 00000000000..e980d676d2b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/MetricController.java @@ -0,0 +1,35 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.Sentry; +import io.sentry.metrics.MetricsUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/metric/") +public class MetricController { + private static final Logger LOGGER = LoggerFactory.getLogger(MetricController.class); + + @GetMapping("count") + String count() { + Sentry.metrics().count("countMetric"); + return "count metric increased"; + } + + @GetMapping("gauge/{value}") + String gauge(@PathVariable("value") Long value) { + Sentry.metrics().gauge("memory.free", value.doubleValue(), MetricsUnit.Information.BYTE); + return "gauge metric tracked"; + } + + @GetMapping("distribution/{value}") + String distribution(@PathVariable("value") Long value) { + Sentry.metrics() + .distribution("distributionMetric", value.doubleValue(), MetricsUnit.Duration.MILLISECOND); + return "distribution metric tracked"; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Person.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Person.java new file mode 100644 index 00000000000..8d8bc4bee75 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Person.java @@ -0,0 +1,24 @@ +package io.sentry.samples.spring.boot4.otlp; + +public class Person { + private final String firstName; + private final String lastName; + + public Person(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public String toString() { + return "Person{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}'; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonController.java new file mode 100644 index 00000000000..5603255334b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonController.java @@ -0,0 +1,51 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.ISpan; +import io.sentry.Sentry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/person/") +public class PersonController { + private final PersonService personService; + private static final Logger LOGGER = LoggerFactory.getLogger(PersonController.class); + + public PersonController(PersonService personService) { + this.personService = personService; + } + + @GetMapping("{id}") + Person person(@PathVariable Long id) { + Sentry.addFeatureFlag("transaction-feature-flag", true); + ISpan currentSpan = Sentry.getSpan(); + ISpan sentrySpan = currentSpan.startChild("spanCreatedThroughSentryApi"); + try { + Sentry.logger().warn("warn Sentry logging"); + Sentry.logger().error("error Sentry logging"); + Sentry.logger().info("hello %s %s", "there", "world!"); + Sentry.addFeatureFlag("my-feature-flag", true); + LOGGER.error("Trying person with id={}", id, new RuntimeException("error while loading")); + throw new IllegalArgumentException("Something went wrong [id=" + id + "]"); + } finally { + sentrySpan.finish(); + } + } + + @PostMapping + Person create(@RequestBody Person person) { + ISpan currentSpan = Sentry.getSpan(); + ISpan sentrySpan = currentSpan.startChild("spanCreatedThroughSentryApi"); + try { + return personService.create(person); + } finally { + sentrySpan.finish(); + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonService.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonService.java new file mode 100644 index 00000000000..947a82435d4 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/PersonService.java @@ -0,0 +1,41 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.ISpan; +import io.sentry.Sentry; +import io.sentry.spring7.tracing.SentrySpan; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; + +/** + * {@link SentrySpan} can be added either on the class or the method to create spans around method + * executions. + */ +@Service +@SentrySpan +public class PersonService { + private static final Logger LOGGER = LoggerFactory.getLogger(PersonService.class); + + private final JdbcTemplate jdbcTemplate; + private int createCount = 0; + + public PersonService(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + Person create(Person person) { + createCount++; + final ISpan span = Sentry.getSpan(); + if (span != null) { + span.setMeasurement("create_count", createCount); + } + + jdbcTemplate.update( + "insert into person (firstName, lastName) values (?, ?)", + person.getFirstName(), + person.getLastName()); + + return person; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java new file mode 100644 index 00000000000..69d578f2d89 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java @@ -0,0 +1,41 @@ +package io.sentry.samples.spring.boot4.otlp; + +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +public class SecurityConfiguration { + + // this API is meant to be consumed by non-browser clients thus the CSRF protection is not needed. + @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) + @Bean + public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { + return http.csrf((csrf) -> csrf.disable()) + .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) + .httpBasic((h) -> {}) + .build(); + } + + @Bean + public @NotNull InMemoryUserDetailsManager userDetailsService() { + final PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); + + final UserDetails user = + User.builder() + .passwordEncoder(encoder::encode) + .username("user") + .password("password") + .roles("USER") + .build(); + + return new InMemoryUserDetailsManager(user); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java new file mode 100644 index 00000000000..b4c58c4882e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java @@ -0,0 +1,81 @@ +package io.sentry.samples.spring.boot4.otlp; + +import static io.sentry.quartz.SentryJobListener.SENTRY_SLUG_KEY; + +import io.sentry.Sentry; +import io.sentry.SentryOptions; +import io.sentry.opentelemetry.otlp.OpenTelemetryOtlpEventProcessor; +import io.sentry.samples.spring.boot4.otlp.quartz.SampleJob; +import java.util.Collections; +import org.quartz.JobDetail; +import org.quartz.SimpleTrigger; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.quartz.CronTriggerFactoryBean; +import org.springframework.scheduling.quartz.JobDetailFactoryBean; +import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.reactive.function.client.WebClient; + +@SpringBootApplication +@EnableScheduling +public class SentryDemoApplication { + public static void main(String[] args) { + SpringApplication.run(SentryDemoApplication.class, args); + } + + @Bean + RestTemplate restTemplate(RestTemplateBuilder builder) { + return builder.build(); + } + + @Bean + WebClient webClient(WebClient.Builder builder) { + return builder.build(); + } + + @Bean + RestClient restClient(RestClient.Builder builder) { + return builder.build(); + } + + @Bean + public JobDetailFactoryBean jobDetail() { + JobDetailFactoryBean jobDetailFactory = new JobDetailFactoryBean(); + jobDetailFactory.setJobClass(SampleJob.class); + jobDetailFactory.setDurability(true); + jobDetailFactory.setJobDataAsMap( + Collections.singletonMap(SENTRY_SLUG_KEY, "monitor_slug_job_detail")); + return jobDetailFactory; + } + + @Bean + public SimpleTriggerFactoryBean trigger(JobDetail job) { + SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean(); + trigger.setJobDetail(job); + trigger.setRepeatInterval(2 * 60 * 1000); // every two minutes + trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY); + trigger.setJobDataAsMap( + Collections.singletonMap(SENTRY_SLUG_KEY, "monitor_slug_simple_trigger")); + return trigger; + } + + @Bean + public CronTriggerFactoryBean cronTrigger(JobDetail job) { + CronTriggerFactoryBean trigger = new CronTriggerFactoryBean(); + trigger.setJobDetail(job); + trigger.setCronExpression("0 0/5 * ? * *"); // every five minutes + return trigger; + } + + @Bean + public Sentry.OptionsConfiguration sentryOptionsCustomization() { + return options -> { + options.addEventProcessor(new OpenTelemetryOtlpEventProcessor()); + }; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Todo.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Todo.java new file mode 100644 index 00000000000..39be54cfc7f --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/Todo.java @@ -0,0 +1,25 @@ +package io.sentry.samples.spring.boot4.otlp; + +public class Todo { + private final Long id; + private final String title; + private final boolean completed; + + public Todo(Long id, String title, boolean completed) { + this.id = id; + this.title = title; + this.completed = completed; + } + + public Long getId() { + return id; + } + + public String getTitle() { + return title; + } + + public boolean isCompleted() { + return completed; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java new file mode 100644 index 00000000000..b083e6c1f88 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java @@ -0,0 +1,57 @@ +package io.sentry.samples.spring.boot4.otlp; + +import io.sentry.reactor.SentryReactorUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Hooks; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +@RestController +public class TodoController { + private final RestTemplate restTemplate; + private final WebClient webClient; + private final RestClient restClient; + + public TodoController(RestTemplate restTemplate, WebClient webClient, RestClient restClient) { + this.restTemplate = restTemplate; + this.webClient = webClient; + this.restClient = restClient; + } + + @GetMapping("/todo/{id}") + Todo todo(@PathVariable Long id) { + return restTemplate.getForObject( + "https://jsonplaceholder.typicode.com/todos/{id}", Todo.class, id); + } + + @GetMapping("/todo-webclient/{id}") + Todo todoWebClient(@PathVariable Long id) { + Hooks.enableAutomaticContextPropagation(); + return SentryReactorUtils.withSentry( + Mono.just(true) + .publishOn(Schedulers.boundedElastic()) + .flatMap( + x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) + .block(); + } + + @GetMapping("/todo-restclient/{id}") + Todo todoRestClient(@PathVariable Long id) { + return restClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .body(Todo.class); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java new file mode 100644 index 00000000000..ef4afb1a6f6 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot4.otlp.graphql; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import org.jetbrains.annotations.NotNull; +import org.springframework.graphql.data.method.annotation.BatchMapping; +import org.springframework.stereotype.Controller; +import reactor.core.publisher.Mono; + +@Controller +public class AssigneeController { + + @BatchMapping(typeName = "Task", field = "assignee") + public Mono> assignee( + final @NotNull Set tasks) { + return Mono.fromCallable( + () -> { + final @NotNull Map map = + new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put( + task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } + + return map; + }); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/GreetingController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/GreetingController.java new file mode 100644 index 00000000000..c1d2a9f9150 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/GreetingController.java @@ -0,0 +1,17 @@ +package io.sentry.samples.spring.boot4.otlp.graphql; + +import org.springframework.graphql.data.method.annotation.Argument; +import org.springframework.graphql.data.method.annotation.QueryMapping; +import org.springframework.stereotype.Controller; + +@Controller +public class GreetingController { + + @QueryMapping + public String greeting(final @Argument String name) { + if ("crash".equalsIgnoreCase(name)) { + throw new RuntimeException("causing an error for " + name); + } + return "Hello " + name + "!"; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java new file mode 100644 index 00000000000..7ec97bc12f2 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java @@ -0,0 +1,140 @@ +package io.sentry.samples.spring.boot4.otlp.graphql; + +import java.nio.file.NoSuchFileException; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; +import org.jetbrains.annotations.NotNull; +import org.springframework.graphql.data.method.annotation.Argument; +import org.springframework.graphql.data.method.annotation.MutationMapping; +import org.springframework.graphql.data.method.annotation.QueryMapping; +import org.springframework.graphql.data.method.annotation.SchemaMapping; +import org.springframework.graphql.data.method.annotation.SubscriptionMapping; +import org.springframework.stereotype.Controller; +import reactor.core.publisher.Flux; + +@Controller +public class ProjectController { + + @QueryMapping + public Project project(final @Argument String slug) throws Exception { + if ("crash".equalsIgnoreCase(slug) || "projectcrash".equalsIgnoreCase(slug)) { + throw new RuntimeException("causing a project error for " + slug); + } + if ("notfound".equalsIgnoreCase(slug)) { + throw new IllegalStateException("not found"); + } + if ("nofile".equals(slug)) { + throw new NoSuchFileException("no such file"); + } + Project project = new Project(); + project.slug = slug; + return project; + } + + @SchemaMapping(typeName = "Project", field = "status") + public ProjectStatus projectStatus(final Project project) { + if ("crash".equalsIgnoreCase(project.slug) || "statuscrash".equalsIgnoreCase(project.slug)) { + throw new RuntimeException("causing a project status error for " + project.slug); + } + return ProjectStatus.COMMUNITY; + } + + @MutationMapping + public String addProject(@Argument String slug) { + if ("crash".equalsIgnoreCase(slug) || "addprojectcrash".equalsIgnoreCase(slug)) { + throw new RuntimeException("causing a project add error for " + slug); + } + return UUID.randomUUID().toString(); + } + + @QueryMapping + public List tasks(final @Argument String projectSlug) { + List tasks = new ArrayList<>(); + tasks.add(new Task("T1", "Create a new API", "A3", "C3")); + tasks.add(new Task("T2", "Update dependencies", "A1", "C1")); + tasks.add(new Task("T3", "Document API", "A1", "C1")); + tasks.add(new Task("T4", "Merge community PRs", "A2", "C2")); + tasks.add(new Task("T5", "Plan more work", null, null)); + if ("crash".equalsIgnoreCase(projectSlug)) { + tasks.add(new Task("T6", "Fix crash", "Acrash", "Ccrash")); + } + return tasks; + } + + @SubscriptionMapping + public Flux notifyNewTask(@Argument String projectSlug) { + if ("crash".equalsIgnoreCase(projectSlug)) { + throw new RuntimeException("causing error for subscription"); + } + if ("fluxerror".equalsIgnoreCase(projectSlug)) { + return Flux.error(new RuntimeException("causing flux error for subscription")); + } + final String assigneeId = "assigneecrash".equalsIgnoreCase(projectSlug) ? "Acrash" : "A1"; + final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; + final @NotNull AtomicInteger counter = new AtomicInteger(1000); + return Flux.interval(Duration.ofSeconds(1)) + .map( + num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); + } + + public static class Task { + public String id; + public String name; + public String assigneeId; + public String creatorId; + + public Task( + final String id, final String name, final String assigneeId, final String creatorId) { + this.id = id; + this.name = name; + this.assigneeId = assigneeId; + this.creatorId = creatorId; + } + + @Override + public String toString() { + return "Task{id=" + id + "}"; + } + } + + public static class Assignee { + public String id; + public String name; + + public Assignee(final String id, final String name) { + this.id = id; + this.name = name; + } + } + + public static class Creator { + public String id; + public String name; + + public Creator(final String id, final String name) { + this.id = id; + this.name = name; + } + } + + public static class Project { + public String slug; + } + + public enum ProjectStatus { + ACTIVE, + COMMUNITY, + INCUBATING, + ATTIC, + EOL; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java new file mode 100644 index 00000000000..94314cbfcac --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java @@ -0,0 +1,50 @@ +package io.sentry.samples.spring.boot4.otlp.graphql; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import org.dataloader.BatchLoaderEnvironment; +import org.dataloader.DataLoader; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.graphql.data.method.annotation.SchemaMapping; +import org.springframework.graphql.execution.BatchLoaderRegistry; +import org.springframework.stereotype.Controller; +import reactor.core.publisher.Mono; + +@Controller +class TaskCreatorController { + + public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { + // using mapped BatchLoader to not have to deal with correct ordering of items + batchLoaderRegistry + .forTypePair(String.class, ProjectController.Creator.class) + .withOptions((builder) -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader( + (Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable( + () -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } + + return map; + }); + }); + } + + @SchemaMapping(typeName = "Task") + public @Nullable CompletableFuture creator( + final ProjectController.Task task, + final DataLoader dataLoader) { + if (task.creatorId == null) { + return null; + } + return dataLoader.load(task.creatorId); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/quartz/SampleJob.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/quartz/SampleJob.java new file mode 100644 index 00000000000..db143d90eb6 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/quartz/SampleJob.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot4.otlp.quartz; + +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.stereotype.Component; + +@Component +public class SampleJob implements Job { + + public void execute(JobExecutionContext context) throws JobExecutionException { + System.out.println("running job"); + try { + Thread.sleep(15000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties new file mode 100644 index 00000000000..43c0bd18c08 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties @@ -0,0 +1,53 @@ +# NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard +sentry.dsn=https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563 +sentry.send-default-pii=true +sentry.max-request-body-size=medium +# Sentry Spring Boot integration allows more fine-grained SentryOptions configuration +sentry.max-breadcrumbs=150 +# Logback integration configuration options +sentry.logging.minimum-event-level=info +sentry.logging.minimum-breadcrumb-level=debug +# Performance configuration +#sentry.traces-sample-rate=1.0 +sentry.ignored-checkins=ignored_monitor_slug_1,ignored_monitor_slug_2 +sentry.debug=true +sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR +sentry.enable-backpressure-handling=true +sentry.enable-spotlight=true +sentry.enablePrettySerializationOutput=false +sentry.in-app-includes="io.sentry.samples" +sentry.logs.enabled=true +sentry.profile-session-sample-rate=1.0 +sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces +sentry.profile-lifecycle=TRACE + +# Uncomment and set to true to enable aot compatibility +# This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) +# to successfully compile to GraalVM +# sentry.enable-aot-compatibility=false + +# Database configuration +spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb +spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver +spring.datasource.username=sa +spring.datasource.password= +spring.graphql.graphiql.enabled=true +spring.graphql.websocket.path=/graphql +spring.quartz.job-store-type=memory + +# OTEL configuration +# Use Sentry propagator to propagate sentry-trace and baggage headers +otel.propagators=tracecontext,baggage,sentry +otel.logs.exporter=none +otel.metrics.exporter=none +# OTLP traces exporter configuration +# Use both otlp and logging exporters - logging prints spans to console for debugging +otel.traces.exporter=otlp,logging +otel.exporter.otlp.traces.endpoint=https://o447951.ingest.us.sentry.io/api/5428563/integration/otlp/v1/traces +otel.exporter.otlp.traces.protocol=http/protobuf +otel.exporter.otlp.traces.headers=x-sentry-auth=sentry sentry_key=502f25099c204a2fbf4cb16edc5975d1 + +# Debug logging for OTel +logging.level.io.opentelemetry=DEBUG +logging.level.io.opentelemetry.exporter=DEBUG +logging.level.io.opentelemetry.sdk.trace.export=DEBUG diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/graphql/schema.graphqls b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/graphql/schema.graphqls new file mode 100644 index 00000000000..aeea62357bd --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/graphql/schema.graphqls @@ -0,0 +1,68 @@ +type Query { + greeting(name: String! = "Spring"): String! + project(slug: ID!): Project + tasks(projectSlug: ID!): [Task] +} + +type Mutation { + addProject(slug: ID!): String! +} + +type Subscription { + notifyNewTask(projectSlug: ID!): Task +} + +""" A Project in the Spring portfolio """ +type Project { + """ Unique string id used in URLs """ + slug: ID! + """ Project name """ + name: String + """ Current support status """ + status: ProjectStatus! +} + +""" A task """ +type Task { + """ ID """ + id: String! + """ Name """ + name: String! + """ ID of the Assignee """ + assigneeId: String + """ Assignee """ + assignee: Assignee + """ ID of the Creator """ + creatorId: String + """ Creator """ + creator: Creator +} + +""" An Assignee """ +type Assignee { + """ ID """ + id: String! + """ Name """ + name: String! +} + +""" An Creator """ +type Creator { + """ ID """ + id: String! + """ Name """ + name: String! +} + +enum ProjectStatus { + """ Actively supported by the Spring team """ + ACTIVE + """ Supported by the community """ + COMMUNITY + """ Prototype, not officially supported yet """ + INCUBATING + """ Project being retired, in maintenance mode """ + ATTIC + """ End-Of-Lifed """ + EOL +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/quartz.properties b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/quartz.properties new file mode 100644 index 00000000000..6e302ce765a --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/quartz.properties @@ -0,0 +1 @@ +org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/schema.sql b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/schema.sql new file mode 100644 index 00000000000..7ca8a5cbf42 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/schema.sql @@ -0,0 +1,5 @@ +CREATE TABLE person ( + id INTEGER IDENTITY PRIMARY KEY, + firstName VARCHAR(50) NOT NULL, + lastName VARCHAR(50) NOT NULL +); diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/DummyTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/DummyTest.kt new file mode 100644 index 00000000000..6f762b7e453 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/DummyTest.kt @@ -0,0 +1,12 @@ +package io.sentry + +import kotlin.test.Test +import kotlin.test.assertTrue + +class DummyTest { + @Test + fun `the only test`() { + // only needed to have more than 0 tests and not fail the build + assertTrue(true) + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/DistributedTracingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/DistributedTracingSystemTest.kt new file mode 100644 index 00000000000..3cd16003024 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/DistributedTracingSystemTest.kt @@ -0,0 +1,197 @@ +package io.sentry.systemtest + +import io.sentry.protocol.SentryId +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals +import org.junit.Before + +class DistributedTracingSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `get person distributed tracing`() { + val traceId = SentryId() + val restClient = testHelper.restClient + restClient.getPersonDistributedTracing( + 1L, + mapOf( + "sentry-trace" to "$traceId-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(500, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "GET /tracing/{id}" && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + } + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "GET /person/{id}" && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + } + } + + @Test + fun `get person distributed tracing with sampled false`() { + val traceId = SentryId() + val restClient = testHelper.restClient + restClient.getPersonDistributedTracing( + 1L, + mapOf( + "sentry-trace" to "$traceId-424cffc8f94feeee-0", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=false,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(500, restClient.lastKnownStatusCode) + + testHelper.ensureNoTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "GET /tracing/{id}" + } + + testHelper.ensureNoTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "GET /person/{id}" + } + } + + @Test + fun `get person distributed tracing without sample_rand`() { + val traceId = SentryId() + val restClient = testHelper.restClient + restClient.getPersonDistributedTracing( + 1L, + mapOf( + "sentry-trace" to "$traceId-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(500, restClient.lastKnownStatusCode) + + var sampleRand1: String? = null + var sampleRand2: String? = null + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + val matches = + transaction.transaction == "GET /tracing/{id}" && + envelopeHeader.traceContext!!.traceId == traceId && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + + if (matches) { + testHelper.logObject(envelopeHeader) + testHelper.logObject(transaction) + sampleRand1 = envelopeHeader.traceContext?.sampleRand + } + + matches + } + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + val matches = + transaction.transaction == "GET /person/{id}" && + envelopeHeader.traceContext!!.traceId == traceId && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + + if (matches) { + testHelper.logObject(envelopeHeader) + testHelper.logObject(transaction) + sampleRand2 = envelopeHeader.traceContext?.sampleRand + } + + matches + } + + assertEquals(sampleRand1, sampleRand2) + } + + @Test + fun `get person distributed tracing updates sample_rate on deferred decision`() { + val traceId = SentryId() + val restClient = testHelper.restClient + restClient.getPersonDistributedTracing( + 1L, + mapOf( + "sentry-trace" to "$traceId-424cffc8f94feeee", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=0.5,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(500, restClient.lastKnownStatusCode) + + var sampleRate1: String? = null + var sampleRate2: String? = null + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + val matches = + transaction.transaction == "GET /tracing/{id}" && + envelopeHeader.traceContext!!.traceId == traceId && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + + if (matches) { + testHelper.logObject(envelopeHeader) + testHelper.logObject(transaction) + sampleRate1 = envelopeHeader.traceContext?.sampleRate + } + + matches + } + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + val matches = + transaction.transaction == "GET /person/{id}" && + envelopeHeader.traceContext!!.traceId == traceId && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + + if (matches) { + testHelper.logObject(envelopeHeader) + testHelper.logObject(transaction) + sampleRate2 = envelopeHeader.traceContext?.sampleRate + } + + matches + } + + assertEquals(sampleRate1, sampleRate2) + assertNotEquals(sampleRate1, "0.5") + } + + @Test + fun `create person distributed tracing`() { + val traceId = SentryId() + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPersonDistributedTracing( + person, + mapOf( + "sentry-trace" to "$traceId-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "POST /tracing/" && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + } + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + transaction.transaction == "POST /person/" && + testHelper.doesTransactionHaveTraceId(transaction, traceId.toString()) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt new file mode 100644 index 00000000000..76a6024decc --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -0,0 +1,46 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import org.junit.Before + +class GraphqlGreetingSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `greeting works`() { + val response = testHelper.graphqlClient.greet("world") + + testHelper.ensureNoErrors(response) + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) + } + } + + @Test + fun `greeting error`() { + val response = testHelper.graphqlClient.greet("crash") + + testHelper.ensureErrorCount(response, 1) + testHelper.ensureErrorReceived { error -> + error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false + } + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt new file mode 100644 index 00000000000..fca3956717c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -0,0 +1,66 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import org.junit.Before + +class GraphqlProjectSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `project query works`() { + val response = testHelper.graphqlClient.project("proj-slug") + + testHelper.ensureNoErrors(response) + assertEquals("proj-slug", response?.data?.project?.slug) + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.project", + ) + } + } + + @Test + fun `project mutation works`() { + val response = testHelper.graphqlClient.addProject("proj-slug") + + testHelper.ensureNoErrors(response) + assertNotNull(response?.data?.addProject) + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) + } + } + + @Test + fun `project mutation error`() { + val response = testHelper.graphqlClient.addProject("addprojectcrash") + + testHelper.ensureErrorCount(response, 1) + assertNull(response?.data?.addProject) + testHelper.ensureErrorReceived { error -> + error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false + } + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt new file mode 100644 index 00000000000..940709c0778 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -0,0 +1,50 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class GraphqlTaskSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `tasks and assignees query works`() { + val response = testHelper.graphqlClient.tasksAndAssignees("project-slug") + + testHelper.ensureNoErrors(response) + + assertEquals(5, response?.data?.tasks?.size) + + val firstTask = response?.data?.tasks?.firstOrNull() ?: throw RuntimeException("no task") + assertEquals("T1", firstTask.id) + assertEquals("A3", firstTask.assigneeId) + assertEquals("A3", firstTask.assignee?.id) + assertEquals("C3", firstTask.creatorId) + assertEquals("C3", firstTask.creator?.id) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.tasks", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.assignee", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.creator", + ) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt new file mode 100644 index 00000000000..dc2ca2a10ae --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -0,0 +1,49 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class MetricsSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `count metric`() { + val restClient = testHelper.restClient + assertEquals("count metric increased", restClient.getCountMetric()) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureMetricsReceived { event, header -> + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + } + } + + @Test + fun `gauge metric`() { + val restClient = testHelper.restClient + assertEquals("gauge metric tracked", restClient.getGaugeMetric(14)) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureMetricsReceived { event, header -> + testHelper.doesContainMetric(event, "memory.free", "gauge", 14.0) + } + } + + @Test + fun `distribution metric`() { + val restClient = testHelper.restClient + assertEquals("distribution metric tracked", restClient.getDistributionMetric(23)) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureMetricsReceived { event, header -> + testHelper.doesContainMetric(event, "distributionMetric", "distribution", 23.0) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt new file mode 100644 index 00000000000..362a8577148 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -0,0 +1,96 @@ +package io.sentry.systemtest + +import io.sentry.protocol.FeatureFlag +import io.sentry.protocol.SentryId +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class PersonSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `get person fails`() { + val restClient = testHelper.restClient + restClient.getPerson(1L) + assertEquals(500, restClient.lastKnownStatusCode) + + testHelper.ensureErrorReceived { event -> + event.message?.formatted == "Trying person with id=1" && + testHelper.doesEventHaveFlag(event, "my-feature-flag", true) + } + + testHelper.ensureErrorReceived { event -> + testHelper.doesEventHaveExceptionMessage(event, "Something went wrong [id=1]") && + testHelper.doesEventHaveFlag(event, "my-feature-flag", true) + } + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionHave( + transaction, + op = "http.server", + featureFlag = FeatureFlag("flag.evaluation.transaction-feature-flag", true), + ) && + testHelper.doesTransactionHaveSpanWith( + transaction, + op = "spanCreatedThroughSentryApi", + featureFlag = FeatureFlag("flag.evaluation.my-feature-flag", true), + ) + } + + Thread.sleep(10000) + + testHelper.ensureLogsReceived { logs, envelopeHeader -> + testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && + testHelper.doesContainLogWithBody(logs, "error Sentry logging") && + testHelper.doesContainLogWithBody(logs, "hello there world!") + } + } + + @Test + fun `create person works`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = restClient.createPerson(person) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "PersonService.create") && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db.query", + "insert into person (firstName, lastName) values (?, ?)", + ) + } + } + + @Test + fun `create person starts a profile linked to the transaction`() { + var profilerId: SentryId? = null + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = restClient.createPerson(person) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + profilerId = transaction.contexts.profile?.profilerId + transaction.transaction == "POST /person/" + } + testHelper.ensureProfileChunkReceived { profileChunk, envelopeHeader -> + profileChunk.profilerId == profilerId + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt new file mode 100644 index 00000000000..d34485e1388 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -0,0 +1,61 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class TodoSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `get todo works`() { + val restClient = testHelper.restClient + restClient.getTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) + } + } + + @Test + fun `get todo webclient works`() { + val restClient = testHelper.restClient + restClient.getTodoWebclient(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) + } + } + + @Test + fun `get todo restclient works`() { + val restClient = testHelper.restClient + restClient.getTodoRestClient(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/resources/logback.xml b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/resources/logback.xml new file mode 100644 index 00000000000..a36b8f80f76 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/resources/logback.xml @@ -0,0 +1,17 @@ + + + + + + + + + + %-4relative [%thread] %-5level %logger{35} -%kvp- %msg %n + + + + + + + diff --git a/settings.gradle.kts b/settings.gradle.kts index fcff35af112..0e9987b4ae4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -64,6 +64,8 @@ include( "sentry-opentelemetry:sentry-opentelemetry-agent", "sentry-opentelemetry:sentry-opentelemetry-agentless", "sentry-opentelemetry:sentry-opentelemetry-agentless-spring", + "sentry-opentelemetry:sentry-opentelemetry-otlp", + "sentry-opentelemetry:sentry-opentelemetry-otlp-spring", "sentry-quartz", "sentry-okhttp", "sentry-openfeature", @@ -74,6 +76,7 @@ include( "sentry-ktor-client", "sentry-samples:sentry-samples-android", "sentry-samples:sentry-samples-console", + "sentry-samples:sentry-samples-console-otlp", "sentry-samples:sentry-samples-console-opentelemetry-noagent", "sentry-samples:sentry-samples-jul", "sentry-samples:sentry-samples-ktor-client", @@ -94,6 +97,7 @@ include( "sentry-samples:sentry-samples-spring-boot-4", "sentry-samples:sentry-samples-spring-boot-4-opentelemetry", "sentry-samples:sentry-samples-spring-boot-4-opentelemetry-noagent", + "sentry-samples:sentry-samples-spring-boot-4-otlp", "sentry-samples:sentry-samples-spring-boot-4-webflux", "sentry-samples:sentry-samples-netflix-dgs", "sentry-android-integration-tests:sentry-uitest-android-critical", diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 1188e6efbc4..55a1136fbe0 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -733,7 +733,9 @@ def get_available_modules(self) -> List[ModuleConfig]: ModuleConfig("sentry-samples-spring-boot-4-opentelemetry-noagent", "false", "true", "false"), ModuleConfig("sentry-samples-spring-boot-4-opentelemetry", "true", "true", "false"), ModuleConfig("sentry-samples-spring-boot-4-opentelemetry", "true", "false", "false"), + ModuleConfig("sentry-samples-spring-boot-4-otlp", "false", "true", "false"), ModuleConfig("sentry-samples-console", "false", "true", "false"), + ModuleConfig("sentry-samples-console-otlp", "false", "true", "false"), ModuleConfig("sentry-samples-console-opentelemetry-noagent", "false", "true", "false"), ModuleConfig("sentry-samples-logback", "false", "true", "false"), ModuleConfig("sentry-samples-log4j2", "false", "true", "false"), From c3a7aed04e9d6d4868bb837176593e9418f0ff1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:04:32 +0100 Subject: [PATCH 012/391] build(deps): bump gradle/actions from 5.0.1 to 5.0.2 (#5131) Bumps [gradle/actions](https://github.com/gradle/actions) from 5.0.1 to 5.0.2. - [Release notes](https://github.com/gradle/actions/releases) - [Commits](https://github.com/gradle/actions/compare/f29f5a9d7b09a7c6b29859002d29d24e1674c884...0723195856401067f7a2779048b490ace7a47d7c) --- updated-dependencies: - dependency-name: gradle/actions dependency-version: 5.0.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/generate-javadocs.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 2 +- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release-build.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 7d2297ed33a..5ee404e790a 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -39,7 +39,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab7e6904c90..6d9766784b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c93a2128524..ffd4082904d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 9143270b5a1..ca27a0b201a 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c - name: Set up Java uses: actions/setup-java@v5 diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 3662f1db3e8..197b5d95659 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -19,7 +19,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index 3ef5d3c52cf..7909b659108 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -20,7 +20,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c - name: Generate Aggregate Javadocs run: | diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 4d6b403be65..5796cc0e020 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -38,7 +38,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} @@ -88,7 +88,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index bb867681b59..7df0d8bb65d 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -36,7 +36,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 792583937ba..b1b912c0561 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -36,7 +36,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 017a150155e..41f3829993d 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -33,7 +33,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 8b41af5e846..37c0bef8a9d 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -26,7 +26,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c - name: Build artifacts run: make publish diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 2cb073304a9..f31e38baee3 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -56,7 +56,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 3b225ebe684..4f33bd18a84 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -56,7 +56,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index a7da8d3bf7e..7578b7a9c10 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -56,7 +56,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 641b49f6c85..88980099774 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -114,7 +114,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 + uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} From a0cbb4a0d7c5495deac611aa932ff468627064e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:05:38 +0100 Subject: [PATCH 013/391] build(deps): bump actions/download-artifact from 7 to 8 (#5132) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/integration-tests-ui-critical.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index b1b912c0561..b8bd19471e9 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -114,7 +114,7 @@ jobs: script: echo "Generated AVD snapshot for caching." - name: Download APK artifact - uses: actions/download-artifact@v7 + uses: actions/download-artifact@v8 with: name: ${{env.APK_ARTIFACT_NAME}} From fc4ec486014351df14cb6d3137ed23560bd201ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:20:45 +0100 Subject: [PATCH 014/391] build(deps): bump actions/upload-artifact from 6 to 7 (#5130) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 4 ++-- .github/workflows/release-build.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 5ee404e790a..d5f326b56bf 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -94,7 +94,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-AGP${{ matrix.agp }}-Integrations${{ matrix.integrations }} path: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d9766784b5..56e832b8e43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-build path: | diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index b8bd19471e9..77691bfd65b 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -44,7 +44,7 @@ jobs: run: make assembleUiTestCriticalRelease - name: Upload APK artifact - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: ${{env.APK_ARTIFACT_NAME}} path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" @@ -141,7 +141,7 @@ jobs: - name: Upload Maestro test results if: ${{ always() }} - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: maestro-logs-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} path: "${{env.BASE_PATH}}/maestro-logs" diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 37c0bef8a9d..7e7774365b9 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -32,7 +32,7 @@ jobs: run: make publish - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: ${{ github.sha }} if-no-files-found: error diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index f31e38baee3..a6c2d7b48b7 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-springboot-2-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 4f33bd18a84..03232723741 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-springboot-3-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 7578b7a9c10..c82113828cc 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -151,7 +151,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-springboot-4-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 88980099774..4f7929343cc 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -153,7 +153,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: test-results-${{ matrix.sample }}-${{ matrix.agent }}-${{ matrix.agent-auto-init }}-system-test path: | From b35244beb3e187553ad4f49a091791dd1f926ec7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 10:52:41 +0000 Subject: [PATCH 015/391] chore: update scripts/update-sentry-native-ndk.sh to 0.13.1 (#5104) Co-authored-by: GitHub --- CHANGELOG.md | 6 ++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf481f1cca3..dba0f4dcdfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,12 @@ - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) +### Dependencies + +- Bump Native SDK from v0.12.7 to v0.13.1 ([#5104](https://github.com/getsentry/sentry-java/pull/5104)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0131) + - [diff](https://github.com/getsentry/sentry-native/compare/0.12.7...0.13.1) + ## 8.33.0 ### Features diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d283b549895..dd2a471f695 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.12.7" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.1" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 41fa056779d19077af437b92fcc4fa2d546f0677 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:56:55 +0100 Subject: [PATCH 016/391] build(deps): bump getsentry/craft from 2.21.7 to 2.23.1 (#5129) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.21.7 to 2.23.1. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/41defb379de52e5f0e3943944fa5575b22fb9f92...d4cfac9d25d1fc72c9241e5d22aff559a114e4e9) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.23.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0dd2ea4b92c..df09bf89706 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@41defb379de52e5f0e3943944fa5575b22fb9f92 # v2 + uses: getsentry/craft@d4cfac9d25d1fc72c9241e5d22aff559a114e4e9 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From 8124101b64493c4107a4fb85979ff6b130c7682f Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 2 Mar 2026 12:27:33 +0100 Subject: [PATCH 017/391] chore(ai): Add `/create-java-pr` Claude Code skill (#5119) * ci: add create-java-pr Claude Code skill Co-Authored-By: Claude Opus 4.6 * use PR template for Java PRs --------- Co-authored-by: Claude Opus 4.6 --- .claude/skills/create-java-pr/SKILL.md | 128 +++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 .claude/skills/create-java-pr/SKILL.md diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md new file mode 100644 index 00000000000..7dcb5ea47c3 --- /dev/null +++ b/.claude/skills/create-java-pr/SKILL.md @@ -0,0 +1,128 @@ +--- +name: create-java-pr +description: Create a pull request in sentry-java. Use when asked to "create pr", "prepare pr", "prep pr", "open pr", "ready for pr", "prepare for review", "finalize changes". Handles branch creation, code formatting, API dump, committing, pushing, PR creation, and changelog. +--- + +# Create Pull Request (sentry-java) + +Prepare local changes and create a pull request for the sentry-java repo. + +## Step 1: Ensure Feature Branch + +```bash +git branch --show-current +``` + +If on `main` or `master`, create and switch to a new branch: + +```bash +git checkout -b / +``` + +Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, etc. matching the commit type conventions. + +## Step 2: Format Code and Regenerate API Files + +```bash +./gradlew spotlessApply apiDump +``` + +This is **required** before every PR in this repo. It formats all Java/Kotlin code via Spotless and regenerates the `.api` binary compatibility files. + +If the command fails, diagnose and fix the issue before continuing. + +## Step 3: Commit Changes + +Check for uncommitted changes: + +```bash +git status --porcelain +``` + +If there are uncommitted changes, invoke the `sentry-skills:commit` skill to stage and commit them following Sentry conventions. + +**Important:** When staging, ignore changes that are only relevant for local testing and should not be part of the PR. Common examples: + +| Ignore Pattern | Reason | +|---|---| +| Hardcoded booleans flipped for testing | Local debug toggles | +| Sample app config changes (`sentry-samples/`) | Local testing configuration | +| `.env` or credentials files | Secrets | + +Restore these files before committing: + +```bash +git checkout -- +``` + +## Step 4: Push the Branch + +```bash +git push -u origin HEAD +``` + +If the push fails due to diverged history, ask the user how to proceed rather than force-pushing. + +## Step 5: Create PR + +Invoke the `sentry-skills:create-pr` skill to create a draft PR. When providing the PR body, use the repo's PR template structure from `.github/pull_request_template.md`: + +``` +## :scroll: Description + + +## :bulb: Motivation and Context + + +## :green_heart: How did you test it? + + +## :pencil: Checklist +- [ ] I added GH Issue ID _&_ Linear ID +- [ ] I added tests to verify the changes. +- [ ] No new PII added or SDK only sends newly added PII if `sendDefaultPII` is enabled. +- [ ] I updated the docs if needed. +- [ ] I updated the wizard if needed. +- [ ] Review from the native team if needed. +- [ ] No breaking change or entry added to the changelog. +- [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs. + +## :crystal_ball: Next steps +``` + +Fill in each section based on the changes being PR'd. Check any checklist items that apply. + +Then continue to Step 6. + +## Step 6: Update Changelog + +After the PR is created, add an entry to `CHANGELOG.md` under the `## Unreleased` section. + +### Determine the subsection + +| Change Type | Subsection | +|---|---| +| New feature | `### Features` | +| Bug fix | `### Fixes` | +| Refactoring, internal cleanup | `### Internal` | +| Dependency update | `### Dependencies` | + +Create the subsection under `## Unreleased` if it does not already exist. + +### Entry format + +```markdown +- ([#](https://github.com/getsentry/sentry-java/pull/)) +``` + +Use the PR number returned by `sentry-skills:create-pr`. Match the style of existing entries — sentence case, ending with the PR link, no trailing period. + +### Commit and push + +Stage `CHANGELOG.md`, commit with message `changelog`, and push: + +```bash +git add CHANGELOG.md +git commit -m "changelog" +git push +``` From fc52bb86337ae3f36a8da009dac05c40ac7a1661 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 2 Mar 2026 12:27:45 +0100 Subject: [PATCH 018/391] docs: Add agent rules for API, options, and PR workflows (#5133) * docs: Add agent rules for API, options, and PR workflows Add cursor rules for public API surface (api.mdc), SDK options (options.mdc), and PR workflow including stacked PRs (pr.mdc). Update overview_dev.mdc to reference the new rules. Add Claude Code skill for creating pull requests. Co-Authored-By: Claude * ref: Remove create-java-pr skill from PR Co-Authored-By: Claude --------- Co-authored-by: Claude --- .cursor/rules/api.mdc | 89 +++++++++++++ .cursor/rules/options.mdc | 115 ++++++++++++++++ .cursor/rules/overview_dev.mdc | 23 ++++ .cursor/rules/pr.mdc | 231 +++++++++++++++++++++++++++++++++ 4 files changed, 458 insertions(+) create mode 100644 .cursor/rules/api.mdc create mode 100644 .cursor/rules/options.mdc create mode 100644 .cursor/rules/pr.mdc diff --git a/.cursor/rules/api.mdc b/.cursor/rules/api.mdc new file mode 100644 index 00000000000..c5a793d9240 --- /dev/null +++ b/.cursor/rules/api.mdc @@ -0,0 +1,89 @@ +--- +alwaysApply: false +description: Public API surface, binary compatibility, and common classes to modify +--- +# Java SDK Public API + +## API Compatibility + +Public API is tracked via `.api` files generated by the [Binary Compatibility Validator](https://github.com/Kotlin/binary-compatibility-validator) Gradle plugin. Each module has its own file at `/api/.api`. + +- **Never edit `.api` files manually.** Run `./gradlew apiDump` to regenerate them. +- `./gradlew check` validates current code against `.api` files and fails on unintended changes. +- `@ApiStatus.Internal` marks classes/methods as internal — they still appear in `.api` files but are not part of the public contract. +- `@ApiStatus.Experimental` marks API that may change in future versions. + +## Key Public API Classes + +### Entry Point + +`Sentry` (`sentry` module) is the static entry point. Most public API methods on `Sentry` delegate to `getCurrentScopes()`. When adding a new method to `Sentry`, it typically calls through to `IScopes`. + +### Interfaces + +| Interface | Description | +|-----------|-------------| +| `IScope` | Single scope — holds data (tags, extras, breadcrumbs, attributes, user, contexts, etc.) | +| `IScopes` | Multi-scope container — manages global, isolation, and current scope; delegates capture calls to `SentryClient` | +| `ISpan` | Performance span — timing, tags, data, measurements | +| `ITransaction` | Top-level transaction — extends `ISpan` | + +### Configuration + +`SentryOptions` is the base configuration class. Platform-specific subclasses: +- `SentryAndroidOptions` — Android-specific options +- Integration modules may add their own (e.g. `SentrySpringProperties`) + +New features must be **opt-in by default** — add a getter/setter pair to the appropriate options class. + +### Internal Classes (Not Public API) + +| Class | Description | +|-------|-------------| +| `SentryClient` | Sends events/envelopes to Sentry — receives captured data from `Scopes` | +| `SentryEnvelope` / `SentryEnvelopeItem` | Low-level envelope serialization | +| `Scope` | Concrete implementation of `IScope` | +| `Scopes` | Concrete implementation of `IScopes` | + +## Adding New Public API + +When adding a new method that users can call (e.g. a new scope operation), these classes typically need changes: + +### Interfaces and Static API +1. `IScope` — add the method signature +2. `IScopes` — add the method signature (usually delegates to a scope) +3. `Sentry` — add static method that calls `getCurrentScopes()` + +### Implementations +4. `Scope` — actual implementation with data storage +5. `Scopes` — delegates to the appropriate scope (global, isolation, or current based on `defaultScopeType`) +6. `CombinedScopeView` — defines how the three scope types combine for reads (merge, first-wins, or specific scope) + +### No-Op and Adapter Classes +7. `NoOpScope` — no-op stub for `IScope` +8. `NoOpScopes` — no-op stub for `IScopes` +9. `ScopesAdapter` — delegates to `Sentry` static API +10. `HubAdapter` — deprecated bridge from old `IHub` API +11. `HubScopesWrapper` — wraps `IScopes` as `IHub` + +### Serialization (if the data is sent to Sentry) +12. Add serialization/deserialization in the relevant data class or create a new one implementing `JsonSerializable` and `JsonDeserializer` + +### Tests +13. Write tests for all implementations, especially `Scope`, `Scopes`, `SentryTest`, and any new data classes +14. No-op classes typically don't need separate tests unless they have non-trivial logic + +## Protocol / Data Model Classes + +Classes in the `io.sentry.protocol` package represent the Sentry event protocol. They implement `JsonSerializable` for serialization and have a companion `Deserializer` class implementing `JsonDeserializer`. When adding new fields to protocol classes, update both serialization and deserialization. + +## Namespaced APIs + +Newer features are namespaced under `Sentry.()` rather than added directly to `Sentry`. Each namespaced API has an interface, implementation, and no-op. Examples: + +- `Sentry.logger()` → `ILoggerApi` / `LoggerApi` / `NoOpLoggerApi` (structured logging, `io.sentry.logger` package) +- `Sentry.metrics()` → `IMetricsApi` / `MetricsApi` / `NoOpMetricsApi` (metrics) + +Options for namespaced features are similarly nested under `SentryOptions`, e.g. `SentryOptions.getMetrics()`, `SentryOptions.getLogs()`. + +These APIs may share infrastructure like the type system (`SentryAttributeType.inferFrom()`) — changes to shared components (e.g. attribute types) may require updates across multiple namespaced APIs. diff --git a/.cursor/rules/options.mdc b/.cursor/rules/options.mdc new file mode 100644 index 00000000000..2d239da7813 --- /dev/null +++ b/.cursor/rules/options.mdc @@ -0,0 +1,115 @@ +--- +alwaysApply: false +description: Adding and modifying SDK options +--- +# Adding Options to the SDK + +New features must be **opt-in by default**. Options control whether a feature is enabled and how it behaves. + +## Namespaced Options + +Newer features use namespaced option classes nested inside `SentryOptions`, e.g.: +- `SentryOptions.getLogs()` → `SentryOptions.Logs` +- `SentryOptions.getMetrics()` → `SentryOptions.Metrics` + +Each namespaced options class is a `public static final class` inside `SentryOptions` with its own fields, getters/setters, and callbacks (e.g. `BeforeSendLogCallback`, `BeforeSendMetricCallback`). + +A typical namespaced options class contains: +- `enabled` boolean (default `false` for opt-in) +- `sampleRate` double (if the feature supports sampling) +- `beforeSend` callback interface (nested inside the options class) + +To add a new namespaced options class: +1. Create the `public static final class` inside `SentryOptions` with fields, getters/setters, and any callback interfaces +2. Add a private field on `SentryOptions` initialized with `new SentryOptions.MyFeature()` +3. Add getter/setter on `SentryOptions` annotated with `@ApiStatus.Experimental` + +## Direct (Non-Namespaced) Options + +Options that apply globally across the SDK (e.g. `dsn`, `environment`, `release`, `sampleRate`, `maxBreadcrumbs`) live as direct fields on `SentryOptions` with getter/setter pairs. Use this pattern for options that aren't tied to a specific feature namespace. + +## Configuration Layers + +Options can be set through multiple layers. When adding a new option, consider which layers apply: + +### 1. SentryOptions (always required) + +The core options class. Add the field (or nested class) with getter/setter here. + +**File:** `sentry/src/main/java/io/sentry/SentryOptions.java` + +**Tests:** `sentry/src/test/java/io/sentry/SentryOptionsTest.kt` +- Test the default value +- Test merge behavior (see layer 2) + +### 2. ExternalOptions (sentry.properties / environment variables) + +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." + +**File:** `sentry/src/main/java/io/sentry/ExternalOptions.java` +- Add `@Nullable` fields with getter/setter for each externally configurable option (e.g. `enableMetrics`, `logsSampleRate`) +- Wire them in the static `from(PropertiesProvider)` method: + - Boolean: `propertiesProvider.getBooleanProperty("metrics.enabled")` + - Double: `propertiesProvider.getDoubleProperty("logs.sample-rate")` + +**File:** `sentry/src/main/java/io/sentry/SentryOptions.java` — `merge()` method +- Add null-check blocks to apply each external option onto the namespaced options class: + ```java + if (options.isEnableMetrics() != null) { + getMetrics().setEnabled(options.isEnableMetrics()); + } + if (options.getLogsSampleRate() != null) { + getLogs().setSampleRate(options.getLogsSampleRate()); + } + ``` + +**Tests:** +- `sentry/src/test/java/io/sentry/ExternalOptionsTest.kt` — test true/false/null for booleans, valid values and null for doubles +- `sentry/src/test/java/io/sentry/SentryOptionsTest.kt` — test merge applies values and test merge preserves defaults when unset + +### 3. Android Manifest Metadata (Android only) + +Allows setting options via `AndroidManifest.xml` `` tags. + +**File:** `sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java` +- Add a `static final String` constant for the key (e.g. `"io.sentry.metrics.enabled"`) +- Read it in `applyMetadata()` using `readBool(metadata, logger, CONSTANT, defaultValue)` +- Apply to the namespaced options, e.g. `options.getMetrics().setEnabled(...)` + +**Tests:** `sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt` +- Test default value preserved when not in manifest +- Test explicit true +- Test explicit false + +### 4. Spring Boot Properties (Spring Boot only) + +`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`. + +No additional code is needed for namespaced options — Spring Boot auto-configuration handles this via property binding on the `SentryOptions` class hierarchy. + +**Tests:** `sentry-spring-boot*/src/test/kotlin/.../SentryAutoConfigurationTest.kt` +- Add the property (e.g. `"sentry.logs.enabled=true"`) to the existing `resolves all properties` test +- Assert the value is set on the resolved `SentryProperties` bean +- There are three Spring Boot modules with separate test files: `sentry-spring-boot`, `sentry-spring-boot-jakarta`, `sentry-spring-boot-4` + +### 5. Reading Options at Runtime + +Features check their options at usage time. For namespaced features the check typically happens in the feature's API class (e.g. `LoggerApi`, `MetricsApi`): +- Check `options.getLogs().isEnabled()` early and return if disabled +- Apply sampling via `options.getLogs().getSampleRate()` if applicable +- Apply `beforeSend` callback in `SentryClient` before sending + +When a feature has its own capture path (e.g. `captureLog`), the relevant classes are: +- `ISentryClient` — add the capture method signature +- `SentryClient` — implement capture, including `beforeSend` callback execution +- `NoOpSentryClient` — add no-op stub + +## Checklist for Adding a New Namespaced Option + +1. `SentryOptions.java` — nested options class + getter/setter on `SentryOptions` +2. `ExternalOptions.java` — `@Nullable` fields + wiring in `from()` +3. `SentryOptions.java` `merge()` — apply external options to namespaced class +4. `ManifestMetadataReader.java` — Android manifest support (if Android-relevant) +5. `SentryAutoConfigurationTest.kt` — Spring Boot property binding tests (all three Spring Boot modules) +6. Tests for all of the above (`SentryOptionsTest`, `ExternalOptionsTest`, `ManifestMetadataReaderTest`) +7. Run `./gradlew apiDump` — the nested class and its methods appear in `sentry.api` diff --git a/.cursor/rules/overview_dev.mdc b/.cursor/rules/overview_dev.mdc index f05d2992d40..a982cfe960e 100644 --- a/.cursor/rules/overview_dev.mdc +++ b/.cursor/rules/overview_dev.mdc @@ -15,6 +15,19 @@ These rules are automatically included in every conversation: Use the `fetch_rules` tool to include these rules when working on specific areas: ### Core SDK Functionality +- **`api`**: Use when working with: + - Adding or modifying public API surface + - Binary compatibility, `.api` files, `apiDump` + - Understanding which classes to modify for new API (interfaces, implementations, no-ops, adapters) + - `IScope`, `IScopes`, `Sentry` static API + - Attributes, logging API, protocol classes + +- **`options`**: Use when working with: + - Adding or modifying SDK options (`SentryOptions`, namespaced options) + - External options (`ExternalOptions`, `sentry.properties`, environment variables) + - Android manifest metadata (`ManifestMetadataReader`) + - Spring Boot properties (`SentryProperties`) + - **`scopes`**: Use when working with: - Hub/Scope management, forking, or lifecycle - `Sentry.getCurrentScopes()`, `pushScope()`, `withScope()` @@ -63,6 +76,13 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - **`new_module`**: Use when adding a new integration or sample module +### Workflow +- **`pr`**: Use when working with: + - Creating pull requests + - Stacked PRs, PR naming, stack comments + - PR changelog entries + - Merging or syncing stacked branches + ### Testing - **`e2e_tests`**: Use when working with: - System tests, sample applications @@ -76,6 +96,8 @@ Use the `fetch_rules` tool to include these rules when working on specific areas 2. **Fetch on-demand**: Use `fetch_rules ["rule_name"]` when you identify specific domain work 3. **Multiple rules**: Fetch multiple rules if task spans domains (e.g., `["scopes", "opentelemetry"]` for tracing scope issues) 4. **Context clues**: Look for these keywords in requests to determine relevant rules: + - Public API/apiDump/.api files/binary compatibility/new method → `api` + - Options/SentryOptions/ExternalOptions/ManifestMetadataReader/sentry.properties → `options` - Scope/Hub/forking → `scopes` - Duplicate/dedup → `deduplication` - OpenTelemetry/tracing/spans → `opentelemetry` @@ -84,3 +106,4 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - System test/e2e/sample → `e2e_tests` - Feature flag/addFeatureFlag/flag evaluation → `feature_flags` - Metrics/count/distribution/gauge → `metrics` + - PR/pull request/stacked PR/stack → `pr` diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc new file mode 100644 index 00000000000..581c8cc95d5 --- /dev/null +++ b/.cursor/rules/pr.mdc @@ -0,0 +1,231 @@ +--- +alwaysApply: false +description: Pull request creation, stacked PRs, and PR workflow +--- + +# Pull Request Rules + +## Creating a Pull Request + +### Step 1: Ensure Feature Branch + +If on `main`, create and switch to a new branch: + +```bash +git checkout -b / +``` + +Branch names use `feat/`, `fix/`, `ref/`, etc. matching the commit type. + +### Step 2: Format Code and Regenerate API Files + +```bash +./gradlew spotlessApply apiDump +``` + +This is **required** before every PR. Fix any failures before continuing. + +### Step 3: Commit Changes + +Use `git status --porcelain` to review changes. Ignore files only relevant for local testing (hardcoded debug toggles, sample app config, `.env` files). Restore those with `git checkout -- `. + +Follow [Sentry commit message conventions](https://develop.sentry.dev/engineering-practices/commit-messages/): + +``` +(): +``` + +Allowed types: `feat`, `fix`, `ref`, `chore`, `docs`, `test`, `perf`, `build`, `ci`, `style`, `meta`, `license` + +- Use imperative present tense ("add" not "added") +- Capitalize subject, no trailing period +- Keep under 100 characters + +### Step 4: Push + +```bash +git push -u origin HEAD +``` + +If push fails due to diverged history, ask the user — do not force-push. + +### Step 5: Create PR + +Create a draft PR using the repo's PR template: + +```markdown +## :scroll: Description + + +## :bulb: Motivation and Context + + +## :green_heart: How did you test it? + + +## :pencil: Checklist +- [ ] I added GH Issue ID _&_ Linear ID +- [ ] I added tests to verify the changes. +- [ ] No new PII added or SDK only sends newly added PII if `sendDefaultPII` is enabled. +- [ ] I updated the docs if needed. +- [ ] I updated the wizard if needed. +- [ ] Review from the native team if needed. +- [ ] No breaking change or entry added to the changelog. +- [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs. + +## :crystal_ball: Next steps +``` + +### Step 6: Update Changelog + +Add an entry to `CHANGELOG.md` under `## Unreleased` in the appropriate subsection: + +| Change Type | Subsection | +|---|---| +| New feature | `### Features` | +| Bug fix | `### Fixes` | +| Refactoring, internal cleanup | `### Internal` | +| Dependency update | `### Dependencies` | + +Entry format: + +```markdown +- ([#](https://github.com/getsentry/sentry-java/pull/)) +``` + +Commit changelog separately: + +```bash +git add CHANGELOG.md && git commit -m "changelog" && git push +``` + +### PR Title Format + +Follow the commit message format: + +``` +(): +``` + +Examples: +- `feat(core): Add structured logging support` +- `fix(android): Prevent crash on API 21 when registering receiver` + +--- + +## Stacked PRs + +Stacked PRs split a large feature into small, easy-to-review PRs where each builds on the previous one. This follows the same concept as the [Graphite](https://graphite.dev/) stacking workflow. + +### Structure + +``` +main → stack-pr-1 → stack-pr-2 → stack-pr-3 → ... +``` + +- The first PR in the stack targets `main` as its base branch. +- Each subsequent PR targets the previous stack PR's branch as its base. +- Each PR contains only incremental changes on top of the previous one. + +### Branch Naming + +Prefer a shared prefix for the feature, with descriptive suffixes per PR. The type prefix (`feat/`, `fix/`, etc.) may vary depending on the nature of each PR's changes: + +``` +feat/scope-attributes # PR 1 +feat/scope-attributes-logger # PR 2 +fix/attribute-type-detection # PR 3 (fix, different name — that's fine) +``` + +### PR Title Naming + +Include the topic name and a sequential number in brackets: + +``` +(): [ ] +``` + +Examples: +- `feat(core): [Global Attributes 1] Add scope-level attributes API` +- `feat(core): [Global Attributes 2] Wire scope attributes into LoggerApi and MetricsApi` +- `feat(samples): [Global Attributes 3] Showcase scope attributes in Spring Boot 4 sample` + +### Finding All PRs in a Stack + +Do **not** rely on branch name patterns — later PRs in a stack may use different prefixes or naming. Instead: + +1. Find the PR for the current branch: + ```bash + gh pr list --head "$(git branch --show-current)" --json number,title,baseRefName --jq '.[0]' + ``` +2. Read the stack comment on that PR — it lists every PR in the stack. +3. If there is no stack comment yet, walk the chain in both directions: + ```bash + # Find the PR whose head branch is the current PR's base (go up) + gh pr list --head --json number,title,baseRefName + + # Find PRs whose base branch is the current PR's head (go down) + gh pr list --base --json number,title,headRefName + ``` + Repeat until you reach `main` going up and find no more PRs going down. + +### Creating a New Stacked PR + +1. Start from the tip of the previous stack branch (or `main` for the first PR). +2. Create a new branch, make changes, format, commit, and push. +3. Create the PR with `--base `: + ```bash + gh pr create --base feat/previous-branch --draft --title "(): [ ] " --body "..." + ``` +4. Add the stack comment to the new PR and update it on all existing PRs in the stack (see below). + +### Stack Comment + +Every PR in the stack must have a comment listing all PRs in the stack. When a new PR is added, update the comment on **all** PRs in the stack. + +Format: + +```markdown +## PR Stack () + +- [#5118](https://github.com/getsentry/sentry-java/pull/5118) — Add scope-level attributes API +- [#5120](https://github.com/getsentry/sentry-java/pull/5120) — Wire scope attributes into LoggerApi and MetricsApi +- [#5121](https://github.com/getsentry/sentry-java/pull/5121) — Showcase scope attributes in Spring Boot 4 samples +``` + +No status column — GitHub already shows that. + +To add or update the stack comment on a PR: + +```bash +# Find existing stack comment (if any) +gh api repos/getsentry/sentry-java/issues//comments --jq '.[] | select(.body | startswith("## PR Stack")) | .id' + +# Create new comment +gh pr comment --body "" + +# Or update existing comment +gh api repos/getsentry/sentry-java/issues/comments/ -X PATCH -f body="" +``` + +### Merging Stacked PRs + +Merge in order from bottom to top (PR 1 first, then PR 2, etc.). After each merge, the next PR's base automatically becomes the merged branch's target. GitHub handles rebasing onto the new base. Verify each PR's diff still looks correct after the previous one merges. + +### Syncing the Stack + +When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack: + +```bash +# On the branch for PR 2 +git checkout feat/scope-attributes-logger +git merge feat/scope-attributes +git push + +# On the branch for PR 3 +git checkout feat/scope-attributes-sample +git merge feat/scope-attributes-logger +git push +``` + +Prefer merge over rebase — it preserves commit history, doesn't invalidate existing review comments, and avoids the need for force-pushing. Only rebase if explicitly requested. From b7fde007e21f716653dd8f2f3ad9afd250899e89 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 2 Mar 2026 16:33:05 +0100 Subject: [PATCH 019/391] fix: Trim DSN string before URI parsing (#5113) * fix: Trim DSN string before URI parsing Trailing or leading whitespace in the DSN string (commonly introduced by copy-paste) causes a URISyntaxException that crashes the application on startup. Trim the DSN before passing it to the URI constructor. Fixes GH-5087 Co-Authored-By: Claude * docs: Add changelog entry for DSN trimming fix Co-Authored-By: Claude * also trim on SentryOptions.setDsn * fix: Throw clear error when DSN is empty Previously an empty or whitespace-only DSN string would fall through to the URI constructor, producing a confusing error message. Now the Dsn constructor checks for empty strings after trimming and throws an IllegalArgumentException with a clear message. Co-Authored-By: Claude * Format code * ci: retrigger checks --------- Co-authored-by: Claude Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 1 + sentry/src/main/java/io/sentry/Dsn.java | 7 +++++-- .../src/main/java/io/sentry/SentryOptions.java | 2 +- sentry/src/test/java/io/sentry/DsnTest.kt | 18 ++++++++++++++++++ .../test/java/io/sentry/SentryOptionsTest.kt | 18 ++++++++++++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba0f4dcdfe..56a7be44b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ### Fixes - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) +- Trim DSN string before parsing to avoid `URISyntaxException` caused by trailing whitespace ([#5113](https://github.com/getsentry/sentry-java/pull/5113)) ### Dependencies diff --git a/sentry/src/main/java/io/sentry/Dsn.java b/sentry/src/main/java/io/sentry/Dsn.java index 836e2c55468..705d383266e 100644 --- a/sentry/src/main/java/io/sentry/Dsn.java +++ b/sentry/src/main/java/io/sentry/Dsn.java @@ -50,8 +50,11 @@ URI getSentryUri() { Dsn(@Nullable String dsn) throws IllegalArgumentException { try { - Objects.requireNonNull(dsn, "The DSN is required."); - final URI uri = new URI(dsn).normalize(); + final String dsnString = Objects.requireNonNull(dsn, "The DSN is required.").trim(); + if (dsnString.isEmpty()) { + throw new IllegalArgumentException("The DSN is empty."); + } + final URI uri = new URI(dsnString).normalize(); final String scheme = uri.getScheme(); if (!("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme))) { throw new IllegalArgumentException("Invalid DSN scheme: " + scheme); diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 14f4acf51fb..298e37795b3 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -749,7 +749,7 @@ Dsn retrieveParsedDsn() throws IllegalArgumentException { * @param dsn the DSN */ public void setDsn(final @Nullable String dsn) { - this.dsn = dsn; + this.dsn = dsn != null ? dsn.trim() : null; this.parsedDsn.resetValue(); dsnHash = StringUtils.calculateStringHash(this.dsn, logger); diff --git a/sentry/src/test/java/io/sentry/DsnTest.kt b/sentry/src/test/java/io/sentry/DsnTest.kt index eaa129c2073..6c454ad5c75 100644 --- a/sentry/src/test/java/io/sentry/DsnTest.kt +++ b/sentry/src/test/java/io/sentry/DsnTest.kt @@ -89,6 +89,24 @@ class DsnTest { assertEquals("http://host/api/id", dsn.sentryUri.toURL().toString()) } + @Test + fun `dsn parsed with leading and trailing whitespace`() { + val dsn = Dsn(" https://key@host/id ") + assertEquals("https://host/api/id", dsn.sentryUri.toURL().toString()) + } + + @Test + fun `when dsn is empty, throws exception`() { + val ex = assertFailsWith { Dsn("") } + assertEquals("java.lang.IllegalArgumentException: The DSN is empty.", ex.message) + } + + @Test + fun `when dsn is only whitespace, throws exception`() { + val ex = assertFailsWith { Dsn(" ") } + assertEquals("java.lang.IllegalArgumentException: The DSN is empty.", ex.message) + } + @Test fun `non http protocols are not accepted`() { assertFailsWith { Dsn("ftp://publicKey:secretKey@host/path/id") } diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 6868b55c2b9..80510db931f 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -588,6 +588,24 @@ class SentryOptionsTest { assertFalse(cacheDirPathWithoutDsn.contains(hash.toString())) } + @Test + fun `when setting dsn with whitespace, it is trimmed and produces the same cache dir path`() { + val dsn = "http://key@localhost/proj" + val options1 = + SentryOptions().apply { + setDsn(dsn) + cacheDirPath = "${File.separator}test" + } + val options2 = + SentryOptions().apply { + setDsn(" $dsn ") + cacheDirPath = "${File.separator}test" + } + + assertEquals(dsn, options2.dsn) + assertEquals(options1.cacheDirPath, options2.cacheDirPath) + } + @Test fun `when options are initialized, idleTimeout is 3000`() { assertEquals(3000L, SentryOptions().idleTimeout) From 9054d65b80c7a724faf4fefeaf104bba1f6e3f92 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 2 Mar 2026 17:26:44 +0100 Subject: [PATCH 020/391] fix(transport): Handle HTTP 413 with actionable log and use send_error for HTTP errors (#5115) * fix(transport): Handle HTTP 413 with actionable log and use send_error for HTTP errors Log a specific, actionable error message when Relay returns HTTP 413 (Content Too Large) instead of the generic "Request failed" message. The message suggests reducing event/breadcrumb/attachment sizes and mentions the `SentryOptions.onOversizedEvent` callback. Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error`, matching the client reports spec and aligning with sentry-python and sentry-cocoa. Fixes GH-5050 Co-Authored-By: Claude * docs: Add changelog entry for HTTP 413 handling Co-Authored-By: Claude * remove duplicate log message * Update changelog for client report discard reason Switch client report discard reason for HTTP 4xx/5xx errors. --------- Co-authored-by: Claude --- CHANGELOG.md | 2 + .../apache/ApacheHttpClientTransport.java | 21 +++++-- ...acheHttpClientTransportClientReportTest.kt | 32 +++++++++- sentry/api/sentry.api | 1 + .../io/sentry/clientreport/DiscardReason.java | 1 + .../sentry/transport/AsyncHttpTransport.java | 2 +- .../io/sentry/transport/HttpConnection.java | 13 +++- .../AsyncHttpTransportClientReportTest.kt | 59 +++++++++++++++++-- .../transport/AsyncHttpTransportTest.kt | 25 ++++++++ 9 files changed, 144 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56a7be44b1b..fec0ecc646a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ ### Fixes - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) +- Log an actionable error message when Relay returns HTTP 413 (Content Too Large) ([#5115](https://github.com/getsentry/sentry-java/pull/5115)) + - Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error` - Trim DSN string before parsing to avoid `URISyntaxException` caused by trailing whitespace ([#5113](https://github.com/getsentry/sentry-java/pull/5113)) ### Dependencies diff --git a/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransport.java b/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransport.java index 2cf1484b563..0d768bf1c52 100644 --- a/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransport.java +++ b/sentry-apache-http-client-5/src/main/java/io/sentry/transport/apache/ApacheHttpClientTransport.java @@ -113,16 +113,29 @@ public void send(final @NotNull SentryEnvelope envelope, final @NotNull Hint hin @Override public void completed(SimpleHttpResponse response) { if (response.getCode() != 200) { - options - .getLogger() - .log(ERROR, "Request failed, API returned %s", response.getCode()); + if (response.getCode() == 413) { + options + .getLogger() + .log( + ERROR, + "Envelope was discarded by the server because it was too large." + + " Consider reducing the size of events, breadcrumbs," + + " or attachments." + + " You can use the `SentryOptions.onOversizedEvent`" + + " callback to customize how oversized events" + + " are handled."); + } else { + options + .getLogger() + .log(ERROR, "Request failed, API returned %s", response.getCode()); + } if (response.getCode() >= 400 && response.getCode() != 429) { if (!HintUtils.hasType(hint, Retryable.class)) { options .getClientReportRecorder() .recordLostEnvelope( - DiscardReason.NETWORK_ERROR, envelopeWithClientReport); + DiscardReason.SEND_ERROR, envelopeWithClientReport); } } } else { diff --git a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt index d110b802345..afe0b38538d 100644 --- a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt +++ b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt @@ -145,7 +145,7 @@ class ApacheHttpClientTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeClientReportAttached)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterClientReportAttached), ) verifyNoMoreInteractions(fixture.clientReportRecorder) @@ -173,7 +173,7 @@ class ApacheHttpClientTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeClientReportAttached)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterClientReportAttached), ) verifyNoMoreInteractions(fixture.clientReportRecorder) @@ -191,6 +191,34 @@ class ApacheHttpClientTransportClientReportTest { verifyNoMoreInteractions(fixture.clientReportRecorder) } + @Test + fun `records lost envelope with send_error on 413 for non retryable`() { + val sut = fixture.getSut(SimpleHttpResponse(413)) + + sut.send(fixture.envelopeBeforeClientReportAttached) + + verify(fixture.clientReportRecorder, times(1)) + .attachReportToEnvelope(same(fixture.envelopeBeforeClientReportAttached)) + verify(fixture.clientReportRecorder, times(1)) + .recordLostEnvelope( + eq(DiscardReason.SEND_ERROR), + same(fixture.envelopeAfterClientReportAttached), + ) + verifyNoMoreInteractions(fixture.clientReportRecorder) + } + + @Test + fun `does not record lost envelope on 413 error for retryable`() { + val sut = fixture.getSut(SimpleHttpResponse(413)) + + sut.send(fixture.envelopeBeforeClientReportAttached, retryableHint()) + + verify(fixture.clientReportRecorder, times(1)) + .attachReportToEnvelope(same(fixture.envelopeBeforeClientReportAttached)) + verify(fixture.clientReportRecorder, never()).recordLostEnvelope(any(), any()) + verifyNoMoreInteractions(fixture.clientReportRecorder) + } + @Test fun `does not record lost envelope on 429 error for non retryable`() { val sut = fixture.getSut(SimpleHttpResponse(429)) diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 4399b191d21..c112e84608d 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -4806,6 +4806,7 @@ public final class io/sentry/clientreport/DiscardReason : java/lang/Enum { public static final field QUEUE_OVERFLOW Lio/sentry/clientreport/DiscardReason; public static final field RATELIMIT_BACKOFF Lio/sentry/clientreport/DiscardReason; public static final field SAMPLE_RATE Lio/sentry/clientreport/DiscardReason; + public static final field SEND_ERROR Lio/sentry/clientreport/DiscardReason; public fun getReason ()Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Lio/sentry/clientreport/DiscardReason; public static fun values ()[Lio/sentry/clientreport/DiscardReason; diff --git a/sentry/src/main/java/io/sentry/clientreport/DiscardReason.java b/sentry/src/main/java/io/sentry/clientreport/DiscardReason.java index 01031fbb3b7..98f25386a5f 100644 --- a/sentry/src/main/java/io/sentry/clientreport/DiscardReason.java +++ b/sentry/src/main/java/io/sentry/clientreport/DiscardReason.java @@ -5,6 +5,7 @@ public enum DiscardReason { CACHE_OVERFLOW("cache_overflow"), RATELIMIT_BACKOFF("ratelimit_backoff"), NETWORK_ERROR("network_error"), + SEND_ERROR("send_error"), SAMPLE_RATE("sample_rate"), BEFORE_SEND("before_send"), EVENT_PROCESSOR("event_processor"), // also for ignored exceptions diff --git a/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java b/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java index b664302f1e0..c4d54c173ef 100644 --- a/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java +++ b/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java @@ -315,7 +315,7 @@ public void run() { if (result.getResponseCode() != 429) { options .getClientReportRecorder() - .recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelopeWithClientReport); + .recordLostEnvelope(DiscardReason.SEND_ERROR, envelopeWithClientReport); } } diff --git a/sentry/src/main/java/io/sentry/transport/HttpConnection.java b/sentry/src/main/java/io/sentry/transport/HttpConnection.java index 3256804201a..71c3ebb15b2 100644 --- a/sentry/src/main/java/io/sentry/transport/HttpConnection.java +++ b/sentry/src/main/java/io/sentry/transport/HttpConnection.java @@ -180,7 +180,18 @@ HttpURLConnection open() throws IOException { updateRetryAfterLimits(connection, responseCode); if (!isSuccessfulResponseCode(responseCode)) { - options.getLogger().log(ERROR, "Request failed, API returned %s", responseCode); + if (responseCode == 413) { + options + .getLogger() + .log( + ERROR, + "Envelope was discarded by the server because it was too large." + + " Consider reducing the size of events, breadcrumbs, or attachments." + + " You can use the `SentryOptions.onOversizedEvent` callback" + + " to customize how oversized events are handled."); + } else { + options.getLogger().log(ERROR, "Request failed, API returned %s", responseCode); + } // double check because call is expensive if (options.isDebug()) { final @NotNull String errorMessage = getErrorMessageFromStream(connection); diff --git a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt index ec05af3df36..6877d521d26 100644 --- a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt +++ b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt @@ -94,7 +94,7 @@ class AsyncHttpTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterAttachingClientReport), ) verifyNoMoreInteractions(fixture.clientReportRecorder) @@ -118,7 +118,7 @@ class AsyncHttpTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterAttachingClientReport), ) verifyNoMoreInteractions(fixture.clientReportRecorder) @@ -145,7 +145,7 @@ class AsyncHttpTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterAttachingClientReport), ) verifyNoMoreInteractions(fixture.clientReportRecorder) @@ -169,12 +169,63 @@ class AsyncHttpTransportClientReportTest { .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) verify(fixture.clientReportRecorder, times(1)) .recordLostEnvelope( - eq(DiscardReason.NETWORK_ERROR), + eq(DiscardReason.SEND_ERROR), same(fixture.envelopeAfterAttachingClientReport), ) verifyNoMoreInteractions(fixture.clientReportRecorder) } + @Test + fun `records lost envelope with send_error on 413 for retryable`() { + // given + givenSetup(TransportResult.error(413)) + whenever( + fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()) + ) + .thenReturn(true) + + // when + val retryableHint = retryableHint() + assertFailsWith(java.lang.IllegalStateException::class) { + fixture.getSUT().send(fixture.envelopeBeforeAttachingClientReport, retryableHint) + } + + // then + verify(fixture.clientReportRecorder, times(1)) + .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) + verify(fixture.clientReportRecorder, times(1)) + .recordLostEnvelope( + eq(DiscardReason.SEND_ERROR), + same(fixture.envelopeAfterAttachingClientReport), + ) + verifyNoMoreInteractions(fixture.clientReportRecorder) + val sentrySdkHint = HintUtils.getSentrySdkHint(retryableHint) + assertFalse((sentrySdkHint as Retryable).isRetry) + verify(fixture.envelopeCache).discard(fixture.envelopeBeforeAttachingClientReport) + } + + @Test + fun `records lost envelope with send_error on 413 for non retryable`() { + // given + givenSetup(TransportResult.error(413)) + + // when + assertFailsWith(java.lang.IllegalStateException::class) { + fixture.getSUT().send(fixture.envelopeBeforeAttachingClientReport) + } + + // then + verify(fixture.clientReportRecorder, times(1)) + .attachReportToEnvelope(same(fixture.envelopeBeforeAttachingClientReport)) + verify(fixture.clientReportRecorder, times(1)) + .recordLostEnvelope( + eq(DiscardReason.SEND_ERROR), + same(fixture.envelopeAfterAttachingClientReport), + ) + verifyNoMoreInteractions(fixture.clientReportRecorder) + verify(fixture.envelopeCache).discard(fixture.envelopeBeforeAttachingClientReport) + } + @Test fun `records lost envelope on full queue for non retryable`() { // given diff --git a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt index 90bd05069ef..70092ffa7ba 100644 --- a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt +++ b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt @@ -156,6 +156,31 @@ class AsyncHttpTransportTest { order.verify(fixture.sentryOptions.envelopeDiskCache).discard(eq(envelope)) } + @Test + fun `discards envelope after unsuccessful send 413`() { + // given + val envelope = SentryEnvelope.from(fixture.sentryOptions.serializer, createSession(), null) + whenever(fixture.transportGate.isConnected).thenReturn(true) + whenever(fixture.rateLimiter.filter(eq(envelope), anyOrNull())).thenReturn(envelope) + whenever(fixture.connection.send(any())).thenReturn(TransportResult.error(413)) + + // when + try { + fixture.getSUT().send(envelope) + } catch (e: IllegalStateException) { + // expected - this is how the AsyncConnection signals failure to the executor for it to retry + } + + // then + val order = inOrder(fixture.connection, fixture.sentryOptions.envelopeDiskCache) + + // because storeBeforeSend is enabled by default + order.verify(fixture.sentryOptions.envelopeDiskCache).storeEnvelope(eq(envelope), anyOrNull()) + + order.verify(fixture.connection).send(eq(envelope)) + order.verify(fixture.sentryOptions.envelopeDiskCache).discard(eq(envelope)) + } + @Test fun `discards envelope after unsuccessful send 429`() { // given From 5a20352b4a4493259a3a889424e915d614655871 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 3 Mar 2026 10:17:18 +0100 Subject: [PATCH 021/391] fix(init): Reduce allocations and bytecode instructions during Sentry.init (#5135) * fix(init): Perform less allocation/bytecode instructions in Sentry.init * Switch new thread to executorService in AssetsModulesLoader * activate options earlier * changelog * fix: Prevent SpotlightIntegration from being re-added after user removal Use AtomicBoolean to ensure activate() only loads SpotlightIntegration once, so users can remove it in their configuration callback without it being re-added by the second activate() call from Sentry.init(). Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 1 + .../core/AndroidOptionsInitializer.java | 3 +- .../internal/modules/AssetsModulesLoader.java | 18 ++++++++---- .../sentry/android/core/SentryAndroidTest.kt | 14 +++++++++ .../modules/AssetsModulesLoaderTest.kt | 7 +++-- ...DuplicateEventDetectionEventProcessor.java | 3 +- .../java/io/sentry/MainEventProcessor.java | 14 +-------- .../io/sentry/SentryExceptionFactory.java | 4 +-- .../main/java/io/sentry/SentryOptions.java | 29 ++++++++++++------- .../java/io/sentry/SentryThreadFactory.java | 4 +-- .../UncaughtExceptionHandlerIntegration.java | 2 +- 11 files changed, 58 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fec0ecc646a..e50e09b72b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - Log an actionable error message when Relay returns HTTP 413 (Content Too Large) ([#5115](https://github.com/getsentry/sentry-java/pull/5115)) - Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error` - Trim DSN string before parsing to avoid `URISyntaxException` caused by trailing whitespace ([#5113](https://github.com/getsentry/sentry-java/pull/5113)) +- Reduce allocations and bytecode instructions during `Sentry.init` ([#5135](https://github.com/getsentry/sentry-java/pull/5135)) ### Dependencies diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index 5bfebaed922..589c4f8d2a1 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -142,6 +142,7 @@ static void loadDefaultAndMetadataOptions( readDefaultOptionValues(options, finalContext, buildInfoProvider); AppState.getInstance().registerLifecycleObserver(options); + options.activate(); } @TestOnly @@ -200,7 +201,7 @@ static void initializeIntegrationsAndProcessors( final @NotNull AppStartMetrics appStartMetrics = AppStartMetrics.getInstance(); if (options.getModulesLoader() instanceof NoOpModulesLoader) { - options.setModulesLoader(new AssetsModulesLoader(context, options.getLogger())); + options.setModulesLoader(new AssetsModulesLoader(context, options)); } if (options.getDebugMetaLoader() instanceof NoOpDebugMetaLoader) { options.setDebugMetaLoader(new AssetsDebugMetaLoader(context, options.getLogger())); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java index 05bb75a60f4..1aa8a89f8fc 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java @@ -1,8 +1,8 @@ package io.sentry.android.core.internal.modules; import android.content.Context; -import io.sentry.ILogger; import io.sentry.SentryLevel; +import io.sentry.SentryOptions; import io.sentry.android.core.ContextUtils; import io.sentry.internal.modules.ModulesLoader; import java.io.FileNotFoundException; @@ -18,13 +18,21 @@ public final class AssetsModulesLoader extends ModulesLoader { private final @NotNull Context context; - public AssetsModulesLoader(final @NotNull Context context, final @NotNull ILogger logger) { - super(logger); + public AssetsModulesLoader(final @NotNull Context context, final @NotNull SentryOptions options) { + super(options.getLogger()); this.context = ContextUtils.getApplicationContext(context); // pre-load modules on a bg thread to avoid doing so on the main thread in case of a crash/error - //noinspection Convert2MethodRef - new Thread(() -> getOrLoadModules()).start(); + try { + options + .getExecutorService() + .submit( + () -> { + getOrLoadModules(); + }); + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, "AssetsModulesLoader submit failed", e); + } } @Override diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index 716d03d8d7a..b7fad8abee2 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -16,6 +16,7 @@ import io.sentry.DateUtils import io.sentry.Hint import io.sentry.ILogger import io.sentry.ISentryClient +import io.sentry.NoOpSentryExecutorService import io.sentry.Sentry import io.sentry.Sentry.OptionsConfiguration import io.sentry.SentryEnvelope @@ -528,6 +529,19 @@ class SentryAndroidTest { assertEquals(99, AppStartMetrics.getInstance().appStartTimeSpan.startUptimeMs) } + @Test + fun `executor service is not NoOp when AndroidConnectionStatusProvider is initialized`() { + var executorServiceIsNoOp = true + fixture.initSut(context = context) { options -> + options.dsn = "https://key@sentry.io/123" + // the config callback runs before initializeIntegrationsAndProcessors, which creates + // AndroidConnectionStatusProvider - so if the executor is already real here, + // it's guaranteed to be real when the provider calls submitSafe() + executorServiceIsNoOp = options.executorService is NoOpSentryExecutorService + } + assertFalse(executorServiceIsNoOp) + } + @Test fun `if the config options block throws still intializes android event processors`() { lateinit var optionsRef: SentryOptions diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt index 9df02a067d0..128087a315d 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt @@ -2,7 +2,8 @@ package io.sentry.android.core.internal.modules import android.content.Context import android.content.res.AssetManager -import io.sentry.ILogger +import io.sentry.SentryOptions +import io.sentry.test.ImmediateExecutorService import java.io.FileNotFoundException import java.nio.charset.Charset import kotlin.test.Test @@ -16,7 +17,7 @@ class AssetsModulesLoaderTest { class Fixture { val context = mock() val assets = mock() - val logger = mock() + val options = SentryOptions().apply { executorService = ImmediateExecutorService() } fun getSut( fileName: String = "sentry-external-modules.txt", @@ -31,7 +32,7 @@ class AssetsModulesLoaderTest { whenever(assets.open(fileName)).thenThrow(FileNotFoundException()) } whenever(context.assets).thenReturn(assets) - return AssetsModulesLoader(context, logger) + return AssetsModulesLoader(context, options) } } diff --git a/sentry/src/main/java/io/sentry/DuplicateEventDetectionEventProcessor.java b/sentry/src/main/java/io/sentry/DuplicateEventDetectionEventProcessor.java index 5004e6514e9..fc178d789f3 100644 --- a/sentry/src/main/java/io/sentry/DuplicateEventDetectionEventProcessor.java +++ b/sentry/src/main/java/io/sentry/DuplicateEventDetectionEventProcessor.java @@ -1,6 +1,5 @@ package io.sentry; -import io.sentry.util.Objects; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -16,7 +15,7 @@ public final class DuplicateEventDetectionEventProcessor implements EventProcess private final @NotNull SentryOptions options; public DuplicateEventDetectionEventProcessor(final @NotNull SentryOptions options) { - this.options = Objects.requireNonNull(options, "options are required"); + this.options = options; } @Override diff --git a/sentry/src/main/java/io/sentry/MainEventProcessor.java b/sentry/src/main/java/io/sentry/MainEventProcessor.java index 5ad19c79e32..8c684bfb65a 100644 --- a/sentry/src/main/java/io/sentry/MainEventProcessor.java +++ b/sentry/src/main/java/io/sentry/MainEventProcessor.java @@ -8,7 +8,6 @@ import io.sentry.protocol.SentryTransaction; import io.sentry.protocol.User; import io.sentry.util.HintUtils; -import io.sentry.util.Objects; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; @@ -29,7 +28,7 @@ public final class MainEventProcessor implements EventProcessor, Closeable { private volatile @Nullable HostnameCache hostnameCache = null; public MainEventProcessor(final @NotNull SentryOptions options) { - this.options = Objects.requireNonNull(options, "The SentryOptions is required."); + this.options = options; final SentryStackTraceFactory sentryStackTraceFactory = new SentryStackTraceFactory(this.options); @@ -38,17 +37,6 @@ public MainEventProcessor(final @NotNull SentryOptions options) { sentryThreadFactory = new SentryThreadFactory(sentryStackTraceFactory); } - MainEventProcessor( - final @NotNull SentryOptions options, - final @NotNull SentryThreadFactory sentryThreadFactory, - final @NotNull SentryExceptionFactory sentryExceptionFactory) { - this.options = Objects.requireNonNull(options, "The SentryOptions is required."); - this.sentryThreadFactory = - Objects.requireNonNull(sentryThreadFactory, "The SentryThreadFactory is required."); - this.sentryExceptionFactory = - Objects.requireNonNull(sentryExceptionFactory, "The SentryExceptionFactory is required."); - } - @Override public @NotNull SentryEvent process(final @NotNull SentryEvent event, final @NotNull Hint hint) { setCommons(event); diff --git a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java index 8b2b5709463..d47776a1627 100644 --- a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java +++ b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java @@ -6,7 +6,6 @@ import io.sentry.protocol.SentryStackFrame; import io.sentry.protocol.SentryStackTrace; import io.sentry.protocol.SentryThread; -import io.sentry.util.Objects; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; @@ -31,8 +30,7 @@ public final class SentryExceptionFactory { * @param sentryStackTraceFactory the sentryStackTraceFactory */ public SentryExceptionFactory(final @NotNull SentryStackTraceFactory sentryStackTraceFactory) { - this.sentryStackTraceFactory = - Objects.requireNonNull(sentryStackTraceFactory, "The SentryStackTraceFactory is required."); + this.sentryStackTraceFactory = sentryStackTraceFactory; } @NotNull diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 298e37795b3..7b21661c223 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -46,6 +46,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.atomic.AtomicBoolean; import javax.net.ssl.SSLSocketFactory; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -318,6 +319,12 @@ public class SentryOptions { /** Sentry Executor Service that sends cached events and envelopes on App. start. */ private @NotNull ISentryExecutorService executorService = NoOpSentryExecutorService.getInstance(); + /** + * Whether SpotlightIntegration has already been loaded via reflection. This prevents re-adding it + * if the user removed it in their configuration callback and activate() is called again. + */ + private final @NotNull AtomicBoolean spotlightIntegrationLoaded = new AtomicBoolean(false); + /** connection timeout in milliseconds. */ private int connectionTimeoutMillis = 30_000; @@ -655,6 +662,18 @@ public void activate() { executorService = new SentryExecutorService(this); executorService.prewarm(); } + + // SpotlightIntegration is loaded via reflection to allow the sentry-spotlight module + // to be excluded from release builds, preventing insecure HTTP URLs from appearing in APKs. + // Only attempt once to avoid re-adding after user removal in their configuration callback. + if (spotlightIntegrationLoaded.compareAndSet(false, true)) { + try { + final Class clazz = Class.forName("io.sentry.spotlight.SpotlightIntegration"); + integrations.add((Integration) clazz.getConstructor().newInstance()); + } catch (Throwable ignored) { + // SpotlightIntegration not available + } + } } /** @@ -3340,16 +3359,6 @@ private SentryOptions(final boolean empty) { integrations.add(new ShutdownHookIntegration()); - // SpotlightIntegration is loaded via reflection to allow the sentry-spotlight module - // to be excluded from release builds, preventing insecure HTTP URLs from appearing in APKs - try { - final Class clazz = Class.forName("io.sentry.spotlight.SpotlightIntegration"); - final Integration spotlight = (Integration) clazz.getConstructor().newInstance(); - integrations.add(spotlight); - } catch (Throwable ignored) { - // SpotlightIntegration not available - } - eventProcessors.add(new MainEventProcessor(this)); eventProcessors.add(new DuplicateEventDetectionEventProcessor(this)); diff --git a/sentry/src/main/java/io/sentry/SentryThreadFactory.java b/sentry/src/main/java/io/sentry/SentryThreadFactory.java index 0b8f2584996..8bd14483269 100644 --- a/sentry/src/main/java/io/sentry/SentryThreadFactory.java +++ b/sentry/src/main/java/io/sentry/SentryThreadFactory.java @@ -3,7 +3,6 @@ import io.sentry.protocol.SentryStackFrame; import io.sentry.protocol.SentryStackTrace; import io.sentry.protocol.SentryThread; -import io.sentry.util.Objects; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -26,8 +25,7 @@ public final class SentryThreadFactory { * @param sentryStackTraceFactory the SentryStackTraceFactory */ public SentryThreadFactory(final @NotNull SentryStackTraceFactory sentryStackTraceFactory) { - this.sentryStackTraceFactory = - Objects.requireNonNull(sentryStackTraceFactory, "The SentryStackTraceFactory is required."); + this.sentryStackTraceFactory = sentryStackTraceFactory; } /** diff --git a/sentry/src/main/java/io/sentry/UncaughtExceptionHandlerIntegration.java b/sentry/src/main/java/io/sentry/UncaughtExceptionHandlerIntegration.java index 8ca02cb8550..6ea61895799 100644 --- a/sentry/src/main/java/io/sentry/UncaughtExceptionHandlerIntegration.java +++ b/sentry/src/main/java/io/sentry/UncaughtExceptionHandlerIntegration.java @@ -44,7 +44,7 @@ public UncaughtExceptionHandlerIntegration() { } UncaughtExceptionHandlerIntegration(final @NotNull UncaughtExceptionHandler threadAdapter) { - this.threadAdapter = Objects.requireNonNull(threadAdapter, "threadAdapter is required."); + this.threadAdapter = threadAdapter; } @Override From bcd5eb7c3afca745431c5ab8b4452d66edfbb6c7 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 3 Mar 2026 10:24:27 +0100 Subject: [PATCH 022/391] fix(test): Fix flaky previous session finalization test (#5139) Use awaitility to wait for the previous session file to be deleted instead of asserting immediately. The PreviousSessionFinalizer runs as a separate task after the test's task in the single-threaded executor, so there is a race between the assertion and the file deletion. Co-authored-by: Claude --- sentry/src/test/java/io/sentry/SentryTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry/src/test/java/io/sentry/SentryTest.kt b/sentry/src/test/java/io/sentry/SentryTest.kt index 72febe35665..c3da8c1c123 100644 --- a/sentry/src/test/java/io/sentry/SentryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTest.kt @@ -964,7 +964,9 @@ class SentryTest { } await.untilTrue(triggered) - assertFalse(previousSessionFile.exists()) + // The PreviousSessionFinalizer runs as a separate task after the test's task in the + // single-threaded executor, so we need to wait for it to delete the file too. + await.until { !previousSessionFile.exists() } } @Test From 7b67c20caa4817c8f6da4a85cac35af3e159cb19 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 3 Mar 2026 10:25:31 +0100 Subject: [PATCH 023/391] fix(test): Fix flaky background-foreground replay test (#5140) Increase sessionIntervalMillis from 2ms to 500ms so the timer task from the first onBackground() doesn't fire before cancelTask() in the second onForeground() can cancel it. With 2ms the timer could race and call replayController.stop() twice. Co-authored-by: Claude --- .../test/java/io/sentry/android/core/LifecycleWatcherTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt index 5149f167129..09c4fae8dc4 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt @@ -282,7 +282,8 @@ class LifecycleWatcherTest { @Test fun `background-foreground replay`() { whenever(fixture.dateProvider.currentTimeMillis).thenReturn(1L) - val watcher = fixture.getSUT(sessionIntervalMillis = 2L, enableAppLifecycleBreadcrumbs = false) + val watcher = + fixture.getSUT(sessionIntervalMillis = 500L, enableAppLifecycleBreadcrumbs = false) watcher.onForeground() verify(fixture.replayController).start() From 56d97d56e07972fc1d9ee3f3c756f0891f0de64a Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 3 Mar 2026 10:36:03 +0100 Subject: [PATCH 024/391] fix(android): Remove AndroidRuntimeManager to prevent ANRs during SDK init (#5127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(android): Remove AndroidRuntimeManager to prevent ANRs during SDK init StrictMode.setVmPolicy()/setThreadPolicy() calls inside runWithRelaxedPolicy() triggered binder IPC on the main thread, causing ANRs (SDK-CRASHES-JAVA-32FQ 34k+, SDK-CRASHES-JAVA-32PH 21k+, SDK-CRASHES-JAVA-32Q9 18k+ events). StrictMode only logs warnings in production by default, so relaxing it is unnecessary and harmful. Co-Authored-By: Claude Opus 4.6 * changelog: Add entry for AndroidRuntimeManager removal Co-Authored-By: Claude Opus 4.6 * fix(test): Remove initNotThrowStrictMode test This test validated that StrictMode with penaltyDeath() didn't crash during SDK init. Since we removed the RuntimeManager that relaxed StrictMode, this test is no longer applicable — the SDK no longer attempts to suppress StrictMode violations. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 1 + .../core/AndroidOptionsInitializer.java | 10 +- .../ApplicationExitInfoEventProcessor.java | 2 +- .../core/DefaultAndroidEventProcessor.java | 4 +- .../sentry/android/core/DeviceInfoUtil.java | 38 +++-- .../android/core/InternalSentrySdk.java | 3 +- .../core/SentryPerformanceProvider.java | 6 +- .../core/cache/AndroidEnvelopeCache.java | 5 +- .../internal/util/AndroidRuntimeManager.java | 32 ----- .../core/AndroidOptionsInitializerTest.kt | 7 - .../util/AndroidRuntimeManagerTest.kt | 130 ------------------ .../io/sentry/uitest/android/SdkInitTests.kt | 50 ------- sentry/api/sentry.api | 17 --- sentry/src/main/java/io/sentry/Sentry.java | 6 +- .../main/java/io/sentry/SentryOptions.java | 25 ---- .../sentry/util/runtime/IRuntimeManager.java | 15 -- .../util/runtime/NeutralRuntimeManager.java | 17 --- .../util/runtime/NeutralRuntimeManagerTest.kt | 61 -------- 18 files changed, 29 insertions(+), 400 deletions(-) delete mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidRuntimeManager.java delete mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidRuntimeManagerTest.kt delete mode 100644 sentry/src/main/java/io/sentry/util/runtime/IRuntimeManager.java delete mode 100644 sentry/src/main/java/io/sentry/util/runtime/NeutralRuntimeManager.java delete mode 100644 sentry/src/test/java/io/sentry/util/runtime/NeutralRuntimeManagerTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index e50e09b72b7..35aa59686f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ ### Fixes +- Remove `AndroidRuntimeManager` StrictMode relaxation to prevent ANRs during SDK init ([#5127](https://github.com/getsentry/sentry-java/pull/5127)) - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) - Log an actionable error message when Relay returns HTTP 413 (Content Too Large) ([#5115](https://github.com/getsentry/sentry-java/pull/5115)) - Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error` diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index 589c4f8d2a1..a189b30d07b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -32,7 +32,6 @@ import io.sentry.android.core.internal.modules.AssetsModulesLoader; import io.sentry.android.core.internal.util.AndroidConnectionStatusProvider; import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; -import io.sentry.android.core.internal.util.AndroidRuntimeManager; import io.sentry.android.core.internal.util.AndroidThreadChecker; import io.sentry.android.core.internal.util.SentryFrameMetricsCollector; import io.sentry.android.core.performance.AppStartMetrics; @@ -123,7 +122,6 @@ static void loadDefaultAndMetadataOptions( options.setDefaultScopeType(ScopeType.CURRENT); options.setOpenTelemetryMode(SentryOpenTelemetryMode.OFF); options.setDateProvider(new SentryAndroidDateProvider()); - options.setRuntimeManager(new AndroidRuntimeManager()); options.getLogs().setLoggerBatchProcessorFactory(new AndroidLoggerBatchProcessorFactory()); options.getMetrics().setMetricsBatchProcessorFactory(new AndroidMetricsBatchProcessorFactory()); @@ -135,10 +133,7 @@ static void loadDefaultAndMetadataOptions( ManifestMetadataReader.applyMetadata(finalContext, options, buildInfoProvider); - options.setCacheDirPath( - options - .getRuntimeManager() - .runWithRelaxedPolicy(() -> getCacheDir(finalContext).getAbsolutePath())); + options.setCacheDirPath(getCacheDir(finalContext).getAbsolutePath()); readDefaultOptionValues(options, finalContext, buildInfoProvider); AppState.getInstance().registerLifecycleObserver(options); @@ -471,8 +466,7 @@ private static void readDefaultOptionValues( if (options.getDistinctId() == null) { try { - options.setDistinctId( - options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context))); + options.setDistinctId(Installation.id(context)); } catch (RuntimeException e) { options.getLogger().log(SentryLevel.ERROR, "Could not generate distinct Id.", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java index ec60bd8f128..58d0a5a59d7 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java @@ -564,7 +564,7 @@ private void mergeUser(final @NotNull SentryBaseEvent event) { private @Nullable String getDeviceId() { try { - return options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context)); + return Installation.id(context); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, "Error getting installationId.", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/DefaultAndroidEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/DefaultAndroidEventProcessor.java index 14cafab224d..7671935bb05 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/DefaultAndroidEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/DefaultAndroidEventProcessor.java @@ -174,7 +174,7 @@ private void mergeUser(final @NotNull SentryBaseEvent event) { // userId should be set even if event is Cached as the userId is static and won't change anyway. if (user.getId() == null) { - user.setId(options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context))); + user.setId(Installation.id(context)); } if (user.getIpAddress() == null && options.isSendDefaultPii()) { user.setIpAddress(IpAddressUtils.DEFAULT_IP_ADDRESS); @@ -372,7 +372,7 @@ private void setAppExtras(final @NotNull App app, final @NotNull Hint hint) { */ public @NotNull User getDefaultUser(final @NotNull Context context) { final @NotNull User user = new User(); - user.setId(options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context))); + user.setId(Installation.id(context)); return user; } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java index 5c06a558103..f3b17c5854a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java @@ -232,27 +232,21 @@ private void setDeviceIO( // this way of getting the size of storage might be problematic for storages bigger than 2GB // check the use of // https://developer.android.com/reference/java/io/File.html#getFreeSpace%28%29 - options - .getRuntimeManager() - .runWithRelaxedPolicy( - () -> { - final @Nullable File dataDir = Environment.getDataDirectory(); - if (dataDir != null) { - StatFs internalStorageStat = new StatFs(dataDir.getPath()); - device.setStorageSize(getTotalInternalStorage(internalStorageStat)); - device.setFreeStorage(getUnusedInternalStorage(internalStorageStat)); - } - - if (includeExternalStorage) { - final @Nullable File internalStorageFile = context.getExternalFilesDir(null); - final @Nullable StatFs externalStorageStat = - getExternalStorageStat(internalStorageFile); - if (externalStorageStat != null) { - device.setExternalStorageSize(getTotalExternalStorage(externalStorageStat)); - device.setExternalFreeStorage(getUnusedExternalStorage(externalStorageStat)); - } - } - }); + final @Nullable File dataDir = Environment.getDataDirectory(); + if (dataDir != null) { + StatFs internalStorageStat = new StatFs(dataDir.getPath()); + device.setStorageSize(getTotalInternalStorage(internalStorageStat)); + device.setFreeStorage(getUnusedInternalStorage(internalStorageStat)); + } + + if (includeExternalStorage) { + final @Nullable File internalStorageFile = context.getExternalFilesDir(null); + final @Nullable StatFs externalStorageStat = getExternalStorageStat(internalStorageFile); + if (externalStorageStat != null) { + device.setExternalStorageSize(getTotalExternalStorage(externalStorageStat)); + device.setExternalFreeStorage(getUnusedExternalStorage(externalStorageStat)); + } + } if (device.getConnectionType() == null) { // wifi, ethernet or cellular, null if none @@ -493,7 +487,7 @@ private Long getUnusedExternalStorage(final @NotNull StatFs stat) { @Nullable private String getDeviceId() { try { - return options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context)); + return Installation.id(context); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, "Error getting installationId.", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java index 7d0a7f77e58..cae558f0d43 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java @@ -102,8 +102,7 @@ public static Map serializeScope( } if (user.getId() == null) { try { - user.setId( - options.getRuntimeManager().runWithRelaxedPolicy(() -> Installation.id(context))); + user.setId(Installation.id(context)); } catch (RuntimeException e) { logger.log(SentryLevel.ERROR, "Could not retrieve installation ID", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java index d687670f9b6..7e43d626b34 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java @@ -20,12 +20,10 @@ import io.sentry.SentryOptions; import io.sentry.TracesSampler; import io.sentry.TracesSamplingDecision; -import io.sentry.android.core.internal.util.AndroidRuntimeManager; import io.sentry.android.core.internal.util.SentryFrameMetricsCollector; import io.sentry.android.core.performance.AppStartMetrics; import io.sentry.android.core.performance.TimeSpan; import io.sentry.util.AutoClosableReentrantLock; -import io.sentry.util.runtime.IRuntimeManager; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -110,9 +108,7 @@ private void launchAppStartProfiler(final @NotNull AppStartMetrics appStartMetri return; } - final @NotNull IRuntimeManager runtimeManager = new AndroidRuntimeManager(); - final @NotNull File cacheDir = - runtimeManager.runWithRelaxedPolicy(() -> AndroidOptionsInitializer.getCacheDir(context)); + final @NotNull File cacheDir = AndroidOptionsInitializer.getCacheDir(context); final @NotNull File configFile = new File(cacheDir, APP_START_PROFILING_CONFIG_FILE_NAME); // No config exists: app start profiling is not enabled diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java index 5aad7ef1b26..e1590e47943 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java @@ -125,10 +125,9 @@ public static boolean hasStartupCrashMarker(final @NotNull SentryOptions options final File crashMarkerFile = new File(outboxPath, STARTUP_CRASH_MARKER_FILE); try { - final boolean exists = - options.getRuntimeManager().runWithRelaxedPolicy(() -> crashMarkerFile.exists()); + final boolean exists = crashMarkerFile.exists(); if (exists) { - if (!options.getRuntimeManager().runWithRelaxedPolicy(() -> crashMarkerFile.delete())) { + if (!crashMarkerFile.delete()) { options .getLogger() .log( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidRuntimeManager.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidRuntimeManager.java deleted file mode 100644 index bed8d63ec11..00000000000 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidRuntimeManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.sentry.android.core.internal.util; - -import android.os.StrictMode; -import io.sentry.util.runtime.IRuntimeManager; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -@ApiStatus.Internal -public final class AndroidRuntimeManager implements IRuntimeManager { - @Override - public T runWithRelaxedPolicy(final @NotNull IRuntimeManagerCallback toRun) { - final @NotNull StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy(); - final @NotNull StrictMode.VmPolicy oldVmPolicy = StrictMode.getVmPolicy(); - StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.LAX); - StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX); - try { - return toRun.run(); - } finally { - StrictMode.setThreadPolicy(oldPolicy); - StrictMode.setVmPolicy(oldVmPolicy); - } - } - - @Override - public void runWithRelaxedPolicy(final @NotNull Runnable toRun) { - runWithRelaxedPolicy( - () -> { - toRun.run(); - return null; - }); - } -} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt index 348075ff900..be54bf7768b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt @@ -24,7 +24,6 @@ import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader import io.sentry.android.core.internal.gestures.AndroidViewGestureTargetLocator import io.sentry.android.core.internal.modules.AssetsModulesLoader import io.sentry.android.core.internal.util.AndroidConnectionStatusProvider -import io.sentry.android.core.internal.util.AndroidRuntimeManager import io.sentry.android.core.internal.util.AndroidThreadChecker import io.sentry.android.core.performance.AppStartMetrics import io.sentry.android.fragment.FragmentLifecycleIntegration @@ -930,10 +929,4 @@ class AndroidOptionsInitializerTest { fixture.sentryOptions.compositePerformanceCollector is DefaultCompositePerformanceCollector } } - - @Test - fun `AndroidRuntimeManager is set in the options`() { - fixture.initSut() - assertIs(fixture.sentryOptions.runtimeManager) - } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidRuntimeManagerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidRuntimeManagerTest.kt deleted file mode 100644 index 6d1b8514c24..00000000000 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidRuntimeManagerTest.kt +++ /dev/null @@ -1,130 +0,0 @@ -package io.sentry.android.core.internal.util - -import android.os.StrictMode -import androidx.test.ext.junit.runners.AndroidJUnit4 -import kotlin.test.AfterTest -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertNotEquals -import kotlin.test.assertTrue -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class AndroidRuntimeManagerTest { - - val sut = AndroidRuntimeManager() - - @AfterTest - fun `clean up`() { - // Revert StrictMode policies to avoid issues with other tests - StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.LAX) - StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX) - } - - @Test - fun `runWithRelaxedPolicy changes policy when running and restores it afterwards`() { - var called = false - val threadPolicy = StrictMode.ThreadPolicy.Builder().detectAll().penaltyDeath().build() - val vmPolicy = StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build() - assertNotEquals(StrictMode.ThreadPolicy.LAX, threadPolicy) - assertNotEquals(StrictMode.VmPolicy.LAX, vmPolicy) - - // Set and assert the StrictMode policies - StrictMode.setThreadPolicy(threadPolicy) - StrictMode.setVmPolicy(vmPolicy) - assertEquals(threadPolicy.toString(), StrictMode.getThreadPolicy().toString()) - assertEquals(vmPolicy.toString(), StrictMode.getVmPolicy().toString()) - - // Run the function and assert LAX policies - called = - sut.runWithRelaxedPolicy { - assertEquals( - StrictMode.ThreadPolicy.LAX.toString(), - StrictMode.getThreadPolicy().toString(), - ) - assertEquals(StrictMode.VmPolicy.LAX.toString(), StrictMode.getVmPolicy().toString()) - true - } - - // Policies should be reverted back - assertEquals(threadPolicy.toString(), StrictMode.getThreadPolicy().toString()) - assertEquals(vmPolicy.toString(), StrictMode.getVmPolicy().toString()) - - // Ensure the code ran - assertTrue(called) - } - - @Test - fun `runWithRelaxedPolicy changes policy and restores it afterwards even if the code throws`() { - var called = false - var exceptionPropagated = false - val threadPolicy = StrictMode.ThreadPolicy.Builder().detectAll().penaltyDeath().build() - val vmPolicy = StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build() - - // Set and assert the StrictMode policies - StrictMode.setThreadPolicy(threadPolicy) - StrictMode.setVmPolicy(vmPolicy) - - // Run the function and assert LAX policies - try { - sut.runWithRelaxedPolicy { - assertEquals( - StrictMode.ThreadPolicy.LAX.toString(), - StrictMode.getThreadPolicy().toString(), - ) - assertEquals(StrictMode.VmPolicy.LAX.toString(), StrictMode.getVmPolicy().toString()) - called = true - throw Exception("Test exception") - } - } catch (e: Exception) { - assertEquals(e.message, "Test exception") - exceptionPropagated = true - } - - // Policies should be reverted back - assertEquals(threadPolicy.toString(), StrictMode.getThreadPolicy().toString()) - assertEquals(vmPolicy.toString(), StrictMode.getVmPolicy().toString()) - - // Ensure the code ran - assertTrue(called) - // Ensure the exception was propagated - assertTrue(exceptionPropagated) - } - - @Test - fun `runWithRelaxedPolicy with Runnable changes policy when running and restores it afterwards even if the code throws`() { - var called = false - var exceptionPropagated = false - val threadPolicy = StrictMode.ThreadPolicy.Builder().detectAll().penaltyDeath().build() - val vmPolicy = StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build() - - // Set and assert the StrictMode policies - StrictMode.setThreadPolicy(threadPolicy) - StrictMode.setVmPolicy(vmPolicy) - - // Run the function and assert LAX policies - try { - sut.runWithRelaxedPolicy { - assertEquals( - StrictMode.ThreadPolicy.LAX.toString(), - StrictMode.getThreadPolicy().toString(), - ) - assertEquals(StrictMode.VmPolicy.LAX.toString(), StrictMode.getVmPolicy().toString()) - called = true - throw Exception("Test exception") - } - } catch (e: Exception) { - assertEquals(e.message, "Test exception") - exceptionPropagated = true - } - - // Policies should be reverted back - assertEquals(threadPolicy.toString(), StrictMode.getThreadPolicy().toString()) - assertEquals(vmPolicy.toString(), StrictMode.getVmPolicy().toString()) - - // Ensure the code ran - assertTrue(called) - // Ensure the exception was propagated - assertTrue(exceptionPropagated) - } -} diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt index 0bd5faf8d98..d3a60d2c198 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt @@ -1,6 +1,5 @@ package io.sentry.uitest.android -import android.os.StrictMode import androidx.lifecycle.Lifecycle import androidx.test.core.app.launchActivity import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -11,7 +10,6 @@ import io.sentry.android.core.AndroidLogger import io.sentry.android.core.CurrentActivityHolder import io.sentry.android.core.NdkIntegration import io.sentry.android.core.SentryAndroidOptions -import io.sentry.assertEnvelopeEvent import io.sentry.assertEnvelopeTransaction import io.sentry.protocol.SentryTransaction import java.util.concurrent.CountDownLatch @@ -254,54 +252,6 @@ class SdkInitTests : BaseUiTest() { assertDefaultIntegrations() } - @Test - fun initNotThrowStrictMode() { - StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder().detectAll().penaltyDeath().build()) - StrictMode.setVmPolicy( - StrictMode.VmPolicy.Builder() - .detectActivityLeaks() - // .detectCleartextNetwork() <- mockWebServer is on http, not https - .detectContentUriWithoutPermission() - .detectCredentialProtectedWhileLocked() - .detectFileUriExposure() - .detectImplicitDirectBoot() - .detectIncorrectContextUse() - .detectLeakedRegistrationObjects() - .detectLeakedSqlLiteObjects() - // .detectNonSdkApiUsage() <- thrown by leakCanary - // .detectUnsafeIntentLaunch() <- fails CI with java.lang.NoSuchMethodError - // .detectUntaggedSockets() <- thrown by mockWebServer - .penaltyDeath() - .build() - ) - initSentry(true) { it.tracesSampleRate = 1.0 } - val sampleScenario = launchActivity() - relayIdlingResource.increment() - relayIdlingResource.increment() - Sentry.captureException(Exception("test")) - sampleScenario.moveToState(Lifecycle.State.DESTROYED) - - // Avoid interferences with other tests and assertion logic - StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.LAX) - StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX) - - relay.assert { - findEnvelope { - assertEnvelopeEvent(it.items.toList()).exceptions!!.any { it.value == "test" } - } - .assert { - it.assertEvent() - it.assertNoOtherItems() - } - findEnvelope { assertEnvelopeTransaction(it.items.toList()).transaction == "EmptyActivity" } - .assert { - it.assertTransaction() - it.assertNoOtherItems() - } - assertNoOtherEnvelopes() - } - } - private fun assertDefaultIntegrations() { val integrations = mutableListOf( diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index c112e84608d..5554379644a 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3564,7 +3564,6 @@ public class io/sentry/SentryOptions { public fun getReadTimeoutMillis ()I public fun getRelease ()Ljava/lang/String; public fun getReplayController ()Lio/sentry/ReplayController; - public fun getRuntimeManager ()Lio/sentry/util/runtime/IRuntimeManager; public fun getSampleRate ()Ljava/lang/Double; public fun getScopeObservers ()Ljava/util/List; public fun getSdkVersion ()Lio/sentry/protocol/SdkVersion; @@ -3718,7 +3717,6 @@ public class io/sentry/SentryOptions { public fun setReadTimeoutMillis (I)V public fun setRelease (Ljava/lang/String;)V public fun setReplayController (Lio/sentry/ReplayController;)V - public fun setRuntimeManager (Lio/sentry/util/runtime/IRuntimeManager;)V public fun setSampleRate (Ljava/lang/Double;)V public fun setSdkVersion (Lio/sentry/protocol/SdkVersion;)V public fun setSendClientReports (Z)V @@ -7812,21 +7810,6 @@ public final class io/sentry/util/network/ReplayNetworkRequestOrResponse { public fun toString ()Ljava/lang/String; } -public abstract interface class io/sentry/util/runtime/IRuntimeManager { - public abstract fun runWithRelaxedPolicy (Lio/sentry/util/runtime/IRuntimeManager$IRuntimeManagerCallback;)Ljava/lang/Object; - public abstract fun runWithRelaxedPolicy (Ljava/lang/Runnable;)V -} - -public abstract interface class io/sentry/util/runtime/IRuntimeManager$IRuntimeManagerCallback { - public abstract fun run ()Ljava/lang/Object; -} - -public final class io/sentry/util/runtime/NeutralRuntimeManager : io/sentry/util/runtime/IRuntimeManager { - public fun ()V - public fun runWithRelaxedPolicy (Lio/sentry/util/runtime/IRuntimeManager$IRuntimeManagerCallback;)Ljava/lang/Object; - public fun runWithRelaxedPolicy (Ljava/lang/Runnable;)V -} - public abstract interface class io/sentry/util/thread/IThreadChecker { public abstract fun currentThreadSystemId ()J public abstract fun getCurrentThreadName ()Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index ff84b151658..8acc051f522 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -612,7 +612,7 @@ private static void initConfigurations(final @NotNull SentryOptions options) { final String outboxPath = options.getOutboxPath(); if (outboxPath != null) { final File outboxDir = new File(outboxPath); - options.getRuntimeManager().runWithRelaxedPolicy(() -> outboxDir.mkdirs()); + outboxDir.mkdirs(); } else { logger.log(SentryLevel.INFO, "No outbox dir path is defined in options."); } @@ -620,7 +620,7 @@ private static void initConfigurations(final @NotNull SentryOptions options) { final String cacheDirPath = options.getCacheDirPath(); if (cacheDirPath != null) { final File cacheDir = new File(cacheDirPath); - options.getRuntimeManager().runWithRelaxedPolicy(() -> cacheDir.mkdirs()); + cacheDir.mkdirs(); final IEnvelopeCache envelopeCache = options.getEnvelopeDiskCache(); // only overwrite the cache impl if it's not already set if (envelopeCache instanceof NoOpEnvelopeCache) { @@ -633,7 +633,7 @@ private static void initConfigurations(final @NotNull SentryOptions options) { && profilingTracesDirPath != null) { final File profilingTracesDir = new File(profilingTracesDirPath); - options.getRuntimeManager().runWithRelaxedPolicy(() -> profilingTracesDir.mkdirs()); + profilingTracesDir.mkdirs(); try { options diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 7b21661c223..b89ec1a0e71 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -31,8 +31,6 @@ import io.sentry.util.Platform; import io.sentry.util.SampleRateUtils; import io.sentry.util.StringUtils; -import io.sentry.util.runtime.IRuntimeManager; -import io.sentry.util.runtime.NeutralRuntimeManager; import io.sentry.util.thread.IThreadChecker; import io.sentry.util.thread.NoOpThreadChecker; import java.io.File; @@ -640,9 +638,6 @@ public class SentryOptions { private @NotNull ISocketTagger socketTagger = NoOpSocketTagger.getInstance(); - /** Runtime manager to manage runtime policies, like StrictMode on Android. */ - private @NotNull IRuntimeManager runtimeManager = new NeutralRuntimeManager(); - private @Nullable String profilingTracesDirPath; public @NotNull IProfileConverter getProfilerConverter() { @@ -3158,26 +3153,6 @@ public void setSocketTagger(final @Nullable ISocketTagger socketTagger) { this.socketTagger = socketTagger != null ? socketTagger : NoOpSocketTagger.getInstance(); } - /** - * Returns the IRuntimeManager - * - * @return the runtime manager - */ - @ApiStatus.Internal - public @NotNull IRuntimeManager getRuntimeManager() { - return runtimeManager; - } - - /** - * Sets the IRuntimeManager - * - * @param runtimeManager the runtime manager - */ - @ApiStatus.Internal - public void setRuntimeManager(final @NotNull IRuntimeManager runtimeManager) { - this.runtimeManager = runtimeManager; - } - /** * Load the lazy fields. Useful to load in the background, so that results are already cached. DO * NOT CALL THIS METHOD ON THE MAIN THREAD. diff --git a/sentry/src/main/java/io/sentry/util/runtime/IRuntimeManager.java b/sentry/src/main/java/io/sentry/util/runtime/IRuntimeManager.java deleted file mode 100644 index ec0f8b05baf..00000000000 --- a/sentry/src/main/java/io/sentry/util/runtime/IRuntimeManager.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.sentry.util.runtime; - -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -@ApiStatus.Internal -public interface IRuntimeManager { - T runWithRelaxedPolicy(final @NotNull IRuntimeManagerCallback toRun); - - void runWithRelaxedPolicy(final @NotNull Runnable toRun); - - interface IRuntimeManagerCallback { - T run(); - } -} diff --git a/sentry/src/main/java/io/sentry/util/runtime/NeutralRuntimeManager.java b/sentry/src/main/java/io/sentry/util/runtime/NeutralRuntimeManager.java deleted file mode 100644 index 36dd061612c..00000000000 --- a/sentry/src/main/java/io/sentry/util/runtime/NeutralRuntimeManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.sentry.util.runtime; - -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -@ApiStatus.Internal -public final class NeutralRuntimeManager implements IRuntimeManager { - @Override - public T runWithRelaxedPolicy(final @NotNull IRuntimeManagerCallback toRun) { - return toRun.run(); - } - - @Override - public void runWithRelaxedPolicy(final @NotNull Runnable toRun) { - toRun.run(); - } -} diff --git a/sentry/src/test/java/io/sentry/util/runtime/NeutralRuntimeManagerTest.kt b/sentry/src/test/java/io/sentry/util/runtime/NeutralRuntimeManagerTest.kt deleted file mode 100644 index faafd4a8c38..00000000000 --- a/sentry/src/test/java/io/sentry/util/runtime/NeutralRuntimeManagerTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -package io.sentry.util.runtime - -import java.io.IOException -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -class NeutralRuntimeManagerTest { - - val sut = NeutralRuntimeManager() - - @Test - fun `runWithRelaxedPolicy runs the code`() { - var called = false - - called = sut.runWithRelaxedPolicy { true } - - // Ensure the code ran - assertTrue(called) - } - - @Test - fun `runWithRelaxedPolicy with runnable runs the code`() { - var called = false - - sut.runWithRelaxedPolicy { called = true } - - // Ensure the code ran - assertTrue(called) - } - - @Test - fun `runWithRelaxedPolicy propagates exception`() { - var exceptionPropagated = false - - try { - sut.runWithRelaxedPolicy { throw IOException("test") } - } catch (e: IOException) { - assertEquals("test", e.message) - exceptionPropagated = true - } - - // Ensure the exception was propagated - assertTrue(exceptionPropagated) - } - - @Test - fun `runWithRelaxedPolicy with runnable propagates exception`() { - var exceptionPropagated = false - - try { - sut.runWithRelaxedPolicy { throw IOException("test") } - } catch (e: IOException) { - assertEquals("test", e.message) - exceptionPropagated = true - } - - // Ensure the exception was propagated - assertTrue(exceptionPropagated) - } -} From 0dd3823ddb6426aa1da133725ea211bc2bf30c04 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 3 Mar 2026 12:02:23 +0100 Subject: [PATCH 025/391] chore(changelog): Add a warning about strictmode violations (#5144) Added important note about StrictMode violations in debug builds. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35aa59686f4..df9ab83e39e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ### Fixes - Remove `AndroidRuntimeManager` StrictMode relaxation to prevent ANRs during SDK init ([#5127](https://github.com/getsentry/sentry-java/pull/5127)) + - **IMPORTANT:** StrictMode violations may appear again in debug builds. This is intentional to prevent ANRs in production releases. - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) - Log an actionable error message when Relay returns HTTP 413 (Content Too Large) ([#5115](https://github.com/getsentry/sentry-java/pull/5115)) - Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error` From 01221e2da958c49289e6fd711d807b8ad0337ccc Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 3 Mar 2026 12:21:46 +0100 Subject: [PATCH 026/391] fix(gestures): Use peekDecorView to not force view hierarchy construction (#5134) * fix(gestures): Use peekDecorView to not force view hierarchy construction * fix(gestures): Add changelog entry for peekDecorView fix Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 1 + .../gestures/SentryGestureListener.java | 2 +- .../SentryGestureListenerPeekDecorViewTest.kt | 48 +++++++++++++++++++ .../core/internal/gestures/ViewHelpers.kt | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerPeekDecorViewTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index df9ab83e39e..ccff564763f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Remove `AndroidRuntimeManager` StrictMode relaxation to prevent ANRs during SDK init ([#5127](https://github.com/getsentry/sentry-java/pull/5127)) - **IMPORTANT:** StrictMode violations may appear again in debug builds. This is intentional to prevent ANRs in production releases. - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) +- Use `peekDecorView` instead of `getDecorView` in `SentryGestureListener` to avoid forcing view hierarchy construction ([#5134](https://github.com/getsentry/sentry-java/pull/5134)) - Log an actionable error message when Relay returns HTTP 413 (Content Too Large) ([#5115](https://github.com/getsentry/sentry-java/pull/5115)) - Also switch the client report discard reason for all HTTP 4xx/5xx errors (except 429) from `network_error` to `send_error` - Trim DSN string before parsing to avoid `URISyntaxException` caused by trailing whitespace ([#5113](https://github.com/getsentry/sentry-java/pull/5113)) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java index cd89db72f53..8caffedad94 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java @@ -347,7 +347,7 @@ void applyScope(final @NotNull IScope scope, final @NotNull ITransaction transac return null; } - final View decorView = window.getDecorView(); + final View decorView = window.peekDecorView(); if (decorView == null) { options .getLogger() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerPeekDecorViewTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerPeekDecorViewTest.kt new file mode 100644 index 00000000000..7b26aa55c79 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerPeekDecorViewTest.kt @@ -0,0 +1,48 @@ +package io.sentry.android.core.internal.gestures + +import android.app.Activity +import android.view.MotionEvent +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.Breadcrumb +import io.sentry.IScopes +import io.sentry.android.core.SentryAndroidOptions +import io.sentry.util.LazyEvaluator +import kotlin.test.Test +import kotlin.test.assertNull +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.anyOrNull +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify +import org.robolectric.Robolectric.buildActivity + +@RunWith(AndroidJUnit4::class) +class SentryGestureListenerPeekDecorViewTest { + + @Test + fun `does not force decor view creation when peekDecorView returns null`() { + // A plain Activity that never calls setContentView — peekDecorView() should return null + val activity = buildActivity(Activity::class.java).create().get() + + // Sanity check: decor view has not been created yet + assertNull(activity.window.peekDecorView()) + + val scopes = mock() + val options = + SentryAndroidOptions().apply { + isEnableUserInteractionBreadcrumbs = true + gestureTargetLocators = listOf(AndroidViewGestureTargetLocator(LazyEvaluator { true })) + dsn = "https://key@sentry.io/proj" + } + + val sut = SentryGestureListener(activity, scopes, options) + sut.onSingleTapUp(mock()) + + // The key assertion: peekDecorView is still null — we did not force view hierarchy creation + assertNull(activity.window.peekDecorView()) + + // And no breadcrumb was captured + verify(scopes, never()).addBreadcrumb(any(), anyOrNull()) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt index 86123d0a3a2..1a4f28bbe35 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt @@ -22,7 +22,7 @@ internal inline fun Window.mockDecorView( finalize: (T) -> Unit = {}, ): T { val view = mockView(id, event, touchWithinBounds, clickable, visible, context, finalize) - whenever(decorView).doReturn(view) + whenever(peekDecorView()).doReturn(view) return view } From b8bd88061259ff86c9472d203d3f17d1c106336e Mon Sep 17 00:00:00 2001 From: Stefan Jandl Date: Tue, 3 Mar 2026 16:47:42 +0100 Subject: [PATCH 027/391] feat: Made `ManifestMetaDataReader` read the `DIST` (#5107) --- CHANGELOG.md | 1 + .../android/core/ManifestMetadataReader.java | 3 +++ .../core/ManifestMetadataReaderTest.kt | 25 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccff564763f..e7485668864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ ``` +- The `ManifestMetaDataReader` now read the `DIST` ([#5107](https://github.com/getsentry/sentry-java/pull/5107)) ### Fixes diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 66587925404..0fd217794e2 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -41,6 +41,7 @@ final class ManifestMetadataReader { static final String NDK_SCOPE_SYNC_ENABLE = "io.sentry.ndk.scope-sync.enable"; static final String NDK_SDK_NAME = "io.sentry.ndk.sdk-name"; static final String RELEASE = "io.sentry.release"; + static final String DIST = "io.sentry.dist"; static final String ENVIRONMENT = "io.sentry.environment"; static final String SDK_NAME = "io.sentry.sdk.name"; static final String SDK_VERSION = "io.sentry.sdk.version"; @@ -273,6 +274,8 @@ static void applyMetadata( options.setRelease(readString(metadata, logger, RELEASE, options.getRelease())); + options.setDist(readString(metadata, logger, DIST, options.getDist())); + options.setEnvironment(readString(metadata, logger, ENVIRONMENT, options.getEnvironment())); options.setSessionTrackingIntervalMillis( diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index c8e55ffc095..fd5c9cffc89 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -187,6 +187,31 @@ class ManifestMetadataReaderTest { assertNull(fixture.options.release) } + @Test + fun `applyMetadata reads dist to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.DIST to "test-dist") + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals("test-dist", fixture.options.dist) + } + + @Test + fun `applyMetadata reads dist and keep default value if not found`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertNull(fixture.options.dist) + } + @Test fun `applyMetadata reads session tracking interval to options`() { // Arrange From 815e0348f1511456e4c377fcf76de0f08177eab8 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 4 Mar 2026 09:16:12 +0100 Subject: [PATCH 028/391] feat(options): Add support for `SENTRY_SAMPLE_RATE` environment variable / `sample-rate` property (#5112) * feat: Add support for SENTRY_SAMPLE_RATE environment variable Add `sampleRate` to `ExternalOptions` so it can be configured via the `SENTRY_SAMPLE_RATE` environment variable or `sample-rate` property, matching the behavior of other sample rate options. Fixes GH-5091 Co-Authored-By: Claude * docs: Add changelog entry for SENTRY_SAMPLE_RATE support Co-Authored-By: Claude --------- Co-authored-by: Claude --- CHANGELOG.md | 1 + sentry/api/sentry.api | 2 ++ sentry/src/main/java/io/sentry/ExternalOptions.java | 10 ++++++++++ sentry/src/main/java/io/sentry/SentryOptions.java | 3 +++ sentry/src/test/java/io/sentry/ExternalOptionsTest.kt | 5 +++++ sentry/src/test/java/io/sentry/SentryOptionsTest.kt | 2 ++ 6 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7485668864..fb4de5057c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- Add support for `SENTRY_SAMPLE_RATE` environment variable / `sample-rate` property ([#5112](https://github.com/getsentry/sentry-java/pull/5112)) - Create `sentry-opentelemetry-otlp` and `sentry-opentelemetry-otlp-spring` modules for combining OpenTelemetry SDK OTLP export with Sentry SDK ([#5100](https://github.com/getsentry/sentry-java/pull/5100)) - OpenTelemetry is configured to send spans to Sentry directly using an OTLP endpoint. - Sentry only uses trace and span ID from OpenTelemetry (via `OpenTelemetryOtlpEventProcessor`) but will not send spans through OpenTelemetry nor use OpenTelemetry `Context` for `Scopes` propagation. diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 5554379644a..9b8413630c2 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -504,6 +504,7 @@ public final class io/sentry/ExternalOptions { public fun getProguardUuid ()Ljava/lang/String; public fun getProxy ()Lio/sentry/SentryOptions$Proxy; public fun getRelease ()Ljava/lang/String; + public fun getSampleRate ()Ljava/lang/Double; public fun getSendClientReports ()Ljava/lang/Boolean; public fun getServerName ()Ljava/lang/String; public fun getSpotlightConnectionUrl ()Ljava/lang/String; @@ -552,6 +553,7 @@ public final class io/sentry/ExternalOptions { public fun setProguardUuid (Ljava/lang/String;)V public fun setProxy (Lio/sentry/SentryOptions$Proxy;)V public fun setRelease (Ljava/lang/String;)V + public fun setSampleRate (Ljava/lang/Double;)V public fun setSendClientReports (Ljava/lang/Boolean;)V public fun setSendDefaultPii (Ljava/lang/Boolean;)V public fun setSendModules (Ljava/lang/Boolean;)V diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index b5604e2b49b..9eaf26b202f 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -23,6 +23,7 @@ public final class ExternalOptions { private @Nullable Boolean enableUncaughtExceptionHandler; private @Nullable Boolean debug; private @Nullable Boolean enableDeduplication; + private @Nullable Double sampleRate; private @Nullable Double tracesSampleRate; private @Nullable Double profilesSampleRate; private @Nullable SentryOptions.RequestSize maxRequestBodySize; @@ -77,6 +78,7 @@ public final class ExternalOptions { propertiesProvider.getBooleanProperty("uncaught.handler.enabled")); options.setPrintUncaughtStackTrace( propertiesProvider.getBooleanProperty("uncaught.handler.print-stacktrace")); + options.setSampleRate(propertiesProvider.getDoubleProperty("sample-rate")); options.setTracesSampleRate(propertiesProvider.getDoubleProperty("traces-sample-rate")); options.setProfilesSampleRate(propertiesProvider.getDoubleProperty("profiles-sample-rate")); options.setDebug(propertiesProvider.getBooleanProperty("debug")); @@ -295,6 +297,14 @@ public void setEnableDeduplication(final @Nullable Boolean enableDeduplication) this.enableDeduplication = enableDeduplication; } + public @Nullable Double getSampleRate() { + return sampleRate; + } + + public void setSampleRate(final @Nullable Double sampleRate) { + this.sampleRate = sampleRate; + } + public @Nullable Double getTracesSampleRate() { return tracesSampleRate; } diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index b89ec1a0e71..7883ed6b95b 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -3378,6 +3378,9 @@ public void merge(final @NotNull ExternalOptions options) { if (options.getPrintUncaughtStackTrace() != null) { setPrintUncaughtStackTrace(options.getPrintUncaughtStackTrace()); } + if (options.getSampleRate() != null) { + setSampleRate(options.getSampleRate()); + } if (options.getTracesSampleRate() != null) { setTracesSampleRate(options.getTracesSampleRate()); } diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index 1276d58fdbb..5a8bb1c7872 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -101,6 +101,11 @@ class ExternalOptionsTest { } } + @Test + fun `creates options with sampleRate using external properties`() { + withPropertiesFile("sample-rate=0.2") { assertEquals(0.2, it.sampleRate) } + } + @Test fun `creates options with tracesSampleRate using external properties`() { withPropertiesFile("traces-sample-rate=0.2") { assertEquals(0.2, it.tracesSampleRate) } diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 80510db931f..2f5b3579cb3 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -376,6 +376,7 @@ class SentryOptionsTest { externalOptions.setTag("tag1", "value1") externalOptions.setTag("tag2", "value2") externalOptions.enableUncaughtExceptionHandler = false + externalOptions.sampleRate = 0.3 externalOptions.tracesSampleRate = 0.5 externalOptions.profilesSampleRate = 0.5 externalOptions.addInAppInclude("com.app") @@ -433,6 +434,7 @@ class SentryOptionsTest { assertEquals(java.net.Proxy.Type.SOCKS, options.proxy!!.type) assertEquals(mapOf("tag1" to "value1", "tag2" to "value2"), options.tags) assertFalse(options.isEnableUncaughtExceptionHandler) + assertEquals(0.3, options.sampleRate) assertEquals(0.5, options.tracesSampleRate) assertEquals(0.5, options.profilesSampleRate) assertEquals(listOf("com.app"), options.inAppIncludes) From 4b1510b40662a2a659349416da2eae5caa61a8c2 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 4 Mar 2026 09:56:18 +0100 Subject: [PATCH 029/391] feat(core): Global Attributes API (#5148) * feat(core): Add scope-level attributes API Add setAttribute, setAttributes, removeAttribute, and getAttributes to IScope/IScopes/Sentry so users can set attributes on the scope that are automatically included in logs and metrics events. Also refactor type inference logic into SentryAttributeType.inferFrom and add SentryLogEventAttributeValue.fromAttribute factory method, removing duplicate getType helpers from LoggerApi and MetricsApi. Co-Authored-By: Claude * changelog * ref: Split out LoggerApi/MetricsApi changes for stacked PR Move factory method extractions (SentryAttributeType.inferFrom, SentryLogEventAttributeValue.fromAttribute) and LoggerApi/MetricsApi scope attribute integration to a separate stacked PR. Co-Authored-By: Claude Opus 4.6 * feat(core): Wire scope attributes into LoggerApi and MetricsApi Extract factory methods SentryAttributeType.inferFrom and SentryLogEventAttributeValue.fromAttribute to reduce duplication. Apply scope attributes to log and metric events automatically. Co-Authored-By: Claude Opus 4.6 * changelog * feat(samples): Showcase scope attributes in Spring Boot 4 samples Add Sentry.setAttribute() calls to PersonController and MetricController across all Spring Boot 4 sample variants to demonstrate scope attributes being auto-attached to logs and metrics. Add e2e test assertions and TestHelper methods to verify scope attributes appear on captured log and metric events. Co-Authored-By: Claude Opus 4.6 * changelog * Revert "changelog" This reverts commit 7189bdca1a211085608f16bf3443c9e6675b6680. * ref: Remove redundant comments from variant controllers Co-Authored-By: Claude Opus 4.6 * ref: Limit scope attributes sample to base Spring Boot 4 variant Co-Authored-By: Claude Opus 4.6 * fix: Detect integer attribute type correctly for all integer Number subtypes Co-Authored-By: Claude Opus 4.6 * changelog * feat: Support collections and arrays in log attribute type inference Co-Authored-By: Claude Opus 4.6 * changelog * use ConcurrentHashMap instead of HashMap when merging attributes * add enabled check similar to tags * make setAttribute and setAttributes params nullable * test: Add coverage for arrayAttribute factory method Add arrayAttribute and named array attribute usage to the four attribute tests in ScopesTest (log, count metric, distribution metric, gauge metric) to verify the factory method works end-to-end. Co-Authored-By: Claude * feat: Add Object[] overload to arrayAttribute factory The arrayAttribute() factory only accepted Collection, but inferFrom() also handles native Java arrays. Add an Object[] overload so users can pass object arrays like String[] directly without falling back to the untyped named() method. Co-Authored-By: Claude * shape changelog --------- Co-authored-by: Claude --- CHANGELOG.md | 5 + .../spring/boot4/MetricController.java | 2 + .../spring/boot4/PersonController.java | 4 + .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++- .../api/sentry-system-test-support.api | 2 + .../io/sentry/systemtest/util/TestHelper.kt | 62 +++++++++ sentry/api/sentry.api | 57 ++++++++ .../java/io/sentry/CombinedScopeView.java | 29 +++++ .../src/main/java/io/sentry/HubAdapter.java | 20 +++ .../main/java/io/sentry/HubScopesWrapper.java | 20 +++ sentry/src/main/java/io/sentry/IScope.java | 38 ++++++ sentry/src/main/java/io/sentry/IScopes.java | 29 +++++ sentry/src/main/java/io/sentry/NoOpHub.java | 12 ++ sentry/src/main/java/io/sentry/NoOpScope.java | 18 +++ .../src/main/java/io/sentry/NoOpScopes.java | 12 ++ sentry/src/main/java/io/sentry/Scope.java | 70 ++++++++++ sentry/src/main/java/io/sentry/Scopes.java | 50 +++++++ .../main/java/io/sentry/ScopesAdapter.java | 20 +++ sentry/src/main/java/io/sentry/Sentry.java | 37 ++++++ .../main/java/io/sentry/SentryAttribute.java | 11 ++ .../java/io/sentry/SentryAttributeType.java | 30 ++++- .../sentry/SentryLogEventAttributeValue.java | 15 +++ .../main/java/io/sentry/logger/LoggerApi.java | 29 ++--- .../java/io/sentry/metrics/MetricsApi.java | 27 ++-- .../java/io/sentry/CombinedScopeViewTest.kt | 67 ++++++++++ sentry/src/test/java/io/sentry/ScopeTest.kt | 104 +++++++++++++++ sentry/src/test/java/io/sentry/ScopesTest.kt | 84 ++++++++++++ .../java/io/sentry/SentryAttributeTypeTest.kt | 122 ++++++++++++++++++ .../protocol/SentryLogsSerializationTest.kt | 1 + .../src/test/resources/json/sentry_logs.json | 5 + 31 files changed, 963 insertions(+), 38 deletions(-) create mode 100644 sentry/src/test/java/io/sentry/SentryAttributeTypeTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index fb4de5057c6..4353044f84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Features +- Add scope-level attributes API ([#5118](https://github.com/getsentry/sentry-java/pull/5118)) via ([#5148](https://github.com/getsentry/sentry-java/pull/5148)) + - Automatically include scope attributes in logs and metrics ([#5120](https://github.com/getsentry/sentry-java/pull/5120)) + - New APIs are `Sentry.setAttribute`, `Sentry.setAttributes`, `Sentry.removeAttribute` +- Support collections and arrays in attribute type inference ([#5124](https://github.com/getsentry/sentry-java/pull/5124)) - Add support for `SENTRY_SAMPLE_RATE` environment variable / `sample-rate` property ([#5112](https://github.com/getsentry/sentry-java/pull/5112)) - Create `sentry-opentelemetry-otlp` and `sentry-opentelemetry-otlp-spring` modules for combining OpenTelemetry SDK OTLP export with Sentry SDK ([#5100](https://github.com/getsentry/sentry-java/pull/5100)) - OpenTelemetry is configured to send spans to Sentry directly using an OTLP endpoint. @@ -32,6 +36,7 @@ ### Fixes +- Fix attribute type detection for `Long`, `Short`, `Byte`, `BigInteger`, `AtomicInteger`, and `AtomicLong` being incorrectly inferred as `double` instead of `integer` ([#5122](https://github.com/getsentry/sentry-java/pull/5122)) - Remove `AndroidRuntimeManager` StrictMode relaxation to prevent ANRs during SDK init ([#5127](https://github.com/getsentry/sentry-java/pull/5127)) - **IMPORTANT:** StrictMode violations may appear again in debug builds. This is intentional to prevent ANRs in production releases. - Fix crash when unregistering `SystemEventsBroadcastReceiver` with try-catch block. ([#5106](https://github.com/getsentry/sentry-java/pull/5106)) diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/MetricController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/MetricController.java index 2a969ec8849..be75f5e3002 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/PersonController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/PersonController.java index c65c9040d5c..489dc629d28 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/PersonController.java @@ -27,6 +27,10 @@ Person person(@PathVariable Long id) { ISpan currentSpan = Sentry.getSpan(); ISpan sentrySpan = currentSpan.startChild("spanCreatedThroughSentryApi"); try { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); + Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 362a8577148..2389734a8b3 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -50,7 +50,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-system-test-support/api/sentry-system-test-support.api b/sentry-system-test-support/api/sentry-system-test-support.api index ff620c7d809..51ef7da55d9 100644 --- a/sentry-system-test-support/api/sentry-system-test-support.api +++ b/sentry-system-test-support/api/sentry-system-test-support.api @@ -574,6 +574,8 @@ public final class io/sentry/systemtest/util/TestHelper { public static synthetic fun doesContainMetric$default (Lio/sentry/systemtest/util/TestHelper;Lio/sentry/SentryMetricsEvents;Ljava/lang/String;Ljava/lang/String;DLjava/lang/String;ILjava/lang/Object;)Z public final fun doesEventHaveExceptionMessage (Lio/sentry/SentryEvent;Ljava/lang/String;)Z public final fun doesEventHaveFlag (Lio/sentry/SentryEvent;Ljava/lang/String;Z)Z + public final fun doesLogWithBodyHaveAttribute (Lio/sentry/SentryLogEvents;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Z + public final fun doesMetricHaveAttribute (Lio/sentry/SentryMetricsEvents;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Z public final fun doesTransactionContainSpanWithDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z public final fun doesTransactionContainSpanWithOp (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z public final fun doesTransactionContainSpanWithOpAndDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Ljava/lang/String;)Z diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt index 2881460a2d0..19817c34ac8 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt @@ -190,6 +190,68 @@ class TestHelper(backendUrl: String) { return true } + fun doesLogWithBodyHaveAttribute( + logs: SentryLogEvents, + body: String, + attributeKey: String, + attributeValue: Any?, + ): Boolean { + val logItem = logs.items.firstOrNull { logItem -> logItem.body == body } + if (logItem == null) { + println("Unable to find log item with body $body in logs:") + logObject(logs) + return false + } + + val attr = logItem.attributes?.get(attributeKey) + if (attr == null) { + println("Unable to find attribute $attributeKey on log with body $body:") + logObject(logItem) + return false + } + + if (attr.value != attributeValue) { + println( + "Attribute $attributeKey has value ${attr.value} but expected $attributeValue on log with body $body:" + ) + logObject(logItem) + return false + } + + return true + } + + fun doesMetricHaveAttribute( + metrics: SentryMetricsEvents, + metricName: String, + attributeKey: String, + attributeValue: Any?, + ): Boolean { + val metricItem = metrics.items.firstOrNull { it.name == metricName } + if (metricItem == null) { + println("Unable to find metric with name $metricName in metrics:") + logObject(metrics) + return false + } + + val attr = metricItem.attributes?.get(attributeKey) + if (attr == null) { + println("Unable to find attribute $attributeKey on metric $metricName:") + logObject(metricItem) + return false + } + + if (attr.value != attributeValue) { + println( + "Attribute $attributeKey has value ${attr.value} but expected $attributeValue on metric $metricName:" + ) + logObject(metricItem) + return false + } + + return true + } + private fun checkIfTransactionMatches( envelopeString: String, callback: ((SentryTransaction, SentryEnvelopeHeader) -> Boolean), diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 9b8413630c2..a7bbb6c6cfa 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -276,6 +276,7 @@ public final class io/sentry/CombinedScopeView : io/sentry/IScope { public synthetic fun clone ()Ljava/lang/Object; public fun endSession ()Lio/sentry/Session; public fun getAttachments ()Ljava/util/List; + public fun getAttributes ()Ljava/util/Map; public fun getBreadcrumbs ()Ljava/util/Queue; public fun getClient ()Lio/sentry/ISentryClient; public fun getContexts ()Lio/sentry/protocol/Contexts; @@ -298,11 +299,15 @@ public final class io/sentry/CombinedScopeView : io/sentry/IScope { public fun getTransaction ()Lio/sentry/ITransaction; public fun getTransactionName ()Ljava/lang/String; public fun getUser ()Lio/sentry/protocol/User; + public fun removeAttribute (Ljava/lang/String;)V public fun removeContexts (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun replaceOptions (Lio/sentry/SentryOptions;)V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Boolean;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Character;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Number;)V @@ -672,10 +677,14 @@ public final class io/sentry/HubAdapter : io/sentry/IHub { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -744,10 +753,14 @@ public final class io/sentry/HubScopesWrapper : io/sentry/IHub { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -867,6 +880,7 @@ public abstract interface class io/sentry/IScope { public abstract fun clone ()Lio/sentry/IScope; public abstract fun endSession ()Lio/sentry/Session; public abstract fun getAttachments ()Ljava/util/List; + public abstract fun getAttributes ()Ljava/util/Map; public abstract fun getBreadcrumbs ()Ljava/util/Queue; public abstract fun getClient ()Lio/sentry/ISentryClient; public abstract fun getContexts ()Lio/sentry/protocol/Contexts; @@ -889,11 +903,15 @@ public abstract interface class io/sentry/IScope { public abstract fun getTransaction ()Lio/sentry/ITransaction; public abstract fun getTransactionName ()Ljava/lang/String; public abstract fun getUser ()Lio/sentry/protocol/User; + public abstract fun removeAttribute (Ljava/lang/String;)V public abstract fun removeContexts (Ljava/lang/String;)V public abstract fun removeExtra (Ljava/lang/String;)V public abstract fun removeTag (Ljava/lang/String;)V public abstract fun replaceOptions (Lio/sentry/SentryOptions;)V public abstract fun setActiveSpan (Lio/sentry/ISpan;)V + public abstract fun setAttribute (Lio/sentry/SentryAttribute;)V + public abstract fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public abstract fun setAttributes (Lio/sentry/SentryAttributes;)V public abstract fun setContexts (Ljava/lang/String;Ljava/lang/Boolean;)V public abstract fun setContexts (Ljava/lang/String;Ljava/lang/Character;)V public abstract fun setContexts (Ljava/lang/String;Ljava/lang/Number;)V @@ -1005,10 +1023,14 @@ public abstract interface class io/sentry/IScopes { public abstract fun popScope ()V public abstract fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public abstract fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public abstract fun removeAttribute (Ljava/lang/String;)V public abstract fun removeExtra (Ljava/lang/String;)V public abstract fun removeTag (Ljava/lang/String;)V public abstract fun reportFullyDisplayed ()V public abstract fun setActiveSpan (Lio/sentry/ISpan;)V + public abstract fun setAttribute (Lio/sentry/SentryAttribute;)V + public abstract fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public abstract fun setAttributes (Lio/sentry/SentryAttributes;)V public abstract fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public abstract fun setFingerprint (Ljava/util/List;)V public abstract fun setLevel (Lio/sentry/SentryLevel;)V @@ -1581,10 +1603,14 @@ public final class io/sentry/NoOpHub : io/sentry/IHub { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -1651,6 +1677,7 @@ public final class io/sentry/NoOpScope : io/sentry/IScope { public synthetic fun clone ()Ljava/lang/Object; public fun endSession ()Lio/sentry/Session; public fun getAttachments ()Ljava/util/List; + public fun getAttributes ()Ljava/util/Map; public fun getBreadcrumbs ()Ljava/util/Queue; public fun getClient ()Lio/sentry/ISentryClient; public fun getContexts ()Lio/sentry/protocol/Contexts; @@ -1674,11 +1701,15 @@ public final class io/sentry/NoOpScope : io/sentry/IScope { public fun getTransaction ()Lio/sentry/ITransaction; public fun getTransactionName ()Ljava/lang/String; public fun getUser ()Lio/sentry/protocol/User; + public fun removeAttribute (Ljava/lang/String;)V public fun removeContexts (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun replaceOptions (Lio/sentry/SentryOptions;)V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Boolean;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Character;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Number;)V @@ -1758,10 +1789,14 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -2327,6 +2362,7 @@ public final class io/sentry/Scope : io/sentry/IScope { public synthetic fun clone ()Ljava/lang/Object; public fun endSession ()Lio/sentry/Session; public fun getAttachments ()Ljava/util/List; + public fun getAttributes ()Ljava/util/Map; public fun getBreadcrumbs ()Ljava/util/Queue; public fun getClient ()Lio/sentry/ISentryClient; public fun getContexts ()Lio/sentry/protocol/Contexts; @@ -2349,11 +2385,15 @@ public final class io/sentry/Scope : io/sentry/IScope { public fun getTransaction ()Lio/sentry/ITransaction; public fun getTransactionName ()Ljava/lang/String; public fun getUser ()Lio/sentry/protocol/User; + public fun removeAttribute (Ljava/lang/String;)V public fun removeContexts (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun replaceOptions (Lio/sentry/SentryOptions;)V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Boolean;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Character;)V public fun setContexts (Ljava/lang/String;Ljava/lang/Number;)V @@ -2484,10 +2524,14 @@ public final class io/sentry/Scopes : io/sentry/IScopes { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -2557,10 +2601,14 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes { public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public fun removeAttribute (Ljava/lang/String;)V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun reportFullyDisplayed ()V public fun setActiveSpan (Lio/sentry/ISpan;)V + public fun setAttribute (Lio/sentry/SentryAttribute;)V + public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public fun setAttributes (Lio/sentry/SentryAttributes;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public fun setFingerprint (Ljava/util/List;)V public fun setLevel (Lio/sentry/SentryLevel;)V @@ -2678,10 +2726,14 @@ public final class io/sentry/Sentry { public static fun popScope ()V public static fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public static fun pushScope ()Lio/sentry/ISentryLifecycleToken; + public static fun removeAttribute (Ljava/lang/String;)V public static fun removeExtra (Ljava/lang/String;)V public static fun removeTag (Ljava/lang/String;)V public static fun replay ()Lio/sentry/IReplayApi; public static fun reportFullyDisplayed ()V + public static fun setAttribute (Lio/sentry/SentryAttribute;)V + public static fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V + public static fun setAttributes (Lio/sentry/SentryAttributes;)V public static fun setCurrentHub (Lio/sentry/IHub;)Lio/sentry/ISentryLifecycleToken; public static fun setCurrentScopes (Lio/sentry/IScopes;)Lio/sentry/ISentryLifecycleToken; public static fun setExtra (Ljava/lang/String;Ljava/lang/String;)V @@ -2763,6 +2815,8 @@ public final class io/sentry/SentryAppStartProfilingOptions$JsonKeys { } public final class io/sentry/SentryAttribute { + public static fun arrayAttribute (Ljava/lang/String;Ljava/util/Collection;)Lio/sentry/SentryAttribute; + public static fun arrayAttribute (Ljava/lang/String;[Ljava/lang/Object;)Lio/sentry/SentryAttribute; public static fun booleanAttribute (Ljava/lang/String;Ljava/lang/Boolean;)Lio/sentry/SentryAttribute; public static fun doubleAttribute (Ljava/lang/String;Ljava/lang/Double;)Lio/sentry/SentryAttribute; public fun getName ()Ljava/lang/String; @@ -2774,11 +2828,13 @@ public final class io/sentry/SentryAttribute { } public final class io/sentry/SentryAttributeType : java/lang/Enum { + public static final field ARRAY Lio/sentry/SentryAttributeType; public static final field BOOLEAN Lio/sentry/SentryAttributeType; public static final field DOUBLE Lio/sentry/SentryAttributeType; public static final field INTEGER Lio/sentry/SentryAttributeType; public static final field STRING Lio/sentry/SentryAttributeType; public fun apiName ()Ljava/lang/String; + public static fun inferFrom (Ljava/lang/Object;)Lio/sentry/SentryAttributeType; public static fun valueOf (Ljava/lang/String;)Lio/sentry/SentryAttributeType; public static fun values ()[Lio/sentry/SentryAttributeType; } @@ -3288,6 +3344,7 @@ public final class io/sentry/SentryLogEvent$JsonKeys { public final class io/sentry/SentryLogEventAttributeValue : io/sentry/JsonSerializable, io/sentry/JsonUnknown { public fun (Lio/sentry/SentryAttributeType;Ljava/lang/Object;)V public fun (Ljava/lang/String;Ljava/lang/Object;)V + public static fun fromAttribute (Lio/sentry/SentryAttribute;)Lio/sentry/SentryLogEventAttributeValue; public fun getType ()Ljava/lang/String; public fun getUnknown ()Ljava/util/Map; public fun getValue ()Ljava/lang/Object; diff --git a/sentry/src/main/java/io/sentry/CombinedScopeView.java b/sentry/src/main/java/io/sentry/CombinedScopeView.java index fc90e6255bd..0c61bdf9126 100644 --- a/sentry/src/main/java/io/sentry/CombinedScopeView.java +++ b/sentry/src/main/java/io/sentry/CombinedScopeView.java @@ -241,6 +241,35 @@ public void removeTag(@Nullable String key) { getDefaultWriteScope().removeTag(key); } + @Override + public @NotNull Map getAttributes() { + final @NotNull Map allAttributes = new ConcurrentHashMap<>(); + allAttributes.putAll(globalScope.getAttributes()); + allAttributes.putAll(isolationScope.getAttributes()); + allAttributes.putAll(scope.getAttributes()); + return allAttributes; + } + + @Override + public void setAttribute(@Nullable String key, @Nullable Object value) { + getDefaultWriteScope().setAttribute(key, value); + } + + @Override + public void setAttribute(@Nullable SentryAttribute attribute) { + getDefaultWriteScope().setAttribute(attribute); + } + + @Override + public void setAttributes(@Nullable SentryAttributes attributes) { + getDefaultWriteScope().setAttributes(attributes); + } + + @Override + public void removeAttribute(@Nullable String key) { + getDefaultWriteScope().removeAttribute(key); + } + @Override public @NotNull Map getExtras() { final @NotNull Map allTags = new ConcurrentHashMap<>(); diff --git a/sentry/src/main/java/io/sentry/HubAdapter.java b/sentry/src/main/java/io/sentry/HubAdapter.java index 5715d061144..cf90eb1fe65 100644 --- a/sentry/src/main/java/io/sentry/HubAdapter.java +++ b/sentry/src/main/java/io/sentry/HubAdapter.java @@ -395,6 +395,26 @@ public void reportFullyDisplayed() { return Sentry.getCurrentScopes().metrics(); } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) { + Sentry.setAttribute(key, value); + } + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) { + Sentry.setAttribute(attribute); + } + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) { + Sentry.setAttributes(attributes); + } + + @Override + public void removeAttribute(final @Nullable String key) { + Sentry.removeAttribute(key); + } + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { Sentry.addFeatureFlag(flag, result); diff --git a/sentry/src/main/java/io/sentry/HubScopesWrapper.java b/sentry/src/main/java/io/sentry/HubScopesWrapper.java index c04aad9ed8c..66a34b4dc36 100644 --- a/sentry/src/main/java/io/sentry/HubScopesWrapper.java +++ b/sentry/src/main/java/io/sentry/HubScopesWrapper.java @@ -380,6 +380,26 @@ public void reportFullyDisplayed() { return scopes.metrics(); } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) { + scopes.setAttribute(key, value); + } + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) { + scopes.setAttribute(attribute); + } + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) { + scopes.setAttributes(attributes); + } + + @Override + public void removeAttribute(final @Nullable String key) { + scopes.removeAttribute(key); + } + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { scopes.addFeatureFlag(flag, result); diff --git a/sentry/src/main/java/io/sentry/IScope.java b/sentry/src/main/java/io/sentry/IScope.java index f41ea1cbbe1..ccab8dbdeb3 100644 --- a/sentry/src/main/java/io/sentry/IScope.java +++ b/sentry/src/main/java/io/sentry/IScope.java @@ -425,6 +425,44 @@ void setSpanContext( @ApiStatus.Internal void replaceOptions(final @NotNull SentryOptions options); + /** + * Sets an attribute on the Scope. + * + * @param key the key + * @param value the value + */ + void setAttribute(final @Nullable String key, final @Nullable Object value); + + /** + * Sets an attribute on the Scope. + * + * @param attribute the attribute + */ + void setAttribute(final @Nullable SentryAttribute attribute); + + /** + * Sets multiple attributes on the Scope. + * + * @param attributes the attributes + */ + void setAttributes(final @Nullable SentryAttributes attributes); + + /** + * Removes an attribute from the Scope. + * + * @param key the key + */ + void removeAttribute(final @Nullable String key); + + /** + * Returns the Scope's attributes + * + * @return the attributes map + */ + @ApiStatus.Internal + @NotNull + Map getAttributes(); + void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result); @ApiStatus.Internal diff --git a/sentry/src/main/java/io/sentry/IScopes.java b/sentry/src/main/java/io/sentry/IScopes.java index 0a7c86fa8e6..b1b437f72e5 100644 --- a/sentry/src/main/java/io/sentry/IScopes.java +++ b/sentry/src/main/java/io/sentry/IScopes.java @@ -748,5 +748,34 @@ default boolean isNoOp() { @NotNull IMetricsApi metrics(); + /** + * Sets an attribute. + * + * @param key the key + * @param value the value + */ + void setAttribute(final @Nullable String key, final @Nullable Object value); + + /** + * Sets an attribute. + * + * @param attribute the attribute + */ + void setAttribute(final @Nullable SentryAttribute attribute); + + /** + * Sets multiple attributes. + * + * @param attributes the attributes + */ + void setAttributes(final @Nullable SentryAttributes attributes); + + /** + * Removes an attribute. + * + * @param key the key + */ + void removeAttribute(final @Nullable String key); + void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result); } diff --git a/sentry/src/main/java/io/sentry/NoOpHub.java b/sentry/src/main/java/io/sentry/NoOpHub.java index 2885d8017d1..4a02be1bd40 100644 --- a/sentry/src/main/java/io/sentry/NoOpHub.java +++ b/sentry/src/main/java/io/sentry/NoOpHub.java @@ -338,6 +338,18 @@ public boolean isNoOp() { return NoOpMetricsApi.getInstance(); } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) {} + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) {} + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) {} + + @Override + public void removeAttribute(final @Nullable String key) {} + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) {} } diff --git a/sentry/src/main/java/io/sentry/NoOpScope.java b/sentry/src/main/java/io/sentry/NoOpScope.java index c04c5af87bd..7693ab81deb 100644 --- a/sentry/src/main/java/io/sentry/NoOpScope.java +++ b/sentry/src/main/java/io/sentry/NoOpScope.java @@ -300,6 +300,24 @@ public void setSpanContext( @Override public void replaceOptions(@NotNull SentryOptions options) {} + @Override + public void setAttribute(@Nullable String key, @Nullable Object value) {} + + @Override + public void setAttribute(@Nullable SentryAttribute attribute) {} + + @Override + public void setAttributes(@Nullable SentryAttributes attributes) {} + + @Override + public void removeAttribute(@Nullable String key) {} + + @ApiStatus.Internal + @Override + public @NotNull Map getAttributes() { + return new HashMap<>(); + } + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) {} diff --git a/sentry/src/main/java/io/sentry/NoOpScopes.java b/sentry/src/main/java/io/sentry/NoOpScopes.java index 5abb20226ac..1ae357d502e 100644 --- a/sentry/src/main/java/io/sentry/NoOpScopes.java +++ b/sentry/src/main/java/io/sentry/NoOpScopes.java @@ -336,6 +336,18 @@ public boolean isNoOp() { return NoOpMetricsApi.getInstance(); } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) {} + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) {} + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) {} + + @Override + public void removeAttribute(final @Nullable String key) {} + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) {} } diff --git a/sentry/src/main/java/io/sentry/Scope.java b/sentry/src/main/java/io/sentry/Scope.java index 5fc82a648d3..1aab545b80c 100644 --- a/sentry/src/main/java/io/sentry/Scope.java +++ b/sentry/src/main/java/io/sentry/Scope.java @@ -65,6 +65,9 @@ public final class Scope implements IScope { /** Scope's tags */ private @NotNull Map tags = new ConcurrentHashMap<>(); + /** Scope's attributes */ + private @NotNull Map attributes = new ConcurrentHashMap<>(); + /** Scope's extras */ private @NotNull Map extra = new ConcurrentHashMap<>(); @@ -164,6 +167,18 @@ private Scope(final @NotNull Scope scope) { this.tags = tagsClone; + final Map attributesRef = scope.attributes; + + final Map attributesClone = new ConcurrentHashMap<>(); + + for (Map.Entry item : attributesRef.entrySet()) { + if (item != null) { + attributesClone.put(item.getKey(), item.getValue()); // shallow copy + } + } + + this.attributes = attributesClone; + final Map extraRef = scope.extra; Map extraClone = new ConcurrentHashMap<>(); @@ -554,6 +569,7 @@ public void clear() { fingerprint.clear(); clearBreadcrumbs(); tags.clear(); + attributes.clear(); extra.clear(); eventProcessors.clear(); clearTransaction(); @@ -613,6 +629,60 @@ public void removeTag(final @Nullable String key) { } } + /** + * Returns the Scope's attributes + * + * @return the attributes map + */ + @ApiStatus.Internal + @SuppressWarnings("NullAway") // attributes are never null + @Override + public @NotNull Map getAttributes() { + return CollectionUtils.newConcurrentHashMap(attributes); + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) { + if (key == null) { + return; + } + if (value == null) { + removeAttribute(key); + } else { + this.attributes.put(key, SentryAttribute.named(key, value)); + } + } + + /** {@inheritDoc} */ + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) { + if (attribute == null) { + return; + } + this.attributes.put(attribute.getName(), attribute); + } + + /** {@inheritDoc} */ + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) { + if (attributes == null) { + return; + } + for (SentryAttribute attribute : attributes.getAttributes().values()) { + this.attributes.put(attribute.getName(), attribute); + } + } + + /** {@inheritDoc} */ + @Override + public void removeAttribute(final @Nullable String key) { + if (key == null) { + return; + } + this.attributes.remove(key); + } + /** * Returns the Scope's extra map * diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index ee3d55f2291..e155979e064 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -1244,6 +1244,56 @@ public void reportFullyDisplayed() { return metrics; } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) { + if (!isEnabled()) { + getOptions() + .getLogger() + .log( + SentryLevel.WARNING, "Instance is disabled and this 'setAttribute' call is a no-op."); + } else { + getCombinedScopeView().setAttribute(key, value); + } + } + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) { + if (!isEnabled()) { + getOptions() + .getLogger() + .log( + SentryLevel.WARNING, "Instance is disabled and this 'setAttribute' call is a no-op."); + } else { + getCombinedScopeView().setAttribute(attribute); + } + } + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) { + if (!isEnabled()) { + getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Instance is disabled and this 'setAttributes' call is a no-op."); + } else { + getCombinedScopeView().setAttributes(attributes); + } + } + + @Override + public void removeAttribute(final @Nullable String key) { + if (!isEnabled()) { + getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Instance is disabled and this 'removeAttribute' call is a no-op."); + } else { + getCombinedScopeView().removeAttribute(key); + } + } + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { combinedScope.addFeatureFlag(flag, result); diff --git a/sentry/src/main/java/io/sentry/ScopesAdapter.java b/sentry/src/main/java/io/sentry/ScopesAdapter.java index ba7e74d23bb..b66b681a332 100644 --- a/sentry/src/main/java/io/sentry/ScopesAdapter.java +++ b/sentry/src/main/java/io/sentry/ScopesAdapter.java @@ -392,6 +392,26 @@ public void reportFullyDisplayed() { return Sentry.getCurrentScopes().metrics(); } + @Override + public void setAttribute(final @Nullable String key, final @Nullable Object value) { + Sentry.setAttribute(key, value); + } + + @Override + public void setAttribute(final @Nullable SentryAttribute attribute) { + Sentry.setAttribute(attribute); + } + + @Override + public void setAttributes(final @Nullable SentryAttributes attributes) { + Sentry.setAttributes(attributes); + } + + @Override + public void removeAttribute(final @Nullable String key) { + Sentry.removeAttribute(key); + } + @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { Sentry.addFeatureFlag(flag, result); diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index 8acc051f522..63caf829fc9 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -1368,6 +1368,43 @@ public static void showUserFeedbackDialog( options.getFeedbackOptions().getDialogHandler().showDialog(associatedEventId, configurator); } + /** + * Sets an attribute on the scope. + * + * @param key the key + * @param value the value + */ + public static void setAttribute(final @Nullable String key, final @Nullable Object value) { + getCurrentScopes().setAttribute(key, value); + } + + /** + * Sets an attribute on the scope. + * + * @param attribute the attribute + */ + public static void setAttribute(final @Nullable SentryAttribute attribute) { + getCurrentScopes().setAttribute(attribute); + } + + /** + * Sets multiple attributes on the scope. + * + * @param attributes the attributes + */ + public static void setAttributes(final @Nullable SentryAttributes attributes) { + getCurrentScopes().setAttributes(attributes); + } + + /** + * Removes an attribute from the scope. + * + * @param key the key + */ + public static void removeAttribute(final @Nullable String key) { + getCurrentScopes().removeAttribute(key); + } + public static void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { getCurrentScopes().addFeatureFlag(flag, result); } diff --git a/sentry/src/main/java/io/sentry/SentryAttribute.java b/sentry/src/main/java/io/sentry/SentryAttribute.java index 4bcef14ee8c..213ef53d91e 100644 --- a/sentry/src/main/java/io/sentry/SentryAttribute.java +++ b/sentry/src/main/java/io/sentry/SentryAttribute.java @@ -1,5 +1,6 @@ package io.sentry; +import java.util.Collection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,4 +55,14 @@ private SentryAttribute( final @NotNull String name, final @Nullable String value) { return new SentryAttribute(name, SentryAttributeType.STRING, value); } + + public static @NotNull SentryAttribute arrayAttribute( + final @NotNull String name, final @Nullable Collection value) { + return new SentryAttribute(name, SentryAttributeType.ARRAY, value); + } + + public static @NotNull SentryAttribute arrayAttribute( + final @NotNull String name, final @Nullable Object[] value) { + return new SentryAttribute(name, SentryAttributeType.ARRAY, value); + } } diff --git a/sentry/src/main/java/io/sentry/SentryAttributeType.java b/sentry/src/main/java/io/sentry/SentryAttributeType.java index a47d7e71f0e..b6648179631 100644 --- a/sentry/src/main/java/io/sentry/SentryAttributeType.java +++ b/sentry/src/main/java/io/sentry/SentryAttributeType.java @@ -1,15 +1,43 @@ package io.sentry; +import java.math.BigInteger; +import java.util.Collection; import java.util.Locale; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public enum SentryAttributeType { STRING, BOOLEAN, INTEGER, - DOUBLE; + DOUBLE, + ARRAY; public @NotNull String apiName() { return name().toLowerCase(Locale.ROOT); } + + public static @NotNull SentryAttributeType inferFrom(final @Nullable Object value) { + if (value instanceof Boolean) { + return BOOLEAN; + } + if (value instanceof Integer + || value instanceof Long + || value instanceof Short + || value instanceof Byte + || value instanceof BigInteger + || value instanceof AtomicInteger + || value instanceof AtomicLong) { + return INTEGER; + } + if (value instanceof Number) { + return DOUBLE; + } + if (value instanceof Collection || (value != null && value.getClass().isArray())) { + return ARRAY; + } + return STRING; + } } diff --git a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java index 1fd7c8c4528..6f6542927f9 100644 --- a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java +++ b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java @@ -27,6 +27,21 @@ public SentryLogEventAttributeValue( this(type.apiName(), value); } + /** + * Creates a {@link SentryLogEventAttributeValue} from a {@link SentryAttribute}, inferring the + * type if not explicitly set. + * + * @param attribute the attribute + * @return the attribute value + */ + public static @NotNull SentryLogEventAttributeValue fromAttribute( + final @NotNull SentryAttribute attribute) { + final @Nullable Object value = attribute.getValue(); + final @NotNull SentryAttributeType type = + attribute.getType() == null ? SentryAttributeType.inferFrom(value) : attribute.getType(); + return new SentryLogEventAttributeValue(type, value); + } + public @NotNull String getType() { return type; } diff --git a/sentry/src/main/java/io/sentry/logger/LoggerApi.java b/sentry/src/main/java/io/sentry/logger/LoggerApi.java index 37a485df315..c203dcbfb8f 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerApi.java @@ -21,6 +21,7 @@ import io.sentry.util.Platform; import io.sentry.util.TracingUtils; import java.util.HashMap; +import java.util.Map; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -163,6 +164,14 @@ private void captureLog( final @NotNull String message, final @Nullable Object... args) { final @NotNull HashMap attributes = new HashMap<>(); + + final @NotNull Map scopeAttributes = + scopes.getCombinedScopeView().getAttributes(); + for (SentryAttribute scopeAttribute : scopeAttributes.values()) { + attributes.put( + scopeAttribute.getName(), SentryLogEventAttributeValue.fromAttribute(scopeAttribute)); + } + final @NotNull String origin = params.getOrigin(); if (!"manual".equalsIgnoreCase(origin)) { attributes.put( @@ -173,17 +182,14 @@ private void captureLog( if (incomingAttributes != null) { for (SentryAttribute attribute : incomingAttributes.getAttributes().values()) { - final @Nullable Object value = attribute.getValue(); - final @NotNull SentryAttributeType type = - attribute.getType() == null ? getType(value) : attribute.getType(); - attributes.put(attribute.getName(), new SentryLogEventAttributeValue(type, value)); + attributes.put(attribute.getName(), SentryLogEventAttributeValue.fromAttribute(attribute)); } } if (args != null) { int i = 0; for (Object arg : args) { - final @NotNull SentryAttributeType type = getType(arg); + final @NotNull SentryAttributeType type = SentryAttributeType.inferFrom(arg); attributes.put( "sentry.message.parameter." + i, new SentryLogEventAttributeValue(type, arg)); i++; @@ -292,17 +298,4 @@ private void setUser(final @NotNull HashMap createAttributes( final @NotNull SentryMetricsParameters params) { final @NotNull HashMap attributes = new HashMap<>(); + + final @NotNull Map scopeAttributes = + scopes.getCombinedScopeView().getAttributes(); + for (SentryAttribute scopeAttribute : scopeAttributes.values()) { + attributes.put( + scopeAttribute.getName(), SentryLogEventAttributeValue.fromAttribute(scopeAttribute)); + } + final @NotNull String origin = params.getOrigin(); if (!"manual".equalsIgnoreCase(origin)) { attributes.put( @@ -177,10 +186,7 @@ private void captureMetrics( if (incomingAttributes != null) { for (SentryAttribute attribute : incomingAttributes.getAttributes().values()) { - final @Nullable Object value = attribute.getValue(); - final @NotNull SentryAttributeType type = - attribute.getType() == null ? getType(value) : attribute.getType(); - attributes.put(attribute.getName(), new SentryLogEventAttributeValue(type, value)); + attributes.put(attribute.getName(), SentryLogEventAttributeValue.fromAttribute(attribute)); } } @@ -279,17 +285,4 @@ private void setUser(final @NotNull HashMap())) + } + + @Test + fun `inferFrom returns ARRAY for mixed-type list`() { + assertEquals(SentryAttributeType.ARRAY, SentryAttributeType.inferFrom(listOf("a", 1, true))) + } + + @Test + fun `arrayAttribute factory accepts Object array`() { + val attr = SentryAttribute.arrayAttribute("key", arrayOf("a", "b")) + assertEquals("key", attr.name) + assertEquals(SentryAttributeType.ARRAY, attr.type) + } +} diff --git a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt index c65a3cca709..ade038a408b 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt @@ -38,6 +38,7 @@ class SentryLogsSerializationTest { "sentry.sdk.name" to SentryLogEventAttributeValue("string", "sentry.java.spring-boot.jakarta"), "sentry.environment" to SentryLogEventAttributeValue("string", "production"), + "custom.array" to SentryLogEventAttributeValue("array", listOf("a", "b")), "sentry.sdk.version" to SentryLogEventAttributeValue("string", "8.11.1"), "sentry.trace.parent_span_id" to SentryLogEventAttributeValue("string", "f28b86350e534671"), diff --git a/sentry/src/test/resources/json/sentry_logs.json b/sentry/src/test/resources/json/sentry_logs.json index e78f5af1b09..1674a4f5764 100644 --- a/sentry/src/test/resources/json/sentry_logs.json +++ b/sentry/src/test/resources/json/sentry_logs.json @@ -20,6 +20,11 @@ "type": "string", "value": "production" }, + "custom.array": + { + "type": "array", + "value": ["a", "b"] + }, "sentry.sdk.version": { "type": "string", From 46044dc3e57aaef0170354382869c0c195a6652f Mon Sep 17 00:00:00 2001 From: adinauer <2542832+adinauer@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:31:08 +0000 Subject: [PATCH 030/391] release: 8.34.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4353044f84e..c6d0c4104dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.34.0 ### Features diff --git a/gradle.properties b/gradle.properties index 3faa0216ef2..9c919a6bde2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.33.0 +versionName=8.34.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 83884a0b907c939131bf81b60b8b5063e9a46e28 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 4 Mar 2026 16:27:26 +0100 Subject: [PATCH 031/391] Allow configuring shutdown and session flush timeouts externally and speed up tests (#4641) * Add new modules for Spring 7 and Spring Boot 4 * Fix Spring 7 and Spring Boot 4 modules (#4602) * Attempt to fix kotlin 2.2 issue (#4603) * Fix Spring 7 and Spring Boot 4 modules * Attempt to fix kotlin 2.2 issue * Second attempt to fix Kotlin 2.2 (#4610) * Second attempt to fix Kotlin 2.2 * Format code * Third attempt at fixing Kotlin 2.2 compat (#4613) --------- Co-authored-by: Sentry Github Bot * Address compose-related issues * Fix tests for Spring 7 and Spring Boot 4 (#4614) * Second attempt to fix Kotlin 2.2 * Format code * Third attempt at fixing Kotlin 2.2 compat * Fix tests for Spring 7 and Spring Boot 4 * Move Spring 7 and Spring Boot 4 packages (#4615) * Move Spring 7 and Spring Boot 4 packages * Fix class not found due to OTel not supporting spring boot 4 yet (#4616) * Format code * some fixes * change kotlin 1.8 to 1.9 and some cleanup * ignore warnings about api level that is not relevant * fix optional dependencies in SentryAutoConfiguration * Update trace origin * Remove duplicate e2e test config * Update Strings for Spring 7 and Spring Boot 4 * Disable Spring Boot 4 agentless e2e tests for now --------- Co-authored-by: Sentry Github Bot --------- Co-authored-by: Sentry Github Bot Co-authored-by: markushi * changelog * fix ci * add ignored span origins for Spring 7 and Spring Boot 4 * move changelog * Speed up tests * docs(changelog): Add entry for external shutdown/session-flush timeout options Co-Authored-By: Claude * ref: Use tracingEnabledRunner in boot4 and jakarta test classes The tracingEnabledRunner was defined but unused in spring-boot-4 and spring-boot-jakarta. Migrate the tracing tests to use it, matching what was already done in spring-boot. Co-Authored-By: Claude * ref: Add Millis suffix to ExternalOptions timeout fields Rename shutdownTimeout/sessionFlushTimeout to shutdownTimeoutMillis/sessionFlushTimeoutMillis for consistency with SentryOptions naming convention. Co-Authored-By: Claude * ref: Add Millis suffix to ExternalOptions timeout fields Rename shutdownTimeout/sessionFlushTimeout to shutdownTimeoutMillis/sessionFlushTimeoutMillis in ExternalOptions for consistency with SentryOptions naming convention. Also rename the sentry.properties keys from shutdown-timeout to shutdown-timeout-millis and session-flush-timeout to session-flush-timeout-millis. Co-Authored-By: Claude * docs(changelog): Restructure timeout options changelog entry List each configuration method separately for clarity. Co-Authored-By: Claude * fix(test): Use baseContextRunner for transport factory tests Tests asserting AsyncHttpTransportFactory must not use contextRunner which includes NoOpTransportConfiguration, as the NoOp bean would override the auto-configured transport factory. Co-Authored-By: Claude * Format code * ci: retrigger CI --------- Co-authored-by: Sentry Github Bot Co-authored-by: markushi Co-authored-by: Claude --- CHANGELOG.md | 4 + .../kotlin/io/sentry/jul/SentryHandlerTest.kt | 14 +- .../io/sentry/log4j2/SentryAppenderTest.kt | 12 +- .../src/test/resources/sentry.properties | 2 + .../io/sentry/logback/SentryAppenderTest.kt | 20 ++- .../boot4/SentryAutoConfigurationTest.kt | 161 ++++++++++-------- ...tryLogbackAppenderAutoConfigurationTest.kt | 80 ++++++--- .../SentryWebfluxAutoConfigurationTest.kt | 77 ++++++--- .../jakarta/SentryAutoConfigurationTest.kt | 161 ++++++++++-------- ...tryLogbackAppenderAutoConfigurationTest.kt | 80 ++++++--- .../SentryWebfluxAutoConfigurationTest.kt | 77 ++++++--- .../boot/SentryAutoConfigurationTest.kt | 114 ++++++++----- ...tryLogbackAppenderAutoConfigurationTest.kt | 80 ++++++--- .../SentryWebfluxAutoConfigurationTest.kt | 53 +++++- sentry/api/sentry.api | 4 + .../main/java/io/sentry/ExternalOptions.java | 21 +++ .../main/java/io/sentry/SentryOptions.java | 6 + .../java/io/sentry/ExternalOptionsTest.kt | 14 ++ .../test/java/io/sentry/SentryOptionsTest.kt | 4 + 19 files changed, 667 insertions(+), 317 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d0c4104dd..338bbea4457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Features +- Allow configuring shutdown and session flush timeouts externally ([#4641](https://github.com/getsentry/sentry-java/pull/4641)) + - `sentry.properties`: `shutdown-timeout-millis`, `session-flush-timeout-millis` + - Environment variables: `SENTRY_SHUTDOWN_TIMEOUT_MILLIS`, `SENTRY_SESSION_FLUSH_TIMEOUT_MILLIS` + - Spring Boot `application.properties`: `sentry.shutdownTimeoutMillis`, `sentry.sessionFlushTimeoutMillis` - Add scope-level attributes API ([#5118](https://github.com/getsentry/sentry-java/pull/5118)) via ([#5148](https://github.com/getsentry/sentry-java/pull/5148)) - Automatically include scope attributes in logs and metrics ([#5120](https://github.com/getsentry/sentry-java/pull/5120)) - New APIs are `Sentry.setAttribute`, `Sentry.setAttributes`, `Sentry.removeAttribute` diff --git a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt index 889eb267d17..e86f06a4ab7 100644 --- a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt +++ b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt @@ -7,6 +7,7 @@ import io.sentry.SentryLogLevel import io.sentry.SentryOptions import io.sentry.checkEvent import io.sentry.checkLogs +import io.sentry.test.applyTestOptions import io.sentry.test.initForTest import io.sentry.transport.ITransport import java.time.Instant @@ -44,6 +45,7 @@ class SentryHandlerTest { val options = SentryOptions() options.dsn = "http://key@localhost/proj" options.setTransportFactory { _, _ -> transport } + applyTestOptions(options) contextTags?.forEach { options.addContextTag(it) } logger = Logger.getLogger("jul.SentryHandlerTest") handler = SentryHandler(options, configureWithLogManager, true) @@ -415,7 +417,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.FINEST) fixture.logger.finest("testing trace level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( @@ -431,7 +433,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.FINE) fixture.logger.fine("testing trace level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.DEBUG, event.items.first().level) }) @@ -442,7 +444,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.CONFIG) fixture.logger.config("testing debug level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.DEBUG, event.items.first().level) }) @@ -453,7 +455,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.INFO) fixture.logger.info("testing info level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.INFO, event.items.first().level) }) @@ -464,7 +466,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.WARNING) fixture.logger.warning("testing warn level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.WARN, event.items.first().level) }) @@ -475,7 +477,7 @@ class SentryHandlerTest { fixture = Fixture(minimumLevel = Level.SEVERE) fixture.logger.severe("testing error level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.ERROR, event.items.first().level) }) diff --git a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt index 4f67b8af368..9923f81f00f 100644 --- a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt +++ b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt @@ -248,7 +248,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.TRACE) logger.trace("testing trace level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( @@ -267,7 +267,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.DEBUG) logger.debug("testing debug level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.DEBUG, event.items.first().level) }) @@ -278,7 +278,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.INFO) logger.info("testing info level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.INFO, event.items.first().level) }) @@ -289,7 +289,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.WARN) logger.warn("testing warn level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.WARN, event.items.first().level) }) @@ -300,7 +300,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.ERROR) logger.error("testing error level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.ERROR, event.items.first().level) }) @@ -311,7 +311,7 @@ class SentryAppenderTest { val logger = fixture.getSut(minimumLevel = Level.FATAL) logger.fatal("testing fatal level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { event -> assertEquals(SentryLogLevel.FATAL, event.items.first().level) }) diff --git a/sentry-log4j2/src/test/resources/sentry.properties b/sentry-log4j2/src/test/resources/sentry.properties index 0163b4f2f84..9845650aace 100644 --- a/sentry-log4j2/src/test/resources/sentry.properties +++ b/sentry-log4j2/src/test/resources/sentry.properties @@ -1,2 +1,4 @@ release=release from sentry.properties logs.enabled=true +shutdown-timeout-millis=0 +session-flush-timeout-millis=0 diff --git a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt index b2e44ac80bc..e00d3aed49a 100644 --- a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt +++ b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt @@ -18,6 +18,7 @@ import io.sentry.SentryLogLevel import io.sentry.SentryOptions import io.sentry.checkEvent import io.sentry.checkLogs +import io.sentry.test.applyTestOptions import io.sentry.test.initForTest import io.sentry.transport.ITransport import java.time.Instant @@ -68,6 +69,7 @@ class SentryAppenderTest { options.dsn = dsn options.isSendDefaultPii = sendDefaultPii options.logs.isEnabled = enableLogs + applyTestOptions(options) contextTags?.forEach { options.addContextTag(it) } appender.setOptions(options) appender.setMinimumBreadcrumbLevel(minimumBreadcrumbLevel) @@ -317,7 +319,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.TRACE, enableLogs = true) fixture.logger.trace("testing trace level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { logs -> assertEquals(SentryLogLevel.TRACE, logs.items.first().level) }) @@ -328,7 +330,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.DEBUG, enableLogs = true) fixture.logger.debug("testing debug level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { logs -> assertEquals(SentryLogLevel.DEBUG, logs.items.first().level) }) @@ -339,7 +341,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.INFO, enableLogs = true) fixture.logger.info("testing info level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { logs -> assertEquals(SentryLogLevel.INFO, logs.items.first().level) }) @@ -350,7 +352,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.WARN, enableLogs = true) fixture.logger.warn("testing warn level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { logs -> assertEquals(SentryLogLevel.WARN, logs.items.first().level) }) @@ -361,7 +363,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.ERROR, enableLogs = true) fixture.logger.error("testing error level") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send(checkLogs { logs -> assertEquals(SentryLogLevel.ERROR, logs.items.first().level) }) @@ -372,7 +374,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.TRACE, enableLogs = true) fixture.logger.trace("Testing {} level", "TRACE") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( @@ -394,7 +396,7 @@ class SentryAppenderTest { fixture = Fixture(minimumLevel = Level.TRACE, enableLogs = true, encoder = encoder) fixture.logger.trace("Testing {} level", "TRACE") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( @@ -420,7 +422,7 @@ class SentryAppenderTest { ) fixture.logger.trace("Testing {} level", "TRACE") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( @@ -447,7 +449,7 @@ class SentryAppenderTest { ) fixture.logger.trace("Testing {} level", "TRACE") - Sentry.flush(1000) + Sentry.flush(10) verify(fixture.transport) .send( diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt index 67200c2cd6d..a5566ef2f30 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt @@ -89,7 +89,8 @@ import org.springframework.web.servlet.HandlerExceptionResolver class SentryAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = WebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -98,6 +99,42 @@ class SentryAutoConfigurationTest { SentryProfilerAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runners for different test categories + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + private val tracingEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `scopes is not created when auto-configuration dsn is not set`() { @@ -106,22 +143,17 @@ class SentryAutoConfigurationTest { @Test fun `scopes is created when dsn is provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(IScopes::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(IScopes::class.java) } } @Test fun `OptionsConfiguration is created if custom one with name sentryOptionsConfiguration is not provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) } } @Test fun `OptionsConfiguration with name sentryOptionsConfiguration is created if another one with different name is provided`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj") + dsnEnabledRunner .withUserConfiguration(CustomOptionsConfigurationConfiguration::class.java) .run { assertThat(it).getBeans(Sentry.OptionsConfiguration::class.java).hasSize(2) @@ -316,7 +348,7 @@ class SentryAutoConfigurationTest { @Test fun `sets SDK version on sent events`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -432,7 +464,7 @@ class SentryAutoConfigurationTest { @Test fun `sets release on SentryEvents if Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -451,7 +483,7 @@ class SentryAutoConfigurationTest { @Test fun `sets custom release on SentryEvents if release property is set and Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.release=my-release") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -542,9 +574,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled, creates tracing filter`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasBean("sentryTracingFilter") } + tracingEnabledRunner.run { assertThat(it).hasBean("sentryTracingFilter") } } @Test @@ -578,19 +608,16 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and sentryTracingFilter already exists, does not create tracing filter`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withUserConfiguration(CustomSentryTracingFilter::class.java) - .run { - assertThat(it).hasBean("sentryTracingFilter") - val filter = it.getBean("sentryTracingFilter") + tracingEnabledRunner.withUserConfiguration(CustomSentryTracingFilter::class.java).run { + assertThat(it).hasBean("sentryTracingFilter") + val filter = it.getBean("sentryTracingFilter") - if (filter is FilterRegistrationBean<*>) { - assertThat(filter.filter).isNotInstanceOf(SentryTracingFilter::class.java) - } else { - assertThat(filter).isNotInstanceOf(SentryTracingFilter::class.java) - } + if (filter is FilterRegistrationBean<*>) { + assertThat(filter.filter).isNotInstanceOf(SentryTracingFilter::class.java) + } else { + assertThat(filter).isNotInstanceOf(SentryTracingFilter::class.java) } + } } @Test @@ -610,9 +637,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentryTransaction`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentryTransactionBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentryTransactionBeans() } } @Test @@ -639,16 +664,14 @@ class SentryAutoConfigurationTest { @Test fun `when Spring AOP is not on the classpath, does not create AOP beans to support @SentryTransaction`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)) - .run { assertThat(it).doesNotHaveSentryTransactionBeans() } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)).run { + assertThat(it).doesNotHaveSentryTransactionBeans() + } } @Test fun `when tracing is enabled and custom sentryTransactionPointcut is provided, sentryTransactionPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentryTransactionPointcut") @@ -659,9 +682,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentrySpan`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentrySpanBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentrySpanBeans() } } @Test @@ -688,16 +709,14 @@ class SentryAutoConfigurationTest { @Test fun `when Spring AOP is not on the classpath, does not create AOP beans to support @SentrySpan`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)) - .run { assertThat(it).doesNotHaveSentrySpanBeans() } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)).run { + assertThat(it).doesNotHaveSentrySpanBeans() + } } @Test fun `when tracing is enabled and custom sentrySpanPointcut is provided, sentrySpanPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentrySpanPointcut") @@ -708,47 +727,44 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and RestTemplate is on the classpath, SentrySpanRestTemplateCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestTemplate is not on the classpath, SentrySpanRestTemplateCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(RestTemplate::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanRestTemplateCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(RestTemplate::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanRestTemplateCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestClient is on the classpath, SentrySpanRestClientCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanRestClientCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanRestClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestClient is not on the classpath, SentrySpanRestClientCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(RestClient::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanRestClientCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(RestClient::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanRestClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and WebClient is on the classpath, SentrySpanWebClientCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and WebClient is not on the classpath, SentrySpanWebClientCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(WebClient::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanWebClientCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(WebClient::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanWebClientCustomizer::class.java) + } } @Test @@ -764,7 +780,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath, creates apache transport factory`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + baseContextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { assertThat(it.getBean(SentryOptions::class.java).transportFactory) .isInstanceOf(ApacheHttpClientTransportFactory::class.java) } @@ -772,7 +788,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is not on the classpath, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(ApacheHttpClientTransportFactory::class.java)) .run { @@ -783,7 +799,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath and custom transport factory bean is set, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -1234,6 +1250,15 @@ class SentryAutoConfigurationTest { @Bean open fun sentryTransport() = transport } + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } + @Configuration(proxyBeanMethods = false) open class CustomBeforeSendCallbackConfiguration { diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt index 17e903d9a34..681932e6f89 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt @@ -5,6 +5,8 @@ import ch.qos.logback.classic.Logger import ch.qos.logback.classic.LoggerContext import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.Appender +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.logback.SentryAppender import kotlin.test.BeforeTest import kotlin.test.Test @@ -13,10 +15,13 @@ import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration class SentryLogbackAppenderAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -24,6 +29,35 @@ class SentryLogbackAppenderAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger @@ -40,19 +74,15 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(1) } } @Test fun `configures SentryAppender for configured loggers`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.logging.loggers[0]=foo.bar", - "sentry.logging.loggers[1]=baz", - ) + dsnEnabledRunner + .withPropertyValues("sentry.logging.loggers[0]=foo.bar", "sentry.logging.loggers[1]=baz") .run { val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger val bazLogger = LoggerFactory.getLogger("baz") as Logger @@ -65,23 +95,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender for none of the loggers if so configured`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.logging.loggers=") - .run { - val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger - val bazLogger = LoggerFactory.getLogger("baz") as Logger + dsnEnabledRunner.withPropertyValues("sentry.logging.loggers=").run { + val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger + val bazLogger = LoggerFactory.getLogger("baz") as Logger - assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - } + assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + } } @Test fun `sets SentryAppender properties`() { - contextRunner + dsnEnabledRunner .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", "sentry.logging.minimum-event-level=info", "sentry.logging.minimum-breadcrumb-level=debug", "sentry.logging.minimum-level=error", @@ -113,7 +140,7 @@ class SentryLogbackAppenderAutoConfigurationTest { sentryAppender.start() rootLogger.addAppender(sentryAppender) - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { val appenders = rootLogger.getAppenders(SentryAppender::class.java) assertThat(appenders).hasSize(1) assertThat(appenders.first().name).isEqualTo("customAppender") @@ -122,7 +149,7 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when logback is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(LoggerContext::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } @@ -130,11 +157,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when sentry-logback module is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(SentryAppender::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } fun Logger.getAppenders(clazz: Class): List> { diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt index fbb3aedf375..a338208d8e4 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt @@ -1,6 +1,8 @@ package io.sentry.spring.boot4 import io.micrometer.context.ThreadLocalAccessor +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.spring7.webflux.SentryWebExceptionHandler import io.sentry.spring7.webflux.SentryWebFilter import io.sentry.spring7.webflux.SentryWebFilterWithThreadLocalAccessor @@ -10,10 +12,13 @@ import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner import org.springframework.boot.webflux.autoconfigure.WebFluxAutoConfiguration +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration import reactor.core.scheduler.Schedulers class SentryWebfluxAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ReactiveWebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -22,10 +27,39 @@ class SentryWebfluxAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `configures sentryWebFilter`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) } @@ -33,9 +67,7 @@ class SentryWebfluxAutoConfigurationTest { @Test fun `configures exception handler`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) } } @Test @@ -59,28 +91,18 @@ class SentryWebfluxAutoConfigurationTest { @Test fun `configures web filter with ThreadLocalAccessor support if available and enabled`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.reactive.thread-local-accessor-enabled=true", - ) - .run { - assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) - assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) - } + dsnEnabledRunner.withPropertyValues("sentry.reactive.thread-local-accessor-enabled=true").run { + assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) + assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) + } } @Test fun `does not configure web filter with ThreadLocalAccessor support if disabled`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.reactive.thread-local-accessor-enabled=false", - ) - .run { - assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) - assertThat(it).hasSingleBean(SentryWebFilter::class.java) - } + dsnEnabledRunner.withPropertyValues("sentry.reactive.thread-local-accessor-enabled=false").run { + assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) + assertThat(it).hasSingleBean(SentryWebFilter::class.java) + } } @Test @@ -93,4 +115,13 @@ class SentryWebfluxAutoConfigurationTest { .withClassLoader(FilteredClassLoader(ThreadLocalAccessor::class.java)) .run { assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt index 4392598bf52..f37122812b1 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt @@ -93,7 +93,8 @@ import org.springframework.web.servlet.HandlerExceptionResolver class SentryAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = WebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -102,6 +103,42 @@ class SentryAutoConfigurationTest { SentryProfilerAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runners for different test categories + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + private val tracingEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `scopes is not created when auto-configuration dsn is not set`() { @@ -110,22 +147,17 @@ class SentryAutoConfigurationTest { @Test fun `scopes is created when dsn is provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(IScopes::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(IScopes::class.java) } } @Test fun `OptionsConfiguration is created if custom one with name sentryOptionsConfiguration is not provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) } } @Test fun `OptionsConfiguration with name sentryOptionsConfiguration is created if another one with different name is provided`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj") + dsnEnabledRunner .withUserConfiguration(CustomOptionsConfigurationConfiguration::class.java) .run { assertThat(it).getBeans(Sentry.OptionsConfiguration::class.java).hasSize(2) @@ -327,7 +359,7 @@ class SentryAutoConfigurationTest { @Test fun `sets SDK version on sent events`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -454,7 +486,7 @@ class SentryAutoConfigurationTest { @Test fun `sets release on SentryEvents if Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -473,7 +505,7 @@ class SentryAutoConfigurationTest { @Test fun `sets custom release on SentryEvents if release property is set and Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.release=my-release") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -564,9 +596,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled, creates tracing filter`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasBean("sentryTracingFilter") } + tracingEnabledRunner.run { assertThat(it).hasBean("sentryTracingFilter") } } @Test @@ -600,19 +630,16 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and sentryTracingFilter already exists, does not create tracing filter`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withUserConfiguration(CustomSentryTracingFilter::class.java) - .run { - assertThat(it).hasBean("sentryTracingFilter") - val filter = it.getBean("sentryTracingFilter") + tracingEnabledRunner.withUserConfiguration(CustomSentryTracingFilter::class.java).run { + assertThat(it).hasBean("sentryTracingFilter") + val filter = it.getBean("sentryTracingFilter") - if (filter is FilterRegistrationBean<*>) { - assertThat(filter.filter).isNotInstanceOf(SentryTracingFilter::class.java) - } else { - assertThat(filter).isNotInstanceOf(SentryTracingFilter::class.java) - } + if (filter is FilterRegistrationBean<*>) { + assertThat(filter.filter).isNotInstanceOf(SentryTracingFilter::class.java) + } else { + assertThat(filter).isNotInstanceOf(SentryTracingFilter::class.java) } + } } @Test @@ -632,9 +659,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentryTransaction`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentryTransactionBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentryTransactionBeans() } } @Test @@ -661,16 +686,14 @@ class SentryAutoConfigurationTest { @Test fun `when Spring AOP is not on the classpath, does not create AOP beans to support @SentryTransaction`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)) - .run { assertThat(it).doesNotHaveSentryTransactionBeans() } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)).run { + assertThat(it).doesNotHaveSentryTransactionBeans() + } } @Test fun `when tracing is enabled and custom sentryTransactionPointcut is provided, sentryTransactionPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentryTransactionPointcut") @@ -681,9 +704,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentrySpan`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentrySpanBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentrySpanBeans() } } @Test @@ -710,16 +731,14 @@ class SentryAutoConfigurationTest { @Test fun `when Spring AOP is not on the classpath, does not create AOP beans to support @SentrySpan`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)) - .run { assertThat(it).doesNotHaveSentrySpanBeans() } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(ProceedingJoinPoint::class.java)).run { + assertThat(it).doesNotHaveSentrySpanBeans() + } } @Test fun `when tracing is enabled and custom sentrySpanPointcut is provided, sentrySpanPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentrySpanPointcut") @@ -730,47 +749,44 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and RestTemplate is on the classpath, SentrySpanRestTemplateCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestTemplate is not on the classpath, SentrySpanRestTemplateCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(RestTemplate::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanRestTemplateCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(RestTemplate::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanRestTemplateCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestClient is on the classpath, SentrySpanRestClientCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanRestClientCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanRestClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and RestClient is not on the classpath, SentrySpanRestClientCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(RestClient::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanRestClientCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(RestClient::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanRestClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and WebClient is on the classpath, SentrySpanWebClientCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) + } } @Test fun `when tracing is enabled and WebClient is not on the classpath, SentrySpanWebClientCustomizer bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .withClassLoader(FilteredClassLoader(WebClient::class.java)) - .run { assertThat(it).doesNotHaveBean(SentrySpanWebClientCustomizer::class.java) } + tracingEnabledRunner.withClassLoader(FilteredClassLoader(WebClient::class.java)).run { + assertThat(it).doesNotHaveBean(SentrySpanWebClientCustomizer::class.java) + } } @Test @@ -786,7 +802,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath, creates apache transport factory`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + baseContextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { assertThat(it.getBean(SentryOptions::class.java).transportFactory) .isInstanceOf(ApacheHttpClientTransportFactory::class.java) } @@ -794,7 +810,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is not on the classpath, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(ApacheHttpClientTransportFactory::class.java)) .run { @@ -805,7 +821,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath and custom transport factory bean is set, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -1256,6 +1272,15 @@ class SentryAutoConfigurationTest { @Bean open fun sentryTransport() = transport } + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } + @Configuration(proxyBeanMethods = false) open class CustomBeforeSendCallbackConfiguration { diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt index 77712ac70c6..d8982d995c1 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt @@ -5,6 +5,8 @@ import ch.qos.logback.classic.Logger import ch.qos.logback.classic.LoggerContext import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.Appender +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.logback.SentryAppender import kotlin.test.BeforeTest import kotlin.test.Test @@ -13,10 +15,13 @@ import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration class SentryLogbackAppenderAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -24,6 +29,35 @@ class SentryLogbackAppenderAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger @@ -40,19 +74,15 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(1) } } @Test fun `configures SentryAppender for configured loggers`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.logging.loggers[0]=foo.bar", - "sentry.logging.loggers[1]=baz", - ) + dsnEnabledRunner + .withPropertyValues("sentry.logging.loggers[0]=foo.bar", "sentry.logging.loggers[1]=baz") .run { val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger val bazLogger = LoggerFactory.getLogger("baz") as Logger @@ -65,23 +95,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender for none of the loggers if so configured`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.logging.loggers=") - .run { - val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger - val bazLogger = LoggerFactory.getLogger("baz") as Logger + dsnEnabledRunner.withPropertyValues("sentry.logging.loggers=").run { + val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger + val bazLogger = LoggerFactory.getLogger("baz") as Logger - assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - } + assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + } } @Test fun `sets SentryAppender properties`() { - contextRunner + dsnEnabledRunner .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", "sentry.logging.minimum-event-level=info", "sentry.logging.minimum-breadcrumb-level=debug", "sentry.logging.minimum-level=error", @@ -113,7 +140,7 @@ class SentryLogbackAppenderAutoConfigurationTest { sentryAppender.start() rootLogger.addAppender(sentryAppender) - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { val appenders = rootLogger.getAppenders(SentryAppender::class.java) assertThat(appenders).hasSize(1) assertThat(appenders.first().name).isEqualTo("customAppender") @@ -122,7 +149,7 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when logback is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(LoggerContext::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } @@ -130,11 +157,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when sentry-logback module is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(SentryAppender::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } fun Logger.getAppenders(clazz: Class): List> { diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt index fd47317d1d2..6b67f2d6e91 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt @@ -1,6 +1,8 @@ package io.sentry.spring.boot.jakarta import io.micrometer.context.ThreadLocalAccessor +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.spring.jakarta.webflux.SentryWebExceptionHandler import io.sentry.spring.jakarta.webflux.SentryWebFilter import io.sentry.spring.jakarta.webflux.SentryWebFilterWithThreadLocalAccessor @@ -10,10 +12,13 @@ import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration import reactor.core.scheduler.Schedulers class SentryWebfluxAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ReactiveWebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -22,10 +27,39 @@ class SentryWebfluxAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `configures sentryWebFilter`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) } @@ -33,9 +67,7 @@ class SentryWebfluxAutoConfigurationTest { @Test fun `configures exception handler`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) } } @Test @@ -59,28 +91,18 @@ class SentryWebfluxAutoConfigurationTest { @Test fun `configures web filter with ThreadLocalAccessor support if available and enabled`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.reactive.thread-local-accessor-enabled=true", - ) - .run { - assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) - assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) - } + dsnEnabledRunner.withPropertyValues("sentry.reactive.thread-local-accessor-enabled=true").run { + assertThat(it).hasSingleBean(SentryWebFilterWithThreadLocalAccessor::class.java) + assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) + } } @Test fun `does not configure web filter with ThreadLocalAccessor support if disabled`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.reactive.thread-local-accessor-enabled=false", - ) - .run { - assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) - assertThat(it).hasSingleBean(SentryWebFilter::class.java) - } + dsnEnabledRunner.withPropertyValues("sentry.reactive.thread-local-accessor-enabled=false").run { + assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) + assertThat(it).hasSingleBean(SentryWebFilter::class.java) + } } @Test @@ -93,4 +115,13 @@ class SentryWebfluxAutoConfigurationTest { .withClassLoader(FilteredClassLoader(ThreadLocalAccessor::class.java)) .run { assertThat(it).doesNotHaveBean(SentryWebFilterWithThreadLocalAccessor::class.java) } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt index 4dd4a9d6721..4ce0bf61208 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt @@ -92,7 +92,8 @@ import org.springframework.web.servlet.HandlerExceptionResolver class SentryAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = WebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -101,6 +102,42 @@ class SentryAutoConfigurationTest { SentryProfilerAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runners for different test categories + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + private val tracingEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `scopes is not created when auto-configuration dsn is not set`() { @@ -109,22 +146,17 @@ class SentryAutoConfigurationTest { @Test fun `scopes is created when dsn is provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(IScopes::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(IScopes::class.java) } } @Test fun `OptionsConfiguration is created if custom one with name sentryOptionsConfiguration is not provided`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) } } @Test fun `OptionsConfiguration with name sentryOptionsConfiguration is created if another one with different name is provided`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj") + dsnEnabledRunner .withUserConfiguration(CustomOptionsConfigurationConfiguration::class.java) .run { assertThat(it).getBeans(Sentry.OptionsConfiguration::class.java).hasSize(2) @@ -141,19 +173,18 @@ class SentryAutoConfigurationTest { @Test fun `sentryOptionsConfiguration bean is configured before custom OptionsConfiguration`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj") + dsnEnabledRunner .withUserConfiguration(CustomOptionsConfigurationConfiguration::class.java) .run { val options = it.getBean(SentryOptions::class.java) assertThat(options.beforeSend).isNull() + assertThat(options.shutdownTimeoutMillis).isEqualTo(0) } } @Test fun `OptionsConfiguration is not created if custom one with name sentryOptionsConfiguration is provided`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj") + dsnEnabledRunner .withUserConfiguration(OverridingOptionsConfigurationConfiguration::class.java) .run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) @@ -279,7 +310,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracePropagationTargets are not set, default is returned`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { val options = it.getBean(SentryProperties::class.java) assertThat(options.tracePropagationTargets).isNotNull().containsOnly(".*") } @@ -300,7 +331,7 @@ class SentryAutoConfigurationTest { @Test fun `when traces sample rate is set to null and tracing is enabled, traces sample rate should be set to 0`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { val options = it.getBean(SentryProperties::class.java) assertThat(options.tracesSampleRate).isNull() } @@ -318,7 +349,7 @@ class SentryAutoConfigurationTest { @Test fun `sets sentryClientName property on SentryOptions`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(it.getBean(SentryOptions::class.java).sentryClientName) .isEqualTo("sentry.java.spring-boot/${BuildConfig.VERSION_NAME}") } @@ -326,7 +357,7 @@ class SentryAutoConfigurationTest { @Test fun `sets SDK version on sent events`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -453,7 +484,7 @@ class SentryAutoConfigurationTest { @Test fun `sets release on SentryEvents if Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -472,7 +503,7 @@ class SentryAutoConfigurationTest { @Test fun `sets custom release on SentryEvents if release property is set and Git integration is configured`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.release=my-release") .withUserConfiguration( MockTransportConfiguration::class.java, @@ -563,9 +594,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled, creates tracing filter`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasBean("sentryTracingFilter") } + tracingEnabledRunner.run { assertThat(it).hasBean("sentryTracingFilter") } } @Test @@ -631,9 +660,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentryTransaction`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentryTransactionBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentryTransactionBeans() } } @Test @@ -668,8 +695,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and custom sentryTransactionPointcut is provided, sentryTransactionPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentryTransactionPointcut") @@ -680,9 +706,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled creates AOP beans to support @SentrySpan`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSentrySpanBeans() } + tracingEnabledRunner.run { assertThat(it).hasSentrySpanBeans() } } @Test @@ -717,8 +741,7 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and custom sentrySpanPointcut is provided, sentrySpanPointcut bean is not created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") + tracingEnabledRunner .withUserConfiguration(CustomSentryPerformancePointcutConfiguration::class.java) .run { assertThat(it).hasBean("sentrySpanPointcut") @@ -729,9 +752,9 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and RestTemplate is on the classpath, SentrySpanRestTemplateCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanRestTemplateCustomizer::class.java) + } } @Test @@ -744,9 +767,9 @@ class SentryAutoConfigurationTest { @Test fun `when tracing is enabled and WebClient is on the classpath, SentrySpanWebClientCustomizer bean is created`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") - .run { assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) } + tracingEnabledRunner.run { + assertThat(it).hasSingleBean(SentrySpanWebClientCustomizer::class.java) + } } @Test @@ -770,7 +793,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath, creates apache transport factory`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + baseContextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { assertThat(it.getBean(SentryOptions::class.java).transportFactory) .isInstanceOf(ApacheHttpClientTransportFactory::class.java) } @@ -778,7 +801,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is not on the classpath, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(ApacheHttpClientTransportFactory::class.java)) .run { @@ -789,7 +812,7 @@ class SentryAutoConfigurationTest { @Test fun `when sentry-apache-http-client-5 is on the classpath and custom transport factory bean is set, does not create apache transport factory`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(MockTransportConfiguration::class.java) .run { @@ -1182,6 +1205,15 @@ class SentryAutoConfigurationTest { @Bean open fun sentryTransport() = transport } + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } + @Configuration(proxyBeanMethods = false) open class CustomBeforeSendCallbackConfiguration { diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt index d353b3629f1..f68cad0ff90 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt @@ -5,6 +5,8 @@ import ch.qos.logback.classic.Logger import ch.qos.logback.classic.LoggerContext import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.Appender +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.logback.SentryAppender import kotlin.test.BeforeTest import kotlin.test.Test @@ -13,10 +15,13 @@ import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration class SentryLogbackAppenderAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -24,6 +29,35 @@ class SentryLogbackAppenderAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger @@ -40,19 +74,15 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(1) } } @Test fun `configures SentryAppender for configured loggers`() { - contextRunner - .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", - "sentry.logging.loggers[0]=foo.bar", - "sentry.logging.loggers[1]=baz", - ) + dsnEnabledRunner + .withPropertyValues("sentry.logging.loggers[0]=foo.bar", "sentry.logging.loggers[1]=baz") .run { val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger val bazLogger = LoggerFactory.getLogger("baz") as Logger @@ -65,23 +95,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `configures SentryAppender for none of the loggers if so configured`() { - contextRunner - .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.logging.loggers=") - .run { - val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger - val bazLogger = LoggerFactory.getLogger("baz") as Logger + dsnEnabledRunner.withPropertyValues("sentry.logging.loggers=").run { + val fooBarLogger = LoggerFactory.getLogger("foo.bar") as Logger + val bazLogger = LoggerFactory.getLogger("baz") as Logger - assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) - } + assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(fooBarLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + assertThat(bazLogger.getAppenders(SentryAppender::class.java)).hasSize(0) + } } @Test fun `sets SentryAppender properties`() { - contextRunner + dsnEnabledRunner .withPropertyValues( - "sentry.dsn=http://key@localhost/proj", "sentry.logging.minimum-event-level=info", "sentry.logging.minimum-breadcrumb-level=debug", "sentry.logging.minimum-level=error", @@ -113,7 +140,7 @@ class SentryLogbackAppenderAutoConfigurationTest { sentryAppender.start() rootLogger.addAppender(sentryAppender) - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + dsnEnabledRunner.run { val appenders = rootLogger.getAppenders(SentryAppender::class.java) assertThat(appenders).hasSize(1) assertThat(appenders.first().name).isEqualTo("customAppender") @@ -122,7 +149,7 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when logback is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(LoggerContext::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } @@ -130,11 +157,20 @@ class SentryLogbackAppenderAutoConfigurationTest { @Test fun `does not configure SentryAppender when sentry-logback module is not on the classpath`() { - contextRunner + baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withClassLoader(FilteredClassLoader(SentryAppender::class.java)) .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).isEmpty() } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } fun Logger.getAppenders(clazz: Class): List> { diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt index 320e8302b64..dea2c005881 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt @@ -1,5 +1,7 @@ package io.sentry.spring.boot +import io.sentry.ITransportFactory +import io.sentry.NoOpTransportFactory import io.sentry.spring.webflux.SentryWebExceptionHandler import io.sentry.spring.webflux.SentryWebFilter import kotlin.test.Test @@ -8,10 +10,13 @@ import org.springframework.boot.autoconfigure.AutoConfigurations import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration import org.springframework.boot.test.context.FilteredClassLoader import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration import reactor.core.scheduler.Schedulers class SentryWebfluxAutoConfigurationTest { - private val contextRunner = + // Base context runner with performance optimizations + private val baseContextRunner = ReactiveWebApplicationContextRunner() .withConfiguration( AutoConfigurations.of( @@ -20,19 +25,44 @@ class SentryWebfluxAutoConfigurationTest { SentryAutoConfiguration::class.java, ) ) + .withPropertyValues( + // Speed up tests by reducing timeouts and disabling expensive operations + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", // Disable expensive module sending + "sentry.attach-stacktrace=false", // Disable expensive stacktrace collection + "sentry.attach-threads=false", // Disable expensive thread info + "sentry.enable-backpressure-handling=false", + "sentry.enable-spotlight=false", + "sentry.debug=false", + "sentry.max-breadcrumbs=0", // Disable breadcrumb collection for performance + ) + + // Use the optimized base runner by default + private val contextRunner = + baseContextRunner.withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls + + // Specialized context runner for tests requiring DSN + private val dsnEnabledRunner = + baseContextRunner + .withPropertyValues("sentry.dsn=http://key@localhost/proj") + .withUserConfiguration( + NoOpTransportConfiguration::class.java + ) // Use no-op transport to avoid network calls @Test fun `configures sentryWebFilter`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(SentryWebFilter::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebFilter::class.java) } } @Test fun `configures exception handler`() { - contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { - assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) - } + dsnEnabledRunner.run { assertThat(it).hasSingleBean(SentryWebExceptionHandler::class.java) } } @Test @@ -53,4 +83,13 @@ class SentryWebfluxAutoConfigurationTest { assertThat(it).doesNotHaveBean(SentryWebFilter::class.java) } } + + @Configuration(proxyBeanMethods = false) + open class NoOpTransportConfiguration { + + @Bean + open fun noOpTransportFactory(): ITransportFactory { + return NoOpTransportFactory.getInstance() + } + } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index a7bbb6c6cfa..73eb9c61446 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -512,6 +512,8 @@ public final class io/sentry/ExternalOptions { public fun getSampleRate ()Ljava/lang/Double; public fun getSendClientReports ()Ljava/lang/Boolean; public fun getServerName ()Ljava/lang/String; + public fun getSessionFlushTimeoutMillis ()Ljava/lang/Long; + public fun getShutdownTimeoutMillis ()Ljava/lang/Long; public fun getSpotlightConnectionUrl ()Ljava/lang/String; public fun getTags ()Ljava/util/Map; public fun getTracePropagationTargets ()Ljava/util/List; @@ -563,6 +565,8 @@ public final class io/sentry/ExternalOptions { public fun setSendDefaultPii (Ljava/lang/Boolean;)V public fun setSendModules (Ljava/lang/Boolean;)V public fun setServerName (Ljava/lang/String;)V + public fun setSessionFlushTimeoutMillis (Ljava/lang/Long;)V + public fun setShutdownTimeoutMillis (Ljava/lang/Long;)V public fun setSpotlightConnectionUrl (Ljava/lang/String;)V public fun setTag (Ljava/lang/String;Ljava/lang/String;)V public fun setTracesSampleRate (Ljava/lang/Double;)V diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index 9eaf26b202f..8f16bcede01 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -35,6 +35,8 @@ public final class ExternalOptions { private final @NotNull List contextTags = new CopyOnWriteArrayList<>(); private @Nullable String proguardUuid; private @Nullable Long idleTimeout; + private @Nullable Long shutdownTimeoutMillis; + private @Nullable Long sessionFlushTimeoutMillis; private final @NotNull Set> ignoredExceptionsForType = new CopyOnWriteArraySet<>(); private @Nullable List ignoredErrors; @@ -137,6 +139,9 @@ public final class ExternalOptions { options.addBundleId(bundleId); } options.setIdleTimeout(propertiesProvider.getLongProperty("idle-timeout")); + options.setShutdownTimeoutMillis(propertiesProvider.getLongProperty("shutdown-timeout-millis")); + options.setSessionFlushTimeoutMillis( + propertiesProvider.getLongProperty("session-flush-timeout-millis")); options.setIgnoredErrors(propertiesProvider.getListOrNull("ignored-errors")); @@ -410,6 +415,22 @@ public void setIdleTimeout(final @Nullable Long idleTimeout) { this.idleTimeout = idleTimeout; } + public @Nullable Long getShutdownTimeoutMillis() { + return shutdownTimeoutMillis; + } + + public void setShutdownTimeoutMillis(final @Nullable Long shutdownTimeoutMillis) { + this.shutdownTimeoutMillis = shutdownTimeoutMillis; + } + + public @Nullable Long getSessionFlushTimeoutMillis() { + return sessionFlushTimeoutMillis; + } + + public void setSessionFlushTimeoutMillis(final @Nullable Long sessionFlushTimeoutMillis) { + this.sessionFlushTimeoutMillis = sessionFlushTimeoutMillis; + } + public @Nullable List getIgnoredErrors() { return ignoredErrors; } diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 7883ed6b95b..a831a11ea8e 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -3430,6 +3430,12 @@ public void merge(final @NotNull ExternalOptions options) { if (options.getIdleTimeout() != null) { setIdleTimeout(options.getIdleTimeout()); } + if (options.getShutdownTimeoutMillis() != null) { + setShutdownTimeoutMillis(options.getShutdownTimeoutMillis()); + } + if (options.getSessionFlushTimeoutMillis() != null) { + setSessionFlushTimeoutMillis(options.getSessionFlushTimeoutMillis()); + } for (String bundleId : options.getBundleIds()) { addBundleId(bundleId); } diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index 5a8bb1c7872..9612a052624 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -180,6 +180,20 @@ class ExternalOptionsTest { withPropertiesFile("idle-timeout=2000") { assertEquals(2000L, it.idleTimeout) } } + @Test + fun `creates options with shutdownTimeoutMillis using external properties`() { + withPropertiesFile("shutdown-timeout-millis=2000") { + assertEquals(2000L, it.shutdownTimeoutMillis) + } + } + + @Test + fun `creates options with sessionFlushTimeoutMillis using external properties`() { + withPropertiesFile("session-flush-timeout-millis=2000") { + assertEquals(2000L, it.sessionFlushTimeoutMillis) + } + } + @Test fun `creates options with ignored exception types using external properties`() { val logger = mock() diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 2f5b3579cb3..960b2838e2a 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -387,6 +387,8 @@ class SentryOptionsTest { externalOptions.addContextTag("requestId") externalOptions.proguardUuid = "1234" externalOptions.idleTimeout = 1500L + externalOptions.shutdownTimeoutMillis = 1499L + externalOptions.sessionFlushTimeoutMillis = 1498L externalOptions.bundleIds.addAll( listOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411 ", " faa3ab42-b1bd-4659-af8e-1682324aa744") ) @@ -443,6 +445,8 @@ class SentryOptionsTest { assertEquals(listOf("userId", "requestId"), options.contextTags) assertEquals("1234", options.proguardUuid) assertEquals(1500L, options.idleTimeout) + assertEquals(1499L, options.shutdownTimeoutMillis) + assertEquals(1498L, options.sessionFlushTimeoutMillis) assertEquals( setOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411", "faa3ab42-b1bd-4659-af8e-1682324aa744"), options.bundleIds, From a415905783b6670cc29ba45372a87f83591682d2 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Mar 2026 10:51:35 +0100 Subject: [PATCH 032/391] fix(screenshot): Add dontwarn replay rules to sentry-android-core (#5153) * fix(screenshot): Add dontwarn replay rules to sentry-android-core * Changelog * Changelog --- CHANGELOG.md | 6 ++++++ sentry-android-core/proguard-rules.pro | 4 ++++ .../sentry-uitest-android/proguard-rules.pro | 4 ---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 338bbea4457..4da8060b6b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153)) + ## 8.34.0 ### Features diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index 25086b4d2b6..2b49c949db9 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -80,6 +80,10 @@ ##---------------Begin: proguard configuration for sentry-android-replay ---------- -dontwarn io.sentry.android.replay.ReplayIntegration -dontwarn io.sentry.android.replay.DefaultReplayBreadcrumbConverter +-dontwarn io.sentry.android.replay.util.MaskRenderer +-dontwarn io.sentry.android.replay.util.ViewsKt +-dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode$Companion +-dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode -keepnames class io.sentry.android.replay.ReplayIntegration ##---------------End: proguard configuration for sentry-android-replay ---------- diff --git a/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro b/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro index 396c9025eaf..5de2dac4bdb 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro +++ b/sentry-android-integration-tests/sentry-uitest-android/proguard-rules.pro @@ -40,8 +40,4 @@ -dontwarn org.mockito.internal.** -dontwarn org.jetbrains.annotations.** -dontwarn io.sentry.android.replay.ReplayIntegration --dontwarn io.sentry.android.replay.util.MaskRenderer --dontwarn io.sentry.android.replay.util.ViewsKt --dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode$Companion --dontwarn io.sentry.android.replay.viewhierarchy.ViewHierarchyNode -keep class curtains.** { *; } From b8bd8c438a49529e3f4575413b6f474a2a8ee031 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Mar 2026 13:49:19 +0100 Subject: [PATCH 033/391] fix(logging): Use ImmediateExecutorService in logging tests and fix Log4j2 scopes usage (#5158) * fix(logging): Use ImmediateExecutorService in logging tests and fix Log4j2 scopes usage Allow injecting ISentryExecutorService into LoggerBatchProcessor for deterministic test execution. Fix Log4j2 SentryAppender to use scopes instance instead of static Sentry calls for logging. Co-Authored-By: Claude Opus 4.6 * fix(log4j2): Move super.start() into start(OptionsConfiguration) overload Ensures the appender is marked as started regardless of which entry point is used, preventing loggerContext.start() from re-triggering the no-arg start() and reinitializing Sentry without the test executor. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .../kotlin/io/sentry/jul/SentryHandlerTest.kt | 6 +++ .../java/io/sentry/log4j2/SentryAppender.java | 53 +++++++++++-------- .../io/sentry/log4j2/SentryAppenderTest.kt | 12 ++++- .../io/sentry/logback/SentryAppenderTest.kt | 6 +++ sentry/api/sentry.api | 1 + .../sentry/logger/LoggerBatchProcessor.java | 13 ++++- 6 files changed, 68 insertions(+), 23 deletions(-) diff --git a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt index e86f06a4ab7..ab160faac40 100644 --- a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt +++ b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt @@ -7,6 +7,9 @@ import io.sentry.SentryLogLevel import io.sentry.SentryOptions import io.sentry.checkEvent import io.sentry.checkLogs +import io.sentry.logger.ILoggerBatchProcessorFactory +import io.sentry.logger.LoggerBatchProcessor +import io.sentry.test.ImmediateExecutorService import io.sentry.test.applyTestOptions import io.sentry.test.initForTest import io.sentry.transport.ITransport @@ -45,6 +48,9 @@ class SentryHandlerTest { val options = SentryOptions() options.dsn = "http://key@localhost/proj" options.setTransportFactory { _, _ -> transport } + options.logs.loggerBatchProcessorFactory = ILoggerBatchProcessorFactory { options, client -> + LoggerBatchProcessor(options, client, ImmediateExecutorService()) + } applyTestOptions(options) contextTags?.forEach { options.addContextTag(it) } logger = Logger.getLogger("jul.SentryHandlerTest") diff --git a/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java b/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java index 6885cdb81fd..df0f9eeb2d2 100644 --- a/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java +++ b/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java @@ -164,25 +164,37 @@ public SentryAppender( @Override public void start() { + start(getOptionsConfiguration(null)); + } + + @NotNull + Sentry.OptionsConfiguration getOptionsConfiguration( + final @Nullable Sentry.OptionsConfiguration additionalOptionsConfiguration) { + return options -> { + options.setEnableExternalConfiguration(true); + options.setInitPriority(InitPriority.LOWEST); + options.setDsn(dsn); + if (debug != null) { + options.setDebug(debug); + } + options.setSentryClientName( + BuildConfig.SENTRY_LOG4J2_SDK_NAME + "/" + BuildConfig.VERSION_NAME); + options.setSdkVersion(createSdkVersion(options)); + if (contextTags != null) { + for (final String contextTag : contextTags) { + options.addContextTag(contextTag); + } + } + Optional.ofNullable(transportFactory).ifPresent(options::setTransportFactory); + if (additionalOptionsConfiguration != null) { + additionalOptionsConfiguration.configure(options); + } + }; + } + + void start(final @NotNull Sentry.OptionsConfiguration optionsConfiguration) { try { - Sentry.init( - options -> { - options.setEnableExternalConfiguration(true); - options.setInitPriority(InitPriority.LOWEST); - options.setDsn(dsn); - if (debug != null) { - options.setDebug(debug); - } - options.setSentryClientName( - BuildConfig.SENTRY_LOG4J2_SDK_NAME + "/" + BuildConfig.VERSION_NAME); - options.setSdkVersion(createSdkVersion(options)); - if (contextTags != null) { - for (final String contextTag : contextTags) { - options.addContextTag(contextTag); - } - } - Optional.ofNullable(transportFactory).ifPresent(options::setTransportFactory); - }); + Sentry.init(optionsConfiguration); } catch (IllegalArgumentException e) { final @Nullable String errorMessage = e.getMessage(); if (errorMessage == null || !errorMessage.startsWith("DSN is required.")) { @@ -235,14 +247,13 @@ protected void captureLog(@NotNull LogEvent loggingEvent) { } final @NotNull Map contextData = loggingEvent.getContextData().toMap(); - final @NotNull List contextTags = - ScopesAdapter.getInstance().getOptions().getContextTags(); + final @NotNull List contextTags = scopes.getOptions().getContextTags(); LoggerPropertiesUtil.applyPropertiesToAttributes(attributes, contextTags, contextData); final @NotNull SentryLogParameters params = SentryLogParameters.create(attributes); params.setOrigin("auto.log.log4j2"); - Sentry.logger().log(sentryLevel, params, formattedMessage, arguments); + scopes.logger().log(sentryLevel, params, formattedMessage, arguments); } /** diff --git a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt index 9923f81f00f..c32459ea022 100644 --- a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt +++ b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt @@ -8,6 +8,9 @@ import io.sentry.SentryLevel import io.sentry.SentryLogLevel import io.sentry.checkEvent import io.sentry.checkLogs +import io.sentry.logger.ILoggerBatchProcessorFactory +import io.sentry.logger.LoggerBatchProcessor +import io.sentry.test.ImmediateExecutorService import io.sentry.test.initForTest import io.sentry.transport.ITransport import java.time.Instant @@ -93,7 +96,14 @@ class SentryAppenderTest { loggerContext.updateLoggers(config) - appender.start() + appender.start( + appender.getOptionsConfiguration { options -> + options.logs.loggerBatchProcessorFactory = + ILoggerBatchProcessorFactory { options, client -> + LoggerBatchProcessor(options, client, ImmediateExecutorService()) + } + } + ) loggerContext.start() return LogManager.getContext().getLogger(SentryAppenderTest::class.java.name) diff --git a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt index e00d3aed49a..e93d6ef2db1 100644 --- a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt +++ b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt @@ -18,6 +18,9 @@ import io.sentry.SentryLogLevel import io.sentry.SentryOptions import io.sentry.checkEvent import io.sentry.checkLogs +import io.sentry.logger.ILoggerBatchProcessorFactory +import io.sentry.logger.LoggerBatchProcessor +import io.sentry.test.ImmediateExecutorService import io.sentry.test.applyTestOptions import io.sentry.test.initForTest import io.sentry.transport.ITransport @@ -69,6 +72,9 @@ class SentryAppenderTest { options.dsn = dsn options.isSendDefaultPii = sendDefaultPii options.logs.isEnabled = enableLogs + options.logs.loggerBatchProcessorFactory = ILoggerBatchProcessorFactory { options, client -> + LoggerBatchProcessor(options, client, ImmediateExecutorService()) + } applyTestOptions(options) contextTags?.forEach { options.addContextTag(it) } appender.setOptions(options) diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 73eb9c61446..c8b194f32d3 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -5259,6 +5259,7 @@ public class io/sentry/logger/LoggerBatchProcessor : io/sentry/logger/ILoggerBat public static final field MAX_QUEUE_SIZE I protected final field options Lio/sentry/SentryOptions; public fun (Lio/sentry/SentryOptions;Lio/sentry/ISentryClient;)V + public fun (Lio/sentry/SentryOptions;Lio/sentry/ISentryClient;Lio/sentry/ISentryExecutorService;)V public fun add (Lio/sentry/SentryLogEvent;)V public fun close (Z)V public fun flush (J)V diff --git a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java index 1f9b8fe7ce2..81ae5b73c1a 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java @@ -21,8 +21,10 @@ import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; @Open public class LoggerBatchProcessor implements ILoggerBatchProcessor { @@ -44,10 +46,19 @@ public class LoggerBatchProcessor implements ILoggerBatchProcessor { public LoggerBatchProcessor( final @NotNull SentryOptions options, final @NotNull ISentryClient client) { + this(options, client, new SentryExecutorService(options)); + } + + @ApiStatus.Internal + @TestOnly + public LoggerBatchProcessor( + final @NotNull SentryOptions options, + final @NotNull ISentryClient client, + final @NotNull ISentryExecutorService executorService) { this.options = options; this.client = client; this.queue = new ConcurrentLinkedQueue<>(); - this.executorService = new SentryExecutorService(options); + this.executorService = executorService; } @Override From 37a4609a5b7f35067285ca6e4886348a1a48df51 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Mar 2026 14:17:29 +0100 Subject: [PATCH 034/391] chore(ci): Kill BinarySizeTest in favour of Size Analysis status check (#5159) --- sentry-android-integration-tests/metrics-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sentry-android-integration-tests/metrics-test.yml b/sentry-android-integration-tests/metrics-test.yml index 9842063d58b..a73ca1ef7c0 100644 --- a/sentry-android-integration-tests/metrics-test.yml +++ b/sentry-android-integration-tests/metrics-test.yml @@ -10,7 +10,3 @@ startupTimeTest: runs: 50 diffMin: 0 diffMax: 150 - -binarySizeTest: - diffMin: 600 KiB - diffMax: 850 KiB From 872b0841f71a53269afd906cf7b61a450c004dd2 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Mar 2026 14:34:25 +0100 Subject: [PATCH 035/391] fix(sessions): Finalize previous session even when auto session tracking is disabled (#5154) * fix(core): Finalize previous session even when auto session tracking is disabled The `isEnableAutoSessionTracking` guard in `PreviousSessionFinalizer`, `MovePreviousSession`, and `InternalSentrySdk.deleteCurrentSessionFile` prevented finalization of manually started sessions (via `Sentry.startSession()`). The flag controls *automatic* session lifecycle, not whether sessions exist at all. Manual sessions write the same files to disk and need the same finalization. Fixes #5108 Co-Authored-By: Claude Opus 4.6 * formatting * changelog: Add entry for #5154 Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 1 + .../sentry/android/core/InternalSentrySdk.java | 8 -------- .../java/io/sentry/MovePreviousSession.java | 8 -------- .../io/sentry/PreviousSessionFinalizer.java | 7 ------- .../java/io/sentry/MovePreviousSessionTest.kt | 16 ++++++++++++---- .../io/sentry/PreviousSessionFinalizerTest.kt | 17 +++-------------- 6 files changed, 16 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da8060b6b2..6e6820a9a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Common: Finalize previous session even when auto session tracking is disabled ([#5154](https://github.com/getsentry/sentry-java/pull/5154)) - Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153)) ## 8.34.0 diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java index cae558f0d43..2779f803a69 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java @@ -1,7 +1,6 @@ package io.sentry.android.core; import static io.sentry.Sentry.getCurrentScopes; -import static io.sentry.SentryLevel.DEBUG; import static io.sentry.SentryLevel.INFO; import static io.sentry.SentryLevel.WARNING; @@ -291,13 +290,6 @@ private static void deleteCurrentSessionFile(final @NotNull SentryOptions option return; } - if (!options.isEnableAutoSessionTracking()) { - options - .getLogger() - .log(DEBUG, "Session tracking is disabled, bailing from deleting current session file."); - return; - } - final File sessionFile = EnvelopeCache.getCurrentSessionFile(cacheDirPath); if (!sessionFile.delete()) { options.getLogger().log(WARNING, "Failed to delete the current session file."); diff --git a/sentry/src/main/java/io/sentry/MovePreviousSession.java b/sentry/src/main/java/io/sentry/MovePreviousSession.java index 99b92d92653..6b7de16d81a 100644 --- a/sentry/src/main/java/io/sentry/MovePreviousSession.java +++ b/sentry/src/main/java/io/sentry/MovePreviousSession.java @@ -1,6 +1,5 @@ package io.sentry; -import static io.sentry.SentryLevel.DEBUG; import static io.sentry.SentryLevel.INFO; import io.sentry.cache.EnvelopeCache; @@ -24,13 +23,6 @@ public void run() { return; } - if (!options.isEnableAutoSessionTracking()) { - options - .getLogger() - .log(DEBUG, "Session tracking is disabled, bailing from previous session mover."); - return; - } - final IEnvelopeCache cache = options.getEnvelopeDiskCache(); if (cache instanceof EnvelopeCache) { final File currentSessionFile = EnvelopeCache.getCurrentSessionFile(cacheDirPath); diff --git a/sentry/src/main/java/io/sentry/PreviousSessionFinalizer.java b/sentry/src/main/java/io/sentry/PreviousSessionFinalizer.java index 46e0c258507..4e3b2e9b3d2 100644 --- a/sentry/src/main/java/io/sentry/PreviousSessionFinalizer.java +++ b/sentry/src/main/java/io/sentry/PreviousSessionFinalizer.java @@ -48,13 +48,6 @@ public void run() { return; } - if (!options.isEnableAutoSessionTracking()) { - options - .getLogger() - .log(DEBUG, "Session tracking is disabled, bailing from previous session finalizer."); - return; - } - final IEnvelopeCache cache = options.getEnvelopeDiskCache(); if (cache instanceof EnvelopeCache) { if (!((EnvelopeCache) cache).waitPreviousSessionFlush()) { diff --git a/sentry/src/test/java/io/sentry/MovePreviousSessionTest.kt b/sentry/src/test/java/io/sentry/MovePreviousSessionTest.kt index 0c361c3efe8..f14cbd6d016 100644 --- a/sentry/src/test/java/io/sentry/MovePreviousSessionTest.kt +++ b/sentry/src/test/java/io/sentry/MovePreviousSessionTest.kt @@ -65,13 +65,21 @@ class MovePreviousSessionTest { } @Test - fun `when session tracking is disabled, logs and returns early`() { - val sut = fixture.getSUT(isEnableSessionTracking = false, envelopeCache = fixture.cache) + fun `when session tracking is disabled, still moves previous session`() { + val sut = fixture.getSUT(isEnableSessionTracking = false) + + val currentSessionFile = EnvelopeCache.getCurrentSessionFile(fixture.options.cacheDirPath!!) + val previousSessionFile = EnvelopeCache.getPreviousSessionFile(fixture.options.cacheDirPath!!) + + currentSessionFile.createNewFile() + currentSessionFile.writeText("session content") sut.run() - verify(fixture.cache, never()).movePreviousSession(any(), any()) - verify(fixture.cache, never()).flushPreviousSession() + (fixture.options.envelopeDiskCache as EnvelopeCache).waitPreviousSessionFlush() + + assertFalse(currentSessionFile.exists()) + assertTrue(previousSessionFile.exists()) } @Test diff --git a/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt b/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt index 7a205d6d51d..4b433ffb3e1 100644 --- a/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt +++ b/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt @@ -210,27 +210,16 @@ class PreviousSessionFinalizerTest { } @Test - fun `if session tracking is disabled, does not wait for previous session flush`() { + fun `if session tracking is disabled, still finalizes previous session`() { val finalizer = fixture.getSut( tmpDir, - flushTimeoutMillis = 500L, + session = Session(null, null, null, "io.sentry.sample@1.0"), sessionTrackingEnabled = false, - shouldAwait = true, ) finalizer.run() - verify(fixture.logger, never()) - .log( - any(), - argThat { - startsWith( - "Timed out waiting to flush previous session to its own file in session finalizer." - ) - }, - any(), - ) - verify(fixture.scopes, never()).captureEnvelope(any()) + verify(fixture.scopes).captureEnvelope(any()) } @Test From 72727477f675aa090fec61bd8a5748fffebfc8b6 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 5 Mar 2026 15:15:47 +0100 Subject: [PATCH 036/391] chore: Add stacked PR support to create-java-pr skill and PR rules (#5151) * chore: Add stacked PR support to create-java-pr skill and PR rules Co-Authored-By: Claude Opus 4.6 * fix: Use --body-file to avoid shell quoting issues in PR body edits Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .claude/skills/create-java-pr/SKILL.md | 61 +++++++++++++++++++--- .cursor/rules/pr.mdc | 71 +++++++++++++++++--------- 2 files changed, 102 insertions(+), 30 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 7dcb5ea47c3..b0fc12a5d2e 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -1,12 +1,24 @@ --- name: create-java-pr -description: Create a pull request in sentry-java. Use when asked to "create pr", "prepare pr", "prep pr", "open pr", "ready for pr", "prepare for review", "finalize changes". Handles branch creation, code formatting, API dump, committing, pushing, PR creation, and changelog. +description: Create a pull request in sentry-java. Use when asked to "create pr", "prepare pr", "prep pr", "open pr", "ready for pr", "prepare for review", "finalize changes". Handles branch creation, code formatting, API dump, committing, pushing, PR creation, changelog, and stacked PRs. --- # Create Pull Request (sentry-java) Prepare local changes and create a pull request for the sentry-java repo. +**Required reading:** Before proceeding, read `.cursor/rules/pr.mdc` for the full PR and stacked PR workflow details. That file is the source of truth for PR conventions, stack comment format, branch naming, and merge strategy. + +## Step 0: Determine PR Type + +Ask the user (or infer from context) whether this is: + +- **Standalone PR** — a regular PR targeting `main`. Follow Steps 1–6 as written. +- **First PR of a new stack** — ask for a topic name (e.g. "Global Attributes"). Create a collection branch from `main`, then branch the first PR off it. The first PR targets the collection branch. +- **Next PR in an existing stack** — identify the previous stack branch and topic. This PR targets the previous stack branch. + +If the user mentions "stack", "stacked PR", or provides a topic name with a number (e.g. `[Topic 2]`), treat it as a stacked PR. See `.cursor/rules/pr.mdc` § "Stacked PRs" for full details. + ## Step 1: Ensure Feature Branch ```bash @@ -21,6 +33,8 @@ git checkout -b / Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, etc. matching the commit type conventions. +**For stacked PRs:** For the first PR in a new stack, first create and push the collection branch (see `.cursor/rules/pr.mdc` § "Creating the Collection Branch"), then branch the PR off it. For subsequent PRs, branch off the previous stack branch. Use the naming conventions from `.cursor/rules/pr.mdc` § "Branch Naming". + ## Step 2: Format Code and Regenerate API Files ```bash @@ -92,13 +106,38 @@ Invoke the `sentry-skills:create-pr` skill to create a draft PR. When providing Fill in each section based on the changes being PR'd. Check any checklist items that apply. -Then continue to Step 6. +**For stacked PRs:** + +- Pass `--base ` so the PR targets the previous branch (first PR in a stack targets the collection branch). +- Use the stacked PR title format: `(): [ ] ` (see `.cursor/rules/pr.mdc` § "PR Title Naming"). +- Include the stack list at the top of the PR body, before the `## :scroll: Description` section (see `.cursor/rules/pr.mdc` § "Stack List in PR Description" for the format). + +Then continue to Step 5.5 (stacked PRs only) or Step 6. + +## Step 5.5: Update Stack List on All PRs (stacked PRs only) + +Skip this step for standalone PRs. + +After creating the PR, update the PR description on **every other PR in the stack** so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". ## Step 6: Update Changelog -After the PR is created, add an entry to `CHANGELOG.md` under the `## Unreleased` section. +First, determine whether a changelog entry is needed. **Skip this step** (and go straight to "No changelog needed" below) if the changes are not user-facing, for example: + +- Test-only changes (new tests, test refactors, test fixtures) +- CI/CD or build configuration changes +- Documentation-only changes +- Code comments or formatting-only changes +- Internal refactors with no behavior change visible to SDK users +- Sample app changes + +If unsure, ask the user. + +### If changelog is needed + +Add an entry to `CHANGELOG.md` under the `## Unreleased` section. -### Determine the subsection +#### Determine the subsection | Change Type | Subsection | |---|---| @@ -109,7 +148,7 @@ After the PR is created, add an entry to `CHANGELOG.md` under the `## Unreleased Create the subsection under `## Unreleased` if it does not already exist. -### Entry format +#### Entry format ```markdown - ([#](https://github.com/getsentry/sentry-java/pull/)) @@ -117,7 +156,7 @@ Create the subsection under `## Unreleased` if it does not already exist. Use the PR number returned by `sentry-skills:create-pr`. Match the style of existing entries — sentence case, ending with the PR link, no trailing period. -### Commit and push +#### Commit and push Stage `CHANGELOG.md`, commit with message `changelog`, and push: @@ -126,3 +165,13 @@ git add CHANGELOG.md git commit -m "changelog" git push ``` + +### No changelog needed + +If no changelog entry is needed, add `#skip-changelog` to the PR description to disable the changelog CI check: + +```bash +gh pr view --json body --jq '.body' > /tmp/pr-body.md +printf '\n#skip-changelog\n' >> /tmp/pr-body.md +gh pr edit --body-file /tmp/pr-body.md +``` diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index 581c8cc95d5..3b8f73194b1 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -120,21 +120,25 @@ Stacked PRs split a large feature into small, easy-to-review PRs where each buil ### Structure ``` -main → stack-pr-1 → stack-pr-2 → stack-pr-3 → ... +main ← collection-branch ← stack-pr-1 ← stack-pr-2 ← stack-pr-3 ← ... ``` -- The first PR in the stack targets `main` as its base branch. +- A **collection branch** is created from `main` and targets `main`. It serves as the base for the entire stack. +- The first PR in the stack targets the collection branch (not `main`). - Each subsequent PR targets the previous stack PR's branch as its base. - Each PR contains only incremental changes on top of the previous one. +The collection branch exists so that individual stack PRs can be **merge-committed** (not squashed). PRs targeting `main` use squash merging, but that causes repeated merge conflicts when syncing the stack. Merge commits on non-`main` branches avoid this. The collection branch itself is squash-merged into `main` at the end. + ### Branch Naming -Prefer a shared prefix for the feature, with descriptive suffixes per PR. The type prefix (`feat/`, `fix/`, etc.) may vary depending on the nature of each PR's changes: +Prefer a shared prefix for the feature, with descriptive suffixes per PR. The collection branch uses the shared prefix. The type prefix (`feat/`, `fix/`, etc.) may vary depending on the nature of each PR's changes: ``` -feat/scope-attributes # PR 1 -feat/scope-attributes-logger # PR 2 -fix/attribute-type-detection # PR 3 (fix, different name — that's fine) +feat/scope-attributes # collection branch → targets main +feat/scope-attributes-api # PR 1 → targets collection branch +feat/scope-attributes-logger # PR 2 → targets PR 1 +fix/attribute-type-detection # PR 3 (fix, different name — that's fine) → targets PR 2 ``` ### PR Title Naming @@ -158,8 +162,8 @@ Do **not** rely on branch name patterns — later PRs in a stack may use differe ```bash gh pr list --head "$(git branch --show-current)" --json number,title,baseRefName --jq '.[0]' ``` -2. Read the stack comment on that PR — it lists every PR in the stack. -3. If there is no stack comment yet, walk the chain in both directions: +2. Read the PR description — the stack list is at the top of the body. +3. If there is no stack list yet, walk the chain in both directions: ```bash # Find the PR whose head branch is the current PR's base (go up) gh pr list --head --json number,title,baseRefName @@ -167,21 +171,33 @@ Do **not** rely on branch name patterns — later PRs in a stack may use differe # Find PRs whose base branch is the current PR's head (go down) gh pr list --base --json number,title,headRefName ``` - Repeat until you reach `main` going up and find no more PRs going down. + Repeat until you reach the collection branch going up and find no more PRs going down. + +### Creating the Collection Branch + +Before the first stacked PR, create the collection branch with an empty commit (so GitHub allows opening a PR) and create the collection PR: + +```bash +git checkout main +git checkout -b feat/ +git commit --allow-empty -m "collection: " +git push -u origin HEAD +gh pr create --base main --draft --title "(): " --body "Collection PR for the stack. Squash-merge this once all stack PRs are merged." +``` ### Creating a New Stacked PR -1. Start from the tip of the previous stack branch (or `main` for the first PR). +1. Start from the tip of the previous stack branch (or the collection branch for the first PR). 2. Create a new branch, make changes, format, commit, and push. -3. Create the PR with `--base `: +3. Create the PR with `--base ` (the collection branch for the first PR): ```bash gh pr create --base feat/previous-branch --draft --title "(): [ ] " --body "..." ``` -4. Add the stack comment to the new PR and update it on all existing PRs in the stack (see below). +4. Add the stack list to the top of the new PR's description and update it on all existing PRs in the stack (see below). -### Stack Comment +### Stack List in PR Description -Every PR in the stack must have a comment listing all PRs in the stack. When a new PR is added, update the comment on **all** PRs in the stack. +Every PR in the stack must have a stack list **at the top of its description** (before the `## :scroll: Description` section). When a new PR is added, update the description on **all** PRs in the stack. Format: @@ -191,26 +207,33 @@ Format: - [#5118](https://github.com/getsentry/sentry-java/pull/5118) — Add scope-level attributes API - [#5120](https://github.com/getsentry/sentry-java/pull/5120) — Wire scope attributes into LoggerApi and MetricsApi - [#5121](https://github.com/getsentry/sentry-java/pull/5121) — Showcase scope attributes in Spring Boot 4 samples + +--- ``` -No status column — GitHub already shows that. +No status column — GitHub already shows that. The `---` separates the stack list from the rest of the PR description. -To add or update the stack comment on a PR: +To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body: ```bash -# Find existing stack comment (if any) -gh api repos/getsentry/sentry-java/issues//comments --jq '.[] | select(.body | startswith("## PR Stack")) | .id' +# Get current PR description into a temp file +gh pr view --json body --jq '.body' > /tmp/pr-body.md -# Create new comment -gh pr comment --body "" +# Edit /tmp/pr-body.md to prepend or replace the stack list section +# (replace everything from "## PR Stack" up to and including the "---" separator, +# or prepend before the existing description if no stack list exists yet) -# Or update existing comment -gh api repos/getsentry/sentry-java/issues/comments/ -X PATCH -f body="" +# Update the description +gh pr edit --body-file /tmp/pr-body.md ``` -### Merging Stacked PRs +### Merging Stacked PRs (done by the user, not the agent) + +Individual stack PRs are merged in order from bottom to top (PR 1 first, then PR 2, etc.) using **merge commits** (not squash). After each merge, the next PR's base automatically becomes the merged branch's target. GitHub handles rebasing onto the new base. + +Once all stack PRs are merged into the collection branch, the collection PR is **squash-merged** into `main`. This gives `main` a clean single commit for the entire feature. -Merge in order from bottom to top (PR 1 first, then PR 2, etc.). After each merge, the next PR's base automatically becomes the merged branch's target. GitHub handles rebasing onto the new base. Verify each PR's diff still looks correct after the previous one merges. +**Do not merge PRs.** Only the user merges PRs. ### Syncing the Stack From 20ec62ae22edbbcdbb4aa67cccde8368704a63cb Mon Sep 17 00:00:00 2001 From: Abhishek Singh <45100807+abhishek-900@users.noreply.github.com> Date: Thu, 5 Mar 2026 20:35:02 +0530 Subject: [PATCH 037/391] fix(android): Add filterTouchesWhenObscured to prevent Tapjacking (#5155) * fix(android): Add filterTouchesWhenObscured to prevent Tapjacking Adds filterTouchesWhenObscured="true" to the user feedback dialog to prevent overlay/tapjacking attack ( CWE-1021) * Changelog --------- Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 1 + .../src/main/res/layout/sentry_dialog_user_feedback.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6820a9a43..583151c1faa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - Common: Finalize previous session even when auto session tracking is disabled ([#5154](https://github.com/getsentry/sentry-java/pull/5154)) +- Android: Add `filterTouchesWhenObscured` to prevent Tapjacking on user feedback dialog ([#5155](https://github.com/getsentry/sentry-java/pull/5155)) - Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153)) ## 8.34.0 diff --git a/sentry-android-core/src/main/res/layout/sentry_dialog_user_feedback.xml b/sentry-android-core/src/main/res/layout/sentry_dialog_user_feedback.xml index e6f77b90a7f..722a0d5cf3d 100644 --- a/sentry-android-core/src/main/res/layout/sentry_dialog_user_feedback.xml +++ b/sentry-android-core/src/main/res/layout/sentry_dialog_user_feedback.xml @@ -4,6 +4,7 @@ android:id="@+id/sentry_dialog_user_feedback_layout" android:layout_width="match_parent" android:layout_height="match_parent" + android:filterTouchesWhenObscured="true" tools:ignore="HardcodedText,RtlHardcoded" android:theme="?android:attr/dialogTheme" android:padding="24dp"> From f063350b14bb573ff877263215731686481e30c6 Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:06:09 +0000 Subject: [PATCH 038/391] release: 8.34.1 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 583151c1faa..e032293263e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.34.1 ### Fixes diff --git a/gradle.properties b/gradle.properties index 9c919a6bde2..db7fab6765c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.34.0 +versionName=8.34.1 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From d501a7eb9c9ddbb1bc297984c6d7b7aaef1b2359 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Fri, 6 Mar 2026 11:19:23 +0100 Subject: [PATCH 039/391] feat(anr): Profile main thread when ANR and report ANR profiles to Sentry (#4899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Profile main thread when ANR and report ANR profiles to sentry * docs(changelog): Add ANR profiling integration entry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * Fix api dump file * Address PR feedback * refactor(anr): Implement lazy file rotation for ANR profiling * Update Changelog * Address PR feedback * Improve folding logic, cleanup tests * Add more tests and address feedback * Update CHANGELOG.md * Address PR feedcback * Move logic to event processor * Update changelog * Ensure integration is tracked * Address PR feedback * Fix tests * Match manifest property to convention, enable profiling in sample app * Add more bound checks and null guards * Remove outdated meta-data * Properly handle foreground transitions * Address PR comments * Address PR feedback * Address PR feedback * Address PR feedback * Re-use thread * Update Changelop * Address review * Address PR feedback * Replace ANR profiling boolean flag with sample-rate (#5156) * feat(android): Add enableAnrFingerprinting option (#5168) * feat(android): Add enableAnrFingerprinting option Decouple ANR fingerprinting from ANR profiling into a standalone opt-in option. This allows static fingerprinting of system-frame-only ANRs regardless of whether profiling is enabled. Co-Authored-By: Claude Opus 4.6 * feat(android): Mark enableAnrFingerprinting as experimental Also enable the option in the sample app. Co-Authored-By: Claude Opus 4.6 * feat(android): Default enableAnrFingerprinting to true Co-Authored-By: Claude Opus 4.6 * refactor(android): Remove experimental flag from enableAnrFingerprinting Co-Authored-By: Claude Opus 4.6 * Fix api dump * Address PR feedback --------- Co-authored-by: Claude Opus 4.6 * Fix tests --------- Co-authored-by: Claude Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 10 +- .../api/sentry-android-core.api | 78 +++++ .../core/AndroidOptionsInitializer.java | 6 + .../sentry/android/core/AnrIntegration.java | 11 +- .../ApplicationExitInfoEventProcessor.java | 175 +++++++++- .../core/ApplicationNotResponding.java | 9 +- .../android/core/ManifestMetadataReader.java | 16 + .../android/core/SentryAndroidOptions.java | 46 +++ .../core/anr/AggregatedStackTrace.java | 56 ++++ .../core/anr/AnrCulpritIdentifier.java | 165 +++++++++ .../sentry/android/core/anr/AnrProfile.java | 35 ++ .../android/core/anr/AnrProfileManager.java | 103 ++++++ .../core/anr/AnrProfileRotationHelper.java | 73 ++++ .../core/anr/AnrProfilingIntegration.java | 308 +++++++++++++++++ .../android/core/anr/AnrStackTrace.java | 79 +++++ .../android/core/anr/StackTraceConverter.java | 150 +++++++++ .../io/sentry/android/core/ANRWatchDogTest.kt | 8 +- .../android/core/AnrV2IntegrationTest.kt | 29 ++ .../ApplicationExitInfoEventProcessorTest.kt | 218 +++++++++++- .../ApplicationExitIntegrationTestBase.kt | 1 + .../core/ManifestMetadataReaderTest.kt | 50 +++ .../android/core/SentryAndroidOptionsTest.kt | 38 +++ .../sentry/android/core/SentryAndroidTest.kt | 4 +- .../core/anr/AnrCulpritIdentifierTest.kt | 167 ++++++++++ .../android/core/anr/AnrProfileManagerTest.kt | 137 ++++++++ .../core/anr/AnrProfileRotationHelperTest.kt | 113 +++++++ .../core/anr/AnrProfilingIntegrationTest.kt | 313 ++++++++++++++++++ .../core/anr/AnrStackTraceConverterTest.kt | 197 +++++++++++ .../android/core/anr/AnrStackTraceTest.kt | 127 +++++++ .../distribution/UpdateResponseParserTest.kt | 4 +- .../src/main/AndroidManifest.xml | 8 +- sentry/api/sentry.api | 1 + .../src/main/java/io/sentry/ProfileChunk.java | 8 +- .../java/io/sentry/SentryEnvelopeItem.java | 64 ++-- .../io/sentry/SentryExceptionFactory.java | 4 +- .../ExceptionMechanismException.java | 11 +- .../main/java/io/sentry/util/StringUtils.java | 8 + 37 files changed, 2772 insertions(+), 58 deletions(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AggregatedStackTrace.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrCulpritIdentifier.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfile.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileManager.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileRotationHelper.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrStackTrace.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/anr/StackTraceConverter.java create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrCulpritIdentifierTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileManagerTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileRotationHelperTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceConverterTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index e032293263e..503d58a4eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,14 @@ ``` - The `ManifestMetaDataReader` now read the `DIST` ([#5107](https://github.com/getsentry/sentry-java/pull/5107)) +- Add new experimental option to capture profiles for ANRs ([#4899](https://github.com/getsentry/sentry-java/pull/4899)) + - This feature will capture a stack profile of the main thread when it gets unresponsive + - The profile gets attached to the ANR event on the next app start, providing a flamegraph of the ANR issue on the sentry issue details page + - Enable via `options.setAnrProfilingSampleRate()` or AndroidManifest.xml: `` + - The sample rate controls the probability of collecting a profile for each detected foreground ANR (0.0 to 1.0, null to disable) +- Add `enableAnrFingerprinting` option to reduce ANR noise by assigning static fingerprints to ANR events with system-only stacktraces + - When enabled, ANRs whose stacktraces contain only system frames (e.g. `java.lang` or `android.os`) are grouped into a single issue instead of creating many separate issues + - Enable via `options.setEnableAnrFingerprinting(true)` or AndroidManifest.xml: `` ### Fixes @@ -180,7 +188,7 @@ - Discard envelopes on `4xx` and `5xx` response ([#4950](https://github.com/getsentry/sentry-java/pull/4950)) - This aims to not overwhelm Sentry after an outage or load shedding (including HTTP 429) where too many events are sent at once -### Feature +### Features - Add a Tombstone integration that detects native crashes without relying on the NDK integration, but instead using `ApplicationExitInfo.REASON_CRASH_NATIVE` on Android 12+. ([#4933](https://github.com/getsentry/sentry-java/pull/4933)) - Currently exposed via options as an _internal_ API only. diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 7e64d0bcf80..4e7e7b4c5c2 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -347,6 +347,7 @@ public final class io/sentry/android/core/SentryAndroidDateProvider : io/sentry/ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/SentryOptions { public fun ()V public fun enableAllAutoBreadcrumbs (Z)V + public fun getAnrProfilingSampleRate ()Ljava/lang/Double; public fun getAnrTimeoutIntervalMillis ()J public fun getBeforeScreenshotCaptureCallback ()Lio/sentry/android/core/SentryAndroidOptions$BeforeCaptureCallback; public fun getBeforeViewHierarchyCaptureCallback ()Lio/sentry/android/core/SentryAndroidOptions$BeforeCaptureCallback; @@ -357,6 +358,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun getScreenshot ()Lio/sentry/android/core/SentryScreenshotOptions; public fun getStartupCrashDurationThresholdMillis ()J public fun isAnrEnabled ()Z + public fun isAnrProfilingEnabled ()Z public fun isAnrReportInDebug ()Z public fun isAttachAnrThreadDump ()Z public fun isAttachScreenshot ()Z @@ -365,6 +367,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun isCollectExternalStorageContext ()Z public fun isEnableActivityLifecycleBreadcrumbs ()Z public fun isEnableActivityLifecycleTracingAutoFinish ()Z + public fun isEnableAnrFingerprinting ()Z public fun isEnableAppComponentBreadcrumbs ()Z public fun isEnableAppLifecycleBreadcrumbs ()Z public fun isEnableAutoActivityLifecycleTracing ()Z @@ -381,6 +384,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun isReportHistoricalTombstones ()Z public fun isTombstoneEnabled ()Z public fun setAnrEnabled (Z)V + public fun setAnrProfilingSampleRate (Ljava/lang/Double;)V public fun setAnrReportInDebug (Z)V public fun setAnrTimeoutIntervalMillis (J)V public fun setAttachAnrThreadDump (Z)V @@ -393,6 +397,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun setDebugImagesLoader (Lio/sentry/android/core/IDebugImagesLoader;)V public fun setEnableActivityLifecycleBreadcrumbs (Z)V public fun setEnableActivityLifecycleTracingAutoFinish (Z)V + public fun setEnableAnrFingerprinting (Z)V public fun setEnableAppComponentBreadcrumbs (Z)V public fun setEnableAppLifecycleBreadcrumbs (Z)V public fun setEnableAutoActivityLifecycleTracing (Z)V @@ -553,6 +558,79 @@ public final class io/sentry/android/core/ViewHierarchyEventProcessor : io/sentr public static fun snapshotViewHierarchyAsData (Landroid/app/Activity;Lio/sentry/util/thread/IThreadChecker;Lio/sentry/ISerializer;Lio/sentry/ILogger;)[B } +public class io/sentry/android/core/anr/AggregatedStackTrace { + public fun ([Ljava/lang/StackTraceElement;IIJF)V + public fun addOccurrence (J)V + public fun getStack ()[Ljava/lang/StackTraceElement; +} + +public class io/sentry/android/core/anr/AnrCulpritIdentifier { + public fun ()V + public static fun identify (Ljava/util/List;)Lio/sentry/android/core/anr/AggregatedStackTrace; + public static fun isSystemFrame (Ljava/lang/String;)Z +} + +public class io/sentry/android/core/anr/AnrProfile { + public final field endTimeMs J + public final field stacks Ljava/util/List; + public final field startTimeMs J + public fun (Ljava/util/List;)V +} + +public class io/sentry/android/core/anr/AnrProfileManager : java/lang/AutoCloseable { + public fun (Lio/sentry/SentryOptions;)V + public fun (Lio/sentry/SentryOptions;Ljava/io/File;)V + public fun add (Lio/sentry/android/core/anr/AnrStackTrace;)V + public fun clear ()V + public fun close ()V + public fun load ()Lio/sentry/android/core/anr/AnrProfile; +} + +public class io/sentry/android/core/anr/AnrProfileRotationHelper { + public fun ()V + public static fun deleteLastFile (Ljava/io/File;)Z + public static fun getFileForRecording (Ljava/io/File;)Ljava/io/File; + public static fun getLastFile (Ljava/io/File;)Ljava/io/File; + public static fun rotate ()V +} + +public class io/sentry/android/core/anr/AnrProfilingIntegration : io/sentry/Integration, io/sentry/android/core/AppState$AppStateListener, java/io/Closeable, java/lang/Runnable { + public static final field POLLING_INTERVAL_MS J + public static final field THRESHOLD_ANR_MS J + public fun ()V + protected fun checkMainThread (Ljava/lang/Thread;)V + public fun close ()V + protected fun getProfileManager ()Lio/sentry/android/core/anr/AnrProfileManager; + protected fun getState ()Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; + public fun onBackground ()V + public fun onForeground ()V + public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V + public fun run ()V +} + +protected final class io/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState : java/lang/Enum { + public static final field ANR_DETECTED Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; + public static final field IDLE Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; + public static final field SUSPICIOUS Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; + public static fun valueOf (Ljava/lang/String;)Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; + public static fun values ()[Lio/sentry/android/core/anr/AnrProfilingIntegration$MainThreadState; +} + +public final class io/sentry/android/core/anr/AnrStackTrace : java/lang/Comparable { + public final field stack [Ljava/lang/StackTraceElement; + public final field timestampMs J + public fun (J[Ljava/lang/StackTraceElement;)V + public fun compareTo (Lio/sentry/android/core/anr/AnrStackTrace;)I + public synthetic fun compareTo (Ljava/lang/Object;)I + public static fun deserialize (Ljava/io/DataInputStream;)Lio/sentry/android/core/anr/AnrStackTrace; + public fun serialize (Ljava/io/DataOutputStream;)V +} + +public final class io/sentry/android/core/anr/StackTraceConverter { + public fun ()V + public static fun convert (Lio/sentry/android/core/anr/AnrProfile;)Lio/sentry/protocol/profiling/SentryProfile; +} + public final class io/sentry/android/core/cache/AndroidEnvelopeCache : io/sentry/cache/EnvelopeCache { public static final field LAST_ANR_MARKER_LABEL Ljava/lang/String; public static final field LAST_ANR_REPORT Ljava/lang/String; diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index a189b30d07b..f83960a3e6b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -26,6 +26,8 @@ import io.sentry.SendFireAndForgetOutboxSender; import io.sentry.SentryLevel; import io.sentry.SentryOpenTelemetryMode; +import io.sentry.android.core.anr.AnrProfileRotationHelper; +import io.sentry.android.core.anr.AnrProfilingIntegration; import io.sentry.android.core.cache.AndroidEnvelopeCache; import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader; import io.sentry.android.core.internal.gestures.AndroidViewGestureTargetLocator; @@ -135,6 +137,8 @@ static void loadDefaultAndMetadataOptions( options.setCacheDirPath(getCacheDir(finalContext).getAbsolutePath()); + AnrProfileRotationHelper.rotate(); + readDefaultOptionValues(options, finalContext, buildInfoProvider); AppState.getInstance().registerLifecycleObserver(options); options.activate(); @@ -397,6 +401,8 @@ static void installDefaultIntegrations( // it to set the replayId in case of an ANR options.addIntegration(AnrIntegrationFactory.create(context, buildInfoProvider)); + options.addIntegration(new AnrProfilingIntegration()); + // registerActivityLifecycleCallbacks is only available if Context is an AppContext if (context instanceof Application) { options.addIntegration( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java index 8243493a50b..f37d433d308 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java @@ -139,11 +139,18 @@ void reportANR( message = "Background " + message; } - final ApplicationNotResponding error = new ApplicationNotResponding(message, anr.getThread()); + final @Nullable Thread thread = anr.getThread(); + final @NotNull ApplicationNotResponding error; + if (thread == null) { + error = new ApplicationNotResponding(message); + } else { + error = new ApplicationNotResponding(message, thread); + } + final Mechanism mechanism = new Mechanism(); mechanism.setType("ANR"); - return new ExceptionMechanismException(mechanism, error, error.getThread(), true); + return new ExceptionMechanismException(mechanism, error, thread, true); } @TestOnly diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java index 58d0a5a59d7..2eca0e68b5b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java @@ -29,6 +29,9 @@ import io.sentry.Breadcrumb; import io.sentry.Hint; import io.sentry.IpAddressUtils; +import io.sentry.ProfileChunk; +import io.sentry.ProfileContext; +import io.sentry.Sentry; import io.sentry.SentryBaseEvent; import io.sentry.SentryEvent; import io.sentry.SentryExceptionFactory; @@ -36,9 +39,16 @@ import io.sentry.SentryOptions; import io.sentry.SentryStackTraceFactory; import io.sentry.SpanContext; +import io.sentry.android.core.anr.AggregatedStackTrace; +import io.sentry.android.core.anr.AnrCulpritIdentifier; +import io.sentry.android.core.anr.AnrProfile; +import io.sentry.android.core.anr.AnrProfileManager; +import io.sentry.android.core.anr.AnrProfileRotationHelper; +import io.sentry.android.core.anr.StackTraceConverter; import io.sentry.android.core.internal.util.CpuInfoUtils; import io.sentry.cache.PersistingOptionsObserver; import io.sentry.cache.PersistingScopeObserver; +import io.sentry.exception.ExceptionMechanismException; import io.sentry.hints.AbnormalExit; import io.sentry.hints.Backfillable; import io.sentry.protocol.App; @@ -50,10 +60,14 @@ import io.sentry.protocol.OperatingSystem; import io.sentry.protocol.Request; import io.sentry.protocol.SdkVersion; +import io.sentry.protocol.SentryException; +import io.sentry.protocol.SentryId; +import io.sentry.protocol.SentryStackFrame; import io.sentry.protocol.SentryStackTrace; import io.sentry.protocol.SentryThread; import io.sentry.protocol.SentryTransaction; import io.sentry.protocol.User; +import io.sentry.protocol.profiling.SentryProfile; import io.sentry.util.HintUtils; import io.sentry.util.SentryRandom; import java.io.File; @@ -700,8 +714,15 @@ public void applyPreEnrichment( public void applyPostEnrichment( @NotNull SentryEvent event, @NotNull Backfillable hint, @NotNull Object rawHint) { final boolean isBackgroundAnr = isBackgroundAnr(rawHint); - setAppForeground(event, !isBackgroundAnr); + + if (options.isAnrProfilingEnabled()) { + applyAnrProfile(event, hint, isBackgroundAnr); + } + setDefaultAnrFingerprint(event, isBackgroundAnr); + + // Set app foreground state + setAppForeground(event, !isBackgroundAnr); } private void setDefaultAnrFingerprint( @@ -709,7 +730,17 @@ private void setDefaultAnrFingerprint( // sentry does not yet have a capability to provide default server-side fingerprint rules, // so we're doing this on the SDK side to group background and foreground ANRs separately // even if they have similar stacktraces. - if (event.getFingerprints() == null) { + if (event.getFingerprints() != null) { + return; + } + + if (options.isEnableAnrFingerprinting() && hasOnlySystemFrames(event)) { + // If the stacktrace only contains system frames, we want to statically group these events + // to avoid ANR noise due to {{ default }} stacktrace grouping + event.setFingerprints( + Arrays.asList( + "system-frames-only-anr", isBackgroundAnr ? "background-anr" : "foreground-anr")); + } else { event.setFingerprints( Arrays.asList("{{ default }}", isBackgroundAnr ? "background-anr" : "foreground-anr")); } @@ -777,5 +808,145 @@ private void setAnrExceptions( event.setExceptions( sentryExceptionFactory.getSentryExceptionsFromThread(mainThread, mechanism, anr)); } + + private void applyAnrProfile( + @NotNull SentryEvent event, @NotNull Backfillable hint, boolean isBackgroundAnr) { + + // Skip background ANRs (as profiling only runs in foreground) + if (isBackgroundAnr) { + return; + } + + final String cacheDirPath = options.getCacheDirPath(); + if (cacheDirPath == null) { + return; + } + final File cacheDir = new File(cacheDirPath); + + if (!(hint instanceof AbnormalExit)) { + return; + } + final Long anrTimestampObj = ((AbnormalExit) hint).timestamp(); + final long anrTimestamp; + if (anrTimestampObj != null) { + anrTimestamp = anrTimestampObj; + } else if (event.getTimestamp() != null) { + anrTimestamp = event.getTimestamp().getTime(); + } else { + return; + } + + AnrProfile anrProfile = null; + try { + final File lastFile = AnrProfileRotationHelper.getLastFile(cacheDir); + if (lastFile.exists()) { + options.getLogger().log(SentryLevel.DEBUG, "Reading ANR profile"); + try (final AnrProfileManager provider = new AnrProfileManager(options, lastFile)) { + anrProfile = provider.load(); + } + } else { + options.getLogger().log(SentryLevel.DEBUG, "No ANR profile file found"); + } + } catch (Throwable t) { + options.getLogger().log(SentryLevel.INFO, "Could not retrieve ANR profile", t); + } finally { + if (!AnrProfileRotationHelper.deleteLastFile(cacheDir)) { + options.getLogger().log(SentryLevel.INFO, "Could not delete ANR profile file"); + } + } + + if (anrProfile == null) { + return; + } + + options.getLogger().log(SentryLevel.INFO, "ANR profile found"); + if (anrTimestamp < anrProfile.startTimeMs || anrTimestamp > anrProfile.endTimeMs) { + options.getLogger().log(SentryLevel.DEBUG, "ANR profile found, but doesn't match"); + return; + } + + final AggregatedStackTrace culprit = AnrCulpritIdentifier.identify(anrProfile.stacks); + if (culprit == null) { + return; + } + + // Capture profile chunk + final @Nullable SentryId profilerId = captureAnrProfile(anrTimestamp, anrProfile); + final @NotNull StackTraceElement[] stack = culprit.getStack(); + + if (stack.length > 0) { + final StackTraceElement stackTraceElement = stack[0]; + final String message = + stackTraceElement.getClassName() + "." + stackTraceElement.getMethodName(); + final ApplicationNotResponding exception = new ApplicationNotResponding(message); + exception.setStackTrace(stack); + + final Mechanism mechanism = new Mechanism(); + mechanism.setType("ANR"); + final ExceptionMechanismException error = + new ExceptionMechanismException(mechanism, exception, null, false); + + final @NotNull List sentryException = + sentryExceptionFactory.getSentryExceptions(error); + + // Replace the original ANR exception with the profile-derived one, + // as we assume the profiling culprit identification is more valuable + // the event threads are kept as-is, so the original main thread stacktrace is still + // available + event.setExceptions(sentryException); + + if (profilerId != null) { + event.getContexts().setProfile(new ProfileContext(profilerId)); + } + } + } + + @Nullable + private SentryId captureAnrProfile(final long anrTimestampMs, @NotNull AnrProfile anrProfile) { + final SentryProfile profile = StackTraceConverter.convert(anrProfile); + final ProfileChunk chunk = + new ProfileChunk( + new SentryId(), + new SentryId(), + null, + new HashMap<>(0), + anrTimestampMs / 1000.0d, + ProfileChunk.PLATFORM_JAVA, + options); + chunk.setSentryProfile(profile); + + final SentryId profilerId = Sentry.getCurrentScopes().captureProfileChunk(chunk); + if (SentryId.EMPTY_ID.equals(profilerId)) { + return null; + } else { + return chunk.getProfilerId(); + } + } + + private boolean hasOnlySystemFrames(@NotNull SentryEvent event) { + final List exceptions = event.getExceptions(); + if (exceptions == null || exceptions.isEmpty()) { + return false; + } + + for (final SentryException exception : exceptions) { + final SentryStackTrace stacktrace = exception.getStacktrace(); + if (stacktrace != null) { + final List frames = stacktrace.getFrames(); + if (frames != null && !frames.isEmpty()) { + for (final SentryStackFrame frame : frames) { + if (frame.isInApp() != null && frame.isInApp()) { + return false; + } + final String module = frame.getModule(); + if (module != null && !AnrCulpritIdentifier.isSystemFrame(module)) { + return false; + } + } + } + } + } + return true; + } } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java index f4998240f81..7b21c2e392c 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ApplicationNotResponding.java @@ -17,7 +17,12 @@ final class ApplicationNotResponding extends RuntimeException { private static final long serialVersionUID = 252541144579117016L; - private final @NotNull Thread thread; + private final @Nullable Thread thread; + + ApplicationNotResponding(final @Nullable String message) { + super(message); + this.thread = null; + } ApplicationNotResponding(final @Nullable String message, final @NotNull Thread thread) { super(message); @@ -25,7 +30,7 @@ final class ApplicationNotResponding extends RuntimeException { setStackTrace(this.thread.getStackTrace()); } - public @NotNull Thread getThread() { + public @Nullable Thread getThread() { return thread; } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 0fd217794e2..940fe8f4362 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -175,6 +175,10 @@ final class ManifestMetadataReader { static final String SCREENSHOT_MASK_ALL_IMAGES = "io.sentry.screenshot.mask-all-images"; + static final String ANR_PROFILING_SAMPLE_RATE = "io.sentry.anr.profiling.sample-rate"; + + static final String ENABLE_ANR_FINGERPRINTING = "io.sentry.anr.enable-fingerprinting"; + /** ManifestMetadataReader ctor */ private ManifestMetadataReader() {} @@ -674,6 +678,18 @@ static void applyMetadata( options .getScreenshot() .setMaskAllImages(readBool(metadata, logger, SCREENSHOT_MASK_ALL_IMAGES, false)); + + if (options.getAnrProfilingSampleRate() == null) { + final double anrProfilingSampleRate = + readDouble(metadata, logger, ANR_PROFILING_SAMPLE_RATE); + if (anrProfilingSampleRate != -1) { + options.setAnrProfilingSampleRate(anrProfilingSampleRate); + } + } + + options.setEnableAnrFingerprinting( + readBool( + metadata, logger, ENABLE_ANR_FINGERPRINTING, options.isEnableAnrFingerprinting())); } options .getLogger() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index 9630fd59618..054e43322a2 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -17,6 +17,7 @@ import io.sentry.protocol.Mechanism; import io.sentry.protocol.SdkVersion; import io.sentry.protocol.SentryId; +import io.sentry.util.SampleRateUtils; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -252,6 +253,10 @@ public interface BeforeCaptureCallback { */ private final @NotNull SentryScreenshotOptions screenshot = new SentryScreenshotOptions(); + private @Nullable Double anrProfilingSampleRate; + + private boolean enableAnrFingerprinting = true; + public SentryAndroidOptions() { setSentryClientName(BuildConfig.SENTRY_ANDROID_SDK_NAME + "/" + BuildConfig.VERSION_NAME); setSdkVersion(createSdkVersion()); @@ -695,6 +700,47 @@ public void setEnableSystemEventBreadcrumbsExtras( return screenshot; } + public @Nullable Double getAnrProfilingSampleRate() { + return anrProfilingSampleRate; + } + + public void setAnrProfilingSampleRate(final @Nullable Double anrProfilingSampleRate) { + if (!SampleRateUtils.isValidSampleRate(anrProfilingSampleRate)) { + throw new IllegalArgumentException( + "The value " + + anrProfilingSampleRate + + " is not valid. Use null to disable or values >= 0.0 and <= 1.0."); + } + this.anrProfilingSampleRate = anrProfilingSampleRate; + } + + public boolean isAnrProfilingEnabled() { + return anrProfilingSampleRate != null && anrProfilingSampleRate > 0; + } + + /** + * Returns whether ANR fingerprinting is enabled. When enabled, the SDK assigns static + * fingerprints to ANR events that would otherwise produce noisy grouping. Currently, this applies + * a static fingerprint to ANRs whose stacktraces contain only system frames and no application + * frames. + * + * @return true if ANR fingerprinting is enabled + */ + public boolean isEnableAnrFingerprinting() { + return enableAnrFingerprinting; + } + + /** + * Sets whether ANR fingerprinting is enabled. When enabled, the SDK assigns static fingerprints + * to ANR events that would otherwise produce noisy grouping. Currently, this applies a static + * fingerprint to ANRs whose stacktraces contain only system frames and no application frames. + * + * @param enableAnrFingerprinting true to enable ANR fingerprinting + */ + public void setEnableAnrFingerprinting(final boolean enableAnrFingerprinting) { + this.enableAnrFingerprinting = enableAnrFingerprinting; + } + static class AndroidUserFeedbackIDialogHandler implements SentryFeedbackOptions.IDialogHandler { @Override public void showDialog( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AggregatedStackTrace.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AggregatedStackTrace.java new file mode 100644 index 00000000000..99eeeb7e004 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AggregatedStackTrace.java @@ -0,0 +1,56 @@ +package io.sentry.android.core.anr; + +import java.util.Arrays; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public class AggregatedStackTrace { + // the number of frames of the stacktrace + final int depth; + + // the quality of the stack trace, higher means better (ratio of app frames: 0.0 to 1.0) + final float quality; + + private final StackTraceElement[] stack; + + // 0 is the most detailed frame in the stacktrace + private final int stackStartIdx; + private final int stackEndIdx; + + // the total number of times this exact stacktrace was captured + int count; + + // first time the stacktrace occurred + private long startTimeMs; + + // last time the stacktrace occurred + private long endTimeMs; + + public AggregatedStackTrace( + final StackTraceElement[] stack, + final int stackStartIdx, + final int stackEndIdx, + final long timestampMs, + final float quality) { + this.stack = stack; + this.stackStartIdx = stackStartIdx; + this.stackEndIdx = stackEndIdx; + this.depth = stackEndIdx - stackStartIdx + 1; + this.startTimeMs = timestampMs; + this.endTimeMs = timestampMs; + this.count = 1; + this.quality = quality; + } + + public void addOccurrence(final long timestampMs) { + this.startTimeMs = Math.min(startTimeMs, timestampMs); + this.endTimeMs = Math.max(endTimeMs, timestampMs); + this.count++; + } + + @NotNull + public StackTraceElement[] getStack() { + return Arrays.copyOfRange(stack, stackStartIdx, stackEndIdx + 1); + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrCulpritIdentifier.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrCulpritIdentifier.java new file mode 100644 index 00000000000..447cb106ce1 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrCulpritIdentifier.java @@ -0,0 +1,165 @@ +package io.sentry.android.core.anr; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@ApiStatus.Internal +public class AnrCulpritIdentifier { + + // common Java and Android packages who are less relevant for being the actual culprit + private static final List systemAndFrameworkPackages = new ArrayList<>(11); + + static { + systemAndFrameworkPackages.add("java.lang"); + systemAndFrameworkPackages.add("java.util"); + + systemAndFrameworkPackages.add("android.app"); + systemAndFrameworkPackages.add("android.os.Handler"); + systemAndFrameworkPackages.add("android.os.Looper"); + systemAndFrameworkPackages.add("android.view"); + systemAndFrameworkPackages.add("android.widget"); + systemAndFrameworkPackages.add("com.android.internal"); + systemAndFrameworkPackages.add("com.google.android"); + + systemAndFrameworkPackages.add("kotlin"); + systemAndFrameworkPackages.add("kotlinx.coroutines"); + } + + private static final class StackTraceKey { + private final @NotNull StackTraceElement[] stack; + private final int startIdx; + private final int endIdx; + private final int hashCode; + + StackTraceKey(final @NotNull StackTraceElement[] stack, final int startIdx, final int endIdx) { + this.stack = stack; + this.startIdx = startIdx; + this.endIdx = endIdx; + this.hashCode = computeHashCode(); + } + + private int computeHashCode() { + int result = 1; + for (int i = startIdx; i <= endIdx; i++) { + result = 31 * result + stack[i].hashCode(); + } + return result; + } + + @Override + public int hashCode() { + return hashCode; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof StackTraceKey)) { + return false; + } + + final @NotNull StackTraceKey other = (StackTraceKey) obj; + + if (hashCode != other.hashCode) { + return false; + } + + final int length = endIdx - startIdx + 1; + final int otherLength = other.endIdx - other.startIdx + 1; + if (length != otherLength) { + return false; + } + + for (int i = 0; i < length; i++) { + if (!stack[startIdx + i].equals(other.stack[other.startIdx + i])) { + return false; + } + } + + return true; + } + } + + /** + * @param stacks a list of stack traces to analyze + * @return the most common occurring stacktrace identified as the culprit + */ + @Nullable + public static AggregatedStackTrace identify(final @NotNull List stacks) { + if (stacks.isEmpty()) { + return null; + } + + // fold all stacktraces and count their occurrences + final @NotNull Map stackTraceMap = new HashMap<>(); + for (final @NotNull AnrStackTrace stackTrace : stacks) { + if (stackTrace.stack.length < 2) { + continue; + } + + // stack[0] is the most detailed element in the stacktrace + // iterate from end to start (length-1 → 0) creating sub-stacks (i..n-1) to find the most + // common root cause + // count app frames from the end to compute quality scores + int appFramesCount = 0; + + for (int i = stackTrace.stack.length - 1; i >= 0; i--) { + + final @NotNull String topMostClassName = stackTrace.stack[i].getClassName(); + final boolean isSystemFrame = isSystemFrame(topMostClassName); + if (!isSystemFrame) { + appFramesCount++; + } + + final int totalFrames = stackTrace.stack.length - i; + final float quality = (float) appFramesCount / totalFrames; + + final @NotNull StackTraceKey key = + new StackTraceKey(stackTrace.stack, i, stackTrace.stack.length - 1); + + @Nullable AggregatedStackTrace aggregatedStackTrace = stackTraceMap.get(key); + if (aggregatedStackTrace == null) { + aggregatedStackTrace = + new AggregatedStackTrace( + stackTrace.stack, + i, + stackTrace.stack.length - 1, + stackTrace.timestampMs, + quality); + stackTraceMap.put(key, aggregatedStackTrace); + } else { + aggregatedStackTrace.addOccurrence(stackTrace.timestampMs); + } + } + } + + if (stackTraceMap.isEmpty()) { + return null; + } + + // the deepest stacktrace with most count wins + return Collections.max( + stackTraceMap.values(), + (c1, c2) -> + Float.compare( + c1.count * (1.0f + c1.quality) * c1.depth, + c2.count * (1.0f + c2.quality) * c2.depth)); + } + + public static boolean isSystemFrame(final @NotNull String clazz) { + for (final String systemPackage : systemAndFrameworkPackages) { + if (clazz.startsWith(systemPackage)) { + return true; + } + } + return false; + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfile.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfile.java new file mode 100644 index 00000000000..19999683905 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfile.java @@ -0,0 +1,35 @@ +package io.sentry.android.core.anr; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public class AnrProfile { + public final List stacks; + + public final long startTimeMs; + public final long endTimeMs; + + public AnrProfile(final @NotNull List stacks) { + this.stacks = new ArrayList<>(stacks.size()); + for (AnrStackTrace stack : stacks) { + if (stack != null) { + this.stacks.add(stack); + } + } + Collections.sort(this.stacks); + + if (!this.stacks.isEmpty()) { + startTimeMs = this.stacks.get(0).timestampMs; + + // adding 10s to be less strict around end time + endTimeMs = this.stacks.get(this.stacks.size() - 1).timestampMs + 10_000L; + } else { + startTimeMs = 0L; + endTimeMs = 0L; + } + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileManager.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileManager.java new file mode 100644 index 00000000000..7e3e1fd514e --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileManager.java @@ -0,0 +1,103 @@ +package io.sentry.android.core.anr; + +import static io.sentry.SentryLevel.ERROR; +import static io.sentry.android.core.anr.AnrProfilingIntegration.POLLING_INTERVAL_MS; +import static io.sentry.android.core.anr.AnrProfilingIntegration.THRESHOLD_ANR_MS; + +import io.sentry.ILogger; +import io.sentry.SentryOptions; +import io.sentry.cache.tape.ObjectQueue; +import io.sentry.cache.tape.QueueFile; +import io.sentry.util.Objects; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@ApiStatus.Internal +public class AnrProfileManager implements AutoCloseable { + + private static final int MAX_NUM_STACKTRACES = + (int) ((THRESHOLD_ANR_MS / POLLING_INTERVAL_MS) * 2); + + @NotNull private final ObjectQueue queue; + + public AnrProfileManager(final @NotNull SentryOptions options) { + this( + options, + new File( + Objects.requireNonNull(options.getCacheDirPath(), "cacheDirPath is required"), + "anr_profile")); + } + + public AnrProfileManager(final @NotNull SentryOptions options, final @NotNull File file) { + final @NotNull ILogger logger = options.getLogger(); + + @Nullable QueueFile queueFile = null; + try { + try { + queueFile = new QueueFile.Builder(file).size(MAX_NUM_STACKTRACES).build(); + } catch (IOException e) { + // if file is corrupted we simply delete it and try to create it again + if (!file.delete()) { + throw new IOException("Could not delete file"); + } + queueFile = new QueueFile.Builder(file).size(MAX_NUM_STACKTRACES).build(); + } + } catch (IOException e) { + logger.log(ERROR, "Failed to create stacktrace queue", e); + } + + if (queueFile == null) { + queue = ObjectQueue.createEmpty(); + } else { + queue = + ObjectQueue.create( + queueFile, + new ObjectQueue.Converter() { + @Override + public AnrStackTrace from(final byte[] source) throws IOException { + // no need to close the streams since they are backed by byte arrays and don't + // hold any resources + final @NotNull ByteArrayInputStream bis = new ByteArrayInputStream(source); + final @NotNull DataInputStream dis = new DataInputStream(bis); + return AnrStackTrace.deserialize(dis); + } + + @Override + public void toStream( + final @NotNull AnrStackTrace value, final @NotNull OutputStream sink) + throws IOException { + try (final @NotNull DataOutputStream dos = new DataOutputStream(sink)) { + value.serialize(dos); + dos.flush(); + sink.flush(); + } + } + }); + } + } + + public void clear() throws IOException { + queue.clear(); + } + + public void add(AnrStackTrace trace) throws IOException { + queue.add(trace); + } + + @NotNull + public AnrProfile load() throws IOException { + return new AnrProfile(queue.asList()); + } + + @Override + public void close() throws IOException { + queue.close(); + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileRotationHelper.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileRotationHelper.java new file mode 100644 index 00000000000..761309f1670 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfileRotationHelper.java @@ -0,0 +1,73 @@ +package io.sentry.android.core.anr; + +import java.io.File; +import java.util.concurrent.atomic.AtomicBoolean; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +/** + * Coordinates file rotation between AnrProfilingIntegration and AnrV2Integration to prevent + * concurrent access to the same QueueFile. + */ +@ApiStatus.Internal +public class AnrProfileRotationHelper { + + private static final String RECORDING_FILE_NAME = "anr_profile"; + private static final String OLD_FILE_NAME = "anr_profile_old"; + + private static final AtomicBoolean shouldRotate = new AtomicBoolean(true); + private static final Object rotationLock = new Object(); + + public static void rotate() { + shouldRotate.set(true); + } + + private static void performRotationIfNeeded(final @NotNull File cacheDir) { + if (!shouldRotate.get()) { + return; + } + + synchronized (rotationLock) { + if (!shouldRotate.get()) { + return; + } + + final File currentFile = new File(cacheDir, RECORDING_FILE_NAME); + final File oldFile = new File(cacheDir, OLD_FILE_NAME); + + try { + oldFile.delete(); + } catch (Throwable e) { + // ignored + } + + try { + currentFile.renameTo(oldFile); + } catch (Throwable e) { + // ignored + } + + shouldRotate.set(false); + } + } + + @NotNull + public static File getFileForRecording(final @NotNull File cacheDir) { + performRotationIfNeeded(cacheDir); + return new File(cacheDir, RECORDING_FILE_NAME); + } + + @NotNull + public static File getLastFile(final @NotNull File cacheDir) { + performRotationIfNeeded(cacheDir); + return new File(cacheDir, OLD_FILE_NAME); + } + + public static boolean deleteLastFile(final @NotNull File cacheDir) { + final File oldFile = new File(cacheDir, OLD_FILE_NAME); + if (!oldFile.exists()) { + return true; + } + return oldFile.delete(); + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java new file mode 100644 index 00000000000..97ec0434249 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java @@ -0,0 +1,308 @@ +package io.sentry.android.core.anr; + +import static io.sentry.util.IntegrationUtils.addIntegrationToSdkVersion; + +import android.os.Handler; +import android.os.Looper; +import android.os.SystemClock; +import io.sentry.ILogger; +import io.sentry.IScopes; +import io.sentry.ISentryLifecycleToken; +import io.sentry.Integration; +import io.sentry.NoOpLogger; +import io.sentry.SentryLevel; +import io.sentry.SentryOptions; +import io.sentry.android.core.AppState; +import io.sentry.android.core.SentryAndroidOptions; +import io.sentry.util.AutoClosableReentrantLock; +import io.sentry.util.Objects; +import io.sentry.util.SentryRandom; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; + +public class AnrProfilingIntegration + implements Integration, Closeable, AppState.AppStateListener, Runnable { + + public static final long POLLING_INTERVAL_MS = 66; + private static final long THRESHOLD_SUSPICION_MS = 1000; + public static final long THRESHOLD_ANR_MS = 4000; + static final int MAX_NUM_STACKS = (int) (10_000 / POLLING_INTERVAL_MS); + + private final AtomicBoolean enabled = new AtomicBoolean(true); + private final Runnable updater = () -> lastMainThreadExecutionTime = SystemClock.uptimeMillis(); + private final @NotNull AutoClosableReentrantLock lifecycleLock = new AutoClosableReentrantLock(); + private final @NotNull AutoClosableReentrantLock profileManagerLock = + new AutoClosableReentrantLock(); + + private volatile long lastMainThreadExecutionTime = SystemClock.uptimeMillis(); + final AtomicInteger numCollectedStacks = new AtomicInteger(); + private volatile MainThreadState mainThreadState = MainThreadState.IDLE; + private volatile @Nullable AnrProfileManager profileManager; + private volatile @NotNull ILogger logger = NoOpLogger.getInstance(); + private volatile @Nullable SentryAndroidOptions options; + private volatile @Nullable Thread thread = null; + private volatile boolean sampled = false; + private volatile boolean inForeground = false; + private volatile @Nullable Handler mainHandler; + private volatile @Nullable Thread mainThread; + + @Override + public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions options) { + this.options = + Objects.requireNonNull( + (options instanceof SentryAndroidOptions) ? (SentryAndroidOptions) options : null, + "SentryAndroidOptions is required"); + this.logger = options.getLogger(); + + if (this.options.isAnrProfilingEnabled()) { + if (this.options.getCacheDirPath() == null) { + logger.log(SentryLevel.WARNING, "ANR Profiling is enabled but cacheDirPath is not set"); + return; + } + + final Looper mainLooper = Looper.getMainLooper(); + this.mainThread = mainLooper.getThread(); + this.mainHandler = new Handler(mainLooper); + + addIntegrationToSdkVersion("AnrProfiling"); + AppState.getInstance().addAppStateListener(this); + } + } + + @Override + public void close() throws IOException { + enabled.set(false); + AppState.getInstance().removeAppStateListener(this); + + // Remove any pending updater callbacks from the main handler + final @Nullable Handler handler = mainHandler; + if (handler != null) { + handler.removeCallbacks(updater); + } + + // Wake and interrupt the thread so it exits + final @Nullable Thread t = thread; + if (t != null) { + synchronized (this) { + notifyAll(); + } + t.interrupt(); + } + + final @Nullable SentryAndroidOptions opts = options; + final @Nullable AnrProfileManager pm; + try (final @NotNull ISentryLifecycleToken ignored = profileManagerLock.acquire()) { + pm = profileManager; + profileManager = null; + } + if (opts != null) { + try { + opts.getExecutorService() + .submit( + () -> { + if (pm == null) { + return; + } + + try { + pm.close(); + } catch (IOException e) { + logger.log(SentryLevel.WARNING, "Failed to close AnrProfileManager"); + } + }); + } catch (Throwable e) { + logger.log(SentryLevel.WARNING, "Failed to submit AnrProfileManager close"); + } + } + } + + @Override + public void onForeground() { + if (!enabled.get()) { + return; + } + try (final @NotNull ISentryLifecycleToken ignored = lifecycleLock.acquire()) { + if (inForeground) { + return; + } + inForeground = true; + updater.run(); + + final @Nullable Thread existingThread = thread; + if (existingThread != null && existingThread.isAlive()) { + // Wake the existing thread + synchronized (this) { + notifyAll(); + } + } + if (existingThread == null || !existingThread.isAlive()) { + final @NotNull Thread profilingThread = new Thread(this, "AnrProfilingIntegration"); + profilingThread.setDaemon(true); + profilingThread.start(); + thread = profilingThread; + } + } + } + + @Override + public void onBackground() { + if (!enabled.get()) { + return; + } + try (final @NotNull ISentryLifecycleToken ignored = lifecycleLock.acquire()) { + inForeground = false; + } + } + + @Override + public void run() { + final @Nullable Handler handler = mainHandler; + final @Nullable Thread mt = mainThread; + if (handler == null || mt == null) { + return; + } + + try { + while (enabled.get() && !Thread.currentThread().isInterrupted()) { + try { + if (!inForeground) { + // Wait until we're back in the foreground or disabled + synchronized (this) { + while (!inForeground && enabled.get()) { + wait(); + } + } + // Reset the updater timestamp after waking to avoid false suspicion + updater.run(); + continue; + } + + checkMainThread(mt); + + handler.removeCallbacks(updater); + handler.post(updater); + + // noinspection BusyWait + Thread.sleep(POLLING_INTERVAL_MS); + } catch (InterruptedException e) { + // Restore interrupt status and exit the polling loop + Thread.currentThread().interrupt(); + return; + } + } + } catch (Throwable t) { + logger.log(SentryLevel.WARNING, "Failed to execute AnrStacktraceIntegration", t); + } + } + + @ApiStatus.Internal + protected void checkMainThread(final @NotNull Thread mainThread) throws IOException { + final long now = SystemClock.uptimeMillis(); + final long diff = now - lastMainThreadExecutionTime; + + if (diff < THRESHOLD_SUSPICION_MS) { + mainThreadState = MainThreadState.IDLE; + sampled = false; + } + + if (mainThreadState == MainThreadState.IDLE && diff > THRESHOLD_SUSPICION_MS) { + if (logger.isEnabled(SentryLevel.DEBUG)) { + logger.log(SentryLevel.DEBUG, "ANR: main thread is suspicious"); + } + mainThreadState = MainThreadState.SUSPICIOUS; + + final @Nullable SentryAndroidOptions opts = options; + final @Nullable Double sampleRate = opts != null ? opts.getAnrProfilingSampleRate() : null; + if (sampleRate != null && SentryRandom.current().nextDouble() < sampleRate) { + sampled = true; + } + + if (sampled) { + clearStacks(); + } + } + + // if we are suspicious and sampled, we need to collect stack traces + if (sampled + && (mainThreadState == MainThreadState.SUSPICIOUS + || mainThreadState == MainThreadState.ANR_DETECTED)) { + if (numCollectedStacks.get() < MAX_NUM_STACKS) { + final long start = SystemClock.uptimeMillis(); + final @NotNull AnrStackTrace trace = + new AnrStackTrace(System.currentTimeMillis(), mainThread.getStackTrace()); + final long duration = SystemClock.uptimeMillis() - start; + if (logger.isEnabled(SentryLevel.DEBUG)) { + logger.log( + SentryLevel.DEBUG, + "AnrWatchdog: capturing main thread stacktrace took " + duration + "ms"); + } + addStackTrace(trace); + } else { + if (logger.isEnabled(SentryLevel.DEBUG)) { + logger.log( + SentryLevel.DEBUG, + "ANR: reached maximum number of collected stack traces, skipping further collection"); + } + } + } + + if (mainThreadState == MainThreadState.SUSPICIOUS && diff > THRESHOLD_ANR_MS) { + if (logger.isEnabled(SentryLevel.DEBUG)) { + logger.log(SentryLevel.DEBUG, "ANR: main thread ANR threshold reached"); + } + mainThreadState = MainThreadState.ANR_DETECTED; + } + } + + @TestOnly + @NotNull + protected MainThreadState getState() { + return mainThreadState; + } + + @TestOnly + @NotNull + protected AnrProfileManager getProfileManager() { + try (final @NotNull ISentryLifecycleToken ignored = profileManagerLock.acquire()) { + if (profileManager == null) { + final @NotNull SentryOptions opts = + Objects.requireNonNull(options, "Options can't be null"); + final @Nullable String cacheDirPath = opts.getCacheDirPath(); + if (cacheDirPath == null) { + throw new IllegalStateException("cacheDirPath is required for ANR profiling"); + } + final @NotNull File currentFile = + AnrProfileRotationHelper.getFileForRecording(new File(cacheDirPath)); + profileManager = new AnrProfileManager(opts, currentFile); + } + + return profileManager; + } + } + + private void clearStacks() throws IOException { + numCollectedStacks.set(0); + getProfileManager().clear(); + } + + private void addStackTrace(@NotNull final AnrStackTrace trace) throws IOException { + if (!enabled.get()) { + return; + } + numCollectedStacks.incrementAndGet(); + getProfileManager().add(trace); + } + + protected enum MainThreadState { + IDLE, + SUSPICIOUS, + ANR_DETECTED, + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrStackTrace.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrStackTrace.java new file mode 100644 index 00000000000..2d165c501bf --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrStackTrace.java @@ -0,0 +1,79 @@ +package io.sentry.android.core.anr; + +import io.sentry.util.StringUtils; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.EOFException; +import java.io.IOException; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@ApiStatus.Internal +public final class AnrStackTrace implements Comparable { + + private static final int MAX_STACK_LENGTH = 1000; + + public final StackTraceElement[] stack; + public final long timestampMs; + + public AnrStackTrace(final long timestampMs, final StackTraceElement[] stack) { + this.timestampMs = timestampMs; + this.stack = stack; + } + + @Override + public int compareTo(final @NotNull AnrStackTrace o) { + return Long.compare(timestampMs, o.timestampMs); + } + + public void serialize(final @NotNull DataOutputStream dos) throws IOException { + dos.writeShort(1); // version + dos.writeLong(timestampMs); + dos.writeInt(stack.length); + for (final @NotNull StackTraceElement element : stack) { + dos.writeUTF(StringUtils.getOrEmpty(element.getClassName())); + dos.writeUTF(StringUtils.getOrEmpty(element.getMethodName())); + // Write null as a special marker to preserve null vs empty string distinction + final @Nullable String fileName = element.getFileName(); + dos.writeBoolean(fileName == null); + dos.writeUTF(fileName == null ? "" : fileName); + dos.writeInt(element.getLineNumber()); + } + } + + @Nullable + public static AnrStackTrace deserialize(final @NotNull DataInputStream dis) throws IOException { + try { + final short version = dis.readShort(); + if (version == 1) { + final long timestampMs = dis.readLong(); + final int stackLength = dis.readInt(); + if (stackLength < 0 || stackLength > MAX_STACK_LENGTH) { + return null; + } + final @NotNull StackTraceElement[] stack = new StackTraceElement[stackLength]; + + for (int i = 0; i < stackLength; i++) { + final @NotNull String className = dis.readUTF(); + final @NotNull String methodName = dis.readUTF(); + // Read the null marker to restore null vs empty string distinction + final boolean isFileNameNull = dis.readBoolean(); + final @NotNull String fileNameStr = dis.readUTF(); + final @Nullable String fileName = isFileNameNull ? null : fileNameStr; + final int lineNumber = dis.readInt(); + final StackTraceElement element = + new StackTraceElement(className, methodName, fileName, lineNumber); + stack[i] = element; + } + + return new AnrStackTrace(timestampMs, stack); + } else { + // unsupported future version + return null; + } + } catch (EOFException e) { + return null; + } + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/StackTraceConverter.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/StackTraceConverter.java new file mode 100644 index 00000000000..f6f29689f72 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/StackTraceConverter.java @@ -0,0 +1,150 @@ +package io.sentry.android.core.anr; + +import io.sentry.protocol.SentryStackFrame; +import io.sentry.protocol.profiling.SentryProfile; +import io.sentry.protocol.profiling.SentrySample; +import io.sentry.protocol.profiling.SentryThreadMetadata; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Converts a list of {@link AnrStackTrace} objects captured during ANR detection into a {@link + * SentryProfile} object suitable for profiling telemetry. + * + *

This converter handles: + * + *

+ */ +@ApiStatus.Internal +public final class StackTraceConverter { + + private static final String MAIN_THREAD_ID = "0"; + private static final String MAIN_THREAD_NAME = "main"; + + /** + * Converts a list of {@link AnrStackTrace} objects to a {@link SentryProfile}. + * + * @param anrProfile The ANR Profile + * @return a populated SentryProfile with deduped frames and samples + */ + @NotNull + public static SentryProfile convert(final @NotNull AnrProfile anrProfile) { + final @NotNull List anrStackTraces = anrProfile.stacks; + + final @NotNull SentryProfile profile = new SentryProfile(); + final @NotNull List frames = new ArrayList<>(); + final @NotNull Map frameSignatureToIndex = new HashMap<>(); + final @NotNull List> stacks = new ArrayList<>(); + final @NotNull Map stackSignatureToIndex = new HashMap<>(); + + for (final @NotNull AnrStackTrace anrStackTrace : anrStackTraces) { + final @NotNull StackTraceElement[] stackElements = anrStackTrace.stack; + final @NotNull List frameIndices = new ArrayList<>(); + for (final @NotNull StackTraceElement element : stackElements) { + final @NotNull String frameSignature = createFrameSignature(element); + @Nullable Integer frameIndex = frameSignatureToIndex.get(frameSignature); + if (frameIndex == null) { + frameIndex = frames.size(); + frames.add(createSentryStackFrame(element)); + frameSignatureToIndex.put(frameSignature, frameIndex); + } + frameIndices.add(frameIndex); + } + + final @NotNull String stackSignature = createStackSignature(frameIndices); + @Nullable Integer stackIndex = stackSignatureToIndex.get(stackSignature); + + if (stackIndex == null) { + stackIndex = stacks.size(); + stacks.add(new ArrayList<>(frameIndices)); + stackSignatureToIndex.put(stackSignature, stackIndex); + } + + final @NotNull SentrySample sample = new SentrySample(); + sample.setTimestamp(anrStackTrace.timestampMs / 1000.0); // Convert ms to seconds + sample.setStackId(stackIndex); + sample.setThreadId(MAIN_THREAD_ID); + + profile.getSamples().add(sample); + } + + profile.setFrames(frames); + profile.setStacks(stacks); + + final @NotNull SentryThreadMetadata threadMetadata = new SentryThreadMetadata(); + threadMetadata.setName(MAIN_THREAD_NAME); + threadMetadata.setPriority(Thread.NORM_PRIORITY); + + final @NotNull Map threadMetadataMap = + Collections.singletonMap(MAIN_THREAD_ID, threadMetadata); + profile.setThreadMetadata(threadMetadataMap); + + return profile; + } + + /** + * Creates a unique signature for a StackTraceElement to identify duplicate frames. + * + * @param element the stack trace element + * @return a signature string representing this frame + */ + @NotNull + private static String createFrameSignature(@NotNull StackTraceElement element) { + return element.getClassName() + + "#" + + element.getMethodName() + + "#" + + element.getFileName() + + "#" + + element.getLineNumber(); + } + + /** + * Creates a unique signature for a stack (list of frame indices) to identify duplicate stacks. + * + * @param frameIndices the list of frame indices + * @return a signature string representing this stack + */ + @NotNull + private static String createStackSignature(@NotNull List frameIndices) { + final @NotNull StringBuilder sb = new StringBuilder(); + for (Integer index : frameIndices) { + if (sb.length() > 0) { + sb.append(","); + } + sb.append(index); + } + return sb.toString(); + } + + /** + * Converts a {@link StackTraceElement} to a {@link SentryStackFrame}. + * + * @param element the stack trace element + * @return a SentryStackFrame populated with available information + */ + @NotNull + private static SentryStackFrame createSentryStackFrame(@NotNull StackTraceElement element) { + final @NotNull SentryStackFrame frame = new SentryStackFrame(); + frame.setFilename(element.getFileName()); + frame.setFunction(element.getMethodName()); + frame.setModule(element.getClassName()); + frame.setLineno(element.getLineNumber() > 0 ? element.getLineNumber() : null); + if (element.isNativeMethod()) { + frame.setNative(true); + } + return frame; + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt index c2c3d384c40..2f3b6791c5b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt @@ -58,8 +58,8 @@ class ANRWatchDogTest { } while (anr == null && waitCount++ < 100) assertNotNull(anr) - assertEquals(expectedState, anr!!.thread.state) - assertEquals(stacktrace.className, anr!!.stackTrace[0].className) + assertEquals(expectedState, anr.thread!!.state) + assertEquals(stacktrace.className, anr.stackTrace[0].className) } finally { sut.interrupt() es.shutdown() @@ -137,8 +137,8 @@ class ANRWatchDogTest { } while (anr == null && waitCount++ < 100) assertNotNull(anr) - assertEquals(expectedState, anr!!.thread.state) - assertEquals(stacktrace.className, anr!!.stackTrace[0].className) + assertEquals(expectedState, anr.thread!!.state) + assertEquals(stacktrace.className, anr.stackTrace[0].className) } finally { sut.interrupt() es.shutdown() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt index a1a35facf56..abd27b51560 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt @@ -8,13 +8,17 @@ import io.sentry.SentryEvent import io.sentry.android.core.AnrV2Integration.AnrV2Hint import io.sentry.android.core.cache.AndroidEnvelopeCache import io.sentry.util.HintUtils +import java.io.File import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull +import org.junit.After import org.junit.runner.RunWith import org.mockito.kotlin.any +import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.argThat import org.mockito.kotlin.check +import org.mockito.kotlin.never import org.mockito.kotlin.spy import org.mockito.kotlin.verify import org.mockito.kotlin.whenever @@ -159,6 +163,11 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { assertEquals("/apex/com.android.runtime/lib64/bionic/libc.so", image.codeFile) } + @After + fun cleanup() { + fixture.options.cacheDirPath?.let { File(it).deleteRecursively() } + } + @Test fun `when latest ANR has foreground importance, sets abnormal mechanism to anr_foreground`() { val integration = @@ -211,4 +220,24 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { verify(fixture.scopes).captureEvent(any(), check { assertNotNull(it.threadDump) }) } + + @Test + fun `when traceInputStream is null, does not report ANR`() { + val integration = fixture.getSut(tmpDir, lastReportedTimestamp = oldTimestamp) + fixture.addAppExitInfo(timestamp = newTimestamp, addTrace = false) + + integration.register(fixture.scopes, fixture.options) + + verify(fixture.scopes, never()).captureEvent(any(), anyOrNull()) + } + + @Test + fun `when traceInputStream has bad data, does not report ANR`() { + val integration = fixture.getSut(tmpDir, lastReportedTimestamp = oldTimestamp) + fixture.addAppExitInfo(timestamp = newTimestamp, addBadTrace = true) + + integration.register(fixture.scopes, fixture.options) + + verify(fixture.scopes, never()).captureEvent(any(), anyOrNull()) + } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt index 66090fc815e..e7583429910 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt @@ -8,13 +8,18 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.Breadcrumb import io.sentry.Hint +import io.sentry.IScopes import io.sentry.IpAddressUtils import io.sentry.NoOpLogger +import io.sentry.Sentry import io.sentry.SentryBaseEvent import io.sentry.SentryEvent import io.sentry.SentryLevel import io.sentry.SentryLevel.DEBUG import io.sentry.SpanContext +import io.sentry.android.core.anr.AnrProfileManager +import io.sentry.android.core.anr.AnrProfileRotationHelper +import io.sentry.android.core.anr.AnrStackTrace import io.sentry.cache.PersistingOptionsObserver.DIST_FILENAME import io.sentry.cache.PersistingOptionsObserver.ENVIRONMENT_FILENAME import io.sentry.cache.PersistingOptionsObserver.OPTIONS_CACHE @@ -67,6 +72,8 @@ import kotlin.test.assertTrue import org.junit.Rule import org.junit.rules.TemporaryFolder import org.junit.runner.RunWith +import org.mockito.Mockito.mockStatic +import org.mockito.kotlin.any import org.mockito.kotlin.mock import org.mockito.kotlin.whenever import org.robolectric.annotation.Config @@ -596,12 +603,44 @@ class ApplicationExitInfoEventProcessorTest { fun `sets default fingerprint to distinguish between background and foreground ANRs`() { val backgroundHint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_background")) - val processedBackground = processEvent(backgroundHint, populateScopeCache = false) + val processedBackground = + processEvent(backgroundHint, populateScopeCache = false) { + exceptions = + listOf( + SentryException().apply { + this.stacktrace = + SentryStackTrace( + listOf( + SentryStackFrame().apply { + module = "io.sentry.samples.MainActivity" + function = "run" + } + ) + ) + } + ) + } assertEquals(listOf("{{ default }}", "background-anr"), processedBackground.fingerprints) val foregroundHint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) - val processedForeground = processEvent(foregroundHint, populateScopeCache = false) + val processedForeground = + processEvent(foregroundHint, populateScopeCache = false) { + exceptions = + listOf( + SentryException().apply { + this.stacktrace = + SentryStackTrace( + listOf( + SentryStackFrame().apply { + module = "io.sentry.samples.MainActivity" + function = "run" + } + ) + ) + } + ) + } assertEquals(listOf("{{ default }}", "foreground-anr"), processedForeground.fingerprints) } @@ -628,6 +667,181 @@ class ApplicationExitInfoEventProcessorTest { assertNull(processed.fingerprints) } + @Test + fun `sets system-frames-only fingerprint when ANR fingerprinting enabled and no app frames`() { + fixture.options.isEnableAnrFingerprinting = true + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + + val processed = + processEvent(hint, populateScopeCache = false) { + threads = + listOf( + SentryThread().apply { + name = "main" + stacktrace = + SentryStackTrace().apply { + frames = + listOf( + SentryStackFrame().apply { + module = "java.lang" + filename = "Thread.java" + function = "run" + } + ) + } + } + ) + } + + assertEquals(listOf("system-frames-only-anr", "foreground-anr"), processed.fingerprints) + } + + @Test + fun `does not set system-frames-only fingerprint when ANR fingerprinting is disabled and no app frames are present`() { + fixture.options.isEnableAnrFingerprinting = false + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + + val processed = + processEvent(hint, populateScopeCache = false) { + threads = + listOf( + SentryThread().apply { + name = "main" + stacktrace = + SentryStackTrace().apply { + frames = + listOf( + SentryStackFrame().apply { + module = "java.lang" + filename = "Thread.java" + function = "run" + } + ) + } + } + ) + } + + assertEquals(listOf("{{ default }}", "foreground-anr"), processed.fingerprints) + } + + @Test + fun `sets default fingerprint when ANR fingerprinting enabled and app frames are present`() { + fixture.options.isEnableAnrFingerprinting = true + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + + val processed = + processEvent(hint, populateScopeCache = false) { + threads = + listOf( + SentryThread().apply { + name = "main" + stacktrace = + SentryStackTrace().apply { + frames = + listOf( + SentryStackFrame().apply { + module = "com.example.MyApp" + function = "onCreate" + } + ) + } + } + ) + } + + assertEquals(listOf("{{ default }}", "foreground-anr"), processed.fingerprints) + } + + @Test + fun `does not set profile context when ANR profiling is disabled`() { + fixture.options.anrProfilingSampleRate = null + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + val processed = + processEvent(hint, populateScopeCache = false) { + threads = + listOf( + SentryThread().apply { + name = "main" + stacktrace = + SentryStackTrace().apply { + frames = + listOf( + SentryStackFrame().apply { + module = "com.example.MyApp" + function = "onCreate" + } + ) + } + } + ) + } + assertNull(processed.contexts.profile) + } + + @Test + fun `applies ANR profile if available`() { + fixture.options.anrProfilingSampleRate = 1.0 + val processor = + fixture.getSut( + tmpDir, + populateScopeCache = false, + populateOptionsCache = false, + isSendDefaultPii = false, + ) + + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + + AnrProfileManager( + fixture.options, + AnrProfileRotationHelper.getFileForRecording(File(fixture.options.cacheDirPath!!)), + ) + .apply { + add( + AnrStackTrace( + System.currentTimeMillis(), + arrayOf( + StackTraceElement( + "android.view.Choreographer", + "doFrame", + "Choreographer.java", + 1234, + ), + StackTraceElement("android.os.Handler", "dispatchMessage", "Handler.java", 5678), + ), + ) + ) + close() + } + AnrProfileRotationHelper.rotate() + + val scopes = mock() + whenever(scopes.captureProfileChunk(any())).thenReturn(SentryId()) + + mockStatic(Sentry::class.java).use { mockedSentry -> + mockedSentry.`when` { Sentry.getCurrentScopes() }.thenReturn(scopes) + + val processed = processor.process(SentryEvent(), hint) + + assertNotNull(processed?.contexts?.profile) + assertNotNull(processed.contexts.profile?.profilerId) + } + } + + @Test + fun `does not crash when ANR profiling is enabled but cache dir is null`() { + fixture.options.anrProfilingSampleRate = 1.0 + fixture.options.cacheDirPath = null + val hint = HintUtils.createWithTypeCheckHint(AbnormalExitHint(mechanism = "anr_foreground")) + val original = SentryEvent() + + val processor = fixture.getSut(tmpDir) + val processed = processor.process(original, hint) + + assertNotNull(processed) + assertNull(processed.contexts.profile) + } + @Test fun `sets replayId when replay folder exists`() { val hint = HintUtils.createWithTypeCheckHint(BackfillableHint()) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt index ff30dfb2e10..649e14e413b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt @@ -418,6 +418,7 @@ abstract class ApplicationExitIntegrationTestBase { extraOptions(this) } options.cacheDirPath?.let { cacheDir -> + File(cacheDir).mkdirs() lastReportedFile = File(cacheDir, config.lastReportedFileName) lastReportedFile.writeText(lastReportedTimestamp.toString()) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index fd5c9cffc89..b9b7d40e48a 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -1997,6 +1997,56 @@ class ManifestMetadataReaderTest { ) } + @Test + fun `applyMetadata reads anrProfilingSampleRate to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.ANR_PROFILING_SAMPLE_RATE to 0.5f) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(0.5, fixture.options.anrProfilingSampleRate!!, 0.01) + } + + @Test + fun `applyMetadata keeps anrProfilingSampleRate default when not set in manifest`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertNull(fixture.options.anrProfilingSampleRate) + } + + @Test + fun `applyMetadata reads enableAnrFingerprinting to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.ENABLE_ANR_FINGERPRINTING to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.isEnableAnrFingerprinting) + } + + @Test + fun `applyMetadata keeps enableAnrFingerprinting default when not set in manifest`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.isEnableAnrFingerprinting) + } + // Network Detail Configuration Tests @Test diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt index 8cb79b0bb5b..819928dcdc4 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt @@ -195,6 +195,44 @@ class SentryAndroidOptionsTest { assertTrue(sentryOptions.isEnableSystemEventBreadcrumbsExtras) } + @Test + fun `anr profiling sample rate is null by default`() { + val sentryOptions = SentryAndroidOptions() + + assertNull(sentryOptions.anrProfilingSampleRate) + assertFalse(sentryOptions.isAnrProfilingEnabled) + } + + @Test + fun `anr profiling can be enabled via sample rate`() { + val sentryOptions = SentryAndroidOptions() + sentryOptions.anrProfilingSampleRate = 1.0 + assertEquals(1.0, sentryOptions.anrProfilingSampleRate) + assertTrue(sentryOptions.isAnrProfilingEnabled) + } + + @Test + fun `anr profiling can be disabled via null sample rate`() { + val sentryOptions = SentryAndroidOptions() + sentryOptions.anrProfilingSampleRate = 1.0 + sentryOptions.anrProfilingSampleRate = null + assertNull(sentryOptions.anrProfilingSampleRate) + assertFalse(sentryOptions.isAnrProfilingEnabled) + } + + @Test + fun `anr profiling is disabled when sample rate is zero`() { + val sentryOptions = SentryAndroidOptions() + sentryOptions.anrProfilingSampleRate = 0.0 + assertFalse(sentryOptions.isAnrProfilingEnabled) + } + + @Test(expected = IllegalArgumentException::class) + fun `anr profiling rejects invalid sample rate`() { + val sentryOptions = SentryAndroidOptions() + sentryOptions.anrProfilingSampleRate = 2.0 + } + private class CustomDebugImagesLoader : IDebugImagesLoader { override fun loadDebugImages(): List? = null diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index b7fad8abee2..c0010fa64e3 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -29,6 +29,7 @@ import io.sentry.Session import io.sentry.ShutdownHookIntegration import io.sentry.SystemOutLogger import io.sentry.UncaughtExceptionHandlerIntegration +import io.sentry.android.core.anr.AnrProfilingIntegration import io.sentry.android.core.cache.AndroidEnvelopeCache import io.sentry.android.core.performance.AppStartMetrics import io.sentry.android.fragment.FragmentLifecycleIntegration @@ -476,7 +477,7 @@ class SentryAndroidTest { fixture.initSut(context = mock()) { options -> optionsRef = options options.dsn = "https://key@sentry.io/123" - assertEquals(18, options.integrations.size) + assertEquals(19, options.integrations.size) options.integrations.removeAll { it is UncaughtExceptionHandlerIntegration || it is ShutdownHookIntegration || @@ -485,6 +486,7 @@ class SentryAndroidTest { it is EnvelopeFileObserverIntegration || it is AppLifecycleIntegration || it is AnrIntegration || + it is AnrProfilingIntegration || it is ActivityLifecycleIntegration || it is ActivityBreadcrumbsIntegration || it is UserInteractionIntegration || diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrCulpritIdentifierTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrCulpritIdentifierTest.kt new file mode 100644 index 00000000000..c4c9c947c99 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrCulpritIdentifierTest.kt @@ -0,0 +1,167 @@ +package io.sentry.android.core.anr + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class AnrCulpritIdentifierTest { + + @Test + fun `returns null for empty dumps`() { + val dumps = emptyList() + val result = AnrCulpritIdentifier.identify(dumps) + assertNull(result) + } + + @Test + fun `identifies single stack trace`() { + val stackTraceElements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + val dumps = listOf(AnrStackTrace(1000, stackTraceElements)) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals(1, result.count) + assertEquals("com.example.MyClass", result.stack.first().className) + assertEquals(2, result.depth) + } + + @Test + fun `identifies most common, most detailed stack trace from multiple dumps`() { + val commonElements = + arrayOf( + StackTraceElement("com.example.CommonClass", "commonMethod1", "CommonClass.java", 42), + StackTraceElement("com.example.CommonClass", "commonMethod2", "CommonClass.java", 100), + ) + val rareElements = + arrayOf( + StackTraceElement("com.example.RareClass", "rareMethod", "RareClass.java", 50), + StackTraceElement("com.example.CommonClass", "commonMethod2", "CommonClass.java", 100), + ) + val dumps = + listOf( + AnrStackTrace(1000, commonElements), + AnrStackTrace(2000, commonElements), + AnrStackTrace(3000, rareElements), + ) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals(2, result.count) + assertEquals("com.example.CommonClass", result.stack.first().className) + assertEquals("commonMethod1", result.stack.first().methodName) + } + + @Test + fun `provides 0 quality score when stack only contains framework packages`() { + val frameworkElements = + arrayOf( + StackTraceElement("java.lang.Object", "wait", "Object.java", 42), + StackTraceElement("android.os.Handler", "handleMessage", "Handler.java", 100), + ) + val dumps = + listOf(AnrStackTrace(1000, frameworkElements), AnrStackTrace(2000, frameworkElements)) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals(0f, result.quality) + } + + @Test + fun `applies lower quality score to framework packages`() { + val frameworkElements = + arrayOf( + StackTraceElement("java.lang.Object", "wait", "Object.java", 42), + StackTraceElement("android.os.Handler", "handleMessage", "Handler.java", 100), + ) + val appElements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("android.os.Handler", "handleMessage", "Handler.java", 100), + ) + + val dumps = listOf(AnrStackTrace(1000, frameworkElements), AnrStackTrace(2000, appElements)) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals("com.example.MyClass", result.stack.first().className) + } + + @Test + fun `prefers deeper stack traces`() { + val shallowStack = + arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + val deepStack = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + StackTraceElement("com.example.ThirdClass", "method3", "ThirdClass.java", 150), + ) + val dumps = listOf(AnrStackTrace(1000, shallowStack), AnrStackTrace(2000, deepStack)) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals(3, result.depth) + assertEquals("com.example.MyClass", result.stack.first().className) + } + + @Test + fun `handles mixed framework and app code`() { + val mixedElements = + arrayOf( + StackTraceElement("com.example.Activity", "onCreate", "Activity.java", 42), + StackTraceElement("com.example.DataProcessor", "process", "DataProcessor.java", 100), + StackTraceElement("java.lang.Thread", "run", "Thread.java", 50), + ) + val dumps = listOf(AnrStackTrace(1000, mixedElements)) + + val result = AnrCulpritIdentifier.identify(dumps) + + assertNotNull(result) + assertEquals(2f / 3f, result.quality, 0.0001f) + assertEquals("com.example.Activity", result.stack.first().className) + } + + @Test + fun `isSystemFrame returns true for java lang packages`() { + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("java.lang.Object")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("java.lang.Thread")) + } + + @Test + fun `isSystemFrame returns true for java util packages`() { + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("java.util.ArrayList")) + } + + @Test + fun `isSystemFrame returns true for android packages`() { + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("android.app.Activity")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("android.os.Handler")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("android.os.Looper")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("android.view.View")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("android.widget.TextView")) + } + + @Test + fun `isSystemFrame returns true for internal android packages`() { + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("com.android.internal.os.ZygoteInit")) + assertEquals(true, AnrCulpritIdentifier.isSystemFrame("com.google.android.gms.common.api.Api")) + } + + @Test + fun `isSystemFrame returns false for app packages`() { + assertEquals(false, AnrCulpritIdentifier.isSystemFrame("com.example.MyClass")) + assertEquals(false, AnrCulpritIdentifier.isSystemFrame("io.sentry.samples.MainActivity")) + assertEquals(false, AnrCulpritIdentifier.isSystemFrame("org.myapp.Feature")) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileManagerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileManagerTest.kt new file mode 100644 index 00000000000..09ee720decc --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileManagerTest.kt @@ -0,0 +1,137 @@ +package io.sentry.android.core.anr + +import io.sentry.SentryOptions +import java.io.File +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue +import org.junit.Rule +import org.junit.rules.TemporaryFolder +import org.mockito.kotlin.mock + +class AnrProfileManagerTest { + @get:Rule val tmpDir = TemporaryFolder() + + private fun createOptions(): SentryOptions { + val options = SentryOptions() + options.cacheDirPath = tmpDir.newFolder().absolutePath + options.setLogger(mock()) + return options + } + + @Test + fun `can add and load stack traces`() { + // Arrange + val options = createOptions() + val manager = AnrProfileManager(options) + val stackTraceElements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + val trace = AnrStackTrace(1000, stackTraceElements) + + // Act + manager.add(trace) + val profile = manager.load() + + // Assert + assertNotNull(profile) + assertEquals(1, profile.stacks.size) + assertEquals(1000L, profile.stacks[0].timestampMs) + assertEquals(2, profile.stacks[0].stack.size) + } + + @Test + fun `can add multiple stack traces`() { + // Arrange + val options = createOptions() + val manager = AnrProfileManager(options) + val stackTraceElements1 = + arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + val stackTraceElements2 = + arrayOf(StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100)) + + // Act + manager.add(AnrStackTrace(1000, stackTraceElements1)) + manager.add(AnrStackTrace(2000, stackTraceElements2)) + val profile = manager.load() + + // Assert + assertNotNull(profile) + assertEquals(2, profile.stacks.size) + assertEquals(1000L, profile.stacks[0].timestampMs) + assertEquals(2000L, profile.stacks[1].timestampMs) + } + + @Test + fun `can clear all stack traces`() { + // Arrange + val options = createOptions() + val manager = AnrProfileManager(options) + val stackTraceElements = + arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + manager.add(AnrStackTrace(1000, stackTraceElements)) + + // Act + manager.clear() + val profile = manager.load() + + // Assert + assertTrue(profile.stacks.isEmpty()) + } + + @Test + fun `load empty profile when nothing added`() { + // Arrange + val options = createOptions() + val manager = AnrProfileManager(options) + + // Act + val profile = manager.load() + + // Assert + assertNotNull(profile) + assertTrue(profile.stacks.isEmpty()) + } + + @Test + fun `can deal with corrupt files`() { + // Arrange + val options = createOptions() + + val file = File(options.getCacheDirPath(), "anr_profile") + file.writeBytes("Hello World".toByteArray()) + + val manager = AnrProfileManager(options) + + // Act + val profile = manager.load() + + // Assert + assertNotNull(profile) + assertTrue(profile.stacks.isEmpty()) + } + + @Test + fun `persists profiles across manager instances`() { + // Arrange + val options = createOptions() + val stackTraceElements = + arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + // Act - add profile with first manager + var manager = AnrProfileManager(options) + manager.add(AnrStackTrace(1000, stackTraceElements)) + + // Create new manager instance from same cache dir + manager = AnrProfileManager(options) + val profile = manager.load() + + // Assert + assertNotNull(profile) + assertEquals(1, profile.stacks.size) + assertEquals(1000L, profile.stacks[0].timestampMs) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileRotationHelperTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileRotationHelperTest.kt new file mode 100644 index 00000000000..0d7d9556111 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfileRotationHelperTest.kt @@ -0,0 +1,113 @@ +package io.sentry.android.core.anr + +import java.io.File +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue +import org.junit.Rule +import org.junit.rules.TemporaryFolder + +class AnrProfileRotationHelperTest { + @get:Rule val tmpDir = TemporaryFolder() + + @BeforeTest + fun setup() { + AnrProfileRotationHelper.rotate() + } + + @Test + fun `getFileForRecording returns file with correct name`() { + val file = AnrProfileRotationHelper.getFileForRecording(tmpDir.root) + + assertEquals("anr_profile", file.name) + assertEquals(tmpDir.root, file.parentFile) + } + + @Test + fun `getLastFile returns last file`() { + val file = AnrProfileRotationHelper.getLastFile(tmpDir.root) + + assertEquals("anr_profile_old", file.name) + assertEquals(tmpDir.root, file.parentFile) + } + + @Test + fun `deleteLastFile returns true when file does not exist`() { + val result = AnrProfileRotationHelper.deleteLastFile(tmpDir.root) + + assertTrue(result) + } + + @Test + fun `deleteLastFile returns true when file is deleted successfully`() { + val lastFile = File(tmpDir.root, "anr_profile_old") + lastFile.writeText("test content") + assertTrue(lastFile.exists()) + + val result = AnrProfileRotationHelper.deleteLastFile(tmpDir.root) + + assertTrue(result) + assertFalse(lastFile.exists()) + } + + @Test + fun `rotate moves current file to last file`() { + val currentFile = File(tmpDir.root, "anr_profile") + currentFile.writeText("current content") + + val lastFile = AnrProfileRotationHelper.getLastFile(tmpDir.root) + + assertTrue(lastFile.exists()) + assertEquals("current content", lastFile.readText()) + } + + @Test + fun `rotate deletes existing last file before moving`() { + val currentFile = File(tmpDir.root, "anr_profile") + val lastFile = File(tmpDir.root, "anr_profile_old") + + lastFile.writeText("last content") + currentFile.writeText("current content") + + assertTrue(lastFile.exists()) + assertTrue(currentFile.exists()) + + val newLastFile = AnrProfileRotationHelper.getLastFile(tmpDir.root) + + assertTrue(newLastFile.exists()) + assertEquals("current content", newLastFile.readText()) + } + + @Test + fun `rotate does not directly perform file renaming`() { + val currentFile = File(tmpDir.root, "anr_profile") + currentFile.writeText("current") + + val lastFile = File(tmpDir.root, "anr_profile_old") + lastFile.writeText("last") + + AnrProfileRotationHelper.rotate() + + // content is still the same + assertEquals("current", currentFile.readText()) + assertEquals("last", lastFile.readText()) + + // but once rotated, the last file should now contain the current file's content + AnrProfileRotationHelper.getFileForRecording(tmpDir.root) + assertEquals("current", lastFile.readText()) + } + + @Test + fun `getFileForRecording triggers rotation when needed`() { + val currentFile = File(tmpDir.root, "anr_profile") + currentFile.writeText("content before rotation") + + AnrProfileRotationHelper.getFileForRecording(tmpDir.root) + + val lastFile = File(tmpDir.root, "anr_profile_old") + assertTrue(lastFile.exists()) + assertEquals("content before rotation", lastFile.readText()) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt new file mode 100644 index 00000000000..c07bb4d71bb --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt @@ -0,0 +1,313 @@ +package io.sentry.android.core.anr + +import android.os.SystemClock +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.ILogger +import io.sentry.IScopes +import io.sentry.SentryIntegrationPackageStorage +import io.sentry.SentryOptions +import io.sentry.android.core.AppState +import io.sentry.android.core.SentryAndroidOptions +import io.sentry.test.getProperty +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.junit.Rule +import org.junit.rules.TemporaryFolder +import org.junit.runner.RunWith +import org.mockito.kotlin.mock + +@RunWith(AndroidJUnit4::class) +class AnrProfilingIntegrationTest { + + @get:Rule val tmpDir = TemporaryFolder() + + private lateinit var mockScopes: IScopes + private lateinit var mockLogger: ILogger + private lateinit var options: SentryAndroidOptions + + @BeforeTest + fun setup() { + mockScopes = mock() + mockLogger = mock() + options = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = 1.0 + } + AppState.getInstance().resetInstance() + } + + @AfterTest + fun cleanup() { + AppState.getInstance().resetInstance() + } + + @Test + fun `onForeground starts monitoring thread`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + + integration.onForeground() + Thread.sleep(100) // Allow thread to start + + val thread = integration.getProperty("thread") + assertNotNull(thread) + assertTrue(thread.isAlive) + assertEquals("AnrProfilingIntegration", thread.name) + } + + @Test + fun `onBackground pauses monitoring thread`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + integration.onForeground() + Thread.sleep(100) + + val thread = integration.getProperty("thread") + assertNotNull(thread) + + integration.onBackground() + Thread.sleep(200) // Allow thread to enter wait state + + // Thread should still be alive but waiting + assertTrue(thread.isAlive) + + integration.close() + thread.join(2000) + assertFalse(thread.isAlive) + } + + @Test + fun `close disables integration and interrupts thread`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + integration.onForeground() + Thread.sleep(100) + + val thread = integration.getProperty("thread") + assertNotNull(thread) + + assertTrue(AppState.getInstance().lifecycleObserver.listeners.isNotEmpty()) + + integration.close() + thread.join(2000) + + assertTrue(!thread.isAlive) + val enabled = integration.getProperty("enabled") + assertTrue(!enabled.get()) + assertTrue(AppState.getInstance().lifecycleObserver.listeners.isEmpty()) + } + + @Test + fun `lifecycle methods have no influence after close`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + integration.close() + integration.onForeground() + integration.onBackground() + + val thread = integration.getProperty("thread") + assertTrue(thread == null || !thread.isAlive) + } + + @Test + fun `multiple foreground calls do not create multiple threads`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + + integration.onForeground() + Thread.sleep(100) + val thread1 = integration.getProperty("thread") + + integration.onForeground() + Thread.sleep(100) + val thread2 = integration.getProperty("thread") + + assertNotNull(thread1) + assertNotNull(thread2) + assertEquals(thread1, thread2, "Should reuse the same thread") + + integration.close() + } + + @Test + fun `foreground after background reuses thread`() { + val integration = AnrProfilingIntegration() + integration.register(mockScopes, options) + + integration.onForeground() + Thread.sleep(100) + val thread1 = integration.getProperty("thread") + + integration.onBackground() + integration.onForeground() + + Thread.sleep(100) + val thread2 = integration.getProperty("thread") + + assertNotNull(thread1) + assertNotNull(thread2) + assertSame(thread1, thread2, "Should reuse the same thread after background") + assertTrue(thread1.isAlive) + + integration.close() + } + + @Test + fun `properly walks through state transitions and collects stack traces`() { + val mainThread = Thread.currentThread() + SystemClock.setCurrentTimeMillis(1_00) + + val androidOptions = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = 1.0 + } + + val integration = AnrProfilingIntegration() + integration.register(mockScopes, androidOptions) + integration.onForeground() + + SystemClock.setCurrentTimeMillis(1_000) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.IDLE, integration.state) + assertTrue(integration.profileManager.load().stacks.isEmpty()) + + SystemClock.setCurrentTimeMillis(3_000) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.SUSPICIOUS, integration.state) + + SystemClock.setCurrentTimeMillis(6_000) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.ANR_DETECTED, integration.state) + assertEquals(2, integration.profileManager.load().stacks.size) + + for (i in 0 until AnrProfilingIntegration.MAX_NUM_STACKS + 1) { + integration.checkMainThread(mainThread) + } + assertEquals(AnrProfilingIntegration.MAX_NUM_STACKS, integration.numCollectedStacks.get()) + } + + @Test + fun `background foreground transitions don't trigger an ANR`() { + val mainThread = Thread.currentThread() + SystemClock.setCurrentTimeMillis(1_000) + + val androidOptions = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = 1.0 + } + + val integration = AnrProfilingIntegration() + integration.register(mockScopes, androidOptions) + integration.onBackground() + + SystemClock.setCurrentTimeMillis(20_000) + integration.onForeground() + + Thread.sleep(100) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.IDLE, integration.state) + } + + @Test + fun `does not register when options is not SentryAndroidOptions`() { + val plainOptions = + SentryOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + } + + val integration = AnrProfilingIntegration() + + try { + integration.register(mockScopes, plainOptions) + } catch (e: IllegalArgumentException) { + // ignored + } + + // Verify no listeners were added + val lifecycleObserver = AppState.getInstance().lifecycleObserver + if (lifecycleObserver != null) { + assertTrue(lifecycleObserver.listeners.isEmpty()) + } + } + + @Test + fun `does not register when ANR profiling is disabled`() { + val androidOptions = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = null + } + + val integration = AnrProfilingIntegration() + integration.register(mockScopes, androidOptions) + + // When ANR profiling is disabled, the integration doesn't add itself to AppState + // So the lifecycle observer may be null or have no listeners + val lifecycleObserver = AppState.getInstance().lifecycleObserver + if (lifecycleObserver != null) { + assertTrue(lifecycleObserver.listeners.isEmpty()) + } + } + + @Test + fun `does not collect stacks when sample rate is zero`() { + val mainThread = Thread.currentThread() + SystemClock.setCurrentTimeMillis(1_00) + + val androidOptions = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = 0.0 + } + + val integration = AnrProfilingIntegration() + integration.register(mockScopes, androidOptions) + integration.onForeground() + + // Transition to suspicious + SystemClock.setCurrentTimeMillis(3_000) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.SUSPICIOUS, integration.state) + + // Transition to ANR + SystemClock.setCurrentTimeMillis(6_000) + integration.checkMainThread(mainThread) + assertEquals(AnrProfilingIntegration.MainThreadState.ANR_DETECTED, integration.state) + + // No stacks should have been collected + assertEquals(0, integration.numCollectedStacks.get()) + } + + @Test + fun `registers when ANR profiling is enabled`() { + val androidOptions = + SentryAndroidOptions().apply { + cacheDirPath = tmpDir.root.absolutePath + setLogger(mockLogger) + anrProfilingSampleRate = 1.0 + } + + val integration = AnrProfilingIntegration() + integration.register(mockScopes, androidOptions) + + assertFalse(AppState.getInstance().lifecycleObserver.listeners.isEmpty()) + assertTrue(SentryIntegrationPackageStorage.getInstance().integrations.contains("AnrProfiling")) + + integration.close() + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceConverterTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceConverterTest.kt new file mode 100644 index 00000000000..f48f1674166 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceConverterTest.kt @@ -0,0 +1,197 @@ +package io.sentry.android.core.anr + +import org.junit.Assert +import org.junit.Test + +class AnrStackTraceConverterTest { + @Test + fun testConvertSimpleStackTrace() { + val elements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + + val anrStackTrace = AnrStackTrace(1000, elements) + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(anrStackTrace) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + Assert.assertNotNull(profile) + Assert.assertEquals(1, profile.samples.size) + Assert.assertEquals(2, profile.frames.size) + Assert.assertEquals(1, profile.stacks.size) + + val frame0 = profile.frames[0] + Assert.assertEquals("MyClass.java", frame0.filename) + Assert.assertEquals("method1", frame0.function) + Assert.assertEquals("com.example.MyClass", frame0.module) + Assert.assertEquals(42, frame0.lineno) + + val frame1 = profile.frames[1] + Assert.assertEquals("AnotherClass.java", frame1.filename) + Assert.assertEquals("method2", frame1.function) + Assert.assertEquals("com.example.AnotherClass", frame1.module) + Assert.assertEquals(100, frame1.lineno) + + val stack = profile.stacks[0] + Assert.assertEquals(2, stack.size) + Assert.assertEquals(0, (stack[0] as Int)) + Assert.assertEquals(1, (stack[1] as Int)) + + val sample = profile.samples[0] + Assert.assertEquals(0, sample.stackId) + Assert.assertEquals("0", sample.threadId) + Assert.assertEquals(1.0, sample.timestamp, 0.001) // 1000ms = 1s + } + + @Test + fun testFrameDeduplication() { + // Create two stack traces with duplicate frames + val elements1 = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + + val elements2 = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.ThirdClass", "method3", "ThirdClass.java", 200), + ) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(1000, elements1)) + anrStackTraces.add(AnrStackTrace(2000, elements2)) + + // Convert to profile + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + // Should have 3 frames total (dedup removes duplicate) + Assert.assertEquals(3, profile.frames.size) + + // First sample uses stack [0, 1] + val stack1 = profile.stacks[0] + Assert.assertEquals(2, stack1.size) + Assert.assertEquals(0, (stack1[0] as Int)) + Assert.assertEquals(1, (stack1[1] as Int)) + + // Second sample uses stack [0, 2] (frame 0 reused) + val stack2 = profile.stacks[1] + Assert.assertEquals(2, stack2.size) + Assert.assertEquals(0, (stack2[0] as Int)) + Assert.assertEquals(2, (stack2[1] as Int)) + } + + @Test + fun testStackDeduplication() { + // Create two stack traces with identical frames in same order + val elements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(1000, elements)) + anrStackTraces.add(AnrStackTrace(2000, elements.clone())) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + // Should have 2 frames and 1 stack (dedup stack) + Assert.assertEquals(2, profile.frames.size) + Assert.assertEquals(1, profile.stacks.size) + + // Both samples should reference the same stack + Assert.assertEquals(0, profile.samples[0].stackId) + Assert.assertEquals(0, profile.samples[1].stackId) + } + + @Test + fun testTimestampConversion() { + val elements = arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + val timestampsMs = longArrayOf(1000, 1500, 5000) + val anrStackTraces: MutableList = ArrayList() + + for (ts in timestampsMs) { + anrStackTraces.add(AnrStackTrace(ts, elements)) + } + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + Assert.assertEquals(1.0, profile.samples[0].timestamp, 0.001) + Assert.assertEquals(1.5, profile.samples[1].timestamp, 0.001) + Assert.assertEquals(5.0, profile.samples[2].timestamp, 0.001) + } + + @Test + fun testNativeMethodHandling() { + val elements = arrayOf(StackTraceElement("java.lang.System", "doSomething", null, -2)) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(1000, elements)) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + val frame = profile.frames[0] + Assert.assertTrue(frame.isNative()!!) + } + + @Test + fun testThreadMetadata() { + val elements = arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(1000, elements)) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + val threadMetadata = profile.threadMetadata["0"] + Assert.assertNotNull(threadMetadata) + Assert.assertEquals("main", threadMetadata!!.name) + Assert.assertEquals(Thread.NORM_PRIORITY, threadMetadata.priority) + } + + @Test + fun testEmptyStackTraceList() { + val anrStackTraces: MutableList = ArrayList() + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + Assert.assertNotNull(profile) + Assert.assertEquals(0, profile.samples.size) + Assert.assertEquals(0, profile.frames.size) + Assert.assertEquals(0, profile.stacks.size) + Assert.assertTrue(profile.threadMetadata.containsKey("0")) + } + + @Test + fun testSampleProperties() { + val elements = arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(12345, elements)) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + val sample = profile.samples[0] + Assert.assertEquals("0", sample.threadId) + Assert.assertEquals(0, sample.stackId) + Assert.assertEquals(12.345, sample.timestamp, 0.001) + } + + @Test + fun testInAppFrameFlag() { + val elements = arrayOf(StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42)) + + val anrStackTraces: MutableList = ArrayList() + anrStackTraces.add(AnrStackTrace(1000, elements)) + + val profile = StackTraceConverter.convert(AnrProfile(anrStackTraces)) + + val frame = profile.frames[0] + Assert.assertNull(frame.isInApp()) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceTest.kt new file mode 100644 index 00000000000..e53ad507bc1 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrStackTraceTest.kt @@ -0,0 +1,127 @@ +package io.sentry.android.core.anr + +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.io.DataInputStream +import java.io.DataOutputStream +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class AnrStackTraceTest { + + @Test + fun `serialize and deserialize preserves stack trace data`() { + val stackTraceElements = + arrayOf( + StackTraceElement("com.example.MyClass", "method1", null, 42), + StackTraceElement("com.example.MyClass", "method1", "", 42), + StackTraceElement("com.example.AnotherClass", "method2", "AnotherClass.java", 100), + ) + val original = AnrStackTrace(1234567890L, stackTraceElements) + + val bytes = ByteArrayOutputStream() + val dos = DataOutputStream(bytes) + original.serialize(dos) + dos.flush() + + val dis = DataInputStream(ByteArrayInputStream(bytes.toByteArray())) + val deserialized = AnrStackTrace.deserialize(dis) + + assertNotNull(deserialized) + assertEquals(original.timestampMs, deserialized.timestampMs) + assertEquals(original.stack.size, deserialized.stack.size) + + for (i in original.stack.indices) { + assertEquals(original.stack[i].className, deserialized.stack[i].className) + assertEquals(original.stack[i].methodName, deserialized.stack[i].methodName) + assertEquals(original.stack[i].fileName, deserialized.stack[i].fileName) + assertEquals(original.stack[i].lineNumber, deserialized.stack[i].lineNumber) + } + } + + @Test + fun `compareTo sorts by timestamp ascending`() { + val trace1 = AnrStackTrace(3000L, emptyArray()) + val trace2 = AnrStackTrace(1000L, emptyArray()) + val trace3 = AnrStackTrace(2000L, emptyArray()) + + val list = listOf(trace3, trace1, trace2) + val sorted = list.sorted() + + assertEquals(1000L, sorted[0].timestampMs) + assertEquals(2000L, sorted[1].timestampMs) + assertEquals(3000L, sorted[2].timestampMs) + } + + @Test + fun `serialize and deserialize handles empty stack`() { + val original = AnrStackTrace(1234567890L, emptyArray()) + + val bytes = ByteArrayOutputStream() + val dos = DataOutputStream(bytes) + original.serialize(dos) + dos.flush() + + val dis = DataInputStream(ByteArrayInputStream(bytes.toByteArray())) + val deserialized = AnrStackTrace.deserialize(dis) + + assertNotNull(deserialized) + assertEquals(0, deserialized.stack.size) + assertEquals(original.timestampMs, deserialized.timestampMs) + } + + @Test + fun `serialize and deserialize handles native methods with no line number`() { + val stackTraceElements = + arrayOf( + StackTraceElement("java.lang.reflect.Method", "invoke", null, -2), + StackTraceElement("com.example.MyClass", "method1", "MyClass.java", 42), + ) + val original = AnrStackTrace(1234567890L, stackTraceElements) + + val bytes = ByteArrayOutputStream() + val dos = DataOutputStream(bytes) + original.serialize(dos) + dos.flush() + + val dis = DataInputStream(ByteArrayInputStream(bytes.toByteArray())) + val deserialized = AnrStackTrace.deserialize(dis) + + assertNotNull(deserialized) + assertEquals(-2, deserialized.stack[0].lineNumber) + assertNull(deserialized.stack[0].fileName) + assertEquals(42, deserialized.stack[1].lineNumber) + } + + @Test + fun `deserialize returns null for oversized stack length`() { + val bytes = ByteArrayOutputStream() + val dos = DataOutputStream(bytes) + dos.writeShort(1) // version + dos.writeLong(1234567890L) // timestamp + dos.writeInt(1001) // stackLength exceeds MAX_STACK_LENGTH + dos.flush() + + val dis = DataInputStream(ByteArrayInputStream(bytes.toByteArray())) + val deserialized = AnrStackTrace.deserialize(dis) + + assertNull(deserialized) + } + + @Test + fun `deserialize returns null for negative stack length`() { + val bytes = ByteArrayOutputStream() + val dos = DataOutputStream(bytes) + dos.writeShort(1) // version + dos.writeLong(1234567890L) // timestamp + dos.writeInt(-1) // negative stackLength + dos.flush() + + val dis = DataInputStream(ByteArrayInputStream(bytes.toByteArray())) + val deserialized = AnrStackTrace.deserialize(dis) + + assertNull(deserialized) + } +} diff --git a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt index e15347095f6..89013c430dd 100644 --- a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt +++ b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt @@ -1,5 +1,6 @@ package io.sentry.android.distribution +import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.SentryOptions import io.sentry.UpdateStatus import org.junit.Assert.assertEquals @@ -7,9 +8,8 @@ import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.robolectric.RobolectricTestRunner -@RunWith(RobolectricTestRunner::class) +@RunWith(AndroidJUnit4::class) class UpdateResponseParserTest { private lateinit var options: SentryOptions diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 690401e44e3..d73a3150f0a 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -253,7 +253,7 @@ - + + diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index c8b194f32d3..0b8171da631 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -7757,6 +7757,7 @@ public final class io/sentry/util/StringUtils { public static fun camelCase (Ljava/lang/String;)Ljava/lang/String; public static fun capitalize (Ljava/lang/String;)Ljava/lang/String; public static fun countOf (Ljava/lang/String;C)I + public static fun getOrEmpty (Ljava/lang/String;)Ljava/lang/String; public static fun getStringAfterDot (Ljava/lang/String;)Ljava/lang/String; public static fun join (Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String; public static fun normalizeUUID (Ljava/lang/String;)Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/ProfileChunk.java b/sentry/src/main/java/io/sentry/ProfileChunk.java index 0aa6b7e524d..a6145ca8e9a 100644 --- a/sentry/src/main/java/io/sentry/ProfileChunk.java +++ b/sentry/src/main/java/io/sentry/ProfileChunk.java @@ -34,7 +34,7 @@ public final class ProfileChunk implements JsonUnknown, JsonSerializable { private @NotNull String version; private double timestamp; - private final @NotNull File traceFile; + private final @Nullable File traceFile; /** Profile trace encoded with Base64. */ private @Nullable String sampledProfile = null; @@ -47,7 +47,7 @@ public ProfileChunk() { this( SentryId.EMPTY_ID, SentryId.EMPTY_ID, - new File("dummy"), + null, new HashMap<>(), 0.0, PLATFORM_ANDROID, @@ -57,7 +57,7 @@ public ProfileChunk() { public ProfileChunk( final @NotNull SentryId profilerId, final @NotNull SentryId chunkId, - final @NotNull File traceFile, + final @Nullable File traceFile, final @NotNull Map measurements, final @NotNull Double timestamp, final @NotNull String platform, @@ -119,7 +119,7 @@ public void setSampledProfile(final @Nullable String sampledProfile) { this.sampledProfile = sampledProfile; } - public @NotNull File getTraceFile() { + public @Nullable File getTraceFile() { return traceFile; } diff --git a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java index 58d150886d3..dd47d2b99d0 100644 --- a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java +++ b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java @@ -302,42 +302,44 @@ private static void ensureAttachmentSizeLimit( final @NotNull IProfileConverter profileConverter) throws SentryEnvelopeException { - final @NotNull File traceFile = profileChunk.getTraceFile(); + final @Nullable File traceFile = profileChunk.getTraceFile(); // Using CachedItem, so we read the trace file in the background final CachedItem cachedItem = new CachedItem( () -> { - if (!traceFile.exists()) { - throw new SentryEnvelopeException( - String.format( - "Dropping profile chunk, because the file '%s' doesn't exists", - traceFile.getName())); - } + if (traceFile != null) { + if (!traceFile.exists()) { + throw new SentryEnvelopeException( + String.format( + "Dropping profile chunk, because the file '%s' doesn't exists", + traceFile.getName())); + } - if (ProfileChunk.PLATFORM_JAVA.equals(profileChunk.getPlatform())) { - if (!NoOpProfileConverter.getInstance().equals(profileConverter)) { - try { - final SentryProfile profile = - profileConverter.convertFromFile(traceFile.getAbsolutePath()); - profileChunk.setSentryProfile(profile); - } catch (Exception e) { - throw new SentryEnvelopeException("Profile conversion failed", e); + if (ProfileChunk.PLATFORM_JAVA.equals(profileChunk.getPlatform())) { + if (!NoOpProfileConverter.getInstance().equals(profileConverter)) { + try { + final SentryProfile profile = + profileConverter.convertFromFile(traceFile.getAbsolutePath()); + profileChunk.setSentryProfile(profile); + } catch (Exception e) { + throw new SentryEnvelopeException("Profile conversion failed", e); + } + } else { + throw new SentryEnvelopeException( + "No ProfileConverter available, dropping chunk."); } } else { - throw new SentryEnvelopeException( - "No ProfileConverter available, dropping chunk."); - } - } else { - // The payload of the profile item is a json including the trace file encoded with - // base64 - final byte[] traceFileBytes = - readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); - final @NotNull String base64Trace = - Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); - if (base64Trace.isEmpty()) { - throw new SentryEnvelopeException("Profiling trace file is empty"); + // The payload of the profile item is a json including the trace file encoded with + // base64 + final byte[] traceFileBytes = + readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); + final @NotNull String base64Trace = + Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); + if (base64Trace.isEmpty()) { + throw new SentryEnvelopeException("Profiling trace file is empty"); + } + profileChunk.setSampledProfile(base64Trace); } - profileChunk.setSampledProfile(base64Trace); } try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); @@ -349,7 +351,9 @@ private static void ensureAttachmentSizeLimit( String.format("Failed to serialize profile chunk\n%s", e.getMessage())); } finally { // In any case we delete the trace file - traceFile.delete(); + if (traceFile != null) { + traceFile.delete(); + } } }); @@ -358,7 +362,7 @@ private static void ensureAttachmentSizeLimit( SentryItemType.ProfileChunk, () -> cachedItem.getBytes().length, "application-json", - traceFile.getName(), + traceFile != null ? traceFile.getName() : null, null, profileChunk.getPlatform(), null); diff --git a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java index d47776a1627..cd4ab1cc0e9 100644 --- a/sentry/src/main/java/io/sentry/SentryExceptionFactory.java +++ b/sentry/src/main/java/io/sentry/SentryExceptionFactory.java @@ -172,9 +172,9 @@ Deque extractExceptionQueueInternal( final List frames = sentryStackTraceFactory.getStackFrames( currentThrowable.getStackTrace(), includeSentryFrames); + final @Nullable Long threadId = thread != null ? thread.getId() : null; SentryException exception = - getSentryException( - currentThrowable, exceptionMechanism, thread.getId(), frames, snapshot); + getSentryException(currentThrowable, exceptionMechanism, threadId, frames, snapshot); exceptions.addFirst(exception); if (exceptionMechanism.getType() == null) { diff --git a/sentry/src/main/java/io/sentry/exception/ExceptionMechanismException.java b/sentry/src/main/java/io/sentry/exception/ExceptionMechanismException.java index 5cfeb747dd2..5df6d473f78 100644 --- a/sentry/src/main/java/io/sentry/exception/ExceptionMechanismException.java +++ b/sentry/src/main/java/io/sentry/exception/ExceptionMechanismException.java @@ -4,6 +4,7 @@ import io.sentry.util.Objects; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A throwable decorator that holds an {@link io.sentry.protocol.Mechanism} related to the decorated @@ -15,7 +16,7 @@ public final class ExceptionMechanismException extends RuntimeException { private final @NotNull Mechanism exceptionMechanism; private final @NotNull Throwable throwable; - private final @NotNull Thread thread; + private final @Nullable Thread thread; private final boolean snapshot; /** @@ -29,11 +30,11 @@ public final class ExceptionMechanismException extends RuntimeException { public ExceptionMechanismException( final @NotNull Mechanism mechanism, final @NotNull Throwable throwable, - final @NotNull Thread thread, + final @Nullable Thread thread, final boolean snapshot) { exceptionMechanism = Objects.requireNonNull(mechanism, "Mechanism is required."); this.throwable = Objects.requireNonNull(throwable, "Throwable is required."); - this.thread = Objects.requireNonNull(thread, "Thread is required."); + this.thread = thread; this.snapshot = snapshot; } @@ -47,7 +48,7 @@ public ExceptionMechanismException( public ExceptionMechanismException( final @NotNull Mechanism mechanism, final @NotNull Throwable throwable, - final @NotNull Thread thread) { + final @Nullable Thread thread) { this(mechanism, throwable, thread, false); } @@ -74,7 +75,7 @@ public ExceptionMechanismException( * * @return the Thread */ - public @NotNull Thread getThread() { + public @Nullable Thread getThread() { return thread; } diff --git a/sentry/src/main/java/io/sentry/util/StringUtils.java b/sentry/src/main/java/io/sentry/util/StringUtils.java index 14c247e71d2..66e3a95ddb7 100644 --- a/sentry/src/main/java/io/sentry/util/StringUtils.java +++ b/sentry/src/main/java/io/sentry/util/StringUtils.java @@ -26,6 +26,14 @@ public final class StringUtils { private StringUtils() {} + public static @NotNull String getOrEmpty(final @Nullable String str) { + if (str == null) { + return ""; + } else { + return str; + } + } + public static @Nullable String getStringAfterDot(final @Nullable String str) { if (str != null) { final int lastDotIndex = str.lastIndexOf("."); From dde4bad1b0d838086a9d0b949f782b79c3268a85 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian <17258265+lcian@users.noreply.github.com> Date: Mon, 9 Mar 2026 12:23:19 +0100 Subject: [PATCH 040/391] meta(gh): Remove myself from CODEOWNERS (#5177) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b01358a8742..4a3ed92029f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @adinauer @romtsn @markushi @lcian +* @adinauer @romtsn @markushi From 08ffa5a5299b9de520ca5bf6b0b5c19afa5634e8 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Mon, 9 Mar 2026 13:07:12 +0100 Subject: [PATCH 041/391] fix: remove the dependency on protobuf-lite for tombstones (#5157) * fix: remove the dependency on protobuf-lite for tombstones * update changelog * gate the close() on the underlying input stream * add scheduled GHA workflow to check for changes in the tombstone protobuf schema --- .../check-tombstone-proto-schema.yml | 16 + CHANGELOG.md | 1 + gradle/libs.versions.toml | 5 +- scripts/check-tombstone-proto-schema.sh | 25 ++ sentry-android-core/build.gradle.kts | 10 +- sentry-android-core/proguard-rules.pro | 3 - .../internal/tombstone/TombstoneParser.java | 138 ++++--- .../core/internal/tombstone/tombstone.proto | 218 ----------- .../internal/tombstone/TombstoneParserTest.kt | 356 +++++++++--------- 9 files changed, 294 insertions(+), 478 deletions(-) create mode 100644 .github/workflows/check-tombstone-proto-schema.yml create mode 100755 scripts/check-tombstone-proto-schema.sh delete mode 100644 sentry-android-core/src/main/proto/io/sentry/android/core/internal/tombstone/tombstone.proto diff --git a/.github/workflows/check-tombstone-proto-schema.yml b/.github/workflows/check-tombstone-proto-schema.yml new file mode 100644 index 00000000000..9234be0c429 --- /dev/null +++ b/.github/workflows/check-tombstone-proto-schema.yml @@ -0,0 +1,16 @@ +name: Check Tombstone Proto Schema + +on: + schedule: + - cron: '0 9 * * *' + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Check for newer Tombstone proto schema + run: ./scripts/check-tombstone-proto-schema.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 503d58a4eda..21fcd2aac74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Common: Finalize previous session even when auto session tracking is disabled ([#5154](https://github.com/getsentry/sentry-java/pull/5154)) - Android: Add `filterTouchesWhenObscured` to prevent Tapjacking on user feedback dialog ([#5155](https://github.com/getsentry/sentry-java/pull/5155)) - Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153)) +- Android: Remove the dependency on protobuf-lite for tombstones ([#5157](https://github.com/getsentry/sentry-java/pull/5157)) ## 8.34.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd2a471f695..61fbefd9152 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -41,7 +41,6 @@ spotless = "7.0.4" gummyBears = "0.12.0" camerax = "1.3.0" openfeature = "1.18.2" -protobuf = "3.25.8" [plugins] kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } @@ -61,7 +60,6 @@ spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.8" } jacoco-android = { id = "com.mxalbert.gradle.jacoco-android", version = "0.2.0" } kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } -protobuf = { id = "com.google.protobuf", version = "0.9.5" } vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } springboot2 = { id = "org.springframework.boot", version.ref = "springboot2" } springboot3 = { id = "org.springframework.boot", version.ref = "springboot3" } @@ -145,8 +143,7 @@ otel-javaagent-extension-api = { module = "io.opentelemetry.javaagent:openteleme otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", version.ref = "otelSemanticConventions" } otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" } p6spy = { module = "p6spy:p6spy", version = "3.9.1" } -protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf"} -protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" } +epitaph = { module = "com.abovevacant:epitaph", version = "0.1.0" } quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } diff --git a/scripts/check-tombstone-proto-schema.sh b/scripts/check-tombstone-proto-schema.sh new file mode 100755 index 00000000000..abb7212c4af --- /dev/null +++ b/scripts/check-tombstone-proto-schema.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +TRACKED_COMMIT="981d145117e8992842cdddee555c57e60c7a220a" + +# tail -n +2 to remove the magic anti-XSSI prefix from the Gitiles JSON response +LATEST_COMMIT=$(curl -sf \ + 'https://android.googlesource.com/platform/system/core/+log/refs/heads/main/debuggerd/proto/tombstone.proto?format=JSON' \ + | tail -n +2 \ + | jq -r '.log[0].commit') + +if [ -z "$LATEST_COMMIT" ] || [ "$LATEST_COMMIT" = "null" ]; then + echo "ERROR: Failed to fetch latest commit from Gitiles" >&2 + exit 1 +fi + +echo "Tracked commit: $TRACKED_COMMIT" +echo "Latest commit: $LATEST_COMMIT" + +if [ "$LATEST_COMMIT" != "$TRACKED_COMMIT" ]; then + echo "Schema has been updated! Latest: https://android.googlesource.com/platform/system/core/+/${LATEST_COMMIT}/debuggerd/proto/tombstone.proto" + exit 1 +fi + +echo "Schema is up to date." diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 23dc964d3d6..1134e948226 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -8,7 +8,6 @@ plugins { alias(libs.plugins.jacoco.android) alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) - alias(libs.plugins.protobuf) } android { @@ -84,7 +83,7 @@ dependencies { implementation(libs.androidx.lifecycle.common.java8) implementation(libs.androidx.lifecycle.process) implementation(libs.androidx.core) - implementation(libs.protobuf.javalite) + implementation(libs.epitaph) errorprone(libs.errorprone.core) errorprone(libs.nopen.checker) @@ -113,10 +112,3 @@ dependencies { testRuntimeOnly(libs.androidx.fragment.ktx) testRuntimeOnly(libs.timber) } - -protobuf { - protoc { artifact = libs.protoc.get().toString() } - generateProtoTasks { - all().forEach { task -> task.builtins { create("java") { option("lite") } } } - } -} diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index 2b49c949db9..aca674442bf 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -54,9 +54,6 @@ -keepnames class io.sentry.android.core.ApplicationNotResponding -# protobuf-java lite -# https://github.com/protocolbuffers/protobuf/blob/5d876c9fec1a6f2feb0750694f803f89312bffff/java/lite.md#r8-rule-to-make-production-app-builds-work --keep class * extends com.google.protobuf.GeneratedMessageLite { *; } ##---------------End: proguard configuration for android-core ---------- diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java index 3235b566556..1f142b52c9a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java @@ -1,6 +1,13 @@ package io.sentry.android.core.internal.tombstone; import androidx.annotation.NonNull; +import com.abovevacant.epitaph.core.BacktraceFrame; +import com.abovevacant.epitaph.core.MemoryMapping; +import com.abovevacant.epitaph.core.Register; +import com.abovevacant.epitaph.core.Signal; +import com.abovevacant.epitaph.core.Tombstone; +import com.abovevacant.epitaph.core.TombstoneThread; +import com.abovevacant.epitaph.wire.TombstoneDecoder; import io.sentry.SentryEvent; import io.sentry.SentryLevel; import io.sentry.SentryStackTraceFactory; @@ -27,7 +34,7 @@ public class TombstoneParser implements Closeable { - private final InputStream tombstoneStream; + @Nullable private final InputStream tombstoneStream; @NotNull private final List inAppIncludes; @NotNull private final List inAppExcludes; @Nullable private final String nativeLibraryDir; @@ -38,7 +45,14 @@ private static String formatHex(long value) { } public TombstoneParser( - @NonNull final InputStream tombstoneStream, + @NotNull List inAppIncludes, + @NotNull List inAppExcludes, + @Nullable String nativeLibraryDir) { + this(null, inAppIncludes, inAppExcludes, nativeLibraryDir); + } + + public TombstoneParser( + @Nullable final InputStream tombstoneStream, @NotNull List inAppIncludes, @NotNull List inAppExcludes, @Nullable String nativeLibraryDir) { @@ -58,10 +72,14 @@ public TombstoneParser( @NonNull public SentryEvent parse() throws IOException { - @NonNull - final TombstoneProtos.Tombstone tombstone = - TombstoneProtos.Tombstone.parseFrom(tombstoneStream); + if (tombstoneStream == null) { + throw new IOException("No InputStream provided; use parse(Tombstone) instead."); + } + return parse(TombstoneDecoder.decode(tombstoneStream)); + } + @NonNull + public SentryEvent parse(@NonNull final Tombstone tombstone) { final SentryEvent event = new SentryEvent(); event.setLevel(SentryLevel.FATAL); @@ -79,19 +97,18 @@ public SentryEvent parse() throws IOException { @NonNull private List createThreads( - @NonNull final TombstoneProtos.Tombstone tombstone, @NonNull final SentryException exc) { + @NonNull final Tombstone tombstone, @NonNull final SentryException exc) { final List threads = new ArrayList<>(); - for (Map.Entry threadEntry : - tombstone.getThreadsMap().entrySet()) { - final TombstoneProtos.Thread threadEntryValue = threadEntry.getValue(); + for (Map.Entry threadEntry : tombstone.threads.entrySet()) { + final TombstoneThread threadEntryValue = threadEntry.getValue(); final SentryThread thread = new SentryThread(); thread.setId(Long.valueOf(threadEntry.getKey())); - thread.setName(threadEntryValue.getName()); + thread.setName(threadEntryValue.name); final SentryStackTrace stacktrace = createStackTrace(threadEntryValue); thread.setStacktrace(stacktrace); - if (tombstone.getTid() == threadEntryValue.getId()) { + if (tombstone.tid == threadEntryValue.id) { thread.setCrashed(true); // even though we refer to the thread_id from the exception, // the backend currently requires a stack-trace in exception @@ -104,30 +121,30 @@ private List createThreads( } @NonNull - private SentryStackTrace createStackTrace(@NonNull final TombstoneProtos.Thread thread) { + private SentryStackTrace createStackTrace(@NonNull final TombstoneThread thread) { final List frames = new ArrayList<>(); - for (TombstoneProtos.BacktraceFrame frame : thread.getCurrentBacktraceList()) { - if (frame.getFileName().endsWith("libart.so")) { + for (BacktraceFrame frame : thread.backtrace) { + if (frame.fileName.endsWith("libart.so")) { // We ignore all ART frames for time being because they aren't actionable for app developers continue; } - if (frame.getFileName().startsWith(" registers = new HashMap<>(); - for (TombstoneProtos.Register register : thread.getRegistersList()) { - registers.put(register.getName(), formatHex(register.getU64())); + for (Register register : thread.registers) { + registers.put(register.name, formatHex(register.value)); } stacktrace.setRegisters(registers); @@ -160,17 +177,17 @@ private SentryStackTrace createStackTrace(@NonNull final TombstoneProtos.Thread } @NonNull - private List createException(@NonNull TombstoneProtos.Tombstone tombstone) { + private List createException(@NonNull Tombstone tombstone) { final SentryException exception = new SentryException(); - if (tombstone.hasSignalInfo()) { - final TombstoneProtos.Signal signalInfo = tombstone.getSignalInfo(); - exception.setType(signalInfo.getName()); - exception.setValue(excTypeValueMap.get(signalInfo.getName())); + if (tombstone.hasSignal()) { + final Signal signalInfo = tombstone.signal; + exception.setType(signalInfo.name); + exception.setValue(excTypeValueMap.get(signalInfo.name)); exception.setMechanism(createMechanismFromSignalInfo(signalInfo)); } - exception.setThreadId((long) tombstone.getTid()); + exception.setThreadId((long) tombstone.tid); final List exceptions = new ArrayList<>(1); exceptions.add(exception); @@ -178,8 +195,7 @@ private List createException(@NonNull TombstoneProtos.Tombstone } @NonNull - private static Mechanism createMechanismFromSignalInfo( - @NonNull final TombstoneProtos.Signal signalInfo) { + private static Mechanism createMechanismFromSignalInfo(@NonNull final Signal signalInfo) { final Mechanism mechanism = new Mechanism(); mechanism.setType(NativeExceptionMechanism.TOMBSTONE.getValue()); @@ -187,38 +203,38 @@ private static Mechanism createMechanismFromSignalInfo( mechanism.setSynthetic(true); final Map meta = new HashMap<>(); - meta.put("number", signalInfo.getNumber()); - meta.put("name", signalInfo.getName()); - meta.put("code", signalInfo.getCode()); - meta.put("code_name", signalInfo.getCodeName()); + meta.put("number", signalInfo.number); + meta.put("name", signalInfo.name); + meta.put("code", signalInfo.code); + meta.put("code_name", signalInfo.codeName); mechanism.setMeta(meta); return mechanism; } @NonNull - private Message constructMessage(@NonNull final TombstoneProtos.Tombstone tombstone) { + private Message constructMessage(@NonNull final Tombstone tombstone) { final Message message = new Message(); - final TombstoneProtos.Signal signalInfo = tombstone.getSignalInfo(); + final Signal signalInfo = tombstone.signal; // reproduce the message `debuggerd` would use to dump the stack trace in logcat - String command = String.join(" ", tombstone.getCommandLineList()); - if (tombstone.hasSignalInfo()) { - String abortMessage = tombstone.getAbortMessage(); + String command = String.join(" ", tombstone.commandLine); + if (tombstone.hasSignal()) { + String abortMessage = tombstone.abortMessage; message.setFormatted( String.format( Locale.ROOT, "%sFatal signal %s (%d), %s (%d), pid = %d (%s)", !abortMessage.isEmpty() ? abortMessage + ": " : "", - signalInfo.getName(), - signalInfo.getNumber(), - signalInfo.getCodeName(), - signalInfo.getCode(), - tombstone.getPid(), + signalInfo.name, + signalInfo.number, + signalInfo.codeName, + signalInfo.code, + tombstone.pid, command)); } else { message.setFormatted( - String.format(Locale.ROOT, "Fatal exit pid = %d (%s)", tombstone.getPid(), command)); + String.format(Locale.ROOT, "Fatal exit pid = %d (%s)", tombstone.pid, command)); } return message; @@ -236,11 +252,11 @@ private static class ModuleAccumulator { long beginAddress; long endAddress; - ModuleAccumulator(TombstoneProtos.MemoryMapping mapping) { - this.mappingName = mapping.getMappingName(); - this.buildId = mapping.getBuildId(); - this.beginAddress = mapping.getBeginAddress(); - this.endAddress = mapping.getEndAddress(); + ModuleAccumulator(MemoryMapping mapping) { + this.mappingName = mapping.mappingName; + this.buildId = mapping.buildId; + this.beginAddress = mapping.beginAddress; + this.endAddress = mapping.endAddress; } void extendTo(long newEndAddress) { @@ -266,7 +282,7 @@ DebugImage toDebugImage() { } } - private DebugMeta createDebugMeta(@NonNull final TombstoneProtos.Tombstone tombstone) { + private DebugMeta createDebugMeta(@NonNull final Tombstone tombstone) { final List images = new ArrayList<>(); // Coalesce memory mappings into modules similar to how sentry-native does it. @@ -277,27 +293,27 @@ private DebugMeta createDebugMeta(@NonNull final TombstoneProtos.Tombstone tombs // combined with non-empty build_id as a proxy for this check. ModuleAccumulator currentModule = null; - for (TombstoneProtos.MemoryMapping mapping : tombstone.getMemoryMappingsList()) { + for (MemoryMapping mapping : tombstone.memoryMappings) { // Skip mappings that are not readable - if (!mapping.getRead()) { + if (!mapping.read) { continue; } // Skip mappings with empty name or in /dev/ - final String mappingName = mapping.getMappingName(); + final String mappingName = mapping.mappingName; if (mappingName.isEmpty() || mappingName.startsWith("/dev/")) { continue; } - final boolean hasBuildId = !mapping.getBuildId().isEmpty(); - final boolean isFileStart = mapping.getOffset() == 0; + final boolean hasBuildId = !mapping.buildId.isEmpty(); + final boolean isFileStart = mapping.offset == 0; if (hasBuildId && isFileStart) { // Check for duplicated mappings: On Android, the same ELF can have multiple // mappings at offset 0 with different permissions (r--p, r-xp, r--p). // If it's the same file as the current module, just extend it. if (currentModule != null && mappingName.equals(currentModule.mappingName)) { - currentModule.extendTo(mapping.getEndAddress()); + currentModule.extendTo(mapping.endAddress); continue; } @@ -313,7 +329,7 @@ private DebugMeta createDebugMeta(@NonNull final TombstoneProtos.Tombstone tombs currentModule = new ModuleAccumulator(mapping); } else if (currentModule != null && mappingName.equals(currentModule.mappingName)) { // Extend the current module with this mapping (same file, continuation) - currentModule.extendTo(mapping.getEndAddress()); + currentModule.extendTo(mapping.endAddress); } } @@ -333,6 +349,8 @@ private DebugMeta createDebugMeta(@NonNull final TombstoneProtos.Tombstone tombs @Override public void close() throws IOException { - tombstoneStream.close(); + if (tombstoneStream != null) { + tombstoneStream.close(); + } } } diff --git a/sentry-android-core/src/main/proto/io/sentry/android/core/internal/tombstone/tombstone.proto b/sentry-android-core/src/main/proto/io/sentry/android/core/internal/tombstone/tombstone.proto deleted file mode 100644 index 2f9cbe52850..00000000000 --- a/sentry-android-core/src/main/proto/io/sentry/android/core/internal/tombstone/tombstone.proto +++ /dev/null @@ -1,218 +0,0 @@ -// Added and adapted from: https://android.googlesource.com/platform/system/core/+/refs/heads/main/debuggerd/proto/tombstone.proto -// Sentry changes: -// * change the java_package -// -// Copyright (C) 2020 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Protobuf definition for Android tombstones. -// -// An app can get hold of these for any `REASON_CRASH_NATIVE` instance of -// `android.app.ApplicationExitInfo`. -// -// https://developer.android.com/reference/android/app/ApplicationExitInfo#getTraceInputStream() -// -syntax = "proto3"; -option java_package = "io.sentry.android.core.internal.tombstone"; -option java_outer_classname = "TombstoneProtos"; -// NOTE TO OEMS: -// If you add custom fields to this proto, do not use numbers in the reserved range. -// NOTE TO CONSUMERS: -// With proto3 -- unlike proto2 -- HasValue is unreliable for any field -// where the default value for that type is also a valid value for the field. -// This means, for example, that a boolean that is false or an integer that -// is zero will appear to be missing --- but because they're not actually -// marked as `optional` in this schema, consumers should just use values -// without first checking whether or not they're "present". -// https://protobuf.dev/programming-guides/proto3/#default -message CrashDetail { - bytes name = 1; - bytes data = 2; - reserved 3 to 999; -} -message StackHistoryBufferEntry { - BacktraceFrame addr = 1; - uint64 fp = 2; - uint64 tag = 3; - reserved 4 to 999; -} -message StackHistoryBuffer { - uint64 tid = 1; - repeated StackHistoryBufferEntry entries = 2; - reserved 3 to 999; -} -message Tombstone { - Architecture arch = 1; - Architecture guest_arch = 24; - string build_fingerprint = 2; - string revision = 3; - string timestamp = 4; - uint32 pid = 5; - uint32 tid = 6; - uint32 uid = 7; - string selinux_label = 8; - repeated string command_line = 9; - // Process uptime in seconds. - uint32 process_uptime = 20; - Signal signal_info = 10; - string abort_message = 14; - repeated CrashDetail crash_details = 21; - repeated Cause causes = 15; - map threads = 16; - map guest_threads = 25; - repeated MemoryMapping memory_mappings = 17; - repeated LogBuffer log_buffers = 18; - repeated FD open_fds = 19; - uint32 page_size = 22; - bool has_been_16kb_mode = 23; - StackHistoryBuffer stack_history_buffer = 26; - reserved 27 to 999; -} -enum Architecture { - ARM32 = 0; - ARM64 = 1; - X86 = 2; - X86_64 = 3; - RISCV64 = 4; - NONE = 5; - reserved 6 to 999; -} -message Signal { - int32 number = 1; - string name = 2; - int32 code = 3; - string code_name = 4; - bool has_sender = 5; - int32 sender_uid = 6; - int32 sender_pid = 7; - bool has_fault_address = 8; - uint64 fault_address = 9; - // Note, may or may not contain the dump of the actual memory contents. Currently, on arm64, we - // only include metadata, and not the contents. - MemoryDump fault_adjacent_metadata = 10; - reserved 11 to 999; -} -message HeapObject { - uint64 address = 1; - uint64 size = 2; - uint64 allocation_tid = 3; - repeated BacktraceFrame allocation_backtrace = 4; - uint64 deallocation_tid = 5; - repeated BacktraceFrame deallocation_backtrace = 6; -} -message MemoryError { - enum Tool { - GWP_ASAN = 0; - SCUDO = 1; - reserved 2 to 999; - } - Tool tool = 1; - enum Type { - UNKNOWN = 0; - USE_AFTER_FREE = 1; - DOUBLE_FREE = 2; - INVALID_FREE = 3; - BUFFER_OVERFLOW = 4; - BUFFER_UNDERFLOW = 5; - reserved 6 to 999; - } - Type type = 2; - oneof location { - HeapObject heap = 3; - } - reserved 4 to 999; -} -message Cause { - string human_readable = 1; - oneof details { - MemoryError memory_error = 2; - } - reserved 3 to 999; -} -message Register { - string name = 1; - uint64 u64 = 2; - reserved 3 to 999; -} -message Thread { - int32 id = 1; - string name = 2; - repeated Register registers = 3; - repeated string backtrace_note = 7; - repeated string unreadable_elf_files = 9; - repeated BacktraceFrame current_backtrace = 4; - repeated MemoryDump memory_dump = 5; - int64 tagged_addr_ctrl = 6; - int64 pac_enabled_keys = 8; - reserved 10 to 999; -} -message BacktraceFrame { - uint64 rel_pc = 1; - uint64 pc = 2; - uint64 sp = 3; - string function_name = 4; - uint64 function_offset = 5; - string file_name = 6; - uint64 file_map_offset = 7; - string build_id = 8; - reserved 9 to 999; -} -message ArmMTEMetadata { - // One memory tag per granule (e.g. every 16 bytes) of regular memory. - bytes memory_tags = 1; - reserved 2 to 999; -} -message MemoryDump { - string register_name = 1; - string mapping_name = 2; - uint64 begin_address = 3; - bytes memory = 4; - oneof metadata { - ArmMTEMetadata arm_mte_metadata = 6; - } - reserved 5, 7 to 999; -} -message MemoryMapping { - uint64 begin_address = 1; - uint64 end_address = 2; - uint64 offset = 3; - bool read = 4; - bool write = 5; - bool execute = 6; - string mapping_name = 7; - string build_id = 8; - uint64 load_bias = 9; - reserved 10 to 999; -} -message FD { - int32 fd = 1; - string path = 2; - string owner = 3; - uint64 tag = 4; - reserved 5 to 999; -} -message LogBuffer { - string name = 1; - repeated LogMessage logs = 2; - reserved 3 to 999; -} -message LogMessage { - string timestamp = 1; - uint32 pid = 2; - uint32 tid = 3; - uint32 priority = 4; - string tag = 5; - string message = 6; - reserved 7 to 999; -} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt index 516b9190022..34e704188c4 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt @@ -1,9 +1,13 @@ package io.sentry.android.core.internal.tombstone +import com.abovevacant.epitaph.core.BacktraceFrame +import com.abovevacant.epitaph.core.MemoryMapping +import com.abovevacant.epitaph.core.Signal +import com.abovevacant.epitaph.core.Tombstone +import com.abovevacant.epitaph.core.TombstoneThread import io.sentry.ILogger import io.sentry.JsonObjectWriter import io.sentry.protocol.DebugMeta -import java.io.ByteArrayInputStream import java.io.StringWriter import java.util.zip.GZIPInputStream import kotlin.test.Test @@ -56,12 +60,15 @@ class TombstoneParserTest { val nativeLibraryDir = "/data/app/~~gu-2hA9_Zg6tfIuDAbLpKA==/io.sentry.samples.android-MFqmKAMnl9AjNlHcO3mejA==/lib/arm64" + val parser = TombstoneParser(inAppIncludes, inAppExcludes, nativeLibraryDir) + @Test fun `parses a snapshot tombstone into Event`() { val tombstoneStream = GZIPInputStream(TombstoneParserTest::class.java.getResourceAsStream("/tombstone.pb.gz")) - val parser = TombstoneParser(tombstoneStream, inAppIncludes, inAppExcludes, nativeLibraryDir) - val event = parser.parse() + val streamParser = + TombstoneParser(tombstoneStream, inAppIncludes, inAppExcludes, nativeLibraryDir) + val event = streamParser.parse() // top-level data assertNotNull(event.eventId) @@ -137,87 +144,82 @@ class TombstoneParserTest { val buildId = "f1c3bcc0279865fe3058404b2831d9e64135386c" val tombstone = - TombstoneProtos.Tombstone.newBuilder() - .setPid(1234) - .setTid(1234) - .setSignalInfo( - TombstoneProtos.Signal.newBuilder() - .setNumber(11) - .setName("SIGSEGV") - .setCode(1) - .setCodeName("SEGV_MAPERR") - ) + Tombstone.Builder() + .pid(1234) + .tid(1234) + .signal(Signal(11, "SIGSEGV", 1, "SEGV_MAPERR", false, 0, 0, false, 0, null)) // First mapping: r--p at offset 0 (ELF header, has build_id) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libc.so") - .setBeginAddress(0x7000000000) - .setEndAddress(0x7000001000) - .setOffset(0) - .setRead(true) - .setWrite(false) - .setExecute(false) + .addMemoryMapping( + MemoryMapping( + 0x7000000000, + 0x7000001000, + 0, + true, + false, + false, + "/system/lib64/libc.so", + buildId, + 0, + ) ) // Second mapping: r-xp at offset 0x1000 (executable segment) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libc.so") - .setBeginAddress(0x7000001000) - .setEndAddress(0x7000010000) - .setOffset(0x1000) - .setRead(true) - .setWrite(false) - .setExecute(true) + .addMemoryMapping( + MemoryMapping( + 0x7000001000, + 0x7000010000, + 0x1000, + true, + false, + true, + "/system/lib64/libc.so", + buildId, + 0, + ) ) // Third mapping: r--p at offset 0x10000 (read-only data) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libc.so") - .setBeginAddress(0x7000010000) - .setEndAddress(0x7000011000) - .setOffset(0x10000) - .setRead(true) - .setWrite(false) - .setExecute(false) + .addMemoryMapping( + MemoryMapping( + 0x7000010000, + 0x7000011000, + 0x10000, + true, + false, + false, + "/system/lib64/libc.so", + buildId, + 0, + ) ) // Fourth mapping: rw-p at offset 0x11000 (writable data) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libc.so") - .setBeginAddress(0x7000011000) - .setEndAddress(0x7000012000) - .setOffset(0x11000) - .setRead(true) - .setWrite(true) - .setExecute(false) + .addMemoryMapping( + MemoryMapping( + 0x7000011000, + 0x7000012000, + 0x11000, + true, + true, + false, + "/system/lib64/libc.so", + buildId, + 0, + ) ) - .putThreads( - 1234, - TombstoneProtos.Thread.newBuilder() - .setId(1234) - .setName("main") - .addCurrentBacktrace( - TombstoneProtos.BacktraceFrame.newBuilder() - .setPc(0x7000001100) - .setFunctionName("crash") - .setFileName("/system/lib64/libc.so") - ) - .build(), + .addThread( + TombstoneThread( + 1234, + "main", + emptyList(), + emptyList(), + emptyList(), + listOf(BacktraceFrame(0, 0x7000001100, 0, "crash", 0, "/system/lib64/libc.so", 0, "")), + emptyList(), + 0, + 0, + ) ) .build() - val parser = - TombstoneParser( - ByteArrayInputStream(tombstone.toByteArray()), - inAppIncludes, - inAppExcludes, - nativeLibraryDir, - ) - val event = parser.parse() + val event = parser.parse(tombstone) // All 4 mappings should be coalesced into a single module val images = event.debugMeta!!.images!! @@ -238,77 +240,69 @@ class TombstoneParserTest { val buildId = "f1c3bcc0279865fe3058404b2831d9e64135386c" val tombstone = - TombstoneProtos.Tombstone.newBuilder() - .setPid(1234) - .setTid(1234) - .setSignalInfo( - TombstoneProtos.Signal.newBuilder() - .setNumber(11) - .setName("SIGSEGV") - .setCode(1) - .setCodeName("SEGV_MAPERR") - ) + Tombstone.Builder() + .pid(1234) + .tid(1234) + .signal(Signal(11, "SIGSEGV", 1, "SEGV_MAPERR", false, 0, 0, false, 0, null)) // First mapping: r--p at offset 0 - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libdl.so") - .setBeginAddress(0x7000000000) - .setEndAddress(0x7000001000) - .setOffset(0) - .setRead(true) - .setWrite(false) - .setExecute(false) + .addMemoryMapping( + MemoryMapping( + 0x7000000000, + 0x7000001000, + 0, + true, + false, + false, + "/system/lib64/libdl.so", + buildId, + 0, + ) ) // Second mapping: r-xp at offset 0 (duplicate!) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libdl.so") - .setBeginAddress(0x7000001000) - .setEndAddress(0x7000002000) - .setOffset(0) - .setRead(true) - .setWrite(false) - .setExecute(true) + .addMemoryMapping( + MemoryMapping( + 0x7000001000, + 0x7000002000, + 0, + true, + false, + true, + "/system/lib64/libdl.so", + buildId, + 0, + ) ) // Third mapping: r--p at offset 0 (another duplicate!) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(buildId) - .setMappingName("/system/lib64/libdl.so") - .setBeginAddress(0x7000002000) - .setEndAddress(0x7000003000) - .setOffset(0) - .setRead(true) - .setWrite(false) - .setExecute(false) + .addMemoryMapping( + MemoryMapping( + 0x7000002000, + 0x7000003000, + 0, + true, + false, + false, + "/system/lib64/libdl.so", + buildId, + 0, + ) ) - .putThreads( - 1234, - TombstoneProtos.Thread.newBuilder() - .setId(1234) - .setName("main") - .addCurrentBacktrace( - TombstoneProtos.BacktraceFrame.newBuilder() - .setPc(0x7000001100) - .setFunctionName("crash") - .setFileName("/system/lib64/libdl.so") - ) - .build(), + .addThread( + TombstoneThread( + 1234, + "main", + emptyList(), + emptyList(), + emptyList(), + listOf(BacktraceFrame(0, 0x7000001100, 0, "crash", 0, "/system/lib64/libdl.so", 0, "")), + emptyList(), + 0, + 0, + ) ) .build() - val parser = - TombstoneParser( - ByteArrayInputStream(tombstone.toByteArray()), - inAppIncludes, - inAppExcludes, - nativeLibraryDir, - ) - val event = parser.parse() + val event = parser.parse(tombstone) - // All duplicate mappings should be coalesced into a single module val images = event.debugMeta!!.images!! assertEquals(1, images.size) @@ -327,59 +321,52 @@ class TombstoneParserTest { val validBuildId = "f1c3bcc0279865fe3058404b2831d9e64135386c" val tombstone = - TombstoneProtos.Tombstone.newBuilder() - .setPid(1234) - .setTid(1234) - .setSignalInfo( - TombstoneProtos.Signal.newBuilder() - .setNumber(11) - .setName("SIGSEGV") - .setCode(1) - .setCodeName("SEGV_MAPERR") - ) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(invalidBuildId) - .setMappingName("/system/lib64/libc.so") - .setBeginAddress(0x7000000000) - .setEndAddress(0x7000001000) - .setOffset(0) - .setRead(true) - .setExecute(true) + Tombstone.Builder() + .pid(1234) + .tid(1234) + .signal(Signal(11, "SIGSEGV", 1, "SEGV_MAPERR", false, 0, 0, false, 0, null)) + .addMemoryMapping( + MemoryMapping( + 0x7000000000, + 0x7000001000, + 0, + true, + false, + true, + "/system/lib64/libc.so", + invalidBuildId, + 0, + ) ) - .addMemoryMappings( - TombstoneProtos.MemoryMapping.newBuilder() - .setBuildId(validBuildId) - .setMappingName("/system/lib64/libm.so") - .setBeginAddress(0x7000002000) - .setEndAddress(0x7000003000) - .setOffset(0) - .setRead(true) - .setExecute(true) + .addMemoryMapping( + MemoryMapping( + 0x7000002000, + 0x7000003000, + 0, + true, + false, + true, + "/system/lib64/libm.so", + validBuildId, + 0, + ) ) - .putThreads( - 1234, - TombstoneProtos.Thread.newBuilder() - .setId(1234) - .setName("main") - .addCurrentBacktrace( - TombstoneProtos.BacktraceFrame.newBuilder() - .setPc(0x7000000100) - .setFunctionName("crash") - .setFileName("/system/lib64/libc.so") - ) - .build(), + .addThread( + TombstoneThread( + 1234, + "main", + emptyList(), + emptyList(), + emptyList(), + listOf(BacktraceFrame(0, 0x7000000100, 0, "crash", 0, "/system/lib64/libc.so", 0, "")), + emptyList(), + 0, + 0, + ) ) .build() - val parser = - TombstoneParser( - ByteArrayInputStream(tombstone.toByteArray()), - inAppIncludes, - inAppExcludes, - nativeLibraryDir, - ) - val event = parser.parse() + val event = parser.parse(tombstone) val images = event.debugMeta!!.images!! assertEquals(2, images.size) @@ -400,8 +387,9 @@ class TombstoneParserTest { // test against a full snapshot so that we can track regressions in the VMA -> module reduction val tombstoneStream = GZIPInputStream(TombstoneParserTest::class.java.getResourceAsStream("/tombstone.pb.gz")) - val parser = TombstoneParser(tombstoneStream, inAppIncludes, inAppExcludes, nativeLibraryDir) - val event = parser.parse() + val streamParser = + TombstoneParser(tombstoneStream, inAppIncludes, inAppExcludes, nativeLibraryDir) + val event = streamParser.parse() val actualJson = serializeDebugMeta(event.debugMeta!!) val expectedJson = readGzippedResourceFile("/tombstone_debug_meta.json.gz") From 6a6b6c63c43109d3abcd1b0b2a7f2228eee0a4ec Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 14:46:25 +0100 Subject: [PATCH 042/391] docs: Add collection branch safety warnings to PR workflow (#5176) Add explicit warnings to pr.mdc and create-java-pr skill that the collection branch must never be manually merged or fast-forwarded. Updating it causes GitHub to auto-merge all stack PRs and delete their branches, destroying the entire stack. Co-authored-by: Claude --- .claude/skills/create-java-pr/SKILL.md | 2 ++ .cursor/rules/pr.mdc | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index b0fc12a5d2e..9a0bf71eec8 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -35,6 +35,8 @@ Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`, **For stacked PRs:** For the first PR in a new stack, first create and push the collection branch (see `.cursor/rules/pr.mdc` § "Creating the Collection Branch"), then branch the PR off it. For subsequent PRs, branch off the previous stack branch. Use the naming conventions from `.cursor/rules/pr.mdc` § "Branch Naming". +**CRITICAL: Never merge, fast-forward, or push commits into the collection branch.** It stays at its initial position until the user merges stack PRs through GitHub. Updating it will auto-merge and destroy the entire PR stack. + ## Step 2: Format Code and Regenerate API Files ```bash diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index 3b8f73194b1..d1926a640fe 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -185,6 +185,8 @@ git push -u origin HEAD gh pr create --base main --draft --title "(): " --body "Collection PR for the stack. Squash-merge this once all stack PRs are merged." ``` +**CRITICAL: Do NOT manually update the collection branch.** Never merge, fast-forward, or push stack branch commits into the collection branch. The collection branch stays at its initial position (the empty commit on `main`) until the user merges individual stack PRs into it one by one through GitHub. If you fast-forward the collection branch to include stack commits, GitHub will auto-merge and delete all stack PR branches, destroying the entire stack. + ### Creating a New Stacked PR 1. Start from the tip of the previous stack branch (or the collection branch for the first PR). @@ -237,12 +239,12 @@ Once all stack PRs are merged into the collection branch, the collection PR is * ### Syncing the Stack -When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack: +When a base PR changes (e.g. after addressing review feedback on PR 1), merge the changes forward through the stack **between adjacent stack PR branches only**: ```bash # On the branch for PR 2 git checkout feat/scope-attributes-logger -git merge feat/scope-attributes +git merge feat/scope-attributes-api git push # On the branch for PR 3 @@ -251,4 +253,6 @@ git merge feat/scope-attributes-logger git push ``` +**Never merge into the collection branch.** Syncing only happens between stack PR branches. The collection branch is untouched until the user merges PRs through GitHub. + Prefer merge over rebase — it preserves commit history, doesn't invalidate existing review comments, and avoids the need for force-pushing. Only rebase if explicitly requested. From b1045ed46a79eb58f9d2cd96d57dcaa150b4346b Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Mar 2026 15:29:36 +0100 Subject: [PATCH 043/391] docs: Improve stacked PR workflow for collection branch and merge method (#5178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Add collection branch safety warnings to PR workflow Add explicit warnings to pr.mdc and create-java-pr skill that the collection branch must never be manually merged or fast-forwarded. Updating it causes GitHub to auto-merge all stack PRs and delete their branches, destroying the entire stack. Co-Authored-By: Claude * docs: Include collection branch PR in stack list updates The stack list update instructions only mentioned "all PRs in the stack" which was ambiguous — it could be read as excluding the collection branch PR. Now both pr.mdc and the create-java-pr skill explicitly call out that the collection branch PR must also be updated with the stack list. Co-Authored-By: Claude * docs: Add merge commit reminder to stack PR descriptions Stack PRs must be merged with merge commits, not squash. Add a reminder to the PR description so reviewers/mergers pick the right method. This only applies to stack PRs — not standalone PRs or the collection branch PR. Co-Authored-By: Claude --------- Co-authored-by: Claude --- .claude/skills/create-java-pr/SKILL.md | 3 ++- .cursor/rules/pr.mdc | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 9a0bf71eec8..cb2618e6477 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -113,6 +113,7 @@ Fill in each section based on the changes being PR'd. Check any checklist items - Pass `--base ` so the PR targets the previous branch (first PR in a stack targets the collection branch). - Use the stacked PR title format: `(): [ ] ` (see `.cursor/rules/pr.mdc` § "PR Title Naming"). - Include the stack list at the top of the PR body, before the `## :scroll: Description` section (see `.cursor/rules/pr.mdc` § "Stack List in PR Description" for the format). +- Add a merge method reminder at the very end of the PR body (see `.cursor/rules/pr.mdc` § "Stack List in PR Description" for the exact text). This only applies to stack PRs, not the collection branch PR. Then continue to Step 5.5 (stacked PRs only) or Step 6. @@ -120,7 +121,7 @@ Then continue to Step 5.5 (stacked PRs only) or Step 6. Skip this step for standalone PRs. -After creating the PR, update the PR description on **every other PR in the stack** so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". +After creating the PR, update the PR description on **every other PR in the stack — including the collection branch PR** — so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". ## Step 6: Update Changelog diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index d1926a640fe..df35ee3b944 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -199,7 +199,7 @@ gh pr create --base main --draft --title "(): " --body "Coll ### Stack List in PR Description -Every PR in the stack must have a stack list **at the top of its description** (before the `## :scroll: Description` section). When a new PR is added, update the description on **all** PRs in the stack. +Every PR in the stack — **including the collection branch PR** — must have a stack list **at the top of its description** (before the `## :scroll: Description` section). When a new PR is added, update the description on **all** PRs in the stack and on the collection branch PR. Format: @@ -215,6 +215,14 @@ Format: No status column — GitHub already shows that. The `---` separates the stack list from the rest of the PR description. +**Merge method reminder:** On stack PRs (not the collection branch PR), add the following line at the very end of the PR description: + +```markdown +> ⚠️ **Merge this PR using a merge commit** (not squash). Only the collection branch is squash-merged into main. +``` + +This does not apply to standalone PRs or the collection branch PR. + To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body: ```bash From ee611d9dc13449cb863122c3a9d49b40e01a99d9 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Mar 2026 11:22:16 +0100 Subject: [PATCH 044/391] feat(samples): [Global Attributes 6] Showcase scope attributes in all sample modules (#5149) * feat(core): Add scope-level attributes API Add setAttribute, setAttributes, removeAttribute, and getAttributes to IScope/IScopes/Sentry so users can set attributes on the scope that are automatically included in logs and metrics events. Also refactor type inference logic into SentryAttributeType.inferFrom and add SentryLogEventAttributeValue.fromAttribute factory method, removing duplicate getType helpers from LoggerApi and MetricsApi. Co-Authored-By: Claude * changelog * ref: Split out LoggerApi/MetricsApi changes for stacked PR Move factory method extractions (SentryAttributeType.inferFrom, SentryLogEventAttributeValue.fromAttribute) and LoggerApi/MetricsApi scope attribute integration to a separate stacked PR. Co-Authored-By: Claude Opus 4.6 * feat(core): Wire scope attributes into LoggerApi and MetricsApi Extract factory methods SentryAttributeType.inferFrom and SentryLogEventAttributeValue.fromAttribute to reduce duplication. Apply scope attributes to log and metric events automatically. Co-Authored-By: Claude Opus 4.6 * changelog * feat(samples): Showcase scope attributes in Spring Boot 4 samples Add Sentry.setAttribute() calls to PersonController and MetricController across all Spring Boot 4 sample variants to demonstrate scope attributes being auto-attached to logs and metrics. Add e2e test assertions and TestHelper methods to verify scope attributes appear on captured log and metric events. Co-Authored-By: Claude Opus 4.6 * changelog * Revert "changelog" This reverts commit 7189bdca1a211085608f16bf3443c9e6675b6680. * ref: Remove redundant comments from variant controllers Co-Authored-By: Claude Opus 4.6 * ref: Limit scope attributes sample to base Spring Boot 4 variant Co-Authored-By: Claude Opus 4.6 * fix: Detect integer attribute type correctly for all integer Number subtypes Co-Authored-By: Claude Opus 4.6 * changelog * feat: Support collections and arrays in log attribute type inference Co-Authored-By: Claude Opus 4.6 * changelog * test: Add coverage for arrayAttribute factory method Add arrayAttribute and named array attribute usage to the four attribute tests in ScopesTest (log, count metric, distribution metric, gauge metric) to verify the factory method works end-to-end. Co-Authored-By: Claude * feat(samples): Showcase scope attributes in all sample modules Add Sentry.setAttribute() calls to all sample source files and corresponding attribute assertions to all system tests. This extends the scope attributes showcase from sentry-samples-spring-boot-4 to all 19 remaining sample modules with system tests. Co-Authored-By: Claude * Format code * ci: trigger CI re-run Co-Authored-By: Claude Opus 4.6 * ci: retrigger CI Co-Authored-By: Claude Opus 4.6 * remove duplicate changelog --------- Co-authored-by: Claude Co-authored-by: Sentry Github Bot --- .../main/java/io/sentry/samples/console/Main.java | 2 ++ .../systemtest/ConsoleApplicationSystemTest.kt | 4 +++- .../main/java/io/sentry/samples/console/Main.java | 2 ++ .../systemtest/ConsoleApplicationSystemTest.kt | 4 +++- .../src/main/java/io/sentry/samples/jul/Main.java | 3 +++ .../systemtest/ConsoleApplicationSystemTest.kt | 15 ++++++++++++++- .../main/java/io/sentry/samples/log4j2/Main.java | 3 +++ .../systemtest/ConsoleApplicationSystemTest.kt | 15 ++++++++++++++- .../main/java/io/sentry/samples/logback/Main.java | 3 +++ .../systemtest/ConsoleApplicationSystemTest.kt | 15 ++++++++++++++- .../samples/spring7/web/MetricController.java | 2 ++ .../samples/spring7/web/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot4/MetricController.java | 2 ++ .../samples/spring/boot4/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot4/MetricController.java | 2 ++ .../samples/spring/boot4/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot4/MetricController.java | 2 ++ .../samples/spring/boot4/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../spring/boot/jakarta/MetricController.java | 2 ++ .../spring/boot/jakarta/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../spring/boot/jakarta/MetricController.java | 2 ++ .../spring/boot/jakarta/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../spring/boot/jakarta/MetricController.java | 2 ++ .../spring/boot/jakarta/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot/MetricController.java | 2 ++ .../samples/spring/boot/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot/MetricController.java | 2 ++ .../samples/spring/boot/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../spring/boot/jakarta/MetricController.java | 2 ++ .../spring/boot/jakarta/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot/MetricController.java | 2 ++ .../samples/spring/boot/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/boot/MetricController.java | 2 ++ .../samples/spring/boot/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../spring/jakarta/web/MetricController.java | 2 ++ .../spring/jakarta/web/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- .../samples/spring/web/MetricController.java | 2 ++ .../samples/spring/web/PersonController.java | 3 +++ .../io/sentry/systemtest/MetricsSystemTest.kt | 4 +++- .../io/sentry/systemtest/PersonSystemTest.kt | 15 ++++++++++++++- 66 files changed, 369 insertions(+), 33 deletions(-) diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java index 9efab21031d..21438ee496c 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java @@ -63,6 +63,8 @@ public static void main(String[] args) throws InterruptedException { Sentry.addFeatureFlag("my-feature-flag", true); + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); captureMetrics(); // Sending exception: diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/test/kotlin/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/test/kotlin/sentry/systemtest/ConsoleApplicationSystemTest.kt index 7a89e5b1e6f..4f21ebefd70 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/test/kotlin/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/test/kotlin/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -111,7 +111,9 @@ class ConsoleApplicationSystemTest { testHelper.ensureMetricsReceived { metricsEvents, sentryEnvelopeHeader -> testHelper.doesContainMetric(metricsEvents, "countMetric", "counter", 1.0) && testHelper.doesContainMetric(metricsEvents, "gaugeMetric", "gauge", 5.0) && - testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) + testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) && + testHelper.doesMetricHaveAttribute(metricsEvents, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(metricsEvents, "countMetric", "feature.version", 2) } } } diff --git a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java index fd21476f402..29fae9381b2 100644 --- a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java @@ -128,6 +128,8 @@ public static void main(String[] args) throws InterruptedException { Sentry.addFeatureFlag("my-feature-flag", true); + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); captureMetrics(); // Sending exception: diff --git a/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt index 9f968485345..2b009167acb 100644 --- a/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -106,7 +106,9 @@ class ConsoleApplicationSystemTest { testHelper.ensureMetricsReceived { metricsEvents, sentryEnvelopeHeader -> testHelper.doesContainMetric(metricsEvents, "countMetric", "counter", 1.0) && testHelper.doesContainMetric(metricsEvents, "gaugeMetric", "gauge", 5.0) && - testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) + testHelper.doesContainMetric(metricsEvents, "distributionMetric", "distribution", 7.0) && + testHelper.doesMetricHaveAttribute(metricsEvents, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(metricsEvents, "countMetric", "feature.version", 2) } } } diff --git a/sentry-samples/sentry-samples-jul/src/main/java/io/sentry/samples/jul/Main.java b/sentry-samples/sentry-samples-jul/src/main/java/io/sentry/samples/jul/Main.java index 9f245470af4..16e7542988a 100644 --- a/sentry-samples/sentry-samples-jul/src/main/java/io/sentry/samples/jul/Main.java +++ b/sentry-samples/sentry-samples-jul/src/main/java/io/sentry/samples/jul/Main.java @@ -23,6 +23,9 @@ public static void main(String[] args) throws Exception { MDC.put("userId", UUID.randomUUID().toString()); MDC.put("requestId", UUID.randomUUID().toString()); + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.addFeatureFlag("my-feature-flag", true); LOGGER.warning("important warning"); diff --git a/sentry-samples/sentry-samples-jul/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-jul/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt index d23428da943..9750dcd728f 100644 --- a/sentry-samples/sentry-samples-jul/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-jul/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -64,7 +64,20 @@ class ConsoleApplicationSystemTest { testHelper.ensureLogsReceived { logs, _ -> testHelper.doesContainLogWithBody(logs, "User has made a purchase of product: 445") && - testHelper.doesContainLogWithBody(logs, "Something went wrong") + testHelper.doesContainLogWithBody(logs, "Something went wrong") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "Something went wrong", "debug.enabled", true) } } } diff --git a/sentry-samples/sentry-samples-log4j2/src/main/java/io/sentry/samples/log4j2/Main.java b/sentry-samples/sentry-samples-log4j2/src/main/java/io/sentry/samples/log4j2/Main.java index 5703fff5d44..9d9d56fe72d 100644 --- a/sentry-samples/sentry-samples-log4j2/src/main/java/io/sentry/samples/log4j2/Main.java +++ b/sentry-samples/sentry-samples-log4j2/src/main/java/io/sentry/samples/log4j2/Main.java @@ -20,6 +20,9 @@ public static void main(String[] args) { // ThreadContext tag not listed in log4j2.xml ThreadContext.put("context-tag", "context-tag-value"); + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.addFeatureFlag("my-feature-flag", true); // logging arguments are converted to Sentry Event parameters diff --git a/sentry-samples/sentry-samples-log4j2/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-log4j2/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt index 5d3266c6ff8..e22488c2f36 100644 --- a/sentry-samples/sentry-samples-log4j2/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-log4j2/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -66,7 +66,20 @@ class ConsoleApplicationSystemTest { testHelper.ensureLogsReceived { logs, _ -> testHelper.doesContainLogWithBody(logs, "User has made a purchase of product: 445") && - testHelper.doesContainLogWithBody(logs, "Something went wrong") + testHelper.doesContainLogWithBody(logs, "Something went wrong") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "Something went wrong", "debug.enabled", true) } } } diff --git a/sentry-samples/sentry-samples-logback/src/main/java/io/sentry/samples/logback/Main.java b/sentry-samples/sentry-samples-logback/src/main/java/io/sentry/samples/logback/Main.java index ec3928998a4..cb6dbc52ce4 100644 --- a/sentry-samples/sentry-samples-logback/src/main/java/io/sentry/samples/logback/Main.java +++ b/sentry-samples/sentry-samples-logback/src/main/java/io/sentry/samples/logback/Main.java @@ -18,6 +18,9 @@ public static void main(String[] args) { // MDC tag not listed in logback.xml MDC.put("context-tag", "context-tag-value"); + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.addFeatureFlag("my-feature-flag", true); LOGGER.warn("important warning"); diff --git a/sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt index 40169882224..ad28ff77762 100644 --- a/sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -66,7 +66,20 @@ class ConsoleApplicationSystemTest { testHelper.ensureLogsReceived { logs, _ -> testHelper.doesContainLogWithBody(logs, "User has made a purchase of product: 445") && - testHelper.doesContainLogWithBody(logs, "Something went wrong") + testHelper.doesContainLogWithBody(logs, "Something went wrong") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "Something went wrong", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "Something went wrong", "debug.enabled", true) } } } diff --git a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/MetricController.java b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/MetricController.java index b7f7d566b9c..73fba080a12 100644 --- a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/MetricController.java +++ b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonController.java b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonController.java index d66cf747c1f..3da15b55d4b 100644 --- a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonController.java +++ b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/web/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable("id") Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index 3d7afa4f73a..0091de63008 100644 --- a/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 99968ef8f51..f0d6bd177e8 100644 --- a/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-7/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/MetricController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/MetricController.java index 2a969ec8849..be75f5e3002 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/PersonController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/PersonController.java index b96c840aae8..a38a0b8bb43 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/PersonController.java @@ -34,6 +34,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("outer-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 50bc732b657..1fe742b64ce 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -56,7 +56,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/MetricController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/MetricController.java index 2a969ec8849..be75f5e3002 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/PersonController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/PersonController.java index bde91c83825..22259d4375c 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/PersonController.java @@ -32,6 +32,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("transaction-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a4d7cc5bdc5..ad9b5f77b62 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -51,7 +51,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/MetricController.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/MetricController.java index 2a969ec8849..be75f5e3002 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonController.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonController.java index 0db43f5ab71..5ea8b2ea0bc 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 7ba241200d4..3b7b2751ee9 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java index f7c7529525f..6b28e59d6a3 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java index 06e4bb963b0..cc8522e2ff1 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java @@ -34,6 +34,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("outer-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 50bc732b657..1fe742b64ce 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -56,7 +56,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java index f7c7529525f..6b28e59d6a3 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java index b17809eb68d..74b38660f66 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java @@ -32,6 +32,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("transaction-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a4d7cc5bdc5..ad9b5f77b62 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -51,7 +51,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java index f7c7529525f..6b28e59d6a3 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java index 2b590e1188b..f3c42b26081 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java @@ -27,6 +27,9 @@ Person person(@PathVariable Long id) { ISpan currentSpan = Sentry.getSpan(); ISpan sentrySpan = currentSpan.startChild("spanCreatedThroughSentryApi"); try { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 362a8577148..2389734a8b3 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -50,7 +50,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/MetricController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/MetricController.java index da5b1d655de..352571ee434 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/PersonController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/PersonController.java index 2f7aa4e03c8..c7d3d360e1a 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/PersonController.java @@ -34,6 +34,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("outer-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 50bc732b657..1fe742b64ce 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -56,7 +56,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/MetricController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/MetricController.java index da5b1d655de..352571ee434 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/PersonController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/PersonController.java index a778339280c..92d08bd8ee3 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/PersonController.java @@ -32,6 +32,9 @@ Person person(@PathVariable Long id) { Sentry.addFeatureFlag("transaction-feature-flag", true); Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan(); try (final @NotNull Scope spanScope = span.makeCurrent()) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a4d7cc5bdc5..ad9b5f77b62 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -51,7 +51,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java index f7c7529525f..6b28e59d6a3 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java index d1a505d0e59..8e1108c3603 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a728fa7c314..3a2455a14fe 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/MetricController.java b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/MetricController.java index da5b1d655de..352571ee434 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonController.java b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonController.java index d0b5435efc1..3816e45ab36 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a728fa7c314..3a2455a14fe 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/MetricController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/MetricController.java index da5b1d655de..352571ee434 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/MetricController.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/PersonController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/PersonController.java index 3bf03cb785f..c3475df14a6 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/PersonController.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/PersonController.java @@ -22,6 +22,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index dc2ca2a10ae..039d9d640c7 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 0cae1acca40..a8ff439acf5 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -40,7 +40,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/MetricController.java b/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/MetricController.java index 6c236a76a96..bb7f3fce64c 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/MetricController.java +++ b/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/PersonController.java b/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/PersonController.java index ec33f360967..fdc11e1452b 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/PersonController.java +++ b/sentry-samples/sentry-samples-spring-jakarta/src/main/java/io/sentry/samples/spring/jakarta/web/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable("id") Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index cef07e4866e..90e7a28fb36 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index c806cf9b40e..af79ec8dc7e 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } diff --git a/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/MetricController.java b/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/MetricController.java index c0629ec137c..30ee8cbec42 100644 --- a/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/MetricController.java +++ b/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/MetricController.java @@ -16,6 +16,8 @@ public class MetricController { @GetMapping("count") String count() { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); Sentry.metrics().count("countMetric"); return "count metric increased"; } diff --git a/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/PersonController.java b/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/PersonController.java index ee4020e0324..35fc4a8a1da 100644 --- a/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/PersonController.java +++ b/sentry-samples/sentry-samples-spring/src/main/java/io/sentry/samples/spring/web/PersonController.java @@ -23,6 +23,9 @@ public PersonController(PersonService personService) { @GetMapping("{id}") Person person(@PathVariable("id") Long id) { + Sentry.setAttribute("user.type", "admin"); + Sentry.setAttribute("feature.version", 2); + Sentry.setAttribute("debug.enabled", true); Sentry.logger().warn("warn Sentry logging"); Sentry.logger().error("error Sentry logging"); Sentry.logger().info("hello %s %s", "there", "world!"); diff --git a/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt b/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt index 6da3d98577e..8a5cd29fe6d 100644 --- a/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt +++ b/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt @@ -21,7 +21,9 @@ class MetricsSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureMetricsReceived { event, header -> - testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) + testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) && + testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") && + testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2) } } diff --git a/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 2a1a60793ac..0565ee5c33e 100644 --- a/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -35,7 +35,20 @@ class PersonSystemTest { testHelper.ensureLogsReceived { logs, envelopeHeader -> testHelper.doesContainLogWithBody(logs, "warn Sentry logging") && testHelper.doesContainLogWithBody(logs, "error Sentry logging") && - testHelper.doesContainLogWithBody(logs, "hello there world!") + testHelper.doesContainLogWithBody(logs, "hello there world!") && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "user.type", + "admin", + ) && + testHelper.doesLogWithBodyHaveAttribute( + logs, + "warn Sentry logging", + "feature.version", + 2, + ) && + testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true) } } From d6f6aaab8833875c124eccca411449b7f0b917bd Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Mar 2026 11:33:44 +0100 Subject: [PATCH 045/391] chore: Use GitHub native PR references in stack list format (#5166) Co-authored-by: Claude Opus 4.6 --- .cursor/rules/pr.mdc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index df35ee3b944..d994b9adbba 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -206,9 +206,9 @@ Format: ```markdown ## PR Stack () -- [#5118](https://github.com/getsentry/sentry-java/pull/5118) — Add scope-level attributes API -- [#5120](https://github.com/getsentry/sentry-java/pull/5120) — Wire scope attributes into LoggerApi and MetricsApi -- [#5121](https://github.com/getsentry/sentry-java/pull/5121) — Showcase scope attributes in Spring Boot 4 samples +- #5118 +- #5120 +- #5121 --- ``` From 97706653da8f48768ea2ec7893cd8b4b1ad0d129 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 10 Mar 2026 11:34:05 +0100 Subject: [PATCH 046/391] ref(docs): Avoid shell redirects in PR workflow docs (#5180) Replace shell redirect examples (>, >>, |, &&) with Write/Edit tool instructions in pr.mdc and create-java-pr skill. This prevents permission prompt spam when agents update PR descriptions, since compound shell commands don't match simple permission patterns. --- .claude/skills/create-java-pr/SKILL.md | 14 +++++++++----- .cursor/rules/pr.mdc | 16 +++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index cb2618e6477..6d5bb34edb3 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -123,6 +123,12 @@ Skip this step for standalone PRs. After creating the PR, update the PR description on **every other PR in the stack — including the collection branch PR** — so all PRs have the same up-to-date stack list. Follow the format and commands in `.cursor/rules/pr.mdc` § "Stack List in PR Description". +**Important:** When updating PR bodies, never use shell redirects (`>`, `>>`) or pipes (`|`) or compound commands (`&&`). These create compound shell expressions that won't match permission patterns. Instead: +- Use `gh pr view --json body --jq '.body'` to get the body (output returned directly) +- Use the `Write` tool to save it to a temp file +- Use the `Edit` tool to modify the temp file +- Use `gh pr edit --body-file /tmp/pr-body.md` to update + ## Step 6: Update Changelog First, determine whether a changelog entry is needed. **Skip this step** (and go straight to "No changelog needed" below) if the changes are not user-facing, for example: @@ -173,8 +179,6 @@ git push If no changelog entry is needed, add `#skip-changelog` to the PR description to disable the changelog CI check: -```bash -gh pr view --json body --jq '.body' > /tmp/pr-body.md -printf '\n#skip-changelog\n' >> /tmp/pr-body.md -gh pr edit --body-file /tmp/pr-body.md -``` +1. Get the current body: `gh pr view --json body --jq '.body'` +2. Use the `Write` tool to save the output to `/tmp/pr-body.md`, appending `\n#skip-changelog\n` at the end +3. Update: `gh pr edit --body-file /tmp/pr-body.md` diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index d994b9adbba..08a07511c67 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -223,19 +223,13 @@ No status column — GitHub already shows that. The `---` separates the stack li This does not apply to standalone PRs or the collection branch PR. -To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body: +To update the PR description, use `--body-file` to avoid shell quoting issues with special characters in the body. -```bash -# Get current PR description into a temp file -gh pr view --json body --jq '.body' > /tmp/pr-body.md - -# Edit /tmp/pr-body.md to prepend or replace the stack list section -# (replace everything from "## PR Stack" up to and including the "---" separator, -# or prepend before the existing description if no stack list exists yet) +**Important:** Do not use shell redirects (`>`, `>>`, `|`) or compound commands (`&&`, `||`). These create compound shell expressions that won't match permission patterns. Instead, use the `Write` and `Edit` tools for file manipulation: -# Update the description -gh pr edit --body-file /tmp/pr-body.md -``` +1. Read the current body with `gh pr view --json body --jq '.body'` (the output is returned directly — use the `Write` tool to save it to `/tmp/pr-body.md`) +2. Use the `Edit` tool to prepend or replace the stack list section in `/tmp/pr-body.md` +3. Update the description: `gh pr edit --body-file /tmp/pr-body.md` ### Merging Stacked PRs (done by the user, not the agent) From 092f017ff4d4477dbe6d9d5eb299368103d70ee8 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Wed, 11 Mar 2026 13:48:38 +0100 Subject: [PATCH 047/391] Fix Changelog (#5187) * Fix Changelog * Update CHANGELOG.md Co-authored-by: Roman Zavarnitsyn * Update CHANGELOG with breaking change for ANR fingerprinting Added breaking change for enableAnrFingerprinting option to reduce ANR noise. --------- Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21fcd2aac74..10622bcaf8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## Unreleased + +### Fixes + +- Android: Remove the dependency on protobuf-lite for tombstones ([#5157](https://github.com/getsentry/sentry-java/pull/5157)) + +### Features + +- Add new experimental option to capture profiles for ANRs ([#4899](https://github.com/getsentry/sentry-java/pull/4899)) + - This feature will capture a stack profile of the main thread when it gets unresponsive + - The profile gets attached to the ANR event on the next app start, providing a flamegraph of the ANR issue on the sentry issue details page + - Enable via `options.setAnrProfilingSampleRate()` or AndroidManifest.xml: `` + - The sample rate controls the probability of collecting a profile for each detected foreground ANR (0.0 to 1.0, null to disable) +- **Breaking:** Add `enableAnrFingerprinting` option to reduce ANR noise by assigning static fingerprints to ANR events with system-only stacktraces + - When enabled, ANRs whose stacktraces contain only system frames (e.g. `java.lang` or `android.os`) are grouped into a single issue instead of creating many separate issues + - **IMPORTANT:** This option is enabled by default. + - Disable via `options.setEnableAnrFingerprinting(false)` or AndroidManifest.xml: `` + ## 8.34.1 ### Fixes @@ -7,7 +25,6 @@ - Common: Finalize previous session even when auto session tracking is disabled ([#5154](https://github.com/getsentry/sentry-java/pull/5154)) - Android: Add `filterTouchesWhenObscured` to prevent Tapjacking on user feedback dialog ([#5155](https://github.com/getsentry/sentry-java/pull/5155)) - Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153)) -- Android: Remove the dependency on protobuf-lite for tombstones ([#5157](https://github.com/getsentry/sentry-java/pull/5157)) ## 8.34.0 @@ -46,14 +63,6 @@ ``` - The `ManifestMetaDataReader` now read the `DIST` ([#5107](https://github.com/getsentry/sentry-java/pull/5107)) -- Add new experimental option to capture profiles for ANRs ([#4899](https://github.com/getsentry/sentry-java/pull/4899)) - - This feature will capture a stack profile of the main thread when it gets unresponsive - - The profile gets attached to the ANR event on the next app start, providing a flamegraph of the ANR issue on the sentry issue details page - - Enable via `options.setAnrProfilingSampleRate()` or AndroidManifest.xml: `` - - The sample rate controls the probability of collecting a profile for each detected foreground ANR (0.0 to 1.0, null to disable) -- Add `enableAnrFingerprinting` option to reduce ANR noise by assigning static fingerprints to ANR events with system-only stacktraces - - When enabled, ANRs whose stacktraces contain only system frames (e.g. `java.lang` or `android.os`) are grouped into a single issue instead of creating many separate issues - - Enable via `options.setEnableAnrFingerprinting(true)` or AndroidManifest.xml: `` ### Fixes From 8733a069bc803db54d18fa059741ae5be4830d20 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Thu, 12 Mar 2026 10:05:02 +0100 Subject: [PATCH 048/391] Refine Changelog for enableAnrFingerprinting option (#5188) * Refine Changelog for enableAnrFingerprinting option #skip-changelog * Apply suggestion from @romtsn --------- Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10622bcaf8b..c6c5ca83377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,12 @@ - The profile gets attached to the ANR event on the next app start, providing a flamegraph of the ANR issue on the sentry issue details page - Enable via `options.setAnrProfilingSampleRate()` or AndroidManifest.xml: `` - The sample rate controls the probability of collecting a profile for each detected foreground ANR (0.0 to 1.0, null to disable) -- **Breaking:** Add `enableAnrFingerprinting` option to reduce ANR noise by assigning static fingerprints to ANR events with system-only stacktraces + +### Behavioral Changes + +- Add `enableAnrFingerprinting` option which assigns static fingerprints to ANR events with system-only stacktraces - When enabled, ANRs whose stacktraces contain only system frames (e.g. `java.lang` or `android.os`) are grouped into a single issue instead of creating many separate issues + - This will help to reduce overall ANR issue noise in the Sentry dashboard - **IMPORTANT:** This option is enabled by default. - Disable via `options.setEnableAnrFingerprinting(false)` or AndroidManifest.xml: `` From 7f68594fbbac019924a69fddac1cdc3e4dadcfa5 Mon Sep 17 00:00:00 2001 From: markushi <1411808+markushi@users.noreply.github.com> Date: Thu, 12 Mar 2026 09:07:04 +0000 Subject: [PATCH 049/391] release: 8.35.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c5ca83377..54dff9fef7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.35.0 ### Fixes diff --git a/gradle.properties b/gradle.properties index db7fab6765c..05e47bc6ade 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.34.1 +versionName=8.35.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 3c621a2cd466909cd8ac19629b6eceac7c9a7622 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:19:49 +0100 Subject: [PATCH 050/391] build(deps): bump reactivecircus/android-emulator-runner from 2.35.0 to 2.37.0 (#5194) Bumps [reactivecircus/android-emulator-runner](https://github.com/reactivecircus/android-emulator-runner) from 2.35.0 to 2.37.0. - [Release notes](https://github.com/reactivecircus/android-emulator-runner/releases) - [Changelog](https://github.com/ReactiveCircus/android-emulator-runner/blob/main/CHANGELOG.md) - [Commits](https://github.com/reactivecircus/android-emulator-runner/compare/b530d96654c385303d652368551fb075bc2f0b6b...e89f39f1abbbd05b1113a29cf4db69e7540cae5a) --- updated-dependencies: - dependency-name: reactivecircus/android-emulator-runner dependency-version: 2.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 4 ++-- .github/workflows/integration-tests-ui-critical.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index d5f326b56bf..c6bee353d83 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -60,7 +60,7 @@ jobs: - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2 + uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2 with: api-level: 30 target: aosp_atd @@ -79,7 +79,7 @@ jobs: # We tried to use the cache action to cache gradle stuff, but it made tests slower and timeout - name: Run instrumentation tests - uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2 + uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2 with: api-level: 30 target: aosp_atd diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 77691bfd65b..04e7f834f1f 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -100,7 +100,7 @@ jobs: - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' - uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2 + uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2 with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} @@ -124,7 +124,7 @@ jobs: version: ${{env.MAESTRO_VERSION}} - name: Run tests - uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2.35.0 + uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # pin@v2.37.0 with: api-level: ${{ matrix.api-level }} target: ${{ matrix.target }} From 139023e3fb465e82b9dd23b235aecc457387e05a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:20:08 +0100 Subject: [PATCH 051/391] build(deps): bump getsentry/craft from 2.23.1 to 2.24.1 (#5197) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.23.1 to 2.24.1. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/d4cfac9d25d1fc72c9241e5d22aff559a114e4e9...013a7b2113c2cac0ff32d5180cfeaefc7c9ce5b6) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.24.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df09bf89706..5dfe3944e78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@d4cfac9d25d1fc72c9241e5d22aff559a114e4e9 # v2 + uses: getsentry/craft@013a7b2113c2cac0ff32d5180cfeaefc7c9ce5b6 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From adaff665437f3faa1fc5ec84aa770e5eec73ac1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:23:43 +0100 Subject: [PATCH 052/391] build(deps): bump actions/create-github-app-token from 2.2.1 to 3.0.0 (#5196) Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 2.2.1 to 3.0.0. - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Commits](https://github.com/actions/create-github-app-token/compare/29824e69f54612133e76f7eaac726eef6c875baf...f8d387b68d61c58ab83c6c016672934102569859) --- updated-dependencies: - dependency-name: actions/create-github-app-token dependency-version: 3.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5dfe3944e78..f7c530df16a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get auth token id: token - uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 with: app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} From 01540d6015e9a2253e983a8c4d0cf1d7198f5813 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:24:02 +0100 Subject: [PATCH 053/391] build(deps): bump dorny/paths-filter from 3.0.2 to 4.0.1 (#5195) Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from 3.0.2 to 4.0.1. - [Release notes](https://github.com/dorny/paths-filter/releases) - [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md) - [Commits](https://github.com/dorny/paths-filter/compare/de90cc6fb38fc0963ad72b210f1f284cd68cea36...fbd0ab8f3e69293af611ebaee6363fc25e6d187d) --- updated-dependencies: - dependency-name: dorny/paths-filter dependency-version: 4.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changes-in-high-risk-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changes-in-high-risk-code.yml b/.github/workflows/changes-in-high-risk-code.yml index ba1376ff513..5da9f52cb50 100644 --- a/.github/workflows/changes-in-high-risk-code.yml +++ b/.github/workflows/changes-in-high-risk-code.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v6 - name: Get changed files id: changes - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 with: token: ${{ github.token }} filters: .github/file-filters.yml From 5183932caab97d2c556bb49cc15e1643361b733b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:24:50 +0100 Subject: [PATCH 054/391] build(deps): bump github/codeql-action from 4.32.4 to 4.32.6 (#5170) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.4 to 4.32.6. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/89a39a4e59826350b863aa6b6252a07ad50cf83e...0d579ffd059c29b07949a3cce3983f0780820c98) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.32.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ffd4082904d..703c4abe043 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2 + uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # pin@v2 + uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # pin@v2 From b4edb46ebd6de4d5d8d8f1fdc330cd67408778d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 10:30:05 +0000 Subject: [PATCH 055/391] chore: update scripts/update-sentry-native-ndk.sh to 0.13.2 (#5181) Co-authored-by: GitHub --- CHANGELOG.md | 8 ++++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54dff9fef7f..75cc2dabd21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +### Dependencies + +- Bump Native SDK from v0.13.1 to v0.13.2 ([#5181](https://github.com/getsentry/sentry-java/pull/5181)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0132) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.1...0.13.2) + ## 8.35.0 ### Fixes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 61fbefd9152..db43203d345 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -148,7 +148,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.1" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.2" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 591440417797100355fd8cbaa353ea084ccfa5cb Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Mon, 16 Mar 2026 16:41:34 +0100 Subject: [PATCH 056/391] Add AI rules files for Profiling (#5034) * add cursor rules for the profiling feature * add profiling info to overview_dev.mdc * split jvm and android profiling * remove profiling android rules, improve jvm rules, improve file name --- .cursor/rules/continuous_profiling_jvm.mdc | 174 +++++++++++++++++++++ .cursor/rules/overview_dev.mdc | 18 ++- 2 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 .cursor/rules/continuous_profiling_jvm.mdc diff --git a/.cursor/rules/continuous_profiling_jvm.mdc b/.cursor/rules/continuous_profiling_jvm.mdc new file mode 100644 index 00000000000..d9a911de25e --- /dev/null +++ b/.cursor/rules/continuous_profiling_jvm.mdc @@ -0,0 +1,174 @@ +--- +alwaysApply: false +description: JVM Continuous Profiling (sentry-async-profiler) +--- +# JVM Continuous Profiling + +Use this rule when working on JVM continuous profiling in `sentry-async-profiler` and the related core profiling abstractions in `sentry`. + +This area is suitable for LLM work, but do not rely on this rule alone for behavior changes. Always read the implementation and nearby tests first, especially for sampling, lifecycle, rate limiting, and file cleanup behavior. + +## Module Structure + +- **`sentry-async-profiler`**: standalone module containing the async-profiler integration + - Uses Java `ServiceLoader` discovery + - No direct dependency from core `sentry` module + - Enabled by adding the module as a dependency + +- **`sentry` core abstractions**: + - `IContinuousProfiler`: profiler lifecycle interface + - `ProfileChunk`: profile chunk payload sent to Sentry + - `IProfileConverter`: converts JVM JFR files into `SentryProfile` + - `ProfileLifecycle`: controls MANUAL vs TRACE lifecycle + - `ProfilingServiceLoader`: loads profiler and converter implementations via `ServiceLoader` + +## Key Classes + +### `JavaContinuousProfiler` (`sentry-async-profiler`) +- Wraps the native async-profiler library +- Writes JFR files to `profilingTracesDirPath` +- Rotates chunks periodically via `MAX_CHUNK_DURATION_MILLIS` (currently 10s) +- Implements `RateLimiter.IRateLimitObserver` +- Maintains `rootSpanCounter` for TRACE lifecycle +- Keeps a session-level `profilerId` across chunks until the profiling session ends +- `getChunkId()` currently returns `SentryId.EMPTY_ID`, but emitted `ProfileChunk`s get a fresh chunk id when built in `stop(...)` + +### `ProfileChunk` +- Carries `profilerId`, `chunkId`, timestamp, platform, measurements, and a JFR file reference +- Built via `ProfileChunk.Builder` +- For JVM, the JFR file is converted later during envelope item creation, not inside `JavaContinuousProfiler` + +### `ProfileLifecycle` +- `MANUAL`: explicit `Sentry.startProfiler()` / `Sentry.stopProfiler()` +- `TRACE`: profiler lifecycle follows active sampled root spans + +## Configuration + +Continuous profiling is **not** controlled by `profilesSampleRate`. + +Key options: +- **`profileSessionSampleRate`**: session-level sample rate for continuous profiling +- **`profileLifecycle`**: `ProfileLifecycle.MANUAL` (default) or `ProfileLifecycle.TRACE` +- **`cacheDirPath`**: base SDK cache directory; profiling traces are written under the derived `profilingTracesDirPath` +- **`profilingTracesHz`**: sampling frequency in Hz (default: 101) + +Continuous profiling is enabled when: +- `profilesSampleRate == null` +- `profilesSampler == null` +- `profileSessionSampleRate != null && profileSessionSampleRate > 0` + +Example: + +```java +options.setProfileSessionSampleRate(1.0); +options.setCacheDirPath("/tmp/sentry-cache"); +options.setProfileLifecycle(ProfileLifecycle.MANUAL); +options.setProfilingTracesHz(101); +``` + +## How It Works + +### Initialization +- `InitUtil.initializeProfiler(...)` resolves or creates the profiling traces directory +- `ProfilingServiceLoader.loadContinuousProfiler(...)` uses `ServiceLoader` to find `JavaContinuousProfilerProvider` +- `AsyncProfilerContinuousProfilerProvider` instantiates `JavaContinuousProfiler` +- `ProfilingServiceLoader.loadProfileConverter()` separately loads the `JavaProfileConverterProvider` + +### Profiling Flow + +**Start** +- Sampling decision is made via `TracesSampler.sampleSessionProfile(...)` +- Sampling is session-based and cached until `reevaluateSampling()` +- Scopes and rate limiter are initialized lazily via `initScopes()` +- Rate limits for `All` or `ProfileChunk` abort startup +- JFR filename is generated under `profilingTracesDirPath` +- async-profiler is started with a command like: + - `start,jfr,event=wall,nobatch,interval=,file=` +- Automatic chunk stop is scheduled after `MAX_CHUNK_DURATION_MILLIS` + +**Chunk Rotation** +- `stop(true)` stops async-profiler and validates the JFR file +- A `ProfileChunk.Builder` is created with: + - current `profilerId` + - a fresh `chunkId` + - trace file + - chunk timestamp + - platform `java` +- Builder is buffered in `payloadBuilders` +- Chunks are sent if scopes are available +- Profiling is restarted for the next chunk + +**Stop** +- `MANUAL`: stop immediately, do not restart, reset `profilerId` +- `TRACE`: decrement `rootSpanCounter`; stop only when it reaches 0 +- `close(...)` also forces shutdown and resets TRACE state + +### Sending and Conversion +- `JavaContinuousProfiler` buffers `ProfileChunk.Builder` instances +- `sendChunks(...)` builds `ProfileChunk` objects and calls `scopes.captureProfileChunk(...)` +- `SentryClient.captureProfileChunk(...)` creates an envelope item +- JVM JFR-to-`SentryProfile` conversion happens in `SentryEnvelopeItem.fromProfileChunk(...)` using the loaded `IProfileConverter` +- Trace files are deleted in the envelope item path after serialization attempts + +## TRACE Mode Lifecycle +- `rootSpanCounter` increments when sampled root spans start +- `rootSpanCounter` decrements when root spans finish +- Profiler runs while `rootSpanCounter > 0` +- Multiple concurrent sampled transactions can share the same profiling session +- Be careful when changing lifecycle logic: this area is lock-protected and concurrency-sensitive + +## Rate Limiting and Buffering + +### Rate Limiting +- Registers as a `RateLimiter.IRateLimitObserver` +- If rate limited for `ProfileChunk` or `All`: + - profiler stops immediately + - it does not auto-restart when the limit expires +- Startup also checks rate limiting before profiling begins + +### Buffering / pre-init behavior +- JFR files are written to `profilingTracesDirPath` and marked `deleteOnExit()` when a chunk is accepted +- If scopes are not yet available, `ProfileChunk.Builder`s remain buffered in memory in `payloadBuilders` +- This commonly matters for profiling that starts before SDK scopes are ready +- This is not a dedicated durable offline queue owned by the profiler itself; conversion and final send happen later in the normal client/envelope path + +## Extending + +To add or replace JVM profiler implementations: +- implement `IContinuousProfiler` +- implement `JavaContinuousProfilerProvider` +- register provider in: + - `META-INF/services/io.sentry.profiling.JavaContinuousProfilerProvider` + +To add or replace JVM profile conversion: +- implement `IProfileConverter` +- implement `JavaProfileConverterProvider` +- register provider in: + - `META-INF/services/io.sentry.profiling.JavaProfileConverterProvider` + +## Code Locations + +Primary implementation: +- `sentry/src/main/java/io/sentry/IContinuousProfiler.java` +- `sentry/src/main/java/io/sentry/ProfileChunk.java` +- `sentry/src/main/java/io/sentry/profiling/ProfilingServiceLoader.java` +- `sentry/src/main/java/io/sentry/util/InitUtil.java` +- `sentry/src/main/java/io/sentry/SentryEnvelopeItem.java` +- `sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfiler.java` +- `sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/provider/AsyncProfilerContinuousProfilerProvider.java` +- `sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/provider/AsyncProfilerProfileConverterProvider.java` +- `sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java` + +Tests to read first: +- `sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfilerTest.kt` +- `sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/JavaContinuousProfilingServiceLoaderTest.kt` +- `sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverterTest.kt` + +## LLM Guidance + +This rule is good enough for orientation, but for actual code changes always verify: +- the sampling path in `TracesSampler` +- continuous profiling enablement in `SentryOptions` +- lifecycle entry points in `Scopes` and `SentryTracer` +- conversion and file deletion behavior in `SentryEnvelopeItem` +- existing tests before changing concurrency or lifecycle semantics diff --git a/.cursor/rules/overview_dev.mdc b/.cursor/rules/overview_dev.mdc index a982cfe960e..17ce98f07be 100644 --- a/.cursor/rules/overview_dev.mdc +++ b/.cursor/rules/overview_dev.mdc @@ -30,7 +30,7 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - **`scopes`**: Use when working with: - Hub/Scope management, forking, or lifecycle - - `Sentry.getCurrentScopes()`, `pushScope()`, `withScope()` + - `Sentry.getCurrentScopes()`, `pushScope()`, `withScope()` - `ScopeType` (GLOBAL, ISOLATION, CURRENT) - Thread-local storage, scope bleeding issues - Migration from Hub API (v7 → v8) @@ -66,6 +66,18 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - `SentryMetricsEvent`, `SentryMetricsEvents` - `SentryOptions.getMetrics()`, `beforeSend` callback +- **`continuous_profiling_jvm`**: Use when working with: + - JVM continuous profiling (`sentry-async-profiler` module) + - `IContinuousProfiler`, `JavaContinuousProfiler` + - `ProfileChunk`, chunk rotation, JFR file handling + - `ProfileLifecycle` (MANUAL vs TRACE modes) + - async-profiler integration, ServiceLoader discovery + - Rate limiting, offline caching, scopes integration + +- **Android profiling**: There is currently no dedicated rule for this area yet. + - Inspect the relevant `sentry-android-core` profiling code directly + - Fetch other related rules as needed (for example `options`, `offline`, or `api`) + ### Integration & Infrastructure - **`opentelemetry`**: Use when working with: - OpenTelemetry modules (`sentry-opentelemetry-*`) @@ -99,7 +111,7 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - Public API/apiDump/.api files/binary compatibility/new method → `api` - Options/SentryOptions/ExternalOptions/ManifestMetadataReader/sentry.properties → `options` - Scope/Hub/forking → `scopes` - - Duplicate/dedup → `deduplication` + - Duplicate/dedup → `deduplication` - OpenTelemetry/tracing/spans → `opentelemetry` - new module/integration/sample → `new_module` - Cache/offline/network → `offline` @@ -107,3 +119,5 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - Feature flag/addFeatureFlag/flag evaluation → `feature_flags` - Metrics/count/distribution/gauge → `metrics` - PR/pull request/stacked PR/stack → `pr` + - JVM continuous profiling/async-profiler/JFR/ProfileChunk → `continuous_profiling_jvm` + - Android continuous profiling/AndroidProfiler/frame metrics/method tracing → no dedicated rule yet; inspect the code directly From 37ec571aad40d714af14c5107647a22895550e83 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Mon, 16 Mar 2026 17:14:42 +0100 Subject: [PATCH 057/391] fix(android): bump epitaph to 0.1.1 (#5200) --- CHANGELOG.md | 3 +++ gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75cc2dabd21..bf7c919c957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - Bump Native SDK from v0.13.1 to v0.13.2 ([#5181](https://github.com/getsentry/sentry-java/pull/5181)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0132) - [diff](https://github.com/getsentry/sentry-native/compare/0.13.1...0.13.2) +- Bump `com.abovevacant:epitaph` to `0.1.1` to avoid old D8/R8 dexing crashes in downstream Android builds on old AGP versions such as 7.4.x. ([#5200](https://github.com/getsentry/sentry-java/pull/5200)) + - [changelog](https://github.com/abovevacant/epitaph/blob/main/CHANGELOG.md#011---2026-03-16) + - [diff](https://github.com/abovevacant/epitaph/compare/v0.1.0...v0.1.1) ## 8.35.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index db43203d345..f81aea8a674 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -143,7 +143,7 @@ otel-javaagent-extension-api = { module = "io.opentelemetry.javaagent:openteleme otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", version.ref = "otelSemanticConventions" } otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" } p6spy = { module = "p6spy:p6spy", version = "3.9.1" } -epitaph = { module = "com.abovevacant:epitaph", version = "0.1.0" } +epitaph = { module = "com.abovevacant:epitaph", version = "0.1.1" } quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } From 9c1b40670ab44bcb38abef3414e06685611f123a Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 17 Mar 2026 11:41:39 +0100 Subject: [PATCH 058/391] Support apps compiled against Jetpack Compose 1.10 (#5189) * Compile against JPC 1.10 * Format code * Fix click/scroll target detection * Update Changelog * Move changes into replay module * Switch to reflection * Fix Changelog * Improve LayoutNode iteration * Fix tag propagation * Add tests * Address PR feedback * Format code * Update CHANGELOG for Jetpack Compose and SDK version * return first tag instead of last one * Fix exception propagation * Return first non-null tag * Allow nullable semantics in case there are really none --------- Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 4 + gradle/libs.versions.toml | 2 +- .../viewhierarchy/ComposeViewHierarchyNode.kt | 47 +- .../viewhierarchy/SentryLayoutNodeHelper.kt | 90 +++ .../ComposeMaskingOptionsTest.kt | 3 +- .../gestures/ComposeGestureTargetLocator.kt | 104 +-- .../foundation/GestureModifierStubs.kt | 15 + .../ComposeGestureTargetLocatorTest.kt | 703 ++++++++++++++++++ 8 files changed, 891 insertions(+), 77 deletions(-) create mode 100644 sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/SentryLayoutNodeHelper.kt create mode 100644 sentry-compose/src/androidUnitTest/kotlin/androidx/compose/foundation/GestureModifierStubs.kt create mode 100644 sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index bf7c919c957..866a450519a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Support masking/unmasking and click/scroll detection for Jetpack Compose 1.10+ ([#5189](https://github.com/getsentry/sentry-java/pull/5189)) + ### Dependencies - Bump Native SDK from v0.13.1 to v0.13.2 ([#5181](https://github.com/getsentry/sentry-java/pull/5181)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f81aea8a674..d659e43438c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,7 +85,7 @@ androidx-compose-material-icons-core = { module = "androidx.compose.material:mat androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version="1.7.8" } androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidxCompose" } # Note: don't change without testing forwards compatibility -androidx-compose-ui-replay = { module = "androidx.compose.ui:ui", version = "1.5.0" } +androidx-compose-ui-replay = { module = "androidx.compose.ui:ui", version = "1.10.2" } androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.1.3" } androidx-core = { module = "androidx.core:core", version = "1.3.2" } androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.7.0" } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index 2e58418c3ac..f421ff9ad07 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -36,32 +36,35 @@ import java.lang.reflect.Method @SuppressLint("UseRequiresApi") @TargetApi(26) internal object ComposeViewHierarchyNode { - private val getSemanticsConfigurationMethod: Method? by lazy { - try { - return@lazy LayoutNode::class.java.getDeclaredMethod("getSemanticsConfiguration").apply { - isAccessible = true + private val getCollapsedSemanticsMethod: Method? by + lazy(LazyThreadSafetyMode.NONE) { + try { + return@lazy LayoutNode::class + .java + .getDeclaredMethod("getCollapsedSemantics\$ui_release") + .apply { isAccessible = true } + } catch (_: Throwable) { + // ignore, as this method may not be available } - } catch (_: Throwable) { - // ignore, as this method may not be available + return@lazy null } - return@lazy null - } private var semanticsRetrievalErrorLogged: Boolean = false @JvmStatic internal fun retrieveSemanticsConfiguration(node: LayoutNode): SemanticsConfiguration? { - // Jetpack Compose 1.8 or newer provides SemanticsConfiguration via SemanticsInfo - // See - // https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt - // and - // https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsInfo.kt - getSemanticsConfigurationMethod?.let { - return it.invoke(node) as SemanticsConfiguration? + return try { + node.semanticsConfiguration + } catch (t: Throwable) { + // for backwards compatibility + // Jetpack Compose 1.8 or older + if (getCollapsedSemanticsMethod != null) { + getCollapsedSemanticsMethod!!.invoke(node) as SemanticsConfiguration? + } else { + // re-throw t if there's no way to retrieve semantics + throw t + } } - - // for backwards compatibility - return node.collapsedSemantics } /** @@ -136,7 +139,7 @@ internal object ComposeViewHierarchyNode { """ Error retrieving semantics information from Compose tree. Most likely you're using an unsupported version of androidx.compose.ui:ui. The supported - version range is 1.5.0 - 1.8.0. + version range is 1.5.0 - 1.10.2. If you're using a newer version, please open a github issue with the version you're using, so we can add support for it. """ @@ -157,7 +160,7 @@ internal object ComposeViewHierarchyNode { shouldMask = true, isImportantForContentCapture = false, // will be set by children isVisible = - !node.outerCoordinator.isTransparent() && + !SentryLayoutNodeHelper.isTransparent(node) && visibleRect.height() > 0 && visibleRect.width() > 0, visibleRect = visibleRect, @@ -165,7 +168,7 @@ internal object ComposeViewHierarchyNode { } val isVisible = - !node.outerCoordinator.isTransparent() && + !SentryLayoutNodeHelper.isTransparent(node) && (semantics == null || !semantics.contains(SemanticsProperties.InvisibleToUser)) && visibleRect.height() > 0 && visibleRect.width() > 0 @@ -301,7 +304,7 @@ internal object ComposeViewHierarchyNode { options: SentryMaskingOptions, logger: ILogger, ) { - val children = this.children + val children = SentryLayoutNodeHelper.getChildren(this) if (children.isEmpty()) { return } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/SentryLayoutNodeHelper.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/SentryLayoutNodeHelper.kt new file mode 100644 index 00000000000..6cfe5ec6fc0 --- /dev/null +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/SentryLayoutNodeHelper.kt @@ -0,0 +1,90 @@ +@file:Suppress( + "INVISIBLE_MEMBER", + "INVISIBLE_REFERENCE", + "EXPOSED_PARAMETER_TYPE", + "EXPOSED_RETURN_TYPE", + "EXPOSED_FUNCTION_RETURN_TYPE", +) + +package io.sentry.android.replay.viewhierarchy + +import androidx.compose.ui.node.LayoutNode +import androidx.compose.ui.node.NodeCoordinator +import java.lang.reflect.Method + +/** + * Provides access to internal LayoutNode members that are subject to Kotlin name-mangling. + * + * This class is not thread-safe, as Compose UI operations are expected to be performed on the main + * thread. + * + * Compiled against Compose >= 1.10 where the mangled names use the "ui" module suffix (e.g. + * getChildren$ui()). For apps still on Compose < 1.10 (where the suffix is "$ui_release"), the + * direct call will throw [NoSuchMethodError] and we fall back to reflection-based accessors that + * are resolved and cached on first use. + */ +internal object SentryLayoutNodeHelper { + private class Fallback(val getChildren: Method?, val getOuterCoordinator: Method?) + + private var useFallback: Boolean? = null + private var fallback: Fallback? = null + + private fun tryResolve(clazz: Class<*>, name: String): Method? { + return try { + clazz.getDeclaredMethod(name).apply { isAccessible = true } + } catch (_: NoSuchMethodException) { + null + } + } + + @Suppress("UNCHECKED_CAST") + fun getChildren(node: LayoutNode): List { + when (useFallback) { + false -> return node.children + true -> { + return getFallback().getChildren!!.invoke(node) as List + } + null -> { + try { + return node.children.also { useFallback = false } + } catch (_: NoSuchMethodError) { + useFallback = true + return getFallback().getChildren!!.invoke(node) as List + } + } + } + } + + fun isTransparent(node: LayoutNode): Boolean { + when (useFallback) { + false -> return node.outerCoordinator.isTransparent() + true -> { + val fb = getFallback() + val coordinator = fb.getOuterCoordinator!!.invoke(node) as NodeCoordinator + return coordinator.isTransparent() + } + null -> { + try { + return node.outerCoordinator.isTransparent().also { useFallback = false } + } catch (_: NoSuchMethodError) { + useFallback = true + val fb = getFallback() + val coordinator = fb.getOuterCoordinator!!.invoke(node) as NodeCoordinator + return coordinator.isTransparent() + } + } + } + } + + private fun getFallback(): Fallback { + fallback?.let { + return it + } + + val layoutNodeClass = LayoutNode::class.java + val getChildren = tryResolve(layoutNodeClass, "getChildren\$ui_release") + val getOuterCoordinator = tryResolve(layoutNodeClass, "getOuterCoordinator\$ui_release") + + return Fallback(getChildren, getOuterCoordinator).also { fallback = it } + } +} diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt index 801c8b6e12b..e043b035668 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt @@ -44,7 +44,6 @@ import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHiera import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode import java.io.File -import java.lang.reflect.InvocationTargetException import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -183,7 +182,7 @@ class ComposeMaskingOptionsTest { val node = mock() whenever(node.semanticsConfiguration).thenThrow(RuntimeException("Compose Runtime Error")) - assertThrows(InvocationTargetException::class.java) { + assertThrows(RuntimeException::class.java) { ComposeViewHierarchyNode.retrieveSemanticsConfiguration(node) } } diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt index bf6a55110be..54deb774c53 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt @@ -44,68 +44,56 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT val rootLayoutNode = root.root - val queue: Queue = LinkedList() - queue.add(rootLayoutNode) + // Pair + val queue: Queue> = LinkedList() + queue.add(Pair(rootLayoutNode, null)) - // the final tag to return + // the final tag to return, only relevant for clicks + // as for scrolls, we return the first matching element var targetTag: String? = null - // the last known tag when iterating the node tree - var lastKnownTag: String? = null while (!queue.isEmpty()) { - val node = queue.poll() ?: continue + val (node, parentTag) = queue.poll() ?: continue if (node.isPlaced && layoutNodeBoundsContain(rootLayoutNode, node, x, y)) { - var isClickable = false - var isScrollable = false - - val modifiers = node.getModifierInfo() - for (index in modifiers.indices) { - val modifierInfo = modifiers[index] - val tag = composeHelper!!.extractTag(modifierInfo.modifier) - if (tag != null) { - lastKnownTag = tag - } - - if (modifierInfo.modifier is SemanticsModifier) { - val semanticsModifierCore = modifierInfo.modifier as SemanticsModifier - val semanticsConfiguration = semanticsModifierCore.semanticsConfiguration - - for (item in semanticsConfiguration) { - val key: String = item.key.name - if ("ScrollBy" == key) { - isScrollable = true - } else if ("OnClick" == key) { - isClickable = true + val tag = extractTag(composeHelper!!, node) ?: parentTag + if (tag != null) { + val modifiers = node.getModifierInfo() + for (index in modifiers.indices) { + val modifierInfo = modifiers[index] + if (modifierInfo.modifier is SemanticsModifier) { + val semanticsModifierCore = modifierInfo.modifier as SemanticsModifier + val semanticsConfiguration = semanticsModifierCore.semanticsConfiguration + + for (item in semanticsConfiguration) { + val key: String = item.key.name + if (targetType == UiElement.Type.SCROLLABLE && "ScrollBy" == key) { + return UiElement(null, null, null, tag, ORIGIN) + } else if (targetType == UiElement.Type.CLICKABLE && "OnClick" == key) { + targetTag = tag + } + } + } else { + // Jetpack Compose 1.5+: uses Node modifiers elements for clicks/scrolls + val modifier = modifierInfo.modifier + val type = modifier.javaClass.name + if ( + targetType == UiElement.Type.CLICKABLE && + ("androidx.compose.foundation.ClickableElement" == type || + "androidx.compose.foundation.CombinedClickableElement" == type) + ) { + targetTag = tag + } else if ( + targetType == UiElement.Type.SCROLLABLE && + ("androidx.compose.foundation.ScrollingLayoutElement" == type || + "androidx.compose.foundation.ScrollingContainerElement" == type) + ) { + return UiElement(null, null, null, tag, ORIGIN) } - } - } else { - val modifier = modifierInfo.modifier - // Newer Jetpack Compose 1.5 uses Node modifiers for clicks/scrolls - val type = modifier.javaClass.name - if ( - "androidx.compose.foundation.ClickableElement" == type || - "androidx.compose.foundation.CombinedClickableElement" == type - ) { - isClickable = true - } else if ( - "androidx.compose.foundation.ScrollingLayoutElement" == type || - "androidx.compose.foundation.ScrollingContainerElement" == type - ) { - isScrollable = true } } } - - if (isClickable && targetType == UiElement.Type.CLICKABLE) { - targetTag = lastKnownTag - } - if (isScrollable && targetType == UiElement.Type.SCROLLABLE) { - targetTag = lastKnownTag - // skip any children for scrollable targets - break - } + queue.addAll(node.zSortedChildren.asMutableList().map { Pair(it, tag) }) } - queue.addAll(node.zSortedChildren.asMutableList()) } return if (targetTag == null) { @@ -125,6 +113,18 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT return bounds.contains(Offset(x, y)) } + private fun extractTag(composeHelper: SentryComposeHelper, node: LayoutNode): String? { + val modifiers = node.getModifierInfo() + for (index in modifiers.indices) { + val modifierInfo = modifiers[index] + val tag = composeHelper.extractTag(modifierInfo.modifier) + if (tag != null) { + return tag + } + } + return null + } + public companion object { private const val ORIGIN = "jetpack_compose" } diff --git a/sentry-compose/src/androidUnitTest/kotlin/androidx/compose/foundation/GestureModifierStubs.kt b/sentry-compose/src/androidUnitTest/kotlin/androidx/compose/foundation/GestureModifierStubs.kt new file mode 100644 index 00000000000..43b3e53bc67 --- /dev/null +++ b/sentry-compose/src/androidUnitTest/kotlin/androidx/compose/foundation/GestureModifierStubs.kt @@ -0,0 +1,15 @@ +package androidx.compose.foundation + +import androidx.compose.ui.Modifier + +/** + * Stub classes used by [io.sentry.compose.gestures.ComposeGestureTargetLocatorTest] so that Mockito + * mocks of these classes return the correct [Class.getName] values at runtime. + */ +internal open class ClickableElement : Modifier.Element + +internal open class CombinedClickableElement : Modifier.Element + +internal open class ScrollingLayoutElement : Modifier.Element + +internal open class ScrollingContainerElement : Modifier.Element diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt new file mode 100644 index 00000000000..8efdf3ebe30 --- /dev/null +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt @@ -0,0 +1,703 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + +package io.sentry.compose.gestures + +import androidx.compose.runtime.collection.mutableVectorOf +import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Rect +import androidx.compose.ui.layout.AlignmentLine +import androidx.compose.ui.layout.LayoutCoordinates +import androidx.compose.ui.layout.ModifierInfo +import androidx.compose.ui.node.LayoutNode +import androidx.compose.ui.node.Owner +import androidx.compose.ui.semantics.SemanticsConfiguration +import androidx.compose.ui.semantics.SemanticsModifier +import androidx.compose.ui.semantics.SemanticsPropertyKey +import androidx.compose.ui.unit.IntSize +import io.sentry.NoOpLogger +import io.sentry.internal.gestures.UiElement +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertNull +import org.junit.Before +import org.junit.Test +import org.mockito.Mockito +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever + +class ComposeGestureTargetLocatorTest { + + private val locator = ComposeGestureTargetLocator(NoOpLogger.getInstance()) + + /** + * Maps each child [LayoutCoordinates] to its bounding rect. Used by [FakeRootCoordinates] to + * return correct bounds when [LayoutCoordinates.localBoundingBoxOf] is called. + */ + private val coordsBounds = mutableMapOf() + + private lateinit var rootCoordinates: LayoutCoordinates + + @Before + fun setUp() { + coordsBounds.clear() + rootCoordinates = FakeRootCoordinates(1000, 1000, coordsBounds) + coordsBounds[rootCoordinates] = Rect(0f, 0f, 1000f, 1000f) + } + + @Test + fun `returns null for non-Owner root`() { + val result = locator.locate("not an owner", 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `returns null for null root`() { + val result = locator.locate(null, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `returns null when no clickable elements`() { + val root = mockLayoutNode(isPlaced = true, tag = "root", width = 100, height = 100) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `detects clickable via SemanticsModifier OnClick`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "btn", + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("btn", result!!.tag) + assertEquals("jetpack_compose", result.origin) + } + + @Test + fun `detects scrollable via SemanticsModifier ScrollBy`() { + val scrollableChild = + mockLayoutNode( + isPlaced = true, + tag = "list", + width = 50, + height = 50, + semanticsKeys = listOf("ScrollBy"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(scrollableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) + assertNotNull(result) + assertEquals("list", result!!.tag) + } + + @Test + fun `detects clickable via ClickableElement modifier`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "btn", + width = 50, + height = 50, + nodeModifierClassName = "androidx.compose.foundation.ClickableElement", + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("btn", result!!.tag) + } + + @Test + fun `detects clickable via CombinedClickableElement modifier`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "btn", + width = 50, + height = 50, + nodeModifierClassName = "androidx.compose.foundation.CombinedClickableElement", + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("btn", result!!.tag) + } + + @Test + fun `detects scrollable via ScrollingLayoutElement modifier`() { + val scrollableChild = + mockLayoutNode( + isPlaced = true, + tag = "scroll", + width = 50, + height = 50, + nodeModifierClassName = "androidx.compose.foundation.ScrollingLayoutElement", + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(scrollableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) + assertNotNull(result) + assertEquals("scroll", result!!.tag) + } + + @Test + fun `detects scrollable via ScrollingContainerElement modifier`() { + val scrollableChild = + mockLayoutNode( + isPlaced = true, + tag = "scroll", + width = 50, + height = 50, + nodeModifierClassName = "androidx.compose.foundation.ScrollingContainerElement", + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(scrollableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) + assertNotNull(result) + assertEquals("scroll", result!!.tag) + } + + @Test + fun `ignores clickable when looking for scrollable`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "btn", + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) + assertNull(result) + } + + @Test + fun `ignores scrollable when looking for clickable`() { + val scrollableChild = + mockLayoutNode( + isPlaced = true, + tag = "list", + width = 50, + height = 50, + semanticsKeys = listOf("ScrollBy"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(scrollableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `skips unplaced nodes`() { + val unplacedClickable = + mockLayoutNode( + isPlaced = false, + tag = "btn", + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(unplacedClickable), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `skips nodes outside bounds`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "btn", + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + left = 200f, + top = 200f, + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 300, + height = 300, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + // click at (5, 5) is outside the child bounds (200-250, 200-250) + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `child inherits parent tag`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + ) + val taggedParent = + mockLayoutNode( + isPlaced = true, + tag = "parent_tag", + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 200, + height = 200, + children = listOf(taggedParent), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("parent_tag", result!!.tag) + } + + @Test + fun `returns deepest clickable for clicks`() { + val deepChild = + mockLayoutNode( + isPlaced = true, + tag = "deep_btn", + width = 20, + height = 20, + semanticsKeys = listOf("OnClick"), + ) + val parentClickable = + mockLayoutNode( + isPlaced = true, + tag = "parent_btn", + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + children = listOf(deepChild), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(parentClickable), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("deep_btn", result!!.tag) + } + + @Test + fun `returns first scrollable immediately`() { + val deepScrollable = + mockLayoutNode( + isPlaced = true, + tag = "deep_scroll", + width = 20, + height = 20, + semanticsKeys = listOf("ScrollBy"), + ) + val parentScrollable = + mockLayoutNode( + isPlaced = true, + tag = "parent_scroll", + width = 50, + height = 50, + semanticsKeys = listOf("ScrollBy"), + children = listOf(deepScrollable), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(parentScrollable), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.SCROLLABLE) + assertNotNull(result) + assertEquals("parent_scroll", result!!.tag) + } + + @Test + fun `returns null when node has no tag and no parent tag`() { + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 50, + height = 50, + semanticsKeys = listOf("OnClick"), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(clickableChild), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNull(result) + } + + @Test + fun `finds tagged clickable nested under untagged containers`() { + // Tree: root(no tag) -> container(no tag) -> container(no tag) -> clickable(tag="deep_btn") + val clickableChild = + mockLayoutNode( + isPlaced = true, + tag = "deep_btn", + width = 10, + height = 10, + semanticsKeys = listOf("OnClick"), + ) + val innerContainer = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 30, + height = 30, + children = listOf(clickableChild), + ) + val outerContainer = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 60, + height = 60, + children = listOf(innerContainer), + ) + val root = + mockLayoutNode( + isPlaced = true, + tag = null, + width = 100, + height = 100, + children = listOf(outerContainer), + ) + val owner = mockOwner(root) + + val result = locator.locate(owner, 5f, 5f, UiElement.Type.CLICKABLE) + assertNotNull(result) + assertEquals("deep_btn", result!!.tag) + } + + // -- helpers -- + + private fun mockOwner(rootNode: LayoutNode): Owner { + // Wire the root node's coordinates to the shared rootCoordinates + whenever(rootNode.coordinates).thenReturn(rootCoordinates) + val owner = mock() + whenever(owner.root).thenReturn(rootNode) + return owner + } + + private fun mockLayoutNode( + isPlaced: Boolean, + tag: String?, + width: Int, + height: Int, + children: List = emptyList(), + semanticsKeys: List = emptyList(), + nodeModifierClassName: String? = null, + left: Float = 0f, + top: Float = 0f, + ): LayoutNode { + val node = Mockito.mock(LayoutNode::class.java) + whenever(node.isPlaced).thenReturn(isPlaced) + + val modifierInfoList = mutableListOf() + + if (tag != null) { + val tagModifierInfo = mockTestTagModifierInfo(tag) + if (tagModifierInfo != null) { + modifierInfoList.add(tagModifierInfo) + } else { + modifierInfoList.add(mockSemanticsTagModifierInfo(tag)) + } + } + + if (semanticsKeys.isNotEmpty()) { + modifierInfoList.add(mockSemanticsKeysModifierInfo(semanticsKeys)) + } + + if (nodeModifierClassName != null) { + modifierInfoList.add(mockNodeModifierInfo(nodeModifierClassName)) + } + + whenever(node.getModifierInfo()).thenReturn(modifierInfoList) + whenever(node.zSortedChildren) + .thenReturn(mutableVectorOf().apply { addAll(children) }) + + val coordinates = FakeChildCoordinates(left, top, width.toFloat(), height.toFloat()) + coordsBounds[coordinates] = Rect(left, top, left + width, top + height) + whenever(node.coordinates).thenReturn(coordinates) + + return node + } + + /** + * Fake root [LayoutCoordinates] that avoids Mockito issues with inline classes like [Offset]. + * Implements [localBoundingBoxOf] by looking up child bounds in [coordsBounds], and + * [localToWindow] as an identity transform. + */ + private class FakeRootCoordinates( + private val width: Int, + private val height: Int, + private val boundsMap: Map, + ) : LayoutCoordinates { + override val size: IntSize + get() = IntSize(width, height) + + override val isAttached: Boolean + get() = true + + override val parentLayoutCoordinates: LayoutCoordinates? + get() = null + + override val parentCoordinates: LayoutCoordinates? + get() = null + + override val providedAlignmentLines: Set + get() = emptySet() + + override fun get(alignmentLine: AlignmentLine): Int = AlignmentLine.Unspecified + + override fun windowToLocal(relativeToWindow: Offset): Offset = relativeToWindow + + override fun localToWindow(relativeToLocal: Offset): Offset = relativeToLocal + + override fun localToRoot(relativeToLocal: Offset): Offset = relativeToLocal + + override fun localPositionOf( + sourceCoordinates: LayoutCoordinates, + relativeToSource: Offset, + ): Offset = relativeToSource + + override fun localBoundingBoxOf( + sourceCoordinates: LayoutCoordinates, + clipBounds: Boolean, + ): Rect = boundsMap[sourceCoordinates] ?: Rect.Zero + + @Deprecated("Deprecated in interface") + override fun localToScreen(relativeToLocal: Offset): Offset = relativeToLocal + + @Deprecated("Deprecated in interface") + override fun screenToLocal(relativeToScreen: Offset): Offset = relativeToScreen + } + + /** + * Minimal fake [LayoutCoordinates] for child nodes. The actual bounds are resolved via + * [FakeRootCoordinates.localBoundingBoxOf], so this only needs identity implementations. + */ + private class FakeChildCoordinates( + private val left: Float, + private val top: Float, + private val width: Float, + private val height: Float, + ) : LayoutCoordinates { + override val size: IntSize + get() = IntSize(width.toInt(), height.toInt()) + + override val isAttached: Boolean + get() = true + + override val parentLayoutCoordinates: LayoutCoordinates? + get() = null + + override val parentCoordinates: LayoutCoordinates? + get() = null + + override val providedAlignmentLines: Set + get() = emptySet() + + override fun get(alignmentLine: AlignmentLine): Int = AlignmentLine.Unspecified + + override fun windowToLocal(relativeToWindow: Offset): Offset = relativeToWindow + + override fun localToWindow(relativeToLocal: Offset): Offset = relativeToLocal + + override fun localToRoot(relativeToLocal: Offset): Offset = relativeToLocal + + override fun localPositionOf( + sourceCoordinates: LayoutCoordinates, + relativeToSource: Offset, + ): Offset = relativeToSource + + override fun localBoundingBoxOf( + sourceCoordinates: LayoutCoordinates, + clipBounds: Boolean, + ): Rect = Rect(left, top, left + width, top + height) + + @Deprecated("Deprecated in interface") + override fun localToScreen(relativeToLocal: Offset): Offset = relativeToLocal + + @Deprecated("Deprecated in interface") + override fun screenToLocal(relativeToScreen: Offset): Offset = relativeToScreen + } + + companion object { + private fun mockTestTagModifierInfo(tag: String): ModifierInfo? { + return try { + val clazz = Class.forName("androidx.compose.ui.platform.TestTagElement") + val constructor = clazz.declaredConstructors.firstOrNull() ?: return null + constructor.isAccessible = true + val instance = constructor.newInstance(tag) as Modifier + val modifierInfo = Mockito.mock(ModifierInfo::class.java) + whenever(modifierInfo.modifier).thenReturn(instance) + modifierInfo + } catch (_: Throwable) { + null + } + } + + private fun mockSemanticsTagModifierInfo(tag: String): ModifierInfo { + val modifierInfo = Mockito.mock(ModifierInfo::class.java) + whenever(modifierInfo.modifier) + .thenReturn( + object : SemanticsModifier { + override val semanticsConfiguration: SemanticsConfiguration + get() { + val config = SemanticsConfiguration() + config.set(SemanticsPropertyKey("TestTag") { s: String?, _: String? -> s }, tag) + return config + } + } + ) + return modifierInfo + } + + private fun mockSemanticsKeysModifierInfo(keys: List): ModifierInfo { + val modifierInfo = Mockito.mock(ModifierInfo::class.java) + whenever(modifierInfo.modifier) + .thenReturn( + object : SemanticsModifier { + override val semanticsConfiguration: SemanticsConfiguration + get() { + val config = SemanticsConfiguration() + for (key in keys) { + config.set(SemanticsPropertyKey(key) { _, _ -> }, Unit) + } + return config + } + } + ) + return modifierInfo + } + + private fun mockNodeModifierInfo(className: String): ModifierInfo { + val modifierWithClassName = + Mockito.mock( + try { + Class.forName(className) + } catch (_: ClassNotFoundException) { + Modifier::class.java + } + ) as Modifier + val modifierInfo = Mockito.mock(ModifierInfo::class.java) + whenever(modifierInfo.modifier).thenReturn(modifierWithClassName) + return modifierInfo + } + } +} From 28b6988cfc57f1857fedf2e65141f76b5b5ce557 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 17 Mar 2026 14:34:34 +0100 Subject: [PATCH 059/391] feat(feedback): implement shake gesture detection (#5150) * feat(feedback): implement shake gesture detection for user feedback form Adds SentryShakeDetector (accelerometer-based) and ShakeDetectionIntegration that shows the feedback dialog when a shake is detected. Controlled by SentryFeedbackOptions.useShakeGesture (default false). Co-Authored-By: Claude Opus 4.6 * fix(feedback): improve shake detection robustness and add tests - Add volatile/AtomicLong for thread-safe cross-thread field access - Use SystemClock.elapsedRealtime() instead of System.currentTimeMillis() - Use SENSOR_DELAY_NORMAL for better battery efficiency - Add multi-shake counting (2+ threshold crossings within 1.5s window) - Handle deferred init for already-resumed activities - Wrap showDialog() in try-catch to prevent app crashes - Improve activity transition handling in onActivityPaused - Mark SentryShakeDetector as @ApiStatus.Internal - Add unit tests for SentryShakeDetector and ShakeDetectionIntegration Co-Authored-By: Claude Opus 4.6 * fix(feedback): prevent stacking multiple feedback dialogs on repeated shakes Track dialog visibility with an isDialogShowing flag that is set before showing and cleared via the onFormClose callback when the dialog is dismissed. Double-checked on both sensor and UI threads to avoid races. Co-Authored-By: Claude Opus 4.6 * fix(feedback): restore original onFormClose to prevent callback chain growth Save the user's original onFormClose once during register() and restore it after each dialog dismiss, instead of wrapping it with a new lambda each time. Co-Authored-By: Claude Opus 4.6 * fix(feedback): reset isDialogShowing on activity pause to prevent stuck flag If showDialog silently fails (e.g. activity destroyed between post and execution), isDialogShowing would stay true forever, permanently disabling shake-to-feedback. Reset it in onActivityPaused since the dialog cannot outlive its host activity. Co-Authored-By: Claude Opus 4.6 * fix(feedback): move isDialogShowing reset from onActivityPaused to onActivityDestroyed AlertDialog survives pause/resume cycles (e.g. screen off/on), so resetting isDialogShowing in onActivityPaused allowed duplicate dialogs. Move the reset to onActivityDestroyed where the dialog truly cannot survive. Co-Authored-By: Claude Opus 4.6 * fix(feedback): scope dialog flag to hosting activity and restore callback on error - Only reset isDialogShowing in onActivityDestroyed when it's the activity that hosts the dialog, not any unrelated activity. - Restore originalOnFormClose in the catch block when showDialog throws. Co-Authored-By: Claude Opus 4.6 * Optimise comparison Co-authored-by: LucasZF * ref(feedback): address review feedback from lucas-zimerman - Rename ShakeDetectionIntegration to FeedbackShakeIntegration to clarify its purpose is feedback-specific (#1) - Avoid Math.sqrt by comparing squared gForce values (#3) - Null out listener before unregistering sensor to prevent in-flight callbacks during stop (#4) Co-Authored-By: Claude Opus 4.6 * fix(feedback): capture onFormClose at shake time instead of registration Capture the current onFormClose callback just before showing the dialog rather than caching it during register(). This ensures callbacks set by the user after SDK init are preserved across shake-triggered dialogs. Co-Authored-By: Claude Opus 4.6 * Reverse sample changes * fix(feedback): restore onFormClose in onActivityDestroyed fallback path When the dialog's host activity is destroyed and onDismiss doesn't fire, onActivityDestroyed now restores the previous onFormClose callback on global options, preventing a stale wrapper from affecting subsequent non-shake feedback dialogs. Co-Authored-By: Claude Opus 4.6 * fix(feedback): make previousOnFormClose volatile for thread safety Co-Authored-By: Claude Opus 4.6 * fix(feedback): always restore onFormClose in onActivityDestroyed even when null The previous null check on previousOnFormClose skipped restoration when no user callback was set, leaving a stale wrapper in global options. Co-Authored-By: Claude Opus 4.6 * Update changelog * ref(feedback): address review feedback for shake gesture detection - Reuse single SentryShakeDetector instance across activity transitions instead of re-creating on every resume (reduces allocations) - Memoize SensorManager and Sensor lookups to avoid repeated binder calls - Use getDefaultSensor(TYPE_ACCELEROMETER, false) to avoid wakeup sensor - Deliver sensor events on a background HandlerThread instead of main thread - Use SentryUserFeedbackDialog.Builder directly with tracked activity instead of going through showDialog/CurrentActivityHolder - Merge dialogActivity into currentActivity, use AppState.isInBackground() to gate against background shakes - Fix integration count in SentryAndroidTest (19 -> 20) Tested manually on Pixel 8 Pro by enabling useShakeGesture in the sample app's SentryAndroid.init and verifying shake opens the feedback dialog. Co-Authored-By: Claude Opus 4.6 * Format code * feat(feedback): add manifest meta-data support for useShakeGesture Allow enabling shake gesture via AndroidManifest.xml: Co-Authored-By: Claude Opus 4.6 * fix(feedback): preserve currentActivity in onActivityPaused when dialog is showing onActivityPaused always fires before onActivityDestroyed. Without this fix, currentActivity was set to null in onPause, making the cleanup condition in onActivityDestroyed (activity == currentActivity) always false. This left isDialogShowing permanently stuck as true, disabling shake-to-feedback for the rest of the session. Co-Authored-By: Claude Opus 4.6 * fix(feedback): pass real logger to SentryShakeDetector on init The detector was constructed with NoOpLogger and the logger field was final, so all diagnostic messages (sensor unavailable warnings) were silently swallowed. Now init(context, logger) updates the logger from SentryOptions. Co-Authored-By: Claude Opus 4.6 * Format code * fix(feedback): clear stale activity ref and reset shake state on stop - Clear currentActivity in onActivityDestroyed to prevent holding a stale reference to a destroyed activity context - Reset shakeCount and firstShakeTimestamp in stop() to prevent cross-session false triggers across pause/resume cycles Co-Authored-By: Claude Opus 4.6 * fix(feedback): clean up dialog state when a different activity resumes When a dialog is showing on Activity A and the user navigates to Activity B (e.g. via notification), onActivityResumed(B) overwrites currentActivity. Later onActivityDestroyed(A) can't match and cleanup never runs, leaving isDialogShowing permanently stuck. Now we detect this in onActivityResumed and clean up proactively. Co-Authored-By: Claude Opus 4.6 * fix(feedback): capture onFormClose as local variable in lambda The onFormClose lambda was reading previousOnFormClose field at dismiss time. If onActivityResumed or onActivityDestroyed already restored and nulled the field, the lambda would overwrite onFormClose with null. Now captured as a local variable at dialog creation time. Co-Authored-By: Claude Opus 4.6 * fix(feedback): restore onFormClose in close() when dialog is showing When close() is called while a dialog is showing, lifecycle callbacks are unregistered so onActivityDestroyed cleanup won't fire. Restore previousOnFormClose and reset dialog state in close() to prevent the callback from being permanently overwritten. Co-Authored-By: Claude Opus 4.6 * fix(feedback): check isFinishing/isDestroyed before showing dialog Add proactive activity validity check inside the runOnUiThread lambda to avoid hitting the catch block with a BadTokenException when the activity becomes invalid between the shake callback and UI execution. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * Enable the feature on the demo app for easier testing * Use a weak reference for activity * Reuse sentry-shake handler thread * Add close to the API * fix(feedback): use instanceof check for SentryAndroidOptions cast Follow the established defensive pattern used by all other Android integrations instead of an unchecked cast that could throw ClassCastException if a hybrid SDK passes a different options type. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: LucasZF Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 6 + .../api/sentry-android-core.api | 26 +++ .../core/AndroidOptionsInitializer.java | 1 + .../core/FeedbackShakeIntegration.java | 198 ++++++++++++++++++ .../android/core/ManifestMetadataReader.java | 5 + .../android/core/SentryShakeDetector.java | 153 ++++++++++++++ .../core/FeedbackShakeIntegrationTest.kt | 106 ++++++++++ .../core/ManifestMetadataReaderTest.kt | 25 +++ .../sentry/android/core/SentryAndroidTest.kt | 3 +- .../android/core/SentryShakeDetectorTest.kt | 165 +++++++++++++++ .../src/main/AndroidManifest.xml | 3 + sentry/api/sentry.api | 2 + .../java/io/sentry/SentryFeedbackOptions.java | 24 +++ 13 files changed, 716 insertions(+), 1 deletion(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 866a450519a..5bc9a21cf98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +### Features + +- Show feedback form on device shake ([#5150](https://github.com/getsentry/sentry-java/pull/5150)) + - Enable via `options.getFeedbackOptions().setUseShakeGesture(true)` or manifest meta-data `io.sentry.feedback.use-shake-gesture` + - Uses the device's accelerometer — no special permissions required + ### Fixes - Support masking/unmasking and click/scroll detection for Jetpack Compose 1.10+ ([#5189](https://github.com/getsentry/sentry-java/pull/5189)) diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 4e7e7b4c5c2..0d83082548f 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -269,6 +269,19 @@ public abstract class io/sentry/android/core/EnvelopeFileObserverIntegration : i public final fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V } +public final class io/sentry/android/core/FeedbackShakeIntegration : android/app/Application$ActivityLifecycleCallbacks, io/sentry/Integration, java/io/Closeable { + public fun (Landroid/app/Application;)V + public fun close ()V + public fun onActivityCreated (Landroid/app/Activity;Landroid/os/Bundle;)V + public fun onActivityDestroyed (Landroid/app/Activity;)V + public fun onActivityPaused (Landroid/app/Activity;)V + public fun onActivityResumed (Landroid/app/Activity;)V + public fun onActivitySaveInstanceState (Landroid/app/Activity;Landroid/os/Bundle;)V + public fun onActivityStarted (Landroid/app/Activity;)V + public fun onActivityStopped (Landroid/app/Activity;)V + public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V +} + public abstract interface class io/sentry/android/core/IDebugImagesLoader { public abstract fun clearDebugImages ()V public abstract fun loadDebugImages ()Ljava/util/List; @@ -462,6 +475,19 @@ public final class io/sentry/android/core/SentryScreenshotOptions : io/sentry/Se public fun trackCustomMasking ()V } +public final class io/sentry/android/core/SentryShakeDetector : android/hardware/SensorEventListener { + public fun (Lio/sentry/ILogger;)V + public fun close ()V + public fun onAccuracyChanged (Landroid/hardware/Sensor;I)V + public fun onSensorChanged (Landroid/hardware/SensorEvent;)V + public fun start (Landroid/content/Context;Lio/sentry/android/core/SentryShakeDetector$Listener;)V + public fun stop ()V +} + +public abstract interface class io/sentry/android/core/SentryShakeDetector$Listener { + public abstract fun onShake ()V +} + public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Button { public fun (Landroid/content/Context;)V public fun (Landroid/content/Context;Landroid/util/AttributeSet;)V diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index f83960a3e6b..5f7fad69b5d 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -410,6 +410,7 @@ static void installDefaultIntegrations( (Application) context, buildInfoProvider, activityFramesTracker)); options.addIntegration(new ActivityBreadcrumbsIntegration((Application) context)); options.addIntegration(new UserInteractionIntegration((Application) context, loadClass)); + options.addIntegration(new FeedbackShakeIntegration((Application) context)); if (isFragmentAvailable) { options.addIntegration(new FragmentLifecycleIntegration((Application) context, true, true)); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java new file mode 100644 index 00000000000..b845b6ed8c4 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java @@ -0,0 +1,198 @@ +package io.sentry.android.core; + +import static io.sentry.util.IntegrationUtils.addIntegrationToSdkVersion; + +import android.app.Activity; +import android.app.Application; +import android.os.Bundle; +import io.sentry.IScopes; +import io.sentry.Integration; +import io.sentry.SentryLevel; +import io.sentry.SentryOptions; +import io.sentry.util.Objects; +import java.io.Closeable; +import java.io.IOException; +import java.lang.ref.WeakReference; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Detects shake gestures and shows the user feedback dialog when a shake is detected. Only active + * when {@link io.sentry.SentryFeedbackOptions#isUseShakeGesture()} returns {@code true}. + */ +public final class FeedbackShakeIntegration + implements Integration, Closeable, Application.ActivityLifecycleCallbacks { + + private final @NotNull Application application; + private final @NotNull SentryShakeDetector shakeDetector; + private @Nullable SentryAndroidOptions options; + private volatile @Nullable WeakReference currentActivityRef; + private volatile boolean isDialogShowing = false; + private volatile @Nullable Runnable previousOnFormClose; + + public FeedbackShakeIntegration(final @NotNull Application application) { + this.application = Objects.requireNonNull(application, "Application is required"); + this.shakeDetector = new SentryShakeDetector(io.sentry.NoOpLogger.getInstance()); + } + + @Override + public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions sentryOptions) { + this.options = + Objects.requireNonNull( + (sentryOptions instanceof SentryAndroidOptions) + ? (SentryAndroidOptions) sentryOptions + : null, + "SentryAndroidOptions is required"); + + if (!this.options.getFeedbackOptions().isUseShakeGesture()) { + return; + } + + shakeDetector.init(application, options.getLogger()); + + addIntegrationToSdkVersion("FeedbackShake"); + application.registerActivityLifecycleCallbacks(this); + options.getLogger().log(SentryLevel.DEBUG, "FeedbackShakeIntegration installed."); + + // In case of a deferred init, hook into any already-resumed activity + final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity(); + if (activity != null) { + currentActivityRef = new WeakReference<>(activity); + startShakeDetection(activity); + } + } + + @Override + public void close() throws IOException { + application.unregisterActivityLifecycleCallbacks(this); + shakeDetector.close(); + // Restore onFormClose if a dialog is still showing, since lifecycle callbacks + // are now unregistered and onActivityDestroyed cleanup won't fire. + if (isDialogShowing) { + isDialogShowing = false; + if (options != null) { + options.getFeedbackOptions().setOnFormClose(previousOnFormClose); + } + previousOnFormClose = null; + } + currentActivityRef = null; + } + + @Override + public void onActivityResumed(final @NotNull Activity activity) { + // If a dialog is showing on a different activity (e.g. user navigated via notification), + // clean up since the dialog's host activity is going away and onActivityDestroyed + // won't match currentActivity anymore. + final @Nullable Activity current = currentActivityRef != null ? currentActivityRef.get() : null; + if (isDialogShowing && current != null && current != activity) { + isDialogShowing = false; + if (options != null) { + options.getFeedbackOptions().setOnFormClose(previousOnFormClose); + } + previousOnFormClose = null; + } + currentActivityRef = new WeakReference<>(activity); + startShakeDetection(activity); + } + + @Override + public void onActivityPaused(final @NotNull Activity activity) { + // Only stop if this is the activity we're tracking. When transitioning between + // activities, B.onResume may fire before A.onPause — stopping unconditionally + // would kill shake detection for the new activity. + final @Nullable Activity current = currentActivityRef != null ? currentActivityRef.get() : null; + if (activity == current) { + stopShakeDetection(); + // Keep currentActivityRef set when a dialog is showing so onActivityDestroyed + // can still match and clean up. Otherwise the cleanup condition + // (activity == current) would always be false since onPause fires + // before onDestroy. + if (!isDialogShowing) { + currentActivityRef = null; + } + } + } + + @Override + public void onActivityCreated( + final @NotNull Activity activity, final @Nullable Bundle savedInstanceState) {} + + @Override + public void onActivityStarted(final @NotNull Activity activity) {} + + @Override + public void onActivityStopped(final @NotNull Activity activity) {} + + @Override + public void onActivitySaveInstanceState( + final @NotNull Activity activity, final @NotNull Bundle outState) {} + + @Override + public void onActivityDestroyed(final @NotNull Activity activity) { + // Only reset if this is the activity that hosts the dialog — the dialog cannot + // outlive its host activity being destroyed. + final @Nullable Activity current = currentActivityRef != null ? currentActivityRef.get() : null; + if (isDialogShowing && activity == current) { + isDialogShowing = false; + currentActivityRef = null; + if (options != null) { + options.getFeedbackOptions().setOnFormClose(previousOnFormClose); + } + previousOnFormClose = null; + } + } + + private void startShakeDetection(final @NotNull Activity activity) { + if (options == null) { + return; + } + // Stop any existing detection (e.g. when transitioning between activities) + stopShakeDetection(); + shakeDetector.start( + activity, + () -> { + final @Nullable WeakReference ref = currentActivityRef; + final Activity active = ref != null ? ref.get() : null; + final Boolean inBackground = AppState.getInstance().isInBackground(); + if (active != null + && options != null + && !isDialogShowing + && !Boolean.TRUE.equals(inBackground)) { + active.runOnUiThread( + () -> { + if (isDialogShowing || active.isFinishing() || active.isDestroyed()) { + return; + } + try { + isDialogShowing = true; + final Runnable captured = options.getFeedbackOptions().getOnFormClose(); + previousOnFormClose = captured; + options + .getFeedbackOptions() + .setOnFormClose( + () -> { + isDialogShowing = false; + options.getFeedbackOptions().setOnFormClose(captured); + if (captured != null) { + captured.run(); + } + previousOnFormClose = null; + }); + new SentryUserFeedbackDialog.Builder(active).create().show(); + } catch (Throwable e) { + isDialogShowing = false; + options.getFeedbackOptions().setOnFormClose(previousOnFormClose); + previousOnFormClose = null; + options + .getLogger() + .log(SentryLevel.ERROR, "Failed to show feedback dialog on shake.", e); + } + }); + } + }); + } + + private void stopShakeDetection() { + shakeDetector.stop(); + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 940fe8f4362..822d7fbbe08 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -167,6 +167,8 @@ final class ManifestMetadataReader { static final String FEEDBACK_SHOW_BRANDING = "io.sentry.feedback.show-branding"; + static final String FEEDBACK_USE_SHAKE_GESTURE = "io.sentry.feedback.use-shake-gesture"; + static final String SPOTLIGHT_ENABLE = "io.sentry.spotlight.enable"; static final String SPOTLIGHT_CONNECTION_URL = "io.sentry.spotlight.url"; @@ -661,6 +663,9 @@ static void applyMetadata( metadata, logger, FEEDBACK_USE_SENTRY_USER, feedbackOptions.isUseSentryUser())); feedbackOptions.setShowBranding( readBool(metadata, logger, FEEDBACK_SHOW_BRANDING, feedbackOptions.isShowBranding())); + feedbackOptions.setUseShakeGesture( + readBool( + metadata, logger, FEEDBACK_USE_SHAKE_GESTURE, feedbackOptions.isUseShakeGesture())); options.setEnableSpotlight( readBool(metadata, logger, SPOTLIGHT_ENABLE, options.isEnableSpotlight())); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java new file mode 100644 index 00000000000..5b6f63309ff --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java @@ -0,0 +1,153 @@ +package io.sentry.android.core; + +import android.content.Context; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.SystemClock; +import io.sentry.ILogger; +import io.sentry.SentryLevel; +import java.util.concurrent.atomic.AtomicLong; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Detects shake gestures using the device's accelerometer. + * + *

The accelerometer sensor (TYPE_ACCELEROMETER) does NOT require any special permissions on + * Android. The BODY_SENSORS permission is only needed for heart rate and similar body sensors. + * + *

Requires at least {@link #SHAKE_COUNT_THRESHOLD} accelerometer readings above {@link + * #SHAKE_THRESHOLD_GRAVITY} within {@link #SHAKE_WINDOW_MS} to trigger a shake event. + * + *

Sensor events are delivered on a background {@link HandlerThread} to avoid polluting the main + * thread. + */ +@ApiStatus.Internal +public final class SentryShakeDetector implements SensorEventListener { + + private static final float SHAKE_THRESHOLD_GRAVITY = 2.7f; + private static final int SHAKE_WINDOW_MS = 1500; + private static final int SHAKE_COUNT_THRESHOLD = 2; + private static final int SHAKE_COOLDOWN_MS = 1000; + + private @Nullable SensorManager sensorManager; + private @Nullable Sensor accelerometer; + private @Nullable HandlerThread handlerThread; + private @Nullable Handler handler; + private final @NotNull AtomicLong lastShakeTimestamp = new AtomicLong(0); + private volatile @Nullable Listener listener; + private @NotNull ILogger logger; + + private int shakeCount = 0; + private long firstShakeTimestamp = 0; + + public interface Listener { + void onShake(); + } + + public SentryShakeDetector(final @NotNull ILogger logger) { + this.logger = logger; + } + + /** + * Initializes the sensor manager and accelerometer sensor. This is separated from start() so the + * values can be resolved once and reused across activity transitions. + */ + void init(final @NotNull Context context, final @NotNull ILogger logger) { + this.logger = logger; + init(context); + } + + private void init(final @NotNull Context context) { + if (sensorManager == null) { + sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); + } + if (sensorManager != null && accelerometer == null) { + accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER, false); + } + if (accelerometer != null && handlerThread == null) { + handlerThread = new HandlerThread("sentry-shake"); + handlerThread.start(); + handler = new Handler(handlerThread.getLooper()); + } + } + + public void start(final @NotNull Context context, final @NotNull Listener shakeListener) { + this.listener = shakeListener; + init(context); + if (sensorManager == null) { + logger.log(SentryLevel.WARNING, "SensorManager is not available. Shake detection disabled."); + return; + } + if (accelerometer == null) { + logger.log( + SentryLevel.WARNING, "Accelerometer sensor not available. Shake detection disabled."); + return; + } + sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL, handler); + } + + public void stop() { + listener = null; + shakeCount = 0; + firstShakeTimestamp = 0; + if (sensorManager != null) { + sensorManager.unregisterListener(this); + } + } + + /** Stops detection and releases the background thread. */ + public void close() { + stop(); + if (handlerThread != null) { + handlerThread.quitSafely(); + handlerThread = null; + handler = null; + } + } + + @Override + public void onSensorChanged(final @NotNull SensorEvent event) { + if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER) { + return; + } + float gX = event.values[0] / SensorManager.GRAVITY_EARTH; + float gY = event.values[1] / SensorManager.GRAVITY_EARTH; + float gZ = event.values[2] / SensorManager.GRAVITY_EARTH; + double gForceSquared = gX * gX + gY * gY + gZ * gZ; + if (gForceSquared > SHAKE_THRESHOLD_GRAVITY * SHAKE_THRESHOLD_GRAVITY) { + long now = SystemClock.elapsedRealtime(); + + // Reset counter if outside the detection window + if (now - firstShakeTimestamp > SHAKE_WINDOW_MS) { + shakeCount = 0; + firstShakeTimestamp = now; + } + + shakeCount++; + + if (shakeCount >= SHAKE_COUNT_THRESHOLD) { + // Enforce cooldown so we don't fire repeatedly + long lastShake = lastShakeTimestamp.get(); + if (now - lastShake > SHAKE_COOLDOWN_MS) { + lastShakeTimestamp.set(now); + shakeCount = 0; + final @Nullable Listener currentListener = listener; + if (currentListener != null) { + currentListener.onShake(); + } + } + } + } + } + + @Override + public void onAccuracyChanged(final @NotNull Sensor sensor, final int accuracy) { + // Not needed for shake detection. + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt new file mode 100644 index 00000000000..cb940686c30 --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt @@ -0,0 +1,106 @@ +package io.sentry.android.core + +import android.app.Activity +import android.app.Application +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.Scopes +import io.sentry.SentryFeedbackOptions +import kotlin.test.BeforeTest +import kotlin.test.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +@RunWith(AndroidJUnit4::class) +class FeedbackShakeIntegrationTest { + + private class Fixture { + val application = mock() + val scopes = mock() + val options = SentryAndroidOptions().apply { dsn = "https://key@sentry.io/proj" } + val activity = mock() + val dialogHandler = mock() + + init { + options.feedbackOptions.setDialogHandler(dialogHandler) + } + + fun getSut(useShakeGesture: Boolean = true): FeedbackShakeIntegration { + options.feedbackOptions.isUseShakeGesture = useShakeGesture + return FeedbackShakeIntegration(application) + } + } + + private val fixture = Fixture() + + @BeforeTest + fun setup() { + CurrentActivityHolder.getInstance().clearActivity() + } + + @Test + fun `when useShakeGesture is enabled registers activity lifecycle callbacks`() { + val sut = fixture.getSut(useShakeGesture = true) + sut.register(fixture.scopes, fixture.options) + + verify(fixture.application).registerActivityLifecycleCallbacks(any()) + } + + @Test + fun `when useShakeGesture is disabled does not register activity lifecycle callbacks`() { + val sut = fixture.getSut(useShakeGesture = false) + sut.register(fixture.scopes, fixture.options) + + verify(fixture.application, never()).registerActivityLifecycleCallbacks(any()) + } + + @Test + fun `close unregisters activity lifecycle callbacks`() { + val sut = fixture.getSut() + sut.register(fixture.scopes, fixture.options) + + sut.close() + + verify(fixture.application).unregisterActivityLifecycleCallbacks(any()) + } + + @Test + fun `hooks into already-resumed activity on deferred init`() { + CurrentActivityHolder.getInstance().setActivity(fixture.activity) + whenever(fixture.activity.getSystemService(any())).thenReturn(null) + + val sut = fixture.getSut() + sut.register(fixture.scopes, fixture.options) + + // The integration should have attempted to start shake detection + // (it will fail gracefully because SensorManager is null in tests, + // but the important thing is it tried) + } + + @Test + fun `does not crash when no activity is available on deferred init`() { + val sut = fixture.getSut() + sut.register(fixture.scopes, fixture.options) + // Should not throw + } + + @Test + fun `onActivityPaused stops shake detection`() { + val sut = fixture.getSut() + sut.register(fixture.scopes, fixture.options) + + whenever(fixture.activity.getSystemService(any())).thenReturn(null) + sut.onActivityResumed(fixture.activity) + sut.onActivityPaused(fixture.activity) + // Should not throw, shake detection stopped gracefully + } + + @Test + fun `close without register does not crash`() { + val sut = fixture.getSut() + sut.close() + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index b9b7d40e48a..ba01a9ecf7a 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -1950,6 +1950,31 @@ class ManifestMetadataReaderTest { assertFalse(fixture.options.feedbackOptions.isShowBranding) } + @Test + fun `applyMetadata reads feedback use shake gesture and keep default value if not found`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertFalse(fixture.options.feedbackOptions.isUseShakeGesture) + } + + @Test + fun `applyMetadata reads feedback use shake gesture to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.FEEDBACK_USE_SHAKE_GESTURE to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.feedbackOptions.isUseShakeGesture) + } + @Test fun `applyMetadata reads screenshot strategy canvas to options`() { // Arrange diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index c0010fa64e3..9c0f68c3f98 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -477,7 +477,7 @@ class SentryAndroidTest { fixture.initSut(context = mock()) { options -> optionsRef = options options.dsn = "https://key@sentry.io/123" - assertEquals(19, options.integrations.size) + assertEquals(20, options.integrations.size) options.integrations.removeAll { it is UncaughtExceptionHandlerIntegration || it is ShutdownHookIntegration || @@ -490,6 +490,7 @@ class SentryAndroidTest { it is ActivityLifecycleIntegration || it is ActivityBreadcrumbsIntegration || it is UserInteractionIntegration || + it is FeedbackShakeIntegration || it is FragmentLifecycleIntegration || it is SentryTimberIntegration || it is AppComponentsBreadcrumbsIntegration || diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt new file mode 100644 index 00000000000..98441e48a8d --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt @@ -0,0 +1,165 @@ +package io.sentry.android.core + +import android.content.Context +import android.hardware.Sensor +import android.hardware.SensorEvent +import android.hardware.SensorManager +import android.os.Handler +import android.os.SystemClock +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.ILogger +import kotlin.test.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.eq +import org.mockito.kotlin.isA +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +@RunWith(AndroidJUnit4::class) +class SentryShakeDetectorTest { + + private class Fixture { + val logger = mock() + val context = mock() + val sensorManager = mock() + val accelerometer = mock() + val listener = mock() + + init { + whenever(context.getSystemService(Context.SENSOR_SERVICE)).thenReturn(sensorManager) + whenever(sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER, false)) + .thenReturn(accelerometer) + } + + fun getSut(): SentryShakeDetector { + return SentryShakeDetector(logger) + } + } + + private val fixture = Fixture() + + @Test + fun `registers sensor listener on start`() { + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + verify(fixture.sensorManager) + .registerListener( + eq(sut), + eq(fixture.accelerometer), + eq(SensorManager.SENSOR_DELAY_NORMAL), + isA(), + ) + } + + @Test + fun `unregisters sensor listener on stop`() { + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + sut.stop() + + verify(fixture.sensorManager).unregisterListener(sut) + } + + @Test + fun `does not crash when SensorManager is null`() { + whenever(fixture.context.getSystemService(Context.SENSOR_SERVICE)).thenReturn(null) + + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + verify(fixture.sensorManager, never()) + .registerListener(any(), any(), any(), any()) + } + + @Test + fun `does not crash when accelerometer is null`() { + whenever(fixture.sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER, false)) + .thenReturn(null) + + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + verify(fixture.sensorManager, never()) + .registerListener(any(), any(), any(), any()) + } + + @Test + fun `triggers listener when shake is detected`() { + // Advance clock so cooldown check (now - 0 > 1000) passes + SystemClock.setCurrentTimeMillis(2000) + + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + // Needs at least SHAKE_COUNT_THRESHOLD (2) readings above threshold + val event1 = createSensorEvent(floatArrayOf(30f, 0f, 0f)) + sut.onSensorChanged(event1) + val event2 = createSensorEvent(floatArrayOf(30f, 0f, 0f)) + sut.onSensorChanged(event2) + + verify(fixture.listener).onShake() + } + + @Test + fun `does not trigger listener on single shake`() { + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + // A single threshold crossing should not trigger + val event = createSensorEvent(floatArrayOf(30f, 0f, 0f)) + sut.onSensorChanged(event) + + verify(fixture.listener, never()).onShake() + } + + @Test + fun `does not trigger listener below threshold`() { + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + // Gravity only (1G) - no shake + val event = createSensorEvent(floatArrayOf(0f, 0f, SensorManager.GRAVITY_EARTH)) + sut.onSensorChanged(event) + + verify(fixture.listener, never()).onShake() + } + + @Test + fun `does not trigger listener for non-accelerometer events`() { + val sut = fixture.getSut() + sut.start(fixture.context, fixture.listener) + + val event = createSensorEvent(floatArrayOf(30f, 0f, 0f), sensorType = Sensor.TYPE_GYROSCOPE) + sut.onSensorChanged(event) + + verify(fixture.listener, never()).onShake() + } + + @Test + fun `stop without start does not crash`() { + val sut = fixture.getSut() + sut.stop() + } + + private fun createSensorEvent( + values: FloatArray, + sensorType: Int = Sensor.TYPE_ACCELEROMETER, + ): SensorEvent { + val sensor = mock() + whenever(sensor.type).thenReturn(sensorType) + + val constructor = SensorEvent::class.java.getDeclaredConstructor(Int::class.javaPrimitiveType) + constructor.isAccessible = true + val event = constructor.newInstance(values.size) + values.copyInto(event.values) + + val sensorField = SensorEvent::class.java.getField("sensor") + sensorField.set(event, sensor) + + return event + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index d73a3150f0a..548e5e8ac0d 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -271,5 +271,8 @@ + diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 0b8171da631..5b8f973e756 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3158,6 +3158,7 @@ public final class io/sentry/SentryFeedbackOptions { public fun isShowEmail ()Z public fun isShowName ()Z public fun isUseSentryUser ()Z + public fun isUseShakeGesture ()Z public fun setCancelButtonLabel (Ljava/lang/CharSequence;)V public fun setDialogHandler (Lio/sentry/SentryFeedbackOptions$IDialogHandler;)V public fun setEmailLabel (Ljava/lang/CharSequence;)V @@ -3180,6 +3181,7 @@ public final class io/sentry/SentryFeedbackOptions { public fun setSubmitButtonLabel (Ljava/lang/CharSequence;)V public fun setSuccessMessageText (Ljava/lang/CharSequence;)V public fun setUseSentryUser (Z)V + public fun setUseShakeGesture (Z)V public fun toString ()Ljava/lang/String; } diff --git a/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java b/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java index 77e0741f8d6..2a0ead54234 100644 --- a/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java +++ b/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java @@ -35,6 +35,9 @@ public final class SentryFeedbackOptions { /** Displays the Sentry logo inside of the form. Defaults to true. */ private boolean showBranding = true; + /** Shows the feedback form when a shake gesture is detected. Defaults to {@code false}. */ + private boolean useShakeGesture = false; + // Text Customization /** The title of the feedback form. Defaults to "Report a Bug". */ private @NotNull CharSequence formTitle = "Report a Bug"; @@ -102,6 +105,7 @@ public SentryFeedbackOptions(final @NotNull SentryFeedbackOptions other) { this.showEmail = other.showEmail; this.useSentryUser = other.useSentryUser; this.showBranding = other.showBranding; + this.useShakeGesture = other.useShakeGesture; this.formTitle = other.formTitle; this.submitButtonLabel = other.submitButtonLabel; this.cancelButtonLabel = other.cancelButtonLabel; @@ -234,6 +238,24 @@ public void setShowBranding(final boolean showBranding) { this.showBranding = showBranding; } + /** + * Shows the feedback form when a shake gesture is detected. Defaults to {@code false}. + * + * @return true if shake gesture triggers the feedback form + */ + public boolean isUseShakeGesture() { + return useShakeGesture; + } + + /** + * Sets whether the feedback form is shown when a shake gesture is detected. + * + * @param useShakeGesture true to enable shake gesture triggering + */ + public void setUseShakeGesture(final boolean useShakeGesture) { + this.useShakeGesture = useShakeGesture; + } + /** * The title of the feedback form. Defaults to "Report a Bug". * @@ -547,6 +569,8 @@ public String toString() { + useSentryUser + ", showBranding=" + showBranding + + ", useShakeGesture=" + + useShakeGesture + ", formTitle='" + formTitle + '\'' From c40144aa5a4f99cf0d72048eb7e870dee8c7f0a4 Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Tue, 17 Mar 2026 17:14:37 +0000 Subject: [PATCH 060/391] release: 8.36.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc9a21cf98..5d303a3c1e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.36.0 ### Features diff --git a/gradle.properties b/gradle.properties index 05e47bc6ade..c9900e412b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.35.0 +versionName=8.36.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 2dfcf3a0392112e212648ffe19e4dd42927b3a48 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 09:58:07 +0000 Subject: [PATCH 061/391] chore: update scripts/update-sentry-native-ndk.sh to 0.13.3 (#5215) Co-authored-by: GitHub --- .github/workflows/integration-tests-benchmarks.yml | 2 +- gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 5796cc0e020..bbef5db31fa 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -106,7 +106,7 @@ jobs: run: ./gradlew :sentry-android-integration-tests:test-app-sentry:assembleRelease - name: Collect app metrics - uses: getsentry/action-app-sdk-overhead-metrics@v1 + uses: getsentry/action-app-sdk-overhead-metrics@5f2d99b8e5a7b833386524924d24320501099a44 with: config: sentry-android-integration-tests/metrics-test.yml sauce-user: ${{ secrets.SAUCE_USERNAME }} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d659e43438c..7b53258a5a6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -148,7 +148,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.2" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.3" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From d3458802ef3450cb992771ef0b700ca539814c8f Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 20 Mar 2026 11:44:09 +0100 Subject: [PATCH 062/391] chore(ci): Fix app overhead metrics action failing because of Appium version (#5216) --- .github/workflows/integration-tests-benchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index bbef5db31fa..24310f9ec81 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -106,7 +106,7 @@ jobs: run: ./gradlew :sentry-android-integration-tests:test-app-sentry:assembleRelease - name: Collect app metrics - uses: getsentry/action-app-sdk-overhead-metrics@5f2d99b8e5a7b833386524924d24320501099a44 + uses: getsentry/action-app-sdk-overhead-metrics@ecce2e2718b6d97ad62220fca05627900b061ed5 with: config: sentry-android-integration-tests/metrics-test.yml sauce-user: ${{ secrets.SAUCE_USERNAME }} From 55aaf9b86d6887b277ff7ca70e3ccf1d2e143092 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 20 Mar 2026 12:03:11 +0100 Subject: [PATCH 063/391] feat(replay): add beforeErrorSampling callback to Session Replay (#5214) * feat(replay): add `beforeErrorSampling` callback to Session Replay Add a BeforeErrorSamplingCallback to SentryReplayOptions that lets developers filter which errors trigger replay capture. The callback runs before the onErrorSampleRate dice roll - returning false skips captureReplay entirely. Co-Authored-By: Claude Opus 4.6 (1M context) * docs: add changelog entry for beforeErrorSampling callback Co-Authored-By: Claude Opus 4.6 (1M context) * docs: use any{} in changelog example Co-Authored-By: Claude Opus 4.6 (1M context) * Apply suggestion from @romtsn --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 19 ++++ sentry/api/sentry.api | 6 ++ .../src/main/java/io/sentry/SentryClient.java | 20 +++- .../java/io/sentry/SentryReplayOptions.java | 47 ++++++++++ .../test/java/io/sentry/SentryClientTest.kt | 94 +++++++++++++++++++ 5 files changed, 185 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d303a3c1e6..57d640f385a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## Unreleased + +### Features + +- Android: Add `beforeErrorSampling` callback to Session Replay ([#5214](https://github.com/getsentry/sentry-java/pull/5214)) + - Allows filtering which errors trigger replay capture before the `onErrorSampleRate` is checked + - Returning `false` skips replay capture entirely for that error; returning `true` proceeds with the normal sample rate check + - Example usage: + ```java + SentryAndroid.init(context) { options -> + options.sessionReplay.beforeErrorSampling = + SentryReplayOptions.BeforeErrorSamplingCallback { event, hint -> + // Skip replay for handled exceptions + val hasUnhandled = event.exceptions?.any { it.mechanism?.isHandled == false } == true + hasUnhandled + } + } + ``` + ## 8.36.0 ### Features diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 5b8f973e756..cb9078ac07b 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3998,6 +3998,7 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun (ZLio/sentry/protocol/SdkVersion;)V public fun addMaskViewClass (Ljava/lang/String;)V public fun addUnmaskViewClass (Ljava/lang/String;)V + public fun getBeforeErrorSampling ()Lio/sentry/SentryReplayOptions$BeforeErrorSamplingCallback; public fun getErrorReplayDuration ()J public fun getFrameRate ()I public fun getNetworkDetailAllowUrls ()Ljava/util/List; @@ -4017,6 +4018,7 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun isSessionReplayEnabled ()Z public fun isSessionReplayForErrorsEnabled ()Z public fun isTrackConfiguration ()Z + public fun setBeforeErrorSampling (Lio/sentry/SentryReplayOptions$BeforeErrorSamplingCallback;)V public fun setDebug (Z)V public fun setMaskAllImages (Z)V public fun setMaskAllText (Z)V @@ -4034,6 +4036,10 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun trackCustomMasking ()V } +public abstract interface class io/sentry/SentryReplayOptions$BeforeErrorSamplingCallback { + public abstract fun execute (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Z +} + public final class io/sentry/SentryReplayOptions$SentryReplayQuality : java/lang/Enum { public static final field HIGH Lio/sentry/SentryReplayOptions$SentryReplayQuality; public static final field LOW Lio/sentry/SentryReplayOptions$SentryReplayQuality; diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 26c70f365f5..b8178e35517 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -231,7 +231,25 @@ private boolean shouldApplyScopeData(final @NotNull CheckIn event, final @NotNul // an event from the past. If it's cached, but with ApplyScopeData, it comes from the outbox // folder and we still want to capture replay (e.g. a native captureException error) if (event != null && !isBackfillable && !isCached && (event.isErrored() || event.isCrashed())) { - options.getReplayController().captureReplay(event.isCrashed()); + boolean shouldCaptureReplay = true; + final SentryReplayOptions.BeforeErrorSamplingCallback beforeErrorSampling = + options.getSessionReplay().getBeforeErrorSampling(); + if (beforeErrorSampling != null) { + try { + shouldCaptureReplay = beforeErrorSampling.execute(event, hint); + } catch (Throwable e) { + options + .getLogger() + .log( + SentryLevel.ERROR, + "The beforeErrorSampling callback threw an exception. Proceeding with replay capture.", + e); + shouldCaptureReplay = true; + } + } + if (shouldCaptureReplay) { + options.getReplayController().captureReplay(event.isCrashed()); + } } try { diff --git a/sentry/src/main/java/io/sentry/SentryReplayOptions.java b/sentry/src/main/java/io/sentry/SentryReplayOptions.java index 3c618bfee9d..d4e0fd257cd 100644 --- a/sentry/src/main/java/io/sentry/SentryReplayOptions.java +++ b/sentry/src/main/java/io/sentry/SentryReplayOptions.java @@ -17,6 +17,25 @@ public final class SentryReplayOptions extends SentryMaskingOptions { + /** + * Callback that is called before the error sample rate is checked for session replay. If the + * callback returns {@code false}, the replay will not be captured for this error event, and the + * {@code onErrorSampleRate} will not be checked. If the callback returns {@code true}, the {@code + * onErrorSampleRate} will be checked as usual. This allows developers to filter which errors + * trigger replay capture. + */ + public interface BeforeErrorSamplingCallback { + /** + * Determines whether replay capture should proceed for the given error event. + * + * @param event the error event that triggered the replay capture + * @param hint the hint associated with the event + * @return {@code true} if the error sample rate should be checked, {@code false} to skip replay + * capture entirely + */ + boolean execute(@NotNull SentryEvent event, @NotNull Hint hint); + } + private static final String CUSTOM_MASKING_INTEGRATION_NAME = "ReplayCustomMasking"; private volatile boolean customMaskingTracked = false; @@ -172,6 +191,12 @@ public enum SentryReplayQuality { */ private @NotNull List networkResponseHeaders = DEFAULT_HEADERS; + /** + * A callback that is called before the error sample rate is checked for session replay. Can be + * used to filter which errors trigger replay capture. + */ + private @Nullable BeforeErrorSamplingCallback beforeErrorSampling; + public SentryReplayOptions(final boolean empty, final @Nullable SdkVersion sdkVersion) { if (!empty) { // Add default mask classes directly without setting usingCustomMasking flag @@ -469,4 +494,26 @@ public void setNetworkResponseHeaders(final @NotNull List networkRespons merged.addAll(additionalHeaders); return Collections.unmodifiableList(new ArrayList<>(merged)); } + + /** + * Gets the callback that is called before the error sample rate is checked for session replay. + * + * @return the callback, or {@code null} if not set + */ + public @Nullable BeforeErrorSamplingCallback getBeforeErrorSampling() { + return beforeErrorSampling; + } + + /** + * Sets the callback that is called before the error sample rate is checked for session replay. + * Returning {@code false} from the callback will skip replay capture for the error event entirely + * (the {@code onErrorSampleRate} will not be checked). Returning {@code true} will proceed with + * the normal error sample rate check. + * + * @param beforeErrorSampling the callback, or {@code null} to disable filtering + */ + public void setBeforeErrorSampling( + final @Nullable BeforeErrorSamplingCallback beforeErrorSampling) { + this.beforeErrorSampling = beforeErrorSampling; + } } diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index e7c4ae84b99..11ff80fd573 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -3195,6 +3195,100 @@ class SentryClientTest { assertFalse(called) } + @Test + fun `beforeErrorSampling returning false skips captureReplay`() { + var called = false + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun captureReplay(isTerminating: Boolean?) { + called = true + } + } + ) + fixture.sentryOptions.sessionReplay.beforeErrorSampling = + SentryReplayOptions.BeforeErrorSamplingCallback { _, _ -> false } + val sut = fixture.getSut() + + sut.captureEvent(SentryEvent().apply { exceptions = listOf(SentryException()) }) + assertFalse(called) + } + + @Test + fun `beforeErrorSampling returning true proceeds with captureReplay`() { + var called = false + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun captureReplay(isTerminating: Boolean?) { + called = true + } + } + ) + fixture.sentryOptions.sessionReplay.beforeErrorSampling = + SentryReplayOptions.BeforeErrorSamplingCallback { _, _ -> true } + val sut = fixture.getSut() + + sut.captureEvent(SentryEvent().apply { exceptions = listOf(SentryException()) }) + assertTrue(called) + } + + @Test + fun `beforeErrorSampling not set proceeds with captureReplay`() { + var called = false + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun captureReplay(isTerminating: Boolean?) { + called = true + } + } + ) + val sut = fixture.getSut() + + sut.captureEvent(SentryEvent().apply { exceptions = listOf(SentryException()) }) + assertTrue(called) + } + + @Test + fun `beforeErrorSampling throwing exception proceeds with captureReplay`() { + var called = false + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun captureReplay(isTerminating: Boolean?) { + called = true + } + } + ) + fixture.sentryOptions.sessionReplay.beforeErrorSampling = + SentryReplayOptions.BeforeErrorSamplingCallback { _, _ -> throw RuntimeException("test") } + val sut = fixture.getSut() + + sut.captureEvent(SentryEvent().apply { exceptions = listOf(SentryException()) }) + assertTrue(called) + } + + @Test + fun `beforeErrorSampling receives correct event and hint`() { + var receivedEvent: SentryEvent? = null + var receivedHint: Hint? = null + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun captureReplay(isTerminating: Boolean?) {} + } + ) + fixture.sentryOptions.sessionReplay.beforeErrorSampling = + SentryReplayOptions.BeforeErrorSamplingCallback { event, hint -> + receivedEvent = event + receivedHint = hint + true + } + val sut = fixture.getSut() + + val event = SentryEvent().apply { exceptions = listOf(SentryException()) } + val hint = Hint() + sut.captureEvent(event, hint) + assertSame(event, receivedEvent) + assertSame(hint, receivedHint) + } + @Test fun `captures replay for cached events with apply scope`() { var called = false From e2dce0b7ae88cde49ff74fe2c23e77949c449815 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 23 Mar 2026 12:00:10 +0100 Subject: [PATCH 064/391] chore(pi): Add pi settings for local skills (#5222) --- .pi/settings.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .pi/settings.json diff --git a/.pi/settings.json b/.pi/settings.json new file mode 100644 index 00000000000..e614d527837 --- /dev/null +++ b/.pi/settings.json @@ -0,0 +1,6 @@ +{ + "skills": [ + "../.claude/skills" + ], + "enableSkillCommands": true +} From e6377ecdf191f63819ce16486971ca4942938c30 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 06:22:38 +0100 Subject: [PATCH 065/391] build(opentelemetry): Bump OpenTelemetry dependencies (#5225) * build(opentelemetry): Bump OpenTelemetry dependencies Update OpenTelemetry core, instrumentation, and semantic conventions\nversions in the shared version catalog.\n\nThis keeps sentry-java aligned with newer OTel releases used by the\nopentelemetry modules and samples.\n\nCo-Authored-By: Claude * changelog * docs(changelog): Clarify OpenTelemetry bump versions Align the OpenTelemetry changelog entry with prior dependency bump style\nby listing each artifact and including previous versions for context.\n\nThis makes the upgrade scope easier to review and mirrors the detail\nlevel used in earlier OpenTelemetry changelog entries.\n\nCo-Authored-By: Claude * ci(e2e): Enable Spring Boot 4 no-agent system tests Enable the spring-boot-4 opentelemetry-noagent sample in backend system-test matrix and spring-boot-4 workflow. This turns the previously commented-out no-agent scenario into an active CI check so regressions are caught automatically. Co-Authored-By: Claude * fix(opentelemetry): Use stable Attributes API in core tests Replace test usage of sdk.internal.AttributesMap with public Attributes builders.\n\nThe OTel dependency bump removed the internal class, which broke\n:sentry-opentelemetry:sentry-opentelemetry-core:compileTestKotlin and\ntherefore the full build. Co-Authored-By: Claude --------- Co-authored-by: Claude --- .github/workflows/spring-boot-4-matrix.yml | 15 ++++++------ .github/workflows/system-tests-backend.yml | 6 ++--- CHANGELOG.md | 9 +++++++ gradle/libs.versions.toml | 10 ++++---- .../OpenTelemetryAttributesExtractorTest.kt | 24 +++++++++++++++---- .../OtelInternalSpanDetectionUtilTest.kt | 21 +++++++++++++--- .../kotlin/SpanDescriptionExtractorTest.kt | 23 ++++++++++++++---- 7 files changed, 80 insertions(+), 28 deletions(-) diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index c82113828cc..b436a7f31ed 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -132,14 +132,13 @@ jobs: --auto-init "false" \ --build "true" -# needs a fix in opentelemetry-spring-boot-starter -# - name: Run sentry-samples-spring-boot-4-opentelemetry-noagent -# run: | -# python3 test/system-test-runner.py test \ -# --module "sentry-samples-spring-boot-4-opentelemetry-noagent" \ -# --agent false \ -# --auto-init "true" \ -# --build "true" + - name: Run sentry-samples-spring-boot-4-opentelemetry-noagent + run: | + python3 test/system-test-runner.py test \ + --module "sentry-samples-spring-boot-4-opentelemetry-noagent" \ + --agent false \ + --auto-init "true" \ + --build "true" - name: Run sentry-samples-spring-7 run: | diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 4f7929343cc..f57f81aaf84 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -72,9 +72,9 @@ jobs: - sample: "sentry-samples-spring-boot-4-webflux" agent: "false" agent-auto-init: "true" -# - sample: "sentry-samples-spring-boot-4-opentelemetry-noagent" -# agent: "false" -# agent-auto-init: "true" + - sample: "sentry-samples-spring-boot-4-opentelemetry-noagent" + agent: "false" + agent-auto-init: "true" - sample: "sentry-samples-spring-boot-4-opentelemetry" agent: "true" agent-auto-init: "true" diff --git a/CHANGELOG.md b/CHANGELOG.md index 57d640f385a..58d20127fbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,15 @@ } ``` +### Dependencies + +- Bump OpenTelemetry ([#5225](https://github.com/getsentry/sentry-java/pull/5225)) + - `opentelemetry` to `1.60.1` (was `1.57.0`) + - `opentelemetry-instrumentation` to `2.26.0` (was `2.23.0`) + - `opentelemetry-instrumentation-alpha` to `2.26.0-alpha` (was `2.23.0-alpha`) + - `opentelemetry-semconv` to `1.40.0` (was `1.37.0`) + - `opentelemetry-semconv-alpha` to `1.40.0-alpha` (was `1.37.0-alpha`) + ## 8.36.0 ### Features diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7b53258a5a6..60be4fd2c03 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,12 +22,12 @@ nopen = "1.0.1" # see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility # see https://developer.android.com/jetpack/androidx/releases/compose-kotlin okhttp = "4.9.2" -otel = "1.57.0" -otelInstrumentation = "2.23.0" -otelInstrumentationAlpha = "2.23.0-alpha" +otel = "1.60.1" +otelInstrumentation = "2.26.0" +otelInstrumentationAlpha = "2.26.0-alpha" # check https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/dependencyManagement/build.gradle.kts#L49 for release version above to find a compatible version -otelSemanticConventions = "1.37.0" -otelSemanticConventionsAlpha = "1.37.0-alpha" +otelSemanticConventions = "1.40.0" +otelSemanticConventionsAlpha = "1.40.0-alpha" retrofit = "2.9.0" slf4j = "1.7.30" springboot2 = "2.7.18" diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt index 5cc37d80f9c..6d37240f0b2 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt @@ -1,8 +1,7 @@ package io.sentry.opentelemetry import io.opentelemetry.api.common.AttributeKey -import io.opentelemetry.sdk.internal.AttributesMap -import io.opentelemetry.sdk.trace.SpanLimits +import io.opentelemetry.api.common.Attributes import io.opentelemetry.sdk.trace.data.SpanData import io.opentelemetry.semconv.HttpAttributes import io.opentelemetry.semconv.ServerAttributes @@ -22,12 +21,12 @@ import org.mockito.kotlin.whenever class OpenTelemetryAttributesExtractorTest { private class Fixture { val spanData = mock() - val attributes = AttributesMap.create(100, SpanLimits.getDefault().maxAttributeValueLength) + var attributes: Attributes = Attributes.empty() val options = SentryOptions.empty() val scope = Scope(options) init { - whenever(spanData.attributes).thenReturn(attributes) + whenever(spanData.attributes).thenAnswer { attributes } } } @@ -346,7 +345,22 @@ class OpenTelemetryAttributesExtractorTest { } private fun givenAttributes(map: Map, Any>) { - map.forEach { k, v -> fixture.attributes.put(k, v) } + fixture.attributes = buildAttributes(map) + } + + private fun buildAttributes(map: Map, Any>): Attributes { + val builder = Attributes.builder() + map.forEach { (key, value) -> putAttribute(builder, key, value) } + return builder.build() + } + + @Suppress("UNCHECKED_CAST") + private fun putAttribute( + builder: io.opentelemetry.api.common.AttributesBuilder, + key: AttributeKey, + value: Any, + ) { + builder.put(key as AttributeKey, value) } private fun whenExtractingAttributes() { diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt index bc453be6c1a..63a6c77c520 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt @@ -1,8 +1,8 @@ package io.sentry.opentelemetry import io.opentelemetry.api.common.AttributeKey +import io.opentelemetry.api.common.Attributes import io.opentelemetry.api.trace.SpanKind -import io.opentelemetry.sdk.internal.AttributesMap import io.opentelemetry.semconv.HttpAttributes import io.opentelemetry.semconv.ServerAttributes import io.opentelemetry.semconv.UrlAttributes @@ -17,7 +17,7 @@ import org.mockito.kotlin.whenever class OtelInternalSpanDetectionUtilTest { private class Fixture { val scopes = mock() - val attributes = AttributesMap.create(100, 100) + var attributes: Attributes = Attributes.empty() val options = SentryOptions.empty() var spanKind: SpanKind = SpanKind.INTERNAL @@ -152,7 +152,22 @@ class OtelInternalSpanDetectionUtilTest { } private fun givenAttributes(map: Map, Any>) { - map.forEach { k, v -> fixture.attributes.put(k, v) } + fixture.attributes = buildAttributes(map) + } + + private fun buildAttributes(map: Map, Any>): Attributes { + val builder = Attributes.builder() + map.forEach { (key, value) -> putAttribute(builder, key, value) } + return builder.build() + } + + @Suppress("UNCHECKED_CAST") + private fun putAttribute( + builder: io.opentelemetry.api.common.AttributesBuilder, + key: AttributeKey, + value: Any, + ) { + builder.put(key as AttributeKey, value) } private fun givenDsn(dsn: String) { diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt index af04914e278..9c5a1a352df 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt @@ -1,11 +1,11 @@ package io.sentry.opentelemetry import io.opentelemetry.api.common.AttributeKey +import io.opentelemetry.api.common.Attributes import io.opentelemetry.api.trace.SpanContext import io.opentelemetry.api.trace.SpanKind import io.opentelemetry.api.trace.TraceFlags import io.opentelemetry.api.trace.TraceState -import io.opentelemetry.sdk.internal.AttributesMap import io.opentelemetry.sdk.trace.data.SpanData import io.opentelemetry.semconv.HttpAttributes import io.opentelemetry.semconv.UrlAttributes @@ -22,14 +22,14 @@ class SpanDescriptionExtractorTest { private class Fixture { val sentrySpan = mock() val otelSpan = mock() - val attributes = AttributesMap.create(100, 100) + var attributes: Attributes = Attributes.empty() var parentSpanContext = SpanContext.getInvalid() var spanKind = SpanKind.INTERNAL var spanName: String? = null var spanDescription: String? = null fun setup() { - whenever(otelSpan.attributes).thenReturn(attributes) + whenever(otelSpan.attributes).thenAnswer { attributes } whenever(otelSpan.parentSpanContext).thenReturn(parentSpanContext) whenever(otelSpan.kind).thenReturn(spanKind) spanName?.let { whenever(otelSpan.name).thenReturn(it) } @@ -271,7 +271,22 @@ class SpanDescriptionExtractorTest { } private fun givenAttributes(map: Map, Any>) { - map.forEach { k, v -> fixture.attributes.put(k, v) } + fixture.attributes = buildAttributes(map) + } + + private fun buildAttributes(map: Map, Any>): Attributes { + val builder = Attributes.builder() + map.forEach { (key, value) -> putAttribute(builder, key, value) } + return builder.build() + } + + @Suppress("UNCHECKED_CAST") + private fun putAttribute( + builder: io.opentelemetry.api.common.AttributesBuilder, + key: AttributeKey, + value: Any, + ) { + builder.put(key as AttributeKey, value) } private fun whenExtractingSpanInfo(): OtelSpanInfo { From 65250bf782fc5ff89fc439edd3654beb01398ee0 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 06:22:57 +0100 Subject: [PATCH 066/391] chore(skills): Add .agents symlink for Claude skills (#5224) Add a project-local .agents/skills symlink that points to .claude/skills so pi can discover repository skills without per-repo .pi/settings.json.\n\nCo-Authored-By: Claude --- .agents/skills | 1 + 1 file changed, 1 insertion(+) create mode 120000 .agents/skills diff --git a/.agents/skills b/.agents/skills new file mode 120000 index 00000000000..454b8427cd7 --- /dev/null +++ b/.agents/skills @@ -0,0 +1 @@ +../.claude/skills \ No newline at end of file From 6839cb084560b75d78c3456af44c6caa2909a221 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 06:23:33 +0100 Subject: [PATCH 067/391] chore(repo): Ignore .factorypath and local Claude worktrees (#5227) --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b8c2d7e9da2..f232c32db51 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ local.properties **/sentry-native-local target/ .classpath +.factorypath .project .settings/ bin/ @@ -30,5 +31,6 @@ spy.log **/tomcat.8080/webapps/ **/__pycache__ -# Local Claude Code settings that should not be committed +# Local Claude Code settings/state that should not be committed .claude/settings.local.json +.claude/worktrees/ From 4c09f527dae5df7b9f7a37e73785bff58dc919a5 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 06:37:04 +0100 Subject: [PATCH 068/391] Add a /test skill to run singular tests or per module tests (#5111) * Add a /test skill to run singular tests or per module tests * fix(test): Correct Android task detection in test skill Map modules ending in -android to testDebugUnitTest so Android library modules like sentry-launchdarkly-android do not fall back to test. Add AskUserQuestion to allowed-tools so interactive mode can execute the decision prompts described in the skill under restricted tool settings. Co-Authored-By: Claude --------- Co-authored-by: Claude --- .claude/skills/test/SKILL.md | 85 ++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .claude/skills/test/SKILL.md diff --git a/.claude/skills/test/SKILL.md b/.claude/skills/test/SKILL.md new file mode 100644 index 00000000000..bdef12364f3 --- /dev/null +++ b/.claude/skills/test/SKILL.md @@ -0,0 +1,85 @@ +--- +name: test +description: Run tests for a specific SDK module. Use when asked to "run tests", "test module", "run unit tests", "run system tests", "run e2e tests", or test a specific class. Auto-detects unit vs system tests. Supports interactive mode. +allowed-tools: Bash, Read, Glob, AskUserQuestion +argument-hint: [interactive] [test-class-filter] +--- + +# Run Tests + +Run tests for a specific module. Auto-detects whether to run unit tests or system tests. + +## Step 0: Check for Interactive Mode + +If `$ARGUMENTS` starts with `interactive` (e.g., `/test interactive sentry ScopesTest`), enable interactive mode. Strip the `interactive` keyword from the arguments before proceeding. + +In interactive mode, use AskUserQuestion at decision points as described in the steps below. + +## Step 1: Parse the Argument + +The argument can be either: +- A **file path** (e.g., `@sentry/src/test/java/io/sentry/ScopesTest.kt`) +- A **module name** (e.g., `sentry-android-core`, `sentry-samples-spring-boot-4`) +- A **module name + test filter** (e.g., `sentry ScopesTest`) + +Extract the module name and optional test class filter from the argument. + +**Interactive mode:** If the test filter is ambiguous (e.g., matches multiple test classes across modules), use AskUserQuestion to let the user pick which test class(es) to run. + +## Step 2: Detect Test Type + +| Signal | Test Type | +|--------|-----------| +| Path contains `sentry-samples/` | System test | +| Module name starts with `sentry-samples-` | System test | +| Everything else | Unit test | + +## Step 3a: Run Unit Tests + +Determine the Gradle test task: + +| Module Pattern | Test Task | +|---------------|-----------| +| `sentry-android-*` | `testDebugUnitTest` | +| `sentry-compose*` | `testDebugUnitTest` | +| `*-android` | `testDebugUnitTest` | +| Everything else | `test` | + +**Interactive mode:** Before running, read the test class file and use AskUserQuestion to ask: +- "Run all tests in this class, or a specific method?" — list the test method names as options. + +If the user picks a specific method, use `--tests="*ClassName.methodName"` as the filter. + +With a test class filter: +```bash +./gradlew '::' --tests="**" --info +``` + +Without a filter: +```bash +./gradlew '::' --info +``` + +## Step 3b: Run System Tests + +System tests require the Python-based test runner which manages a mock Sentry server and sample app lifecycle. + +1. Ensure the Python venv exists: +```bash +test -d .venv || make setupPython +``` + +2. Extract the sample module name. For file paths like `sentry-samples//src/...`, the sample module is the directory name (e.g., `sentry-samples-spring`). + +3. Run the system test: +```bash +.venv/bin/python test/system-test-runner.py test --module +``` + +This starts the mock Sentry server, starts the sample app (Spring Boot/Tomcat/CLI), runs tests via `./gradlew :sentry-samples::systemTest`, and cleans up afterwards. + +## Step 4: Report Results + +Summarize the test outcome: +- Total tests run, passed, failed, skipped +- For failures: show the failing test name and the assertion/error message From ae6907dfcbc235a4e31e51b47c9d41aa7c2fe878 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 06:44:39 +0100 Subject: [PATCH 069/391] feat(core): Add configurable IScopesStorageFactory to SentryOptions (#5199) * feat(core): Add configurable IScopesStorageFactory to SentryOptions Allow users to provide a custom IScopesStorage factory via SentryOptions.setScopesStorageFactory(). When set, the custom factory takes precedence over the default auto-detection logic. Fixes #5193 Co-Authored-By: Claude Opus 4.6 (1M context) * changelog * ref(core): Have ScopesStorageFactory implement IScopesStorageFactory Add LoadClass and ILogger parameters to IScopesStorageFactory.create() so custom factories have access to class loading utilities. Co-Authored-By: Claude Opus 4.6 (1M context) * Revert "ref(core): Have ScopesStorageFactory implement IScopesStorageFactory" This reverts commit a0d77eb80af274e5fe6a7412bc3b6547f520c2f3. * feat(core): Pass SentryOptions to IScopesStorageFactory.create() SPI-discovered factory implementations are instantiated via ServiceLoader with no-arg constructors, so they need access to options like logger and DSN at creation time. Change the interface method signature to accept SentryOptions as a parameter. Co-Authored-By: Claude --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + sentry/api/sentry.api | 6 +++ .../java/io/sentry/IScopesStorageFactory.java | 11 +++++ sentry/src/main/java/io/sentry/Sentry.java | 5 +- .../main/java/io/sentry/SentryOptions.java | 23 ++++++++++ .../test/java/io/sentry/SentryOptionsTest.kt | 23 ++++++++++ sentry/src/test/java/io/sentry/SentryTest.kt | 46 +++++++++++++++++++ 7 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 sentry/src/main/java/io/sentry/IScopesStorageFactory.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 58d20127fbf..cbc6651ce34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- Add configurable `IScopesStorageFactory` to `SentryOptions` for providing a custom `IScopesStorage`, e.g. when the default `ThreadLocal`-backed storage is incompatible with non-pinning thread models ([#5199](https://github.com/getsentry/sentry-java/pull/5199)) - Android: Add `beforeErrorSampling` callback to Session Replay ([#5214](https://github.com/getsentry/sentry-java/pull/5214)) - Allows filtering which errors trigger replay capture before the `onErrorSampleRate` is checked - Returning `false` skips replay capture entirely for that error; returning `true` proceeds with the normal sample rate check diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index cb9078ac07b..1d8ff4d3e0d 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -1060,6 +1060,10 @@ public abstract interface class io/sentry/IScopesStorage { public abstract fun set (Lio/sentry/IScopes;)Lio/sentry/ISentryLifecycleToken; } +public abstract interface class io/sentry/IScopesStorageFactory { + public abstract fun create (Lio/sentry/SentryOptions;)Lio/sentry/IScopesStorage; +} + public abstract interface class io/sentry/ISentryClient { public abstract fun captureBatchedLogEvents (Lio/sentry/SentryLogEvents;)V public abstract fun captureBatchedMetricsEvents (Lio/sentry/SentryMetricsEvents;)V @@ -3631,6 +3635,7 @@ public class io/sentry/SentryOptions { public fun getReplayController ()Lio/sentry/ReplayController; public fun getSampleRate ()Ljava/lang/Double; public fun getScopeObservers ()Ljava/util/List; + public fun getScopesStorageFactory ()Lio/sentry/IScopesStorageFactory; public fun getSdkVersion ()Lio/sentry/protocol/SdkVersion; public fun getSentryClientName ()Ljava/lang/String; public fun getSerializer ()Lio/sentry/ISerializer; @@ -3783,6 +3788,7 @@ public class io/sentry/SentryOptions { public fun setRelease (Ljava/lang/String;)V public fun setReplayController (Lio/sentry/ReplayController;)V public fun setSampleRate (Ljava/lang/Double;)V + public fun setScopesStorageFactory (Lio/sentry/IScopesStorageFactory;)V public fun setSdkVersion (Lio/sentry/protocol/SdkVersion;)V public fun setSendClientReports (Z)V public fun setSendDefaultPii (Z)V diff --git a/sentry/src/main/java/io/sentry/IScopesStorageFactory.java b/sentry/src/main/java/io/sentry/IScopesStorageFactory.java new file mode 100644 index 00000000000..129d97a935a --- /dev/null +++ b/sentry/src/main/java/io/sentry/IScopesStorageFactory.java @@ -0,0 +1,11 @@ +package io.sentry; + +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +/** Factory for creating custom {@link IScopesStorage} implementations. */ +@ApiStatus.Experimental +public interface IScopesStorageFactory { + @NotNull + IScopesStorage create(@NotNull SentryOptions options); +} diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index 63caf829fc9..fee19dc4d09 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -439,7 +439,10 @@ private static void initFatalLogger(final @NotNull SentryOptions options) { private static void initScopesStorage(SentryOptions options) { getScopesStorage().close(); - if (SentryOpenTelemetryMode.OFF == options.getOpenTelemetryMode()) { + if (options.getScopesStorageFactory() != null) { + scopesStorage = options.getScopesStorageFactory().create(options); + scopesStorage.init(); + } else if (SentryOpenTelemetryMode.OFF == options.getOpenTelemetryMode()) { scopesStorage = new DefaultScopesStorage(); } else { scopesStorage = ScopesStorageFactory.create(new LoadClass(), NoOpLogger.getInstance()); diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index a831a11ea8e..862bd708aa4 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -557,6 +557,8 @@ public class SentryOptions { private @NotNull ISpanFactory spanFactory = NoOpSpanFactory.getInstance(); + private @Nullable IScopesStorageFactory scopesStorageFactory; + /** * Profiling traces rate. 101 hz means 101 traces in 1 second. Defaults to 101 to avoid possible * lockstep sampling. More on @@ -3557,6 +3559,27 @@ public void setSpanFactory(final @NotNull ISpanFactory spanFactory) { this.spanFactory = spanFactory; } + /** + * Returns the custom scopes storage factory, or null if auto-detection should be used. + * + * @return the custom scopes storage factory or null + */ + @ApiStatus.Experimental + public @Nullable IScopesStorageFactory getScopesStorageFactory() { + return scopesStorageFactory; + } + + /** + * Sets a custom factory for creating {@link IScopesStorage} implementations. When set, this + * factory takes precedence over the default auto-detection logic. + * + * @param scopesStorageFactory the custom factory, or null to use auto-detection + */ + @ApiStatus.Experimental + public void setScopesStorageFactory(final @Nullable IScopesStorageFactory scopesStorageFactory) { + this.scopesStorageFactory = scopesStorageFactory; + } + @ApiStatus.Experimental public @NotNull SentryOptions.Logs getLogs() { return logs; diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 960b2838e2a..1fd8d9cc81f 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -964,4 +964,27 @@ class SentryOptionsTest { options.logs.loggerBatchProcessorFactory = mock assertSame(mock, options.logs.loggerBatchProcessorFactory) } + + @Test + fun `scopesStorageFactory is null by default`() { + val options = SentryOptions() + assertNull(options.scopesStorageFactory) + } + + @Test + fun `scopesStorageFactory can be set and retrieved`() { + val options = SentryOptions() + val factory = IScopesStorageFactory { _ -> DefaultScopesStorage() } + options.scopesStorageFactory = factory + assertSame(factory, options.scopesStorageFactory) + } + + @Test + fun `scopesStorageFactory can be set to null`() { + val options = SentryOptions() + val factory = IScopesStorageFactory { _ -> DefaultScopesStorage() } + options.scopesStorageFactory = factory + options.scopesStorageFactory = null + assertNull(options.scopesStorageFactory) + } } diff --git a/sentry/src/test/java/io/sentry/SentryTest.kt b/sentry/src/test/java/io/sentry/SentryTest.kt index c3da8c1c123..25f45816b74 100644 --- a/sentry/src/test/java/io/sentry/SentryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTest.kt @@ -1723,4 +1723,50 @@ class SentryTest { javaClass.injectForField("name", "io.sentry.SentryTest\$CustomAndroidOptions") } } + + @Test + fun `when scopesStorageFactory is set, it is used instead of default storage`() { + val customStorage = mock() + whenever(customStorage.set(anyOrNull())).thenReturn(mock()) + whenever(customStorage.get()).thenReturn(null) + + initForTest { + it.dsn = dsn + it.scopesStorageFactory = IScopesStorageFactory { _ -> customStorage } + } + + verify(customStorage).init() + verify(customStorage).set(any()) + } + + @Test + fun `when scopesStorageFactory is null, default auto-detection is used`() { + initForTest { + it.dsn = dsn + it.scopesStorageFactory = null + } + + // Should work normally with DefaultScopesStorage + val scopes = Sentry.getCurrentScopes() + assertFalse(scopes.isNoOp) + } + + @Test + fun `custom scopes storage from factory is functional`() { + val backingStorage = DefaultScopesStorage() + val factoryCalled = AtomicBoolean(false) + + initForTest { + it.dsn = dsn + it.scopesStorageFactory = IScopesStorageFactory { _ -> + factoryCalled.set(true) + backingStorage + } + } + + assertTrue(factoryCalled.get()) + + val scopes = Sentry.getCurrentScopes() + assertFalse(scopes.isNoOp) + } } From 23b2680687921bdefe78ce704f591f5eece7f640 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Wed, 25 Mar 2026 08:00:01 +0100 Subject: [PATCH 070/391] fix(replay): text layouts with center/end alignment return incorrect masking bounding box (#5218) * Remove fill workaround, shortcut calculations if there's only one line of text * changelog * Revert "Remove fill workaround, shortcut calculations if there's only one line of text" This reverts commit cfdcadcf866ea5572f154cf2781d90b97fdc0984. * Work around erroneous paragraph return values * Cover some more edge cases * Format code * Trigger Build * fix dependencies * Add snapshot tests for non-ellipsized multi-line text masking Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Sentry Github Bot Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 + sentry-android-core/build.gradle.kts | 7 +- .../core/ScreenshotEventProcessorTest.kt | 392 ++++++++++++++++++ .../screenshot_mask_all.png | Bin 2673 -> 2608 bytes ...eenshot_mask_ellipsized_compose_masked.png | Bin 0 -> 2917 bytes ...nshot_mask_ellipsized_compose_unmasked.png | Bin 0 -> 20367 bytes ...screenshot_mask_ellipsized_view_masked.png | Bin 0 -> 2331 bytes ...reenshot_mask_ellipsized_view_unmasked.png | Bin 0 -> 16750 bytes .../screenshot_mask_text.png | Bin 8428 -> 8366 bytes .../screenshot_multiline_compose_masked.png | Bin 0 -> 3272 bytes .../screenshot_multiline_compose_unmasked.png | Bin 0 -> 28628 bytes .../screenshot_multiline_view_masked.png | Bin 0 -> 2924 bytes .../screenshot_multiline_view_unmasked.png | Bin 0 -> 20865 bytes .../io/sentry/android/replay/util/Nodes.kt | 72 ++-- .../sentry/android/replay/util/TextLayout.kt | 8 +- .../io/sentry/android/replay/util/Views.kt | 43 +- .../viewhierarchy/ComposeViewHierarchyNode.kt | 7 +- 17 files changed, 460 insertions(+), 73 deletions(-) create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_view_masked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_view_unmasked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_masked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_unmasked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png create mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_unmasked.png diff --git a/CHANGELOG.md b/CHANGELOG.md index cbc6651ce34..65b59334d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Session Replay: Fix Compose text masking mismatch with weighted text ([#5218](https://github.com/getsentry/sentry-java/pull/5218)) + ### Features - Add configurable `IScopesStorageFactory` to `SentryOptions` for providing a custom `IScopesStorage`, e.g. when the default `ThreadLocal`-backed storage is incompatible with non-pinning thread models ([#5199](https://github.com/getsentry/sentry-java/pull/5199)) diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 1134e948226..ffd42c7d4d7 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion plugins { id("com.android.library") alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.compose) jacoco alias(libs.plugins.jacoco.android) alias(libs.plugins.errorprone) @@ -108,7 +109,11 @@ dependencies { testImplementation(projects.sentryCompose) testImplementation(projects.sentryAndroidNdk) testImplementation(libs.dropbox.differ) - testRuntimeOnly(libs.androidx.compose.ui) + testImplementation(libs.androidx.activity.compose) + testImplementation(libs.androidx.compose.ui) + testImplementation(libs.androidx.compose.foundation) + testImplementation(libs.androidx.compose.foundation.layout) + testImplementation(libs.androidx.compose.material3) testRuntimeOnly(libs.androidx.fragment.ktx) testRuntimeOnly(libs.timber) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt index acc38228e6b..300936153f7 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt @@ -9,12 +9,27 @@ import android.graphics.Color import android.graphics.drawable.Drawable import android.os.Bundle import android.os.Looper +import android.text.TextUtils import android.view.View import android.widget.ImageView import android.widget.LinearLayout import android.widget.LinearLayout.LayoutParams import android.widget.RadioButton import android.widget.TextView +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import androidx.test.ext.junit.runners.AndroidJUnit4 import com.dropbox.differ.Color as DifferColor import com.dropbox.differ.Image @@ -410,6 +425,84 @@ class ScreenshotEventProcessorTest { assertNotNull(bytes) } + @Test + fun `snapshot - screenshot with ellipsized text no masking`() { + fixture.activity = buildActivity(EllipsizedTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots( + "screenshot_mask_ellipsized_view_unmasked", + isReplayAvailable = false, + ) + assertNotNull(bytes) + } + + @Test + fun `snapshot - screenshot with ellipsized text masking`() { + fixture.activity = buildActivity(EllipsizedTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_mask_ellipsized_view_masked") { + it.screenshot.setMaskAllText(true) + } + assertNotNull(bytes) + } + + @Test + fun `snapshot - compose text no masking`() { + fixture.activity = buildActivity(ComposeTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots( + "screenshot_mask_ellipsized_compose_unmasked", + isReplayAvailable = false, + ) + assertNotNull(bytes) + } + + @Test + fun `snapshot - compose text with masking`() { + fixture.activity = buildActivity(ComposeTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_mask_ellipsized_compose_masked") { + it.screenshot.setMaskAllText(true) + } + assertNotNull(bytes) + } + + @Test + fun `snapshot - multiline view text no masking`() { + fixture.activity = buildActivity(MultiLineTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_multiline_view_unmasked", isReplayAvailable = false) + assertNotNull(bytes) + } + + @Test + fun `snapshot - multiline view text with masking`() { + fixture.activity = buildActivity(MultiLineTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_multiline_view_masked") { + it.screenshot.setMaskAllText(true) + } + assertNotNull(bytes) + } + + @Test + fun `snapshot - multiline compose text no masking`() { + fixture.activity = buildActivity(ComposeMultiLineTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_multiline_compose_unmasked", isReplayAvailable = false) + assertNotNull(bytes) + } + + @Test + fun `snapshot - multiline compose text with masking`() { + fixture.activity = buildActivity(ComposeMultiLineTextActivity::class.java, null).setup().get() + val bytes = + processEventForSnapshots("screenshot_multiline_compose_masked") { + it.screenshot.setMaskAllText(true) + } + assertNotNull(bytes) + } + // endregion private fun getEvent(): SentryEvent = SentryEvent(Throwable("Throwable")) @@ -484,6 +577,305 @@ private class CustomView(context: Context) : View(context) { } } +private class EllipsizedTextActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val longText = "This is a very long text that should be ellipsized when it does not fit" + + val linearLayout = + LinearLayout(this).apply { + setBackgroundColor(Color.WHITE) + orientation = LinearLayout.VERTICAL + layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) + setPadding(10, 10, 10, 10) + } + + // Ellipsize end + linearLayout.addView( + TextView(this).apply { + text = longText + setTextColor(Color.BLACK) + textSize = 16f + maxLines = 1 + ellipsize = TextUtils.TruncateAt.END + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + // Ellipsize middle + linearLayout.addView( + TextView(this).apply { + text = longText + setTextColor(Color.BLACK) + textSize = 16f + maxLines = 1 + ellipsize = TextUtils.TruncateAt.MIDDLE + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + // Ellipsize start + linearLayout.addView( + TextView(this).apply { + text = longText + setTextColor(Color.BLACK) + textSize = 16f + maxLines = 1 + ellipsize = TextUtils.TruncateAt.START + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + // Non-ellipsized text for comparison + linearLayout.addView( + TextView(this).apply { + text = "Short text" + setTextColor(Color.BLACK) + textSize = 16f + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + setContentView(linearLayout) + } +} + +private class ComposeTextActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val longText = "This is a very long text that should be ellipsized when it does not fit in view" + + setContent { + Column( + modifier = + Modifier.fillMaxWidth() + .background(androidx.compose.ui.graphics.Color.White) + .padding(10.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + // Ellipsis overflow + Text( + longText, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Text with textAlign center + Text( + "Centered text", + textAlign = TextAlign.Center, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Text with textAlign end + Text( + "End-aligned text", + textAlign = TextAlign.End, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Ellipsis with textAlign center + Text( + longText, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + textAlign = TextAlign.Center, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Weighted row with text + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text( + "Weight 1", + fontSize = 16.sp, + modifier = Modifier.weight(1f).background(androidx.compose.ui.graphics.Color.LightGray), + ) + Text( + "Weight 1", + fontSize = 16.sp, + modifier = Modifier.weight(1f).background(androidx.compose.ui.graphics.Color.LightGray), + ) + } + + // Weighted row with ellipsized text + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text( + longText, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + fontSize = 16.sp, + modifier = Modifier.weight(1f).background(androidx.compose.ui.graphics.Color.LightGray), + ) + Text( + longText, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + textAlign = TextAlign.End, + fontSize = 16.sp, + modifier = Modifier.weight(1f).background(androidx.compose.ui.graphics.Color.LightGray), + ) + } + + // Short text (for comparison) + Text( + "Short text", + fontSize = 16.sp, + modifier = Modifier.background(androidx.compose.ui.graphics.Color.LightGray), + ) + } + } + } +} + +private class MultiLineTextActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val multiLineText = + "This is a long text that will wrap across multiple lines without being ellipsized. " + + "It should continue to flow naturally within the available width of the view." + + val linearLayout = + LinearLayout(this).apply { + setBackgroundColor(Color.WHITE) + orientation = LinearLayout.VERTICAL + layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) + setPadding(10, 10, 10, 10) + } + + // Multi-line wrapping text (no maxLines, no ellipsize) + linearLayout.addView( + TextView(this).apply { + text = multiLineText + setTextColor(Color.BLACK) + textSize = 16f + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + // Multi-line text with maxLines = 3 (wraps but capped) + linearLayout.addView( + TextView(this).apply { + text = multiLineText + setTextColor(Color.BLACK) + textSize = 16f + maxLines = 3 + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + // Short single-line text for comparison + linearLayout.addView( + TextView(this).apply { + text = "Short text" + setTextColor(Color.BLACK) + textSize = 16f + setBackgroundColor(Color.LTGRAY) + layoutParams = + LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { + setMargins(0, 8, 0, 0) + } + } + ) + + setContentView(linearLayout) + } +} + +private class ComposeMultiLineTextActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val multiLineText = + "This is a long text that will wrap across multiple lines without being ellipsized. " + + "It should continue to flow naturally within the available width of the view." + + setContent { + Column( + modifier = + Modifier.fillMaxWidth() + .background(androidx.compose.ui.graphics.Color.White) + .padding(10.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + // Multi-line wrapping text (no maxLines, no overflow) + Text( + multiLineText, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Multi-line text with maxLines = 3 + Text( + multiLineText, + maxLines = 3, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Multi-line centered text + Text( + multiLineText, + textAlign = TextAlign.Center, + fontSize = 16.sp, + modifier = + Modifier.fillMaxWidth().background(androidx.compose.ui.graphics.Color.LightGray), + ) + + // Short text for comparison + Text( + "Short text", + fontSize = 16.sp, + modifier = Modifier.background(androidx.compose.ui.graphics.Color.LightGray), + ) + } + } + } +} + private class MaskingActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png index 31ba5f581bcfc891c1c1eef20d9106580c53c0ae..aa1ec41ee06c2a1dbbd7292cf8629935c5c9b634 100644 GIT binary patch literal 2608 zcmeHJSx}Q#6#jqy6oLgwt%ig^g42%_faSY5~U;WG$hA4od`N69_5FfCW*9 zQ4mz>Sgi|$6h;yUBrFm{1gZ#xKnQ_}tOAiG34zc*ee*%9Qy+Zjow;-8+~v&qzVqF4 z@0tDH9_DMT)&Kxt?zxw7002Nb+tM^? zAMY@}n-ZPBz`h-|No&+F6f&zLe>K#m_+G6Hkf)wgi!qjvZA3;t1W3>zq7s36ypC?W z5BSCYtwxy#EpEip5?u`Pss#eULpg<0ALrX>QWlBZI1mA3SqRH(%oO55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/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png new file mode 100644 index 0000000000000000000000000000000000000000..53e5a236c3e86ca447dd8674c6d046302bd8cda1 GIT binary patch literal 2917 zcmeH}c~p~E7QnwOBmsp41ZAW``)|n-23i*zjyCV zw6ZXklsF;*0DvUroRJLxK*-?RheCie2&R<~{6J_n#s)wcS78<$z-a~)I~4dtpxhGx z-~gIpbk;63i$B8lJ7fxL8yBhB6pX7BrelhHO0)Iz`7O5K& z26iAx%D9{A7bXlb*gh=e$p$P=%igvG)Ou1X_oXr}PJQsQ*#7$WGhK2R8NhYD3hnhy zs&;}vD-hzj_E=ngQO2&4Bgg3u(Hu;HPonEBspHMhcP5ZSq<&hFjToa5f1q; zF8yJ$Pot&;YV#M+#0NhAv0yhG7atG<8b*lgqRPt3pAoRdtj;TfH`KoQ;ODEyq{gVt z$c{^FeO0_(e!sla7F{*eD>(^PJH*eJpZ8vZ$^T2$99+fc`_jU~UTr1N|d2`gShME$a zN}#Yvj(UnrQMik+cGNMZ+^2c<+9osalfGZ%YYir}^_X7S@N&%?R_&8jrFQ^_7WB*- zm&?syN9}O+4)}JLzAVB`%<0n$<4Zo@WL~K{e;QQhXJKJ6r6dKza3m7P78?tK zAB&asZlg1TmKUUDSj$~at9Eo;} z;hehZpT5FlG&%AIpidzaAqpE!mQa-C+R|kFnqoR}fdMoh8f8b3RxvYq-f*$qE4G+W zx)9jV(4cXn1c2JFFOC~7QQryPJC#R4b;m7$acQ>XZ?z*l-eHmh5dFy6#YK+PH{v!X z{?2LR8NqZ{=j^Q4(qt(xP8yI@My z%%CPjWjXi`Rl{zHjm-=|Vf#XUj3^zxOLwqZ9F#@~QW1u;PHZT#m~d&Lo5iN&+;#hN z%&*JWAf_*BDA`bu>lUNrd>fnME2_D%ASuR34argVUV zHCb5pJaF*Cq+(z1Ebpj5W-DO|Z_8mZ#kN2xG+K3ju#l@kmWKaOXqovt&v%>5=OPVz z->L;=<8W1<$zN{mhr)W>KF+e`4OZN}T$fjx*`n~s#jeg%af`!x*Sj}OzCZHi>)5wc zJcZG!M>S(rb55K8+WuE!HPu#d-C9tgcy9s#ajL9qYDx*6lt~FJ>Nr(kr@-N{qqG?e z1~tXQ+Kd~P=4n<$p!<(Deo9m5*18?m_9O|m_S;AUz8zxT0}7vo(UAiWabf}=;+|BB ztaVOQPxBP0OXX_s{+RtDfk}9&PN(eXswvLD_=2@UX|FfRcBG5@J2m4^xHMn?KH!#V zzxM%W!BIzWdzl%$aSL{6Uz1VS2IXpxb=nl|nUVULIS9ok8vbd6R>Ba7vG;^fIQBuL%GBTNv8==u@72TezIy3dCLDxj-dE5RZh`x?;OV^Bj4Rx< zoVljfmU4f+jcV9Yw;LIN3L)qc#Sr^e1N#US;olk}m*=Z;?uXB~KNE%PkDsIGiJD~c zR~GdLNEQtDvo0WuwiByPbAg7Xx=5TpbhaIRdRCT9+S*yxB`Zcq9Berzm1~c-%A6Rw zRO(P%(S9vxm~t>Bb5CMfdHt9`xB*71t`1}exThhN+v7$b3>t(Et-PHds`00xA)k<^ zcVK3B#;#O)y-QvQ9Q~qlO#XK`QEi?B%RixBIW~iNNM66tajA*}R0S%1v}k*aR`?ej zV}R7%Q0}4ey}a|M=)FSpXQ2M4e(=NI=p${@|6R0=?vO>6;d>-!z*ZTcd~0D;X5bd{ EZ)r_j+5i9m literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png new file mode 100644 index 0000000000000000000000000000000000000000..efc2304c4f2db20dc4d7d5ee73a741da009a9001 GIT binary patch literal 20367 zcmeIacRZH;-#>oRAPGfMA){esZzUljq);kCw(M0(k=Za(WJVIo-ZC%60>p}d7^7Z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B=|Q1xa~gR%yuHB{0{46L=gZ0 literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_unmasked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_unmasked.png new file mode 100644 index 0000000000000000000000000000000000000000..dc4beee80a68507a82bce68ebd330f48314fabe5 GIT binary patch literal 28628 zcmdqJby!yG+AsQoNC-$NsRDu^h?JCyfOHBX2+|VL-HnnGA|ir-goHHGUD6<-bazO1 z$GOLxYpt{P`PO%?v-dgYpFOY3Yfh%XJH|7f=e~b+kGBd>B=9d$UP7Tz_)?OhiYOGC z5d7)K#)SWanX9k^|3b4>ln_ScbYA-dUtrh@ODSQ)KW^Ci0Vos=N=o#xl2hzTm9y%z zfxYu{aWo=AQNpXgKA9|c-_h;M@VfBCo<+A2Et&a9*%a$x+CXtXPL)SazoMvGqf)N& zh)thq%91^LU7$uCpO>Qf^)$RUZL);)-#tAyW>1JEZT9Zp$H^PYU1;4FvgsT)U9akF zqi`5+zl1{buG3Maxf?x#hUr~r#Hxy}&rVK?E8~TSS+DyN=RN!-3kw=2IbM+OEg?+r zmwDeYT6EZ1NI#({@cbHo5Yu?qeOLYe?1w(k*XHRp>rPa=M{%2ex-w7BFdHr}fJTeq zL+Iq8Q`|*jQWB*8AbpA%9p|Sv%H3Ike*4ws4+K{rSW6S(BFIB@6Y>)gp_r2a3<1i&KV2 zMoI{ah{TKu%D73{U^>nJq_}eR>eR|mfnwA>DolJzpV?V`dPc_jiHVxBG3T6v%qAbz z>Z7GQSz1+;Po6w!>FR3UoN2Z`J8}LP8ChRne__IX|N6MwcE`L!&rRb!7PFjO>zO9& ziQnOj@)i!B!JC}^1#Gq(by2xqUMNL%bs22h*@MlQhVk*Z;}uKKW2)Bnb~+!z4`E@y zR;ty8+bM}R{(Ou7(cFx+zcyC?E#4zzbLgvB5Ft5vz`N@Yg%cHM9zD9QUSc7prFA31 zoQ;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g9ip|QY+GMPZ03}v^X>2IMi1`019AZptun!5m;9e zZzRZDhtEz&MXxDV$ynrY7QyJGrKN>pm`{cltgad8TFIZxFDM9>s{o(lRO~dQ1WE|? z^ZBx&VSGOa8;IUG1?DU4xG4|XdE!WcFLABF*Ztt#9R>t3czmyC)Z}UjH)JZwl6vs> z&>6*3`tcAk_0nv%;NymKuOpGtU^g{??#!d>=4U4B=lmNCAH5BhpXv%fAW*1B9d^K$ z1a!l2EHjW+iekD7t=>n?56B~_7!?&wInHDroPSU+Thuf0?LQE;iQqf)c__)n?~*R? zKv;-qVnL6Yq1_nDJQ$CQzD|mK!bVIl;WP)ylwi$qU~!;F;JTIt#Hav_?izTT38n%e z+ClKpTQL6;Z;4fW_O_;I+)CiY-N1Dc+_7Uhsyu=Q%SfsPR)sc5s5zCL1PetW)+oI5 z<+2gbk?>ygu<^A)+#Y1cFvzPUxP}{RDc(#u`cIO`hxZJC)7vN~7Tp0JfjlUG$S&dA zj8=dkPP9zIG@~5CdJ8Xg8`cnuZYjh9vUh@Al10P8{3D;IvR!w!nyVE z@p+rspR;4+F|2_Q)kwA4_2jsDbH+Y6`gdKMaYWvNB#B^D(URx~?b9235iUF<$~bav z{Z+WEck#doiCypwUtix#XJ6DpJq0avC7!956H(DHue>+?G0wn%r{?SQ*IGhyv@=%i z^Ad%sH{ZnEM);O*)~YO$+WB`Sr%$W_WH!BJ!@sHOdjHh%e~N!;3}n(7w63b2|M#iz vFaG|&Iz0aK$Ntx8`kxE(|8PO3q&A literal 0 HcmV?d00001 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png new file mode 100644 index 0000000000000000000000000000000000000000..373752de30f95ef642b961822be5ddcdbdeb9cba GIT binary patch literal 2924 zcmeHJc~nzZ9)5WV5Y}W6F%4T_1W^!BSu_fSUBqZaR0t5+oU)XovdSKi5u_|~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}ov9sT1+7|gAJWkv^Y zeCg69mP?tJn}rv# z>jr&r$=%%@N#o32`}HdXz9|GjpC|;agl9oPnQ$ct0xJ;y%m5x47#I08U}D$zRRj5m zpp}jQ7V3WeAvHC17_IabaBUHP2-g_EwF5&e_{EDBcvMLri!@%~mg`3^D)f0fP;Mf= zd^rpj%QOU-Xzz%Koct`jX2IC2%=A9vc~0z)*+*!|h+5h66x9@49a85U?}pwGDgJFxuKBtS!}FF9t592MPOYtL+}esHv&3RGpNh~!EWSt>^5_=prD`x#u(8u6qwWSV5T;3 zrHb8_@4#&0vcaE`iHR!+N?$>?62(Eg_BsfQN{7h^sFa=ocMWy3VO-L2stE(0>L4;U zI%+mr{xFf>3LPQcY$251$W4&Va78~NGYKwgc%WmV5GX2w4nmq>yQ71e@O+|Ac{5OQ zKNk_#@XY%{K@IE`Q*O- z_S&a2zUxcEiA9*_Htq|_Vx!T layout.size.width + + override fun getLineLeft(line: Int): Float { + if (paragraphWidthExceedsNode) { + return 0f } + return layout.getLineLeft(line) } - override fun getEllipsisCount(line: Int): Int = if (layout.isLineEllipsized(line)) 1 else 0 - - override fun getLineVisibleEnd(line: Int): Int = layout.getLineEnd(line, visibleEnd = true) + override fun getLineRight(line: Int): Float { + if (paragraphWidthExceedsNode) { + return layout.multiParagraph.getLineWidth(line) + } + return layout.getLineRight(line) + } override fun getLineTop(line: Int): Int = layout.getLineTop(line).roundToInt() override fun getLineBottom(line: Int): Int = layout.getLineBottom(line).roundToInt() - - override fun getLineStart(line: Int): Int = layout.getLineStart(line) } // TODO: probably most of the below we can do via bytecode instrumentation and speed up at runtime @@ -92,8 +93,6 @@ internal fun Painter.isMaskable(): Boolean { !className.contains("Brush") } -internal data class TextAttributes(val color: Color?, val hasFillModifier: Boolean) - /** * This method is necessary to mask text in Compose. * @@ -101,37 +100,24 @@ internal data class TextAttributes(val color: Color?, val hasFillModifier: Boole * string in their name, e.g. TextStringSimpleElement or TextAnnotatedStringElement. We then get the * color from the modifier, to be able to mask it with the correct color. * - * We also look up for classes that have a [Fill] modifier, usually they all have a `Fill` string in - * their name, e.g. FillElement. This is necessary to workaround a Compose bug where single-line - * text composable without a `fill` modifier still thinks that there's one and wrongly calculates - * horizontal position. - * * We also add special proguard rules to keep the `Text` class names and their `color` member. */ -internal fun LayoutNode.findTextAttributes(): TextAttributes { +internal fun LayoutNode.findTextColor(): Color? { val modifierInfos = getModifierInfo() - var color: Color? = null - var hasFillModifier = false for (index in modifierInfos.indices) { val modifier = modifierInfos[index].modifier val modifierClassName = modifier::class.java.name if (modifierClassName.contains("Text")) { - color = - try { - (modifier::class - .java - .getDeclaredField("color") - .apply { isAccessible = true } - .get(modifier) as? ColorProducer) - ?.invoke() - } catch (e: Throwable) { - null - } - } else if (modifierClassName.contains("Fill")) { - hasFillModifier = true + return try { + (modifier::class.java.getDeclaredField("color").apply { isAccessible = true }.get(modifier) + as? ColorProducer) + ?.invoke() + } catch (e: Throwable) { + null + } } } - return TextAttributes(color, hasFillModifier) + return null } /** diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/TextLayout.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/TextLayout.kt index 9b974efceaa..e62584bda06 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/TextLayout.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/TextLayout.kt @@ -13,15 +13,11 @@ internal interface TextLayout { */ val dominantTextColor: Int? - fun getPrimaryHorizontal(line: Int, offset: Int): Float + fun getLineLeft(line: Int): Float - fun getEllipsisCount(line: Int): Int - - fun getLineVisibleEnd(line: Int): Int + fun getLineRight(line: Int): Float fun getLineTop(line: Int): Int fun getLineBottom(line: Int): Int - - fun getLineStart(line: Int): Int } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt index 80ca1beee4e..d0583cdaa6a 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt @@ -128,21 +128,14 @@ internal fun TextLayout?.getVisibleRects( val rects = mutableListOf() for (i in 0 until lineCount) { - val lineStart = getPrimaryHorizontal(i, getLineStart(i)).toInt() - val ellipsisCount = getEllipsisCount(i) - val lineVisibleEnd = getLineVisibleEnd(i) - var lineEnd = - getPrimaryHorizontal(i, lineVisibleEnd - ellipsisCount + if (ellipsisCount > 0) 1 else 0) - .toInt() - if (lineEnd == 0 && lineVisibleEnd > 0) { - // looks like the case for when emojis are present in text - lineEnd = getPrimaryHorizontal(i, lineVisibleEnd - 1).toInt() + 1 - } + val lineLeft = getLineLeft(i).toInt() + val lineRight = getLineRight(i).toInt() val lineTop = getLineTop(i) val lineBottom = getLineBottom(i) val rect = Rect() - rect.left = globalRect.left + paddingLeft + lineStart - rect.right = rect.left + (lineEnd - lineStart) + + rect.left = globalRect.left + paddingLeft + lineLeft + rect.right = globalRect.left + paddingLeft + lineRight rect.top = globalRect.top + paddingTop + lineTop rect.bottom = rect.top + (lineBottom - lineTop) @@ -197,18 +190,30 @@ internal class AndroidTextLayout(private val layout: Layout) : TextLayout { return dominantColor?.toOpaque() } - override fun getPrimaryHorizontal(line: Int, offset: Int): Float = - layout.getPrimaryHorizontal(offset) - - override fun getEllipsisCount(line: Int): Int = layout.getEllipsisCount(line) + /** + * If text gets ellipsized, we return the left and right bounds of the ellipsized text instead of + * the width, as it's set to some obscure VERY_WIDE value. E.g. see + * https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/TextView.java;l=468?q=VERY_WIDE + */ + override fun getLineLeft(line: Int): Float { + return if (layout.ellipsizedWidth > 0 && layout.ellipsizedWidth < layout.width) { + 0f + } else { + layout.getLineLeft(line) + } + } - override fun getLineVisibleEnd(line: Int): Int = layout.getLineVisibleEnd(line) + override fun getLineRight(line: Int): Float { + return if (layout.ellipsizedWidth > 0 && layout.ellipsizedWidth < layout.width) { + layout.ellipsizedWidth.toFloat() + } else { + layout.getLineRight(line) + } + } override fun getLineTop(line: Int): Int = layout.getLineTop(line) override fun getLineBottom(line: Int): Int = layout.getLineBottom(line) - - override fun getLineStart(line: Int): Int = layout.getLineStart(line) } internal fun View?.addOnDrawListenerSafe(listener: ViewTreeObserver.OnDrawListener) { diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index f421ff9ad07..ec01d28d4fb 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -24,7 +24,7 @@ import io.sentry.android.replay.SentryReplayModifiers import io.sentry.android.replay.util.ComposeTextLayout import io.sentry.android.replay.util.boundsInWindow import io.sentry.android.replay.util.findPainter -import io.sentry.android.replay.util.findTextAttributes +import io.sentry.android.replay.util.findTextColor import io.sentry.android.replay.util.isMaskable import io.sentry.android.replay.util.toOpaque import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHierarchyNode @@ -189,11 +189,10 @@ internal object ComposeViewHierarchyNode { ?.action ?.invoke(textLayoutResults) - val (color, hasFillModifier) = node.findTextAttributes() val textLayoutResult = textLayoutResults.firstOrNull() var textColor = textLayoutResult?.layoutInput?.style?.color if (textColor?.isUnspecified == true) { - textColor = color + textColor = node.findTextColor() } val isLaidOut = textLayoutResult?.layoutInput?.style?.fontSize != TextUnit.Unspecified // TODO: support editable text (currently there's a way to get @Composable's padding only @@ -202,7 +201,7 @@ internal object ComposeViewHierarchyNode { TextViewHierarchyNode( layout = if (textLayoutResult != null && !isEditable && isLaidOut) { - ComposeTextLayout(textLayoutResult, hasFillModifier) + ComposeTextLayout(textLayoutResult) } else { null }, From 028aa67fabce3d2f9caa097bd4e2d13be6ba7b85 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 25 Mar 2026 11:13:59 +0100 Subject: [PATCH 071/391] feat(spring): Cache Tracing (#5165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(spring): [Cache Tracing 1] Add SentryCacheWrapper and SentryCacheManagerWrapper Co-Authored-By: Claude Opus 4.6 * collection: Cache Tracing * fix(cache): Fix span description, putIfAbsent, and Callable hit detection - Use cache key as span description instead of cache name, matching the spec and other SDKs (Python, JavaScript) - Skip instrumentation for putIfAbsent since we cannot know if a write actually occurred; override to bypass default get()+put() delegation - Wrap valueLoader Callable in get(key, Callable) to detect cache hit/miss instead of always reporting hit=true - Update tests to match new behavior Co-Authored-By: Claude * feat(core): [Cache Tracing 2] Add enableCacheTracing option Co-Authored-By: Claude Opus 4.6 * feat(spring): [Cache Tracing 3] Add BeanPostProcessor and auto-configuration Co-Authored-By: Claude Opus 4.6 * changelog * fix: Update changelog PR references Co-Authored-By: Claude * feat(samples): [Cache Tracing 4] Add cache tracing e2e sample Co-Authored-By: Claude Opus 4.6 * ref(samples): Replace ConcurrentMapCacheManager with Caffeine Use Caffeine as the cache provider instead of a plain ConcurrentMapCacheManager. Spring Boot auto-configures CaffeineCacheManager when Caffeine is on the classpath, so the explicit CacheManager bean is no longer needed. Co-Authored-By: Claude * fix dependencies; move to toml * feat(jcache): Add SentryJCacheWrapper for JCache (JSR-107) cache tracing * changelog * fix(jcache): Make replace and getAndReplace passthrough (no span) Like putIfAbsent, these are conditional writes that may be no-ops. Emitting a cache.put span for them would be misleading. * fix(jcache): Check for NoOp span after startChild startChild can return a NoOp span (e.g. when span limit is reached). Skip instrumentation in that case to avoid unnecessary work. * fix(jcache): Use cache.flush for removeAll() without keys removeAll() with no args removes all entries, which is semantically equivalent to clear(). Use cache.flush instead of cache.remove. The keyed removeAll(Set) remains cache.remove. * feat(samples): Add JCache cache tracing demo to console sample Co-Authored-By: Claude Opus 4.6 * changelog Co-Authored-By: Claude Opus 4.6 * changelog Co-Authored-By: Claude Opus 4.6 * fix(core): Use correct cache span op terminology in Javadoc Co-Authored-By: Claude Opus 4.6 * changelog * fix(spring7): Avoid double-wrapping caches in SentryCacheManagerWrapper Co-Authored-By: Claude Opus 4.6 * feat(samples): Add cache tracing to all Spring Boot 4 samples Co-Authored-By: Claude Opus 4.6 * fix(test): Add SENTRY_ENABLE_CACHE_TRACING env var to system test runner Co-Authored-By: Claude Opus 4.6 * feat(jcache): Add SentryJCacheWrapper ctor that uses ScopesAdapter Co-Authored-By: Claude Opus 4.6 * feat(spring7): Add retrieve() overrides to SentryCacheWrapper Adds support for Spring 6.1+ async cache operations (CompletableFuture and Mono/Flux). Without these overrides, @Cacheable on reactive return types crashes with UnsupportedOperationException. Co-Authored-By: Claude Opus 4.6 * feat(spring-jakarta): Add cache tracing for Spring Boot 3 / Spring 6 Port cache tracing classes from sentry-spring-7 to sentry-spring-jakarta, covering Spring Boot 3 (Spring Framework 6.x) users. Includes SentryCacheWrapper, SentryCacheManagerWrapper, SentryCacheBeanPostProcessor, and auto-configuration in sentry-spring-boot-jakarta. The retrieve() overrides for CompletableFuture/reactive cache operations are included and safe on Spring 6.0 (where retrieve() doesn't exist on the Cache interface) — they're simply dead code, never called by the framework until Spring 6.1+. Co-Authored-By: Claude * feat(samples): Add cache tracing to all Spring Boot 3 Jakarta samples Add CacheController, TodoService with @Cacheable/@CachePut/@CacheEvict, Caffeine cache config, and CacheSystemTest e2e tests to all four Jakarta sample modules: - sentry-samples-spring-boot-jakarta - sentry-samples-spring-boot-jakarta-opentelemetry - sentry-samples-spring-boot-jakarta-opentelemetry-noagent - sentry-samples-spring-boot-webflux-jakarta Co-Authored-By: Claude * feat(spring): Add cache tracing for Spring Boot 2 / Spring 5 Port cache tracing instrumentation from sentry-spring-jakarta to sentry-spring for Spring Boot 2 users. Adds SentryCacheWrapper, SentryCacheManagerWrapper, and SentryCacheBeanPostProcessor in the io.sentry.spring.cache package. Wires auto-configuration in sentry-spring-boot via sentry.enable-cache-tracing=true property. The retrieve() methods are omitted since Spring 5 does not have them (they were added in Spring 6.1). Co-Authored-By: Claude * feat(samples): Add cache tracing to Spring Boot 2 sample Add CacheController, TodoService with @Cacheable/@CachePut/@CacheEvict annotations, and CacheSystemTest e2e tests to the sentry-samples-spring-boot sample. Enables cache tracing with Caffeine as the cache provider. Co-Authored-By: Claude * changelog * fix(spring): Skip cache span data when child span is NoOp Add span.isNoOp() check after startChild() in all three Spring SentryCacheWrapper variants, matching the existing pattern in SentryJCacheWrapper. This avoids setting span data on noop spans when sampling drops the span. Co-Authored-By: Claude Opus 4.6 * feat(spring): Add db.operation.name attribute to cache spans Co-Authored-By: Claude Opus 4.6 (1M context) * feat(spring): Instrument putIfAbsent, replace, and getAndReplace cache operations Co-Authored-By: Claude Opus 4.6 (1M context) * fix(spring): Use ValueWrapper to determine cache hit in typed get The get(key, type) method incorrectly used result != null to detect cache hits, failing to distinguish a miss from a cached null value. Now uses delegate.get(key) to check the ValueWrapper first. Co-Authored-By: Claude Opus 4.6 (1M context) * docs(jcache): Fix docs link in README Co-Authored-By: Claude Opus 4.6 (1M context) * ref(spring): Use method-specific span operations for cache spans Instead of the 4 generic categories (cache.get, cache.put, cache.remove, cache.flush), use the actual method name as the span operation (e.g. cache.evict, cache.putIfAbsent, cache.retrieve). Co-Authored-By: Claude Opus 4.6 (1M context) * ref(spring): Derive span operation from operationName in startSpan Remove redundant first parameter since it was always "cache." + operationName. The prefix is now applied inside the helper method. Co-Authored-By: Claude Opus 4.6 (1M context) * ref(jcache): Merge startSpanForKeys into startSpan overload Replace the separate startSpanForKeys helper with a startSpan(Set, String) overload, unifying the two span creation methods under the same name. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * ref(cache): Move operation attribute to SpanDataConvention as CACHE_OPERATION_KEY Replace local OPERATION_ATTRIBUTE constants in all cache wrappers with a shared CACHE_OPERATION_KEY constant in SpanDataConvention. Also changes the attribute key from "db.operation.name" to "cache.operation". * feat(cache): Add cache.write boolean span attribute Set cache.write on spans across all four cache wrapper implementations to indicate whether an operation actually modified the cache. This complements the existing cache.hit attribute for read operations. Co-Authored-By: Claude * fix(jcache): Use comma-joined keys as span description for bulk operations Co-Authored-By: Claude Opus 4.6 (1M context) * ref(cache): Remove _KEY suffix from cache SpanDataConvention constants Rename CACHE_HIT_KEY, CACHE_KEY_KEY, and CACHE_OPERATION_KEY to CACHE_HIT, CACHE_KEY, and CACHE_OPERATION to match the newer naming convention used by CACHE_WRITE, THREAD_ID, FRAMES_TOTAL, etc. Co-Authored-By: Claude * fix(spring): Fix get(key, type) double-call in SentryCacheWrapper Use a single delegate.get(key, type) call instead of calling delegate.get(key) for hit detection and delegate.get(key, type) for the actual value. This eliminates doubled cache round trips (e.g. Redis network calls) and a TOCTOU race where the entry could expire between the two calls. The trade-off is that cached null values are now indistinguishable from cache misses, which is acceptable for observability purposes. * fix(samples): Fix cache evict system test to match actual span op * assert multiple keys in single assertions * Format code * update PR links in changelog * fix(spring): [Cache Tracing 24] Track invalidate cache.write accurately Set cache.write based on delegate.invalidate() result instead of always true. This keeps span data aligned with Spring's invalidate semantics when no entries were present. Add tests in spring, spring-jakarta, and spring-7 wrappers to cover the false return path and assert cache.write is false. Co-Authored-By: Claude --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 6 + README.md | 1 + buildSrc/src/main/java/Config.kt | 1 + gradle/libs.versions.toml | 6 + sentry-jcache/README.md | 13 + sentry-jcache/api/sentry-jcache.api | 38 ++ sentry-jcache/build.gradle.kts | 90 +++ .../io/sentry/jcache/SentryJCacheWrapper.java | 506 +++++++++++++++++ .../sentry/jcache/SentryJCacheWrapperTest.kt | 534 ++++++++++++++++++ .../sentry-samples-console/build.gradle.kts | 3 + .../java/io/sentry/samples/console/Main.java | 50 ++ .../build.gradle.kts | 4 + .../samples/spring/boot4/CacheController.java | 34 ++ .../spring/boot4/SentryDemoApplication.java | 2 + .../samples/spring/boot4/TodoService.java | 29 + .../src/main/resources/application.properties | 3 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../spring/boot4/otlp/CacheController.java | 34 ++ .../boot4/otlp/SentryDemoApplication.java | 2 + .../spring/boot4/otlp/TodoService.java | 29 + .../src/main/resources/application.properties | 3 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../samples/spring/boot4/CacheController.java | 34 ++ .../spring/boot4/SentryDemoApplication.java | 2 + .../samples/spring/boot4/TodoService.java | 29 + .../src/main/resources/application.properties | 3 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../samples/spring/boot4/CacheController.java | 34 ++ .../spring/boot4/SentryDemoApplication.java | 2 + .../samples/spring/boot4/TodoService.java | 29 + .../src/main/resources/application.properties | 3 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../spring/boot/jakarta/CacheController.java | 34 ++ .../boot/jakarta/SentryDemoApplication.java | 2 + .../spring/boot/jakarta/TodoService.java | 29 + .../src/main/resources/application.properties | 5 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../spring/boot/jakarta/CacheController.java | 34 ++ .../boot/jakarta/SentryDemoApplication.java | 2 + .../spring/boot/jakarta/TodoService.java | 29 + .../src/main/resources/application.properties | 5 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../spring/boot/jakarta/CacheController.java | 34 ++ .../boot/jakarta/SentryDemoApplication.java | 2 + .../spring/boot/jakarta/TodoService.java | 29 + .../src/main/resources/application.properties | 5 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 4 + .../spring/boot/jakarta/CacheController.java | 34 ++ .../boot/jakarta/SentryDemoApplication.java | 2 + .../spring/boot/jakarta/TodoService.java | 29 + .../src/main/resources/application.properties | 5 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ .../build.gradle.kts | 2 + .../samples/spring/boot/CacheController.java | 34 ++ .../spring/boot/SentryDemoApplication.java | 2 + .../samples/spring/boot/TodoService.java | 29 + .../src/main/resources/application.properties | 5 + .../io/sentry/systemtest/CacheSystemTest.kt | 51 ++ sentry-spring-7/api/sentry-spring-7.api | 29 + .../cache/SentryCacheBeanPostProcessor.java | 29 + .../cache/SentryCacheManagerWrapper.java | 37 ++ .../spring7/cache/SentryCacheWrapper.java | 326 +++++++++++ .../cache/SentryCacheBeanPostProcessorTest.kt | 44 ++ .../cache/SentryCacheManagerWrapperTest.kt | 61 ++ .../spring7/cache/SentryCacheWrapperTest.kt | 530 +++++++++++++++++ .../spring/boot4/SentryAutoConfiguration.java | 15 + .../boot4/SentryAutoConfigurationTest.kt | 30 + .../boot/jakarta/SentryAutoConfiguration.java | 15 + .../spring/boot/SentryAutoConfiguration.java | 15 + .../api/sentry-spring-jakarta.api | 29 + .../cache/SentryCacheBeanPostProcessor.java | 29 + .../cache/SentryCacheManagerWrapper.java | 37 ++ .../jakarta/cache/SentryCacheWrapper.java | 326 +++++++++++ .../cache/SentryCacheBeanPostProcessorTest.kt | 44 ++ .../cache/SentryCacheManagerWrapperTest.kt | 61 ++ .../jakarta/cache/SentryCacheWrapperTest.kt | 530 +++++++++++++++++ sentry-spring/api/sentry-spring.api | 27 + .../cache/SentryCacheBeanPostProcessor.java | 29 + .../cache/SentryCacheManagerWrapper.java | 37 ++ .../spring/cache/SentryCacheWrapper.java | 253 +++++++++ .../cache/SentryCacheBeanPostProcessorTest.kt | 44 ++ .../cache/SentryCacheManagerWrapperTest.kt | 61 ++ .../spring/cache/SentryCacheWrapperTest.kt | 354 ++++++++++++ .../api/sentry-system-test-support.api | 3 + .../sentry/systemtest/util/RestTestClient.kt | 18 + sentry/api/sentry.api | 8 + .../main/java/io/sentry/ExternalOptions.java | 11 + .../main/java/io/sentry/SentryOptions.java | 24 + .../java/io/sentry/SpanDataConvention.java | 4 + .../java/io/sentry/ExternalOptionsTest.kt | 14 + .../test/java/io/sentry/SentryOptionsTest.kt | 7 + settings.gradle.kts | 1 + test/system-test-runner.py | 3 +- 100 files changed, 5447 insertions(+), 1 deletion(-) create mode 100644 sentry-jcache/README.md create mode 100644 sentry-jcache/api/sentry-jcache.api create mode 100644 sentry-jcache/build.gradle.kts create mode 100644 sentry-jcache/src/main/java/io/sentry/jcache/SentryJCacheWrapper.java create mode 100644 sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/CacheController.java create mode 100644 sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/TodoService.java create mode 100644 sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheBeanPostProcessor.java create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheManagerWrapper.java create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheBeanPostProcessorTest.kt create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheManagerWrapperTest.kt create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheWrapperTest.kt create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessor.java create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapper.java create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessorTest.kt create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapperTest.kt create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheWrapperTest.kt create mode 100644 sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheBeanPostProcessor.java create mode 100644 sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheManagerWrapper.java create mode 100644 sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheWrapper.java create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheBeanPostProcessorTest.kt create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheManagerWrapperTest.kt create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheWrapperTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b59334d90..fabd81c5746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ ### Features +- Add cache tracing instrumentation for Spring Boot 2, 3, and 4 ([#5165](https://github.com/getsentry/sentry-java/pull/5165)) + - Wraps Spring `CacheManager` and `Cache` beans to produce cache spans + - Set `sentry.enable-cache-tracing` to `true` to enable this feature +- Add JCache (JSR-107) cache tracing via new `sentry-jcache` module ([#5165](https://github.com/getsentry/sentry-java/pull/5165)) + - Wraps JCache `Cache` with `SentryJCacheWrapper` to produce cache spans + - Set the `enableCacheTracing` option to `true` to enable this feature - Add configurable `IScopesStorageFactory` to `SentryOptions` for providing a custom `IScopesStorage`, e.g. when the default `ThreadLocal`-backed storage is incompatible with non-pinning thread models ([#5199](https://github.com/getsentry/sentry-java/pull/5199)) - Android: Add `beforeErrorSampling` callback to Session Replay ([#5214](https://github.com/getsentry/sentry-java/pull/5214)) - Allows filtering which errors trigger replay capture before the `onErrorSampleRate` is checked diff --git a/README.md b/README.md index 31285e2be29..25fedc8217f 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Sentry SDK for Java and Android | sentry-graphql | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql?style=for-the-badge&logo=sentry&color=green) | | sentry-graphql-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-core?style=for-the-badge&logo=sentry&color=green) | | sentry-graphql-22 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-22?style=for-the-badge&logo=sentry&color=green) | +| sentry-jcache | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jcache?style=for-the-badge&logo=sentry&color=green) | | sentry-quartz | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-quartz?style=for-the-badge&logo=sentry&color=green) | | sentry-openfeign | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeign?style=for-the-badge&logo=sentry&color=green) | | sentry-openfeature | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeature?style=for-the-badge&logo=sentry&color=green) | diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 72892df5a9a..b5d1dafeb74 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -77,6 +77,7 @@ object Config { val SENTRY_GRAPHQL_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql" val SENTRY_GRAPHQL_CORE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql-core" val SENTRY_GRAPHQL22_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql22" + val SENTRY_JCACHE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jcache" val SENTRY_QUARTZ_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.quartz" val SENTRY_JDBC_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jdbc" val SENTRY_OPENFEATURE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.openfeature" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 60be4fd2c03..eb7ab86e4bd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -99,6 +99,8 @@ androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" } async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" } async-profiler-jfr-converter = { module = "tools.profiler:jfr-converter", version.ref = "asyncProfiler" } +caffeine = { module = "com.github.ben-manes.caffeine:caffeine" } +caffeine-jcache = { module = "com.github.ben-manes.caffeine:jcache", version = "3.2.0" } coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" } commons-compress = {module = "org.apache.commons:commons-compress", version = "1.25.0"} context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" } @@ -144,6 +146,7 @@ otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", vers otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" } p6spy = { module = "p6spy:p6spy", version = "3.9.1" } epitaph = { module = "com.abovevacant:epitaph", version = "0.1.1" } +jcache = { module = "javax.cache:cache-api", version = "1.1.1" } quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } @@ -166,6 +169,7 @@ springboot-starter-aop = { module = "org.springframework.boot:spring-boot-starte springboot-starter-security = { module = "org.springframework.boot:spring-boot-starter-security", version.ref = "springboot2" } springboot-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot2" } springboot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot2" } +springboot-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot2" } springboot3-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" } springboot3-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot3" } springboot3-starter-graphql = { module = "org.springframework.boot:spring-boot-starter-graphql", version.ref = "springboot3" } @@ -178,6 +182,7 @@ springboot3-starter-aop = { module = "org.springframework.boot:spring-boot-start springboot3-starter-security = { module = "org.springframework.boot:spring-boot-starter-security", version.ref = "springboot3" } springboot3-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot3" } springboot3-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot3" } +springboot3-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot3" } springboot4-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" } springboot4-resttestclient = { module = "org.springframework.boot:spring-boot-resttestclient", version.ref = "springboot4" } springboot4-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot4" } @@ -193,6 +198,7 @@ springboot4-starter-restclient = { module = "org.springframework.boot:spring-boo springboot4-starter-webclient = { module = "org.springframework.boot:spring-boot-starter-webclient", version.ref = "springboot4" } springboot4-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot4" } springboot4-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot4" } +springboot4-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot4" } timber = { module = "com.jakewharton.timber:timber", version = "4.7.1" } # Animalsniffer signature diff --git a/sentry-jcache/README.md b/sentry-jcache/README.md new file mode 100644 index 00000000000..e4f4d8e49a4 --- /dev/null +++ b/sentry-jcache/README.md @@ -0,0 +1,13 @@ +# sentry-jcache + +This module provides an integration for JCache (JSR-107). + +JCache is a standard API — you need a provider implementation at runtime. Common implementations include: + +- [Caffeine](https://github.com/ben-manes/caffeine) (via `com.github.ben-manes.caffeine:jcache`) +- [Ehcache 3](https://www.ehcache.org/) (via `org.ehcache:ehcache`) +- [Hazelcast](https://hazelcast.com/) +- [Apache Ignite](https://ignite.apache.org/) +- [Infinispan](https://infinispan.org/) + +Please consult the documentation on how to install and use this integration in the Sentry Docs for [Java](https://docs.sentry.io/platforms/java/integrations/jcache/). diff --git a/sentry-jcache/api/sentry-jcache.api b/sentry-jcache/api/sentry-jcache.api new file mode 100644 index 00000000000..b834ba41064 --- /dev/null +++ b/sentry-jcache/api/sentry-jcache.api @@ -0,0 +1,38 @@ +public final class io/sentry/jcache/BuildConfig { + public static final field SENTRY_JCACHE_SDK_NAME Ljava/lang/String; + public static final field VERSION_NAME Ljava/lang/String; +} + +public final class io/sentry/jcache/SentryJCacheWrapper : javax/cache/Cache { + public fun (Ljavax/cache/Cache;)V + public fun (Ljavax/cache/Cache;Lio/sentry/IScopes;)V + public fun clear ()V + public fun close ()V + public fun containsKey (Ljava/lang/Object;)Z + public fun deregisterCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V + public fun get (Ljava/lang/Object;)Ljava/lang/Object; + public fun getAll (Ljava/util/Set;)Ljava/util/Map; + public fun getAndPut (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun getAndRemove (Ljava/lang/Object;)Ljava/lang/Object; + public fun getAndReplace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + public fun getCacheManager ()Ljavax/cache/CacheManager; + public fun getConfiguration (Ljava/lang/Class;)Ljavax/cache/configuration/Configuration; + public fun getName ()Ljava/lang/String; + public fun invoke (Ljava/lang/Object;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/lang/Object; + public fun invokeAll (Ljava/util/Set;Ljavax/cache/processor/EntryProcessor;[Ljava/lang/Object;)Ljava/util/Map; + public fun isClosed ()Z + public fun iterator ()Ljava/util/Iterator; + public fun loadAll (Ljava/util/Set;ZLjavax/cache/integration/CompletionListener;)V + public fun put (Ljava/lang/Object;Ljava/lang/Object;)V + public fun putAll (Ljava/util/Map;)V + public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Z + public fun registerCacheEntryListener (Ljavax/cache/configuration/CacheEntryListenerConfiguration;)V + public fun remove (Ljava/lang/Object;)Z + public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z + public fun removeAll ()V + public fun removeAll (Ljava/util/Set;)V + public fun replace (Ljava/lang/Object;Ljava/lang/Object;)Z + public fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z + public fun unwrap (Ljava/lang/Class;)Ljava/lang/Object; +} + diff --git a/sentry-jcache/build.gradle.kts b/sentry-jcache/build.gradle.kts new file mode 100644 index 00000000000..a9393a7d905 --- /dev/null +++ b/sentry-jcache/build.gradle.kts @@ -0,0 +1,90 @@ +import net.ltgt.gradle.errorprone.errorprone +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `java-library` + id("io.sentry.javadoc") + alias(libs.plugins.kotlin.jvm) + jacoco + alias(libs.plugins.errorprone) + alias(libs.plugins.gradle.versions) + alias(libs.plugins.buildconfig) +} + +tasks.withType().configureEach { + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 + compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 + compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 +} + +dependencies { + api(projects.sentry) + compileOnly(libs.jcache) + + compileOnly(libs.jetbrains.annotations) + compileOnly(libs.nopen.annotations) + errorprone(libs.errorprone.core) + errorprone(libs.nopen.checker) + errorprone(libs.nullaway) + + // tests + testImplementation(projects.sentry) + testImplementation(projects.sentryTestSupport) + testImplementation(libs.jcache) + testImplementation(kotlin(Config.kotlinStdLib)) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.mockito.kotlin) + testImplementation(libs.mockito.inline) +} + +configure { test { java.srcDir("src/test/java") } } + +jacoco { toolVersion = libs.versions.jacoco.get() } + +tasks.jacocoTestReport { + reports { + xml.required.set(true) + html.required.set(false) + } +} + +tasks { + jacocoTestCoverageVerification { + violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } + } + check { + dependsOn(jacocoTestCoverageVerification) + dependsOn(jacocoTestReport) + } +} + +tasks.withType().configureEach { + options.errorprone { + check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) + option("NullAway:AnnotatedPackages", "io.sentry") + } +} + +buildConfig { + useJavaOutput() + packageName("io.sentry.jcache") + buildConfigField( + "String", + "SENTRY_JCACHE_SDK_NAME", + "\"${Config.Sentry.SENTRY_JCACHE_SDK_NAME}\"", + ) + buildConfigField("String", "VERSION_NAME", "\"${project.version}\"") +} + +tasks.jar { + manifest { + attributes( + "Sentry-Version-Name" to project.version, + "Sentry-SDK-Name" to Config.Sentry.SENTRY_JCACHE_SDK_NAME, + "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-jcache", + "Implementation-Vendor" to "Sentry", + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + ) + } +} diff --git a/sentry-jcache/src/main/java/io/sentry/jcache/SentryJCacheWrapper.java b/sentry-jcache/src/main/java/io/sentry/jcache/SentryJCacheWrapper.java new file mode 100644 index 00000000000..e1c3b786e85 --- /dev/null +++ b/sentry-jcache/src/main/java/io/sentry/jcache/SentryJCacheWrapper.java @@ -0,0 +1,506 @@ +package io.sentry.jcache; + +import io.sentry.IScopes; +import io.sentry.ISpan; +import io.sentry.ScopesAdapter; +import io.sentry.SpanDataConvention; +import io.sentry.SpanOptions; +import io.sentry.SpanStatus; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.configuration.CacheEntryListenerConfiguration; +import javax.cache.configuration.Configuration; +import javax.cache.integration.CompletionListener; +import javax.cache.processor.EntryProcessor; +import javax.cache.processor.EntryProcessorException; +import javax.cache.processor.EntryProcessorResult; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Wraps a JCache {@link Cache} to create Sentry spans for cache operations. + * + * @param the type of key + * @param the type of value + */ +@ApiStatus.Experimental +public final class SentryJCacheWrapper implements Cache { + + private static final String TRACE_ORIGIN = "auto.cache.jcache"; + + private final @NotNull Cache delegate; + private final @NotNull IScopes scopes; + + public SentryJCacheWrapper(final @NotNull Cache delegate) { + this(delegate, ScopesAdapter.getInstance()); + } + + public SentryJCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + // -- read operations -- + + @Override + public V get(final K key) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key); + } + try { + final V result = delegate.get(key); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public Map getAll(final Set keys) { + final ISpan span = startSpanForKeys(keys, "getAll"); + if (span == null) { + return delegate.getAll(keys); + } + try { + final Map result = delegate.getAll(keys); + span.setData(SpanDataConvention.CACHE_HIT, !result.isEmpty()); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean containsKey(final K key) { + return delegate.containsKey(key); + } + + // -- write operations -- + + @Override + public void put(final K key, final V value) { + final ISpan span = startSpan(key, "put"); + if (span == null) { + delegate.put(key, value); + return; + } + try { + delegate.put(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public V getAndPut(final K key, final V value) { + final ISpan span = startSpan(key, "getAndPut"); + if (span == null) { + return delegate.getAndPut(key, value); + } + try { + final V result = delegate.getAndPut(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void putAll(final Map map) { + final ISpan span = startSpanForKeys(map.keySet(), "putAll"); + if (span == null) { + delegate.putAll(map); + return; + } + try { + delegate.putAll(map); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean putIfAbsent(final K key, final V value) { + final ISpan span = startSpan(key, "putIfAbsent"); + if (span == null) { + return delegate.putIfAbsent(key, value); + } + try { + final boolean result = delegate.putIfAbsent(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean replace(final K key, final V oldValue, final V newValue) { + final ISpan span = startSpan(key, "replace"); + if (span == null) { + return delegate.replace(key, oldValue, newValue); + } + try { + final boolean result = delegate.replace(key, oldValue, newValue); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean replace(final K key, final V value) { + final ISpan span = startSpan(key, "replace"); + if (span == null) { + return delegate.replace(key, value); + } + try { + final boolean result = delegate.replace(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public V getAndReplace(final K key, final V value) { + final ISpan span = startSpan(key, "getAndReplace"); + if (span == null) { + return delegate.getAndReplace(key, value); + } + try { + final V result = delegate.getAndReplace(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + // -- remove operations -- + + @Override + public boolean remove(final K key) { + final ISpan span = startSpan(key, "remove"); + if (span == null) { + return delegate.remove(key); + } + try { + final boolean result = delegate.remove(key); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean remove(final K key, final V oldValue) { + final ISpan span = startSpan(key, "remove"); + if (span == null) { + return delegate.remove(key, oldValue); + } + try { + final boolean result = delegate.remove(key, oldValue); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public V getAndRemove(final K key) { + final ISpan span = startSpan(key, "getAndRemove"); + if (span == null) { + return delegate.getAndRemove(key); + } + try { + final V result = delegate.getAndRemove(key); + span.setData(SpanDataConvention.CACHE_WRITE, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void removeAll(final Set keys) { + final ISpan span = startSpanForKeys(keys, "removeAll"); + if (span == null) { + delegate.removeAll(keys); + return; + } + try { + delegate.removeAll(keys); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void removeAll() { + final ISpan span = startSpan(null, "removeAll"); + if (span == null) { + delegate.removeAll(); + return; + } + try { + delegate.removeAll(); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + // -- flush operations -- + + @Override + public void clear() { + final ISpan span = startSpan(null, "clear"); + if (span == null) { + delegate.clear(); + return; + } + try { + delegate.clear(); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void close() { + delegate.close(); + } + + // -- entry processor operations -- + + @Override + public T invoke( + final K key, final EntryProcessor entryProcessor, final Object... arguments) + throws EntryProcessorException { + final ISpan span = startSpan(key, "invoke"); + if (span == null) { + return delegate.invoke(key, entryProcessor, arguments); + } + try { + final T result = delegate.invoke(key, entryProcessor, arguments); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public Map> invokeAll( + final Set keys, + final EntryProcessor entryProcessor, + final Object... arguments) { + final ISpan span = startSpanForKeys(keys, "invokeAll"); + if (span == null) { + return delegate.invokeAll(keys, entryProcessor, arguments); + } + try { + final Map> result = + delegate.invokeAll(keys, entryProcessor, arguments); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + // -- passthrough operations -- + + @Override + public void loadAll( + final Set keys, + final boolean replaceExistingValues, + final CompletionListener completionListener) { + delegate.loadAll(keys, replaceExistingValues, completionListener); + } + + @Override + public String getName() { + return delegate.getName(); + } + + @Override + public CacheManager getCacheManager() { + return delegate.getCacheManager(); + } + + @Override + public > C getConfiguration(final Class clazz) { + return delegate.getConfiguration(clazz); + } + + @Override + public boolean isClosed() { + return delegate.isClosed(); + } + + @Override + public T unwrap(final Class clazz) { + return delegate.unwrap(clazz); + } + + @Override + public void registerCacheEntryListener( + final CacheEntryListenerConfiguration cacheEntryListenerConfiguration) { + delegate.registerCacheEntryListener(cacheEntryListenerConfiguration); + } + + @Override + public void deregisterCacheEntryListener( + final CacheEntryListenerConfiguration cacheEntryListenerConfiguration) { + delegate.deregisterCacheEntryListener(cacheEntryListenerConfiguration); + } + + @Override + public Iterator> iterator() { + return delegate.iterator(); + } + + // -- span helpers -- + + private @Nullable ISpan startSpan( + final @Nullable Object key, final @NotNull String operationName) { + final String keyString = key != null ? String.valueOf(key) : null; + return startSpan( + operationName, keyString, keyString != null ? Collections.singletonList(keyString) : null); + } + + private @Nullable ISpan startSpanForKeys( + final @NotNull Set keys, final @NotNull String operationName) { + final List keyStrings = keys.stream().map(String::valueOf).collect(Collectors.toList()); + return startSpan(operationName, String.join(", ", keyStrings), keyStrings); + } + + private @Nullable ISpan startSpan( + final @NotNull String operationName, + final @Nullable String description, + final @Nullable List cacheKeys) { + if (!scopes.getOptions().isEnableCacheTracing()) { + return null; + } + + final ISpan activeSpan = scopes.getSpan(); + if (activeSpan == null || activeSpan.isNoOp()) { + return null; + } + + final SpanOptions spanOptions = new SpanOptions(); + spanOptions.setOrigin(TRACE_ORIGIN); + final ISpan span = activeSpan.startChild("cache." + operationName, description, spanOptions); + if (span.isNoOp()) { + return null; + } + if (cacheKeys != null) { + span.setData(SpanDataConvention.CACHE_KEY, cacheKeys); + } + span.setData(SpanDataConvention.CACHE_OPERATION, operationName); + return span; + } +} diff --git a/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt b/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt new file mode 100644 index 00000000000..9e523d3df21 --- /dev/null +++ b/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt @@ -0,0 +1,534 @@ +package io.sentry.jcache + +import io.sentry.IScopes +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import javax.cache.Cache +import javax.cache.CacheManager +import javax.cache.configuration.CacheEntryListenerConfiguration +import javax.cache.configuration.Configuration +import javax.cache.integration.CompletionListener +import javax.cache.processor.EntryProcessor +import javax.cache.processor.EntryProcessorResult +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentryJCacheWrapperTest { + + private lateinit var scopes: IScopes + private lateinit var delegate: Cache + private lateinit var options: SentryOptions + + @BeforeTest + fun setup() { + scopes = mock() + delegate = mock() + options = SentryOptions().apply { isEnableCacheTracing = true } + whenever(scopes.options).thenReturn(options) + whenever(delegate.name).thenReturn("testCache") + } + + private fun createTransaction(): SentryTracer { + val tx = SentryTracer(TransactionContext("tx", "op"), scopes) + whenever(scopes.span).thenReturn(tx) + return tx + } + + // -- get(K key) -- + + @Test + fun `get creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn("value") + + val result = wrapper.get("myKey") + + assertEquals("value", result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.get", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("auto.cache.jcache", span.spanContext.origin) + assertEquals("get", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `get creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + val result = wrapper.get("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + } + + // -- getAll -- + + @Test + fun `getAll creates span with cache hit true when results exist`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val keys = setOf("k1", "k2") + whenever(delegate.getAll(keys)).thenReturn(mapOf("k1" to "v1")) + + val result = wrapper.getAll(keys) + + assertEquals(mapOf("k1" to "v1"), result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.getAll", span.operation) + assertEquals("k1, k2", span.description) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("k1", "k2"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("getAll", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `getAll creates span with cache hit false when empty`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val keys = setOf("k1") + whenever(delegate.getAll(keys)).thenReturn(emptyMap()) + + wrapper.getAll(keys) + + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + } + + // -- put -- + + @Test + fun `put creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + + wrapper.put("myKey", "myValue") + + verify(delegate).put("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.put", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("put", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- getAndPut -- + + @Test + fun `getAndPut creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.getAndPut("myKey", "newValue")).thenReturn("oldValue") + + val result = wrapper.getAndPut("myKey", "newValue") + + assertEquals("oldValue", result) + assertEquals(1, tx.spans.size) + assertEquals("cache.getAndPut", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("getAndPut", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- putAll -- + + @Test + fun `putAll creates cache put span with all keys`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val entries = mapOf("k1" to "v1", "k2" to "v2") + + wrapper.putAll(entries) + + verify(delegate).putAll(entries) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.putAll", span.operation) + assertEquals("k1, k2", span.description) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("k1", "k2"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("putAll", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- putIfAbsent -- + + @Test + fun `putIfAbsent creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.putIfAbsent("myKey", "myValue")).thenReturn(true) + + val result = wrapper.putIfAbsent("myKey", "myValue") + + assertTrue(result) + verify(delegate).putIfAbsent("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.putIfAbsent", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("putIfAbsent", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- replace -- + + @Test + fun `replace with old value creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.replace("myKey", "old", "new")).thenReturn(true) + + val result = wrapper.replace("myKey", "old", "new") + + assertTrue(result) + verify(delegate).replace("myKey", "old", "new") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.replace", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("replace", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `replace creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.replace("myKey", "value")).thenReturn(true) + + val result = wrapper.replace("myKey", "value") + + assertTrue(result) + verify(delegate).replace("myKey", "value") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.replace", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("replace", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- getAndReplace -- + + @Test + fun `getAndReplace creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.getAndReplace("myKey", "newValue")).thenReturn("oldValue") + + val result = wrapper.getAndReplace("myKey", "newValue") + + assertEquals("oldValue", result) + verify(delegate).getAndReplace("myKey", "newValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.getAndReplace", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("getAndReplace", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- remove(K) -- + + @Test + fun `remove creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.remove("myKey")).thenReturn(true) + + val result = wrapper.remove("myKey") + + assertTrue(result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.remove", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("remove", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- remove(K, V) -- + + @Test + fun `remove with value creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.remove("myKey", "myValue")).thenReturn(true) + + val result = wrapper.remove("myKey", "myValue") + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.remove", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("remove", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- getAndRemove -- + + @Test + fun `getAndRemove creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.getAndRemove("myKey")).thenReturn("value") + + val result = wrapper.getAndRemove("myKey") + + assertEquals("value", result) + assertEquals(1, tx.spans.size) + assertEquals("cache.getAndRemove", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("getAndRemove", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- removeAll(Set) -- + + @Test + fun `removeAll with keys creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val keys = setOf("k1", "k2") + + wrapper.removeAll(keys) + + verify(delegate).removeAll(keys) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.removeAll", span.operation) + assertEquals("k1, k2", span.description) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("k1", "k2"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("removeAll", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- removeAll() -- + + @Test + fun `removeAll without keys creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + + wrapper.removeAll() + + verify(delegate).removeAll() + assertEquals(1, tx.spans.size) + assertEquals("cache.removeAll", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("removeAll", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- clear -- + + @Test + fun `clear creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + + wrapper.clear() + + verify(delegate).clear() + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.clear", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertNull(span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("clear", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- invoke -- + + @Test + fun `invoke creates cache get span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val processor = mock>() + whenever(delegate.invoke("myKey", processor)).thenReturn("result") + + val result = wrapper.invoke("myKey", processor) + + assertEquals("result", result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invoke", tx.spans.first().operation) + assertEquals("invoke", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- invokeAll -- + + @Test + fun `invokeAll creates cache get span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val processor = mock>() + val keys = setOf("k1", "k2") + val resultMap = mock>>() + whenever(delegate.invokeAll(keys, processor)).thenReturn(resultMap) + + val result = wrapper.invokeAll(keys, processor) + + assertEquals(resultMap, result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invokeAll", tx.spans.first().operation) + assertEquals("invokeAll", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- passthrough operations -- + + @Test + fun `containsKey delegates without creating span`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.containsKey("myKey")).thenReturn(true) + + assertTrue(wrapper.containsKey("myKey")) + assertEquals(0, tx.spans.size) + } + + @Test + fun `getName delegates to underlying cache`() { + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertEquals("testCache", wrapper.name) + } + + @Test + fun `getCacheManager delegates to underlying cache`() { + val manager = mock() + whenever(delegate.cacheManager).thenReturn(manager) + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertEquals(manager, wrapper.cacheManager) + } + + @Test + fun `isClosed delegates to underlying cache`() { + whenever(delegate.isClosed).thenReturn(false) + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertFalse(wrapper.isClosed) + } + + @Test + fun `close delegates to underlying cache`() { + val wrapper = SentryJCacheWrapper(delegate, scopes) + wrapper.close() + verify(delegate).close() + } + + @Test + fun `registerCacheEntryListener delegates to underlying cache`() { + val wrapper = SentryJCacheWrapper(delegate, scopes) + val config = mock>() + wrapper.registerCacheEntryListener(config) + verify(delegate).registerCacheEntryListener(config) + } + + @Test + fun `deregisterCacheEntryListener delegates to underlying cache`() { + val wrapper = SentryJCacheWrapper(delegate, scopes) + val config = mock>() + wrapper.deregisterCacheEntryListener(config) + verify(delegate).deregisterCacheEntryListener(config) + } + + @Test + fun `iterator delegates to underlying cache`() { + val iter = mock>>() + whenever(delegate.iterator()).thenReturn(iter) + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertEquals(iter, wrapper.iterator()) + } + + @Test + fun `loadAll delegates to underlying cache`() { + val wrapper = SentryJCacheWrapper(delegate, scopes) + val keys = setOf("k1") + val listener = mock() + wrapper.loadAll(keys, true, listener) + verify(delegate).loadAll(keys, true, listener) + } + + @Test + fun `getConfiguration delegates to underlying cache`() { + val config = mock>() + whenever( + delegate.getConfiguration(Configuration::class.java as Class>) + ) + .thenReturn(config) + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertEquals( + config, + wrapper.getConfiguration(Configuration::class.java as Class>), + ) + } + + @Test + fun `unwrap delegates to underlying cache`() { + whenever(delegate.unwrap(String::class.java)).thenReturn("unwrapped") + val wrapper = SentryJCacheWrapper(delegate, scopes) + assertEquals("unwrapped", wrapper.unwrap(String::class.java)) + } + + // -- no span when no active transaction -- + + @Test + fun `does not create span when there is no active transaction`() { + whenever(scopes.span).thenReturn(null) + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + } + + // -- no span when option is disabled -- + + @Test + fun `does not create span when enableCacheTracing is false`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + assertEquals(0, tx.spans.size) + } + + // -- error handling -- + + @Test + fun `sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryJCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } +} diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index 5737e8effe0..0dc6183b4fc 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -35,6 +35,9 @@ tasks.withType().configureEach { dependencies { implementation(projects.sentry) implementation(projects.sentryAsyncProfiler) + implementation(projects.sentryJcache) + implementation(libs.jcache) + implementation(libs.caffeine.jcache) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(projects.sentry) diff --git a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java index 29fae9381b2..0ed0646c7bc 100644 --- a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java @@ -2,9 +2,14 @@ import io.sentry.*; import io.sentry.clientreport.DiscardReason; +import io.sentry.jcache.SentryJCacheWrapper; import io.sentry.protocol.Message; import io.sentry.protocol.User; import java.util.Collections; +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.MutableConfiguration; public class Main { @@ -88,6 +93,9 @@ public static void main(String[] args) throws InterruptedException { // Set what percentage of traces should be collected options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces + // Enable cache tracing to create spans for cache operations + options.setEnableCacheTracing(true); + // Determine traces sample rate based on the sampling context // options.setTracesSampler( // context -> { @@ -164,6 +172,12 @@ public static void main(String[] args) throws InterruptedException { Sentry.captureEvent(event, hint); } + // Cache tracing with JCache (JSR-107) + // + // Wrapping a JCache Cache with SentryJCacheWrapper creates cache.get, cache.put, + // cache.remove, and cache.flush spans as children of the active transaction. + demonstrateCacheTracing(); + // Performance feature // // Transactions collect execution time of the piece of code that's executed between the start @@ -191,6 +205,42 @@ public static void main(String[] args) throws InterruptedException { // Sentry.close(); } + private static void demonstrateCacheTracing() { + // Create a JCache CacheManager and Cache using standard JSR-107 API + CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(); + MutableConfiguration config = + new MutableConfiguration().setTypes(String.class, String.class); + Cache rawCache = cacheManager.createCache("myCache", config); + + // Wrap with SentryJCacheWrapper to enable cache tracing + Cache cache = new SentryJCacheWrapper<>(rawCache); + + // All cache operations inside a transaction produce child spans + ITransaction transaction = Sentry.startTransaction("cache-demo", "demo"); + try (ISentryLifecycleToken ignored = transaction.makeCurrent()) { + // cache.put span + cache.put("greeting", "hello"); + + // cache.get span (hit — returns "hello", cache.hit = true) + cache.get("greeting"); + + // cache.get span (miss — returns null, cache.hit = false) + cache.get("nonexistent"); + + // cache.remove span + cache.remove("greeting"); + + // cache.flush span + cache.clear(); + } finally { + transaction.finish(); + } + + // Clean up + cacheManager.destroyCache("myCache"); + cacheManager.close(); + } + private static void captureMetrics() { Sentry.metrics().count("countMetric"); Sentry.metrics().gauge("gaugeMetric", 5.0); diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index ef38162d6bf..c3e8ba06fae 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -59,6 +59,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(libs.otel) + // cache tracing + implementation(libs.springboot4.starter.cache) + implementation(libs.caffeine) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/CacheController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/CacheController.java new file mode 100644 index 00000000000..3c2e66442de --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot4; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index aa5ebce68cd..b00609ad9ac 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -11,6 +11,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -21,6 +22,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoService.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoService.java new file mode 100644 index 00000000000..c837ab8398a --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot4; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties index 6b57706019b..a0808e04fde 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties @@ -20,6 +20,9 @@ sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s # Uncomment and set to true to enable aot compatibility # This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index 4f3d64524fd..01e07fc2526 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -58,6 +58,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(projects.sentryOpentelemetry.sentryOpentelemetryOtlpSpring) + // cache tracing + implementation(libs.springboot4.starter.cache) + implementation(libs.caffeine) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CacheController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CacheController.java new file mode 100644 index 00000000000..f453f81187c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot4.otlp; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java index b4c58c4882e..1bf622154d0 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SentryDemoApplication.java @@ -12,6 +12,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -22,6 +23,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoService.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoService.java new file mode 100644 index 00000000000..1a748a165a4 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot4.otlp; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties index 43c0bd18c08..f9b35099062 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties @@ -20,6 +20,9 @@ sentry.logs.enabled=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s # Uncomment and set to true to enable aot compatibility # This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index b9986a31d02..cdcf65711a8 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -32,6 +32,10 @@ dependencies { implementation(libs.springboot4.starter.webflux) implementation(libs.springboot4.starter.webclient) + // cache tracing + implementation(libs.springboot4.starter.cache) + implementation(libs.caffeine) + testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(projects.sentrySystemTestSupport) testImplementation(libs.apollo3.kotlin) diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/CacheController.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/CacheController.java new file mode 100644 index 00000000000..3c2e66442de --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot4; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index 72980871730..0d37be7634c 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -2,10 +2,12 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/TodoService.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/TodoService.java new file mode 100644 index 00000000000..c837ab8398a --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot4; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties index 9e9d6596e08..9fc969efd28 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties @@ -15,3 +15,6 @@ sentry.enable-spotlight=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index a7fa57dac83..f43cc47cc6d 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -57,6 +57,10 @@ dependencies { implementation(projects.sentryQuartz) implementation(projects.sentryAsyncProfiler) + // cache tracing + implementation(libs.springboot4.starter.cache) + implementation(libs.caffeine) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/CacheController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/CacheController.java new file mode 100644 index 00000000000..3c2e66442de --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot4; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java index 71463a9a819..13d97fa8442 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SentryDemoApplication.java @@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.restclient.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -19,6 +20,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoService.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoService.java new file mode 100644 index 00000000000..c837ab8398a --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot4; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties index 9ba7a54aaf8..8198059343a 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties @@ -20,6 +20,9 @@ sentry.logs.enabled=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s # Uncomment and set to true to enable aot compatibility # This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index b0fbae0ddc4..86914467a6d 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -52,6 +52,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) + // cache tracing + implementation(libs.springboot3.starter.cache) + implementation(libs.caffeine) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java new file mode 100644 index 00000000000..1327d5e6e29 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot.jakarta; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java index 7f412eaa0d6..8cbd7875b5f 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java @@ -11,6 +11,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -21,6 +22,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java new file mode 100644 index 00000000000..70a145558c2 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot.jakarta; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties index d19c33a3d1b..a3a59d290b1 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties @@ -35,6 +35,11 @@ spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.quartz.job-store-type=memory +# Cache tracing +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s + # OTEL configuration otel.propagators=tracecontext,baggage,sentry otel.logs.exporter=none diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index 0eeaf30d2bd..37d7a94eec0 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -56,6 +56,10 @@ dependencies { implementation(libs.otel) implementation(projects.sentryAsyncProfiler) + // cache tracing + implementation(libs.springboot3.starter.cache) + implementation(libs.caffeine) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java new file mode 100644 index 00000000000..1327d5e6e29 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot.jakarta; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java index a6eb46f4c74..cd550bfbadf 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java @@ -11,6 +11,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -21,6 +22,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java new file mode 100644 index 00000000000..70a145558c2 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot.jakarta; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties index 6b57706019b..12a9ca17269 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties @@ -34,3 +34,8 @@ spring.datasource.password= spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.quartz.job-store-type=memory + +# Cache tracing +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index 570d35b727b..a945b87109a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -55,6 +55,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(projects.sentryOpenfeature) + // cache tracing + implementation(libs.springboot3.starter.cache) + implementation(libs.caffeine) + // OpenFeature SDK implementation(libs.openfeature) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java new file mode 100644 index 00000000000..1327d5e6e29 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot.jakarta; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java index 8050cb8e74c..e818cbe42ff 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java @@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -19,6 +20,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java new file mode 100644 index 00000000000..70a145558c2 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot.jakarta; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 9830709c313..60b92d369d5 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -35,3 +35,8 @@ spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.quartz.job-store-type=memory +# Cache tracing +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s + diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts index 1cdff5cab38..a45249830f4 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts @@ -31,6 +31,10 @@ dependencies { implementation(libs.springboot3.starter.graphql) implementation(libs.springboot3.starter.webflux) + // cache tracing + implementation(libs.springboot3.starter.cache) + implementation(libs.caffeine) + testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(projects.sentrySystemTestSupport) testImplementation(libs.apollo3.kotlin) diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java new file mode 100644 index 00000000000..1327d5e6e29 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot.jakarta; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java index 926298bb97b..baa6d30e5c3 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/SentryDemoApplication.java @@ -2,10 +2,12 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching public class SentryDemoApplication { public static void main(String[] args) { SpringApplication.run(SentryDemoApplication.class, args); diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java new file mode 100644 index 00000000000..70a145558c2 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot.jakarta; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties index 3bc4087b288..02eaf0c731c 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties @@ -16,3 +16,8 @@ sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE + +# Cache tracing +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index be2b4583fb6..b6fcd675cf3 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -40,7 +40,9 @@ dependencies { implementation(libs.springboot.starter.security) implementation(libs.springboot.starter.web) implementation(libs.springboot.starter.webflux) + implementation(libs.springboot.starter.cache) implementation(libs.springboot.starter.websocket) + implementation(libs.caffeine) implementation(Config.Libs.aspectj) implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/CacheController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/CacheController.java new file mode 100644 index 00000000000..e85f201139f --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/CacheController.java @@ -0,0 +1,34 @@ +package io.sentry.samples.spring.boot; + +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/cache/") +public class CacheController { + private final TodoService todoService; + + public CacheController(TodoService todoService) { + this.todoService = todoService; + } + + @GetMapping("{id}") + Todo get(@PathVariable Long id) { + return todoService.get(id); + } + + @PostMapping + Todo save(@RequestBody Todo todo) { + return todoService.save(todo); + } + + @DeleteMapping("{id}") + void delete(@PathVariable Long id) { + todoService.delete(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/SentryDemoApplication.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/SentryDemoApplication.java index b4f46260997..a08770b1029 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/SentryDemoApplication.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/SentryDemoApplication.java @@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; @@ -18,6 +19,7 @@ import org.springframework.web.reactive.function.client.WebClient; @SpringBootApplication +@EnableCaching @EnableScheduling public class SentryDemoApplication { public static void main(String[] args) { diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/TodoService.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/TodoService.java new file mode 100644 index 00000000000..81aa944c8be --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/TodoService.java @@ -0,0 +1,29 @@ +package io.sentry.samples.spring.boot; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +@Service +public class TodoService { + private final Map store = new ConcurrentHashMap<>(); + + @Cacheable(value = "todos", key = "#id") + public Todo get(Long id) { + return store.get(id); + } + + @CachePut(value = "todos", key = "#todo.id") + public Todo save(Todo todo) { + store.put(todo.getId(), todo); + return todo; + } + + @CacheEvict(value = "todos", key = "#id") + public void delete(Long id) { + store.remove(id); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties index d39f38d7182..4e97e7a1eb8 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties @@ -20,6 +20,11 @@ sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces sentry.profile-lifecycle=TRACE +# Cache tracing +sentry.enable-cache-tracing=true +spring.cache.cache-names=todos +spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s + # Database configuration spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt new file mode 100644 index 00000000000..b45e9c10853 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/CacheSystemTest.kt @@ -0,0 +1,51 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class CacheSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `cache put and get produce spans`() { + val restClient = testHelper.restClient + + // Save a todo (triggers @CachePut -> cache.put span) + val todo = Todo(1L, "test-todo", false) + restClient.saveCachedTodo(todo) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put") + } + + testHelper.reset() + + // Get the todo (triggers @Cacheable -> cache.get span, should be a hit) + restClient.getCachedTodo(1L) + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get") + } + } + + @Test + fun `cache evict produces span`() { + val restClient = testHelper.restClient + + restClient.deleteCachedTodo(1L) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict") + } + } +} diff --git a/sentry-spring-7/api/sentry-spring-7.api b/sentry-spring-7/api/sentry-spring-7.api index 3a57c13e835..71a8a022bf6 100644 --- a/sentry-spring-7/api/sentry-spring-7.api +++ b/sentry-spring-7/api/sentry-spring-7.api @@ -104,6 +104,35 @@ public final class io/sentry/spring7/SpringSecuritySentryUserProvider : io/sentr public fun provideUser ()Lio/sentry/protocol/User; } +public final class io/sentry/spring7/cache/SentryCacheBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring7/cache/SentryCacheManagerWrapper : org/springframework/cache/CacheManager { + public fun (Lorg/springframework/cache/CacheManager;Lio/sentry/IScopes;)V + public fun getCache (Ljava/lang/String;)Lorg/springframework/cache/Cache; + public fun getCacheNames ()Ljava/util/Collection; +} + +public final class io/sentry/spring7/cache/SentryCacheWrapper : org/springframework/cache/Cache { + public fun (Lorg/springframework/cache/Cache;Lio/sentry/IScopes;)V + public fun clear ()V + public fun evict (Ljava/lang/Object;)V + public fun evictIfPresent (Ljava/lang/Object;)Z + public fun get (Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; + public fun get (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; + public fun get (Ljava/lang/Object;Ljava/util/concurrent/Callable;)Ljava/lang/Object; + public fun getName ()Ljava/lang/String; + public fun getNativeCache ()Ljava/lang/Object; + public fun invalidate ()Z + public fun put (Ljava/lang/Object;Ljava/lang/Object;)V + public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; + public fun retrieve (Ljava/lang/Object;)Ljava/util/concurrent/CompletableFuture; + public fun retrieve (Ljava/lang/Object;Ljava/util/function/Supplier;)Ljava/util/concurrent/CompletableFuture; +} + public abstract interface annotation class io/sentry/spring7/checkin/SentryCheckIn : java/lang/annotation/Annotation { public abstract fun heartbeat ()Z public abstract fun monitorSlug ()Ljava/lang/String; diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheBeanPostProcessor.java b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheBeanPostProcessor.java new file mode 100644 index 00000000000..b6569a9953b --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheBeanPostProcessor.java @@ -0,0 +1,29 @@ +package io.sentry.spring7.cache; + +import io.sentry.ScopesAdapter; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.cache.CacheManager; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; + +/** Wraps {@link CacheManager} beans in {@link SentryCacheManagerWrapper} for instrumentation. */ +@ApiStatus.Internal +public final class SentryCacheBeanPostProcessor implements BeanPostProcessor, PriorityOrdered { + + @Override + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof CacheManager && !(bean instanceof SentryCacheManagerWrapper)) { + return new SentryCacheManagerWrapper((CacheManager) bean, ScopesAdapter.getInstance()); + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheManagerWrapper.java b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheManagerWrapper.java new file mode 100644 index 00000000000..97ac313bd91 --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheManagerWrapper.java @@ -0,0 +1,37 @@ +package io.sentry.spring7.cache; + +import io.sentry.IScopes; +import java.util.Collection; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; + +/** Wraps a Spring {@link CacheManager} to return Sentry-instrumented caches. */ +@ApiStatus.Internal +public final class SentryCacheManagerWrapper implements CacheManager { + + private final @NotNull CacheManager delegate; + private final @NotNull IScopes scopes; + + public SentryCacheManagerWrapper( + final @NotNull CacheManager delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @Nullable Cache getCache(final @NotNull String name) { + final Cache cache = delegate.getCache(name); + if (cache == null || cache instanceof SentryCacheWrapper) { + return cache; + } + return new SentryCacheWrapper(cache, scopes); + } + + @Override + public @NotNull Collection getCacheNames() { + return delegate.getCacheNames(); + } +} diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java new file mode 100644 index 00000000000..e5cb9ce87e9 --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java @@ -0,0 +1,326 @@ +package io.sentry.spring7.cache; + +import io.sentry.IScopes; +import io.sentry.ISpan; +import io.sentry.SpanDataConvention; +import io.sentry.SpanOptions; +import io.sentry.SpanStatus; +import java.util.Collections; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Supplier; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; + +/** Wraps a Spring {@link Cache} to create Sentry spans for cache operations. */ +@ApiStatus.Internal +public final class SentryCacheWrapper implements Cache { + + private static final String TRACE_ORIGIN = "auto.cache.spring"; + + private final @NotNull Cache delegate; + private final @NotNull IScopes scopes; + + public SentryCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @NotNull String getName() { + return delegate.getName(); + } + + @Override + public @NotNull Object getNativeCache() { + return delegate.getNativeCache(); + } + + @Override + public @Nullable ValueWrapper get(final @NotNull Object key) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key); + } + try { + final ValueWrapper result = delegate.get(key); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @Nullable Class type) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, type); + } + try { + final T result = delegate.get(key, type); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @NotNull Callable valueLoader) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, valueLoader); + } + try { + final AtomicBoolean loaderInvoked = new AtomicBoolean(false); + final T result = + delegate.get( + key, + () -> { + loaderInvoked.set(true); + return valueLoader.call(); + }); + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable CompletableFuture retrieve(final @NotNull Object key) { + final ISpan span = startSpan(key, "retrieve"); + if (span == null) { + return delegate.retrieve(key); + } + final CompletableFuture result; + try { + result = delegate.retrieve(key); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + span.finish(); + throw e; + } + if (result == null) { + span.setData(SpanDataConvention.CACHE_HIT, false); + span.setStatus(SpanStatus.OK); + span.finish(); + return null; + } + return result.whenComplete( + (value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, value != null); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); + } + + @Override + public CompletableFuture retrieve( + final @NotNull Object key, final @NotNull Supplier> valueLoader) { + final ISpan span = startSpan(key, "retrieve"); + if (span == null) { + return delegate.retrieve(key, valueLoader); + } + final AtomicBoolean loaderInvoked = new AtomicBoolean(false); + final CompletableFuture result; + try { + result = + delegate.retrieve( + key, + () -> { + loaderInvoked.set(true); + return valueLoader.get(); + }); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + span.finish(); + throw e; + } + return result.whenComplete( + (value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); + } + + @Override + public void put(final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "put"); + if (span == null) { + delegate.put(key, value); + return; + } + try { + delegate.put(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable ValueWrapper putIfAbsent( + final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "putIfAbsent"); + if (span == null) { + return delegate.putIfAbsent(key, value); + } + try { + final ValueWrapper result = delegate.putIfAbsent(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result == null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void evict(final @NotNull Object key) { + final ISpan span = startSpan(key, "evict"); + if (span == null) { + delegate.evict(key); + return; + } + try { + delegate.evict(key); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean evictIfPresent(final @NotNull Object key) { + final ISpan span = startSpan(key, "evictIfPresent"); + if (span == null) { + return delegate.evictIfPresent(key); + } + try { + final boolean result = delegate.evictIfPresent(key); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void clear() { + final ISpan span = startSpan(null, "clear"); + if (span == null) { + delegate.clear(); + return; + } + try { + delegate.clear(); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean invalidate() { + final ISpan span = startSpan(null, "invalidate"); + if (span == null) { + return delegate.invalidate(); + } + try { + final boolean result = delegate.invalidate(); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + private @Nullable ISpan startSpan( + final @Nullable Object key, final @NotNull String operationName) { + if (!scopes.getOptions().isEnableCacheTracing()) { + return null; + } + + final ISpan activeSpan = scopes.getSpan(); + if (activeSpan == null || activeSpan.isNoOp()) { + return null; + } + + final SpanOptions spanOptions = new SpanOptions(); + spanOptions.setOrigin(TRACE_ORIGIN); + final String keyString = key != null ? String.valueOf(key) : null; + final ISpan span = activeSpan.startChild("cache." + operationName, keyString, spanOptions); + if (span.isNoOp()) { + return null; + } + if (keyString != null) { + span.setData(SpanDataConvention.CACHE_KEY, Collections.singletonList(keyString)); + } + span.setData(SpanDataConvention.CACHE_OPERATION, operationName); + return span; + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheBeanPostProcessorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheBeanPostProcessorTest.kt new file mode 100644 index 00000000000..54c5e696d6a --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheBeanPostProcessorTest.kt @@ -0,0 +1,44 @@ +package io.sentry.spring7.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.cache.CacheManager + +class SentryCacheBeanPostProcessorTest { + + private val scopes: IScopes = mock() + + @Test + fun `wraps CacheManager beans in SentryCacheManagerWrapper`() { + val cacheManager = mock() + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(cacheManager, "cacheManager") + + assertTrue(result is SentryCacheManagerWrapper) + } + + @Test + fun `does not double-wrap SentryCacheManagerWrapper`() { + val delegate = mock() + val alreadyWrapped = SentryCacheManagerWrapper(delegate, scopes) + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(alreadyWrapped, "cacheManager") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `does not wrap non-CacheManager beans`() { + val someBean = "not a cache manager" + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheManagerWrapperTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheManagerWrapperTest.kt new file mode 100644 index 00000000000..dbc5992b7e0 --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheManagerWrapperTest.kt @@ -0,0 +1,61 @@ +package io.sentry.spring7.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache +import org.springframework.cache.CacheManager + +class SentryCacheManagerWrapperTest { + + private val scopes: IScopes = mock() + private val delegate: CacheManager = mock() + + @Test + fun `getCache wraps returned cache in SentryCacheWrapper`() { + val cache = mock() + whenever(delegate.getCache("test")).thenReturn(cache) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertTrue(result is SentryCacheWrapper) + } + + @Test + fun `getCache returns null when delegate returns null`() { + whenever(delegate.getCache("missing")).thenReturn(null) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("missing") + + assertNull(result) + } + + @Test + fun `getCache does not double-wrap SentryCacheWrapper`() { + val innerCache = mock() + val alreadyWrapped = SentryCacheWrapper(innerCache, scopes) + whenever(delegate.getCache("test")).thenReturn(alreadyWrapped) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `getCacheNames delegates to underlying cache manager`() { + whenever(delegate.cacheNames).thenReturn(listOf("cache1", "cache2")) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.cacheNames + + assertEquals(listOf("cache1", "cache2"), result) + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheWrapperTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheWrapperTest.kt new file mode 100644 index 00000000000..ef056e7fdb5 --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/cache/SentryCacheWrapperTest.kt @@ -0,0 +1,530 @@ +package io.sentry.spring7.cache + +import io.sentry.IScopes +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import java.util.concurrent.Callable +import java.util.concurrent.CompletableFuture +import java.util.function.Supplier +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.any +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache + +class SentryCacheWrapperTest { + + private lateinit var scopes: IScopes + private lateinit var delegate: Cache + private lateinit var options: SentryOptions + + @BeforeTest + fun setup() { + scopes = mock() + delegate = mock() + options = SentryOptions().apply { isEnableCacheTracing = true } + whenever(scopes.options).thenReturn(options) + whenever(delegate.name).thenReturn("testCache") + } + + private fun createTransaction(): SentryTracer { + val tx = SentryTracer(TransactionContext("tx", "op"), scopes) + whenever(scopes.span).thenReturn(tx) + return tx + } + + // -- get(Object key) -- + + @Test + fun `get with ValueWrapper creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val valueWrapper = mock() + whenever(delegate.get("myKey")).thenReturn(valueWrapper) + + val result = wrapper.get("myKey") + + assertEquals(valueWrapper, result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.get", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("auto.cache.spring", span.spanContext.origin) + assertEquals("get", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `get with ValueWrapper creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + val result = wrapper.get("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- get(Object key, Class) -- + + @Test + fun `get with type creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn("value") + + val result = wrapper.get("myKey", String::class.java) + + assertEquals("value", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn(null) + + val result = wrapper.get("myKey", String::class.java) + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey", String::class.java)).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey", String::class.java) } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- get(Object key, Callable) -- + + @Test + fun `get with callable creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache hit: delegate returns value without invoking the loader + whenever(delegate.get(eq("myKey"), any>())).thenReturn("cached") + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("cached", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with callable creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache miss: delegate invokes the loader callable + whenever(delegate.get(eq("myKey"), any>())).thenAnswer { invocation -> + val loader = invocation.getArgument>(1) + loader.call() + } + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("loaded", result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- retrieve(Object key) -- + + @Test + fun `retrieve creates span with cache hit true when future resolves with value`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture("value")) + + val result = wrapper.retrieve("myKey") + + assertEquals("value", result!!.get()) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.retrieve", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("retrieve", span.getData(SpanDataConvention.CACHE_OPERATION)) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve creates span with cache hit false when future resolves with null`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture(null)) + + val result = wrapper.retrieve("myKey") + + assertNull(result!!.get()) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve creates span with cache hit false when delegate returns null`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(null) + + val result = wrapper.retrieve("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(false, span.getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals(SpanStatus.OK, span.status) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve sets error status when future completes exceptionally`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("async cache error") + whenever(delegate.retrieve("myKey")) + .thenReturn(CompletableFuture().also { it.completeExceptionally(exception) }) + + val result = wrapper.retrieve("myKey") + + assertFailsWith { result!!.get() } + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve sets error status when delegate throws synchronously`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("sync error") + whenever(delegate.retrieve("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.retrieve("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve does not create span when tracing is disabled`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture("value")) + + wrapper.retrieve("myKey") + + verify(delegate).retrieve("myKey") + assertEquals(0, tx.spans.size) + } + + // -- retrieve(Object key, Supplier>) -- + + @Test + fun `retrieve with loader creates span with cache hit true when loader not invoked`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache hit: delegate returns value without invoking the loader + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture.completedFuture("cached")) + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertEquals("cached", result.get()) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve with loader creates span with cache hit false when loader invoked`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache miss: delegate invokes the loader supplier + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenAnswer { invocation -> + val loader = invocation.getArgument>>(1) + loader.get() + } + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertEquals("loaded", result.get()) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve with loader sets error status when future completes exceptionally`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("async loader error") + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture().also { it.completeExceptionally(exception) }) + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertFailsWith { result.get() } + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve with loader does not create span when tracing is disabled`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture.completedFuture("cached")) + + wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + verify(delegate).retrieve(eq("myKey"), any>>()) + assertEquals(0, tx.spans.size) + } + + // -- put -- + + @Test + fun `put creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.put("myKey", "myValue") + + verify(delegate).put("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.put", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("put", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- putIfAbsent -- + + @Test + fun `putIfAbsent creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.putIfAbsent("myKey", "myValue")).thenReturn(null) + + val result = wrapper.putIfAbsent("myKey", "myValue") + + assertNull(result) + verify(delegate).putIfAbsent("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.putIfAbsent", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("putIfAbsent", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- evict -- + + @Test + fun `evict creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.evict("myKey") + + verify(delegate).evict("myKey") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.evict", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evict", span.getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + } + + // -- evictIfPresent -- + + @Test + fun `evictIfPresent creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.evictIfPresent("myKey")).thenReturn(true) + + val result = wrapper.evictIfPresent("myKey") + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.evictIfPresent", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evictIfPresent", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- clear -- + + @Test + fun `clear creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.clear() + + verify(delegate).clear() + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.clear", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertNull(span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("clear", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- invalidate -- + + @Test + fun `invalidate creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(true) + + val result = wrapper.invalidate() + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `invalidate sets cache write false when cache had no mappings`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(false) + + val result = wrapper.invalidate() + + assertFalse(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- no span when no active transaction -- + + @Test + fun `does not create span when there is no active transaction`() { + whenever(scopes.span).thenReturn(null) + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + } + + // -- no span when option is disabled -- + + @Test + fun `does not create span when enableCacheTracing is false`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + assertEquals(0, tx.spans.size) + } + + // -- error handling -- + + @Test + fun `sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- delegation -- + + @Test + fun `getName delegates to underlying cache`() { + val wrapper = SentryCacheWrapper(delegate, scopes) + assertEquals("testCache", wrapper.name) + } + + @Test + fun `getNativeCache delegates to underlying cache`() { + val nativeCache = Object() + whenever(delegate.nativeCache).thenReturn(nativeCache) + val wrapper = SentryCacheWrapper(delegate, scopes) + + assertEquals(nativeCache, wrapper.nativeCache) + } +} diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java index 1b804e8cb8d..ae9e3ac50fe 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java @@ -25,6 +25,7 @@ import io.sentry.spring7.SentryWebConfiguration; import io.sentry.spring7.SpringProfilesEventProcessor; import io.sentry.spring7.SpringSecuritySentryUserProvider; +import io.sentry.spring7.cache.SentryCacheBeanPostProcessor; import io.sentry.spring7.checkin.SentryCheckInAdviceConfiguration; import io.sentry.spring7.checkin.SentryCheckInPointcutConfiguration; import io.sentry.spring7.checkin.SentryQuartzConfiguration; @@ -65,6 +66,7 @@ import org.springframework.boot.restclient.autoconfigure.RestTemplateAutoConfiguration; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.webclient.autoconfigure.WebClientAutoConfiguration; +import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; @@ -229,6 +231,19 @@ static class Graphql22Configuration {} }) static class QuartzConfiguration {} + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(CacheManager.class) + @ConditionalOnProperty(name = "sentry.enable-cache-tracing", havingValue = "true") + @Open + static class SentryCacheConfiguration { + + @Bean + public static @NotNull SentryCacheBeanPostProcessor sentryCacheBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringCache"); + return new SentryCacheBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt index a5566ef2f30..7f30c860bb3 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt @@ -38,6 +38,7 @@ import io.sentry.spring7.SentryUserFilter import io.sentry.spring7.SentryUserProvider import io.sentry.spring7.SpringProfilesEventProcessor import io.sentry.spring7.SpringSecuritySentryUserProvider +import io.sentry.spring7.cache.SentryCacheBeanPostProcessor import io.sentry.spring7.tracing.SentryTracingFilter import io.sentry.spring7.tracing.SpringServletTransactionNameProvider import io.sentry.spring7.tracing.TransactionNameProvider @@ -231,6 +232,7 @@ class SentryAutoConfigurationTest { "sentry.ignored-transactions=transactionName1,transactionNameB", "sentry.enable-backpressure-handling=false", "sentry.enable-database-transaction-tracing=true", + "sentry.enable-cache-tracing=true", "sentry.enable-spotlight=true", "sentry.spotlight-connection-url=http://local.sentry.io:1234", "sentry.force-init=true", @@ -284,6 +286,7 @@ class SentryAutoConfigurationTest { .containsOnly(FilterString("transactionName1"), FilterString("transactionNameB")) assertThat(options.isEnableBackpressureHandling).isEqualTo(false) assertThat(options.isEnableDatabaseTransactionTracing).isEqualTo(true) + assertThat(options.isEnableCacheTracing).isEqualTo(true) assertThat(options.isForceInit).isEqualTo(true) assertThat(options.isGlobalHubMode).isEqualTo(true) assertThat(options.isCaptureOpenTelemetryEvents).isEqualTo(true) @@ -1179,6 +1182,33 @@ class SentryAutoConfigurationTest { } } + @Test + fun `SentryCacheBeanPostProcessor is registered when enable-cache-tracing is true`() { + contextRunner + .withPropertyValues( + "sentry.dsn=http://key@localhost/proj", + "sentry.enable-cache-tracing=true", + ) + .run { assertThat(it).hasSingleBean(SentryCacheBeanPostProcessor::class.java) } + } + + @Test + fun `SentryCacheBeanPostProcessor is not registered when enable-cache-tracing is missing`() { + contextRunner.withPropertyValues("sentry.dsn=http://key@localhost/proj").run { + assertThat(it).doesNotHaveBean(SentryCacheBeanPostProcessor::class.java) + } + } + + @Test + fun `SentryCacheBeanPostProcessor is not registered when enable-cache-tracing is false`() { + contextRunner + .withPropertyValues( + "sentry.dsn=http://key@localhost/proj", + "sentry.enable-cache-tracing=false", + ) + .run { assertThat(it).doesNotHaveBean(SentryCacheBeanPostProcessor::class.java) } + } + @Configuration(proxyBeanMethods = false) open class CustomSchedulerFactoryBeanCustomizerConfiguration { class MyJobListener : JobListener { diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java index 8663dac8c56..ef57868ad87 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java @@ -25,6 +25,7 @@ import io.sentry.spring.jakarta.SentryWebConfiguration; import io.sentry.spring.jakarta.SpringProfilesEventProcessor; import io.sentry.spring.jakarta.SpringSecuritySentryUserProvider; +import io.sentry.spring.jakarta.cache.SentryCacheBeanPostProcessor; import io.sentry.spring.jakarta.checkin.SentryCheckInAdviceConfiguration; import io.sentry.spring.jakarta.checkin.SentryCheckInPointcutConfiguration; import io.sentry.spring.jakarta.checkin.SentryQuartzConfiguration; @@ -65,6 +66,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.info.GitProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; @@ -231,6 +233,19 @@ static class Graphql22Configuration {} }) static class QuartzConfiguration {} + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(CacheManager.class) + @ConditionalOnProperty(name = "sentry.enable-cache-tracing", havingValue = "true") + @Open + static class SentryCacheConfiguration { + + @Bean + public static @NotNull SentryCacheBeanPostProcessor sentryCacheBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringCache"); + return new SentryCacheBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java index 76424b5c55f..99fd602f74b 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java @@ -25,6 +25,7 @@ import io.sentry.spring.SpringProfilesEventProcessor; import io.sentry.spring.SpringSecuritySentryUserProvider; import io.sentry.spring.boot.graphql.SentryGraphqlAutoConfiguration; +import io.sentry.spring.cache.SentryCacheBeanPostProcessor; import io.sentry.spring.checkin.SentryCheckInAdviceConfiguration; import io.sentry.spring.checkin.SentryCheckInPointcutConfiguration; import io.sentry.spring.checkin.SentryQuartzConfiguration; @@ -64,6 +65,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.info.GitProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; @@ -216,6 +218,19 @@ static class GraphqlConfiguration {} }) static class QuartzConfiguration {} + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(CacheManager.class) + @ConditionalOnProperty(name = "sentry.enable-cache-tracing", havingValue = "true") + @Open + static class SentryCacheConfiguration { + + @Bean + public static @NotNull SentryCacheBeanPostProcessor sentryCacheBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringCache"); + return new SentryCacheBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-jakarta/api/sentry-spring-jakarta.api b/sentry-spring-jakarta/api/sentry-spring-jakarta.api index f28f4153b59..fe634da6f4c 100644 --- a/sentry-spring-jakarta/api/sentry-spring-jakarta.api +++ b/sentry-spring-jakarta/api/sentry-spring-jakarta.api @@ -104,6 +104,35 @@ public final class io/sentry/spring/jakarta/SpringSecuritySentryUserProvider : i public fun provideUser ()Lio/sentry/protocol/User; } +public final class io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/jakarta/cache/SentryCacheManagerWrapper : org/springframework/cache/CacheManager { + public fun (Lorg/springframework/cache/CacheManager;Lio/sentry/IScopes;)V + public fun getCache (Ljava/lang/String;)Lorg/springframework/cache/Cache; + public fun getCacheNames ()Ljava/util/Collection; +} + +public final class io/sentry/spring/jakarta/cache/SentryCacheWrapper : org/springframework/cache/Cache { + public fun (Lorg/springframework/cache/Cache;Lio/sentry/IScopes;)V + public fun clear ()V + public fun evict (Ljava/lang/Object;)V + public fun evictIfPresent (Ljava/lang/Object;)Z + public fun get (Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; + public fun get (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; + public fun get (Ljava/lang/Object;Ljava/util/concurrent/Callable;)Ljava/lang/Object; + public fun getName ()Ljava/lang/String; + public fun getNativeCache ()Ljava/lang/Object; + public fun invalidate ()Z + public fun put (Ljava/lang/Object;Ljava/lang/Object;)V + public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; + public fun retrieve (Ljava/lang/Object;)Ljava/util/concurrent/CompletableFuture; + public fun retrieve (Ljava/lang/Object;Ljava/util/function/Supplier;)Ljava/util/concurrent/CompletableFuture; +} + public abstract interface annotation class io/sentry/spring/jakarta/checkin/SentryCheckIn : java/lang/annotation/Annotation { public abstract fun heartbeat ()Z public abstract fun monitorSlug ()Ljava/lang/String; diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessor.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessor.java new file mode 100644 index 00000000000..ec9964f7abc --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessor.java @@ -0,0 +1,29 @@ +package io.sentry.spring.jakarta.cache; + +import io.sentry.ScopesAdapter; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.cache.CacheManager; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; + +/** Wraps {@link CacheManager} beans in {@link SentryCacheManagerWrapper} for instrumentation. */ +@ApiStatus.Internal +public final class SentryCacheBeanPostProcessor implements BeanPostProcessor, PriorityOrdered { + + @Override + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof CacheManager && !(bean instanceof SentryCacheManagerWrapper)) { + return new SentryCacheManagerWrapper((CacheManager) bean, ScopesAdapter.getInstance()); + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapper.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapper.java new file mode 100644 index 00000000000..ed243e973a2 --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapper.java @@ -0,0 +1,37 @@ +package io.sentry.spring.jakarta.cache; + +import io.sentry.IScopes; +import java.util.Collection; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; + +/** Wraps a Spring {@link CacheManager} to return Sentry-instrumented caches. */ +@ApiStatus.Internal +public final class SentryCacheManagerWrapper implements CacheManager { + + private final @NotNull CacheManager delegate; + private final @NotNull IScopes scopes; + + public SentryCacheManagerWrapper( + final @NotNull CacheManager delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @Nullable Cache getCache(final @NotNull String name) { + final Cache cache = delegate.getCache(name); + if (cache == null || cache instanceof SentryCacheWrapper) { + return cache; + } + return new SentryCacheWrapper(cache, scopes); + } + + @Override + public @NotNull Collection getCacheNames() { + return delegate.getCacheNames(); + } +} diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java new file mode 100644 index 00000000000..9b7c551a2d2 --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java @@ -0,0 +1,326 @@ +package io.sentry.spring.jakarta.cache; + +import io.sentry.IScopes; +import io.sentry.ISpan; +import io.sentry.SpanDataConvention; +import io.sentry.SpanOptions; +import io.sentry.SpanStatus; +import java.util.Collections; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Supplier; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; + +/** Wraps a Spring {@link Cache} to create Sentry spans for cache operations. */ +@ApiStatus.Internal +public final class SentryCacheWrapper implements Cache { + + private static final String TRACE_ORIGIN = "auto.cache.spring"; + + private final @NotNull Cache delegate; + private final @NotNull IScopes scopes; + + public SentryCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @NotNull String getName() { + return delegate.getName(); + } + + @Override + public @NotNull Object getNativeCache() { + return delegate.getNativeCache(); + } + + @Override + public @Nullable ValueWrapper get(final @NotNull Object key) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key); + } + try { + final ValueWrapper result = delegate.get(key); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @Nullable Class type) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, type); + } + try { + final T result = delegate.get(key, type); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @NotNull Callable valueLoader) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, valueLoader); + } + try { + final AtomicBoolean loaderInvoked = new AtomicBoolean(false); + final T result = + delegate.get( + key, + () -> { + loaderInvoked.set(true); + return valueLoader.call(); + }); + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable CompletableFuture retrieve(final @NotNull Object key) { + final ISpan span = startSpan(key, "retrieve"); + if (span == null) { + return delegate.retrieve(key); + } + final CompletableFuture result; + try { + result = delegate.retrieve(key); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + span.finish(); + throw e; + } + if (result == null) { + span.setData(SpanDataConvention.CACHE_HIT, false); + span.setStatus(SpanStatus.OK); + span.finish(); + return null; + } + return result.whenComplete( + (value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, value != null); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); + } + + @Override + public CompletableFuture retrieve( + final @NotNull Object key, final @NotNull Supplier> valueLoader) { + final ISpan span = startSpan(key, "retrieve"); + if (span == null) { + return delegate.retrieve(key, valueLoader); + } + final AtomicBoolean loaderInvoked = new AtomicBoolean(false); + final CompletableFuture result; + try { + result = + delegate.retrieve( + key, + () -> { + loaderInvoked.set(true); + return valueLoader.get(); + }); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + span.finish(); + throw e; + } + return result.whenComplete( + (value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); + } + + @Override + public void put(final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "put"); + if (span == null) { + delegate.put(key, value); + return; + } + try { + delegate.put(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable ValueWrapper putIfAbsent( + final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "putIfAbsent"); + if (span == null) { + return delegate.putIfAbsent(key, value); + } + try { + final ValueWrapper result = delegate.putIfAbsent(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result == null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void evict(final @NotNull Object key) { + final ISpan span = startSpan(key, "evict"); + if (span == null) { + delegate.evict(key); + return; + } + try { + delegate.evict(key); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean evictIfPresent(final @NotNull Object key) { + final ISpan span = startSpan(key, "evictIfPresent"); + if (span == null) { + return delegate.evictIfPresent(key); + } + try { + final boolean result = delegate.evictIfPresent(key); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void clear() { + final ISpan span = startSpan(null, "clear"); + if (span == null) { + delegate.clear(); + return; + } + try { + delegate.clear(); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean invalidate() { + final ISpan span = startSpan(null, "invalidate"); + if (span == null) { + return delegate.invalidate(); + } + try { + final boolean result = delegate.invalidate(); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + private @Nullable ISpan startSpan( + final @Nullable Object key, final @NotNull String operationName) { + if (!scopes.getOptions().isEnableCacheTracing()) { + return null; + } + + final ISpan activeSpan = scopes.getSpan(); + if (activeSpan == null || activeSpan.isNoOp()) { + return null; + } + + final SpanOptions spanOptions = new SpanOptions(); + spanOptions.setOrigin(TRACE_ORIGIN); + final String keyString = key != null ? String.valueOf(key) : null; + final ISpan span = activeSpan.startChild("cache." + operationName, keyString, spanOptions); + if (span.isNoOp()) { + return null; + } + if (keyString != null) { + span.setData(SpanDataConvention.CACHE_KEY, Collections.singletonList(keyString)); + } + span.setData(SpanDataConvention.CACHE_OPERATION, operationName); + return span; + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessorTest.kt new file mode 100644 index 00000000000..301678d35d9 --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheBeanPostProcessorTest.kt @@ -0,0 +1,44 @@ +package io.sentry.spring.jakarta.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.cache.CacheManager + +class SentryCacheBeanPostProcessorTest { + + private val scopes: IScopes = mock() + + @Test + fun `wraps CacheManager beans in SentryCacheManagerWrapper`() { + val cacheManager = mock() + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(cacheManager, "cacheManager") + + assertTrue(result is SentryCacheManagerWrapper) + } + + @Test + fun `does not double-wrap SentryCacheManagerWrapper`() { + val delegate = mock() + val alreadyWrapped = SentryCacheManagerWrapper(delegate, scopes) + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(alreadyWrapped, "cacheManager") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `does not wrap non-CacheManager beans`() { + val someBean = "not a cache manager" + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapperTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapperTest.kt new file mode 100644 index 00000000000..05daa207d37 --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheManagerWrapperTest.kt @@ -0,0 +1,61 @@ +package io.sentry.spring.jakarta.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache +import org.springframework.cache.CacheManager + +class SentryCacheManagerWrapperTest { + + private val scopes: IScopes = mock() + private val delegate: CacheManager = mock() + + @Test + fun `getCache wraps returned cache in SentryCacheWrapper`() { + val cache = mock() + whenever(delegate.getCache("test")).thenReturn(cache) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertTrue(result is SentryCacheWrapper) + } + + @Test + fun `getCache returns null when delegate returns null`() { + whenever(delegate.getCache("missing")).thenReturn(null) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("missing") + + assertNull(result) + } + + @Test + fun `getCache does not double-wrap SentryCacheWrapper`() { + val innerCache = mock() + val alreadyWrapped = SentryCacheWrapper(innerCache, scopes) + whenever(delegate.getCache("test")).thenReturn(alreadyWrapped) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `getCacheNames delegates to underlying cache manager`() { + whenever(delegate.cacheNames).thenReturn(listOf("cache1", "cache2")) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.cacheNames + + assertEquals(listOf("cache1", "cache2"), result) + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheWrapperTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheWrapperTest.kt new file mode 100644 index 00000000000..a04f548d447 --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/cache/SentryCacheWrapperTest.kt @@ -0,0 +1,530 @@ +package io.sentry.spring.jakarta.cache + +import io.sentry.IScopes +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import java.util.concurrent.Callable +import java.util.concurrent.CompletableFuture +import java.util.function.Supplier +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.any +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache + +class SentryCacheWrapperTest { + + private lateinit var scopes: IScopes + private lateinit var delegate: Cache + private lateinit var options: SentryOptions + + @BeforeTest + fun setup() { + scopes = mock() + delegate = mock() + options = SentryOptions().apply { isEnableCacheTracing = true } + whenever(scopes.options).thenReturn(options) + whenever(delegate.name).thenReturn("testCache") + } + + private fun createTransaction(): SentryTracer { + val tx = SentryTracer(TransactionContext("tx", "op"), scopes) + whenever(scopes.span).thenReturn(tx) + return tx + } + + // -- get(Object key) -- + + @Test + fun `get with ValueWrapper creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val valueWrapper = mock() + whenever(delegate.get("myKey")).thenReturn(valueWrapper) + + val result = wrapper.get("myKey") + + assertEquals(valueWrapper, result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.get", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("auto.cache.spring", span.spanContext.origin) + assertEquals("get", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `get with ValueWrapper creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + val result = wrapper.get("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- get(Object key, Class) -- + + @Test + fun `get with type creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn("value") + + val result = wrapper.get("myKey", String::class.java) + + assertEquals("value", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn(null) + + val result = wrapper.get("myKey", String::class.java) + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey", String::class.java)).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey", String::class.java) } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- get(Object key, Callable) -- + + @Test + fun `get with callable creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache hit: delegate returns value without invoking the loader + whenever(delegate.get(eq("myKey"), any>())).thenReturn("cached") + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("cached", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with callable creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache miss: delegate invokes the loader callable + whenever(delegate.get(eq("myKey"), any>())).thenAnswer { invocation -> + val loader = invocation.getArgument>(1) + loader.call() + } + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("loaded", result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- retrieve(Object key) -- + + @Test + fun `retrieve creates span with cache hit true when future resolves with value`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture("value")) + + val result = wrapper.retrieve("myKey") + + assertEquals("value", result!!.get()) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.retrieve", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("retrieve", span.getData(SpanDataConvention.CACHE_OPERATION)) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve creates span with cache hit false when future resolves with null`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture(null)) + + val result = wrapper.retrieve("myKey") + + assertNull(result!!.get()) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve creates span with cache hit false when delegate returns null`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(null) + + val result = wrapper.retrieve("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(false, span.getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals(SpanStatus.OK, span.status) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve sets error status when future completes exceptionally`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("async cache error") + whenever(delegate.retrieve("myKey")) + .thenReturn(CompletableFuture().also { it.completeExceptionally(exception) }) + + val result = wrapper.retrieve("myKey") + + assertFailsWith { result!!.get() } + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve sets error status when delegate throws synchronously`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("sync error") + whenever(delegate.retrieve("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.retrieve("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve does not create span when tracing is disabled`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve("myKey")).thenReturn(CompletableFuture.completedFuture("value")) + + wrapper.retrieve("myKey") + + verify(delegate).retrieve("myKey") + assertEquals(0, tx.spans.size) + } + + // -- retrieve(Object key, Supplier>) -- + + @Test + fun `retrieve with loader creates span with cache hit true when loader not invoked`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache hit: delegate returns value without invoking the loader + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture.completedFuture("cached")) + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertEquals("cached", result.get()) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve with loader creates span with cache hit false when loader invoked`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache miss: delegate invokes the loader supplier + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenAnswer { invocation -> + val loader = invocation.getArgument>>(1) + loader.get() + } + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertEquals("loaded", result.get()) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + assertTrue(tx.spans.first().isFinished) + } + + @Test + fun `retrieve with loader sets error status when future completes exceptionally`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("async loader error") + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture().also { it.completeExceptionally(exception) }) + + val result = wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + assertFailsWith { result.get() } + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + assertTrue(span.isFinished) + } + + @Test + fun `retrieve with loader does not create span when tracing is disabled`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.retrieve(eq("myKey"), any>>())) + .thenReturn(CompletableFuture.completedFuture("cached")) + + wrapper.retrieve("myKey") { CompletableFuture.completedFuture("loaded") } + + verify(delegate).retrieve(eq("myKey"), any>>()) + assertEquals(0, tx.spans.size) + } + + // -- put -- + + @Test + fun `put creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.put("myKey", "myValue") + + verify(delegate).put("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.put", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("put", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- putIfAbsent -- + + @Test + fun `putIfAbsent creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.putIfAbsent("myKey", "myValue")).thenReturn(null) + + val result = wrapper.putIfAbsent("myKey", "myValue") + + assertNull(result) + verify(delegate).putIfAbsent("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.putIfAbsent", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("putIfAbsent", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- evict -- + + @Test + fun `evict creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.evict("myKey") + + verify(delegate).evict("myKey") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.evict", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evict", span.getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + } + + // -- evictIfPresent -- + + @Test + fun `evictIfPresent creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.evictIfPresent("myKey")).thenReturn(true) + + val result = wrapper.evictIfPresent("myKey") + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.evictIfPresent", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evictIfPresent", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- clear -- + + @Test + fun `clear creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.clear() + + verify(delegate).clear() + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.clear", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertNull(span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("clear", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- invalidate -- + + @Test + fun `invalidate creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(true) + + val result = wrapper.invalidate() + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `invalidate sets cache write false when cache had no mappings`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(false) + + val result = wrapper.invalidate() + + assertFalse(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- no span when no active transaction -- + + @Test + fun `does not create span when there is no active transaction`() { + whenever(scopes.span).thenReturn(null) + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + } + + // -- no span when option is disabled -- + + @Test + fun `does not create span when enableCacheTracing is false`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + assertEquals(0, tx.spans.size) + } + + // -- error handling -- + + @Test + fun `sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- delegation -- + + @Test + fun `getName delegates to underlying cache`() { + val wrapper = SentryCacheWrapper(delegate, scopes) + assertEquals("testCache", wrapper.name) + } + + @Test + fun `getNativeCache delegates to underlying cache`() { + val nativeCache = Object() + whenever(delegate.nativeCache).thenReturn(nativeCache) + val wrapper = SentryCacheWrapper(delegate, scopes) + + assertEquals(nativeCache, wrapper.nativeCache) + } +} diff --git a/sentry-spring/api/sentry-spring.api b/sentry-spring/api/sentry-spring.api index fb07af382ba..7148277e2ef 100644 --- a/sentry-spring/api/sentry-spring.api +++ b/sentry-spring/api/sentry-spring.api @@ -104,6 +104,33 @@ public final class io/sentry/spring/SpringSecuritySentryUserProvider : io/sentry public fun provideUser ()Lio/sentry/protocol/User; } +public final class io/sentry/spring/cache/SentryCacheBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/cache/SentryCacheManagerWrapper : org/springframework/cache/CacheManager { + public fun (Lorg/springframework/cache/CacheManager;Lio/sentry/IScopes;)V + public fun getCache (Ljava/lang/String;)Lorg/springframework/cache/Cache; + public fun getCacheNames ()Ljava/util/Collection; +} + +public final class io/sentry/spring/cache/SentryCacheWrapper : org/springframework/cache/Cache { + public fun (Lorg/springframework/cache/Cache;Lio/sentry/IScopes;)V + public fun clear ()V + public fun evict (Ljava/lang/Object;)V + public fun evictIfPresent (Ljava/lang/Object;)Z + public fun get (Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; + public fun get (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; + public fun get (Ljava/lang/Object;Ljava/util/concurrent/Callable;)Ljava/lang/Object; + public fun getName ()Ljava/lang/String; + public fun getNativeCache ()Ljava/lang/Object; + public fun invalidate ()Z + public fun put (Ljava/lang/Object;Ljava/lang/Object;)V + public fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Lorg/springframework/cache/Cache$ValueWrapper; +} + public abstract interface annotation class io/sentry/spring/checkin/SentryCheckIn : java/lang/annotation/Annotation { public abstract fun heartbeat ()Z public abstract fun monitorSlug ()Ljava/lang/String; diff --git a/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheBeanPostProcessor.java b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheBeanPostProcessor.java new file mode 100644 index 00000000000..7382f7500f2 --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheBeanPostProcessor.java @@ -0,0 +1,29 @@ +package io.sentry.spring.cache; + +import io.sentry.ScopesAdapter; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.cache.CacheManager; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; + +/** Wraps {@link CacheManager} beans in {@link SentryCacheManagerWrapper} for instrumentation. */ +@ApiStatus.Internal +public final class SentryCacheBeanPostProcessor implements BeanPostProcessor, PriorityOrdered { + + @Override + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof CacheManager && !(bean instanceof SentryCacheManagerWrapper)) { + return new SentryCacheManagerWrapper((CacheManager) bean, ScopesAdapter.getInstance()); + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheManagerWrapper.java b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheManagerWrapper.java new file mode 100644 index 00000000000..a66517fd7fb --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheManagerWrapper.java @@ -0,0 +1,37 @@ +package io.sentry.spring.cache; + +import io.sentry.IScopes; +import java.util.Collection; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; + +/** Wraps a Spring {@link CacheManager} to return Sentry-instrumented caches. */ +@ApiStatus.Internal +public final class SentryCacheManagerWrapper implements CacheManager { + + private final @NotNull CacheManager delegate; + private final @NotNull IScopes scopes; + + public SentryCacheManagerWrapper( + final @NotNull CacheManager delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @Nullable Cache getCache(final @NotNull String name) { + final Cache cache = delegate.getCache(name); + if (cache == null || cache instanceof SentryCacheWrapper) { + return cache; + } + return new SentryCacheWrapper(cache, scopes); + } + + @Override + public @NotNull Collection getCacheNames() { + return delegate.getCacheNames(); + } +} diff --git a/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheWrapper.java b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheWrapper.java new file mode 100644 index 00000000000..0e0ccb7d228 --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/cache/SentryCacheWrapper.java @@ -0,0 +1,253 @@ +package io.sentry.spring.cache; + +import io.sentry.IScopes; +import io.sentry.ISpan; +import io.sentry.SpanDataConvention; +import io.sentry.SpanOptions; +import io.sentry.SpanStatus; +import java.util.Collections; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicBoolean; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.cache.Cache; + +/** Wraps a Spring {@link Cache} to create Sentry spans for cache operations. */ +@ApiStatus.Internal +public final class SentryCacheWrapper implements Cache { + + private static final String TRACE_ORIGIN = "auto.cache.spring"; + + private final @NotNull Cache delegate; + private final @NotNull IScopes scopes; + + public SentryCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes scopes) { + this.delegate = delegate; + this.scopes = scopes; + } + + @Override + public @NotNull String getName() { + return delegate.getName(); + } + + @Override + public @NotNull Object getNativeCache() { + return delegate.getNativeCache(); + } + + @Override + public @Nullable ValueWrapper get(final @NotNull Object key) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key); + } + try { + final ValueWrapper result = delegate.get(key); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @Nullable Class type) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, type); + } + try { + final T result = delegate.get(key, type); + span.setData(SpanDataConvention.CACHE_HIT, result != null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable T get(final @NotNull Object key, final @NotNull Callable valueLoader) { + final ISpan span = startSpan(key, "get"); + if (span == null) { + return delegate.get(key, valueLoader); + } + try { + final AtomicBoolean loaderInvoked = new AtomicBoolean(false); + final T result = + delegate.get( + key, + () -> { + loaderInvoked.set(true); + return valueLoader.call(); + }); + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void put(final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "put"); + if (span == null) { + delegate.put(key, value); + return; + } + try { + delegate.put(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public @Nullable ValueWrapper putIfAbsent( + final @NotNull Object key, final @Nullable Object value) { + final ISpan span = startSpan(key, "putIfAbsent"); + if (span == null) { + return delegate.putIfAbsent(key, value); + } + try { + final ValueWrapper result = delegate.putIfAbsent(key, value); + span.setData(SpanDataConvention.CACHE_WRITE, result == null); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void evict(final @NotNull Object key) { + final ISpan span = startSpan(key, "evict"); + if (span == null) { + delegate.evict(key); + return; + } + try { + delegate.evict(key); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean evictIfPresent(final @NotNull Object key) { + final ISpan span = startSpan(key, "evictIfPresent"); + if (span == null) { + return delegate.evictIfPresent(key); + } + try { + final boolean result = delegate.evictIfPresent(key); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public void clear() { + final ISpan span = startSpan(null, "clear"); + if (span == null) { + delegate.clear(); + return; + } + try { + delegate.clear(); + span.setData(SpanDataConvention.CACHE_WRITE, true); + span.setStatus(SpanStatus.OK); + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + @Override + public boolean invalidate() { + final ISpan span = startSpan(null, "invalidate"); + if (span == null) { + return delegate.invalidate(); + } + try { + final boolean result = delegate.invalidate(); + span.setData(SpanDataConvention.CACHE_WRITE, result); + span.setStatus(SpanStatus.OK); + return result; + } catch (Throwable e) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(e); + throw e; + } finally { + span.finish(); + } + } + + private @Nullable ISpan startSpan( + final @Nullable Object key, final @NotNull String operationName) { + if (!scopes.getOptions().isEnableCacheTracing()) { + return null; + } + + final ISpan activeSpan = scopes.getSpan(); + if (activeSpan == null || activeSpan.isNoOp()) { + return null; + } + + final SpanOptions spanOptions = new SpanOptions(); + spanOptions.setOrigin(TRACE_ORIGIN); + final String keyString = key != null ? String.valueOf(key) : null; + final ISpan span = activeSpan.startChild("cache." + operationName, keyString, spanOptions); + if (span.isNoOp()) { + return null; + } + if (keyString != null) { + span.setData(SpanDataConvention.CACHE_KEY, Collections.singletonList(keyString)); + } + span.setData(SpanDataConvention.CACHE_OPERATION, operationName); + return span; + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheBeanPostProcessorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheBeanPostProcessorTest.kt new file mode 100644 index 00000000000..4392d6820e5 --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheBeanPostProcessorTest.kt @@ -0,0 +1,44 @@ +package io.sentry.spring.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.cache.CacheManager + +class SentryCacheBeanPostProcessorTest { + + private val scopes: IScopes = mock() + + @Test + fun `wraps CacheManager beans in SentryCacheManagerWrapper`() { + val cacheManager = mock() + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(cacheManager, "cacheManager") + + assertTrue(result is SentryCacheManagerWrapper) + } + + @Test + fun `does not double-wrap SentryCacheManagerWrapper`() { + val delegate = mock() + val alreadyWrapped = SentryCacheManagerWrapper(delegate, scopes) + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(alreadyWrapped, "cacheManager") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `does not wrap non-CacheManager beans`() { + val someBean = "not a cache manager" + val processor = SentryCacheBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheManagerWrapperTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheManagerWrapperTest.kt new file mode 100644 index 00000000000..e3d45038732 --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheManagerWrapperTest.kt @@ -0,0 +1,61 @@ +package io.sentry.spring.cache + +import io.sentry.IScopes +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache +import org.springframework.cache.CacheManager + +class SentryCacheManagerWrapperTest { + + private val scopes: IScopes = mock() + private val delegate: CacheManager = mock() + + @Test + fun `getCache wraps returned cache in SentryCacheWrapper`() { + val cache = mock() + whenever(delegate.getCache("test")).thenReturn(cache) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertTrue(result is SentryCacheWrapper) + } + + @Test + fun `getCache returns null when delegate returns null`() { + whenever(delegate.getCache("missing")).thenReturn(null) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("missing") + + assertNull(result) + } + + @Test + fun `getCache does not double-wrap SentryCacheWrapper`() { + val innerCache = mock() + val alreadyWrapped = SentryCacheWrapper(innerCache, scopes) + whenever(delegate.getCache("test")).thenReturn(alreadyWrapped) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.getCache("test") + + assertSame(alreadyWrapped, result) + } + + @Test + fun `getCacheNames delegates to underlying cache manager`() { + whenever(delegate.cacheNames).thenReturn(listOf("cache1", "cache2")) + + val wrapper = SentryCacheManagerWrapper(delegate, scopes) + val result = wrapper.cacheNames + + assertEquals(listOf("cache1", "cache2"), result) + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheWrapperTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheWrapperTest.kt new file mode 100644 index 00000000000..ab21ef77b4f --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/cache/SentryCacheWrapperTest.kt @@ -0,0 +1,354 @@ +package io.sentry.spring.cache + +import io.sentry.IScopes +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import java.util.concurrent.Callable +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.any +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.cache.Cache + +class SentryCacheWrapperTest { + + private lateinit var scopes: IScopes + private lateinit var delegate: Cache + private lateinit var options: SentryOptions + + @BeforeTest + fun setup() { + scopes = mock() + delegate = mock() + options = SentryOptions().apply { isEnableCacheTracing = true } + whenever(scopes.options).thenReturn(options) + whenever(delegate.name).thenReturn("testCache") + } + + private fun createTransaction(): SentryTracer { + val tx = SentryTracer(TransactionContext("tx", "op"), scopes) + whenever(scopes.span).thenReturn(tx) + return tx + } + + // -- get(Object key) -- + + @Test + fun `get with ValueWrapper creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val valueWrapper = mock() + whenever(delegate.get("myKey")).thenReturn(valueWrapper) + + val result = wrapper.get("myKey") + + assertEquals(valueWrapper, result) + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.get", span.operation) + assertEquals("myKey", span.description) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT)) + assertNull(span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("auto.cache.spring", span.spanContext.origin) + assertEquals("get", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `get with ValueWrapper creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + val result = wrapper.get("myKey") + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- get(Object key, Class) -- + + @Test + fun `get with type creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn("value") + + val result = wrapper.get("myKey", String::class.java) + + assertEquals("value", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey", String::class.java)).thenReturn(null) + + val result = wrapper.get("myKey", String::class.java) + + assertNull(result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with type sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey", String::class.java)).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey", String::class.java) } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- get(Object key, Callable) -- + + @Test + fun `get with callable creates span with cache hit true on hit`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache hit: delegate returns value without invoking the loader + whenever(delegate.get(eq("myKey"), any>())).thenReturn("cached") + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("cached", result) + assertEquals(1, tx.spans.size) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + @Test + fun `get with callable creates span with cache hit false on miss`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + // Simulate cache miss: delegate invokes the loader callable + whenever(delegate.get(eq("myKey"), any>())).thenAnswer { invocation -> + val loader = invocation.getArgument>(1) + loader.call() + } + + val result = wrapper.get("myKey", Callable { "loaded" }) + + assertEquals("loaded", result) + assertEquals(1, tx.spans.size) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_HIT)) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- put -- + + @Test + fun `put creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.put("myKey", "myValue") + + verify(delegate).put("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.put", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("put", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- putIfAbsent -- + + @Test + fun `putIfAbsent creates cache put span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.putIfAbsent("myKey", "myValue")).thenReturn(null) + + val result = wrapper.putIfAbsent("myKey", "myValue") + + assertNull(result) + verify(delegate).putIfAbsent("myKey", "myValue") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.putIfAbsent", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("putIfAbsent", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- evict -- + + @Test + fun `evict creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.evict("myKey") + + verify(delegate).evict("myKey") + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.evict", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evict", span.getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), span.getData(SpanDataConvention.CACHE_KEY)) + } + + // -- evictIfPresent -- + + @Test + fun `evictIfPresent creates cache remove span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.evictIfPresent("myKey")).thenReturn(true) + + val result = wrapper.evictIfPresent("myKey") + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.evictIfPresent", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("evictIfPresent", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + assertEquals(listOf("myKey"), tx.spans.first().getData(SpanDataConvention.CACHE_KEY)) + } + + // -- clear -- + + @Test + fun `clear creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + + wrapper.clear() + + verify(delegate).clear() + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("cache.clear", span.operation) + assertEquals(SpanStatus.OK, span.status) + assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE)) + assertNull(span.getData(SpanDataConvention.CACHE_KEY)) + assertEquals("clear", span.getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- invalidate -- + + @Test + fun `invalidate creates cache flush span`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(true) + + val result = wrapper.invalidate() + + assertTrue(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(true, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + @Test + fun `invalidate sets cache write false when cache had no mappings`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.invalidate()).thenReturn(false) + + val result = wrapper.invalidate() + + assertFalse(result) + assertEquals(1, tx.spans.size) + assertEquals("cache.invalidate", tx.spans.first().operation) + assertEquals(false, tx.spans.first().getData(SpanDataConvention.CACHE_WRITE)) + assertEquals("invalidate", tx.spans.first().getData(SpanDataConvention.CACHE_OPERATION)) + } + + // -- no span when no active transaction -- + + @Test + fun `does not create span when there is no active transaction`() { + whenever(scopes.span).thenReturn(null) + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + } + + // -- no span when option is disabled -- + + @Test + fun `does not create span when enableCacheTracing is false`() { + options.isEnableCacheTracing = false + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + whenever(delegate.get("myKey")).thenReturn(null) + + wrapper.get("myKey") + + verify(delegate).get("myKey") + assertEquals(0, tx.spans.size) + } + + // -- error handling -- + + @Test + fun `sets error status and throwable on exception`() { + val tx = createTransaction() + val wrapper = SentryCacheWrapper(delegate, scopes) + val exception = RuntimeException("cache error") + whenever(delegate.get("myKey")).thenThrow(exception) + + assertFailsWith { wrapper.get("myKey") } + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + // -- delegation -- + + @Test + fun `getName delegates to underlying cache`() { + val wrapper = SentryCacheWrapper(delegate, scopes) + assertEquals("testCache", wrapper.name) + } + + @Test + fun `getNativeCache delegates to underlying cache`() { + val nativeCache = Object() + whenever(delegate.nativeCache).thenReturn(nativeCache) + val wrapper = SentryCacheWrapper(delegate, scopes) + + assertEquals(nativeCache, wrapper.nativeCache) + } +} diff --git a/sentry-system-test-support/api/sentry-system-test-support.api b/sentry-system-test-support/api/sentry-system-test-support.api index 51ef7da55d9..83a9f288d0c 100644 --- a/sentry-system-test-support/api/sentry-system-test-support.api +++ b/sentry-system-test-support/api/sentry-system-test-support.api @@ -548,7 +548,9 @@ public final class io/sentry/systemtest/util/RestTestClient : io/sentry/systemte public static synthetic fun createPerson$default (Lio/sentry/systemtest/util/RestTestClient;Lio/sentry/systemtest/Person;Ljava/util/Map;ILjava/lang/Object;)Lio/sentry/systemtest/Person; public final fun createPersonDistributedTracing (Lio/sentry/systemtest/Person;Ljava/util/Map;)Lio/sentry/systemtest/Person; public static synthetic fun createPersonDistributedTracing$default (Lio/sentry/systemtest/util/RestTestClient;Lio/sentry/systemtest/Person;Ljava/util/Map;ILjava/lang/Object;)Lio/sentry/systemtest/Person; + public final fun deleteCachedTodo (J)V public final fun errorWithFeatureFlag (Ljava/lang/String;)Ljava/lang/String; + public final fun getCachedTodo (J)Lio/sentry/systemtest/Todo; public final fun getCountMetric ()Ljava/lang/String; public final fun getDistributionMetric (J)Ljava/lang/String; public final fun getGaugeMetric (J)Ljava/lang/String; @@ -558,6 +560,7 @@ public final class io/sentry/systemtest/util/RestTestClient : io/sentry/systemte public final fun getTodo (J)Lio/sentry/systemtest/Todo; public final fun getTodoRestClient (J)Lio/sentry/systemtest/Todo; public final fun getTodoWebclient (J)Lio/sentry/systemtest/Todo; + public final fun saveCachedTodo (Lio/sentry/systemtest/Todo;)Lio/sentry/systemtest/Todo; } public final class io/sentry/systemtest/util/SentryMockServerClient : io/sentry/systemtest/util/LoggingInsecureRestClient { diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt index bdaa2333f21..da552ff93bc 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt @@ -50,6 +50,24 @@ class RestTestClient(private val backendBaseUrl: String) : LoggingInsecureRestCl return callTyped(request, true) } + fun getCachedTodo(id: Long): Todo? { + val request = Request.Builder().url("$backendBaseUrl/cache/$id") + + return callTyped(request, true) + } + + fun saveCachedTodo(todo: Todo): Todo? { + val request = Request.Builder().url("$backendBaseUrl/cache/").post(toRequestBody(todo)) + + return callTyped(request, true) + } + + fun deleteCachedTodo(id: Long) { + val request = Request.Builder().url("$backendBaseUrl/cache/$id").delete() + + call(request, true) + } + fun checkFeatureFlag(flagKey: String): FeatureFlagResponse? { val request = Request.Builder().url("$backendBaseUrl/feature-flag/check/$flagKey") diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 1d8ff4d3e0d..c748df38369 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -520,6 +520,7 @@ public final class io/sentry/ExternalOptions { public fun getTracesSampleRate ()Ljava/lang/Double; public fun isCaptureOpenTelemetryEvents ()Ljava/lang/Boolean; public fun isEnableBackpressureHandling ()Ljava/lang/Boolean; + public fun isEnableCacheTracing ()Ljava/lang/Boolean; public fun isEnableDatabaseTransactionTracing ()Ljava/lang/Boolean; public fun isEnableLogs ()Ljava/lang/Boolean; public fun isEnableMetrics ()Ljava/lang/Boolean; @@ -536,6 +537,7 @@ public final class io/sentry/ExternalOptions { public fun setDist (Ljava/lang/String;)V public fun setDsn (Ljava/lang/String;)V public fun setEnableBackpressureHandling (Ljava/lang/Boolean;)V + public fun setEnableCacheTracing (Ljava/lang/Boolean;)V public fun setEnableDatabaseTransactionTracing (Ljava/lang/Boolean;)V public fun setEnableDeduplication (Ljava/lang/Boolean;)V public fun setEnableLogs (Ljava/lang/Boolean;)V @@ -3667,6 +3669,7 @@ public class io/sentry/SentryOptions { public fun isEnableAppStartProfiling ()Z public fun isEnableAutoSessionTracking ()Z public fun isEnableBackpressureHandling ()Z + public fun isEnableCacheTracing ()Z public fun isEnableDatabaseTransactionTracing ()Z public fun isEnableDeduplication ()Z public fun isEnableEventSizeLimiting ()Z @@ -3725,6 +3728,7 @@ public class io/sentry/SentryOptions { public fun setEnableAppStartProfiling (Z)V public fun setEnableAutoSessionTracking (Z)V public fun setEnableBackpressureHandling (Z)V + public fun setEnableCacheTracing (Z)V public fun setEnableDatabaseTransactionTracing (Z)V public fun setEnableDeduplication (Z)V public fun setEnableEventSizeLimiting (Z)V @@ -4352,6 +4356,10 @@ public final class io/sentry/SpanContext$JsonKeys { public abstract interface class io/sentry/SpanDataConvention { public static final field BLOCKED_MAIN_THREAD_KEY Ljava/lang/String; + public static final field CACHE_HIT Ljava/lang/String; + public static final field CACHE_KEY Ljava/lang/String; + public static final field CACHE_OPERATION Ljava/lang/String; + public static final field CACHE_WRITE Ljava/lang/String; public static final field CALL_STACK_KEY Ljava/lang/String; public static final field CONTRIBUTES_TTFD Ljava/lang/String; public static final field CONTRIBUTES_TTID Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index 8f16bcede01..dade1f140c8 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -57,6 +57,7 @@ public final class ExternalOptions { private @Nullable Boolean sendDefaultPii; private @Nullable Boolean enableBackpressureHandling; private @Nullable Boolean enableDatabaseTransactionTracing; + private @Nullable Boolean enableCacheTracing; private @Nullable Boolean globalHubMode; private @Nullable Boolean forceInit; private @Nullable Boolean captureOpenTelemetryEvents; @@ -162,6 +163,8 @@ public final class ExternalOptions { options.setEnableDatabaseTransactionTracing( propertiesProvider.getBooleanProperty("enable-database-transaction-tracing")); + options.setEnableCacheTracing(propertiesProvider.getBooleanProperty("enable-cache-tracing")); + options.setGlobalHubMode(propertiesProvider.getBooleanProperty("global-hub-mode")); options.setCaptureOpenTelemetryEvents( @@ -523,6 +526,14 @@ public void setEnableDatabaseTransactionTracing( return enableDatabaseTransactionTracing; } + public void setEnableCacheTracing(final @Nullable Boolean enableCacheTracing) { + this.enableCacheTracing = enableCacheTracing; + } + + public @Nullable Boolean isEnableCacheTracing() { + return enableCacheTracing; + } + public void setGlobalHubMode(final @Nullable Boolean globalHubMode) { this.globalHubMode = globalHubMode; } diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 862bd708aa4..9df125b4d11 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -490,6 +490,9 @@ public class SentryOptions { /** Whether database transaction spans (BEGIN, COMMIT, ROLLBACK) should be traced. */ private boolean enableDatabaseTransactionTracing = false; + /** Whether cache operations (get, put, remove, flush) should be traced. */ + private boolean enableCacheTracing = false; + /** Date provider to retrieve the current date from. */ @ApiStatus.Internal private final @NotNull LazyEvaluator dateProvider = @@ -2632,6 +2635,24 @@ public void setEnableDatabaseTransactionTracing(boolean enableDatabaseTransactio this.enableDatabaseTransactionTracing = enableDatabaseTransactionTracing; } + /** + * Whether cache operations (get, put, remove, flush) should be traced. + * + * @return true if cache operations should be traced + */ + public boolean isEnableCacheTracing() { + return enableCacheTracing; + } + + /** + * Whether cache operations (get, put, remove, flush) should be traced. + * + * @param enableCacheTracing true if cache operations should be traced + */ + public void setEnableCacheTracing(boolean enableCacheTracing) { + this.enableCacheTracing = enableCacheTracing; + } + /** * Whether Sentry is enabled. * @@ -3470,6 +3491,9 @@ public void merge(final @NotNull ExternalOptions options) { if (options.isEnableDatabaseTransactionTracing() != null) { setEnableDatabaseTransactionTracing(options.isEnableDatabaseTransactionTracing()); } + if (options.isEnableCacheTracing() != null) { + setEnableCacheTracing(options.isEnableCacheTracing()); + } if (options.getMaxRequestBodySize() != null) { setMaxRequestBodySize(options.getMaxRequestBodySize()); } diff --git a/sentry/src/main/java/io/sentry/SpanDataConvention.java b/sentry/src/main/java/io/sentry/SpanDataConvention.java index c4329f6dcad..647c0dacddf 100644 --- a/sentry/src/main/java/io/sentry/SpanDataConvention.java +++ b/sentry/src/main/java/io/sentry/SpanDataConvention.java @@ -26,4 +26,8 @@ public interface SpanDataConvention { String HTTP_START_TIMESTAMP = "http.start_timestamp"; String HTTP_END_TIMESTAMP = "http.end_timestamp"; String PROFILER_ID = "profiler_id"; + String CACHE_HIT = "cache.hit"; + String CACHE_KEY = "cache.key"; + String CACHE_OPERATION = "cache.operation"; + String CACHE_WRITE = "cache.write"; } diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index 9612a052624..298eff34ba0 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -331,6 +331,20 @@ class ExternalOptionsTest { } } + @Test + fun `creates options with enableCacheTracing set to true`() { + withPropertiesFile("enable-cache-tracing=true") { options -> + assertTrue(options.isEnableCacheTracing == true) + } + } + + @Test + fun `creates options with enableCacheTracing set to false`() { + withPropertiesFile("enable-cache-tracing=false") { options -> + assertTrue(options.isEnableCacheTracing == false) + } + } + @Test fun `creates options with cron defaults`() { withPropertiesFile( diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 1fd8d9cc81f..1b9ce5eace3 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -400,6 +400,7 @@ class SentryOptionsTest { externalOptions.ignoredErrors = listOf("Some error", "Another .*") externalOptions.isEnableBackpressureHandling = false externalOptions.isEnableDatabaseTransactionTracing = true + externalOptions.isEnableCacheTracing = true externalOptions.maxRequestBodySize = SentryOptions.RequestSize.MEDIUM externalOptions.isSendDefaultPii = true externalOptions.isForceInit = true @@ -465,6 +466,7 @@ class SentryOptionsTest { ) assertFalse(options.isEnableBackpressureHandling) assertTrue(options.isEnableDatabaseTransactionTracing) + assertTrue(options.isEnableCacheTracing) assertTrue(options.isForceInit) assertNotNull(options.cron) assertEquals(10L, options.cron?.defaultCheckinMargin) @@ -701,6 +703,11 @@ class SentryOptionsTest { assertFalse(SentryOptions().isEnableDatabaseTransactionTracing) } + @Test + fun `when options are initialized, enableCacheTracing is set to false by default`() { + assertFalse(SentryOptions().isEnableCacheTracing) + } + @Test fun `when options are initialized, metrics is enabled by default`() { assertTrue(SentryOptions().metrics.isEnabled) diff --git a/settings.gradle.kts b/settings.gradle.kts index 0e9987b4ae4..8d431d5fbdf 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -66,6 +66,7 @@ include( "sentry-opentelemetry:sentry-opentelemetry-agentless-spring", "sentry-opentelemetry:sentry-opentelemetry-otlp", "sentry-opentelemetry:sentry-opentelemetry-otlp-spring", + "sentry-jcache", "sentry-quartz", "sentry-okhttp", "sentry-openfeature", diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 55a1136fbe0..70489c580a5 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -61,7 +61,8 @@ "OTEL_TRACES_EXPORTER": "none", "OTEL_METRICS_EXPORTER": "none", "OTEL_LOGS_EXPORTER": "none", - "SENTRY_LOGS_ENABLED": "true" + "SENTRY_LOGS_ENABLED": "true", + "SENTRY_ENABLE_CACHE_TRACING": "true" } class ServerType(Enum): From 72ab40d6fcb24c6a19311bf4028ba1ad28ec345e Mon Sep 17 00:00:00 2001 From: adinauer <2542832+adinauer@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:41:08 +0000 Subject: [PATCH 072/391] release: 8.37.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fabd81c5746..fde4587e625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.37.0 ### Fixes diff --git a/gradle.properties b/gradle.properties index c9900e412b3..cdae82047e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.36.0 +versionName=8.37.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 8c1fb225bde207e1c97fec88db1d3deb93fc45ea Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 25 Mar 2026 13:07:07 +0100 Subject: [PATCH 073/391] chore(changelog): Update dependencies section with Native SDK version bump (#5217) * chore(changelog): Update dependencies section with Native SDK version bump * Refine SentryAndroid replay capture logic Updated SentryAndroid initialization code to capture replay only for crashes. * Change example usage from Java to Kotlin Updated example usage in CHANGELOG to use Kotlin. --- CHANGELOG.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fde4587e625..ff1597652b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,19 +19,21 @@ - Allows filtering which errors trigger replay capture before the `onErrorSampleRate` is checked - Returning `false` skips replay capture entirely for that error; returning `true` proceeds with the normal sample rate check - Example usage: - ```java + ```kotlin SentryAndroid.init(context) { options -> options.sessionReplay.beforeErrorSampling = SentryReplayOptions.BeforeErrorSamplingCallback { event, hint -> - // Skip replay for handled exceptions - val hasUnhandled = event.exceptions?.any { it.mechanism?.isHandled == false } == true - hasUnhandled + // Only capture replay for crashes (excluding e.g. handled exceptions) + event.isCrashed } } ``` ### Dependencies +- Bump Native SDK from v0.13.2 to v0.13.3 ([#5215](https://github.com/getsentry/sentry-java/pull/5215)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0133) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.2...0.13.3) - Bump OpenTelemetry ([#5225](https://github.com/getsentry/sentry-java/pull/5225)) - `opentelemetry` to `1.60.1` (was `1.57.0`) - `opentelemetry-instrumentation` to `2.26.0` (was `2.23.0`) From a7fc3666eb04bed49f438906ccab126b1e03130e Mon Sep 17 00:00:00 2001 From: joshuarli Date: Thu, 26 Mar 2026 02:16:20 -0700 Subject: [PATCH 074/391] chore(github): pin GitHub Actions to full-length commit SHAs (#5229) --- .github/workflows/agp-matrix.yml | 8 ++++---- .github/workflows/build.yml | 8 ++++---- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/changes-in-high-risk-code.yml | 4 ++-- .github/workflows/check-tombstone-proto-schema.yml | 2 +- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/danger.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 6 +++--- .github/workflows/format-code.yml | 4 ++-- .github/workflows/generate-javadocs.yml | 4 ++-- .github/workflows/integration-tests-benchmarks.yml | 10 +++++----- .github/workflows/integration-tests-size.yml | 6 +++--- .../workflows/integration-tests-ui-critical.yml | 14 +++++++------- .github/workflows/integration-tests-ui.yml | 4 ++-- .github/workflows/release-build.yml | 6 +++--- .github/workflows/release.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 10 +++++----- .github/workflows/spring-boot-3-matrix.yml | 10 +++++----- .github/workflows/spring-boot-4-matrix.yml | 10 +++++----- .github/workflows/system-tests-backend.yml | 8 ++++---- .github/workflows/update-deps.yml | 4 ++-- 21 files changed, 64 insertions(+), 64 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index c6bee353d83..750be7ca2e4 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -28,12 +28,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -50,7 +50,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 id: avd-cache with: path: | @@ -94,7 +94,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-AGP${{ matrix.agp }}-Integrations${{ matrix.integrations }} path: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56e832b8e43..3e5a79f5930 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,19 +19,19 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} @@ -53,7 +53,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-build path: | diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index af9087141e7..2b37e202856 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@f4889d04564e47311038ecb6b910fef6b6cf1363 # v2 secrets: inherit diff --git a/.github/workflows/changes-in-high-risk-code.yml b/.github/workflows/changes-in-high-risk-code.yml index 5da9f52cb50..e22fa135412 100644 --- a/.github/workflows/changes-in-high-risk-code.yml +++ b/.github/workflows/changes-in-high-risk-code.yml @@ -16,7 +16,7 @@ jobs: high_risk_code: ${{ steps.changes.outputs.high_risk_code }} high_risk_code_files: ${{ steps.changes.outputs.high_risk_code_files }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Get changed files id: changes uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Comment on PR to notify of changes in high risk files - uses: actions/github-script@v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 env: high_risk_code: ${{ needs.files-changed.outputs.high_risk_code_files }} with: diff --git a/.github/workflows/check-tombstone-proto-schema.yml b/.github/workflows/check-tombstone-proto-schema.yml index 9234be0c429..f4dd5f2f957 100644 --- a/.github/workflows/check-tombstone-proto-schema.yml +++ b/.github/workflows/check-tombstone-proto-schema.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Check for newer Tombstone proto schema run: ./scripts/check-tombstone-proto-schema.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 703c4abe043..06aa7fdcba4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,12 +20,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 7f2045ea980..77fe824701a 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -8,4 +8,4 @@ jobs: danger: runs-on: ubuntu-latest steps: - - uses: getsentry/github-workflows/danger@v3 + - uses: getsentry/github-workflows/danger@26f565c05d0dd49f703d238706b775883037d76b # v3 diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index ca27a0b201a..1d1493bb7bf 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -14,20 +14,20 @@ jobs: uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c - name: Set up Java - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 # TODO: remove this when upstream is fixed - name: Disable Gradle configuration cache (see https://github.com/fossas/fossa-cli/issues/872) run: sed -i 's/^org.gradle.configuration-cache=.*/org.gradle.configuration-cache=false/' gradle.properties - name: 'Enforce License Compliance' - uses: getsentry/action-enforce-license-compliance@main + uses: getsentry/action-enforce-license-compliance@48236a773346cb6552a7bda1ee370d2797365d87 # main with: skip_checkout: 'true' fossa_test_timeout_seconds: 3600 diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 197b5d95659..c338400f958 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index 7909b659108..b50d42f7d1d 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 24310f9ec81..dec5c8eae51 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -27,12 +27,12 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -77,12 +77,12 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -92,7 +92,7 @@ jobs: with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - - uses: actions/cache@v5 + - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 id: app-plain-cache with: path: sentry-android-integration-tests/test-app-plain/build/outputs/apk/release/test-app-plain-release.apk diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 7df0d8bb65d..615d447cbf2 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -20,17 +20,17 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Setup Java Version - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: "temurin" java-version: "17" # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 04e7f834f1f..446228943b5 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -27,10 +27,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Java 17 - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -44,7 +44,7 @@ jobs: run: make assembleUiTestCriticalRelease - name: Upload APK artifact - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: ${{env.APK_ARTIFACT_NAME}} path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" @@ -81,7 +81,7 @@ jobs: arch: x86_64 steps: - name: Checkout code - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Enable KVM run: | @@ -90,7 +90,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 id: avd-cache with: path: | @@ -114,7 +114,7 @@ jobs: script: echo "Generated AVD snapshot for caching." - name: Download APK artifact - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: name: ${{env.APK_ARTIFACT_NAME}} @@ -141,7 +141,7 @@ jobs: - name: Upload Maestro test results if: ${{ always() }} - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: maestro-logs-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} path: "${{env.BASE_PATH}}/maestro-logs" diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 41f3829993d..bbaaa88f53a 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -22,12 +22,12 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 7e7774365b9..62d2d5caa43 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -15,12 +15,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -32,7 +32,7 @@ jobs: run: make publish - name: Upload artifacts - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: ${{ github.sha }} if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7c530df16a..cdf7c141026 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: with: app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: token: ${{ steps.token.outputs.token }} # Needs to be set, otherwise git describe --tags will fail with: No names found, cannot describe anything diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index a6c2d7b48b7..3e57dfd907e 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -28,12 +28,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.10.5' @@ -43,14 +43,14 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-springboot-2-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 03232723741..ed8669e60f3 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -28,12 +28,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.10.5' @@ -43,14 +43,14 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-springboot-3-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index b436a7f31ed..67c5efe8700 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -28,12 +28,12 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.10.5' @@ -43,14 +43,14 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@v5 + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-springboot-4-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index f57f81aaf84..f225be8faf6 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -94,11 +94,11 @@ jobs: agent: "false" agent-auto-init: "true" steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: 'recursive' - - uses: actions/setup-python@v6 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.10.5' @@ -108,7 +108,7 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@v5 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 with: distribution: 'temurin' java-version: '17' @@ -153,7 +153,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 with: name: test-results-${{ matrix.sample }}-${{ matrix.agent }}-${{ matrix.agent-auto-init }}-system-test path: | diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index e4e2d5433b7..a8bb5f655a1 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -18,7 +18,7 @@ jobs: native: runs-on: ubuntu-latest steps: - - uses: getsentry/github-workflows/updater@v3 + - uses: getsentry/github-workflows/updater@26f565c05d0dd49f703d238706b775883037d76b # v3 with: path: scripts/update-sentry-native-ndk.sh name: Native SDK @@ -27,7 +27,7 @@ jobs: gradle-wrapper: runs-on: ubuntu-latest steps: - - uses: getsentry/github-workflows/updater@v3 + - uses: getsentry/github-workflows/updater@26f565c05d0dd49f703d238706b775883037d76b # v3 with: path: scripts/update-gradle.sh name: Gradle From f2c2e7d827d945de83595d7fc62579e8b0dc085e Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 26 Mar 2026 11:16:02 +0100 Subject: [PATCH 075/391] fix(otel): Avoid deadlock in SentryContextStorage.root() with virtual threads (#5234) * fix(otel): Avoid deadlock in SentryContextStorage.root() with virtual threads SentryContextStorage.root() called SentryContextWrapper.wrap() which triggers scope.clone() and acquires locks. Under virtual threads, ReentrantLock.unlock() can re-enter root() via OpenTelemetry executor instrumentation on ForkJoinPool.execute(), causing a deadlock. Return the default OTel root context without wrapping. Scopes are resolved later via attach() or Sentry.getCurrentScopes(). Fixes GH-5226 Co-Authored-By: Claude * changelog --------- Co-authored-by: Claude --- CHANGELOG.md | 6 ++++++ .../java/io/sentry/opentelemetry/SentryContextStorage.java | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff1597652b1..8ea323e0ad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Fix deadlock in `SentryContextStorage.root()` with virtual threads and OpenTelemetry agent ([#5234](https://github.com/getsentry/sentry-java/pull/5234)) + ## 8.37.0 ### Fixes diff --git a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/SentryContextStorage.java b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/SentryContextStorage.java index 5a916a9ecab..c97e40ea62d 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/SentryContextStorage.java +++ b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/SentryContextStorage.java @@ -41,6 +41,9 @@ public Context current() { @Override public Context root() { - return SentryContextWrapper.wrap(ContextStorage.super.root()); + // Don't wrap() here — it triggers scope.clone() which acquires locks. Under virtual + // threads, lock.unlock() can re-enter here via OpenTelemetry executor instrumentation, causing + // a deadlock. + return ContextStorage.super.root(); } } From f967be65f01220214f9c487c7994ce930b2864c4 Mon Sep 17 00:00:00 2001 From: adinauer <2542832+adinauer@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:16:42 +0000 Subject: [PATCH 076/391] release: 8.37.1 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea323e0ad5..6f68583a5fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.37.1 ### Fixes diff --git a/gradle.properties b/gradle.properties index cdae82047e2..3ce5df53b45 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.37.0 +versionName=8.37.1 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 1d4a07a7408869f170ad014e303d8fb6e30cdda1 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Thu, 26 Mar 2026 13:11:19 +0100 Subject: [PATCH 077/391] chore: Add error monitoring solution question to bug report templates (#5185) * chore(android): Add error monitoring solution question to bug report template Co-Authored-By: Claude Opus 4.6 * chore(java): Add error monitoring solution question to Java bug report template Co-Authored-By: Claude Opus 4.6 * chore: Address PR feedback on issue templates Co-Authored-By: Claude Opus 4.6 * fix: Typo your -> you're in issue templates Co-Authored-By: Claude Opus 4.6 * Address PR feedback * Omit reserved word --------- Co-authored-by: Claude Opus 4.6 --- .github/ISSUE_TEMPLATE/bug_report_android.yml | 16 ++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report_java.yml | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report_android.yml b/.github/ISSUE_TEMPLATE/bug_report_android.yml index e83e485450d..5dff43579c6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_android.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_android.yml @@ -55,6 +55,22 @@ body: validations: required: true + - type: dropdown + id: other_error_monitoring_solution + attributes: + description: Are you using any other error monitoring solution alongside Sentry? + label: Other Error Monitoring Solution + options: + - "No" + - "Bugsnag" + - "Datadog" + - "Firebase Crashlytics" + - "Instabug/Luciq" + - "NewRelic" + - "Other (please mention in issue description)" + validations: + required: true + - type: input id: version attributes: diff --git a/.github/ISSUE_TEMPLATE/bug_report_java.yml b/.github/ISSUE_TEMPLATE/bug_report_java.yml index 3f2df40888b..8355d75a43b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_java.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_java.yml @@ -53,6 +53,25 @@ body: validations: required: true + - type: dropdown + id: other_error_monitoring + attributes: + description: Are you using any other error monitoring solution alongside Sentry? + label: Other Error Monitoring Solution + options: + - "Yes" + - "No" + validations: + required: true + + - type: input + id: other_error_monitoring_name + attributes: + label: Other Error Monitoring Solution Name + description: If you're using another error monitoring solution side-by-side, please enter the name of the other solution. + validations: + required: false + - type: input id: version attributes: From 11f416162b4e623ccccedebba41fc2a08fcf3374 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 27 Mar 2026 13:30:15 +0100 Subject: [PATCH 078/391] ci: Bump Spring Boot versions in CI matrix (#5235) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Spring Boot 3.x patch versions: - 3.2.10 → 3.2.12 - 3.3.5 → 3.3.13 - 3.4.5 → 3.4.13 - 3.5.6 → 3.5.13 Add Spring Boot 4.0.5 to 4.x matrix. Co-authored-by: Claude --- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index ed8669e60f3..4abb488387a 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - springboot-version: [ '3.0.0', '3.2.10', '3.3.5', '3.4.5', '3.5.6' ] + springboot-version: [ '3.0.0', '3.2.12', '3.3.13', '3.4.13', '3.5.13' ] name: Spring Boot ${{ matrix.springboot-version }} env: diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 67c5efe8700..6466abb58ae 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - springboot-version: [ '4.0.0' ] + springboot-version: [ '4.0.0', '4.0.5' ] name: Spring Boot ${{ matrix.springboot-version }} env: From 6285fcce78720c0dab4c9df7d989c950b48b297c Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Fri, 27 Mar 2026 15:50:26 +0100 Subject: [PATCH 079/391] chore: Add PR validation workflow (#5239) Automatically validates non-maintainer PRs by checking: - Issue reference exists in PR body - Referenced issue has discussion between author and maintainer - Referenced issue is not assigned to someone else Also enforces that all PRs start as drafts. Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/validate-pr.yml | 327 ++++++++++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 .github/workflows/validate-pr.yml diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml new file mode 100644 index 00000000000..e826cb338a7 --- /dev/null +++ b/.github/workflows/validate-pr.yml @@ -0,0 +1,327 @@ +name: Validate PR + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + validate-non-maintainer-pr: + name: Validate Non-Maintainer PR + runs-on: ubuntu-24.04 + permissions: + pull-requests: write + contents: write + outputs: + was-closed: ${{ steps.validate.outputs.was-closed }} + steps: + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v2 + with: + app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} + private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} + + - name: Validate PR + id: validate + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + const pullRequest = context.payload.pull_request; + const repo = context.repo; + const prAuthor = pullRequest.user.login; + const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`; + + // --- Helper: check if a user has admin or maintain permission on a repo (cached) --- + const maintainerCache = new Map(); + async function isMaintainer(owner, repoName, username) { + const key = `${owner}/${repoName}:${username}`; + if (maintainerCache.has(key)) return maintainerCache.get(key); + let result = false; + try { + const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ + owner, + repo: repoName, + username, + }); + // permission field uses legacy values (admin/write/read/none) where + // maintain maps to write. Use role_name for the actual role. + result = ['admin', 'maintain'].includes(data.role_name); + } catch { + // noop — result stays false + } + maintainerCache.set(key, result); + return result; + } + + // --- Step 1: Check if PR author is a maintainer (admin or maintain role) --- + const authorIsMaintainer = await isMaintainer(repo.owner, repo.repo, prAuthor); + if (authorIsMaintainer) { + core.info(`PR author ${prAuthor} has admin/maintain access. Skipping.`); + return; + } + core.info(`PR author ${prAuthor} is not a maintainer.`); + + // --- Step 2: Parse issue references from PR body --- + const body = pullRequest.body || ''; + + // Match all issue reference formats: + // #123, Fixes #123, getsentry/repo#123, Fixes getsentry/repo#123 + // https://github.com/getsentry/repo/issues/123 + const issueRefs = []; + const seen = new Set(); + + // Pattern 1: Full GitHub URLs + const urlPattern = /https?:\/\/github\.com\/(getsentry)\/([\w.-]+)\/issues\/(\d+)/gi; + for (const match of body.matchAll(urlPattern)) { + const key = `${match[1]}/${match[2]}#${match[3]}`; + if (!seen.has(key)) { + seen.add(key); + issueRefs.push({ owner: match[1], repo: match[2], number: parseInt(match[3]) }); + } + } + + // Pattern 2: Cross-repo references (getsentry/repo#123) + const crossRepoPattern = /(?:(?:fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved)\s+)?(getsentry)\/([\w.-]+)#(\d+)/gi; + for (const match of body.matchAll(crossRepoPattern)) { + const key = `${match[1]}/${match[2]}#${match[3]}`; + if (!seen.has(key)) { + seen.add(key); + issueRefs.push({ owner: match[1], repo: match[2], number: parseInt(match[3]) }); + } + } + + // Pattern 3: Same-repo references (#123) + // Negative lookbehind to avoid matching cross-repo refs or URLs already captured + const sameRepoPattern = /(?:(?:fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved)\s+)?(? 0) { + const assignedToAuthor = issue.assignees.some(a => a.login === prAuthor); + if (!assignedToAuthor) { + core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} is assigned to someone else.`); + hasAssigneeConflict = true; + continue; + } + } + + // Check discussion: both PR author and a maintainer must have commented + const comments = await github.paginate(github.rest.issues.listComments, { + owner: ref.owner, + repo: ref.repo, + issue_number: ref.number, + per_page: 100, + }); + + // Also consider the issue author as a participant (opening the issue is a form of discussion) + // Guard against null user (deleted/suspended GitHub accounts) + const prAuthorParticipated = + issue.user?.login === prAuthor || + comments.some(c => c.user?.login === prAuthor); + + let maintainerParticipated = false; + if (prAuthorParticipated) { + // Check each commenter (and issue author) for admin/maintain access on the issue's repo + const usersToCheck = new Set(); + if (issue.user?.login) usersToCheck.add(issue.user.login); + for (const comment of comments) { + if (comment.user?.login && comment.user.login !== prAuthor) { + usersToCheck.add(comment.user.login); + } + } + + for (const user of usersToCheck) { + if (user === prAuthor) continue; + if (await isMaintainer(repo.owner, repo.repo, user)) { + maintainerParticipated = true; + core.info(`Maintainer ${user} participated in ${ref.owner}/${ref.repo}#${ref.number}.`); + break; + } + } + } + + if (prAuthorParticipated && maintainerParticipated) { + core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} has valid discussion. PR is allowed.`); + return; // PR is valid — at least one issue passes all checks + } + + core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} lacks discussion between author and maintainer.`); + hasNoDiscussion = true; + } + + // --- Step 5: No valid issue found — close with the most relevant reason --- + if (hasAssigneeConflict) { + core.info('Closing PR: referenced issue is assigned to someone else.'); + await closePR([ + 'This PR has been automatically closed. The referenced issue is already assigned to someone else.', + '', + 'If you believe this assignment is outdated, please comment on the issue to discuss before opening a new PR.', + '', + `Please review our [contributing guidelines](${contributingUrl}) for more details.`, + ].join('\n'), 'issue-already-assigned'); + return; + } + + if (hasNoDiscussion) { + core.info('Closing PR: no discussion between PR author and a maintainer in the referenced issue.'); + await closePR([ + 'This PR has been automatically closed. The referenced issue does not show a discussion between you and a maintainer.', + '', + 'To avoid wasted effort on both sides, please discuss your proposed approach in the issue first and wait for a maintainer to respond before opening a PR.', + '', + `Please review our [contributing guidelines](${contributingUrl}) for more details.`, + ].join('\n'), 'missing-maintainer-discussion'); + return; + } + + // If we get here, all issue refs were unfetchable + core.info('Could not validate any referenced issues. Closing PR.'); + await closePR([ + 'This PR has been automatically closed. The referenced issue(s) could not be found.', + '', + '**Next steps:**', + '1. Ensure the issue exists and is in a `getsentry` repository', + '2. Discuss the approach with a maintainer in the issue', + '3. Once a maintainer has acknowledged your proposed approach, open a new PR referencing the issue', + '', + `Please review our [contributing guidelines](${contributingUrl}) for more details.`, + ].join('\n'), 'missing-issue-reference'); + + enforce-draft: + name: Enforce Draft PR + needs: [validate-non-maintainer-pr] + if: | + always() + && github.event.pull_request.draft == false + && needs.validate-non-maintainer-pr.outputs.was-closed != 'true' + runs-on: ubuntu-24.04 + permissions: + pull-requests: write + contents: write + steps: + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v2 + with: + app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} + private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} + + - name: Convert PR to draft + env: + GH_TOKEN: ${{github.token}} + PR_URL: ${{ github.event.pull_request.html_url }} + run: | + gh pr ready "$PR_URL" --undo + + - name: Label and comment + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + const pullRequest = context.payload.pull_request; + const repo = context.repo; + + // Label the PR so maintainers can filter/track violations + await github.rest.issues.addLabels({ + ...repo, + issue_number: pullRequest.number, + labels: ['converted-to-draft'], + }); + + // Check for existing bot comment to avoid duplicates on reopen + const comments = await github.rest.issues.listComments({ + ...repo, + issue_number: pullRequest.number, + }); + const botComment = comments.data.find(c => + c.user.type === 'Bot' && + c.body.includes('automatically converted to draft') + ); + if (botComment) { + core.info('Bot comment already exists, skipping.'); + return; + } + + const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`; + + await github.rest.issues.createComment({ + ...repo, + issue_number: pullRequest.number, + body: [ + `This PR has been automatically converted to draft. All PRs must start as drafts per our [contributing guidelines](${contributingUrl}).`, + '', + '**Next steps:**', + '1. Ensure CI passes', + '2. Fill in the PR description completely', + '3. Mark as "Ready for review" when you\'re done' + ].join('\n') + }); From 8d0496a6538cd0504865dd1e5f4db8a68fe4afd8 Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Fri, 27 Mar 2026 20:48:54 +0100 Subject: [PATCH 080/391] chore: Use shared validate-pr composite action (#5240) Replace the inline PR validation workflow with the shared composite action from getsentry/github-workflows#153. This shrinks the workflow from 300+ lines to ~15 and ensures future updates to validation logic are picked up automatically. #skip-changelog Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/validate-pr.yml | 315 +----------------------------- 1 file changed, 2 insertions(+), 313 deletions(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index e826cb338a7..c05657993e8 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -5,323 +5,12 @@ on: types: [opened, reopened] jobs: - validate-non-maintainer-pr: - name: Validate Non-Maintainer PR + validate-pr: runs-on: ubuntu-24.04 permissions: pull-requests: write - contents: write - outputs: - was-closed: ${{ steps.validate.outputs.was-closed }} steps: - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v2 + - uses: getsentry/github-workflows/validate-pr@4243265ac9cc3ee5b89ad2b30c3797ac8483d63a with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} - - - name: Validate PR - id: validate - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - github-token: ${{ steps.app-token.outputs.token }} - script: | - const pullRequest = context.payload.pull_request; - const repo = context.repo; - const prAuthor = pullRequest.user.login; - const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`; - - // --- Helper: check if a user has admin or maintain permission on a repo (cached) --- - const maintainerCache = new Map(); - async function isMaintainer(owner, repoName, username) { - const key = `${owner}/${repoName}:${username}`; - if (maintainerCache.has(key)) return maintainerCache.get(key); - let result = false; - try { - const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ - owner, - repo: repoName, - username, - }); - // permission field uses legacy values (admin/write/read/none) where - // maintain maps to write. Use role_name for the actual role. - result = ['admin', 'maintain'].includes(data.role_name); - } catch { - // noop — result stays false - } - maintainerCache.set(key, result); - return result; - } - - // --- Step 1: Check if PR author is a maintainer (admin or maintain role) --- - const authorIsMaintainer = await isMaintainer(repo.owner, repo.repo, prAuthor); - if (authorIsMaintainer) { - core.info(`PR author ${prAuthor} has admin/maintain access. Skipping.`); - return; - } - core.info(`PR author ${prAuthor} is not a maintainer.`); - - // --- Step 2: Parse issue references from PR body --- - const body = pullRequest.body || ''; - - // Match all issue reference formats: - // #123, Fixes #123, getsentry/repo#123, Fixes getsentry/repo#123 - // https://github.com/getsentry/repo/issues/123 - const issueRefs = []; - const seen = new Set(); - - // Pattern 1: Full GitHub URLs - const urlPattern = /https?:\/\/github\.com\/(getsentry)\/([\w.-]+)\/issues\/(\d+)/gi; - for (const match of body.matchAll(urlPattern)) { - const key = `${match[1]}/${match[2]}#${match[3]}`; - if (!seen.has(key)) { - seen.add(key); - issueRefs.push({ owner: match[1], repo: match[2], number: parseInt(match[3]) }); - } - } - - // Pattern 2: Cross-repo references (getsentry/repo#123) - const crossRepoPattern = /(?:(?:fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved)\s+)?(getsentry)\/([\w.-]+)#(\d+)/gi; - for (const match of body.matchAll(crossRepoPattern)) { - const key = `${match[1]}/${match[2]}#${match[3]}`; - if (!seen.has(key)) { - seen.add(key); - issueRefs.push({ owner: match[1], repo: match[2], number: parseInt(match[3]) }); - } - } - - // Pattern 3: Same-repo references (#123) - // Negative lookbehind to avoid matching cross-repo refs or URLs already captured - const sameRepoPattern = /(?:(?:fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved)\s+)?(? 0) { - const assignedToAuthor = issue.assignees.some(a => a.login === prAuthor); - if (!assignedToAuthor) { - core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} is assigned to someone else.`); - hasAssigneeConflict = true; - continue; - } - } - - // Check discussion: both PR author and a maintainer must have commented - const comments = await github.paginate(github.rest.issues.listComments, { - owner: ref.owner, - repo: ref.repo, - issue_number: ref.number, - per_page: 100, - }); - - // Also consider the issue author as a participant (opening the issue is a form of discussion) - // Guard against null user (deleted/suspended GitHub accounts) - const prAuthorParticipated = - issue.user?.login === prAuthor || - comments.some(c => c.user?.login === prAuthor); - - let maintainerParticipated = false; - if (prAuthorParticipated) { - // Check each commenter (and issue author) for admin/maintain access on the issue's repo - const usersToCheck = new Set(); - if (issue.user?.login) usersToCheck.add(issue.user.login); - for (const comment of comments) { - if (comment.user?.login && comment.user.login !== prAuthor) { - usersToCheck.add(comment.user.login); - } - } - - for (const user of usersToCheck) { - if (user === prAuthor) continue; - if (await isMaintainer(repo.owner, repo.repo, user)) { - maintainerParticipated = true; - core.info(`Maintainer ${user} participated in ${ref.owner}/${ref.repo}#${ref.number}.`); - break; - } - } - } - - if (prAuthorParticipated && maintainerParticipated) { - core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} has valid discussion. PR is allowed.`); - return; // PR is valid — at least one issue passes all checks - } - - core.info(`Issue ${ref.owner}/${ref.repo}#${ref.number} lacks discussion between author and maintainer.`); - hasNoDiscussion = true; - } - - // --- Step 5: No valid issue found — close with the most relevant reason --- - if (hasAssigneeConflict) { - core.info('Closing PR: referenced issue is assigned to someone else.'); - await closePR([ - 'This PR has been automatically closed. The referenced issue is already assigned to someone else.', - '', - 'If you believe this assignment is outdated, please comment on the issue to discuss before opening a new PR.', - '', - `Please review our [contributing guidelines](${contributingUrl}) for more details.`, - ].join('\n'), 'issue-already-assigned'); - return; - } - - if (hasNoDiscussion) { - core.info('Closing PR: no discussion between PR author and a maintainer in the referenced issue.'); - await closePR([ - 'This PR has been automatically closed. The referenced issue does not show a discussion between you and a maintainer.', - '', - 'To avoid wasted effort on both sides, please discuss your proposed approach in the issue first and wait for a maintainer to respond before opening a PR.', - '', - `Please review our [contributing guidelines](${contributingUrl}) for more details.`, - ].join('\n'), 'missing-maintainer-discussion'); - return; - } - - // If we get here, all issue refs were unfetchable - core.info('Could not validate any referenced issues. Closing PR.'); - await closePR([ - 'This PR has been automatically closed. The referenced issue(s) could not be found.', - '', - '**Next steps:**', - '1. Ensure the issue exists and is in a `getsentry` repository', - '2. Discuss the approach with a maintainer in the issue', - '3. Once a maintainer has acknowledged your proposed approach, open a new PR referencing the issue', - '', - `Please review our [contributing guidelines](${contributingUrl}) for more details.`, - ].join('\n'), 'missing-issue-reference'); - - enforce-draft: - name: Enforce Draft PR - needs: [validate-non-maintainer-pr] - if: | - always() - && github.event.pull_request.draft == false - && needs.validate-non-maintainer-pr.outputs.was-closed != 'true' - runs-on: ubuntu-24.04 - permissions: - pull-requests: write - contents: write - steps: - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v2 - with: - app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} - private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} - - - name: Convert PR to draft - env: - GH_TOKEN: ${{github.token}} - PR_URL: ${{ github.event.pull_request.html_url }} - run: | - gh pr ready "$PR_URL" --undo - - - name: Label and comment - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - github-token: ${{ steps.app-token.outputs.token }} - script: | - const pullRequest = context.payload.pull_request; - const repo = context.repo; - - // Label the PR so maintainers can filter/track violations - await github.rest.issues.addLabels({ - ...repo, - issue_number: pullRequest.number, - labels: ['converted-to-draft'], - }); - - // Check for existing bot comment to avoid duplicates on reopen - const comments = await github.rest.issues.listComments({ - ...repo, - issue_number: pullRequest.number, - }); - const botComment = comments.data.find(c => - c.user.type === 'Bot' && - c.body.includes('automatically converted to draft') - ); - if (botComment) { - core.info('Bot comment already exists, skipping.'); - return; - } - - const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`; - - await github.rest.issues.createComment({ - ...repo, - issue_number: pullRequest.number, - body: [ - `This PR has been automatically converted to draft. All PRs must start as drafts per our [contributing guidelines](${contributingUrl}).`, - '', - '**Next steps:**', - '1. Ensure CI passes', - '2. Fill in the PR description completely', - '3. Mark as "Ready for review" when you\'re done' - ].join('\n') - }); From 5865051197d7944c602a6e0af5e11033709b064d Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Fri, 27 Mar 2026 22:48:35 +0100 Subject: [PATCH 081/391] chore: Update validate-pr action to latest version (#5241) Updates the pinned SHA to pick up the bot allowlist fix, which prevents trusted bots (dependabot, renovate, etc.) from being closed by the PR validation workflow. #skip-changelog Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/validate-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index c05657993e8..3b82dd4026f 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: getsentry/github-workflows/validate-pr@4243265ac9cc3ee5b89ad2b30c3797ac8483d63a + - uses: getsentry/github-workflows/validate-pr@4ff40ada546d4a31b852a4279828b989a6193497 with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} From 2166fabd4b23a0e604f6c8ba34b819262c61cb37 Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Mon, 30 Mar 2026 12:16:36 +0200 Subject: [PATCH 082/391] fix(ci): Update validate-pr action to remove draft enforcement (#5247) The draft enforcement step was failing due to insufficient app permissions. It has been removed from the shared action. Refs getsentry/github-workflows#159 Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/validate-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 3b82dd4026f..44da67faa43 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: getsentry/github-workflows/validate-pr@4ff40ada546d4a31b852a4279828b989a6193497 + - uses: getsentry/github-workflows/validate-pr@0b52fc6a867b744dcbdf5d25c18bc8d1c95710e1 with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} From 79a09131975001ac6f291ca8ea011b438431e4e4 Mon Sep 17 00:00:00 2001 From: Stefan Jandl Date: Mon, 30 Mar 2026 14:41:57 +0200 Subject: [PATCH 083/391] feat: Sync file attachments to native (#5211) --- CHANGELOG.md | 630 +++++++++--------- sentry-android-ndk/api/sentry-android-ndk.api | 2 + .../sentry/android/ndk/NdkScopeObserver.java | 38 ++ .../android/ndk/NdkScopeObserverTest.kt | 31 + sentry/api/sentry.api | 4 + .../main/java/io/sentry/IScopeObserver.java | 4 + sentry/src/main/java/io/sentry/Scope.java | 8 + .../java/io/sentry/ScopeObserverAdapter.java | 6 + 8 files changed, 413 insertions(+), 310 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f68583a5fe..ac9f9654836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Features + +- Android: Attachments on the scope will now be synced to native ([#5211](https://github.com/getsentry/sentry-java/pull/5211)) + ## 8.37.1 ### Fixes @@ -302,9 +308,8 @@ - Android: Flush logs when app enters background ([#4951](https://github.com/getsentry/sentry-java/pull/4951)) - Add option to capture additional OkHttp network request/response details in session replays ([#4919](https://github.com/getsentry/sentry-java/pull/4919)) - Depends on `SentryOkHttpInterceptor` to intercept the request and extract request/response bodies - - To enable, add url regexes via the `io.sentry.session-replay.network-detail-allow-urls` metadata tag in AndroidManifest ([code sample](https://github.com/getsentry/sentry-java/blob/b03edbb1b0d8b871c62a09bc02cbd8a4e1f6fea1/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml#L196-L205)) - - Or you can manually specify SentryReplayOptions via `SentryAndroid#init`: -_(Make sure you disable the auto init via manifest meta-data: io.sentry.auto-init=false)_ + - To enable, add url regexes via the `io.sentry.session-replay.network-detail-allow-urls` metadata tag in AndroidManifest ([code sample](https://github.com/getsentry/sentry-java/blob/b03edbb1b0d8b871c62a09bc02cbd8a4e1f6fea1/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml#L196-L205)) - Or you can manually specify SentryReplayOptions via `SentryAndroid#init`: + _(Make sure you disable the auto init via manifest meta-data: io.sentry.auto-init=false)_

Kotlin @@ -346,13 +351,12 @@ SentryAndroid.init(
- ### Improvements - Avoid forking `rootScopes` for Reactor if current thread has `NoOpScopes` ([#4793](https://github.com/getsentry/sentry-java/pull/4793)) - This reduces the SDKs overhead by avoiding unnecessary scope forks -### Fixes +### Fixes - Fix missing thread stacks for ANRv1 events ([#4918](https://github.com/getsentry/sentry-java/pull/4918)) - Fix handling of unparseable mime-type on request filter ([#4939](https://github.com/getsentry/sentry-java/pull/4939)) @@ -608,15 +612,15 @@ SentryAndroid.init( - Add onDiscard to enable users to track the type and amount of data discarded before reaching Sentry ([#4612](https://github.com/getsentry/sentry-java/pull/4612)) - Stub for setting the callback on `Sentry.init`: - ```java - Sentry.init(options -> { - ... - options.setOnDiscard( - (reason, category, number) -> { - // Your logic to process discarded data - }); - }); - ``` + ```java + Sentry.init(options -> { + ... + options.setOnDiscard( + (reason, category, number) -> { + // Your logic to process discarded data + }); + }); + ``` ## 8.19.1 @@ -666,7 +670,7 @@ SentryAndroid.init( - Move and flush unfinished previous session on init ([#4624](https://github.com/getsentry/sentry-java/pull/4624)) - This removes the need for unnecessary blocking our background queue for 15 seconds in the case of a background app start - Switch to compileOnly dependency for compose-ui-material ([#4630](https://github.com/getsentry/sentry-java/pull/4630)) - - This fixes `StackOverflowError` when using OSS Licenses plugin + - This fixes `StackOverflowError` when using OSS Licenses plugin ### Dependencies @@ -871,21 +875,24 @@ SentryAndroid.init( ### Features - Add New User Feedback Widget ([#4450](https://github.com/getsentry/sentry-java/pull/4450)) - - This widget is a custom button that can be used to show the user feedback form + - This widget is a custom button that can be used to show the user feedback form - Add New User Feedback form ([#4384](https://github.com/getsentry/sentry-java/pull/4384)) - - We now introduce SentryUserFeedbackDialog, which extends AlertDialog, inheriting the show() and cancel() methods, among others. - To use it, just instantiate it and call show() on the instance (Sentry must be previously initialized). - For customization options, please check the [User Feedback documentation](https://docs.sentry.io/platforms/android/user-feedback/configuration/). - ```java - import io.sentry.android.core.SentryUserFeedbackDialog; - - new SentryUserFeedbackDialog.Builder(context).create().show(); - ``` - ```kotlin - import io.sentry.android.core.SentryUserFeedbackDialog - - SentryUserFeedbackDialog.Builder(context).create().show() - ``` + - We now introduce SentryUserFeedbackDialog, which extends AlertDialog, inheriting the show() and cancel() methods, among others. + To use it, just instantiate it and call show() on the instance (Sentry must be previously initialized). + For customization options, please check the [User Feedback documentation](https://docs.sentry.io/platforms/android/user-feedback/configuration/). + + ```java + import io.sentry.android.core.SentryUserFeedbackDialog; + + new SentryUserFeedbackDialog.Builder(context).create().show(); + ``` + + ```kotlin + import io.sentry.android.core.SentryUserFeedbackDialog + + SentryUserFeedbackDialog.Builder(context).create().show() + ``` + - Add `user.id`, `user.name` and `user.email` to log attributes ([#4486](https://github.com/getsentry/sentry-java/pull/4486)) - User `name` attribute has been deprecated, please use `username` instead ([#4486](https://github.com/getsentry/sentry-java/pull/4486)) - Add device (`device.brand`, `device.model` and `device.family`) and OS (`os.name` and `os.version`) attributes to logs ([#4493](https://github.com/getsentry/sentry-java/pull/4493)) @@ -931,8 +938,8 @@ SentryAndroid.init( ### Features - Add debug mode for Session Replay masking ([#4357](https://github.com/getsentry/sentry-java/pull/4357)) - - Use `Sentry.replay().enableDebugMaskingOverlay()` to overlay the screen with the Session Replay masks. - - The masks will be invalidated at most once per `frameRate` (default 1 fps). + - Use `Sentry.replay().enableDebugMaskingOverlay()` to overlay the screen with the Session Replay masks. + - The masks will be invalidated at most once per `frameRate` (default 1 fps). - Extend Logs API to allow passing in `attributes` ([#4402](https://github.com/getsentry/sentry-java/pull/4402)) - `Sentry.logger.log` now takes a `SentryLogParameters` - Use `SentryLogParameters.create(SentryAttributes.of(...))` to pass attributes @@ -963,17 +970,17 @@ SentryAndroid.init( ### Features - Add new User Feedback API ([#4286](https://github.com/getsentry/sentry-java/pull/4286)) - - We now introduced Sentry.captureFeedback, which supersedes Sentry.captureUserFeedback + - We now introduced Sentry.captureFeedback, which supersedes Sentry.captureUserFeedback - Add Sentry Log Feature ([#4372](https://github.com/getsentry/sentry-java/pull/4372)) - - The feature is disabled by default and needs to be enabled by: - - `options.getLogs().setEnabled(true)` in `Sentry.init` / `SentryAndroid.init` - - `` in `AndroidManifest.xml` - - `logs.enabled=true` in `sentry.properties` - - `sentry.logs.enabled=true` in `application.properties` - - `sentry.logs.enabled: true` in `application.yml` - - Logs can be captured using `Sentry.logger().info()` and similar methods. - - Logs also take a format string and arguments which we then send through `String.format`. - - Please use `options.getLogs().setBeforeSend()` to filter outgoing logs + - The feature is disabled by default and needs to be enabled by: + - `options.getLogs().setEnabled(true)` in `Sentry.init` / `SentryAndroid.init` + - `` in `AndroidManifest.xml` + - `logs.enabled=true` in `sentry.properties` + - `sentry.logs.enabled=true` in `application.properties` + - `sentry.logs.enabled: true` in `application.yml` + - Logs can be captured using `Sentry.logger().info()` and similar methods. + - Logs also take a format string and arguments which we then send through `String.format`. + - Please use `options.getLogs().setBeforeSend()` to filter outgoing logs ### Fixes @@ -1008,11 +1015,11 @@ SentryAndroid.init( ### Features - Wrap configured OpenTelemetry `ContextStorageProvider` if available ([#4359](https://github.com/getsentry/sentry-java/pull/4359)) - - This is only relevant if you see `java.lang.IllegalStateException: Found multiple ContextStorageProvider. Set the io.opentelemetry.context.ContextStorageProvider property to the fully qualified class name of the provider to use. Falling back to default ContextStorage. Found providers: ...` + - This is only relevant if you see `java.lang.IllegalStateException: Found multiple ContextStorageProvider. Set the io.opentelemetry.context.ContextStorageProvider property to the fully qualified class name of the provider to use. Falling back to default ContextStorage. Found providers: ...` - Set `-Dio.opentelemetry.context.contextStorageProvider=io.sentry.opentelemetry.SentryContextStorageProvider` on your `java` command - Sentry will then wrap the other `ContextStorageProvider` that has been configured by loading it through SPI - If no other `ContextStorageProvider` is available or there are problems loading it, we fall back to using `SentryOtelThreadLocalStorage` - + ### Fixes - Update profile chunk rate limit and client report ([#4353](https://github.com/getsentry/sentry-java/pull/4353)) @@ -1071,9 +1078,9 @@ SentryAndroid.init( - UI Profiling GA Continuous Profiling is now GA, named UI Profiling. To enable it you can use one of the following options. More info can be found at https://docs.sentry.io/platforms/android/profiling/. - Note: Both `options.profilesSampler` and `options.profilesSampleRate` must **not** be set to enable UI Profiling. - To keep the same transaction-based behaviour, without the 30 seconds limitation, you can use the `trace` lifecycle mode. - + Note: Both `options.profilesSampler` and `options.profilesSampleRate` must **not** be set to enable UI Profiling. + To keep the same transaction-based behaviour, without the 30 seconds limitation, you can use the `trace` lifecycle mode. + ```xml @@ -1084,10 +1091,11 @@ SentryAndroid.init( ``` + ```java import io.sentry.ProfileLifecycle; import io.sentry.android.core.SentryAndroid; - + SentryAndroid.init(context, options -> { // Enable UI profiling, adjust in production env. This is evaluated only once per session options.setProfileSessionSampleRate(1.0); @@ -1097,6 +1105,7 @@ SentryAndroid.init( options.setStartProfilerOnAppStart(true); }); ``` + ```kotlin import io.sentry.ProfileLifecycle import io.sentry.android.core.SentryAndroid @@ -1167,10 +1176,10 @@ SentryAndroid.init( ### Features - Add native stack frame address information and debug image metadata to ANR events ([#4061](https://github.com/getsentry/sentry-java/pull/4061)) - - This enables symbolication for stripped native code in ANRs + - This enables symbolication for stripped native code in ANRs - Add Continuous Profiling Support ([#3710](https://github.com/getsentry/sentry-java/pull/3710)) - To enable Continuous Profiling use the `Sentry.startProfiler` and `Sentry.stopProfiler` experimental APIs. Sampling rate can be set through `options.profileSessionSampleRate`, which defaults to null (disabled). + To enable Continuous Profiling use the `Sentry.startProfiler` and `Sentry.stopProfiler` experimental APIs. Sampling rate can be set through `options.profileSessionSampleRate`, which defaults to null (disabled). Note: Both `options.profilesSampler` and `options.profilesSampleRate` must **not** be set to enable Continuous Profiling. ```java @@ -1178,7 +1187,7 @@ SentryAndroid.init( import io.sentry.android.core.SentryAndroid; SentryAndroid.init(context) { options -> - + // Currently under experimental options: options.getExperimental().setProfileSessionSampleRate(1.0); // In manual mode, you need to start and stop the profiler manually using Sentry.startProfiler and Sentry.stopProfiler @@ -1187,16 +1196,17 @@ SentryAndroid.init( } // Start profiling Sentry.startProfiler(); - + // After all profiling is done, stop the profiler. Profiles can last indefinitely if not stopped. Sentry.stopProfiler(); ``` + ```kotlin import io.sentry.ProfileLifecycle import io.sentry.android.core.SentryAndroid SentryAndroid.init(context) { options -> - + // Currently under experimental options: options.experimental.profileSessionSampleRate = 1.0 // In manual mode, you need to start and stop the profiler manually using Sentry.startProfiler and Sentry.stopProfiler @@ -1205,7 +1215,7 @@ SentryAndroid.init( } // Start profiling Sentry.startProfiler() - + // After all profiling is done, stop the profiler. Profiles can last indefinitely if not stopped. Sentry.stopProfiler() ``` @@ -1243,7 +1253,7 @@ SentryAndroid.init( - remove any previous value if the new value is set to `null` - Add support for setting in-app-includes/in-app-excludes via AndroidManifest.xml ([#4240](https://github.com/getsentry/sentry-java/pull/4240)) - Modifications to OkHttp requests are now properly propagated to the affected span / breadcrumbs ([#4238](https://github.com/getsentry/sentry-java/pull/4238)) - - Please ensure the SentryOkHttpInterceptor is added last to your OkHttpClient, as otherwise changes to the `Request` by subsequent interceptors won't be considered + - Please ensure the SentryOkHttpInterceptor is added last to your OkHttpClient, as otherwise changes to the `Request` by subsequent interceptors won't be considered - Fix "class ch.qos.logback.classic.spi.ThrowableProxyVO cannot be cast to class ch.qos.logback.classic.spi.ThrowableProxy" ([#4206](https://github.com/getsentry/sentry-java/pull/4206)) - In this case we cannot report the `Throwable` to Sentry as it's not available - If you are using OpenTelemetry v1 `OpenTelemetryAppender`, please consider upgrading to v2 @@ -1316,7 +1326,7 @@ SentryAndroid.init( ### Behavioural Changes - The class `io.sentry.spring.jakarta.webflux.ReactorUtils` is now deprecated, please use `io.sentry.reactor.SentryReactorUtils` in the new `sentry-reactor` module instead ([#4155](https://github.com/getsentry/sentry-java/pull/4155)) - - The new module will be exposed as an `api` dependency when using `sentry-spring-boot-jakarta` (Spring Boot 3) or `sentry-spring-jakarta` (Spring 6). + - The new module will be exposed as an `api` dependency when using `sentry-spring-boot-jakarta` (Spring Boot 3) or `sentry-spring-jakarta` (Spring 6). Therefore, if you're using one of those modules, changing your imports will suffice. ## 8.2.0 @@ -1330,7 +1340,7 @@ SentryAndroid.init( - Create onCreate and onStart spans for all Activities ([#4025](https://github.com/getsentry/sentry-java/pull/4025)) - Add split apks info to the `App` context ([#3193](https://github.com/getsentry/sentry-java/pull/3193)) - Expose new `withSentryObservableEffect` method overload that accepts `SentryNavigationListener` as a parameter ([#4143](https://github.com/getsentry/sentry-java/pull/4143)) - - This allows sharing the same `SentryNavigationListener` instance across fragments and composables to preserve the trace + - This allows sharing the same `SentryNavigationListener` instance across fragments and composables to preserve the trace - (Internal) Add API to filter native debug images based on stacktrace addresses ([#4089](https://github.com/getsentry/sentry-java/pull/4089)) - Propagate sampling random value ([#4153](https://github.com/getsentry/sentry-java/pull/4153)) - The random value used for sampling traces is now sent to Sentry and attached to the `baggage` header on outgoing requests @@ -1401,6 +1411,7 @@ SentryAndroid.init(context) { options -> ``` If you would like to keep some of the default broadcast events as breadcrumbs, consider opening a [GitHub issue](https://github.com/getsentry/sentry-java/issues/new). + - Set mechanism `type` to `suppressed` for suppressed exceptions ([#4125](https://github.com/getsentry/sentry-java/pull/4125)) - This helps to distinguish an exceptions cause from any suppressed exceptions in the Sentry UI @@ -1422,10 +1433,10 @@ Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. - Lifecycle tokens have been introduced to manage `Scope` lifecycle, see "Behavioural Changes" for more details. - Bumping `minSdk` level to 21 (Android 5.0) - Our `sentry-opentelemetry-agent` has been improved and now works in combination with the rest of Sentry. You may now combine OpenTelemetry and Sentry for instrumenting your application. - - You may now use both OpenTelemetry SDK and Sentry SDK to capture transactions and spans. They can also be mixed and end up on the same transaction. - - OpenTelemetry extends the Sentry SDK by adding spans for numerous integrations, like Ktor, Vert.x and MongoDB. Please check [the OpenTelemetry GitHub repository](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation) for a full list. - - OpenTelemetry allows propagating trace information from and to additional libraries, that Sentry did not support before, for example gRPC. - - OpenTelemetry also has broader support for propagating the Sentry `Scopes` through reactive libraries like RxJava. + - You may now use both OpenTelemetry SDK and Sentry SDK to capture transactions and spans. They can also be mixed and end up on the same transaction. + - OpenTelemetry extends the Sentry SDK by adding spans for numerous integrations, like Ktor, Vert.x and MongoDB. Please check [the OpenTelemetry GitHub repository](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation) for a full list. + - OpenTelemetry allows propagating trace information from and to additional libraries, that Sentry did not support before, for example gRPC. + - OpenTelemetry also has broader support for propagating the Sentry `Scopes` through reactive libraries like RxJava. - The SDK is now compatible with Spring Boot 3.4 - We now support GraphQL v22 (`sentry-graphql-22`) - Metrics have been removed @@ -1442,11 +1453,11 @@ This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or - The minSdk level for sentry-android-ndk changed from 19 to 21 ([#3851](https://github.com/getsentry/sentry-java/pull/3851)) - Throw IllegalArgumentException when calling Sentry.init on Android ([#3596](https://github.com/getsentry/sentry-java/pull/3596)) - Metrics have been removed from the SDK ([#3774](https://github.com/getsentry/sentry-java/pull/3774)) - - Metrics will return but we don't know in what exact form yet + - Metrics will return but we don't know in what exact form yet - `enableTracing` option (a.k.a `enable-tracing`) has been removed from the SDK ([#3776](https://github.com/getsentry/sentry-java/pull/3776)) - - Please set `tracesSampleRate` to a value >= 0.0 for enabling performance instead. The default value is `null` which means performance is disabled. + - Please set `tracesSampleRate` to a value >= 0.0 for enabling performance instead. The default value is `null` which means performance is disabled. - Replace `synchronized` methods and blocks with `ReentrantLock` (`AutoClosableReentrantLock`) ([#3715](https://github.com/getsentry/sentry-java/pull/3715)) - - If you are subclassing any Sentry classes, please check if the parent class used `synchronized` before. Please make sure to use the same lock object as the parent class in that case. + - If you are subclassing any Sentry classes, please check if the parent class used `synchronized` before. Please make sure to use the same lock object as the parent class in that case. - `traceOrigins` option (`io.sentry.traces.tracing-origins` in manifest) has been removed, please use `tracePropagationTargets` (`io.sentry.traces.trace-propagation-targets` in manifest`) instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) - `profilingEnabled` option (`io.sentry.traces.profiling.enable` in manifest) has been removed, please use `profilesSampleRate` (`io.sentry.traces.profiling.sample-rate` instead) instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) - `shutdownTimeout` option has been removed, please use `shutdownTimeoutMillis` instead ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) @@ -1466,32 +1477,32 @@ This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or - User segment has been removed ([#3512](https://github.com/getsentry/sentry-java/pull/3512)) - One of the `AndroidTransactionProfiler` constructors has been removed, please use a different one ([#3780](https://github.com/getsentry/sentry-java/pull/3780)) - Use String instead of UUID for SessionId ([#3834](https://github.com/getsentry/sentry-java/pull/3834)) - - The `Session` constructor now takes a `String` instead of a `UUID` for the `sessionId` parameter. - - `Session.getSessionId()` now returns a `String` instead of a `UUID`. + - The `Session` constructor now takes a `String` instead of a `UUID` for the `sessionId` parameter. + - `Session.getSessionId()` now returns a `String` instead of a `UUID`. - All status codes below 400 are now mapped to `SpanStatus.OK` ([#3869](https://github.com/getsentry/sentry-java/pull/3869)) - Change OkHttp sub-spans to span attributes ([#3556](https://github.com/getsentry/sentry-java/pull/3556)) - - This will reduce the number of spans created by the SDK + - This will reduce the number of spans created by the SDK - `instrumenter` option should no longer be needed as our new OpenTelemetry integration now works in combination with the rest of Sentry ### Behavioural Changes - We're introducing some new `Scope` types in the SDK, allowing for better control over what data is attached where. Previously there was a stack of scopes that was pushed and popped. Instead we now fork scopes for a given lifecycle and then restore the previous scopes. Since `Hub` is gone, it is also never cloned anymore. Separation of data now happens through the different scope types while making it easier to manipulate exactly what you need without having to attach data at the right time to have it apply where wanted. - - Global scope is attached to all events created by the SDK. It can also be modified before `Sentry.init` has been called. It can be manipulated using `Sentry.configureScope(ScopeType.GLOBAL, (scope) -> { ... })`. - - Isolation scope can be used e.g. to attach data to all events that come up while handling an incoming request. It can also be used for other isolation purposes. It can be manipulated using `Sentry.configureScope(ScopeType.ISOLATION, (scope) -> { ... })`. The SDK automatically forks isolation scope in certain cases like incoming requests, CRON jobs, Spring `@Async` and more. - - Current scope is forked often and data added to it is only added to events that are created while this scope is active. Data is also passed on to newly forked child scopes but not to parents. It can be manipulated using `Sentry.configureScope(ScopeType.CURRENT, (scope) -> { ... })`. + - Global scope is attached to all events created by the SDK. It can also be modified before `Sentry.init` has been called. It can be manipulated using `Sentry.configureScope(ScopeType.GLOBAL, (scope) -> { ... })`. + - Isolation scope can be used e.g. to attach data to all events that come up while handling an incoming request. It can also be used for other isolation purposes. It can be manipulated using `Sentry.configureScope(ScopeType.ISOLATION, (scope) -> { ... })`. The SDK automatically forks isolation scope in certain cases like incoming requests, CRON jobs, Spring `@Async` and more. + - Current scope is forked often and data added to it is only added to events that are created while this scope is active. Data is also passed on to newly forked child scopes but not to parents. It can be manipulated using `Sentry.configureScope(ScopeType.CURRENT, (scope) -> { ... })`. - `Sentry.popScope` has been deprecated, please call `.close()` on the token returned by `Sentry.pushScope` instead or use it in a way described in more detail in [our migration guide](https://docs.sentry.io/platforms/java/migration/7.x-to-8.0). - We have chosen a default scope that is used for `Sentry.configureScope()` as well as API like `Sentry.setTag()` - - For Android the type defaults to `CURRENT` scope - - For Backend and other JVM applicatons it defaults to `ISOLATION` scope + - For Android the type defaults to `CURRENT` scope + - For Backend and other JVM applicatons it defaults to `ISOLATION` scope - Event processors on `Scope` can now be ordered by overriding the `getOrder` method on implementations of `EventProcessor`. NOTE: This order only applies to event processors on `Scope` but not `SentryOptions` at the moment. Feel free to request this if you need it. - `Hub` is deprecated in favor of `Scopes`, alongside some `Hub` relevant APIs. More details can be found in [our migration guide](https://docs.sentry.io/platforms/java/migration/7.x-to-8.0). - Send file name and path only if `isSendDefaultPii` is `true` ([#3919](https://github.com/getsentry/sentry-java/pull/3919)) - (Android) Enable Performance V2 by default ([#3824](https://github.com/getsentry/sentry-java/pull/3824)) - - With this change cold app start spans will include spans for ContentProviders, Application and Activity load. + - With this change cold app start spans will include spans for ContentProviders, Application and Activity load. - (Android) Replace thread id with kernel thread id in span data ([#3706](https://github.com/getsentry/sentry-java/pull/3706)) - (Android) The JNI layer for sentry-native has now been moved from sentry-java to sentry-native ([#3189](https://github.com/getsentry/sentry-java/pull/3189)) - - This now includes prefab support for sentry-native, allowing you to link and access the sentry-native API within your native app code - - Checkout the `sentry-samples/sentry-samples-android` example on how to configure CMake and consume `sentry.h` + - This now includes prefab support for sentry-native, allowing you to link and access the sentry-native API within your native app code + - Checkout the `sentry-samples/sentry-samples-android` example on how to configure CMake and consume `sentry.h` - The user ip-address is now only set to `"{{auto}}"` if `sendDefaultPii` is enabled ([#4072](https://github.com/getsentry/sentry-java/pull/4072)) - This change gives you control over IP address collection directly on the client @@ -1499,49 +1510,49 @@ This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or - The SDK is now compatible with Spring Boot 3.4 ([#3939](https://github.com/getsentry/sentry-java/pull/3939)) - Our `sentry-opentelemetry-agent` has been completely reworked and now plays nicely with the rest of the Java SDK - - You may also want to give this new agent a try even if you haven't used OpenTelemetry (with Sentry) before. It offers support for [many more libraries and frameworks](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md), improving on our trace propagation, `Scopes` (used to be `Hub`) propagation as well as performance instrumentation (i.e. more spans). - - If you are using a framework we did not support before and currently resort to manual instrumentation, please give the agent a try. See [here for a list of supported libraries, frameworks and application servers](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md). - - Please see [Java SDK docs](https://docs.sentry.io/platforms/java/tracing/instrumentation/opentelemetry/) for more details on how to set up the agent. Please make sure to select the correct SDK from the dropdown on the left side of the docs. - - What's new about the Agent - - When the OpenTelemetry Agent is used, Sentry API creates OpenTelemetry spans under the hood, handing back a wrapper object which bridges the gap between traditional Sentry API and OpenTelemetry. We might be replacing some of the Sentry performance API in the future. - - This is achieved by configuring the SDK to use `OtelSpanFactory` instead of `DefaultSpanFactory` which is done automatically by the auto init of the Java Agent. - - OpenTelemetry spans are now only turned into Sentry spans when they are finished so they can be sent to the Sentry server. - - Now registers an OpenTelemetry `Sampler` which uses Sentry sampling configuration - - Other Performance integrations automatically stop creating spans to avoid duplicate spans - - The Sentry SDK now makes use of OpenTelemetry `Context` for storing Sentry `Scopes` (which is similar to what used to be called `Hub`) and thus relies on OpenTelemetry for `Context` propagation. - - Classes used for the previous version of our OpenTelemetry support have been deprecated but can still be used manually. We're not planning to keep the old agent around in favor of less complexity in the SDK. + - You may also want to give this new agent a try even if you haven't used OpenTelemetry (with Sentry) before. It offers support for [many more libraries and frameworks](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md), improving on our trace propagation, `Scopes` (used to be `Hub`) propagation as well as performance instrumentation (i.e. more spans). + - If you are using a framework we did not support before and currently resort to manual instrumentation, please give the agent a try. See [here for a list of supported libraries, frameworks and application servers](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md). + - Please see [Java SDK docs](https://docs.sentry.io/platforms/java/tracing/instrumentation/opentelemetry/) for more details on how to set up the agent. Please make sure to select the correct SDK from the dropdown on the left side of the docs. + - What's new about the Agent + - When the OpenTelemetry Agent is used, Sentry API creates OpenTelemetry spans under the hood, handing back a wrapper object which bridges the gap between traditional Sentry API and OpenTelemetry. We might be replacing some of the Sentry performance API in the future. + - This is achieved by configuring the SDK to use `OtelSpanFactory` instead of `DefaultSpanFactory` which is done automatically by the auto init of the Java Agent. + - OpenTelemetry spans are now only turned into Sentry spans when they are finished so they can be sent to the Sentry server. + - Now registers an OpenTelemetry `Sampler` which uses Sentry sampling configuration + - Other Performance integrations automatically stop creating spans to avoid duplicate spans + - The Sentry SDK now makes use of OpenTelemetry `Context` for storing Sentry `Scopes` (which is similar to what used to be called `Hub`) and thus relies on OpenTelemetry for `Context` propagation. + - Classes used for the previous version of our OpenTelemetry support have been deprecated but can still be used manually. We're not planning to keep the old agent around in favor of less complexity in the SDK. - Add `sentry-opentelemetry-agentless-spring` module ([#4000](https://github.com/getsentry/sentry-java/pull/4000)) - - This module can be added as a dependency when using Sentry with OpenTelemetry and Spring Boot but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry. - - You may want to set `OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none` env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use. + - This module can be added as a dependency when using Sentry with OpenTelemetry and Spring Boot but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry. + - You may want to set `OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none` env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use. - Add `sentry-opentelemetry-agentless` module ([#3961](https://github.com/getsentry/sentry-java/pull/3961)) - - This module can be added as a dependency when using Sentry with OpenTelemetry but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry. - - To enable the auto configuration of it, please set `-Dotel.java.global-autoconfigure.enabled=true` on the `java` command, when starting your application. - - You may also want to set `OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none` env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use. + - This module can be added as a dependency when using Sentry with OpenTelemetry but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry. + - To enable the auto configuration of it, please set `-Dotel.java.global-autoconfigure.enabled=true` on the `java` command, when starting your application. + - You may also want to set `OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none` env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use. - `OpenTelemetryUtil.applyOpenTelemetryOptions` now takes an enum instead of a boolean for its mode - Add `openTelemetryMode` option ([#3994](https://github.com/getsentry/sentry-java/pull/3994)) - - It defaults to `AUTO` meaning the SDK will figure out how to best configure itself for use with OpenTelemetry - - Use of OpenTelemetry can also be disabled completely by setting it to `OFF` ([#3995](https://github.com/getsentry/sentry-java/pull/3995)) - - In this case even if OpenTelemetry is present, the Sentry SDK will not use it - - Use `AGENT` when using `sentry-opentelemetry-agent` - - Use `AGENTLESS` when using `sentry-opentelemetry-agentless` - - Use `AGENTLESS_SPRING` when using `sentry-opentelemetry-agentless-spring` + - It defaults to `AUTO` meaning the SDK will figure out how to best configure itself for use with OpenTelemetry + - Use of OpenTelemetry can also be disabled completely by setting it to `OFF` ([#3995](https://github.com/getsentry/sentry-java/pull/3995)) + - In this case even if OpenTelemetry is present, the Sentry SDK will not use it + - Use `AGENT` when using `sentry-opentelemetry-agent` + - Use `AGENTLESS` when using `sentry-opentelemetry-agentless` + - Use `AGENTLESS_SPRING` when using `sentry-opentelemetry-agentless-spring` - Add `ignoredTransactions` option to filter out transactions by name ([#3871](https://github.com/getsentry/sentry-java/pull/3871)) - - can be used via ENV vars, e.g. `SENTRY_IGNORED_TRANSACTIONS=POST /person/,GET /pers.*` - - can also be set in options directly, e.g. `options.setIgnoredTransactions(...)` - - can also be set in `sentry.properties`, e.g. `ignored-transactions=POST /person/,GET /pers.*` - - can also be set in Spring config `application.properties`, e.g. `sentry.ignored-transactions=POST /person/,GET /pers.*` + - can be used via ENV vars, e.g. `SENTRY_IGNORED_TRANSACTIONS=POST /person/,GET /pers.*` + - can also be set in options directly, e.g. `options.setIgnoredTransactions(...)` + - can also be set in `sentry.properties`, e.g. `ignored-transactions=POST /person/,GET /pers.*` + - can also be set in Spring config `application.properties`, e.g. `sentry.ignored-transactions=POST /person/,GET /pers.*` - Add `scopeBindingMode` to `SpanOptions` ([#4004](https://github.com/getsentry/sentry-java/pull/4004)) - - This setting only affects the SDK when used with OpenTelemetry. - - Defaults to `AUTO` meaning the SDK will decide whether the span should be bound to the current scope. It will not bind transactions to scope using `AUTO`, it will only bind spans where the parent span is on the current scope. - - `ON` sets the new span on the current scope. - - `OFF` does not set the new span on the scope. + - This setting only affects the SDK when used with OpenTelemetry. + - Defaults to `AUTO` meaning the SDK will decide whether the span should be bound to the current scope. It will not bind transactions to scope using `AUTO`, it will only bind spans where the parent span is on the current scope. + - `ON` sets the new span on the current scope. + - `OFF` does not set the new span on the scope. - Add `ignoredSpanOrigins` option for ignoring spans coming from certain integrations - - We pre-configure this to ignore Performance instrumentation for Spring and other integrations when using our OpenTelemetry Agent to avoid duplicate spans + - We pre-configure this to ignore Performance instrumentation for Spring and other integrations when using our OpenTelemetry Agent to avoid duplicate spans - Support `graphql-java` v22 via a new module `sentry-graphql-22` ([#3740](https://github.com/getsentry/sentry-java/pull/3740)) - - If you are using `graphql-java` v21 or earlier, you can use the `sentry-graphql` module - - For `graphql-java` v22 and newer please use the `sentry-graphql-22` module + - If you are using `graphql-java` v21 or earlier, you can use the `sentry-graphql` module + - For `graphql-java` v22 and newer please use the `sentry-graphql-22` module - We now provide a `SentryInstrumenter` bean directly for Spring (Boot) if there is none yet instead of using `GraphQlSourceBuilderCustomizer` to add the instrumentation ([#3744](https://github.com/getsentry/sentry-java/pull/3744)) - - It is now also possible to provide a bean of type `SentryGraphqlInstrumentation.BeforeSpanCallback` which is then used by `SentryInstrumenter` + - It is now also possible to provide a bean of type `SentryGraphqlInstrumentation.BeforeSpanCallback` which is then used by `SentryInstrumenter` - Add data fetching environment hint to breadcrumb for GraphQL (#3413) ([#3431](https://github.com/getsentry/sentry-java/pull/3431)) - Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396) - Any suppressed exceptions are added to the issue details page in Sentry, the same way any cause is. @@ -1549,23 +1560,23 @@ This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or - Enable `ThreadLocalAccessor` for Spring Boot 3 WebFlux by default ([#4023](https://github.com/getsentry/sentry-java/pull/4023)) - Allow passing `environment` to `CheckinUtils.withCheckIn` ([3889](https://github.com/getsentry/sentry-java/pull/3889)) - Add `globalHubMode` to options ([#3805](https://github.com/getsentry/sentry-java/pull/3805)) - - `globalHubMode` used to only be a param on `Sentry.init`. To make it easier to be used in e.g. Desktop environments, we now additionally added it as an option on SentryOptions that can also be set via `sentry.properties`. - - If both the param on `Sentry.init` and the option are set, the option will win. By default the option is set to `null` meaning whatever is passed to `Sentry.init` takes effect. + - `globalHubMode` used to only be a param on `Sentry.init`. To make it easier to be used in e.g. Desktop environments, we now additionally added it as an option on SentryOptions that can also be set via `sentry.properties`. + - If both the param on `Sentry.init` and the option are set, the option will win. By default the option is set to `null` meaning whatever is passed to `Sentry.init` takes effect. - Lazy uuid generation for SentryId and SpanId ([#3770](https://github.com/getsentry/sentry-java/pull/3770)) - Faster generation of Sentry and Span IDs ([#3818](https://github.com/getsentry/sentry-java/pull/3818)) - - Uses faster implementation to convert UUID to SentryID String - - Uses faster Random implementation to generate UUIDs + - Uses faster implementation to convert UUID to SentryID String + - Uses faster Random implementation to generate UUIDs - Android 15: Add support for 16KB page sizes ([#3851](https://github.com/getsentry/sentry-java/pull/3851)) - - See https://developer.android.com/guide/practices/page-sizes for more details + - See https://developer.android.com/guide/practices/page-sizes for more details - Add init priority settings ([#3674](https://github.com/getsentry/sentry-java/pull/3674)) - - You may now set `forceInit=true` (`force-init` for `.properties` files) to ensure a call to Sentry.init / SentryAndroid.init takes effect + - You may now set `forceInit=true` (`force-init` for `.properties` files) to ensure a call to Sentry.init / SentryAndroid.init takes effect - Add force init option to Android Manifest ([#3675](https://github.com/getsentry/sentry-java/pull/3675)) - - Use `` to ensure Sentry Android auto init is not easily overwritten + - Use `` to ensure Sentry Android auto init is not easily overwritten - Attach request body for `application/x-www-form-urlencoded` requests in Spring ([#3731](https://github.com/getsentry/sentry-java/pull/3731)) - - Previously request body was only attached for `application/json` requests + - Previously request body was only attached for `application/json` requests - Set breadcrumb level based on http status ([#3771](https://github.com/getsentry/sentry-java/pull/3771)) - Emit transaction.data inside contexts.trace.data ([#3735](https://github.com/getsentry/sentry-java/pull/3735)) - - Also does not emit `transaction.data` in `extras` anymore + - Also does not emit `transaction.data` in `extras` anymore - Add a sample for showcasing Sentry with OpenTelemetry for Spring Boot 3 with our Java agent (`sentry-samples-spring-boot-jakarta-opentelemetry`) ([#3856](https://github.com/getsentry/sentry-java/pull/3828)) - Add a sample for showcasing Sentry with OpenTelemetry for Spring Boot 3 without our Java agent (`sentry-samples-spring-boot-jakarta-opentelemetry-noagent`) ([#3856](https://github.com/getsentry/sentry-java/pull/3856)) - Add a sample for showcasing Sentry with OpenTelemetry (`sentry-samples-console-opentelemetry-noagent`) ([#3856](https://github.com/getsentry/sentry-java/pull/3862)) @@ -1573,28 +1584,28 @@ This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or ### Fixes - Fix incoming defer sampling decision `sentry-trace` header ([#3942](https://github.com/getsentry/sentry-java/pull/3942)) - - A `sentry-trace` header that only contains trace ID and span ID but no sampled flag (`-1`, `-0` suffix) means the receiving system can make its own sampling decision - - When generating `sentry-trace` header from `PropagationContext` we now copy the `sampled` flag. - - In `TransactionContext.fromPropagationContext` when there is no parent sampling decision, keep the decision `null` so a new sampling decision is made instead of defaulting to `false` + - A `sentry-trace` header that only contains trace ID and span ID but no sampled flag (`-1`, `-0` suffix) means the receiving system can make its own sampling decision + - When generating `sentry-trace` header from `PropagationContext` we now copy the `sampled` flag. + - In `TransactionContext.fromPropagationContext` when there is no parent sampling decision, keep the decision `null` so a new sampling decision is made instead of defaulting to `false` - Fix order of calling `close` on previous Sentry instance when re-initializing ([#3750](https://github.com/getsentry/sentry-java/pull/3750)) - - Previously some parts of Sentry were immediately closed after re-init that should have stayed open and some parts of the previous init were never closed + - Previously some parts of Sentry were immediately closed after re-init that should have stayed open and some parts of the previous init were never closed - All status codes below 400 are now mapped to `SpanStatus.OK` ([#3869](https://github.com/getsentry/sentry-java/pull/3869)) - Improve ignored check performance ([#3992](https://github.com/getsentry/sentry-java/pull/3992)) - - Checking if a span origin, a transaction or a checkIn should be ignored is now faster + - Checking if a span origin, a transaction or a checkIn should be ignored is now faster - Cache requests for Spring using Springs `ContentCachingRequestWrapper` instead of our own Wrapper to also cache parameters ([#3641](https://github.com/getsentry/sentry-java/pull/3641)) - - Previously only the body was cached which could lead to problems in the FilterChain as Request parameters were not available + - Previously only the body was cached which could lead to problems in the FilterChain as Request parameters were not available - Close backpressure monitor on SDK shutdown ([#3998](https://github.com/getsentry/sentry-java/pull/3998)) - - Due to the backpressure monitor rescheduling a task to run every 10s, it very likely caused shutdown to wait the full `shutdownTimeoutMillis` (defaulting to 2s) instead of being able to terminate immediately + - Due to the backpressure monitor rescheduling a task to run every 10s, it very likely caused shutdown to wait the full `shutdownTimeoutMillis` (defaulting to 2s) instead of being able to terminate immediately - Let OpenTelemetry auto instrumentation handle extracting and injecting tracing information if present ([#3953](https://github.com/getsentry/sentry-java/pull/3953)) - - Our integrations no longer call `.continueTrace` and also do not inject tracing headers if the integration has been added to `ignoredSpanOrigins` + - Our integrations no longer call `.continueTrace` and also do not inject tracing headers if the integration has been added to `ignoredSpanOrigins` - Fix testTag not working for Jetpack Compose user interaction tracking ([#3878](https://github.com/getsentry/sentry-java/pull/3878)) - Mark `DiskFlushNotification` hint flushed when rate limited ([#3892](https://github.com/getsentry/sentry-java/pull/3892)) - - Our `UncaughtExceptionHandlerIntegration` waited for the full flush timeout duration (default 15s) when rate limited. + - Our `UncaughtExceptionHandlerIntegration` waited for the full flush timeout duration (default 15s) when rate limited. - Do not replace `op` with auto generated content for OpenTelemetry spans with span kind `INTERNAL` ([#3906](https://github.com/getsentry/sentry-java/pull/3906)) - Add `enable-spotlight` and `spotlight-connection-url` to external options and check if spotlight is enabled when deciding whether to inspect an OpenTelemetry span for connecting to splotlight ([#3709](https://github.com/getsentry/sentry-java/pull/3709)) - Trace context on `Contexts.setTrace` has been marked `@NotNull` ([#3721](https://github.com/getsentry/sentry-java/pull/3721)) - - Setting it to `null` would cause an exception. - - Transactions are dropped if trace context is missing + - Setting it to `null` would cause an exception. + - Transactions are dropped if trace context is missing - Remove internal annotation on `SpanOptions` ([#3722](https://github.com/getsentry/sentry-java/pull/3722)) - `SentryLogbackInitializer` is now public ([#3723](https://github.com/getsentry/sentry-java/pull/3723)) - Parse and use `send-default-pii` and `max-request-body-size` from `sentry.properties` ([#3534](https://github.com/getsentry/sentry-java/pull/3534)) @@ -1611,66 +1622,66 @@ These changes have been made during development of `8.0.0`. You may skip this se - Extract OpenTelemetry `URL_PATH` span attribute into description ([#3933](https://github.com/getsentry/sentry-java/pull/3933)) - Replace OpenTelemetry `ContextStorage` wrapper with `ContextStorageProvider` ([#3938](https://github.com/getsentry/sentry-java/pull/3938)) - - The wrapper had to be put in place before any call to `Context` whereas `ContextStorageProvider` is automatically invoked at the correct time. + - The wrapper had to be put in place before any call to `Context` whereas `ContextStorageProvider` is automatically invoked at the correct time. - Send `otel.kind` to Sentry ([#3907](https://github.com/getsentry/sentry-java/pull/3907)) - Spring Boot now automatically detects if OpenTelemetry is available and makes use of it ([#3846](https://github.com/getsentry/sentry-java/pull/3846)) - - This is only enabled if there is no OpenTelemetry agent available - - We prefer to use the OpenTelemetry agent as it offers more auto instrumentation - - In some cases the OpenTelemetry agent cannot be used, please see https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/ for more details on when to prefer the Agent and when the Spring Boot starter makes more sense. - - In this mode the SDK makes use of the `OpenTelemetry` bean that is created by `opentelemetry-spring-boot-starter` instead of `GlobalOpenTelemetry` + - This is only enabled if there is no OpenTelemetry agent available + - We prefer to use the OpenTelemetry agent as it offers more auto instrumentation + - In some cases the OpenTelemetry agent cannot be used, please see https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/ for more details on when to prefer the Agent and when the Spring Boot starter makes more sense. + - In this mode the SDK makes use of the `OpenTelemetry` bean that is created by `opentelemetry-spring-boot-starter` instead of `GlobalOpenTelemetry` - Spring Boot now automatically detects our OpenTelemetry agent if its auto init is disabled ([#3848](https://github.com/getsentry/sentry-java/pull/3848)) - - This means Spring Boot config mechanisms can now be combined with our OpenTelemetry agent - - The `sentry-opentelemetry-extra` module has been removed again, most classes have been moved to `sentry-opentelemetry-bootstrap` which is loaded into the bootstrap classloader (i.e. `null`) when our Java agent is used. The rest has been moved into `sentry-opentelemetry-agentcustomization` and is loaded into the agent classloader when our Java agent is used. - - The `sentry-opentelemetry-bootstrap` and `sentry-opentelemetry-agentcustomization` modules can be used without the agent as well, in which case all classes are loaded into the application classloader. Check out our `sentry-samples-spring-boot-jakarta-opentelemetry-noagent` sample. - - In this mode the SDK makes use of `GlobalOpenTelemetry` + - This means Spring Boot config mechanisms can now be combined with our OpenTelemetry agent + - The `sentry-opentelemetry-extra` module has been removed again, most classes have been moved to `sentry-opentelemetry-bootstrap` which is loaded into the bootstrap classloader (i.e. `null`) when our Java agent is used. The rest has been moved into `sentry-opentelemetry-agentcustomization` and is loaded into the agent classloader when our Java agent is used. + - The `sentry-opentelemetry-bootstrap` and `sentry-opentelemetry-agentcustomization` modules can be used without the agent as well, in which case all classes are loaded into the application classloader. Check out our `sentry-samples-spring-boot-jakarta-opentelemetry-noagent` sample. + - In this mode the SDK makes use of `GlobalOpenTelemetry` - Automatically set span factory based on presence of OpenTelemetry ([#3858](https://github.com/getsentry/sentry-java/pull/3858)) - - `SentrySpanFactoryHolder` has been removed as it is no longer required. + - `SentrySpanFactoryHolder` has been removed as it is no longer required. - Replace deprecated `SimpleInstrumentation` with `SimplePerformantInstrumentation` for graphql 22 ([#3974](https://github.com/getsentry/sentry-java/pull/3974)) - We now hold a strong reference to the underlying OpenTelemetry span when it is created through Sentry API ([#3997](https://github.com/getsentry/sentry-java/pull/3997)) - - This keeps it from being garbage collected too early + - This keeps it from being garbage collected too early - Defer sampling decision by setting `sampled` to `null` in `PropagationContext` when using OpenTelemetry in case of an incoming defer sampling `sentry-trace` header. ([#3945](https://github.com/getsentry/sentry-java/pull/3945)) - Build `PropagationContext` from `SamplingDecision` made by `SentrySampler` instead of parsing headers and potentially ignoring a sampling decision in case a `sentry-trace` header comes in with deferred sampling decision. ([#3947](https://github.com/getsentry/sentry-java/pull/3947)) - The Sentry OpenTelemetry Java agent now makes sure Sentry `Scopes` storage is initialized even if the agents auto init is disabled ([#3848](https://github.com/getsentry/sentry-java/pull/3848)) - - This is required for all integrations to work together with our OpenTelemetry Java agent if its auto init has been disabled and the SDKs init should be used instead. + - This is required for all integrations to work together with our OpenTelemetry Java agent if its auto init has been disabled and the SDKs init should be used instead. - Fix `startChild` for span that is not in current OpenTelemetry `Context` ([#3862](https://github.com/getsentry/sentry-java/pull/3862)) - - Starting a child span from a transaction that wasn't in the current `Context` lead to multiple transactions being created (one for the transaction and another per span created). + - Starting a child span from a transaction that wasn't in the current `Context` lead to multiple transactions being created (one for the transaction and another per span created). - Add `auto.graphql.graphql22` to ignored span origins when using OpenTelemetry ([#3828](https://github.com/getsentry/sentry-java/pull/3828)) - Use OpenTelemetry span name as fallback for transaction name ([#3557](https://github.com/getsentry/sentry-java/pull/3557)) - - In certain cases we were sending transactions as "" when using OpenTelemetry + - In certain cases we were sending transactions as "" when using OpenTelemetry - Add OpenTelemetry span data to Sentry span ([#3593](https://github.com/getsentry/sentry-java/pull/3593)) - No longer selectively copy OpenTelemetry attributes to Sentry spans / transactions `data` ([#3663](https://github.com/getsentry/sentry-java/pull/3663)) - Remove `PROCESS_COMMAND_ARGS` (`process.command_args`) OpenTelemetry span attribute as it can be very large ([#3664](https://github.com/getsentry/sentry-java/pull/3664)) - Use RECORD_ONLY sampling decision if performance is disabled ([#3659](https://github.com/getsentry/sentry-java/pull/3659)) - - Also fix check whether Performance is enabled when making a sampling decision in the OpenTelemetry sampler + - Also fix check whether Performance is enabled when making a sampling decision in the OpenTelemetry sampler - Sentry OpenTelemetry Java Agent now sets Instrumenter to SENTRY (used to be OTEL) ([#3697](https://github.com/getsentry/sentry-java/pull/3697)) - Set span origin in `ActivityLifecycleIntegration` on span options instead of after creating the span / transaction ([#3702](https://github.com/getsentry/sentry-java/pull/3702)) - - This allows spans to be filtered by span origin on creation + - This allows spans to be filtered by span origin on creation - Honor ignored span origins in `SentryTracer.startChild` ([#3704](https://github.com/getsentry/sentry-java/pull/3704)) - Use span id of remote parent ([#3548](https://github.com/getsentry/sentry-java/pull/3548)) - - Traces were broken because on an incoming request, OtelSentrySpanProcessor did not set the parentSpanId on the span correctly. Traces were not referencing the actual parent span but some other (random) span ID which the server doesn't know. + - Traces were broken because on an incoming request, OtelSentrySpanProcessor did not set the parentSpanId on the span correctly. Traces were not referencing the actual parent span but some other (random) span ID which the server doesn't know. - Attach active span to scope when using OpenTelemetry ([#3549](https://github.com/getsentry/sentry-java/pull/3549)) - - Errors weren't linked to traces correctly due to parts of the SDK not knowing the current span + - Errors weren't linked to traces correctly due to parts of the SDK not knowing the current span - Record dropped spans in client report when sampling out OpenTelemetry spans ([#3552](https://github.com/getsentry/sentry-java/pull/3552)) - Retrieve the correct current span from `Scope`/`Scopes` when using OpenTelemetry ([#3554](https://github.com/getsentry/sentry-java/pull/3554)) - Support spans that are split into multiple batches ([#3539](https://github.com/getsentry/sentry-java/pull/3539)) - - When spans belonging to a single transaction were split into multiple batches for SpanExporter, we did not add all spans because the isSpanTooOld check wasn't inverted. + - When spans belonging to a single transaction were split into multiple batches for SpanExporter, we did not add all spans because the isSpanTooOld check wasn't inverted. - Partially fix bootstrap class loading ([#3543](https://github.com/getsentry/sentry-java/pull/3543)) - - There was a problem with two separate Sentry `Scopes` being active inside each OpenTelemetry `Context` due to using context keys from more than one class loader. + - There was a problem with two separate Sentry `Scopes` being active inside each OpenTelemetry `Context` due to using context keys from more than one class loader. - The Spring Boot 3 WebFlux sample now uses our GraphQL v22 integration ([#3828](https://github.com/getsentry/sentry-java/pull/3828)) - Do not ignore certain span origins for OpenTelemetry without agent ([#3856](https://github.com/getsentry/sentry-java/pull/3856)) - `span.startChild` now uses `.makeCurrent()` by default ([#3544](https://github.com/getsentry/sentry-java/pull/3544)) - - This caused an issue where the span tree wasn't correct because some spans were not added to their direct parent + - This caused an issue where the span tree wasn't correct because some spans were not added to their direct parent - Do not set the exception group marker when there is a suppressed exception ([#4056](https://github.com/getsentry/sentry-java/pull/4056)) - - Due to how grouping works in Sentry currently sometimes the suppressed exception is treated as the main exception. This change ensures we keep using the main exception and not change how grouping works. - - As a consequence the list of exceptions in the group on top of an issue is no longer shown in Sentry UI. - - We are planning to improve this in the future but opted for this fix first. + - Due to how grouping works in Sentry currently sometimes the suppressed exception is treated as the main exception. This change ensures we keep using the main exception and not change how grouping works. + - As a consequence the list of exceptions in the group on top of an issue is no longer shown in Sentry UI. + - We are planning to improve this in the future but opted for this fix first. ### Dependencies - Bump Native SDK from v0.7.0 to v0.7.17 ([#3441](https://github.com/getsentry/sentry-java/pull/3189)) ([#3851](https://github.com/getsentry/sentry-java/pull/3851)) ([#3914](https://github.com/getsentry/sentry-java/pull/3914)) ([#4003](https://github.com/getsentry/sentry-java/pull/4003)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0717) - - [diff](https://github.com/getsentry/sentry-native/compare/0.7.0...0.7.17) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0717) + - [diff](https://github.com/getsentry/sentry-native/compare/0.7.0...0.7.17) - Bump OpenTelemetry to 1.44.1, OpenTelemetry Java Agent to 2.10.0 and Semantic Conventions to 1.28.0 ([#3668](https://github.com/getsentry/sentry-java/pull/3668)) ([#3935](https://github.com/getsentry/sentry-java/pull/3935)) ### Migration Guide / Deprecations @@ -1678,10 +1689,10 @@ These changes have been made during development of `8.0.0`. You may skip this se Please take a look at [our migration guide in docs](https://docs.sentry.io/platforms/java/migration/7.x-to-8.0). - `Hub` has been deprecated, we're replacing the following: - - `IHub` has been replaced by `IScopes`, however you should be able to simply pass `IHub` instances to code expecting `IScopes`, allowing for an easier migration. - - `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()` - - The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead - - Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced. + - `IHub` has been replaced by `IScopes`, however you should be able to simply pass `IHub` instances to code expecting `IScopes`, allowing for an easier migration. + - `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()` + - The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead + - Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced. - `Sentry.popScope` has been replaced by calling `.close()` on the token returned by `Sentry.pushScope()` and `Sentry.pushIsolationScope()`. The token can also be used in a `try` block like this: ``` @@ -1692,28 +1703,27 @@ try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) { as well as: - ``` try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) { // this block has its separate isolation scope } ``` + - Classes used by our previous OpenTelemetry integration have been deprecated (`SentrySpanProcessor`, `SentryPropagator`, `OpenTelemetryLinkErrorEventProcessor`). Please take a look at [docs](https://docs.sentry.io/platforms/java/tracing/instrumentation/opentelemetry/) on how to setup OpenTelemetry in v8. You may also use `LifecycleHelper.close(token)`, e.g. in case you need to pass the token around for closing later. - ### Changes from `rc.4` If you have been using `8.0.0-rc.4` of the Java SDK, here's the new changes that have been included in the `8.0.0` release: - Make `SentryClient` constructor public ([#4045](https://github.com/getsentry/sentry-java/pull/4045)) - The user ip-address is now only set to `"{{auto}}"` if sendDefaultPii is enabled ([#4072](https://github.com/getsentry/sentry-java/pull/4072)) - - This change gives you control over IP address collection directly on the client + - This change gives you control over IP address collection directly on the client - Do not set the exception group marker when there is a suppressed exception ([#4056](https://github.com/getsentry/sentry-java/pull/4056)) - - Due to how grouping works in Sentry currently sometimes the suppressed exception is treated as the main exception. This change ensures we keep using the main exception and not change how grouping works. - - As a consequence the list of exceptions in the group on top of an issue is no longer shown in Sentry UI. - - We are planning to improve this in the future but opted for this fix first. + - Due to how grouping works in Sentry currently sometimes the suppressed exception is treated as the main exception. This change ensures we keep using the main exception and not change how grouping works. + - As a consequence the list of exceptions in the group on top of an issue is no longer shown in Sentry UI. + - We are planning to improve this in the future but opted for this fix first. - Fix swallow NDK loadLibrary errors ([#4082](https://github.com/getsentry/sentry-java/pull/4082)) ## 7.22.6 @@ -1724,7 +1734,7 @@ If you have been using `8.0.0-rc.4` of the Java SDK, here's the new changes that - Improve low memory breadcrumb capturing ([#4325](https://github.com/getsentry/sentry-java/pull/4325)) - Make `SystemEventsBreadcrumbsIntegration` faster ([#4330](https://github.com/getsentry/sentry-java/pull/4330)) - Fix unregister `SystemEventsBroadcastReceiver` when entering background ([#4338](https://github.com/getsentry/sentry-java/pull/4338)) - - This should reduce ANRs seen with this class in the stack trace for Android 14 and above + - This should reduce ANRs seen with this class in the stack trace for Android 14 and above - Pre-load modules on a background thread upon SDK init ([#4348](https://github.com/getsentry/sentry-java/pull/4348)) - Session Replay: Fix inconsistent `segment_id` ([#4471](https://github.com/getsentry/sentry-java/pull/4471)) - Session Replay: Do not capture current replay for cached events from the past ([#4474](https://github.com/getsentry/sentry-java/pull/4474)) @@ -1772,11 +1782,11 @@ If you have been using `8.0.0-rc.4` of the Java SDK, here's the new changes that ### Fixes - Session Replay: Fix various crashes and issues ([#4135](https://github.com/getsentry/sentry-java/pull/4135)) - - Fix `FileNotFoundException` when trying to read/write `.ongoing_segment` file - - Fix `IllegalStateException` when registering `onDrawListener` - - Fix SIGABRT native crashes on Motorola devices when encoding a video + - Fix `FileNotFoundException` when trying to read/write `.ongoing_segment` file + - Fix `IllegalStateException` when registering `onDrawListener` + - Fix SIGABRT native crashes on Motorola devices when encoding a video - (Jetpack Compose) Modifier.sentryTag now uses Modifier.Node ([#4029](https://github.com/getsentry/sentry-java/pull/4029)) - - This allows Composables that use this modifier to be skippable + - This allows Composables that use this modifier to be skippable ## 7.21.0 @@ -1790,7 +1800,7 @@ If you have been using `8.0.0-rc.4` of the Java SDK, here's the new changes that ### Behavioural Changes - (changed in [7.20.1](https://github.com/getsentry/sentry-java/releases/tag/7.20.1)) The user ip-address is now only set to `"{{auto}}"` if sendDefaultPii is enabled ([#4071](https://github.com/getsentry/sentry-java/pull/4071)) - - This change gives you control over IP address collection directly on the client + - This change gives you control over IP address collection directly on the client - Reduce the number of broadcasts the SDK is subscribed for ([#4052](https://github.com/getsentry/sentry-java/pull/4052)) - Drop `TempSensorBreadcrumbsIntegration` - Drop `PhoneStateBreadcrumbsIntegration` @@ -1839,7 +1849,7 @@ If you would like to keep some of the default broadcast events as breadcrumbs, c ### Behavioural Changes - The user ip-address is now only set to `"{{auto}}"` if sendDefaultPii is enabled ([#4071](https://github.com/getsentry/sentry-java/pull/4071)) - - This change gives you control over IP address collection directly on the client + - This change gives you control over IP address collection directly on the client ## 7.20.0 @@ -1849,23 +1859,23 @@ If you would like to keep some of the default broadcast events as breadcrumbs, c To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onErrorSampleRate` options. - ```kotlin - import io.sentry.SentryReplayOptions - import io.sentry.android.core.SentryAndroid +```kotlin +import io.sentry.SentryReplayOptions +import io.sentry.android.core.SentryAndroid - SentryAndroid.init(context) { options -> - - options.sessionReplay.sessionSampleRate = 1.0 - options.sessionReplay.onErrorSampleRate = 1.0 - - // To change default redaction behavior (defaults to true) - options.sessionReplay.redactAllImages = true - options.sessionReplay.redactAllText = true - - // To change quality of the recording (defaults to MEDIUM) - options.sessionReplay.quality = SentryReplayOptions.SentryReplayQuality.MEDIUM // (LOW|MEDIUM|HIGH) - } - ``` +SentryAndroid.init(context) { options -> + + options.sessionReplay.sessionSampleRate = 1.0 + options.sessionReplay.onErrorSampleRate = 1.0 + + // To change default redaction behavior (defaults to true) + options.sessionReplay.redactAllImages = true + options.sessionReplay.redactAllText = true + + // To change quality of the recording (defaults to MEDIUM) + options.sessionReplay.quality = SentryReplayOptions.SentryReplayQuality.MEDIUM // (LOW|MEDIUM|HIGH) +} +``` ### Fixes @@ -1899,16 +1909,16 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ### Fixes - Session Replay: fix various crashes and issues ([#3970](https://github.com/getsentry/sentry-java/pull/3970)) - - Fix `IndexOutOfBoundsException` when tracking window changes - - Fix `IllegalStateException` when adding/removing draw listener for a dead view - - Fix `ConcurrentModificationException` when registering window listeners and stopping `WindowRecorder`/`GestureRecorder` + - Fix `IndexOutOfBoundsException` when tracking window changes + - Fix `IllegalStateException` when adding/removing draw listener for a dead view + - Fix `ConcurrentModificationException` when registering window listeners and stopping `WindowRecorder`/`GestureRecorder` - Add support for setting sentry-native handler_strategy ([#3671](https://github.com/getsentry/sentry-java/pull/3671)) ### Dependencies - Bump Native SDK from v0.7.8 to v0.7.16 ([#3671](https://github.com/getsentry/sentry-java/pull/3671)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0716) - - [diff](https://github.com/getsentry/sentry-native/compare/0.7.8...0.7.16) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0716) + - [diff](https://github.com/getsentry/sentry-native/compare/0.7.8...0.7.16) ## 7.18.1 @@ -1921,7 +1931,7 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ### Features - Android 15: Add support for 16KB page sizes ([#3620](https://github.com/getsentry/sentry-java/pull/3620)) - - See https://developer.android.com/guide/practices/page-sizes for more details + - See https://developer.android.com/guide/practices/page-sizes for more details - Session Replay: Add `beforeSendReplay` callback ([#3855](https://github.com/getsentry/sentry-java/pull/3855)) - Session Replay: Add support for masking/unmasking view containers ([#3881](https://github.com/getsentry/sentry-java/pull/3881)) @@ -1930,14 +1940,14 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE - Avoid collecting normal frames ([#3782](https://github.com/getsentry/sentry-java/pull/3782)) - Ensure android initialization process continues even if options configuration block throws an exception ([#3887](https://github.com/getsentry/sentry-java/pull/3887)) - Do not report parsing ANR error when there are no threads ([#3888](https://github.com/getsentry/sentry-java/pull/3888)) - - This should significantly reduce the number of events with message "Sentry Android SDK failed to parse system thread dump..." reported + - This should significantly reduce the number of events with message "Sentry Android SDK failed to parse system thread dump..." reported - Session Replay: Disable replay in session mode when rate limit is active ([#3854](https://github.com/getsentry/sentry-java/pull/3854)) ### Dependencies - Bump Native SDK from v0.7.2 to v0.7.8 ([#3620](https://github.com/getsentry/sentry-java/pull/3620)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078) - - [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078) + - [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8) ## 7.17.0 @@ -1951,8 +1961,8 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE - Using MaxBreadcrumb with value 0 no longer crashes. ([#3836](https://github.com/getsentry/sentry-java/pull/3836)) - Accept manifest integer values when requiring floating values ([#3823](https://github.com/getsentry/sentry-java/pull/3823)) - Fix standalone tomcat jndi issue ([#3873](https://github.com/getsentry/sentry-java/pull/3873)) - - Using Sentry Spring Boot on a standalone tomcat caused the following error: - - Failed to bind properties under 'sentry.parsed-dsn' to io.sentry.Dsn + - Using Sentry Spring Boot on a standalone tomcat caused the following error: + - Failed to bind properties under 'sentry.parsed-dsn' to io.sentry.Dsn ## 7.16.0 @@ -1976,7 +1986,7 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ### Breaking changes -- The method `addIntegrationToSdkVersion(Ljava/lang/Class;)V` has been removed from the core (`io.sentry:sentry`) package. Please make sure all of the packages (e.g. `io.sentry:sentry-android-core`, `io.sentry:sentry-android-fragment`, `io.sentry:sentry-okhttp` and others) are all aligned and using the same version to prevent the `NoSuchMethodError` exception. +- The method `addIntegrationToSdkVersion(Ljava/lang/Class;)V` has been removed from the core (`io.sentry:sentry`) package. Please make sure all of the packages (e.g. `io.sentry:sentry-android-core`, `io.sentry:sentry-android-fragment`, `io.sentry:sentry-okhttp` and others) are all aligned and using the same version to prevent the `NoSuchMethodError` exception. ## 7.16.0-alpha.1 @@ -2003,12 +2013,12 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE - Add support for `feedback` envelope header item type ([#3687](https://github.com/getsentry/sentry-java/pull/3687)) - Add breadcrumb.origin field ([#3727](https://github.com/getsentry/sentry-java/pull/3727)) - Session Replay: Add options to selectively mask/unmask views captured in replay. The following options are available: ([#3689](https://github.com/getsentry/sentry-java/pull/3689)) - - `android:tag="sentry-mask|sentry-unmask"` in XML or `view.setTag("sentry-mask|sentry-unmask")` in code tags - - if you already have a tag set for a view, you can set a tag by id: `` in XML or `view.setTag(io.sentry.android.replay.R.id.sentry_privacy, "mask|unmask")` in code - - `view.sentryReplayMask()` or `view.sentryReplayUnmask()` extension functions - - mask/unmask `View`s of a certain type by adding fully-qualified classname to one of the lists `options.experimental.sessionReplay.addMaskViewClass()` or `options.experimental.sessionReplay.addUnmaskViewClass()`. Note, that all of the view subclasses/subtypes will be masked/unmasked as well - - For example, (this is already a default behavior) to mask all `TextView`s and their subclasses (`RadioButton`, `EditText`, etc.): `options.experimental.sessionReplay.addMaskViewClass("android.widget.TextView")` - - If you're using code obfuscation, adjust your proguard-rules accordingly, so your custom view class name is not minified + - `android:tag="sentry-mask|sentry-unmask"` in XML or `view.setTag("sentry-mask|sentry-unmask")` in code tags + - if you already have a tag set for a view, you can set a tag by id: `` in XML or `view.setTag(io.sentry.android.replay.R.id.sentry_privacy, "mask|unmask")` in code + - `view.sentryReplayMask()` or `view.sentryReplayUnmask()` extension functions + - mask/unmask `View`s of a certain type by adding fully-qualified classname to one of the lists `options.experimental.sessionReplay.addMaskViewClass()` or `options.experimental.sessionReplay.addUnmaskViewClass()`. Note, that all of the view subclasses/subtypes will be masked/unmasked as well + - For example, (this is already a default behavior) to mask all `TextView`s and their subclasses (`RadioButton`, `EditText`, etc.): `options.experimental.sessionReplay.addMaskViewClass("android.widget.TextView")` + - If you're using code obfuscation, adjust your proguard-rules accordingly, so your custom view class name is not minified - Session Replay: Support Jetpack Compose masking ([#3739](https://github.com/getsentry/sentry-java/pull/3739)) - To selectively mask/unmask @Composables, use `Modifier.sentryReplayMask()` and `Modifier.sentryReplayUnmask()` modifiers - Session Replay: Mask `WebView`, `VideoView` and `androidx.media3.ui.PlayerView` by default ([#3775](https://github.com/getsentry/sentry-java/pull/3775)) @@ -2022,7 +2032,7 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE - Fix potential ANRs due to default integrations ([#3778](https://github.com/getsentry/sentry-java/pull/3778)) - Lazily initialize heavy `SentryOptions` members to avoid ANRs on app start ([#3749](https://github.com/getsentry/sentry-java/pull/3749)) -*Breaking changes*: +_Breaking changes_: - `options.experimental.sessionReplay.errorSampleRate` was renamed to `options.experimental.sessionReplay.onErrorSampleRate` ([#3637](https://github.com/getsentry/sentry-java/pull/3637)) - Manifest option `io.sentry.session-replay.error-sample-rate` was renamed to `io.sentry.session-replay.on-error-sample-rate` ([#3637](https://github.com/getsentry/sentry-java/pull/3637)) @@ -2092,15 +2102,15 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE import io.sentry.android.core.SentryAndroid SentryAndroid.init(context) { options -> - + // Currently under experimental options: options.experimental.sessionReplay.sessionSampleRate = 1.0 options.experimental.sessionReplay.errorSampleRate = 1.0 - + // To change default redaction behavior (defaults to true) options.experimental.sessionReplay.redactAllImages = true options.experimental.sessionReplay.redactAllText = true - + // To change quality of the recording (defaults to MEDIUM) options.experimental.sessionReplay.quality = SentryReplayOptions.SentryReplayQuality.MEDIUM // (LOW|MEDIUM|HIGH) } @@ -2189,7 +2199,7 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ### Features -- Experimental: Add support for Sentry Developer Metrics ([#3205](https://github.com/getsentry/sentry-java/pull/3205), [#3238](https://github.com/getsentry/sentry-java/pull/3238), [#3248](https://github.com/getsentry/sentry-java/pull/3248), [#3250](https://github.com/getsentry/sentry-java/pull/3250)) +- Experimental: Add support for Sentry Developer Metrics ([#3205](https://github.com/getsentry/sentry-java/pull/3205), [#3238](https://github.com/getsentry/sentry-java/pull/3238), [#3248](https://github.com/getsentry/sentry-java/pull/3248), [#3250](https://github.com/getsentry/sentry-java/pull/3250)) Use the Metrics API to track processing time, download sizes, user signups, and conversion rates and correlate them back to tracing data in order to get deeper insights and solve issues faster. Our API supports counters, distributions, sets, gauges and timers, and it's easy to get started: ```kotlin Sentry.metrics() @@ -2233,8 +2243,8 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE - (perf-v2): Calculate frame delay on a span level ([#3197](https://github.com/getsentry/sentry-java/pull/3197)) - Resolve spring properties in @SentryCheckIn annotation ([#3194](https://github.com/getsentry/sentry-java/pull/3194)) - Experimental: Add Spotlight integration ([#3166](https://github.com/getsentry/sentry-java/pull/3166)) - - For more details about Spotlight head over to https://spotlightjs.com/ - - Set `options.isEnableSpotlight = true` to enable Spotlight + - For more details about Spotlight head over to https://spotlightjs.com/ + - Set `options.isEnableSpotlight = true` to enable Spotlight ### Fixes @@ -2248,12 +2258,12 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ### Features - Added App Start profiling - - This depends on the new option `io.sentry.profiling.enable-app-start`, other than the already existing `io.sentry.traces.profiling.sample-rate`. - - Sampler functions can check the new `isForNextAppStart` flag, to adjust startup profiling sampling programmatically. - Relevant PRs: - - Decouple Profiler from Transaction ([#3101](https://github.com/getsentry/sentry-java/pull/3101)) - - Add options and sampling logic ([#3121](https://github.com/getsentry/sentry-java/pull/3121)) - - Add ContentProvider and start profile ([#3128](https://github.com/getsentry/sentry-java/pull/3128)) + - This depends on the new option `io.sentry.profiling.enable-app-start`, other than the already existing `io.sentry.traces.profiling.sample-rate`. + - Sampler functions can check the new `isForNextAppStart` flag, to adjust startup profiling sampling programmatically. + Relevant PRs: + - Decouple Profiler from Transaction ([#3101](https://github.com/getsentry/sentry-java/pull/3101)) + - Add options and sampling logic ([#3121](https://github.com/getsentry/sentry-java/pull/3121)) + - Add ContentProvider and start profile ([#3128](https://github.com/getsentry/sentry-java/pull/3128)) - Extend internal performance collector APIs ([#3102](https://github.com/getsentry/sentry-java/pull/3102)) - Collect slow and frozen frames for spans using `OnFrameMetricsAvailableListener` ([#3111](https://github.com/getsentry/sentry-java/pull/3111)) - Interpolate total frame count to match span duration ([#3158](https://github.com/getsentry/sentry-java/pull/3158)) @@ -2335,8 +2345,9 @@ To enable Replay use the `sessionReplay.sessionSampleRate` or `sessionReplay.onE ## 7.0.0 Version 7 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are: + - Bumping `minSdk` level to 19 (Android 4.4) -- The SDK will now listen to connectivity changes and try to re-upload cached events when internet connection is re-established additionally to uploading events on app restart +- The SDK will now listen to connectivity changes and try to re-upload cached events when internet connection is re-established additionally to uploading events on app restart - `Sentry.getSpan` now returns the root transaction, which should improve the span hierarchy and make it leaner - Multiple improvements to reduce probability of the SDK causing ANRs - New `sentry-okhttp` artifact is unbundled from Android and can be used in pure JVM-only apps @@ -2370,8 +2381,8 @@ Similarly, if you have a Sentry SDK (e.g. `sentry-android-core`) dependency on o - `SentryOkHttpUtils` was removed from public API as it's been exposed by mistake ([#3005](https://github.com/getsentry/sentry-java/pull/3005)) - `Scope` now implements the `IScope` interface, therefore some methods like `ScopeCallback.run` accept `IScope` now ([#3066](https://github.com/getsentry/sentry-java/pull/3066)) - Cleanup `startTransaction` overloads ([#2964](https://github.com/getsentry/sentry-java/pull/2964)) - - We have reduced the number of overloads by allowing to pass in a `TransactionOptions` object instead of having separate parameters for certain options - - `TransactionOptions` has defaults set and can be customized, for example: + - We have reduced the number of overloads by allowing to pass in a `TransactionOptions` object instead of having separate parameters for certain options + - `TransactionOptions` has defaults set and can be customized, for example: ```kotlin // old @@ -2384,14 +2395,14 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app - Android only: `Sentry.getSpan()` returns the root span/transaction instead of the latest span ([#2855](https://github.com/getsentry/sentry-java/pull/2855)) - Capture failed HTTP and GraphQL (Apollo) requests by default ([#2794](https://github.com/getsentry/sentry-java/pull/2794)) - - This can increase your event consumption and may affect your quota, because we will report failed network requests as Sentry events by default, if you're using the `sentry-android-okhttp` or `sentry-apollo-3` integrations. You can customize what errors you want/don't want to have reported for [OkHttp](https://docs.sentry.io/platforms/android/integrations/okhttp#http-client-errors) and [Apollo3](https://docs.sentry.io/platforms/android/integrations/apollo3#graphql-client-errors) respectively. + - This can increase your event consumption and may affect your quota, because we will report failed network requests as Sentry events by default, if you're using the `sentry-android-okhttp` or `sentry-apollo-3` integrations. You can customize what errors you want/don't want to have reported for [OkHttp](https://docs.sentry.io/platforms/android/integrations/okhttp#http-client-errors) and [Apollo3](https://docs.sentry.io/platforms/android/integrations/apollo3#graphql-client-errors) respectively. - Measure AppStart time till First Draw instead of `onResume` ([#2851](https://github.com/getsentry/sentry-java/pull/2851)) - Automatic user interaction tracking: every click now starts a new automatic transaction ([#2891](https://github.com/getsentry/sentry-java/pull/2891)) - - Previously performing a click on the same UI widget twice would keep the existing transaction running, the new behavior now better aligns with other SDKs + - Previously performing a click on the same UI widget twice would keep the existing transaction running, the new behavior now better aligns with other SDKs - Add deadline timeout for automatic transactions ([#2865](https://github.com/getsentry/sentry-java/pull/2865)) - - This affects all automatically generated transactions on Android (UI, clicks), the default timeout is 30s, meaning the automatic transaction will be force-finished with status `deadline_exceeded` when reaching the deadline + - This affects all automatically generated transactions on Android (UI, clicks), the default timeout is 30s, meaning the automatic transaction will be force-finished with status `deadline_exceeded` when reaching the deadline - Set ip_address to {{auto}} by default, even if sendDefaultPII is disabled ([#2860](https://github.com/getsentry/sentry-java/pull/2860)) - - Instead use the "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io + - Instead use the "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io - Raw logback message and parameters are now guarded by `sendDefaultPii` if an `encoder` has been configured ([#2976](https://github.com/getsentry/sentry-java/pull/2976)) - The `maxSpans` setting (defaults to 1000) is enforced for nested child spans which means a single transaction can have `maxSpans` number of children (nested or not) at most ([#3065](https://github.com/getsentry/sentry-java/pull/3065)) - The `ScopeCallback` in `withScope` is now always executed ([#3066](https://github.com/getsentry/sentry-java/pull/3066)) @@ -2405,8 +2416,8 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app ### Features - Observe network state to upload any unsent envelopes ([#2910](https://github.com/getsentry/sentry-java/pull/2910)) - - Android: it works out-of-the-box as part of the default `SendCachedEnvelopeIntegration` - - JVM: you'd have to install `SendCachedEnvelopeFireAndForgetIntegration` as mentioned in https://docs.sentry.io/platforms/java/configuration/#configuring-offline-caching and provide your own implementation of `IConnectionStatusProvider` via `SentryOptions` + - Android: it works out-of-the-box as part of the default `SendCachedEnvelopeIntegration` + - JVM: you'd have to install `SendCachedEnvelopeFireAndForgetIntegration` as mentioned in https://docs.sentry.io/platforms/java/configuration/#configuring-offline-caching and provide your own implementation of `IConnectionStatusProvider` via `SentryOptions` - Add `sentry-okhttp` module to support instrumenting OkHttp in non-Android projects ([#3005](https://github.com/getsentry/sentry-java/pull/3005)) - Do not filter out Sentry SDK frames in case of uncaught exceptions ([#3021](https://github.com/getsentry/sentry-java/pull/3021)) - Do not try to send and drop cached envelopes when rate-limiting is active ([#2937](https://github.com/getsentry/sentry-java/pull/2937)) @@ -2414,16 +2425,16 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app ### Fixes - Use `getMyMemoryState()` instead of `getRunningAppProcesses()` to retrieve process importance ([#3004](https://github.com/getsentry/sentry-java/pull/3004)) - - This should prevent some app stores from flagging apps as violating their privacy + - This should prevent some app stores from flagging apps as violating their privacy - Reduce flush timeout to 4s on Android to avoid ANRs ([#2858](https://github.com/getsentry/sentry-java/pull/2858)) - Reduce timeout of AsyncHttpTransport to avoid ANR ([#2879](https://github.com/getsentry/sentry-java/pull/2879)) - Do not overwrite UI transaction status if set by the user ([#2852](https://github.com/getsentry/sentry-java/pull/2852)) - Capture unfinished transaction on Scope with status `aborted` in case a crash happens ([#2938](https://github.com/getsentry/sentry-java/pull/2938)) - - This will fix the link between transactions and corresponding crashes, you'll be able to see them in a single trace + - This will fix the link between transactions and corresponding crashes, you'll be able to see them in a single trace - Fix Coroutine Context Propagation using CopyableThreadContextElement ([#2838](https://github.com/getsentry/sentry-java/pull/2838)) - Fix don't overwrite the span status of unfinished spans ([#2859](https://github.com/getsentry/sentry-java/pull/2859)) - Migrate from `default` interface methods to proper implementations in each interface implementor ([#2847](https://github.com/getsentry/sentry-java/pull/2847)) - - This prevents issues when using the SDK on older AGP versions (< 4.x.x) + - This prevents issues when using the SDK on older AGP versions (< 4.x.x) - Reduce main thread work on init ([#3036](https://github.com/getsentry/sentry-java/pull/3036)) - Move Integrations registration to background on init ([#3043](https://github.com/getsentry/sentry-java/pull/3043)) - Fix `SentryOkHttpInterceptor.BeforeSpanCallback` was not finishing span when it was dropped ([#2958](https://github.com/getsentry/sentry-java/pull/2958)) @@ -2442,7 +2453,7 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app ### Fixes -- Fix SIGSEV, SIGABRT and SIGBUS crashes happening after/around the August Google Play System update, see [#2955](https://github.com/getsentry/sentry-java/issues/2955) for more details (fix provided by Native SDK bump) +- Fix SIGSEV, SIGABRT and SIGBUS crashes happening after/around the August Google Play System update, see [#2955](https://github.com/getsentry/sentry-java/issues/2955) for more details (fix provided by Native SDK bump) - Ensure DSN uses http/https protocol ([#3044](https://github.com/getsentry/sentry-java/pull/3044)) ### Dependencies @@ -2455,7 +2466,7 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app ### Fixes -- Fix SIGSEV, SIGABRT and SIGBUS crashes happening after/around the August Google Play System update, see [#2955](https://github.com/getsentry/sentry-java/issues/2955) for more details (fix provided by Native SDK bump) +- Fix SIGSEV, SIGABRT and SIGBUS crashes happening after/around the August Google Play System update, see [#2955](https://github.com/getsentry/sentry-java/issues/2955) for more details (fix provided by Native SDK bump) ### Dependencies @@ -2567,15 +2578,15 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app - Add HTTP response code to Spring WebFlux transactions ([#2870](https://github.com/getsentry/sentry-java/pull/2870)) - Add `sampled` to Dynamic Sampling Context ([#2869](https://github.com/getsentry/sentry-java/pull/2869)) - Improve server side GraphQL support for spring-graphql and Nextflix DGS ([#2856](https://github.com/getsentry/sentry-java/pull/2856)) - - If you have already been using `SentryDataFetcherExceptionHandler` that still works but has been deprecated. Please use `SentryGenericDataFetcherExceptionHandler` combined with `SentryInstrumentation` instead for better error reporting. - - More exceptions and errors caught and reported to Sentry by also looking at the `ExecutionResult` (more specifically its `errors`) - - You may want to filter out certain errors, please see [docs on filtering](https://docs.sentry.io/platforms/java/configuration/filtering/) - - More details for Sentry events: query, variables and response (where possible) - - Breadcrumbs for operation (query, mutation, subscription), data fetchers and data loaders (Spring only) - - Better hub propagation by using `GraphQLContext` + - If you have already been using `SentryDataFetcherExceptionHandler` that still works but has been deprecated. Please use `SentryGenericDataFetcherExceptionHandler` combined with `SentryInstrumentation` instead for better error reporting. + - More exceptions and errors caught and reported to Sentry by also looking at the `ExecutionResult` (more specifically its `errors`) + - You may want to filter out certain errors, please see [docs on filtering](https://docs.sentry.io/platforms/java/configuration/filtering/) + - More details for Sentry events: query, variables and response (where possible) + - Breadcrumbs for operation (query, mutation, subscription), data fetchers and data loaders (Spring only) + - Better hub propagation by using `GraphQLContext` - Add autoconfigure modules for Spring Boot called `sentry-spring-boot` and `sentry-spring-boot-jakarta` ([#2880](https://github.com/getsentry/sentry-java/pull/2880)) - The autoconfigure modules `sentry-spring-boot` and `sentry-spring-boot-jakarta` have a `compileOnly` dependency on `spring-boot-starter` which is needed for our auto installation in [sentry-android-gradle-plugin](https://github.com/getsentry/sentry-android-gradle-plugin) - - The starter modules `sentry-spring-boot-starter` and `sentry-spring-boot-starter-jakarta` now bring `spring-boot-starter` as a dependency + - The starter modules `sentry-spring-boot-starter` and `sentry-spring-boot-starter-jakarta` now bring `spring-boot-starter` as a dependency - You can now disable Sentry by setting the `enabled` option to `false` ([#2840](https://github.com/getsentry/sentry-java/pull/2840)) ### Fixes @@ -2598,6 +2609,7 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app ## 6.26.0 ### Features + - (Internal) Extend APIs for hybrid SDKs ([#2814](https://github.com/getsentry/sentry-java/pull/2814), [#2846](https://github.com/getsentry/sentry-java/pull/2846)) ### Fixes @@ -2658,13 +2670,13 @@ val transaction = Sentry.startTransaction("name", "op", TransactionOptions().app - Add debouncing mechanism and before-capture callbacks for screenshots and view hierarchies ([#2773](https://github.com/getsentry/sentry-java/pull/2773)) - Improve ANRv2 implementation ([#2792](https://github.com/getsentry/sentry-java/pull/2792)) - Add a proguard rule to keep `ApplicationNotResponding` class from obfuscation - - Add a new option `setReportHistoricalAnrs`; when enabled, it will report all of the ANRs from the [getHistoricalExitReasons](https://developer.android.com/reference/android/app/ActivityManager?hl=en#getHistoricalProcessExitReasons(java.lang.String,%20int,%20int)) list. - By default, the SDK only reports and enriches the latest ANR and only this one counts towards ANR rate. - Worth noting that this option is mainly useful when updating the SDK to the version where ANRv2 has been introduced, to report all ANRs happened prior to the SDK update. After that, the SDK will always pick up the latest ANR from the historical exit reasons list on next app restart, so there should be no historical ANRs to report. - These ANRs are reported with the `HistoricalAppExitInfo` mechanism. - - Add a new option `setAttachAnrThreadDump` to send ANR thread dump from the system as an attachment. - This is only useful as additional information, because the SDK attempts to parse the thread dump into proper threads with stacktraces by default. - - If [ApplicationExitInfo#getTraceInputStream](https://developer.android.com/reference/android/app/ApplicationExitInfo#getTraceInputStream()) returns null, the SDK no longer reports an ANR event, as these events are not very useful without it. + - Add a new option `setReportHistoricalAnrs`; when enabled, it will report all of the ANRs from the [getHistoricalExitReasons]() list. + By default, the SDK only reports and enriches the latest ANR and only this one counts towards ANR rate. + Worth noting that this option is mainly useful when updating the SDK to the version where ANRv2 has been introduced, to report all ANRs happened prior to the SDK update. After that, the SDK will always pick up the latest ANR from the historical exit reasons list on next app restart, so there should be no historical ANRs to report. + These ANRs are reported with the `HistoricalAppExitInfo` mechanism. + - Add a new option `setAttachAnrThreadDump` to send ANR thread dump from the system as an attachment. + This is only useful as additional information, because the SDK attempts to parse the thread dump into proper threads with stacktraces by default. + - If [ApplicationExitInfo#getTraceInputStream]() returns null, the SDK no longer reports an ANR event, as these events are not very useful without it. - Enhance regex patterns for native stackframes ## 6.23.0 @@ -2680,7 +2692,7 @@ import io.sentry.apollo3.sentryTracing val apolloClient = ApolloClient.Builder() .serverUrl("https://example.com/graphql") - .sentryTracing(captureFailedRequests = true) + .sentryTracing(captureFailedRequests = true) .build() ``` @@ -2711,9 +2723,9 @@ val apolloClient = ApolloClient.Builder() ### Features - Introduce new `sentry-android-sqlite` integration ([#2722](https://github.com/getsentry/sentry-java/pull/2722)) - - This integration replaces the old `androidx.sqlite` database instrumentation in the Sentry Android Gradle plugin - - A new capability to manually instrument your `androidx.sqlite` databases. - - You can wrap your custom `SupportSQLiteOpenHelper` instance into `SentrySupportSQLiteOpenHelper(myHelper)` if you're not using the Sentry Android Gradle plugin and still benefit from performance auto-instrumentation. + - This integration replaces the old `androidx.sqlite` database instrumentation in the Sentry Android Gradle plugin + - A new capability to manually instrument your `androidx.sqlite` databases. + - You can wrap your custom `SupportSQLiteOpenHelper` instance into `SentrySupportSQLiteOpenHelper(myHelper)` if you're not using the Sentry Android Gradle plugin and still benefit from performance auto-instrumentation. - Add SentryWrapper for Callable and Supplier Interface ([#2720](https://github.com/getsentry/sentry-java/pull/2720)) - Load sentry-debug-meta.properties ([#2734](https://github.com/getsentry/sentry-java/pull/2734)) - This enables source context for Java @@ -2736,15 +2748,15 @@ val apolloClient = ApolloClient.Builder() - [View Hierarchy](https://docs.sentry.io/platforms/android/enriching-events/viewhierarchy/) support for Jetpack Compose screens - Automatic breadcrumbs for [user interactions](https://docs.sentry.io/platforms/android/performance/instrumentation/automatic-instrumentation/#user-interaction-instrumentation) - More granular http requests instrumentation with a new SentryOkHttpEventListener ([#2659](https://github.com/getsentry/sentry-java/pull/2659)) - - Create spans for time spent on: - - Proxy selection - - DNS resolution - - HTTPS setup - - Connection - - Requesting headers - - Receiving response - - You can attach the event listener to your OkHttpClient through `client.eventListener(new SentryOkHttpEventListener()).addInterceptor(new SentryOkHttpInterceptor()).build();` - - In case you already have an event listener you can use the SentryOkHttpEventListener as well through `client.eventListener(new SentryOkHttpEventListener(myListener)).addInterceptor(new SentryOkHttpInterceptor()).build();` + - Create spans for time spent on: + - Proxy selection + - DNS resolution + - HTTPS setup + - Connection + - Requesting headers + - Receiving response + - You can attach the event listener to your OkHttpClient through `client.eventListener(new SentryOkHttpEventListener()).addInterceptor(new SentryOkHttpInterceptor()).build();` + - In case you already have an event listener you can use the SentryOkHttpEventListener as well through `client.eventListener(new SentryOkHttpEventListener(myListener)).addInterceptor(new SentryOkHttpInterceptor()).build();` - Add a new option to disable `RootChecker` ([#2735](https://github.com/getsentry/sentry-java/pull/2735)) ### Fixes @@ -2765,16 +2777,16 @@ val apolloClient = ApolloClient.Builder() - Add Screenshot and ViewHierarchy to integrations list ([#2698](https://github.com/getsentry/sentry-java/pull/2698)) - New ANR detection based on [ApplicationExitInfo API](https://developer.android.com/reference/android/app/ApplicationExitInfo) ([#2697](https://github.com/getsentry/sentry-java/pull/2697)) - - This implementation completely replaces the old one (based on a watchdog) on devices running Android 11 and above: - - New implementation provides more precise ANR events/ANR rate detection as well as system thread dump information. The new implementation reports ANRs exactly as Google Play Console, without producing false positives or missing important background ANR events. - - New implementation reports ANR events with a new mechanism `mechanism:AppExitInfo`. - - However, despite producing many false positives, the old implementation is capable of better enriching ANR errors (which is not available with the new implementation), for example: - - Capturing screenshots at the time of ANR event; - - Capturing transactions and profiling data corresponding to the ANR event; - - Auxiliary information (such as current memory load) at the time of ANR event. - - If you would like us to provide support for the old approach working alongside the new one on Android 11 and above (e.g. for raising events for slow code on main thread), consider upvoting [this issue](https://github.com/getsentry/sentry-java/issues/2693). - - The old watchdog implementation will continue working for older API versions (Android < 11): - - The old implementation reports ANR events with the existing mechanism `mechanism:ANR`. + - This implementation completely replaces the old one (based on a watchdog) on devices running Android 11 and above: + - New implementation provides more precise ANR events/ANR rate detection as well as system thread dump information. The new implementation reports ANRs exactly as Google Play Console, without producing false positives or missing important background ANR events. + - New implementation reports ANR events with a new mechanism `mechanism:AppExitInfo`. + - However, despite producing many false positives, the old implementation is capable of better enriching ANR errors (which is not available with the new implementation), for example: + - Capturing screenshots at the time of ANR event; + - Capturing transactions and profiling data corresponding to the ANR event; + - Auxiliary information (such as current memory load) at the time of ANR event. + - If you would like us to provide support for the old approach working alongside the new one on Android 11 and above (e.g. for raising events for slow code on main thread), consider upvoting [this issue](https://github.com/getsentry/sentry-java/issues/2693). + - The old watchdog implementation will continue working for older API versions (Android < 11): + - The old implementation reports ANR events with the existing mechanism `mechanism:ANR`. - Open up `TransactionOptions`, `ITransaction` and `IHub` methods allowing consumers modify start/end timestamp of transactions and spans ([#2701](https://github.com/getsentry/sentry-java/pull/2701)) - Send source bundle IDs to Sentry to enable source context ([#2663](https://github.com/getsentry/sentry-java/pull/2663)) - For more information on how to enable source context, please refer to [#633](https://github.com/getsentry/sentry-java/issues/633#issuecomment-1465599120) @@ -2809,7 +2821,7 @@ val apolloClient = ApolloClient.Builder() - Attach Trace Context when an ANR is detected (ANRv1) ([#2583](https://github.com/getsentry/sentry-java/pull/2583)) - Make log4j2 integration compatible with log4j 3.0 ([#2634](https://github.com/getsentry/sentry-java/pull/2634)) - - Instead of relying on package scanning, we now use an annotation processor to generate `Log4j2Plugins.dat` + - Instead of relying on package scanning, we now use an annotation processor to generate `Log4j2Plugins.dat` - Create `User` and `Breadcrumb` from map ([#2614](https://github.com/getsentry/sentry-java/pull/2614)) - Add `sent_at` to envelope header item ([#2638](https://github.com/getsentry/sentry-java/pull/2638)) @@ -2822,12 +2834,13 @@ val apolloClient = ApolloClient.Builder() - Fix aar artifacts publishing for Maven ([#2641](https://github.com/getsentry/sentry-java/pull/2641)) ### Dependencies + - Bump Kotlin compile version from v1.6.10 to 1.8.0 ([#2563](https://github.com/getsentry/sentry-java/pull/2563)) - Bump Compose compile version from v1.1.1 to v1.3.0 ([#2563](https://github.com/getsentry/sentry-java/pull/2563)) - Bump AGP version from v7.3.0 to v7.4.2 ([#2574](https://github.com/getsentry/sentry-java/pull/2574)) - Bump Gradle from v7.6.0 to v8.0.2 ([#2563](https://github.com/getsentry/sentry-java/pull/2563)) - - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v802) - - [diff](https://github.com/gradle/gradle/compare/v7.6.0...v8.0.2) + - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v802) + - [diff](https://github.com/gradle/gradle/compare/v7.6.0...v8.0.2) - Bump Gradle from v8.0.2 to v8.1.0 ([#2650](https://github.com/getsentry/sentry-java/pull/2650)) - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v810) - [diff](https://github.com/gradle/gradle/compare/v8.0.2...v8.1.0) @@ -2836,7 +2849,7 @@ val apolloClient = ApolloClient.Builder() ### Features -- Add `name` and `geo` to `User` ([#2556](https://github.com/getsentry/sentry-java/pull/2556)) +- Add `name` and `geo` to `User` ([#2556](https://github.com/getsentry/sentry-java/pull/2556)) - Add breadcrumbs on network changes ([#2608](https://github.com/getsentry/sentry-java/pull/2608)) - Add time-to-initial-display and time-to-full-display measurements to Activity transactions ([#2611](https://github.com/getsentry/sentry-java/pull/2611)) - Read integration list written by sentry gradle plugin from manifest ([#2598](https://github.com/getsentry/sentry-java/pull/2598)) @@ -2874,7 +2887,7 @@ val apolloClient = ApolloClient.Builder() - Fix timestamps of slow and frozen frames for profiles ([#2584](https://github.com/getsentry/sentry-java/pull/2584)) - Deprecate reportFullDisplayed in favor of reportFullyDisplayed ([#2585](https://github.com/getsentry/sentry-java/pull/2585)) - Add mechanism for logging integrations and update spring mechanism types ([#2595](https://github.com/getsentry/sentry-java/pull/2595)) - - NOTE: If you're using these mechanism types (`HandlerExceptionResolver`, `SentryWebExceptionHandler`) in your dashboards please update them to use the new types. + - NOTE: If you're using these mechanism types (`HandlerExceptionResolver`, `SentryWebExceptionHandler`) in your dashboards please update them to use the new types. - Filter out session cookies sent by Spring and Spring Boot integrations ([#2593](https://github.com/getsentry/sentry-java/pull/2593)) - We filter out some common cookies like JSESSIONID - We also read the value from `server.servlet.session.cookie.name` and filter it out @@ -2899,9 +2912,9 @@ val apolloClient = ApolloClient.Builder() - Adjust time-to-full-display span if reportFullDisplayed is called too early ([#2550](https://github.com/getsentry/sentry-java/pull/2550)) - Add `enableTracing` option ([#2530](https://github.com/getsentry/sentry-java/pull/2530)) - - This change is backwards compatible. The default is `null` meaning existing behaviour remains unchanged (setting either `tracesSampleRate` or `tracesSampler` enables performance). - - If set to `true`, performance is enabled, even if no `tracesSampleRate` or `tracesSampler` have been configured. - - If set to `false` performance is disabled, regardless of `tracesSampleRate` and `tracesSampler` options. + - This change is backwards compatible. The default is `null` meaning existing behaviour remains unchanged (setting either `tracesSampleRate` or `tracesSampler` enables performance). + - If set to `true`, performance is enabled, even if no `tracesSampleRate` or `tracesSampler` have been configured. + - If set to `false` performance is disabled, regardless of `tracesSampleRate` and `tracesSampler` options. - Detect dependencies by listing MANIFEST.MF files at runtime ([#2538](https://github.com/getsentry/sentry-java/pull/2538)) - Report integrations in use, report packages in use more consistently ([#2179](https://github.com/getsentry/sentry-java/pull/2179)) - Implement `ThreadLocalAccessor` for propagating Sentry hub with reactor / WebFlux ([#2570](https://github.com/getsentry/sentry-java/pull/2570)) @@ -2928,7 +2941,7 @@ val apolloClient = ApolloClient.Builder() ### Features - Add time-to-full-display span to Activity auto-instrumentation ([#2432](https://github.com/getsentry/sentry-java/pull/2432)) -- Add `main` flag to threads and `in_foreground` flag for app contexts ([#2516](https://github.com/getsentry/sentry-java/pull/2516)) +- Add `main` flag to threads and `in_foreground` flag for app contexts ([#2516](https://github.com/getsentry/sentry-java/pull/2516)) ### Fixes @@ -3164,7 +3177,7 @@ val apolloClient = ApolloClient.Builder() ### Features -- Server-Side Dynamic Sampling Context support ([#2226](https://github.com/getsentry/sentry-java/pull/2226)) +- Server-Side Dynamic Sampling Context support ([#2226](https://github.com/getsentry/sentry-java/pull/2226)) ## 6.4.4 @@ -3225,7 +3238,6 @@ val apolloClient = ApolloClient.Builder() - `attach-screenshot` set on Manual init. didn't work ([#2186](https://github.com/getsentry/sentry-java/pull/2186)) - Remove extra space from `spring.factories` causing issues in old versions of Spring Boot ([#2181](https://github.com/getsentry/sentry-java/pull/2181)) - ### Features - Bump Native SDK to v0.4.18 ([#2154](https://github.com/getsentry/sentry-java/pull/2154)) @@ -3260,6 +3272,7 @@ val apolloClient = ApolloClient.Builder() - Add sample rate to baggage as well as trace in envelope header and flatten user ([#2135](https://github.com/getsentry/sentry-java/pull/2135)) Breaking Changes: + - The boolean parameter `samplingDecision` in the `TransactionContext` constructor has been replaced with a `TracesSamplingDecision` object. Feel free to ignore the `@ApiStatus.Internal` in this case. ## 6.1.4 @@ -3323,19 +3336,19 @@ Breaking Changes: - Add Android profiling traces ([#1897](https://github.com/getsentry/sentry-java/pull/1897)) ([#1959](https://github.com/getsentry/sentry-java/pull/1959)) and its tests ([#1949](https://github.com/getsentry/sentry-java/pull/1949)) - Enable enableScopeSync by default for Android ([#1928](https://github.com/getsentry/sentry-java/pull/1928)) - Feat: Vendor JSON ([#1554](https://github.com/getsentry/sentry-java/pull/1554)) - - Introduce `JsonSerializable` and `JsonDeserializer` interfaces for manual json - serialization/deserialization. - - Introduce `JsonUnknwon` interface to preserve unknown properties when deserializing/serializing - SDK classes. - - When passing custom objects, for example in `Contexts`, these are supported for serialization: - - `JsonSerializable` - - `Map`, `Collection`, `Array`, `String` and all primitive types. - - Objects with the help of refection. - - `Map`, `Collection`, `Array`, `String` and all primitive types. - - Call `toString()` on objects that have a cyclic reference to a ancestor object. - - Call `toString()` where object graphs exceed max depth. - - Remove `gson` dependency. - - Remove `IUnknownPropertiesConsumer` + - Introduce `JsonSerializable` and `JsonDeserializer` interfaces for manual json + serialization/deserialization. + - Introduce `JsonUnknwon` interface to preserve unknown properties when deserializing/serializing + SDK classes. + - When passing custom objects, for example in `Contexts`, these are supported for serialization: + - `JsonSerializable` + - `Map`, `Collection`, `Array`, `String` and all primitive types. + - Objects with the help of refection. + - `Map`, `Collection`, `Array`, `String` and all primitive types. + - Call `toString()` on objects that have a cyclic reference to a ancestor object. + - Call `toString()` where object graphs exceed max depth. + - Remove `gson` dependency. + - Remove `IUnknownPropertiesConsumer` - Pass MDC tags as Sentry tags ([#1954](https://github.com/getsentry/sentry-java/pull/1954)) ### Fixes @@ -3377,7 +3390,7 @@ Breaking Changes: ### Fixes -* Change order of event filtering mechanisms and only send session update for dropped events if session state changed (#2028) +- Change order of event filtering mechanisms and only send session update for dropped events if session state changed (#2028) ## 5.7.3 @@ -3771,7 +3784,6 @@ Thank you: ### Fixes - - Ref: Deprecate SentryBaseEvent#getOriginThrowable and add SentryBaseEvent#getThrowableMechanism ([#1502](https://github.com/getsentry/sentry-java/pull/1502)) - Graceful Shutdown flushes event instead of Closing SDK ([#1500](https://github.com/getsentry/sentry-java/pull/1500)) - Do not append threads that come from the EnvelopeFileObserver ([#1501](https://github.com/getsentry/sentry-java/pull/1501)) @@ -3930,6 +3942,7 @@ Breaking Changes: - SentryTransaction#finish should not clear another transaction from the scope ([#1278](https://github.com/getsentry/sentry-java/pull/1278)) Breaking Changes: + - Enchancement: SentryExceptionResolver should not send handled errors by default ([#1248](https://github.com/getsentry/sentry-java/pull/1248)). - Ref: Simplify RestTemplate instrumentation ([#1246](https://github.com/getsentry/sentry-java/pull/1246)) - Enchancement: Add overloads for startTransaction taking op and description ([#1244](https://github.com/getsentry/sentry-java/pull/1244)) @@ -4083,7 +4096,7 @@ This release brings the Sentry Performance feature to Java SDK, Spring, Spring B - Set current thread only if theres no exceptions ([#1064](https://github.com/getsentry/sentry-java/pull/1064)) - Append DebugImage list if event already has it ([#1092](https://github.com/getsentry/sentry-java/pull/1092)) - Sort breadcrumbs by Date if there are breadcrumbs already in the event ([#1094](https://github.com/getsentry/sentry-java/pull/1094)) -- Free Local Refs manually due to Android local ref. count limits ([#1179](https://github.com/getsentry/sentry-java/pull/1179)) +- Free Local Refs manually due to Android local ref. count limits ([#1179](https://github.com/getsentry/sentry-java/pull/1179)) ## 3.2.0 @@ -4204,6 +4217,7 @@ Packages were released on [`bintray sentry-java`](https://dl.bintray.com/getsent ## Where is the Java 1.7 code base? The previous Java releases, are all available in this repository through the tagged releases. + ## 3.0.0-beta.1 ## What’s Changed @@ -4243,7 +4257,7 @@ TBD Packages were released on [bintray](https://dl.bintray.com/getsentry/maven/io/sentry/) > Note: This release marks the unification of the Java and Android Sentry codebases based on the core of the Android SDK (version 2.x). -Previous releases for the Android SDK (version 2.x) can be found on the now archived: https://github.com/getsentry/sentry-android/ +> Previous releases for the Android SDK (version 2.x) can be found on the now archived: https://github.com/getsentry/sentry-android/ ## 3.0.0-alpha.1 @@ -4251,7 +4265,6 @@ Previous releases for the Android SDK (version 2.x) can be found on the now arch ### Fixes - ## New releases will happen on a different repository: https://github.com/getsentry/sentry-java @@ -4262,7 +4275,6 @@ https://github.com/getsentry/sentry-java ### Fixes - - feat: enable release health by default Packages were released on [`bintray`](https://dl.bintray.com/getsentry/sentry-android/io/sentry/sentry-android/), [`jcenter`](https://jcenter.bintray.com/io/sentry/sentry-android/) and [`mavenCentral`](https://repo.maven.apache.org/maven2/io/sentry/sentry-android/) @@ -4346,15 +4358,15 @@ We'd love to get feedback. - feat: timber integration ([#464](https://github.com/getsentry/sentry-android/pull/464)) @marandaneto -1) To add integrations it requires a [manual initialization](https://docs.sentry.io/platforms/android/#manual-initialization) of the Android SDK. +1. To add integrations it requires a [manual initialization](https://docs.sentry.io/platforms/android/#manual-initialization) of the Android SDK. -2) Add the `sentry-android-timber` dependency: +2. Add the `sentry-android-timber` dependency: ```groovy implementation 'io.sentry:sentry-android-timber:{version}' // version >= 2.2.0 ``` -3) Initialize and add the `SentryTimberIntegration`: +3. Initialize and add the `SentryTimberIntegration`: ```java SentryAndroid.init(this, options -> { @@ -4368,7 +4380,7 @@ SentryAndroid.init(this, options -> { }); ``` -4) Use the Timber integration: +4. Use the Timber integration: ```java try { @@ -4657,8 +4669,8 @@ New features not offered by (1.7.x): - Captures crashes caused by native code - Access to the [`sentry-native` SDK](https://github.com/getsentry/sentry-native/) API by your native (C/C++/Rust code/..). - Automatic init (just add your `DSN` to the manifest) - - Proguard rules are added automatically - - Permission (Internet) is added automatically + - Proguard rules are added automatically + - Permission (Internet) is added automatically - Uncaught Exceptions might be captured even before the app restarts - Sentry's Unified API. - More context/device information @@ -4719,7 +4731,6 @@ Release of Sentry's new SDK for Android. ### Fixes - - Update ndk for new sentry-native version ([#235](https://github.com/getsentry/sentry-android/pull/235)) @Swatinem @marandaneto - Make integrations public ([#256](https://github.com/getsentry/sentry-android/pull/256)) @marandaneto - Bump build-tools ([#255](https://github.com/getsentry/sentry-android/pull/255)) @marandaneto @@ -4757,7 +4768,6 @@ Release of Sentry's new SDK for Android. ### Fixes - - Honor RetryAfter ([#236](https://github.com/getsentry/sentry-android/pull/236)) @marandaneto - Add tests for SentryValues ([#238](https://github.com/getsentry/sentry-android/pull/238)) @philipphofmann - Do not set frames if there's none ([#234](https://github.com/getsentry/sentry-android/pull/234)) @marandaneto @@ -4858,7 +4868,7 @@ Third release of Sentry's new SDK for Android. ### Fixes -- Fixed release for jcenter and bintray +- Fixed release for jcenter and bintray Packages were released on [`bintray`](https://dl.bintray.com/getsentry/sentry-android/io/sentry/), [`jcenter`](https://jcenter.bintray.com/io/sentry/sentry-android/) @@ -4888,8 +4898,8 @@ New features not offered by our current (1.7.x), stable SDK are: - Captures crashes caused by native code - Access to the [`sentry-native` SDK](https://github.com/getsentry/sentry-native/) API by your native (C/C++/Rust code/..). - Automatic init (just add your `DSN` to the manifest) - - Proguard rules are added automatically - - Permission (Internet) is added automatically + - Proguard rules are added automatically + - Permission (Internet) is added automatically - Uncaught Exceptions might be captured even before the app restarts - Unified API which include scopes etc. - More context/device information diff --git a/sentry-android-ndk/api/sentry-android-ndk.api b/sentry-android-ndk/api/sentry-android-ndk.api index 44c153a71fe..a7c5571d0bb 100644 --- a/sentry-android-ndk/api/sentry-android-ndk.api +++ b/sentry-android-ndk/api/sentry-android-ndk.api @@ -15,7 +15,9 @@ public final class io/sentry/android/ndk/DebugImagesLoader : io/sentry/android/c public final class io/sentry/android/ndk/NdkScopeObserver : io/sentry/ScopeObserverAdapter { public fun (Lio/sentry/SentryOptions;)V + public fun addAttachment (Lio/sentry/Attachment;)V public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V + public fun clearAttachments ()V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V diff --git a/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java b/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java index 023ce965f51..a1474bb69c8 100644 --- a/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java +++ b/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java @@ -1,5 +1,6 @@ package io.sentry.android.ndk; +import io.sentry.Attachment; import io.sentry.Breadcrumb; import io.sentry.DateUtils; import io.sentry.IScope; @@ -145,4 +146,41 @@ public void setTrace(@Nullable SpanContext spanContext, @NotNull IScope scope) { options.getLogger().log(SentryLevel.ERROR, e, "Scope sync setTrace failed."); } } + + @Override + public void addAttachment(final @NotNull Attachment attachment) { + final String pathname = attachment.getPathname(); + if (pathname != null) { + try { + options.getExecutorService().submit(() -> nativeScope.addAttachment(pathname)); + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, e, "Scope sync addAttachment has an error."); + } + return; + } + + final byte[] bytes = attachment.getBytes(); + if (bytes != null) { + final String filename = attachment.getFilename(); + try { + options.getExecutorService().submit(() -> nativeScope.addAttachmentBytes(bytes, filename)); + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, e, "Scope sync addAttachment has an error."); + } + return; + } + + options + .getLogger() + .log(SentryLevel.DEBUG, "Scope sync addAttachment skips attachment without path or bytes."); + } + + @Override + public void clearAttachments() { + try { + options.getExecutorService().submit(() -> nativeScope.clearAttachments()); + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, e, "Scope sync clearAttachments has an error."); + } + } } diff --git a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/NdkScopeObserverTest.kt b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/NdkScopeObserverTest.kt index 696bb69a8d5..a8b5318bfab 100644 --- a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/NdkScopeObserverTest.kt +++ b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/NdkScopeObserverTest.kt @@ -1,5 +1,6 @@ package io.sentry.android.ndk +import io.sentry.Attachment import io.sentry.Breadcrumb import io.sentry.DateUtils import io.sentry.JsonSerializer @@ -153,4 +154,34 @@ class NdkScopeObserverTest { verify(fixture.nativeScope) .addBreadcrumb(anyOrNull(), anyOrNull(), anyOrNull(), anyOrNull(), anyOrNull(), anyOrNull()) } + + @Test + fun `add file-path attachment syncs to native scope`() { + val sut = fixture.getSut() + + val attachment = Attachment("/data/data/com.example/files/log.txt") + sut.addAttachment(attachment) + + verify(fixture.nativeScope).addAttachment("/data/data/com.example/files/log.txt") + } + + @Test + fun `add byte attachment syncs bytes to native scope`() { + val sut = fixture.getSut() + + val bytes = byteArrayOf(1, 2, 3) + val attachment = Attachment(bytes, "data.bin") + sut.addAttachment(attachment) + + verify(fixture.nativeScope).addAttachmentBytes(bytes, "data.bin") + } + + @Test + fun `clear attachments forwards call to native scope`() { + val sut = fixture.getSut() + + sut.clearAttachments() + + verify(fixture.nativeScope).clearAttachments() + } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index c748df38369..3962c3ef1e2 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -945,7 +945,9 @@ public abstract interface class io/sentry/IScope { } public abstract interface class io/sentry/IScopeObserver { + public abstract fun addAttachment (Lio/sentry/Attachment;)V public abstract fun addBreadcrumb (Lio/sentry/Breadcrumb;)V + public abstract fun clearAttachments ()V public abstract fun removeExtra (Ljava/lang/String;)V public abstract fun removeTag (Ljava/lang/String;)V public abstract fun setBreadcrumbs (Ljava/util/Collection;)V @@ -2452,7 +2454,9 @@ public abstract interface class io/sentry/ScopeCallback { public abstract class io/sentry/ScopeObserverAdapter : io/sentry/IScopeObserver { public fun ()V + public fun addAttachment (Lio/sentry/Attachment;)V public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V + public fun clearAttachments ()V public fun removeExtra (Ljava/lang/String;)V public fun removeTag (Ljava/lang/String;)V public fun setBreadcrumbs (Ljava/util/Collection;)V diff --git a/sentry/src/main/java/io/sentry/IScopeObserver.java b/sentry/src/main/java/io/sentry/IScopeObserver.java index a43ccf6b695..e1b9a785043 100644 --- a/sentry/src/main/java/io/sentry/IScopeObserver.java +++ b/sentry/src/main/java/io/sentry/IScopeObserver.java @@ -45,4 +45,8 @@ public interface IScopeObserver { void setTrace(@Nullable SpanContext spanContext, @NotNull IScope scope); void setReplayId(@NotNull SentryId replayId); + + void addAttachment(@NotNull Attachment attachment); + + void clearAttachments(); } diff --git a/sentry/src/main/java/io/sentry/Scope.java b/sentry/src/main/java/io/sentry/Scope.java index 1aab545b80c..fa44e90a194 100644 --- a/sentry/src/main/java/io/sentry/Scope.java +++ b/sentry/src/main/java/io/sentry/Scope.java @@ -924,12 +924,20 @@ public List getAttachments() { @Override public void addAttachment(final @NotNull Attachment attachment) { attachments.add(attachment); + + for (final IScopeObserver observer : options.getScopeObservers()) { + observer.addAttachment(attachment); + } } /** Clear all attachments. */ @Override public void clearAttachments() { attachments.clear(); + + for (final IScopeObserver observer : options.getScopeObservers()) { + observer.clearAttachments(); + } } /** diff --git a/sentry/src/main/java/io/sentry/ScopeObserverAdapter.java b/sentry/src/main/java/io/sentry/ScopeObserverAdapter.java index f0ec6448e03..4f6a5ac842c 100644 --- a/sentry/src/main/java/io/sentry/ScopeObserverAdapter.java +++ b/sentry/src/main/java/io/sentry/ScopeObserverAdapter.java @@ -57,4 +57,10 @@ public void setTrace(@Nullable SpanContext spanContext, @NotNull IScope scope) { @Override public void setReplayId(@NotNull SentryId replayId) {} + + @Override + public void addAttachment(@NotNull Attachment attachment) {} + + @Override + public void clearAttachments() {} } From 22ff2c7a3bc300b075ba2755d93ad1482e3c75cb Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Mon, 30 Mar 2026 16:42:03 +0200 Subject: [PATCH 084/391] chore: Add THIRD_PARTY_NOTICES.md for vendored third-party code (#5186) * chore: Add THIRD_PARTY_NOTICES.md for vendored third-party code Co-Authored-By: Claude Opus 4.6 * chore: Add changelog entry for THIRD_PARTY_NOTICES.md Co-Authored-By: Claude Opus 4.6 * Fix changelog section name * Update CHANGELOG.md Co-authored-by: Roman Zavarnitsyn * chore: Bundle THIRD_PARTY_NOTICES.md in sentry JAR under META-INF Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 1 + THIRD_PARTY_NOTICES.md | 458 ++++++++++++++++++++++++++++++++++++++++ sentry/build.gradle.kts | 4 + 3 files changed, 463 insertions(+) create mode 100644 THIRD_PARTY_NOTICES.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9f9654836..b097b0790bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features - Android: Attachments on the scope will now be synced to native ([#5211](https://github.com/getsentry/sentry-java/pull/5211)) +- Add THIRD_PARTY_NOTICES.md for vendored third-party code, bundled as SENTRY_THIRD_PARTY_NOTICES.md in the sentry JAR under META-INF ([#5186](https://github.com/getsentry/sentry-java/pull/5186)) ## 8.37.1 diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 00000000000..8b2141cc59e --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,458 @@ +# Third-Party Software Notices and Information + +The Sentry Java SDK distribution includes software developed by third parties which carry their own copyright notices and license terms. These notices are provided below. + +In the event that a required notice is missing or incorrect, please inform us by creating an issue [here](https://github.com/getsentry/sentry-java/issues). + +--- + +## Google GSON (Apache 2.0) + +**Source:** https://github.com/google/gson (Tag: gson-parent-2.8.7)
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2010 Google Inc. + +### Scope + +The Sentry Java SDK includes vendored JSON stream reading and writing classes extracted from the GSON library. The code resides in the `io.sentry.vendor.gson.stream` package and includes `JsonReader`, `JsonWriter`, `JsonScope`, `JsonToken`, and `MalformedJsonException`. + +``` +Copyright (C) 2010 Google Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## FasterXML Jackson — ISO8601Utils (Apache 2.0) + +**Source:** https://github.com/FasterXML/jackson-databind
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2007-, Tatu Saloranta + +### Scope + +The Sentry Java SDK includes an adapted version of `ISO8601Utils` from the Jackson Databind library for ISO 8601 date/time parsing and formatting. The code resides in `io.sentry.vendor.gson.internal.bind.util.ISO8601Utils`. + +``` +Copyright (C) 2007-, Tatu Saloranta + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Android Open Source Project — Base64 (Apache 2.0) + +**Source:** https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/util/Base64.java
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2010 The Android Open Source Project + +### Scope + +The Sentry Java SDK includes an adapted version of the Android `Base64` class for Base64 encoding and decoding on non-Android platforms. The code resides in `io.sentry.vendor.Base64`. + +``` +Copyright (C) 2010 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Square — Tape (Apache 2.0) + +**Source:** https://github.com/square/tape (Commit: 445cd3fd0a7b3ec48c9ea3e0e86663fe6d3735d8)
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2010 Square, Inc. + +### Scope + +The Sentry Java SDK includes an adapted version of Square's Tape library, a file-based FIFO queue implementation used for reliable event storage. The code resides in the `io.sentry.cache.tape` package and includes `QueueFile`, `FileObjectQueue`, and `ObjectQueue`. + +``` +Copyright (C) 2010 Square, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Square — Curtains (Apache 2.0) + +**Source:** https://github.com/square/curtains (v1.2.5)
+**License:** Apache License 2.0
+**Copyright:** Copyright 2021 Square Inc. + +### Scope + +The Sentry Java SDK includes an adapted version of Square's Curtains library for null-safe `Window.Callback` handling. The code resides in `io.sentry.android.replay.util.FixedWindowCallback`. + +``` +Copyright 2021 Square Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Apache Commons Collections (Apache 2.0) + +**Source:** https://github.com/apache/commons-collections
+**License:** Apache License 2.0
+**Copyright:** Copyright The Apache Software Foundation + +### Scope + +The Sentry Java SDK includes adapted versions of `CircularFifoQueue`, `SynchronizedCollection`, and `SynchronizedQueue` from Apache Commons Collections. The code resides in `io.sentry.CircularFifoQueue`, `io.sentry.SynchronizedCollection`, and `io.sentry.SynchronizedQueue`. + +``` +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Matej Tymes — JavaFixes (Apache 2.0) + +**Source:** https://github.com/MatejTymes/JavaFixes (Commit: 37e74b9d0a29f7a47485c6d1bb1307f01fb93634)
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2016 Matej Tymes + +### Scope + +The Sentry Java SDK includes an adapted version of `ReusableCountLatch` from the JavaFixes library for concurrent synchronization. The code resides in `io.sentry.transport.ReusableCountLatch`. + +``` +Copyright (C) 2016 Matej Tymes + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Baomidou — Dynamic-Datasource (Apache 2.0) + +**Source:** https://github.com/baomidou/dynamic-datasource
+**License:** Apache License 2.0
+**Copyright:** Copyright © 2018 organization baomidou + +### Scope + +The Sentry Java SDK includes an adapted UUID generation implementation from the Dynamic-Datasource library. The code resides in `io.sentry.util.UUIDGenerator`. + +``` +Copyright © 2018 organization baomidou + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Google Firebase — Android SDK (Apache 2.0) + +**Source:** https://github.com/firebase/firebase-android-sdk
+**License:** Apache License 2.0
+**Copyright:** Copyright 2022 Google LLC + +### Scope + +The Sentry Java SDK includes an adapted version of `FirstDrawDoneListener` from the Firebase Android SDK for detecting initial display time via `OnDrawListener`. The code resides in `io.sentry.android.core.internal.util.FirstDrawDoneListener`. + +``` +Copyright 2022 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Android Open Source Project — Thread Dump Parsing (Apache 2.0) + +**Source:** https://cs.android.com/android/platform/superproject/+/master:development/tools/bugreport/src/com/android/bugreport/stacks/ThreadSnapshotParser.java
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2016 The Android Open Source Project + +### Scope + +The Sentry Java SDK includes adapted thread state and stack trace parsing code from the Android Open Source Project's bugreport tools. The code resides in the `io.sentry.android.core.internal.threaddump` package and includes `ThreadDumpParser`, `Line`, and `Lines`. + +``` +Copyright (C) 2016 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## OpenTelemetry (Apache 2.0) + +**Source:** https://github.com/open-telemetry/opentelemetry-java (Commit: 0aacc55d1e3f5cc6dbb4f8fa26bcb657b01a7bc9)
+**License:** Apache License 2.0
+**Copyright:** Copyright The OpenTelemetry Authors + +### Scope + +The Sentry Java SDK includes an adapted version of `ThreadLocalContextStorage` from the OpenTelemetry Java SDK for thread-local context storage. The code resides in `io.sentry.opentelemetry.SentryOtelThreadLocalStorage`. + +``` +Copyright The OpenTelemetry Authors +SPDX-License-Identifier: Apache-2.0 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## SalomonBrys — ANR-WatchDog (MIT) + +**Source:** https://github.com/SalomonBrys/ANR-WatchDog (Commit: 1969075f75f5980e9000eaffbaa13b0daf282dcb)
+**License:** MIT License
+**Copyright:** Copyright (c) 2016 Salomon BRYS + +### Scope + +The Sentry Java SDK includes an adapted version of the ANR-WatchDog library for Application Not Responding (ANR) detection on Android. The code resides in `io.sentry.android.core.ANRWatchDog`. + +``` +MIT License + +Copyright (c) 2016 Salomon BRYS + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` + +--- + +## Breadwallet — Root Detection (MIT) + +**Source:** https://github.com/Menwitz/ravencoin-android (adapted from breadwallet)
+**License:** MIT License
+**Copyright:** Copyright (c) 2016 breadwallet LLC + +### Scope + +The Sentry Java SDK includes an adapted root detection implementation from the Ravencoin Android wallet (originally from breadwallet). The code resides in `io.sentry.android.core.internal.util.RootChecker`. + +``` +MIT License + +Copyright (c) 2016 breadwallet LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +``` + +--- + +## KilianB — PCG-Java (MIT) + +**Source:** https://github.com/KilianB/pcg-java
+**License:** MIT License
+**Copyright:** Copyright (c) 2018 + +### Scope + +The Sentry Java SDK includes an adapted PCG-based random number generator from the pcg-java library for fast sampling. The code resides in `io.sentry.util.Random`. + +``` +MIT License + +Copyright (c) 2018 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +--- + +## Jon Chambers — UUID String Utils (MIT) + +**Source:** Jon Chambers
+**License:** MIT License
+**Copyright:** Copyright (c) 2018 Jon Chambers + +### Scope + +The Sentry Java SDK includes adapted UUID string manipulation utilities. The code resides in `io.sentry.util.UUIDStringUtils`. + +``` +MIT License + +Copyright (c) 2018 Jon Chambers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` diff --git a/sentry/build.gradle.kts b/sentry/build.gradle.kts index bbeb9cc62df..25e700995b4 100644 --- a/sentry/build.gradle.kts +++ b/sentry/build.gradle.kts @@ -95,6 +95,10 @@ tasks.withType().configureEach { } tasks.jar { + from(rootProject.file("THIRD_PARTY_NOTICES.md")) { + into("META-INF") + rename { "SENTRY_THIRD_PARTY_NOTICES.md" } + } manifest { attributes( "Sentry-Version-Name" to project.version, From 96c9c721415eb3b1d058e6650143fdcebd8461ae Mon Sep 17 00:00:00 2001 From: Giannis Gkiortzis <58184179+giortzisg@users.noreply.github.com> Date: Tue, 31 Mar 2026 08:35:57 +0200 Subject: [PATCH 085/391] feat: Add strict trace continuation support (#5136) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add strict trace continuation support Extract org ID from DSN host, add strictTraceContinuation and orgId options, propagate sentry-org_id in baggage, and validate incoming traces per the decision matrix. Closes #5128 * Format code * Add changelog entry * Update API surface file for strict trace continuation Add public API declarations for new org ID and strict trace continuation methods on Baggage, PropagationContext, and SentryOptions. Co-Authored-By: Claude Opus 4.6 * Address review comments for strict trace continuation - Make Dsn.orgId final, remove unnecessary setter - Fix test signatures to use List for baggage headers - Add strictTraceContinuation and orgId to ExternalOptions and merge() - Add options to ManifestMetadataReader for Android manifest config - Use Sentry.getCurrentScopes().getOptions() in legacy fromHeaders overload - Improve CHANGELOG description with details about new options - Update API surface file for ExternalOptions changes Co-Authored-By: Claude Opus 4.6 * Fix compilation errors after rebase on main - Add comment to empty catch block in PropagationContext to satisfy -Werror - Add setOrgId setter to Dsn class (remove final modifier on orgId field) to support the existing test for org ID override Co-Authored-By: Claude Opus 4.6 * fix: Move changelog entry to Unreleased section * Format code * fix: Address review comments — pass options to PropagationContext, fix OTel overload, add option tests, make Dsn.orgId final - Remove PropagationContext.fromHeaders overload without SentryOptions; all callers now pass options (or null) explicitly instead of relying on Sentry.getCurrentScopes() - Add SentryOptions parameter to the OTel-facing fromHeaders(SentryTraceHeader, Baggage, SpanId) overload so OpenTelemetry integrations also check orgId - Make Dsn.orgId final and remove the setter — orgId is only set during DSN parsing in the constructor - Add tests for strictTraceContinuation and orgId options in ExternalOptionsTest, SentryOptionsTest, and ManifestMetadataReaderTest - Improve CHANGELOG entry with customer-facing description - Update API declarations (apiDump) Co-Authored-By: Claude Opus 4.6 * fix: Add missing 8.34.1 changelog section Co-Authored-By: Claude Opus 4.6 * Format code * fix: Address PR review comments for strict trace continuation - Remove duplicated org ID check in PropagationContext.fromHeaders, pass options through to the single-check overload instead - Add debug log when trace is not continued in the SentryTraceHeader overload - Handle empty/blank org ID strings in shouldContinueTrace to avoid silently breaking traces - Update OtelSentrySpanProcessor to use PropagationContext.fromHeaders with options for org_id validation - Rename ExternalOptions property key to enable-strict-trace-continuation (matching the enable- prefix convention for newer options) - Update ExternalOptionsTest to use the new property key - Add strict-trace-continuation and org-id properties to all 3 Spring Boot SentryAutoConfigurationTest modules - Improve CHANGELOG entry with detailed customer-facing descriptions and configuration examples for all options Co-Authored-By: Claude Opus 4.6 * Format code * fix(tracing): Clarify strict org validation debug log Update the trace-continuation rejection log message to cover all strict org ID validation failures, including missing org IDs, not just mismatches. Co-Authored-By: Claude * fix(android): Use enabled suffix for strict trace manifest key Rename the Android manifest option to io.sentry.strict-trace-continuation.enabled to align with existing enabled-style manifest flags. Update changelog documentation to match the new Android key. Co-Authored-By: Claude * fix(api): Mark effective org ID helper as internal Annotate SentryOptions.getEffectiveOrgId with ApiStatus.Internal since it is used as an internal helper for trace propagation org ID resolution. Co-Authored-By: Claude * ref(tracing): Extract trace continuation decision into TracingUtils Move strict trace continuation org-id validation logic to TracingUtils so it can be reused by tracing entry points. Update PropagationContext to call the shared helper and add dedicated TracingUtils tests for strict/non-strict org-id continuation outcomes. Co-Authored-By: Claude * fix(opentelemetry): Enforce strict continuation in propagators Apply strict trace continuation checks in all OpenTelemetry propagator extract paths before creating remote parent span context. When org-id validation fails, return the original context and ignore incoming sentry-trace and baggage to keep propagation behavior aligned with strict continuation requirements. Add rejection tests for OtelSentryPropagator, deprecated SentryPropagator, and OpenTelemetryOtlpPropagator. Co-Authored-By: Claude * Format code * fix(tracing): Fix empty orgId bypassing DSN fallback The getEffectiveOrgId() method only checked orgId != null, allowing empty strings and whitespace-only values to bypass the DSN fallback mechanism. This caused empty org IDs to propagate to outgoing baggage headers as sentry-org_id=, silently breaking trace continuation in strict mode. Update getEffectiveOrgId() to trim the orgId value and check if it's empty after trimming. Empty or blank values now correctly fall back to the DSN org ID instead of propagating as empty strings. Add comprehensive test coverage for all edge cases including empty strings, whitespace-only values, and their impact on baggage propagation and strict trace continuation. Co-Authored-By: Claude * Format code * ref: Remove redundant trim of already-trimmed effective org ID getEffectiveOrgId() already guarantees it returns either null or a trimmed, non-empty string. The defensive trim and empty check in shouldContinueTrace was dead code that could never change the result. Co-Authored-By: Claude * ref(tracing): Revert shouldContinueTrace check in OtelSentrySpanProcessor The propagator is the correct enforcement point for org ID validation. By the time the span processor runs, OTel has already created the span with the remote parent's trace ID. If shouldContinueTrace rejects here, it creates a fresh PropagationContext with a mismatched trace ID rather than cleanly rejecting the trace. Co-Authored-By: Claude * fix(test): Clean up global Sentry state in SentryPropagatorTest SentryPropagatorTest calls Sentry.init with strict trace continuation but never closes Sentry afterward. This leaks global state into SentrySpanProcessorTest where SentryPropagator uses the global ScopesAdapter and rejects incoming sentry-trace headers under the leaked strict mode configuration. Add @AfterTest that calls Sentry.close() to prevent state leakage. Co-Authored-By: Claude * fix(test): Use mock scopes in propagator strict continuation tests The strict continuation tests called Sentry.init with strict mode and org ID configuration, which leaked global state into other tests. Sentry.close() does not fully reset the global scope options, so SentrySpanProcessorTest's SentryPropagator (using ScopesAdapter) would reject incoming sentry-trace headers. Use the package-private constructor with mock IScopes instead of relying on global Sentry state for strict continuation validation. Co-Authored-By: Claude * fix(test): Reset OTel context in propagator test teardown Sentry.init uses OtelContextScopesStorage which pushes scopes onto the OTel context via makeCurrent(). The returned pop-token is discarded by Sentry.init, and OtelContextScopesStorage.close() is a no-op, so Sentry.close() alone does not restore the OTel context. Since JUnit reuses the same thread across test classes, stale scopes from SentryPropagatorTest (with strict continuation enabled) leaked into SentrySpanProcessorTest via Context.current(). Add Context.root().makeCurrent() after Sentry.close() in all propagator test teardowns to reset the thread-local OTel context. Co-Authored-By: Claude * fix(test): Add back test for inject with invalid span The previous commit replaced the invalid-span inject test with a no-span-in-context test. These are distinct scenarios: an explicitly invalid span vs no span at all. Restore the invalid span test and keep both. Co-Authored-By: Claude --------- Co-authored-by: Sentry Github Bot Co-authored-by: Claude Opus 4.6 Co-authored-by: Alexander Dinauer Co-authored-by: Alexander Dinauer --- CHANGELOG.md | 4 + .../android/core/ManifestMetadataReader.java | 12 ++ .../core/ManifestMetadataReaderTest.kt | 50 ++++++ .../opentelemetry/OtelSentryPropagator.java | 8 + .../opentelemetry/SentryPropagator.java | 15 +- .../sentry/opentelemetry/SentrySampler.java | 3 +- .../opentelemetry/SentrySpanProcessor.java | 5 +- .../test/kotlin/OtelSentryPropagatorTest.kt | 23 +++ .../src/test/kotlin/SentryPropagatorTest.kt | 48 +++++ .../otlp/OpenTelemetryOtlpPropagator.java | 16 +- .../test/kotlin/OtelSentryPropagatorTest.kt | 151 ++++++++++------ .../tracing/SentryTracingFilterTest.kt | 1 + .../webflux/SentryWebFluxTracingFilterTest.kt | 1 + .../boot4/SentryAutoConfigurationTest.kt | 4 + .../jakarta/SentryAutoConfigurationTest.kt | 4 + .../boot/SentryAutoConfigurationTest.kt | 4 + .../tracing/SentryTracingFilterTest.kt | 1 + .../webflux/SentryWebFluxTracingFilterTest.kt | 1 + .../spring/tracing/SentryTracingFilterTest.kt | 1 + .../webflux/SentryWebFluxTracingFilterTest.kt | 1 + sentry/api/sentry.api | 19 +- sentry/src/main/java/io/sentry/Baggage.java | 17 +- sentry/src/main/java/io/sentry/Dsn.java | 20 +++ .../main/java/io/sentry/ExternalOptions.java | 23 +++ .../java/io/sentry/PropagationContext.java | 21 ++- sentry/src/main/java/io/sentry/Scopes.java | 3 +- .../main/java/io/sentry/SentryOptions.java | 57 ++++++ .../java/io/sentry/util/TracingUtils.java | 26 +++ sentry/src/test/java/io/sentry/BaggageTest.kt | 85 +++++++++ sentry/src/test/java/io/sentry/DsnTest.kt | 24 +++ .../java/io/sentry/ExternalOptionsTest.kt | 29 ++++ .../java/io/sentry/PropagationContextTest.kt | 164 ++++++++++++++++++ .../test/java/io/sentry/SentryOptionsTest.kt | 108 ++++++++++++ .../java/io/sentry/TransactionContextTest.kt | 4 + .../java/io/sentry/util/TracingUtilsTest.kt | 80 +++++++++ 35 files changed, 963 insertions(+), 70 deletions(-) create mode 100644 sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentryPropagatorTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index b097b0790bf..6bd3b127948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Features +- Prevent cross-organization trace continuation ([#5136](https://github.com/getsentry/sentry-java/pull/5136)) + - By default, the SDK now extracts the organization ID from the DSN (e.g. `o123.ingest.sentry.io`) and compares it with the `sentry-org_id` value in incoming baggage headers. When the two differ, the SDK starts a fresh trace instead of continuing the foreign one. This guards against accidentally linking traces across organizations. + - New option `enableStrictTraceContinuation` (default `false`): when enabled, both the SDK's org ID **and** the incoming baggage org ID must be present and match for a trace to be continued. Traces with a missing org ID on either side are rejected. Configurable via code (`setStrictTraceContinuation(true)`), `sentry.properties` (`enable-strict-trace-continuation=true`), Android manifest (`io.sentry.strict-trace-continuation.enabled`), or Spring Boot (`sentry.strict-trace-continuation=true`). + - New option `orgId`: allows explicitly setting the organization ID for self-hosted and Relay setups where it cannot be extracted from the DSN. Configurable via code (`setOrgId("123")`), `sentry.properties` (`org-id=123`), Android manifest (`io.sentry.org-id`), or Spring Boot (`sentry.org-id=123`). - Android: Attachments on the scope will now be synced to native ([#5211](https://github.com/getsentry/sentry-java/pull/5211)) - Add THIRD_PARTY_NOTICES.md for vendored third-party code, bundled as SENTRY_THIRD_PARTY_NOTICES.md in the sentry JAR under META-INF ([#5186](https://github.com/getsentry/sentry-java/pull/5186)) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 822d7fbbe08..6d90bb5ca8e 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -167,6 +167,9 @@ final class ManifestMetadataReader { static final String FEEDBACK_SHOW_BRANDING = "io.sentry.feedback.show-branding"; + static final String STRICT_TRACE_CONTINUATION = "io.sentry.strict-trace-continuation.enabled"; + static final String ORG_ID = "io.sentry.org-id"; + static final String FEEDBACK_USE_SHAKE_GESTURE = "io.sentry.feedback.use-shake-gesture"; static final String SPOTLIGHT_ENABLE = "io.sentry.spotlight.enable"; @@ -667,6 +670,15 @@ static void applyMetadata( readBool( metadata, logger, FEEDBACK_USE_SHAKE_GESTURE, feedbackOptions.isUseShakeGesture())); + options.setStrictTraceContinuation( + readBool( + metadata, logger, STRICT_TRACE_CONTINUATION, options.isStrictTraceContinuation())); + + final @Nullable String orgId = readString(metadata, logger, ORG_ID, null); + if (orgId != null) { + options.setOrgId(orgId); + } + options.setEnableSpotlight( readBool(metadata, logger, SPOTLIGHT_ENABLE, options.isEnableSpotlight())); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index ba01a9ecf7a..81b73d5dea7 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -2461,4 +2461,54 @@ class ManifestMetadataReaderTest { // maskAllImages should also add WebView assertTrue(fixture.options.screenshot.maskViewClasses.contains("android.webkit.WebView")) } + + @Test + fun `applyMetadata reads strictTraceContinuation and keeps default value if not found`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertFalse(fixture.options.isStrictTraceContinuation) + } + + @Test + fun `applyMetadata reads strictTraceContinuation to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.STRICT_TRACE_CONTINUATION to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.isStrictTraceContinuation) + } + + @Test + fun `applyMetadata reads orgId and keeps null if not found`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertNull(fixture.options.orgId) + } + + @Test + fun `applyMetadata reads orgId to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.ORG_ID to "12345") + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals("12345", fixture.options.orgId) + } } diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentryPropagator.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentryPropagator.java index 56e87c67896..e87af070748 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentryPropagator.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentryPropagator.java @@ -113,6 +113,14 @@ public Context extract( final @Nullable String baggageString = getter.get(carrier, BaggageHeader.BAGGAGE_HEADER); final Baggage baggage = Baggage.fromHeader(baggageString); + if (!TracingUtils.shouldContinueTrace(scopes.getOptions(), baggage)) { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, "Not continuing trace due to strict org ID validation failure."); + return context; + } final @NotNull TraceState traceState = TraceState.getDefault(); SpanContext otelSpanContext = diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentryPropagator.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentryPropagator.java index ffcab9ed541..4016debf2bb 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentryPropagator.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentryPropagator.java @@ -16,6 +16,7 @@ import io.sentry.SentryLevel; import io.sentry.SentryTraceHeader; import io.sentry.exception.InvalidSentryTraceHeaderException; +import io.sentry.util.TracingUtils; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -98,6 +99,17 @@ public Context extract( try { SentryTraceHeader sentryTraceHeader = new SentryTraceHeader(sentryTraceString); + final @Nullable String baggageString = getter.get(carrier, BaggageHeader.BAGGAGE_HEADER); + Baggage baggage = Baggage.fromHeader(baggageString); + if (!TracingUtils.shouldContinueTrace(scopes.getOptions(), baggage)) { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, "Not continuing trace due to strict org ID validation failure."); + return context; + } + SpanContext otelSpanContext = SpanContext.createFromRemoteParent( sentryTraceHeader.getTraceId().toString(), @@ -107,9 +119,6 @@ public Context extract( @NotNull Context modifiedContext = context.with(SentryOtelKeys.SENTRY_TRACE_KEY, sentryTraceHeader); - - final @Nullable String baggageString = getter.get(carrier, BaggageHeader.BAGGAGE_HEADER); - Baggage baggage = Baggage.fromHeader(baggageString); modifiedContext = modifiedContext.with(SentryOtelKeys.SENTRY_BAGGAGE_KEY, baggage); Span wrappedSpan = Span.wrap(otelSpanContext); diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java index 5493ba033cb..1a9e8724ca6 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java @@ -91,7 +91,8 @@ public SamplingResult shouldSample( final @NotNull PropagationContext propagationContext = sentryTraceHeader == null ? new PropagationContext(new SentryId(traceId), randomSpanId, null, baggage, null) - : PropagationContext.fromHeaders(sentryTraceHeader, baggage, randomSpanId); + : PropagationContext.fromHeaders( + sentryTraceHeader, baggage, randomSpanId, scopes.getOptions()); final @NotNull TransactionContext transactionContext = TransactionContext.fromPropagationContext(propagationContext); diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java index 2b650ef9dd2..9c6a51f17c3 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java @@ -127,7 +127,10 @@ public void onStart(final @NotNull Context parentContext, final @NotNull ReadWri new SentryId(traceData.getTraceId()), spanId, null, null, null) : TransactionContext.fromPropagationContext( PropagationContext.fromHeaders( - traceData.getSentryTraceHeader(), traceData.getBaggage(), spanId)); + traceData.getSentryTraceHeader(), + traceData.getBaggage(), + spanId, + scopes.getOptions())); ; transactionContext.setName(transactionName); transactionContext.setTransactionNameSource(transactionNameSource); diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt index 2315412fd46..6b9e733157d 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -19,6 +19,7 @@ import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFalse import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertSame @@ -38,6 +39,8 @@ class OtelSentryPropagatorTest { @AfterTest fun cleanup() { spanStorage.clear() + Sentry.close() + Context.root().makeCurrent() } @Test @@ -69,6 +72,26 @@ class OtelSentryPropagatorTest { assertSame(scopeInContext, scopes) } + @Test + fun `ignores incoming headers when strict continuation rejects org id`() { + Sentry.init { options -> + options.dsn = "https://key@o2.ingest.sentry.io/123" + options.isStrictTraceContinuation = true + } + val propagator = OtelSentryPropagator() + val carrier: Map = + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to "sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-org_id=1", + ) + + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + assertFalse(Span.fromContext(newContext).spanContext.isValid) + assertNull(newContext.get(SENTRY_TRACE_KEY)) + assertNull(newContext.get(SENTRY_BAGGAGE_KEY)) + } + @Test fun `uses incoming headers`() { val propagator = OtelSentryPropagator() diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentryPropagatorTest.kt new file mode 100644 index 00000000000..29e820acff0 --- /dev/null +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentryPropagatorTest.kt @@ -0,0 +1,48 @@ +package io.sentry.opentelemetry + +import io.opentelemetry.api.trace.Span +import io.opentelemetry.context.Context +import io.sentry.Sentry +import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_BAGGAGE_KEY +import io.sentry.opentelemetry.SentryOtelKeys.SENTRY_TRACE_KEY +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertFalse +import kotlin.test.assertNull + +class SentryPropagatorTest { + + @BeforeTest + fun setup() { + Sentry.init("https://key@sentry.io/proj") + } + + @AfterTest + fun teardown() { + Sentry.close() + Context.root().makeCurrent() + } + + @Suppress("DEPRECATION") + @Test + fun `ignores incoming headers when strict continuation rejects org id`() { + Sentry.init { options -> + options.dsn = "https://key@o2.ingest.sentry.io/123" + options.isStrictTraceContinuation = true + } + + val propagator = SentryPropagator() + val carrier: Map = + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to "sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-org_id=1", + ) + + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + assertFalse(Span.fromContext(newContext).spanContext.isValid) + assertNull(newContext.get(SENTRY_TRACE_KEY)) + assertNull(newContext.get(SENTRY_BAGGAGE_KEY)) + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java index e6bc31ca827..a4249b27ec0 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/main/java/io/sentry/opentelemetry/otlp/OpenTelemetryOtlpPropagator.java @@ -18,6 +18,7 @@ import io.sentry.SentryLevel; import io.sentry.SentryTraceHeader; import io.sentry.exception.InvalidSentryTraceHeaderException; +import io.sentry.util.TracingUtils; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -87,6 +88,16 @@ public Context extract( SentryTraceHeader sentryTraceHeader = new SentryTraceHeader(sentryTraceString); final @Nullable String baggageString = getter.get(carrier, BaggageHeader.BAGGAGE_HEADER); + final @Nullable Baggage baggage = + baggageString == null ? null : Baggage.fromHeader(baggageString); + if (!TracingUtils.shouldContinueTrace(scopes.getOptions(), baggage)) { + scopes + .getOptions() + .getLogger() + .log( + SentryLevel.DEBUG, "Not continuing trace due to strict org ID validation failure."); + return context; + } final @NotNull TraceState traceState = TraceState.getDefault(); final @NotNull TraceFlags traceFlags = @@ -104,9 +115,8 @@ public Context extract( Span wrappedSpan = Span.wrap(otelSpanContext); @NotNull Context modifiedContext = context.with(wrappedSpan); - if (baggageString != null) { - modifiedContext = - modifiedContext.with(SENTRY_BAGGAGE_KEY, Baggage.fromHeader(baggageString)); + if (baggage != null) { + modifiedContext = modifiedContext.with(SENTRY_BAGGAGE_KEY, baggage); } scopes diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt index e9bfe26c11d..1d5d56c5bff 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -9,6 +9,7 @@ import io.opentelemetry.context.propagation.TextMapGetter import io.opentelemetry.context.propagation.TextMapSetter import io.sentry.Baggage import io.sentry.Sentry +import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals @@ -23,6 +24,12 @@ class OpenTelemetryOtlpPropagatorTest { Sentry.init("https://key@sentry.io/proj") } + @AfterTest + fun teardown() { + Sentry.close() + Context.root().makeCurrent() + } + @Test fun `propagator registers for sentry-trace and baggage`() { val propagator = OpenTelemetryOtlpPropagator() @@ -46,6 +53,25 @@ class OpenTelemetryOtlpPropagatorTest { assertNull(baggage) } + @Test + fun `ignores incoming headers when strict continuation rejects org id`() { + Sentry.init { options -> + options.dsn = "https://key@o2.ingest.sentry.io/123" + options.isStrictTraceContinuation = true + } + val propagator = OpenTelemetryOtlpPropagator() + val carrier: Map = + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to "sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-org_id=1", + ) + + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) + + assertFalse(Span.fromContext(newContext).spanContext.isValid) + assertNull(newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY)) + } + @Test fun `uses incoming headers`() { val propagator = OpenTelemetryOtlpPropagator() @@ -55,74 +81,65 @@ class OpenTelemetryOtlpPropagatorTest { "baggage" to "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) val span = Span.fromContext(newContext) + assertTrue(span.spanContext.isValid) assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) assertEquals("424cffc8f94feeee", span.spanContext.spanId) - assertTrue(span.spanContext.isSampled) - assertEquals( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", - newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY)?.toHeaderString(null), - ) + val baggage = newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY) + assertEquals("production", baggage?.environment) } @Test - fun `extract does not store baggage in context when baggage header is missing`() { + fun `extract sets sampled trace flag when sentry-trace has sampled=0`() { val propagator = OpenTelemetryOtlpPropagator() val carrier: Map = - mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1") - val newContext = propagator.extract(Context.root(), carrier, MapGetter()) - - assertNull(newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY)) - } - - @Test - fun `does not inject baggage header when baggage is missing from context`() { - val propagator = OpenTelemetryOtlpPropagator() - val carrier = mutableMapOf() - - val otelSpanContext = - SpanContext.create( - "f9118105af4a2d42b4124532cd1065ff", - "424cffc8f94feeee", - TraceFlags.getSampled(), - TraceState.getDefault(), + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-0", + "baggage" to + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=false,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) - val otelSpan = Span.wrap(otelSpanContext) - val context = Context.root().with(otelSpan) - propagator.inject(context, carrier, MapSetter()) + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) - assertEquals("f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", carrier["sentry-trace"]) - assertNull(carrier["baggage"]) + val span = Span.fromContext(newContext) + assertTrue(span.spanContext.isValid) + assertFalse(span.spanContext.traceFlags.isSampled) } @Test - fun `extract sets sampled trace flag when sentry-trace has sampled=0`() { + fun `extract sets sampled trace flag when sentry-trace has no sampling decision`() { val propagator = OpenTelemetryOtlpPropagator() val carrier: Map = - mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-0") + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee", + "baggage" to + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ) + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) val span = Span.fromContext(newContext) - assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) - assertEquals("424cffc8f94feeee", span.spanContext.spanId) - assertFalse(span.spanContext.isSampled) + assertTrue(span.spanContext.isValid) + assertTrue(span.spanContext.traceFlags.isSampled) } @Test - fun `extract sets sampled trace flag when sentry-trace has no sampling decision`() { + fun `extract does not store baggage in context when baggage header is missing`() { val propagator = OpenTelemetryOtlpPropagator() val carrier: Map = - mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee") + mapOf("sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1") + val newContext = propagator.extract(Context.root(), carrier, MapGetter()) val span = Span.fromContext(newContext) - assertEquals("f9118105af4a2d42b4124532cd1065ff", span.spanContext.traceId) - assertEquals("424cffc8f94feeee", span.spanContext.spanId) - assertTrue(span.spanContext.isSampled) + assertTrue(span.spanContext.isValid) + + val baggage = newContext.get(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY) + assertNull(baggage) } @Test @@ -138,16 +155,12 @@ class OpenTelemetryOtlpPropagatorTest { TraceState.getDefault(), ) val otelSpan = Span.wrap(otelSpanContext) - + val baggage = + Baggage.fromHeader( + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + ) val context = - Context.root() - .with(otelSpan) - .with( - OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY, - Baggage.fromHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ), - ) + Context.root().with(otelSpan).with(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY, baggage) propagator.inject(context, carrier, MapSetter()) @@ -159,7 +172,18 @@ class OpenTelemetryOtlpPropagatorTest { } @Test - fun `does not inject headers if span is invalid`() { + fun `does not inject headers when no span in context`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier = mutableMapOf() + + propagator.inject(Context.root(), carrier, MapSetter()) + + assertNull(carrier["sentry-trace"]) + assertNull(carrier["baggage"]) + } + + @Test + fun `does not inject headers when span is invalid`() { val propagator = OpenTelemetryOtlpPropagator() val carrier = mutableMapOf() @@ -168,17 +192,40 @@ class OpenTelemetryOtlpPropagatorTest { assertNull(carrier["sentry-trace"]) assertNull(carrier["baggage"]) } + + @Test + fun `does not inject baggage header when baggage is missing from context`() { + val propagator = OpenTelemetryOtlpPropagator() + val carrier = mutableMapOf() + + val otelSpanContext = + SpanContext.create( + "f9118105af4a2d42b4124532cd1065ff", + "424cffc8f94feeee", + TraceFlags.getSampled(), + TraceState.getDefault(), + ) + val otelSpan = Span.wrap(otelSpanContext) + + propagator.inject(Context.root().with(otelSpan), carrier, MapSetter()) + + assertEquals("f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", carrier["sentry-trace"]) + assertNull(carrier["baggage"]) + } } class MapGetter : TextMapGetter> { - override fun keys(carrier: Map): MutableIterable = - carrier.keys.toMutableList() + override fun keys(carrier: Map): MutableIterable { + return carrier.keys.toMutableList() + } - override fun get(carrier: Map?, key: String): String? = carrier?.get(key) + override fun get(carrier: Map?, key: String): String? { + return carrier?.get(key) + } } class MapSetter : TextMapSetter> { override fun set(carrier: MutableMap?, key: String, value: String) { - carrier?.set(key, value) + carrier?.put(key, value) } } diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt index f63b5d9631c..9778a6d0154 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt @@ -96,6 +96,7 @@ class SentryTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt index 495f45ac650..bb14538d921 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt @@ -98,6 +98,7 @@ class SentryWebFluxTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt index 7f30c860bb3..ef1f12aeecf 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt @@ -244,6 +244,8 @@ class SentryAutoConfigurationTest { "sentry.cron.default-failure-issue-threshold=40", "sentry.cron.default-recovery-threshold=50", "sentry.logs.enabled=true", + "sentry.strict-trace-continuation=true", + "sentry.org-id=12345", ) .run { val options = it.getBean(SentryProperties::class.java) @@ -299,6 +301,8 @@ class SentryAutoConfigurationTest { assertThat(options.cron!!.defaultFailureIssueThreshold).isEqualTo(40L) assertThat(options.cron!!.defaultRecoveryThreshold).isEqualTo(50L) assertThat(options.logs.isEnabled).isEqualTo(true) + assertThat(options.isStrictTraceContinuation).isEqualTo(true) + assertThat(options.orgId).isEqualTo("12345") } } diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt index f37122812b1..91677d16b4e 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt @@ -249,6 +249,8 @@ class SentryAutoConfigurationTest { "sentry.profile-session-sample-rate=1.0", "sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces", "sentry.profile-lifecycle=TRACE", + "sentry.strict-trace-continuation=true", + "sentry.org-id=12345", ) .run { val options = it.getBean(SentryProperties::class.java) @@ -307,6 +309,8 @@ class SentryAutoConfigurationTest { assertThat(options.profilingTracesDirPath) .startsWith(File("tmp/sentry/profiling-traces").absolutePath) assertThat(options.profileLifecycle).isEqualTo(ProfileLifecycle.TRACE) + assertThat(options.isStrictTraceContinuation).isEqualTo(true) + assertThat(options.orgId).isEqualTo("12345") } } diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt index 4ce0bf61208..d9e598d0473 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt @@ -247,6 +247,8 @@ class SentryAutoConfigurationTest { "sentry.profile-session-sample-rate=1.0", "sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces", "sentry.profile-lifecycle=TRACE", + "sentry.strict-trace-continuation=true", + "sentry.org-id=12345", ) .run { val options = it.getBean(SentryProperties::class.java) @@ -305,6 +307,8 @@ class SentryAutoConfigurationTest { assertThat(options.profilingTracesDirPath) .startsWith(File("tmp/sentry/profiling-traces").absolutePath) assertThat(options.profileLifecycle).isEqualTo(ProfileLifecycle.TRACE) + assertThat(options.isStrictTraceContinuation).isEqualTo(true) + assertThat(options.orgId).isEqualTo("12345") } } diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt index dfb8376286a..ffdd2b9ad75 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt @@ -96,6 +96,7 @@ class SentryTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt index b14f1b5910c..f0b8d62e025 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt @@ -98,6 +98,7 @@ class SentryWebFluxTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt index f12517ee19e..f942da342c5 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt @@ -96,6 +96,7 @@ class SentryTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt index b27c0856106..5d91ec58486 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt @@ -98,6 +98,7 @@ class SentryWebFluxTracingFilterTest { logger, it.arguments[0] as String?, it.arguments[1] as List?, + null, ) ) } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 3962c3ef1e2..b9cbb2ae1b2 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -47,6 +47,7 @@ public final class io/sentry/Baggage { public static fun fromHeader (Ljava/util/List;ZLio/sentry/ILogger;)Lio/sentry/Baggage; public fun get (Ljava/lang/String;)Ljava/lang/String; public fun getEnvironment ()Ljava/lang/String; + public fun getOrgId ()Ljava/lang/String; public fun getPublicKey ()Ljava/lang/String; public fun getRelease ()Ljava/lang/String; public fun getReplayId ()Ljava/lang/String; @@ -62,6 +63,7 @@ public final class io/sentry/Baggage { public fun isShouldFreeze ()Z public fun set (Ljava/lang/String;Ljava/lang/String;)V public fun setEnvironment (Ljava/lang/String;)V + public fun setOrgId (Ljava/lang/String;)V public fun setPublicKey (Ljava/lang/String;)V public fun setRelease (Ljava/lang/String;)V public fun setReplayId (Ljava/lang/String;)V @@ -81,6 +83,7 @@ public final class io/sentry/Baggage { public final class io/sentry/Baggage$DSCKeys { public static final field ALL Ljava/util/List; public static final field ENVIRONMENT Ljava/lang/String; + public static final field ORG_ID Ljava/lang/String; public static final field PUBLIC_KEY Ljava/lang/String; public static final field RELEASE Ljava/lang/String; public static final field REPLAY_ID Ljava/lang/String; @@ -501,6 +504,7 @@ public final class io/sentry/ExternalOptions { public fun getInAppExcludes ()Ljava/util/List; public fun getInAppIncludes ()Ljava/util/List; public fun getMaxRequestBodySize ()Lio/sentry/SentryOptions$RequestSize; + public fun getOrgId ()Ljava/lang/String; public fun getPrintUncaughtStackTrace ()Ljava/lang/Boolean; public fun getProfileLifecycle ()Lio/sentry/ProfileLifecycle; public fun getProfileSessionSampleRate ()Ljava/lang/Double; @@ -531,6 +535,7 @@ public final class io/sentry/ExternalOptions { public fun isGlobalHubMode ()Ljava/lang/Boolean; public fun isSendDefaultPii ()Ljava/lang/Boolean; public fun isSendModules ()Ljava/lang/Boolean; + public fun isStrictTraceContinuation ()Ljava/lang/Boolean; public fun setCaptureOpenTelemetryEvents (Ljava/lang/Boolean;)V public fun setCron (Lio/sentry/SentryOptions$Cron;)V public fun setDebug (Ljava/lang/Boolean;)V @@ -554,6 +559,7 @@ public final class io/sentry/ExternalOptions { public fun setIgnoredErrors (Ljava/util/List;)V public fun setIgnoredTransactions (Ljava/util/List;)V public fun setMaxRequestBodySize (Lio/sentry/SentryOptions$RequestSize;)V + public fun setOrgId (Ljava/lang/String;)V public fun setPrintUncaughtStackTrace (Ljava/lang/Boolean;)V public fun setProfileLifecycle (Lio/sentry/ProfileLifecycle;)V public fun setProfileSessionSampleRate (Ljava/lang/Double;)V @@ -570,6 +576,7 @@ public final class io/sentry/ExternalOptions { public fun setSessionFlushTimeoutMillis (Ljava/lang/Long;)V public fun setShutdownTimeoutMillis (Ljava/lang/Long;)V public fun setSpotlightConnectionUrl (Ljava/lang/String;)V + public fun setStrictTraceContinuation (Ljava/lang/Boolean;)V public fun setTag (Ljava/lang/String;Ljava/lang/String;)V public fun setTracesSampleRate (Ljava/lang/Double;)V } @@ -2277,9 +2284,9 @@ public final class io/sentry/PropagationContext { public fun (Lio/sentry/PropagationContext;)V public fun (Lio/sentry/protocol/SentryId;Lio/sentry/SpanId;Lio/sentry/SpanId;Lio/sentry/Baggage;Ljava/lang/Boolean;)V public static fun fromExistingTrace (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Double;Ljava/lang/Double;)Lio/sentry/PropagationContext; - public static fun fromHeaders (Lio/sentry/ILogger;Ljava/lang/String;Ljava/lang/String;)Lio/sentry/PropagationContext; - public static fun fromHeaders (Lio/sentry/ILogger;Ljava/lang/String;Ljava/util/List;)Lio/sentry/PropagationContext; - public static fun fromHeaders (Lio/sentry/SentryTraceHeader;Lio/sentry/Baggage;Lio/sentry/SpanId;)Lio/sentry/PropagationContext; + public static fun fromHeaders (Lio/sentry/ILogger;Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryOptions;)Lio/sentry/PropagationContext; + public static fun fromHeaders (Lio/sentry/ILogger;Ljava/lang/String;Ljava/util/List;Lio/sentry/SentryOptions;)Lio/sentry/PropagationContext; + public static fun fromHeaders (Lio/sentry/SentryTraceHeader;Lio/sentry/Baggage;Lio/sentry/SpanId;Lio/sentry/SentryOptions;)Lio/sentry/PropagationContext; public fun getBaggage ()Lio/sentry/Baggage; public fun getParentSpanId ()Lio/sentry/SpanId; public fun getSampleRand ()Ljava/lang/Double; @@ -3585,6 +3592,7 @@ public class io/sentry/SentryOptions { public fun getDistribution ()Lio/sentry/SentryOptions$DistributionOptions; public fun getDistributionController ()Lio/sentry/IDistributionApi; public fun getDsn ()Ljava/lang/String; + public fun getEffectiveOrgId ()Ljava/lang/String; public fun getEnvelopeDiskCache ()Lio/sentry/cache/IEnvelopeCache; public fun getEnvelopeReader ()Lio/sentry/IEnvelopeReader; public fun getEnvironment ()Ljava/lang/String; @@ -3625,6 +3633,7 @@ public class io/sentry/SentryOptions { public fun getOnOversizedEvent ()Lio/sentry/SentryOptions$OnOversizedEventCallback; public fun getOpenTelemetryMode ()Lio/sentry/SentryOpenTelemetryMode; public fun getOptionsObservers ()Ljava/util/List; + public fun getOrgId ()Ljava/lang/String; public fun getOutboxPath ()Ljava/lang/String; public fun getPerformanceCollectors ()Ljava/util/List; public fun getProfileLifecycle ()Lio/sentry/ProfileLifecycle; @@ -3697,6 +3706,7 @@ public class io/sentry/SentryOptions { public fun isSendDefaultPii ()Z public fun isSendModules ()Z public fun isStartProfilerOnAppStart ()Z + public fun isStrictTraceContinuation ()Z public fun isTraceOptionsRequests ()Z public fun isTraceSampling ()Z public fun isTracingEnabled ()Z @@ -3781,6 +3791,7 @@ public class io/sentry/SentryOptions { public fun setOnDiscard (Lio/sentry/SentryOptions$OnDiscardCallback;)V public fun setOnOversizedEvent (Lio/sentry/SentryOptions$OnOversizedEventCallback;)V public fun setOpenTelemetryMode (Lio/sentry/SentryOpenTelemetryMode;)V + public fun setOrgId (Ljava/lang/String;)V public fun setPrintUncaughtStackTrace (Z)V public fun setProfileLifecycle (Lio/sentry/ProfileLifecycle;)V public fun setProfileSessionSampleRate (Ljava/lang/Double;)V @@ -3813,6 +3824,7 @@ public class io/sentry/SentryOptions { public fun setSpotlightConnectionUrl (Ljava/lang/String;)V public fun setSslSocketFactory (Ljavax/net/ssl/SSLSocketFactory;)V public fun setStartProfilerOnAppStart (Z)V + public fun setStrictTraceContinuation (Z)V public fun setTag (Ljava/lang/String;Ljava/lang/String;)V public fun setThreadChecker (Lio/sentry/util/thread/IThreadChecker;)V public fun setTraceOptionsRequests (Z)V @@ -7800,6 +7812,7 @@ public final class io/sentry/util/TracingUtils { public static fun isIgnored (Ljava/util/List;Ljava/lang/String;)Z public static fun maybeUpdateBaggage (Lio/sentry/IScope;Lio/sentry/SentryOptions;)Lio/sentry/PropagationContext; public static fun setTrace (Lio/sentry/IScopes;Lio/sentry/PropagationContext;)V + public static fun shouldContinueTrace (Lio/sentry/SentryOptions;Lio/sentry/Baggage;)Z public static fun startNewTrace (Lio/sentry/IScopes;)V public static fun trace (Lio/sentry/IScopes;Ljava/util/List;Lio/sentry/ISpan;)Lio/sentry/util/TracingUtils$TracingHeaders; public static fun traceIfAllowed (Lio/sentry/IScopes;Ljava/lang/String;Ljava/util/List;Lio/sentry/ISpan;)Lio/sentry/util/TracingUtils$TracingHeaders; diff --git a/sentry/src/main/java/io/sentry/Baggage.java b/sentry/src/main/java/io/sentry/Baggage.java index 5f610a02918..4645df3f3a4 100644 --- a/sentry/src/main/java/io/sentry/Baggage.java +++ b/sentry/src/main/java/io/sentry/Baggage.java @@ -186,6 +186,7 @@ public static Baggage fromEvent( baggage.setPublicKey(options.retrieveParsedDsn().getPublicKey()); baggage.setRelease(event.getRelease()); baggage.setEnvironment(event.getEnvironment()); + baggage.setOrgId(options.getEffectiveOrgId()); baggage.setTransaction(transaction); // we don't persist sample rate baggage.setSampleRate(null); @@ -450,6 +451,16 @@ public void setReplayId(final @Nullable String replayId) { set(DSCKeys.REPLAY_ID, replayId); } + @ApiStatus.Internal + public @Nullable String getOrgId() { + return get(DSCKeys.ORG_ID); + } + + @ApiStatus.Internal + public void setOrgId(final @Nullable String orgId) { + set(DSCKeys.ORG_ID, orgId); + } + /** * Sets / updates a value, but only if the baggage is still mutable. * @@ -501,6 +512,7 @@ public void setValuesFromTransaction( if (replayId != null && !SentryId.EMPTY_ID.equals(replayId)) { setReplayId(replayId.toString()); } + setOrgId(sentryOptions.getEffectiveOrgId()); setSampleRate(sampleRate(samplingDecision)); setSampled(StringUtils.toString(sampled(samplingDecision))); setSampleRand(sampleRand(samplingDecision)); @@ -536,6 +548,7 @@ public void setValuesFromScope( if (!SentryId.EMPTY_ID.equals(replayId)) { setReplayId(replayId.toString()); } + setOrgId(options.getEffectiveOrgId()); setTransaction(null); setSampleRate(null); setSampled(null); @@ -632,6 +645,7 @@ public static final class DSCKeys { public static final String SAMPLE_RAND = "sentry-sample_rand"; public static final String SAMPLED = "sentry-sampled"; public static final String REPLAY_ID = "sentry-replay_id"; + public static final String ORG_ID = "sentry-org_id"; public static final List ALL = Arrays.asList( @@ -644,6 +658,7 @@ public static final class DSCKeys { SAMPLE_RATE, SAMPLE_RAND, SAMPLED, - REPLAY_ID); + REPLAY_ID, + ORG_ID); } } diff --git a/sentry/src/main/java/io/sentry/Dsn.java b/sentry/src/main/java/io/sentry/Dsn.java index 705d383266e..0d21499b5fc 100644 --- a/sentry/src/main/java/io/sentry/Dsn.java +++ b/sentry/src/main/java/io/sentry/Dsn.java @@ -2,15 +2,20 @@ import io.sentry.util.Objects; import java.net.URI; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; final class Dsn { + private static final @NotNull Pattern ORG_ID_PATTERN = Pattern.compile("^o(\\d+)\\."); + private final @NotNull String projectId; private final @Nullable String path; private final @Nullable String secretKey; private final @NotNull String publicKey; private final @NotNull URI sentryUri; + private final @Nullable String orgId; /* / The project ID which the authenticated user is bound to. @@ -87,8 +92,23 @@ URI getSentryUri() { sentryUri = new URI( scheme, null, uri.getHost(), uri.getPort(), path + "api/" + projectId, null, null); + + // Extract org ID from host (e.g., "o123.ingest.sentry.io" -> "123") + String extractedOrgId = null; + final String host = uri.getHost(); + if (host != null) { + final Matcher matcher = ORG_ID_PATTERN.matcher(host); + if (matcher.find()) { + extractedOrgId = matcher.group(1); + } + } + orgId = extractedOrgId; } catch (Throwable e) { throw new IllegalArgumentException(e); } } + + public @Nullable String getOrgId() { + return orgId; + } } diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index dade1f140c8..e992c04466b 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -66,6 +66,9 @@ public final class ExternalOptions { private @Nullable String profilingTracesDirPath; private @Nullable ProfileLifecycle profileLifecycle; + private @Nullable Boolean strictTraceContinuation; + private @Nullable String orgId; + private @Nullable SentryOptions.Cron cron; @SuppressWarnings("unchecked") @@ -221,6 +224,10 @@ public final class ExternalOptions { options.setCron(cron); } + options.setStrictTraceContinuation( + propertiesProvider.getBooleanProperty("enable-strict-trace-continuation")); + options.setOrgId(propertiesProvider.getProperty("org-id")); + options.setEnableSpotlight(propertiesProvider.getBooleanProperty("enable-spotlight")); options.setSpotlightConnectionUrl(propertiesProvider.getProperty("spotlight-connection-url")); options.setProfileSessionSampleRate( @@ -621,6 +628,22 @@ public void setProfilingTracesDirPath(@Nullable String profilingTracesDirPath) { this.profilingTracesDirPath = profilingTracesDirPath; } + public @Nullable Boolean isStrictTraceContinuation() { + return strictTraceContinuation; + } + + public void setStrictTraceContinuation(final @Nullable Boolean strictTraceContinuation) { + this.strictTraceContinuation = strictTraceContinuation; + } + + public @Nullable String getOrgId() { + return orgId; + } + + public void setOrgId(final @Nullable String orgId) { + this.orgId = orgId; + } + public @Nullable ProfileLifecycle getProfileLifecycle() { return profileLifecycle; } diff --git a/sentry/src/main/java/io/sentry/PropagationContext.java b/sentry/src/main/java/io/sentry/PropagationContext.java index e7d39d35fe5..a6779805276 100644 --- a/sentry/src/main/java/io/sentry/PropagationContext.java +++ b/sentry/src/main/java/io/sentry/PropagationContext.java @@ -15,14 +15,16 @@ public final class PropagationContext { public static PropagationContext fromHeaders( final @NotNull ILogger logger, final @Nullable String sentryTraceHeader, - final @Nullable String baggageHeader) { - return fromHeaders(logger, sentryTraceHeader, Arrays.asList(baggageHeader)); + final @Nullable String baggageHeader, + final @Nullable SentryOptions options) { + return fromHeaders(logger, sentryTraceHeader, Arrays.asList(baggageHeader), options); } public static @NotNull PropagationContext fromHeaders( final @NotNull ILogger logger, final @Nullable String sentryTraceHeaderString, - final @Nullable List baggageHeaderStrings) { + final @Nullable List baggageHeaderStrings, + final @Nullable SentryOptions options) { if (sentryTraceHeaderString == null) { return new PropagationContext(); } @@ -30,7 +32,8 @@ public static PropagationContext fromHeaders( try { final @NotNull SentryTraceHeader traceHeader = new SentryTraceHeader(sentryTraceHeaderString); final @NotNull Baggage baggage = Baggage.fromHeader(baggageHeaderStrings, logger); - return fromHeaders(traceHeader, baggage, null); + + return fromHeaders(traceHeader, baggage, null, options); } catch (InvalidSentryTraceHeaderException e) { logger.log(SentryLevel.DEBUG, e, "Failed to parse Sentry trace header: %s", e.getMessage()); return new PropagationContext(); @@ -40,7 +43,15 @@ public static PropagationContext fromHeaders( public static @NotNull PropagationContext fromHeaders( final @NotNull SentryTraceHeader sentryTraceHeader, final @Nullable Baggage baggage, - final @Nullable SpanId spanId) { + final @Nullable SpanId spanId, + final @Nullable SentryOptions options) { + if (options != null && !TracingUtils.shouldContinueTrace(options, baggage)) { + options + .getLogger() + .log(SentryLevel.DEBUG, "Not continuing trace due to strict org ID validation failure."); + return new PropagationContext(); + } + final @NotNull SpanId spanIdToUse = spanId == null ? new SpanId() : spanId; return new PropagationContext( diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index e155979e064..82c03feac4b 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -1135,7 +1135,8 @@ public void reportFullyDisplayed() { final @Nullable String sentryTrace, final @Nullable List baggageHeaders) { @NotNull PropagationContext propagationContext = - PropagationContext.fromHeaders(getOptions().getLogger(), sentryTrace, baggageHeaders); + PropagationContext.fromHeaders( + getOptions().getLogger(), sentryTrace, baggageHeaders, getOptions()); configureScope( (scope) -> { scope.withPropagationContext( diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 9df125b4d11..86086f8816b 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -432,6 +432,21 @@ public class SentryOptions { /** Whether to propagate W3C traceparent HTTP header. */ private boolean propagateTraceparent = false; + /** + * Controls whether the SDK requires matching org IDs from incoming baggage to continue a trace. + * When true, both the SDK's org ID and the incoming baggage org ID must be present and match. + * When false, a mismatch between present org IDs will still start a new trace, but missing org + * IDs on either side are tolerated. + */ + private boolean strictTraceContinuation = false; + + /** + * An optional organization ID. The SDK will try to extract it from the DSN in most cases but you + * can provide it explicitly for self-hosted and Relay setups. This value is used for trace + * propagation and for features like {@link #strictTraceContinuation}. + */ + private @Nullable String orgId; + /** Proguard UUID. */ private @Nullable String proguardUuid; @@ -2306,6 +2321,42 @@ public void setPropagateTraceparent(final boolean propagateTraceparent) { this.propagateTraceparent = propagateTraceparent; } + public boolean isStrictTraceContinuation() { + return strictTraceContinuation; + } + + public void setStrictTraceContinuation(final boolean strictTraceContinuation) { + this.strictTraceContinuation = strictTraceContinuation; + } + + public @Nullable String getOrgId() { + return orgId; + } + + public void setOrgId(final @Nullable String orgId) { + this.orgId = orgId; + } + + /** + * Returns the effective org ID, preferring the explicit config option over the DSN-parsed value. + * Empty or whitespace-only explicit org IDs are treated as unset and fall back to the DSN. + */ + @ApiStatus.Internal + public @Nullable String getEffectiveOrgId() { + if (orgId != null) { + final @NotNull String trimmed = orgId.trim(); + if (!trimmed.isEmpty()) { + return trimmed; + } + } + try { + final @Nullable String dsnOrgId = retrieveParsedDsn().getOrgId(); + return dsnOrgId; + } catch (Throwable e) { + return null; + } + } + /** * Returns a Proguard UUID. * @@ -3557,6 +3608,12 @@ public void merge(final @NotNull ExternalOptions options) { if (options.getProfileLifecycle() != null) { setProfileLifecycle(options.getProfileLifecycle()); } + if (options.isStrictTraceContinuation() != null) { + setStrictTraceContinuation(options.isStrictTraceContinuation()); + } + if (options.getOrgId() != null) { + setOrgId(options.getOrgId()); + } } private @NotNull SdkVersion createSdkVersion() { diff --git a/sentry/src/main/java/io/sentry/util/TracingUtils.java b/sentry/src/main/java/io/sentry/util/TracingUtils.java index 673980e7359..9de7adec4be 100644 --- a/sentry/src/main/java/io/sentry/util/TracingUtils.java +++ b/sentry/src/main/java/io/sentry/util/TracingUtils.java @@ -196,6 +196,32 @@ public static boolean isIgnored( return false; } + @ApiStatus.Internal + public static boolean shouldContinueTrace( + final @NotNull SentryOptions options, final @Nullable Baggage baggage) { + final @Nullable String sdkOrgId = options.getEffectiveOrgId(); + final @Nullable String rawBaggageOrgId = baggage != null ? baggage.getOrgId() : null; + final @Nullable String baggageOrgId = + (rawBaggageOrgId != null && !rawBaggageOrgId.trim().isEmpty()) + ? rawBaggageOrgId.trim() + : null; + + // Mismatched org IDs always reject regardless of strict mode + if (sdkOrgId != null && baggageOrgId != null && !sdkOrgId.equals(baggageOrgId)) { + return false; + } + + // In strict mode, both must be present and match (unless both are missing) + if (options.isStrictTraceContinuation()) { + if (sdkOrgId == null && baggageOrgId == null) { + return true; + } + return sdkOrgId != null && sdkOrgId.equals(baggageOrgId); + } + + return true; + } + /** * Ensures a non null baggage instance is present by creating a new Baggage instance if null is * passed in. diff --git a/sentry/src/test/java/io/sentry/BaggageTest.kt b/sentry/src/test/java/io/sentry/BaggageTest.kt index fd187c61982..e177645734d 100644 --- a/sentry/src/test/java/io/sentry/BaggageTest.kt +++ b/sentry/src/test/java/io/sentry/BaggageTest.kt @@ -4,6 +4,7 @@ import com.github.javafaker.Faker import io.sentry.Baggage.MAX_BAGGAGE_LIST_MEMBER_COUNT import io.sentry.Baggage.MAX_BAGGAGE_STRING_LENGTH import io.sentry.protocol.SentryId +import io.sentry.protocol.TransactionNameSource import java.util.UUID import kotlin.test.BeforeTest import kotlin.test.Test @@ -736,6 +737,90 @@ class BaggageTest { assertNull(baggage.sampleRate) } + @Test + fun `setValuesFromScope falls back to DSN org id when explicit orgId is empty`() { + val options = + SentryOptions().apply { + dsn = "https://key@o123.ingest.sentry.io/456" + orgId = "" + } + val scope = Scope(options) + val baggage = Baggage(logger) + + baggage.setValuesFromScope(scope, options) + + assertEquals("123", baggage.orgId) + } + + @Test + fun `setValuesFromScope falls back to DSN org id when explicit orgId is whitespace`() { + val options = + SentryOptions().apply { + dsn = "https://key@o123.ingest.sentry.io/456" + orgId = " " + } + val scope = Scope(options) + val baggage = Baggage(logger) + + baggage.setValuesFromScope(scope, options) + + assertEquals("123", baggage.orgId) + } + + @Test + fun `setValuesFromTransaction falls back to DSN org id when explicit orgId is empty`() { + val options = + SentryOptions().apply { + dsn = "https://key@o123.ingest.sentry.io/456" + orgId = "" + } + val baggage = Baggage(logger) + + baggage.setValuesFromTransaction( + SentryId(), + SentryId(), + options, + TracesSamplingDecision(true, 1.0), + "test-transaction", + TransactionNameSource.CUSTOM, + ) + + assertEquals("123", baggage.orgId) + } + + @Test + fun `fromEvent falls back to DSN org id when explicit orgId is empty`() { + val options = + SentryOptions().apply { + dsn = "https://key@o123.ingest.sentry.io/456" + orgId = "" + } + val event = SentryEvent() + event.contexts.setTrace(SpanContext("test-op")) + + val baggage = Baggage.fromEvent(event, "test-transaction", options) + + assertEquals("123", baggage.orgId) + } + + @Test + fun `baggage header does not include org id when both explicit and DSN org ids are empty`() { + val options = + SentryOptions().apply { + dsn = "https://key@sentry.io/456" + orgId = "" + release = "1.0.0" + } + val scope = Scope(options) + val baggage = Baggage(logger) + + baggage.setValuesFromScope(scope, options) + val headerString = baggage.toHeaderString(null) + + // Should not contain sentry-org_id if both explicit and DSN org ids are null/empty + assertFalse(headerString.contains("sentry-org_id")) + } + /** * token = 1*tchar tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / * "`" / "|" / "~" / DIGIT / ALPHA ; any VCHAR, except delimiters diff --git a/sentry/src/test/java/io/sentry/DsnTest.kt b/sentry/src/test/java/io/sentry/DsnTest.kt index 6c454ad5c75..7e2982073f1 100644 --- a/sentry/src/test/java/io/sentry/DsnTest.kt +++ b/sentry/src/test/java/io/sentry/DsnTest.kt @@ -121,4 +121,28 @@ class DsnTest { Dsn("HTTP://publicKey:secretKey@host/path/id") Dsn("HTTPS://publicKey:secretKey@host/path/id") } + + @Test + fun `extracts org id from host`() { + val dsn = Dsn("https://key@o123.ingest.sentry.io/456") + assertEquals("123", dsn.orgId) + } + + @Test + fun `extracts single digit org id from host`() { + val dsn = Dsn("https://key@o1.ingest.us.sentry.io/456") + assertEquals("1", dsn.orgId) + } + + @Test + fun `returns null org id when host has no org prefix`() { + val dsn = Dsn("https://key@sentry.io/456") + assertNull(dsn.orgId) + } + + @Test + fun `returns null org id for non-standard host`() { + val dsn = Dsn("http://key@localhost:9000/456") + assertNull(dsn.orgId) + } } diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index 298eff34ba0..54630355557 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -463,6 +463,35 @@ class ExternalOptionsTest { } } + @Test + fun `creates options with strictTraceContinuation set to true`() { + withPropertiesFile("enable-strict-trace-continuation=true") { options -> + assertTrue(options.isStrictTraceContinuation == true) + } + } + + @Test + fun `creates options with strictTraceContinuation set to false`() { + withPropertiesFile("enable-strict-trace-continuation=false") { options -> + assertTrue(options.isStrictTraceContinuation == false) + } + } + + @Test + fun `creates options with strictTraceContinuation set to null when not set`() { + withPropertiesFile { assertNull(it.isStrictTraceContinuation) } + } + + @Test + fun `creates options with orgId using external properties`() { + withPropertiesFile("org-id=12345") { options -> assertEquals("12345", options.orgId) } + } + + @Test + fun `creates options with orgId set to null when not set`() { + withPropertiesFile { assertNull(it.orgId) } + } + private fun withPropertiesFile( textLines: List = emptyList(), logger: ILogger = mock(), diff --git a/sentry/src/test/java/io/sentry/PropagationContextTest.kt b/sentry/src/test/java/io/sentry/PropagationContextTest.kt index 8e83dec4deb..5e38846519d 100644 --- a/sentry/src/test/java/io/sentry/PropagationContextTest.kt +++ b/sentry/src/test/java/io/sentry/PropagationContextTest.kt @@ -1,7 +1,9 @@ package io.sentry import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertNotEquals import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -13,6 +15,7 @@ class PropagationContextTest { NoOpLogger.getInstance(), "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1", "sentry-trace_id=a,sentry-transaction=sentryTransaction", + null, ) assertFalse(propagationContext.baggage.isMutable) assertTrue(propagationContext.baggage.isShouldFreeze) @@ -25,6 +28,7 @@ class PropagationContextTest { NoOpLogger.getInstance(), "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1", "a=b", + null, ) assertTrue(propagationContext.baggage.isMutable) assertFalse(propagationContext.baggage.isShouldFreeze) @@ -37,9 +41,169 @@ class PropagationContextTest { NoOpLogger.getInstance(), "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1", null as? String?, + null, ) assertNotNull(propagationContext.baggage) assertTrue(propagationContext.baggage.isMutable) assertFalse(propagationContext.baggage.isShouldFreeze) } + + // Decision matrix tests for shouldContinueTrace + + private val incomingTraceId = "bc6d53f15eb88f4320054569b8c553d4" + private val sentryTrace = "bc6d53f15eb88f4320054569b8c553d4-b72fa28504b07285-1" + + private fun makeOptions( + dsnOrgId: String?, + explicitOrgId: String? = null, + strict: Boolean = false, + ): SentryOptions { + val options = SentryOptions() + if (dsnOrgId != null) { + options.dsn = "https://key@o$dsnOrgId.ingest.sentry.io/123" + } else { + options.dsn = "https://key@sentry.io/123" + } + options.orgId = explicitOrgId + options.isStrictTraceContinuation = strict + return options + } + + private fun makeBaggage(orgId: String?): String { + val parts = mutableListOf("sentry-trace_id=$incomingTraceId") + if (orgId != null) { + parts.add("sentry-org_id=$orgId") + } + return parts.joinToString(",") + } + + @Test + fun `strict=false, matching orgs - continues trace`() { + val options = makeOptions(dsnOrgId = "1", strict = false) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=false, baggage missing org - continues trace`() { + val options = makeOptions(dsnOrgId = "1", strict = false) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage(null)), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=false, sdk missing org - continues trace`() { + val options = makeOptions(dsnOrgId = null, strict = false) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=false, both missing org - continues trace`() { + val options = makeOptions(dsnOrgId = null, strict = false) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage(null)), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=false, mismatched orgs - starts new trace`() { + val options = makeOptions(dsnOrgId = "2", strict = false) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertNotEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=true, matching orgs - continues trace`() { + val options = makeOptions(dsnOrgId = "1", strict = true) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=true, baggage missing org - starts new trace`() { + val options = makeOptions(dsnOrgId = "1", strict = true) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage(null)), + options, + ) + assertNotEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=true, sdk missing org - starts new trace`() { + val options = makeOptions(dsnOrgId = null, strict = true) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertNotEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=true, both missing org - continues trace`() { + val options = makeOptions(dsnOrgId = null, strict = true) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage(null)), + options, + ) + assertEquals(incomingTraceId, pc.traceId.toString()) + } + + @Test + fun `strict=true, mismatched orgs - starts new trace`() { + val options = makeOptions(dsnOrgId = "2", strict = true) + val pc = + PropagationContext.fromHeaders( + NoOpLogger.getInstance(), + sentryTrace, + listOf(makeBaggage("1")), + options, + ) + assertNotEquals(incomingTraceId, pc.traceId.toString()) + } } diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 1b9ce5eace3..da014b30f74 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -972,6 +972,114 @@ class SentryOptionsTest { assertSame(mock, options.logs.loggerBatchProcessorFactory) } + @Test + fun `when options is initialized, strictTraceContinuation is false`() { + assertFalse(SentryOptions().isStrictTraceContinuation) + } + + @Test + fun `when options is initialized, orgId is null`() { + assertNull(SentryOptions().orgId) + } + + @Test + fun `merging options applies strictTraceContinuation`() { + val externalOptions = ExternalOptions() + externalOptions.setStrictTraceContinuation(true) + val options = SentryOptions() + options.merge(externalOptions) + assertTrue(options.isStrictTraceContinuation) + } + + @Test + fun `merging options when strictTraceContinuation is not set preserves the previous value`() { + val externalOptions = ExternalOptions() + val options = SentryOptions() + options.isStrictTraceContinuation = true + options.merge(externalOptions) + assertTrue(options.isStrictTraceContinuation) + } + + @Test + fun `merging options applies orgId`() { + val externalOptions = ExternalOptions() + externalOptions.setOrgId("12345") + val options = SentryOptions() + options.merge(externalOptions) + assertEquals("12345", options.orgId) + } + + @Test + fun `merging options when orgId is not set preserves the previous value`() { + val externalOptions = ExternalOptions() + val options = SentryOptions() + options.orgId = "original" + options.merge(externalOptions) + assertEquals("original", options.orgId) + } + + @Test + fun `getEffectiveOrgId prefers explicit orgId over DSN`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + options.orgId = "999" + assertEquals("999", options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId falls back to DSN org id`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + assertEquals("123", options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId returns null when no orgId configured`() { + val options = SentryOptions() + options.dsn = "https://key@sentry.io/456" + assertNull(options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId falls back to DSN when explicit orgId is empty string`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + options.orgId = "" + assertEquals("123", options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId falls back to DSN when explicit orgId is whitespace only`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + options.orgId = " " + assertEquals("123", options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId falls back to DSN when explicit orgId is tab and newline`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + options.orgId = "\t\n" + assertEquals("123", options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId returns null when explicit orgId is empty and no DSN orgId`() { + val options = SentryOptions() + options.dsn = "https://key@sentry.io/456" + options.orgId = "" + assertNull(options.effectiveOrgId) + } + + @Test + fun `getEffectiveOrgId trims whitespace from explicit orgId`() { + val options = SentryOptions() + options.dsn = "https://key@o123.ingest.sentry.io/456" + options.orgId = " 999 " + assertEquals("999", options.effectiveOrgId) + } + @Test fun `scopesStorageFactory is null by default`() { val options = SentryOptions() diff --git a/sentry/src/test/java/io/sentry/TransactionContextTest.kt b/sentry/src/test/java/io/sentry/TransactionContextTest.kt index a27a600e96c..55603853a66 100644 --- a/sentry/src/test/java/io/sentry/TransactionContextTest.kt +++ b/sentry/src/test/java/io/sentry/TransactionContextTest.kt @@ -31,6 +31,7 @@ class TransactionContextTest { logger, SentryTraceHeader(SentryId(), SpanId(), false).value, "sentry-trace_id=a,sentry-transaction=sentryTransaction,sentry-sample_rate=0.3", + null, ) val context = TransactionContext.fromPropagationContext(propagationContext) assertNull(context.sampled) @@ -48,6 +49,7 @@ class TransactionContextTest { logger, SentryTraceHeader(SentryId(), SpanId(), false).value, "sentry-trace_id=a,sentry-transaction=sentryTransaction", + null, ) val context = TransactionContext.fromPropagationContext(propagationContext) assertNull(context.sampled) @@ -65,6 +67,7 @@ class TransactionContextTest { logger, SentryTraceHeader(SentryId(), SpanId(), true).value, "sentry-trace_id=a,sentry-transaction=sentryTransaction,sentry-sample_rate=0.3", + null, ) val context = TransactionContext.fromPropagationContext(propagationContext) assertNull(context.sampled) @@ -82,6 +85,7 @@ class TransactionContextTest { logger, SentryTraceHeader(SentryId(), SpanId(), true).value, "sentry-trace_id=a,sentry-transaction=sentryTransaction", + null, ) val context = TransactionContext.fromPropagationContext(propagationContext) assertNull(context.sampled) diff --git a/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt b/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt index 9c906712261..edfcc361b08 100644 --- a/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt @@ -510,4 +510,84 @@ class TracingUtilsTest { assertEquals(fixture.scope.propagationContext.spanId.toString(), parts[2]) assertEquals("00", parts[3]) } + + private fun makeOptions( + dsnOrgId: String?, + explicitOrgId: String? = null, + strict: Boolean = false, + ): SentryOptions { + val options = SentryOptions() + if (dsnOrgId != null) { + options.dsn = "https://key@o$dsnOrgId.ingest.sentry.io/123" + } else { + options.dsn = "https://key@sentry.io/123" + } + options.orgId = explicitOrgId + options.isStrictTraceContinuation = strict + return options + } + + private fun makeBaggage(orgId: String?): Baggage { + val raw = + if (orgId != null) { + "sentry-trace_id=bc6d53f15eb88f4320054569b8c553d4,sentry-org_id=$orgId" + } else { + "sentry-trace_id=bc6d53f15eb88f4320054569b8c553d4" + } + return Baggage.fromHeader(raw, NoOpLogger.getInstance()) + } + + @Test + fun `shouldContinueTrace strict=false matching org ids returns true`() { + val options = makeOptions(dsnOrgId = "1", strict = false) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage("1"))) + } + + @Test + fun `shouldContinueTrace strict=false mismatched org ids returns false`() { + val options = makeOptions(dsnOrgId = "2", strict = false) + assertFalse(TracingUtils.shouldContinueTrace(options, makeBaggage("1"))) + } + + @Test + fun `shouldContinueTrace strict=true matching org ids returns true`() { + val options = makeOptions(dsnOrgId = "1", strict = true) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage("1"))) + } + + @Test + fun `shouldContinueTrace strict=true missing baggage org id returns false`() { + val options = makeOptions(dsnOrgId = "1", strict = true) + assertFalse(TracingUtils.shouldContinueTrace(options, makeBaggage(null))) + } + + @Test + fun `shouldContinueTrace strict=true both missing org ids returns true`() { + val options = makeOptions(dsnOrgId = null, strict = true) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage(null))) + } + + @Test + fun `shouldContinueTrace uses DSN fallback when explicit orgId is empty`() { + val options = makeOptions(dsnOrgId = "123", explicitOrgId = "", strict = true) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage("123"))) + } + + @Test + fun `shouldContinueTrace uses DSN fallback when explicit orgId is whitespace`() { + val options = makeOptions(dsnOrgId = "123", explicitOrgId = " ", strict = true) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage("123"))) + } + + @Test + fun `shouldContinueTrace rejects mismatch after empty explicit orgId falls back to DSN`() { + val options = makeOptions(dsnOrgId = "123", explicitOrgId = "", strict = true) + assertFalse(TracingUtils.shouldContinueTrace(options, makeBaggage("999"))) + } + + @Test + fun `shouldContinueTrace strict=false with empty explicit orgId uses DSN fallback`() { + val options = makeOptions(dsnOrgId = "123", explicitOrgId = "", strict = false) + assertTrue(TracingUtils.shouldContinueTrace(options, makeBaggage("123"))) + } } From 58892596dfba8c72800e3a5bc3257b0693ca6211 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:15:06 +0200 Subject: [PATCH 086/391] build(deps): bump github/codeql-action from 4.32.6 to 4.35.1 (#5243) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.6 to 4.35.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/0d579ffd059c29b07949a3cce3983f0780820c98...c10b8064de6f491fea524254123dbe5e09572f13) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.35.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 06aa7fdcba4..6b30f064c49 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # pin@v2 + uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # pin@v2 + uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # pin@v2 From d12a33cb0d775be364de874512cee8fa431b110e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:18:29 +0200 Subject: [PATCH 087/391] build(deps): bump requests from 2.32.4 to 2.33.0 in the uv group across 1 directory (#5237) Bumps the uv group with 1 update in the / directory: [requests](https://github.com/psf/requests). Updates `requests` from 2.32.4 to 2.33.0 - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.32.4...v2.33.0) --- updated-dependencies: - dependency-name: requests dependency-version: 2.33.0 dependency-type: direct:production dependency-group: uv ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ce11ab2364c..ace4a3e0374 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ certifi==2025.7.14 charset-normalizer==3.4.2 idna==3.10 -requests==2.32.4 +requests==2.33.0 urllib3==2.6.3 From 34e1ee33c2967e77d7fafe5c698bb84eb8de22fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:47:15 +0200 Subject: [PATCH 088/391] build(deps): bump getsentry/craft from 2.24.1 to 2.25.2 (#5242) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.24.1 to 2.25.2. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/013a7b2113c2cac0ff32d5180cfeaefc7c9ce5b6...ba01e596c4a4c07692f0de10b0d4fe05f3dd0292) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.25.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdf7c141026..eb99dca7f25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@013a7b2113c2cac0ff32d5180cfeaefc7c9ce5b6 # v2 + uses: getsentry/craft@ba01e596c4a4c07692f0de10b0d4fe05f3dd0292 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From a0e1341f423af62c9a7b1c02ff251103a42a0d26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:48:36 +0200 Subject: [PATCH 089/391] build(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.0 to 2.25.2 (#5245) Bumps [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) from 2.25.0 to 2.25.2. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/f4889d04564e47311038ecb6b910fef6b6cf1363...ba01e596c4a4c07692f0de10b0d4fe05f3dd0292) --- updated-dependencies: - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.25.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changelog-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index 2b37e202856..f22a34cba7c 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@f4889d04564e47311038ecb6b910fef6b6cf1363 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@ba01e596c4a4c07692f0de10b0d4fe05f3dd0292 # v2 secrets: inherit From 05d6f765f5e3cb32d2d12e234612a64c3e651d99 Mon Sep 17 00:00:00 2001 From: Itay Brenner Date: Tue, 31 Mar 2026 11:22:08 -0300 Subject: [PATCH 090/391] chore: bump action-app-sdk-overhead-metrics SHA (#5238) --- .github/workflows/integration-tests-benchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index dec5c8eae51..dee3ddb6652 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -106,7 +106,7 @@ jobs: run: ./gradlew :sentry-android-integration-tests:test-app-sentry:assembleRelease - name: Collect app metrics - uses: getsentry/action-app-sdk-overhead-metrics@ecce2e2718b6d97ad62220fca05627900b061ed5 + uses: getsentry/action-app-sdk-overhead-metrics@44fb5489ac4ac252c87d84811972dc93a1e490b8 with: config: sentry-android-integration-tests/metrics-test.yml sauce-user: ${{ secrets.SAUCE_USERNAME }} From a1eadfac15bc28deb016dfb5632b483770eedc4e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:23:10 +0200 Subject: [PATCH 091/391] build(deps): bump codecov/codecov-action from 5.5.2 to 6.0.0 (#5246) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.5.2 to 6.0.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/671740ac38dd9b0130fbe1cec585b89eea48d3de...57e3a136b779b570ffcdbf80b3bdc90e7fab3de2) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e5a79f5930..06fa061d4ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: run: make preMerge - name: Upload coverage to Codecov - uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # pin@v4 + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@v4 with: name: sentry-java fail_ci_if_error: false From 62c14b0aad97f2aa44e02c0ad881c237c2252e1b Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Wed, 1 Apr 2026 08:47:16 +0200 Subject: [PATCH 092/391] chore(tooling): Add dotagents configuration (#5230) * meta: Add dotagents configuration Sets up dotagents to manage AI agent skills declaratively via agents.toml. Previously committed skills are now managed by dotagents and gitignored. Co-Authored-By: Claude Opus 4.6 (1M context) * meta: Keep custom skills alongside dotagents-managed ones Use a nested .gitignore in .claude/skills/ to ignore dotagents-managed skills while preserving repo-specific custom skills (create-java-pr, test). Co-Authored-By: Claude Opus 4.6 (1M context) * Declare built-in skills --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .claude/skills/.gitignore | 8 ++++++++ .gitignore | 3 +++ agents.toml | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .claude/skills/.gitignore create mode 100644 agents.toml diff --git a/.claude/skills/.gitignore b/.claude/skills/.gitignore new file mode 100644 index 00000000000..08243027e52 --- /dev/null +++ b/.claude/skills/.gitignore @@ -0,0 +1,8 @@ +# Ignore dotagents-managed skills (synced from agents.toml) +* +# Keep custom repo-specific skills +!.gitignore +!create-java-pr/ +!create-java-pr/** +!test/ +!test/** diff --git a/.gitignore b/.gitignore index f232c32db51..a7899736a86 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ spy.log # Local Claude Code settings/state that should not be committed .claude/settings.local.json .claude/worktrees/ +# Auto-generated by dotagents — do not commit these files. +agents.lock +.agents/.gitignore diff --git a/agents.toml b/agents.toml new file mode 100644 index 00000000000..b2347f8e7e6 --- /dev/null +++ b/agents.toml @@ -0,0 +1,33 @@ +# Whenever you make changes to this file, run the following to update all generated dotagent files +# npx @sentry/dotagents install +# npx @sentry/dotagents sync + +version = 1 + +[[skills]] +name = "dotagents" +source = "getsentry/dotagents" + +[[skills]] +name = "sentry-workflow" +source = "getsentry/sentry-for-ai" + +[[skills]] +name = "sentry-fix-issues" +source = "getsentry/sentry-for-ai" + +[[skills]] +name = "sentry-code-review" +source = "getsentry/sentry-for-ai" + +[[skills]] +name = "sentry-pr-code-review" +source = "getsentry/sentry-for-ai" + +[[skills]] +name = "create-java-pr" +source = "path:.agents/skills/create-java-pr" + +[[skills]] +name = "test" +source = "path:.agents/skills/test" From 2195398893bdc987254ef070f604099a41630503 Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Wed, 1 Apr 2026 14:49:06 +0200 Subject: [PATCH 093/391] chore: Update validate-pr workflow (#5252) Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/validate-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 44da67faa43..10fe894067a 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: getsentry/github-workflows/validate-pr@0b52fc6a867b744dcbdf5d25c18bc8d1c95710e1 + - uses: getsentry/github-workflows/validate-pr@71588ddf95134f804e82c5970a8098588e2eaecd with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} From 327ca5122afdf678e205cff989c6882dd21664dd Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 8 Apr 2026 14:47:04 +0200 Subject: [PATCH 094/391] perf(init): Do not retrieve ActivityManager if API < 35 (#5275) * perf(init): Do not retrieve ActivityManager if API < 35 * Changelog --- CHANGELOG.md | 4 +++ .../core/performance/AppStartMetrics.java | 27 ++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bd3b127948..7c2f14fdeaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - Android: Attachments on the scope will now be synced to native ([#5211](https://github.com/getsentry/sentry-java/pull/5211)) - Add THIRD_PARTY_NOTICES.md for vendored third-party code, bundled as SENTRY_THIRD_PARTY_NOTICES.md in the sentry JAR under META-INF ([#5186](https://github.com/getsentry/sentry-java/pull/5186)) +### Improvements + +- Do not retrieve `ActivityManager` if API < 35 on SDK init ([#5275](https://github.com/getsentry/sentry-java/pull/5275)) + ## 8.37.1 ### Fixes diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java index 1bb95b9061a..746805fcfdc 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java @@ -338,19 +338,20 @@ public void registerLifecycleCallbacks(final @NotNull Application application) { appLaunchedInForeground.resetValue(); application.registerActivityLifecycleCallbacks(instance); - final @Nullable ActivityManager activityManager = - (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE); - - if (activityManager != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { - final List historicalProcessStartReasons = - activityManager.getHistoricalProcessStartReasons(1); - if (!historicalProcessStartReasons.isEmpty()) { - final @NotNull ApplicationStartInfo info = historicalProcessStartReasons.get(0); - if (info.getStartupState() == ApplicationStartInfo.STARTUP_STATE_STARTED) { - if (info.getStartType() == ApplicationStartInfo.START_TYPE_COLD) { - appStartType = AppStartType.COLD; - } else { - appStartType = AppStartType.WARM; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { + final @Nullable ActivityManager activityManager = + (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE); + if (activityManager != null) { + final List historicalProcessStartReasons = + activityManager.getHistoricalProcessStartReasons(1); + if (!historicalProcessStartReasons.isEmpty()) { + final @NotNull ApplicationStartInfo info = historicalProcessStartReasons.get(0); + if (info.getStartupState() == ApplicationStartInfo.STARTUP_STATE_STARTED) { + if (info.getStartType() == ApplicationStartInfo.START_TYPE_COLD) { + appStartType = AppStartType.COLD; + } else { + appStartType = AppStartType.WARM; + } } } } From b572de2f2ac4c5431e8279851cc41cd5b344459c Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:40:35 +0000 Subject: [PATCH 095/391] release: 8.38.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c2f14fdeaa..f78a541171c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.38.0 ### Features diff --git a/gradle.properties b/gradle.properties index 3ce5df53b45..aa2f556e2b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.9.0 # Release information -versionName=8.37.1 +versionName=8.38.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From cd0981b5927b7c57c40dc519d3a690d0af884640 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 14:05:10 +0200 Subject: [PATCH 096/391] chore(deps): update Native SDK to v0.13.6 (#5277) Co-authored-by: GitHub --- CHANGELOG.md | 8 ++++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f78a541171c..d4a9266f261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +### Dependencies + +- Bump Native SDK from v0.13.3 to v0.13.6 ([#5277](https://github.com/getsentry/sentry-java/pull/5277)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0136) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.3...0.13.6) + ## 8.38.0 ### Features diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eb7ab86e4bd..93cb7b79158 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.3" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.6" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 7935b26106c57393d64dc47bed2877617fb3cec3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 11:57:17 +0200 Subject: [PATCH 097/391] build(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#5286) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/bbbca2ddaa5d8feaa63e36b76fdaad77386f024f...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 4 ++-- .github/workflows/release-build.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 750be7ca2e4..d288bbef8ae 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -94,7 +94,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-AGP${{ matrix.agp }}-Integrations${{ matrix.integrations }} path: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06fa061d4ac..5debd3ad5a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-build path: | diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 446228943b5..46b9665a099 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -44,7 +44,7 @@ jobs: run: make assembleUiTestCriticalRelease - name: Upload APK artifact - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: ${{env.APK_ARTIFACT_NAME}} path: "${{env.BASE_PATH}}/${{env.BUILD_PATH}}/${{env.APK_NAME}}" @@ -141,7 +141,7 @@ jobs: - name: Upload Maestro test results if: ${{ always() }} - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: maestro-logs-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} path: "${{env.BASE_PATH}}/maestro-logs" diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 62d2d5caa43..3ba2d299e54 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -32,7 +32,7 @@ jobs: run: make publish - name: Upload artifacts - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: ${{ github.sha }} if-no-files-found: error diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 3e57dfd907e..9ac07b7b3ee 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-springboot-2-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 4abb488387a..963b6976cc2 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-springboot-3-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 6466abb58ae..97fd6476fed 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -150,7 +150,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-springboot-4-${{ matrix.springboot-version }} path: | diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index f225be8faf6..321d6ae5652 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -153,7 +153,7 @@ jobs: - name: Upload test results if: always() - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: test-results-${{ matrix.sample }}-${{ matrix.agent }}-${{ matrix.agent-auto-init }}-system-test path: | From 3af77f43495c957d88472975c0bdb982edb8411d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 11:57:46 +0200 Subject: [PATCH 098/391] build(deps): bump actions/create-github-app-token from 3.0.0 to 3.1.1 (#5287) Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 3.0.0 to 3.1.1. - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Commits](https://github.com/actions/create-github-app-token/compare/f8d387b68d61c58ab83c6c016672934102569859...1b10c78c7865c340bc4f6099eb2f838309f1e8c3) --- updated-dependencies: - dependency-name: actions/create-github-app-token dependency-version: 3.1.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb99dca7f25..d2b9eaf45a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Get auth token id: token - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 with: app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} From 0675272ae2a242c9db25fe96485f5167d21912ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:01:00 +0200 Subject: [PATCH 099/391] build(deps): bump actions/github-script from 8.0.0 to 9.0.0 (#5285) Bumps [actions/github-script](https://github.com/actions/github-script) from 8.0.0 to 9.0.0. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/ed597411d8f924073f98dfc5c65a23a2325f34cd...3a2844b7e9c422d3c10d287c895573f7108da1b3) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changes-in-high-risk-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changes-in-high-risk-code.yml b/.github/workflows/changes-in-high-risk-code.yml index e22fa135412..4ecc23619a4 100644 --- a/.github/workflows/changes-in-high-risk-code.yml +++ b/.github/workflows/changes-in-high-risk-code.yml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Comment on PR to notify of changes in high risk files - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: high_risk_code: ${{ needs.files-changed.outputs.high_risk_code_files }} with: From ce4b2c14da6fce40953fc11fc5df65b2839d31e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 00:10:39 +0200 Subject: [PATCH 100/391] chore(deps): update Gradle to v9.4.1 (#5063) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update scripts/update-gradle.sh to v9.4.1 * Fix build * fix dependsOn * align shadow plugin version * Fix apollo version * Format code * fix(build): remove Spring Boot 2 Gradle plugin for Gradle 9 compatibility (#5263) * fix(build): remove Spring Boot 2 Gradle plugin for Gradle 9 compatibility The Spring Boot 2.7.x Gradle plugin uses removed Gradle APIs (LenientConfiguration.getFiles()) that are incompatible with Gradle 9. Library modules (sentry-spring, sentry-spring-boot, sentry-spring-boot-starter): - Replace SpringBootPlugin.BOM_COORDINATES with direct BOM reference via version catalog (libs.springboot2.bom) - Remove the 'apply false' plugin declaration entirely Sample apps (spring-boot, webflux, otel, netflix-dgs): - Replace Spring Boot plugin with Shadow plugin for fat JAR creation - Add application plugin for main class configuration - Use platform(libs.springboot2.bom) for dependency version management - Configure shadow JAR to merge Spring metadata files - Replace BootRun task with JavaExec in otel sample * fix: set duplicatesStrategy=INCLUDE for shadow JAR spring.factories merge Shadow plugin 9.x defaults to DuplicatesStrategy.EXCLUDE, which drops duplicate META-INF/spring.factories entries before transformers can merge them. Setting INCLUDE allows the AppendingTransformer to see all entries and properly concatenate spring.factories from all JARs. Without this, the shadow JAR only contains spring.factories from a single dependency, causing Spring Boot auto-configuration to fail (e.g. missing RestTemplateBuilder, no embedded web server). * fix: remove duplicate shadow plugin entry in version catalog * Format code * fix: update system test runner for shadow JAR compatibility - Auto-detect shadowJar vs bootJar build task based on build.gradle.kts - Add fallback HTTP readiness check for shadow JAR apps that lack actuator endpoints (actuator web endpoints don't work in flat JARs) - Append spring-autoconfigure-metadata.properties in shadow JAR config * fix(otel): use DuplicatesStrategy.INCLUDE for otel agent shadow JAR Shadow 9.x enforces duplicatesStrategy before transformers run, so DuplicatesStrategy.FAIL prevents mergeServiceFiles from merging inst/META-INF/services/ files that exist in both the upstream OTel agent JAR and the isolated distro libs. Switching to INCLUDE lets the transformer see all duplicates and merge them correctly. * Exclude test-support modules from api validation * Verbose system test output and wire inputs for them properly * align coroutines version to 1.9.0 for system tests * fix(otel): use mergeServiceFiles path instead of include for Shadow 9.x Shadow 9.x's ServiceFileTransformer strips the `inst/` prefix when using `include("inst/META-INF/services/*")`, placing merged service files under `META-INF/services/` instead of `inst/META-INF/services/`. This breaks the OTel agent's classloader which expects isolated services under `inst/`. Using `path = "inst/META-INF/services"` preserves the correct output path. Also add missing `duplicatesStrategy = DuplicatesStrategy.INCLUDE` to console-otlp, log4j2, and console-opentelemetry-noagent shadow JARs so that mergeServiceFiles and Log4j2 transformers can see duplicates before they are deduplicated. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(otel): add default mergeServiceFiles for bootstrap service relocation Shadow 9.x only applies package relocations to service files that are claimed by a ServiceFileTransformer. The ContextStorageProvider service file at META-INF/services/ was not being relocated because it wasn't handled by any transformer — only the inst/META-INF/services/ files were. Adding a default mergeServiceFiles() call ensures bootstrap service files (like ContextStorageProvider) go through the transformer and get properly relocated to their shaded paths. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(spring-boot2): pre-merge Spring metadata for Shadow 9.x compatibility Shadow 9.x enforces DuplicatesStrategy before transformers run, which breaks the `append` transformer for spring.factories and other Spring metadata files. Only the last copy survives instead of being concatenated. Replace `append` calls with a pre-merge task that manually concatenates Spring metadata files (spring.factories, spring.handlers, spring.schemas, spring-autoconfigure-metadata.properties) from the runtime classpath before the shadow JAR is built. The merged files are included first in the shadow JAR so they take precedence over duplicates from dependency JARs. This fixes the PersonSystemTest failure where @SentrySpan AOP and JDBC instrumentation weren't working because SentryAutoConfiguration wasn't properly registered in the merged spring.factories. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * fix(lint): suppress OldTargetApi for uitest-android module Lint 8.13.1 (set via android.experimental.lint.version) expects targetSdk 37 but we target 36. This is a test-only module so suppressing is safe. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(spring-boot2): make mergeSpringMetadata configuration-cache compatible Resolve the runtime classpath at configuration time (not inside doLast) so the task doesn't capture Gradle script object references that can't be serialized by the configuration cache. Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(spring-boot2): replace from() with doLast JAR patching for spring metadata The from() approach with DuplicatesStrategy.INCLUDE doesn't work because dependency JARs' spring.factories overwrites the pre-merged version. Instead, let the shadow JAR build normally, then use a doLast action to replace the Spring metadata files in the built JAR with the properly merged versions using the NIO ZIP filesystem API. Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(spring-boot2): merge AutoConfiguration.imports + doLast JAR patching The shadow JAR was missing the embedded web server auto-configuration because AutoConfiguration.imports (used by SB 2.7+) had duplicate entries from multiple dependency JARs, with only the last copy surviving. Add AutoConfiguration.imports to the pre-merge file list and use doLast JAR patching via NIO ZIP filesystem to replace metadata files after the shadow JAR is built, avoiding the DuplicatesStrategy issue entirely. Also suppress OldTargetApi lint for uitest-android-benchmark module. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(spring-boot2): also merge ManagementContextConfiguration.imports This file has duplicate entries across actuator JARs and needs the same pre-merge treatment as AutoConfiguration.imports. Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(spring-boot2): use separate patchSpringMetadata task for JAR patching The doLast on shadowJar doesn't run when the task is cached/up-to-date. Move JAR patching to a separate `patchSpringMetadata` task that is finalized by shadowJar, ensuring it always runs. Also use recursive walkTopDown to handle nested directories (e.g. META-INF/spring/). Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(spring-boot2): revert to doLast on shadowJar for Spring metadata patching The separate patchSpringMetadata task approach caused regressions — the finalizedBy relationship didn't reliably execute the patching in CI. Revert to doLast directly on shadowJar with outputs.upToDateWhen { false } to ensure the patching always runs. Also use walkTopDown for recursive directory traversal (needed for META-INF/spring/ subdirectory). Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(spring-boot2): inline Spring metadata merge into shadowJar doLast Replace the separate mergeSpringMetadata task with inline doLast on shadowJar that resolves runtimeClasspath at execution time (not configuration time). This ensures all project dependency JARs are built before their spring.factories entries are read and merged. Verified locally: 20/21 system tests pass. Only PersonSystemTest 'create person works' fails due to @SentrySpan AOP limitation in shadow JARs. Co-Authored-By: Claude Opus 4.6 (1M context) * formatting * fix(build): make Spring sample shadowJar patching config-cache safe * fix(build): merge Spring metadata properties in shadow jars * fix(build): preserve escaped spring metadata keys * refactor(samples): drop no-op spring shadow service merging * test(android): Avoid ANR profiling integration test race Drive the ANR profiling state-machine test synchronously instead of starting the background polling thread. The previous version could read the queue-backed profile store while the polling thread was still appending stack traces, which made the release unit test flaky with NoSuchElementException in QueueFile iteration. Co-Authored-By: Codex * fix(test): Require actuator health for Spring readiness * ref(build): Share Spring metadata file list Move the Spring metadata entry list into MergeSpringMetadataAction so the Spring sample shadowJar tasks use one source of truth. Drop the temporary system-test-runner unit test and keep verification on the existing Spring Boot system test flow. Co-Authored-By: Codex * docs(build): Document Spring metadata merge action Explain that MergeSpringMetadataAction patches shadow JARs by merging Spring metadata with file-specific semantics and by preserving service-provider registrations from the runtime classpath. This keeps the intent of the build logic clear without changing behavior. Co-Authored-By: Codex * build(opentelemetry): Fail agent shadow duplicates by default Set the final agent shadowJar to fail on unexpected duplicate entries while still allowing service descriptors to merge in the bootstrap and inst paths. This keeps duplicate handling strict without breaking the service file transformers Shadow still relies on. Co-Authored-By: Claude --------- Co-authored-by: Sentry Github Bot Co-authored-by: Roman Zavarnitsyn Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Codex * Apply suggestion from @romtsn --------- Co-authored-by: GitHub Co-authored-by: Roman Zavarnitsyn Co-authored-by: Sentry Github Bot Co-authored-by: Alexander Dinauer Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Codex --- CHANGELOG.md | 7 + build.gradle.kts | 12 +- buildSrc/src/main/java/Config.kt | 2 +- .../main/java/MergeSpringMetadataAction.kt | 292 +++++++++ gradle.properties | 2 +- gradle/libs.versions.toml | 5 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../core/anr/AnrProfilingIntegrationTest.kt | 2 +- .../build.gradle.kts | 2 + .../sentry-uitest-android/build.gradle.kts | 2 + .../build.gradle.kts | 20 +- .../build.gradle.kts | 7 +- .../build.gradle.kts | 7 +- .../sentry-samples-console/build.gradle.kts | 6 +- .../sentry-samples-jul/build.gradle.kts | 6 +- .../sentry-samples-log4j2/build.gradle.kts | 7 +- .../sentry-samples-logback/build.gradle.kts | 6 +- .../build.gradle.kts | 30 +- .../sentry-samples-spring-7/build.gradle.kts | 4 + .../build.gradle.kts | 4 + .../build.gradle.kts | 4 + .../build.gradle.kts | 4 + .../build.gradle.kts | 4 + .../build.gradle.kts | 4 + .../build.gradle.kts | 7 + .../build.gradle.kts | 7 + .../build.gradle.kts | 8 +- .../build.gradle.kts | 35 +- .../build.gradle.kts | 42 +- .../build.gradle.kts | 7 + .../build.gradle.kts | 34 +- .../build.gradle.kts | 37 +- .../build.gradle.kts | 7 + .../sentry-samples-spring/build.gradle.kts | 11 +- sentry-spring-boot-starter/build.gradle.kts | 4 +- sentry-spring-boot/build.gradle.kts | 6 +- sentry-spring/build.gradle.kts | 4 +- .../api/sentry-system-test-support.api | 619 ------------------ sentry-system-test-support/build.gradle.kts | 4 +- .../systemtest/graphql/GraphqlTestClient.kt | 8 +- .../io/sentry/systemtest/util/TestHelper.kt | 4 +- .../api/sentry-test-support.api | 75 --- test/system-test-runner.py | 15 +- 43 files changed, 620 insertions(+), 755 deletions(-) create mode 100644 buildSrc/src/main/java/MergeSpringMetadataAction.kt delete mode 100644 sentry-system-test-support/api/sentry-system-test-support.api delete mode 100644 sentry-test-support/api/sentry-test-support.api diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a9266f261..8357f0699df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,18 @@ ## Unreleased +### Internal + +- Bump AGP version from v8.6.0 to v8.13.1 ([#5063](https://github.com/getsentry/sentry-java/pull/5063)) + ### Dependencies - Bump Native SDK from v0.13.3 to v0.13.6 ([#5277](https://github.com/getsentry/sentry-java/pull/5277)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0136) - [diff](https://github.com/getsentry/sentry-native/compare/0.13.3...0.13.6) +- Bump Gradle from v8.14.3 to v9.4.1 ([#5063](https://github.com/getsentry/sentry-java/pull/5063)) + - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v941) + - [diff](https://github.com/gradle/gradle/compare/v8.14.3...v9.4.1) ## 8.38.0 diff --git a/build.gradle.kts b/build.gradle.kts index 376d0652832..6656e00e49a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -87,7 +87,9 @@ apiValidation { "test-app-sentry", "test-app-size", "sentry-samples-netflix-dgs", - "sentry-samples-console-otlp" + "sentry-samples-console-otlp", + "sentry-test-support", + "sentry-system-test-support" ) ) } @@ -249,9 +251,13 @@ tasks.register("buildForCodeQL") { } .forEach { proj -> if (proj.plugins.hasPlugin("com.android.library")) { - this.dependsOn(proj.tasks.findByName("compileReleaseUnitTestSources")) + proj.tasks.findByName("compileReleaseUnitTestSources")?.let { testTask -> + this.dependsOn(testTask) + } } else { - this.dependsOn(proj.tasks.findByName("testClasses")) + proj.tasks.findByName("testClasses")?.let { testTask -> + this.dependsOn(testTask) + } } } } diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index b5d1dafeb74..3285db23a98 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -2,7 +2,7 @@ import java.math.BigDecimal object Config { - val AGP = System.getenv("VERSION_AGP") ?: "8.6.0" + val AGP = System.getenv("VERSION_AGP") ?: "8.13.1" val kotlinStdLib = "stdlib-jdk8" val kotlinStdLibVersionAndroid = "1.9.24" val kotlinTestJunit = "test-junit" diff --git a/buildSrc/src/main/java/MergeSpringMetadataAction.kt b/buildSrc/src/main/java/MergeSpringMetadataAction.kt new file mode 100644 index 00000000000..2df744924cb --- /dev/null +++ b/buildSrc/src/main/java/MergeSpringMetadataAction.kt @@ -0,0 +1,292 @@ +import java.net.URI +import java.nio.file.FileSystems +import java.nio.file.Files +import java.util.LinkedHashSet +import java.util.zip.ZipFile +import org.gradle.api.Action +import org.gradle.api.Task +import org.gradle.api.file.FileCollection +import org.gradle.api.tasks.bundling.AbstractArchiveTask + +/** + * Patches a built shadow JAR by merging Spring metadata and service descriptor files from the + * runtime classpath into the final archive. + * + * Spring metadata files do not all share the same merge semantics, so this action merges + * `spring.factories` as list properties, `.imports` files as line-based metadata, and other Spring + * metadata as key/value properties. It also deduplicates service-provider configuration entries + * under `META-INF/services` so the flat executable JAR keeps the runtime registrations it needs. + */ +class MergeSpringMetadataAction( + private val runtimeClasspath: FileCollection, + private val springMetadataFiles: List, +) : Action { + companion object { + val DEFAULT_SPRING_METADATA_FILES = + listOf( + "META-INF/spring.factories", + "META-INF/spring.handlers", + "META-INF/spring.schemas", + "META-INF/spring-autoconfigure-metadata.properties", + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports", + "META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports", + ) + } + + override fun execute(task: Task) { + val archiveTask = task as AbstractArchiveTask + val jar = archiveTask.archiveFile.get().asFile + val runtimeJars = runtimeClasspath.files.filter { it.name.endsWith(".jar") } + val uri = URI.create("jar:${jar.toURI()}") + + FileSystems.newFileSystem(uri, mapOf("create" to "false")).use { fs -> + springMetadataFiles.forEach { entryPath -> + val target = fs.getPath(entryPath) + val contents = mutableListOf() + + if (Files.exists(target)) { + contents.add(Files.readString(target)) + } + + runtimeJars.forEach { depJar -> + try { + ZipFile(depJar).use { zip -> + val entry = zip.getEntry(entryPath) + if (entry != null) { + contents.add(zip.getInputStream(entry).bufferedReader().readText()) + } + } + } catch (_: Exception) { + // Ignore non-zip files on the runtime classpath. + } + } + + val merged = + when { + entryPath == "META-INF/spring.factories" -> mergeListProperties(contents) + entryPath.endsWith(".imports") -> mergeLineBasedMetadata(contents) + else -> mergeMapProperties(contents) + } + + if (merged.isNotEmpty()) { + if (target.parent != null) { + Files.createDirectories(target.parent) + } + Files.write(target, merged.toByteArray()) + } + } + + val serviceEntries = linkedSetOf() + + runtimeJars.forEach { depJar -> + try { + ZipFile(depJar).use { zip -> + val entries = zip.entries() + while (entries.hasMoreElements()) { + val entry = entries.nextElement() + if (!entry.isDirectory && entry.name.startsWith("META-INF/services/")) { + serviceEntries.add(entry.name) + } + } + } + } catch (_: Exception) { + // Ignore non-zip files on the runtime classpath. + } + } + + serviceEntries.forEach { entryPath -> + val providers = LinkedHashSet() + val target = fs.getPath(entryPath) + + if (Files.exists(target)) { + Files.newBufferedReader(target).useLines { lines -> + lines.forEach { line -> + val provider = line.trim() + if (provider.isNotEmpty() && !provider.startsWith("#")) { + providers.add(provider) + } + } + } + } + + runtimeJars.forEach { depJar -> + try { + ZipFile(depJar).use { zip -> + val entry = zip.getEntry(entryPath) + if (entry != null) { + zip.getInputStream(entry).bufferedReader().useLines { lines -> + lines.forEach { line -> + val provider = line.trim() + if (provider.isNotEmpty() && !provider.startsWith("#")) { + providers.add(provider) + } + } + } + } + } + } catch (_: Exception) { + // Ignore non-zip files on the runtime classpath. + } + } + + if (providers.isNotEmpty()) { + if (target.parent != null) { + Files.createDirectories(target.parent) + } + Files.write(target, providers.joinToString(separator = "\n", postfix = "\n").toByteArray()) + } + } + } + } + + private fun mergeLineBasedMetadata(contents: List): String { + val lines = LinkedHashSet() + + contents.forEach { content -> + content.lineSequence().forEach { rawLine -> + val line = rawLine.trim() + if (line.isNotEmpty() && !line.startsWith("#")) { + lines.add(line) + } + } + } + + return if (lines.isEmpty()) "" else lines.joinToString(separator = "\n", postfix = "\n") + } + + private fun mergeMapProperties(contents: List): String { + val merged = linkedMapOf() + + contents.forEach { content -> + parseProperties(content).forEach { (key, value) -> + merged[key] = value + } + } + + return if (merged.isEmpty()) { + "" + } else { + merged.entries.joinToString(separator = "\n", postfix = "\n") { (key, value) -> "$key=$value" } + } + } + + private fun mergeListProperties(contents: List): String { + val merged = linkedMapOf>() + + contents.forEach { content -> + parseProperties(content).forEach { (key, value) -> + val values = merged.getOrPut(key) { LinkedHashSet() } + value + .split(',') + .map(String::trim) + .filter(String::isNotEmpty) + .forEach(values::add) + } + } + + return if (merged.isEmpty()) { + "" + } else { + merged.entries.joinToString(separator = "\n", postfix = "\n") { (key, values) -> + "$key=${values.joinToString(separator = ",")}" + } + } + } + + private fun parseProperties(content: String): List> { + val logicalLines = mutableListOf() + val current = StringBuilder() + + content.lineSequence().forEach { rawLine -> + val line = rawLine.trim() + if (current.isEmpty() && (line.isEmpty() || line.startsWith("#") || line.startsWith("!"))) { + return@forEach + } + + val normalized = if (current.isEmpty()) line else line.trimStart() + current.append( + if (endsWithContinuation(rawLine)) normalized.dropLast(1) else normalized, + ) + + if (!endsWithContinuation(rawLine)) { + logicalLines.add(current.toString()) + current.setLength(0) + } + } + + if (current.isNotEmpty()) { + logicalLines.add(current.toString()) + } + + return logicalLines.map { line -> + val separatorIndex = findSeparatorIndex(line) + if (separatorIndex < 0) { + line to "" + } else { + val keyEnd = trimTrailingWhitespace(line, separatorIndex) + val valueStart = findValueStart(line, separatorIndex) + line.substring(0, keyEnd) to line.substring(valueStart).trim() + } + } + } + + private fun endsWithContinuation(line: String): Boolean { + var backslashCount = 0 + + for (index in line.length - 1 downTo 0) { + if (line[index] == '\\') { + backslashCount++ + } else { + break + } + } + + return backslashCount % 2 == 1 + } + + private fun findSeparatorIndex(line: String): Int { + var backslashCount = 0 + + line.forEachIndexed { index, char -> + if (char == '\\') { + backslashCount++ + } else { + val isEscaped = backslashCount % 2 == 1 + if (!isEscaped && (char == '=' || char == ':' || char.isWhitespace())) { + return index + } + backslashCount = 0 + } + } + + return -1 + } + + private fun trimTrailingWhitespace(line: String, endExclusive: Int): Int { + var end = endExclusive + + while (end > 0 && line[end - 1].isWhitespace()) { + end-- + } + + return end + } + + private fun findValueStart(line: String, separatorIndex: Int): Int { + var valueStart = separatorIndex + + while (valueStart < line.length && line[valueStart].isWhitespace()) { + valueStart++ + } + + if (valueStart < line.length && (line[valueStart] == '=' || line[valueStart] == ':')) { + valueStart++ + } + + while (valueStart < line.length && line[valueStart].isWhitespace()) { + valueStart++ + } + + return valueStart + } +} diff --git a/gradle.properties b/gradle.properties index aa2f556e2b3..d9d50f79f73 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled # AndroidX required by AGP >= 3.6.x android.useAndroidX=true -android.experimental.lint.version=8.9.0 +android.experimental.lint.version=8.13.1 # Release information versionName=8.38.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 93cb7b79158..d02e3249df7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -61,13 +61,13 @@ detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.8" } jacoco-android = { id = "com.mxalbert.gradle.jacoco-android", version = "0.2.0" } kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } -springboot2 = { id = "org.springframework.boot", version.ref = "springboot2" } springboot3 = { id = "org.springframework.boot", version.ref = "springboot3" } springboot4 = { id = "org.springframework.boot", version.ref = "springboot4" } -spring-dependency-management = { id = "io.spring.dependency-management", version = "1.0.11.RELEASE" } +spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" } gretty = { id = "org.gretty", version = "4.0.0" } animalsniffer = { id = "ru.vyarus.animalsniffer", version = "2.0.1" } sentry = { id = "io.sentry.android.gradle", version = "6.0.0-alpha.6"} +shadow = { id = "com.gradleup.shadow", version = "9.4.1" } [libraries] apache-httpclient = { module = "org.apache.httpcomponents.client5:httpclient5", version = "5.0.4" } @@ -158,6 +158,7 @@ slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } slf4j-jdk14 = { module = "org.slf4j:slf4j-jdk14", version.ref = "slf4j" } slf4j2-api = { module = "org.slf4j:slf4j-api", version = "2.0.5" } spotlessLib = { module = "com.diffplug.spotless:com.diffplug.spotless.gradle.plugin", version.ref = "spotless"} +springboot2-bom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "springboot2" } springboot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot2" } springboot-starter-graphql = { module = "org.springframework.boot:spring-boot-starter-graphql", version.ref = "springboot2" } springboot-starter-quartz = { module = "org.springframework.boot:spring-boot-starter-quartz", version.ref = "springboot2" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da476b..c61a118f7dd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt index c07bb4d71bb..2ae48fb3253 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt @@ -174,7 +174,7 @@ class AnrProfilingIntegrationTest { val integration = AnrProfilingIntegration() integration.register(mockScopes, androidOptions) - integration.onForeground() + // Drive the state machine synchronously to avoid racing the background polling thread. SystemClock.setCurrentTimeMillis(1_000) integration.checkMainThread(mainThread) diff --git a/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts b/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts index e6480d8b37d..4b5993644ee 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts +++ b/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts @@ -81,6 +81,8 @@ android { lint { warningsAsErrors = true checkDependencies = true + // Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36 + disable += "OldTargetApi" // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false diff --git a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts index 0c32cbad941..a4d46405fb8 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts +++ b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts @@ -74,6 +74,8 @@ android { lint { warningsAsErrors = true checkDependencies = true + // Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36 + disable += "OldTargetApi" // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false diff --git a/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts index 7ee17c09385..ef98d488bd1 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts @@ -3,7 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { `java-library` id("io.sentry.javadoc") - id("com.gradleup.shadow") version "8.3.6" + alias(libs.plugins.shadow) } fun relocatePackages(shadowJar: ShadowJar) { @@ -133,7 +133,7 @@ tasks { // each CopySpec has // its own duplicatesStrategy register("isolateJavaagentLibs", Copy::class.java) { - dependsOn(findByName("relocateJavaagentLibs")) + findByName("relocateJavaagentLibs")?.let { task -> dependsOn(task) } with(isolateClasses(findByName("relocateJavaagentLibs")!!.outputs.files)) into(project.layout.buildDirectory.file("isolated/javaagentLibs").get().asFile) @@ -145,14 +145,26 @@ tasks { named("shadowJar", ShadowJar::class) { configurations = listOf(bootstrapLibs) + listOf(upstreamAgent) - dependsOn(findByName("isolateJavaagentLibs")) + findByName("isolateJavaagentLibs")?.let { task -> dependsOn(task) } from(findByName("isolateJavaagentLibs")!!.outputs) archiveClassifier.set("") duplicatesStrategy = DuplicatesStrategy.FAIL - mergeServiceFiles { include("inst/META-INF/services/*") } + filesMatching("META-INF/services/**") { duplicatesStrategy = DuplicatesStrategy.INCLUDE } + filesMatching("inst/META-INF/services/**") { duplicatesStrategy = DuplicatesStrategy.INCLUDE } + + // Shadow 9.x only applies relocations to service files handled by a ServiceFileTransformer. + // We need two mergeServiceFiles calls: + // 1. Default path (META-INF/services) — ensures bootstrap service files get relocated + // (e.g., ContextStorageProvider → shaded path). Without this, Shadow 9.x skips + // relocation for service file names/contents not claimed by a transformer. + // 2. inst/ path — merges isolated agent service files from both the upstream agent + // and the distro libs. Uses `path` instead of `include` filter because Shadow 9.x's + // include() strips the `inst/` prefix on output. + mergeServiceFiles() + mergeServiceFiles { path = "inst/META-INF/services" } exclude("**/module-info.class") relocatePackages(this) diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts index 338241078ae..f5d14dc2c38 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.console.Main") } @@ -48,6 +48,7 @@ dependencies { tasks.shadowJar { manifest { attributes["Main-Class"] = "io.sentry.samples.console.Main" } archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR + duplicatesStrategy = DuplicatesStrategy.INCLUDE mergeServiceFiles() } @@ -66,6 +67,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts index 18836c89555..483f6bea799 100644 --- a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.console.Main") } @@ -51,6 +51,7 @@ dependencies { tasks.shadowJar { manifest { attributes["Main-Class"] = "io.sentry.samples.console.Main" } archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR + duplicatesStrategy = DuplicatesStrategy.INCLUDE mergeServiceFiles() } @@ -69,6 +70,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index 0dc6183b4fc..c27196e96b8 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.console.Main") } @@ -69,6 +69,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-jul/build.gradle.kts b/sentry-samples/sentry-samples-jul/build.gradle.kts index 8b5f5057054..01e6a95f13d 100644 --- a/sentry-samples/sentry-samples-jul/build.gradle.kts +++ b/sentry-samples/sentry-samples-jul/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.jul.Main") } @@ -62,6 +62,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-log4j2/build.gradle.kts index dede2d9cb29..005e1116528 100644 --- a/sentry-samples/sentry-samples-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-log4j2/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.log4j2.Main") } @@ -45,6 +45,7 @@ dependencies { tasks.shadowJar { manifest { attributes["Main-Class"] = "io.sentry.samples.log4j2.Main" } archiveClassifier.set("") // Remove the classifier so it replaces the regular JAR + duplicatesStrategy = DuplicatesStrategy.INCLUDE mergeServiceFiles() // Use Log4j2 cache transformer to properly handle plugin files transform( @@ -67,6 +68,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-logback/build.gradle.kts b/sentry-samples/sentry-samples-logback/build.gradle.kts index ee6949c6c6b..05f96c346a8 100644 --- a/sentry-samples/sentry-samples-logback/build.gradle.kts +++ b/sentry-samples/sentry-samples-logback/build.gradle.kts @@ -5,7 +5,7 @@ plugins { application alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) - id("com.github.johnrengelman.shadow") version "8.1.1" + alias(libs.plugins.shadow) } application { mainClass.set("io.sentry.samples.logback.Main") } @@ -62,6 +62,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts index ade18a0cbc1..202b8d8f058 100644 --- a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts +++ b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts @@ -2,12 +2,15 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.springboot2) - alias(libs.plugins.spring.dependency.management) + java + application + alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) } +application { mainClass.set("io.sentry.samples.netflix.dgs.NetlixDgsApplication") } + group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" @@ -19,6 +22,7 @@ java.targetCompatibility = JavaVersion.VERSION_1_8 repositories { mavenCentral() } dependencies { + implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter.web) implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) @@ -32,6 +36,28 @@ dependencies { } } +val runtimeClasspath = configurations.named("runtimeClasspath") + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.netflix.dgs.NetlixDgsApplication" } + archiveClassifier.set("") + + doLast( + MergeSpringMetadataAction( + runtimeClasspath.get(), + MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, + ) + ) +} + +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +tasks.startScripts { dependsOn(tasks.shadowJar) } + tasks.withType().configureEach { useJUnitPlatform() } tasks.withType().configureEach { diff --git a/sentry-samples/sentry-samples-spring-7/build.gradle.kts b/sentry-samples/sentry-samples-spring-7/build.gradle.kts index a8f2dc4da7c..e3300cd2841 100644 --- a/sentry-samples/sentry-samples-spring-7/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-7/build.gradle.kts @@ -73,6 +73,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index 71ff985d67c..a7b2d939cdc 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -82,6 +82,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index c3e8ba06fae..d43a628eb9a 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -110,6 +110,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index 01e07fc2526..7329d5cc0ea 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -87,6 +87,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index cdcf65711a8..a311b8a972e 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -66,6 +66,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index f43cc47cc6d..d96e5602483 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -84,6 +84,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index 86914467a6d..c7fc0106131 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -18,6 +18,9 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -80,6 +83,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index 37d7a94eec0..767208a6082 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -19,6 +19,9 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -114,6 +117,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index a945b87109a..98f7ba434ff 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -18,6 +18,9 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -69,7 +72,6 @@ dependencies { testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(projects.sentry) testImplementation(projects.sentrySystemTestSupport) - testImplementation(libs.apollo3.kotlin) testImplementation(libs.kotlin.test.junit) testImplementation(libs.slf4j2.api) testImplementation(libs.springboot3.starter.test) { @@ -85,6 +87,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index 07e61c75af8..d96c59ac871 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -2,12 +2,15 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.springboot2) - alias(libs.plugins.spring.dependency.management) + java + application + alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) } +application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } + group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" @@ -35,6 +38,8 @@ tasks.withType().configureEach { } dependencies { + implementation(platform(libs.springboot2.bom)) + implementation(platform(libs.otel.instrumentation.bom)) implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) @@ -72,7 +77,27 @@ dependencies { testImplementation("org.apache.httpcomponents:httpclient") } -dependencyManagement { imports { mavenBom(libs.otel.instrumentation.bom.get().toString()) } } +val runtimeClasspath = configurations.named("runtimeClasspath") + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.spring.boot.SentryDemoApplication" } + archiveClassifier.set("") + + doLast( + MergeSpringMetadataAction( + runtimeClasspath.get(), + MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, + ) + ) +} + +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +tasks.startScripts { dependsOn(tasks.shadowJar) } configure { test { java.srcDir("src/test/java") } } @@ -80,6 +105,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index 21a3cf3f7d5..1a7f62f6e74 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -1,14 +1,16 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.tasks.run.BootRun plugins { - alias(libs.plugins.springboot2) - alias(libs.plugins.spring.dependency.management) + java + application + alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) } +application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } + group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" @@ -33,6 +35,7 @@ tasks.withType().configureEach { } dependencies { + implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) @@ -70,14 +73,35 @@ dependencies { testImplementation("org.apache.httpcomponents:httpclient") } +val runtimeClasspath = configurations.named("runtimeClasspath") + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.spring.boot.SentryDemoApplication" } + archiveClassifier.set("") + + doLast( + MergeSpringMetadataAction( + runtimeClasspath.get(), + MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, + ) + ) +} + +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +tasks.startScripts { dependsOn(tasks.shadowJar) } + configure { test { java.srcDir("src/test/java") } } -tasks.register("bootRunWithAgent").configure { +tasks.register("bootRunWithAgent").configure { group = "application" - val mainBootRunTask = tasks.getByName("bootRun") - mainClass = mainBootRunTask.mainClass - classpath = mainBootRunTask.classpath + mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") + classpath = sourceSets["main"].runtimeClasspath val versionName = project.properties["versionName"] as String val agentJarPath = @@ -101,6 +125,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts index a45249830f4..d5b04543576 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts @@ -18,6 +18,9 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + dependencies { implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) @@ -60,6 +63,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts index 3c0a5f8c83e..b10b30737d8 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts @@ -2,12 +2,15 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.springboot2) - alias(libs.plugins.spring.dependency.management) + java + application + alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) } +application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } + group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" @@ -19,6 +22,7 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } dependencies { + implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.graphql) implementation(libs.springboot.starter.webflux) @@ -42,6 +46,28 @@ dependencies { testImplementation("org.apache.httpcomponents:httpclient") } +val runtimeClasspath = configurations.named("runtimeClasspath") + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.spring.boot.SentryDemoApplication" } + archiveClassifier.set("") + + doLast( + MergeSpringMetadataAction( + runtimeClasspath.get(), + MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, + ) + ) +} + +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +tasks.startScripts { dependsOn(tasks.shadowJar) } + configure { test { java.srcDir("src/test/java") } } tasks.withType().configureEach { @@ -55,6 +81,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index b6fcd675cf3..5b89ef568e4 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -2,12 +2,15 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - alias(libs.plugins.springboot2) - alias(libs.plugins.spring.dependency.management) + java + application + alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) } +application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } + group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" @@ -31,6 +34,7 @@ tasks.withType().configureEach { } dependencies { + implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) @@ -69,12 +73,41 @@ dependencies { testImplementation("org.apache.httpcomponents:httpclient") } +val runtimeClasspath = configurations.named("runtimeClasspath") + +// Configure the Shadow JAR (executable JAR with all dependencies) +tasks.shadowJar { + manifest { attributes["Main-Class"] = "io.sentry.samples.spring.boot.SentryDemoApplication" } + archiveClassifier.set("") + + // Shadow 9.x enforces DuplicatesStrategy before transformers run, so `append` + // only sees one copy of each file. We merge Spring metadata from the runtime + // classpath and patch the built JAR in doLast. + doLast( + MergeSpringMetadataAction( + runtimeClasspath.get(), + MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, + ) + ) +} + +tasks.jar { + enabled = false + dependsOn(tasks.shadowJar) +} + +tasks.startScripts { dependsOn(tasks.shadowJar) } + configure { test { java.srcDir("src/test/java") } } tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts index 8e450865659..319431e71d2 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts @@ -26,6 +26,9 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + dependencyManagement { imports { mavenBom(SpringBootPlugin.BOM_COORDINATES) @@ -72,6 +75,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-samples/sentry-samples-spring/build.gradle.kts b/sentry-samples/sentry-samples-spring/build.gradle.kts index f6aa0e925ee..446baf3a696 100644 --- a/sentry-samples/sentry-samples-spring/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring/build.gradle.kts @@ -1,9 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES plugins { application - alias(libs.plugins.springboot2) apply false alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -27,9 +25,12 @@ java { repositories { mavenCentral() } +// Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version +extra["kotlin-coroutines.version"] = "1.9.0" + dependencyManagement { imports { - mavenBom(BOM_COORDINATES) + mavenBom(libs.springboot2.bom.get().toString()) mavenBom(libs.kotlin.bom.get().toString()) mavenBom(libs.jackson.bom.get().toString()) } @@ -73,6 +74,10 @@ tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" + val test = project.extensions.getByType()["test"] + testClassesDirs = test.output.classesDirs + classpath = test.runtimeClasspath + outputs.upToDateWhen { false } maxParallelForks = 1 diff --git a/sentry-spring-boot-starter/build.gradle.kts b/sentry-spring-boot-starter/build.gradle.kts index a8b22a50f09..6b5bcdf5752 100644 --- a/sentry-spring-boot-starter/build.gradle.kts +++ b/sentry-spring-boot-starter/build.gradle.kts @@ -1,6 +1,5 @@ import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { `java-library` @@ -9,7 +8,6 @@ plugins { jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) - alias(libs.plugins.springboot2) apply false } tasks.withType().configureEach { @@ -22,7 +20,7 @@ dependencies { api(projects.sentrySpringBoot) api(libs.springboot.starter) - annotationProcessor(platform(SpringBootPlugin.BOM_COORDINATES)) + annotationProcessor(platform(libs.springboot2.bom)) annotationProcessor(Config.AnnotationProcessors.springBootAutoConfigure) annotationProcessor(Config.AnnotationProcessors.springBootConfiguration) diff --git a/sentry-spring-boot/build.gradle.kts b/sentry-spring-boot/build.gradle.kts index a81613e5e1e..43150869db5 100644 --- a/sentry-spring-boot/build.gradle.kts +++ b/sentry-spring-boot/build.gradle.kts @@ -1,6 +1,5 @@ import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { `java-library` @@ -10,7 +9,6 @@ plugins { alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) - alias(libs.plugins.springboot2) apply false } tasks.withType().configureEach { @@ -40,14 +38,14 @@ dependencies { compileOnly(libs.springboot.starter.graphql) compileOnly(libs.springboot.starter.quartz) compileOnly(libs.springboot.starter.security) - compileOnly(platform(SpringBootPlugin.BOM_COORDINATES)) + compileOnly(platform(libs.springboot2.bom)) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springWebflux) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryCore) compileOnly(projects.sentryGraphql) compileOnly(projects.sentryQuartz) - annotationProcessor(platform(SpringBootPlugin.BOM_COORDINATES)) + annotationProcessor(platform(libs.springboot2.bom)) annotationProcessor(Config.AnnotationProcessors.springBootAutoConfigure) annotationProcessor(Config.AnnotationProcessors.springBootConfiguration) diff --git a/sentry-spring/build.gradle.kts b/sentry-spring/build.gradle.kts index 57c0b9d9f31..b651a9e62b2 100644 --- a/sentry-spring/build.gradle.kts +++ b/sentry-spring/build.gradle.kts @@ -1,6 +1,5 @@ import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { `java-library` @@ -10,7 +9,6 @@ plugins { alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) - alias(libs.plugins.springboot2) apply false } tasks.withType().configureEach { @@ -22,7 +20,7 @@ tasks.withType().configureEach { dependencies { api(projects.sentry) - compileOnly(platform(SpringBootPlugin.BOM_COORDINATES)) + compileOnly(platform(libs.springboot2.bom)) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springAop) compileOnly(Config.Libs.springSecurityWeb) diff --git a/sentry-system-test-support/api/sentry-system-test-support.api b/sentry-system-test-support/api/sentry-system-test-support.api deleted file mode 100644 index 83a9f288d0c..00000000000 --- a/sentry-system-test-support/api/sentry-system-test-support.api +++ /dev/null @@ -1,619 +0,0 @@ -public final class io/sentry/samples/graphql/AddProjectMutation : com/apollographql/apollo3/api/Mutation { - public static final field Companion Lio/sentry/samples/graphql/AddProjectMutation$Companion; - public static final field OPERATION_ID Ljava/lang/String; - public static final field OPERATION_NAME Ljava/lang/String; - public fun (Ljava/lang/String;)V - public fun adapter ()Lcom/apollographql/apollo3/api/Adapter; - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/AddProjectMutation; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/AddProjectMutation;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/AddProjectMutation; - public fun document ()Ljava/lang/String; - public fun equals (Ljava/lang/Object;)Z - public final fun getSlug ()Ljava/lang/String; - public fun hashCode ()I - public fun id ()Ljava/lang/String; - public fun name ()Ljava/lang/String; - public fun rootField ()Lcom/apollographql/apollo3/api/CompiledField; - public fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)V - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/AddProjectMutation$Companion { - public final fun getOPERATION_DOCUMENT ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/AddProjectMutation$Data : com/apollographql/apollo3/api/Mutation$Data { - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/AddProjectMutation$Data; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/AddProjectMutation$Data;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/AddProjectMutation$Data; - public fun equals (Ljava/lang/Object;)Z - public final fun getAddProject ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/GreetingQuery : com/apollographql/apollo3/api/Query { - public static final field Companion Lio/sentry/samples/graphql/GreetingQuery$Companion; - public static final field OPERATION_ID Ljava/lang/String; - public static final field OPERATION_NAME Ljava/lang/String; - public fun (Ljava/lang/String;)V - public fun adapter ()Lcom/apollographql/apollo3/api/Adapter; - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/GreetingQuery; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/GreetingQuery;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/GreetingQuery; - public fun document ()Ljava/lang/String; - public fun equals (Ljava/lang/Object;)Z - public final fun getName ()Ljava/lang/String; - public fun hashCode ()I - public fun id ()Ljava/lang/String; - public fun name ()Ljava/lang/String; - public fun rootField ()Lcom/apollographql/apollo3/api/CompiledField; - public fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)V - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/GreetingQuery$Companion { - public final fun getOPERATION_DOCUMENT ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/GreetingQuery$Data : com/apollographql/apollo3/api/Query$Data { - public fun (Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/GreetingQuery$Data; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/GreetingQuery$Data;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/GreetingQuery$Data; - public fun equals (Ljava/lang/Object;)Z - public final fun getGreeting ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/ProjectQuery : com/apollographql/apollo3/api/Query { - public static final field Companion Lio/sentry/samples/graphql/ProjectQuery$Companion; - public static final field OPERATION_ID Ljava/lang/String; - public static final field OPERATION_NAME Ljava/lang/String; - public fun (Ljava/lang/String;)V - public fun adapter ()Lcom/apollographql/apollo3/api/Adapter; - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/ProjectQuery; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/ProjectQuery;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/ProjectQuery; - public fun document ()Ljava/lang/String; - public fun equals (Ljava/lang/Object;)Z - public final fun getSlug ()Ljava/lang/String; - public fun hashCode ()I - public fun id ()Ljava/lang/String; - public fun name ()Ljava/lang/String; - public fun rootField ()Lcom/apollographql/apollo3/api/CompiledField; - public fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)V - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/ProjectQuery$Companion { - public final fun getOPERATION_DOCUMENT ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/ProjectQuery$Data : com/apollographql/apollo3/api/Query$Data { - public fun (Lio/sentry/samples/graphql/ProjectQuery$Project;)V - public final fun component1 ()Lio/sentry/samples/graphql/ProjectQuery$Project; - public final fun copy (Lio/sentry/samples/graphql/ProjectQuery$Project;)Lio/sentry/samples/graphql/ProjectQuery$Data; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/ProjectQuery$Data;Lio/sentry/samples/graphql/ProjectQuery$Project;ILjava/lang/Object;)Lio/sentry/samples/graphql/ProjectQuery$Data; - public fun equals (Ljava/lang/Object;)Z - public final fun getProject ()Lio/sentry/samples/graphql/ProjectQuery$Project; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/ProjectQuery$Project { - public fun (Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/type/ProjectStatus;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Lio/sentry/samples/graphql/type/ProjectStatus; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/type/ProjectStatus;)Lio/sentry/samples/graphql/ProjectQuery$Project; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/ProjectQuery$Project;Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/type/ProjectStatus;ILjava/lang/Object;)Lio/sentry/samples/graphql/ProjectQuery$Project; - public fun equals (Ljava/lang/Object;)Z - public final fun getName ()Ljava/lang/String; - public final fun getSlug ()Ljava/lang/String; - public final fun getStatus ()Lio/sentry/samples/graphql/type/ProjectStatus; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery : com/apollographql/apollo3/api/Query { - public static final field Companion Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Companion; - public static final field OPERATION_ID Ljava/lang/String; - public static final field OPERATION_NAME Ljava/lang/String; - public fun (Ljava/lang/String;)V - public fun adapter ()Lcom/apollographql/apollo3/api/Adapter; - public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/TasksAndAssigneesQuery;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery; - public fun document ()Ljava/lang/String; - public fun equals (Ljava/lang/Object;)Z - public final fun getSlug ()Ljava/lang/String; - public fun hashCode ()I - public fun id ()Ljava/lang/String; - public fun name ()Ljava/lang/String; - public fun rootField ()Lcom/apollographql/apollo3/api/CompiledField; - public fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)V - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee { - public fun (Ljava/lang/String;Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee; - public fun equals (Ljava/lang/Object;)Z - public final fun getId ()Ljava/lang/String; - public final fun getName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery$Companion { - public final fun getOPERATION_DOCUMENT ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery$Creator { - public fun (Ljava/lang/String;Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator; - public fun equals (Ljava/lang/Object;)Z - public final fun getId ()Ljava/lang/String; - public final fun getName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery$Data : com/apollographql/apollo3/api/Query$Data { - public fun (Ljava/util/List;)V - public final fun component1 ()Ljava/util/List; - public final fun copy (Ljava/util/List;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Data; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Data;Ljava/util/List;ILjava/lang/Object;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Data; - public fun equals (Ljava/lang/Object;)Z - public final fun getTasks ()Ljava/util/List; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/TasksAndAssigneesQuery$Task { - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Ljava/lang/String; - public final fun component4 ()Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee; - public final fun component5 ()Ljava/lang/String; - public final fun component6 ()Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Task; - public static synthetic fun copy$default (Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Task;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee;Ljava/lang/String;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator;ILjava/lang/Object;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Task; - public fun equals (Ljava/lang/Object;)Z - public final fun getAssignee ()Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee; - public final fun getAssigneeId ()Ljava/lang/String; - public final fun getCreator ()Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator; - public final fun getCreatorId ()Ljava/lang/String; - public final fun getId ()Ljava/lang/String; - public final fun getName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/samples/graphql/adapter/AddProjectMutation_ResponseAdapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/AddProjectMutation_ResponseAdapter; -} - -public final class io/sentry/samples/graphql/adapter/AddProjectMutation_ResponseAdapter$Data : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/AddProjectMutation_ResponseAdapter$Data; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/AddProjectMutation$Data; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/AddProjectMutation$Data;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/AddProjectMutation_VariablesAdapter : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/AddProjectMutation_VariablesAdapter; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/AddProjectMutation; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/AddProjectMutation;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/GreetingQuery_ResponseAdapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/GreetingQuery_ResponseAdapter; -} - -public final class io/sentry/samples/graphql/adapter/GreetingQuery_ResponseAdapter$Data : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/GreetingQuery_ResponseAdapter$Data; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/GreetingQuery$Data; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/GreetingQuery$Data;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/GreetingQuery_VariablesAdapter : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/GreetingQuery_VariablesAdapter; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/GreetingQuery; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/GreetingQuery;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter; -} - -public final class io/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter$Data : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter$Data; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/ProjectQuery$Data; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/ProjectQuery$Data;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter$Project : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/ProjectQuery_ResponseAdapter$Project; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/ProjectQuery$Project; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/ProjectQuery$Project;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/ProjectQuery_VariablesAdapter : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/ProjectQuery_VariablesAdapter; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/ProjectQuery; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/ProjectQuery;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter; -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Assignee : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Assignee; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Assignee;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Creator : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Creator; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Creator;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Data : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Data; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Data; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Data;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Task : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_ResponseAdapter$Task; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Task; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public final fun getRESPONSE_NAMES ()Ljava/util/List; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/TasksAndAssigneesQuery$Task;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_VariablesAdapter : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/adapter/TasksAndAssigneesQuery_VariablesAdapter; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/TasksAndAssigneesQuery; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/TasksAndAssigneesQuery;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/samples/graphql/selections/AddProjectMutationSelections { - public static final field INSTANCE Lio/sentry/samples/graphql/selections/AddProjectMutationSelections; - public final fun get__root ()Ljava/util/List; -} - -public final class io/sentry/samples/graphql/selections/GreetingQuerySelections { - public static final field INSTANCE Lio/sentry/samples/graphql/selections/GreetingQuerySelections; - public final fun get__root ()Ljava/util/List; -} - -public final class io/sentry/samples/graphql/selections/ProjectQuerySelections { - public static final field INSTANCE Lio/sentry/samples/graphql/selections/ProjectQuerySelections; - public final fun get__root ()Ljava/util/List; -} - -public final class io/sentry/samples/graphql/selections/TasksAndAssigneesQuerySelections { - public static final field INSTANCE Lio/sentry/samples/graphql/selections/TasksAndAssigneesQuerySelections; - public final fun get__root ()Ljava/util/List; -} - -public final class io/sentry/samples/graphql/type/Assignee { - public static final field Companion Lio/sentry/samples/graphql/type/Assignee$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Assignee$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/Creator { - public static final field Companion Lio/sentry/samples/graphql/type/Creator$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Creator$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/GraphQLBoolean { - public static final field Companion Lio/sentry/samples/graphql/type/GraphQLBoolean$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/GraphQLBoolean$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/CustomScalarType; -} - -public final class io/sentry/samples/graphql/type/GraphQLFloat { - public static final field Companion Lio/sentry/samples/graphql/type/GraphQLFloat$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/GraphQLFloat$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/CustomScalarType; -} - -public final class io/sentry/samples/graphql/type/GraphQLID { - public static final field Companion Lio/sentry/samples/graphql/type/GraphQLID$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/GraphQLID$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/CustomScalarType; -} - -public final class io/sentry/samples/graphql/type/GraphQLInt { - public static final field Companion Lio/sentry/samples/graphql/type/GraphQLInt$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/GraphQLInt$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/CustomScalarType; -} - -public final class io/sentry/samples/graphql/type/GraphQLString { - public static final field Companion Lio/sentry/samples/graphql/type/GraphQLString$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/GraphQLString$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/CustomScalarType; -} - -public final class io/sentry/samples/graphql/type/Mutation { - public static final field Companion Lio/sentry/samples/graphql/type/Mutation$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Mutation$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/Project { - public static final field Companion Lio/sentry/samples/graphql/type/Project$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Project$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/ProjectStatus : java/lang/Enum { - public static final field ACTIVE Lio/sentry/samples/graphql/type/ProjectStatus; - public static final field ATTIC Lio/sentry/samples/graphql/type/ProjectStatus; - public static final field COMMUNITY Lio/sentry/samples/graphql/type/ProjectStatus; - public static final field Companion Lio/sentry/samples/graphql/type/ProjectStatus$Companion; - public static final field EOL Lio/sentry/samples/graphql/type/ProjectStatus; - public static final field INCUBATING Lio/sentry/samples/graphql/type/ProjectStatus; - public static final field UNKNOWN__ Lio/sentry/samples/graphql/type/ProjectStatus; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getRawValue ()Ljava/lang/String; - public static fun valueOf (Ljava/lang/String;)Lio/sentry/samples/graphql/type/ProjectStatus; - public static fun values ()[Lio/sentry/samples/graphql/type/ProjectStatus; -} - -public final class io/sentry/samples/graphql/type/ProjectStatus$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/EnumType; - public final fun knownValues ()[Lio/sentry/samples/graphql/type/ProjectStatus; - public final fun safeValueOf (Ljava/lang/String;)Lio/sentry/samples/graphql/type/ProjectStatus; -} - -public final class io/sentry/samples/graphql/type/Query { - public static final field Companion Lio/sentry/samples/graphql/type/Query$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Query$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/Task { - public static final field Companion Lio/sentry/samples/graphql/type/Task$Companion; - public fun ()V -} - -public final class io/sentry/samples/graphql/type/Task$Companion { - public final fun getType ()Lcom/apollographql/apollo3/api/ObjectType; -} - -public final class io/sentry/samples/graphql/type/adapter/ProjectStatus_ResponseAdapter : com/apollographql/apollo3/api/Adapter { - public static final field INSTANCE Lio/sentry/samples/graphql/type/adapter/ProjectStatus_ResponseAdapter; - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lio/sentry/samples/graphql/type/ProjectStatus; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lio/sentry/samples/graphql/type/ProjectStatus;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class io/sentry/systemtest/Person { - public fun (Ljava/lang/String;Ljava/lang/String;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/systemtest/Person; - public static synthetic fun copy$default (Lio/sentry/systemtest/Person;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/sentry/systemtest/Person; - public fun equals (Ljava/lang/Object;)Z - public final fun getFirstName ()Ljava/lang/String; - public final fun getLastName ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/systemtest/Todo { - public fun (JLjava/lang/String;Z)V - public final fun component1 ()J - public final fun component2 ()Ljava/lang/String; - public final fun component3 ()Z - public final fun copy (JLjava/lang/String;Z)Lio/sentry/systemtest/Todo; - public static synthetic fun copy$default (Lio/sentry/systemtest/Todo;JLjava/lang/String;ZILjava/lang/Object;)Lio/sentry/systemtest/Todo; - public fun equals (Ljava/lang/Object;)Z - public final fun getCompleted ()Z - public final fun getId ()J - public final fun getTitle ()Ljava/lang/String; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/systemtest/graphql/GraphqlTestClient { - public fun (Ljava/lang/String;)V - public final fun addProject (Ljava/lang/String;)Lcom/apollographql/apollo3/api/ApolloResponse; - public final fun getApollo ()Lcom/apollographql/apollo3/ApolloClient; - public final fun greet (Ljava/lang/String;)Lcom/apollographql/apollo3/api/ApolloResponse; - public final fun project (Ljava/lang/String;)Lcom/apollographql/apollo3/api/ApolloResponse; - public final fun tasksAndAssignees (Ljava/lang/String;)Lcom/apollographql/apollo3/api/ApolloResponse; -} - -public final class io/sentry/systemtest/util/EnvelopeCounts { - public fun ()V - public final fun getEnvelopes ()Ljava/lang/Long; - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/systemtest/util/EnvelopesReceived { - public fun ()V - public final fun getEnvelopes ()Ljava/util/List; - public fun toString ()Ljava/lang/String; -} - -public final class io/sentry/systemtest/util/FeatureFlagResponse { - public fun (Ljava/lang/String;Z)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Z - public final fun copy (Ljava/lang/String;Z)Lio/sentry/systemtest/util/FeatureFlagResponse; - public static synthetic fun copy$default (Lio/sentry/systemtest/util/FeatureFlagResponse;Ljava/lang/String;ZILjava/lang/Object;)Lio/sentry/systemtest/util/FeatureFlagResponse; - public fun equals (Ljava/lang/Object;)Z - public final fun getFlagKey ()Ljava/lang/String; - public final fun getValue ()Z - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public class io/sentry/systemtest/util/LoggingInsecureRestClient { - public fun ()V - protected final fun call (Lokhttp3/Request$Builder;ZLjava/util/Map;)Lokhttp3/Response; - public static synthetic fun call$default (Lio/sentry/systemtest/util/LoggingInsecureRestClient;Lokhttp3/Request$Builder;ZLjava/util/Map;ILjava/lang/Object;)Lokhttp3/Response; - protected final fun client ()Lokhttp3/OkHttpClient; - public final fun getLastKnownStatusCode ()Ljava/lang/Integer; - public final fun getLogger ()Lorg/slf4j/Logger; - protected final fun objectMapper ()Lcom/fasterxml/jackson/databind/ObjectMapper; - public final fun setLastKnownStatusCode (Ljava/lang/Integer;)V - protected final fun toRequestBody (Ljava/lang/Object;)Lokhttp3/RequestBody; -} - -public final class io/sentry/systemtest/util/RestTestClient : io/sentry/systemtest/util/LoggingInsecureRestClient { - public fun (Ljava/lang/String;)V - public final fun checkFeatureFlag (Ljava/lang/String;)Lio/sentry/systemtest/util/FeatureFlagResponse; - public final fun createPerson (Lio/sentry/systemtest/Person;Ljava/util/Map;)Lio/sentry/systemtest/Person; - public static synthetic fun createPerson$default (Lio/sentry/systemtest/util/RestTestClient;Lio/sentry/systemtest/Person;Ljava/util/Map;ILjava/lang/Object;)Lio/sentry/systemtest/Person; - public final fun createPersonDistributedTracing (Lio/sentry/systemtest/Person;Ljava/util/Map;)Lio/sentry/systemtest/Person; - public static synthetic fun createPersonDistributedTracing$default (Lio/sentry/systemtest/util/RestTestClient;Lio/sentry/systemtest/Person;Ljava/util/Map;ILjava/lang/Object;)Lio/sentry/systemtest/Person; - public final fun deleteCachedTodo (J)V - public final fun errorWithFeatureFlag (Ljava/lang/String;)Ljava/lang/String; - public final fun getCachedTodo (J)Lio/sentry/systemtest/Todo; - public final fun getCountMetric ()Ljava/lang/String; - public final fun getDistributionMetric (J)Ljava/lang/String; - public final fun getGaugeMetric (J)Ljava/lang/String; - public final fun getPerson (J)Lio/sentry/systemtest/Person; - public final fun getPersonDistributedTracing (JLjava/util/Map;)Lio/sentry/systemtest/Person; - public static synthetic fun getPersonDistributedTracing$default (Lio/sentry/systemtest/util/RestTestClient;JLjava/util/Map;ILjava/lang/Object;)Lio/sentry/systemtest/Person; - public final fun getTodo (J)Lio/sentry/systemtest/Todo; - public final fun getTodoRestClient (J)Lio/sentry/systemtest/Todo; - public final fun getTodoWebclient (J)Lio/sentry/systemtest/Todo; - public final fun saveCachedTodo (Lio/sentry/systemtest/Todo;)Lio/sentry/systemtest/Todo; -} - -public final class io/sentry/systemtest/util/SentryMockServerClient : io/sentry/systemtest/util/LoggingInsecureRestClient { - public fun (Ljava/lang/String;)V - public final fun getEnvelopeCount ()Lio/sentry/systemtest/util/EnvelopeCounts; - public final fun getEnvelopes ()Lio/sentry/systemtest/util/EnvelopesReceived; - public final fun reset ()V -} - -public final class io/sentry/systemtest/util/TestHelper { - public fun (Ljava/lang/String;)V - public final fun doesContainLogWithBody (Lio/sentry/SentryLogEvents;Ljava/lang/String;)Z - public final fun doesContainMetric (Lio/sentry/SentryMetricsEvents;Ljava/lang/String;Ljava/lang/String;DLjava/lang/String;)Z - public static synthetic fun doesContainMetric$default (Lio/sentry/systemtest/util/TestHelper;Lio/sentry/SentryMetricsEvents;Ljava/lang/String;Ljava/lang/String;DLjava/lang/String;ILjava/lang/Object;)Z - public final fun doesEventHaveExceptionMessage (Lio/sentry/SentryEvent;Ljava/lang/String;)Z - public final fun doesEventHaveFlag (Lio/sentry/SentryEvent;Ljava/lang/String;Z)Z - public final fun doesLogWithBodyHaveAttribute (Lio/sentry/SentryLogEvents;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Z - public final fun doesMetricHaveAttribute (Lio/sentry/SentryMetricsEvents;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Z - public final fun doesTransactionContainSpanWithDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z - public final fun doesTransactionContainSpanWithOp (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z - public final fun doesTransactionContainSpanWithOpAndDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Ljava/lang/String;)Z - public final fun doesTransactionHave (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Lio/sentry/protocol/FeatureFlag;)Z - public static synthetic fun doesTransactionHave$default (Lio/sentry/systemtest/util/TestHelper;Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Lio/sentry/protocol/FeatureFlag;ILjava/lang/Object;)Z - public final fun doesTransactionHaveOp (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z - public final fun doesTransactionHaveSpanWith (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Lio/sentry/protocol/FeatureFlag;Z)Z - public static synthetic fun doesTransactionHaveSpanWith$default (Lio/sentry/systemtest/util/TestHelper;Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Lio/sentry/protocol/FeatureFlag;ZILjava/lang/Object;)Z - public final fun doesTransactionHaveTraceId (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z - public final fun ensureEnvelopeCountIncreased ()V - public final fun ensureEnvelopeReceived (ILkotlin/jvm/functions/Function1;)V - public static synthetic fun ensureEnvelopeReceived$default (Lio/sentry/systemtest/util/TestHelper;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)V - public final fun ensureErrorCount (Lcom/apollographql/apollo3/api/ApolloResponse;I)V - public final fun ensureErrorReceived (Lkotlin/jvm/functions/Function1;)V - public final fun ensureLogsReceived (Lkotlin/jvm/functions/Function2;)V - public final fun ensureMetricsReceived (Lkotlin/jvm/functions/Function2;)V - public final fun ensureNoEnvelopeReceived (Lkotlin/jvm/functions/Function1;)V - public final fun ensureNoErrors (Lcom/apollographql/apollo3/api/ApolloResponse;)V - public final fun ensureNoTransactionReceived (Lkotlin/jvm/functions/Function2;)V - public final fun ensureProfileChunkReceived (Lkotlin/jvm/functions/Function2;)V - public final fun ensureTransactionReceived (Lkotlin/jvm/functions/Function2;)V - public final fun ensureTransactionWithSpanReceived (Lkotlin/jvm/functions/Function1;)V - public final fun findJar (Ljava/lang/String;Ljava/lang/String;)Ljava/io/File; - public static synthetic fun findJar$default (Lio/sentry/systemtest/util/TestHelper;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/io/File; - public final fun getDsn ()Ljava/lang/String; - public final fun getEnvelopeCounts ()Lio/sentry/systemtest/util/EnvelopeCounts; - public final fun getGraphqlClient ()Lio/sentry/systemtest/graphql/GraphqlTestClient; - public final fun getJsonSerializer ()Lio/sentry/JsonSerializer; - public final fun getRestClient ()Lio/sentry/systemtest/util/RestTestClient; - public final fun getSentryClient ()Lio/sentry/systemtest/util/SentryMockServerClient; - public final fun launch (Ljava/io/File;Ljava/util/Map;Z)Ljava/lang/Process; - public static synthetic fun launch$default (Lio/sentry/systemtest/util/TestHelper;Ljava/io/File;Ljava/util/Map;ZILjava/lang/Object;)Ljava/lang/Process; - public final fun logObject (Ljava/lang/Object;)V - public final fun reset ()V - public final fun setEnvelopeCounts (Lio/sentry/systemtest/util/EnvelopeCounts;)V - public final fun snapshotEnvelopeCount ()V -} - diff --git a/sentry-system-test-support/build.gradle.kts b/sentry-system-test-support/build.gradle.kts index dea680b4db1..b8e4a283c87 100644 --- a/sentry-system-test-support/build.gradle.kts +++ b/sentry-system-test-support/build.gradle.kts @@ -5,7 +5,7 @@ plugins { jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) - id("com.apollographql.apollo3") version "3.8.2" + id("com.apollographql.apollo") version "4.1.1" } configure { @@ -22,7 +22,7 @@ tasks.withType().configureEach dependencies { api(projects.sentry) api(projects.sentryTestSupport) - api(libs.apollo3.kotlin) + api(libs.apollo4.kotlin) compileOnly(libs.jetbrains.annotations) compileOnly(libs.nopen.annotations) diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/graphql/GraphqlTestClient.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/graphql/GraphqlTestClient.kt index 5127f06b8f7..c1b0a409bda 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/graphql/GraphqlTestClient.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/graphql/GraphqlTestClient.kt @@ -1,9 +1,9 @@ package io.sentry.systemtest.graphql -import com.apollographql.apollo3.ApolloClient -import com.apollographql.apollo3.api.ApolloResponse -import com.apollographql.apollo3.api.Mutation -import com.apollographql.apollo3.api.Query +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.ApolloResponse +import com.apollographql.apollo.api.Mutation +import com.apollographql.apollo.api.Query import io.sentry.samples.graphql.AddProjectMutation import io.sentry.samples.graphql.GreetingQuery import io.sentry.samples.graphql.ProjectQuery diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt index 19817c34ac8..7f0dfc8c955 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt @@ -1,7 +1,7 @@ package io.sentry.systemtest.util -import com.apollographql.apollo3.api.ApolloResponse -import com.apollographql.apollo3.api.Operation +import com.apollographql.apollo.api.ApolloResponse +import com.apollographql.apollo.api.Operation import io.sentry.JsonSerializer import io.sentry.ProfileChunk import io.sentry.SentryEnvelopeHeader diff --git a/sentry-test-support/api/sentry-test-support.api b/sentry-test-support/api/sentry-test-support.api deleted file mode 100644 index 1d8ae671216..00000000000 --- a/sentry-test-support/api/sentry-test-support.api +++ /dev/null @@ -1,75 +0,0 @@ -public final class io/sentry/AssertionsKt { - public static final fun assertEnvelopeEvent (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;)Lio/sentry/SentryEvent; - public static synthetic fun assertEnvelopeEvent$default (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lio/sentry/SentryEvent; - public static final fun assertEnvelopeFeedback (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;)Lio/sentry/SentryEvent; - public static synthetic fun assertEnvelopeFeedback$default (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lio/sentry/SentryEvent; - public static final fun assertEnvelopeProfile (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;)Lio/sentry/ProfilingTraceData; - public static synthetic fun assertEnvelopeProfile$default (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lio/sentry/ProfilingTraceData; - public static final fun assertEnvelopeTransaction (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;)Lio/sentry/protocol/SentryTransaction; - public static synthetic fun assertEnvelopeTransaction$default (Ljava/util/List;Lio/sentry/ILogger;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lio/sentry/protocol/SentryTransaction; - public static final fun checkEvent (Lkotlin/jvm/functions/Function1;)Lio/sentry/SentryEnvelope; - public static final fun checkLogs (Lkotlin/jvm/functions/Function1;)Lio/sentry/SentryEnvelope; - public static final fun checkTransaction (Lkotlin/jvm/functions/Function1;)Lio/sentry/SentryEnvelope; - public static final fun getMockServerRequestTimeoutMillis ()J -} - -public final class io/sentry/SkipError : java/lang/Error { - public fun (Ljava/lang/String;)V -} - -public final class io/sentry/test/DeferredExecutorService : io/sentry/ISentryExecutorService { - public fun ()V - public fun close (J)V - public final fun hasScheduledRunnables ()Z - public fun isClosed ()Z - public fun prewarm ()V - public final fun runAll ()V - public fun schedule (Ljava/lang/Runnable;J)Ljava/util/concurrent/Future; - public fun submit (Ljava/lang/Runnable;)Ljava/util/concurrent/Future; - public fun submit (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future; -} - -public final class io/sentry/test/ImmediateExecutorService : io/sentry/ISentryExecutorService { - public fun ()V - public fun close (J)V - public fun isClosed ()Z - public fun prewarm ()V - public fun schedule (Ljava/lang/Runnable;J)Ljava/util/concurrent/Future; - public fun submit (Ljava/lang/Runnable;)Ljava/util/concurrent/Future; - public fun submit (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future; -} - -public final class io/sentry/test/InitKt { - public static final fun applyTestOptions (Lio/sentry/SentryOptions;)V - public static final fun initForTest ()V - public static final fun initForTest (Lio/sentry/Sentry$OptionsConfiguration;)V - public static final fun initForTest (Lio/sentry/Sentry$OptionsConfiguration;Z)V - public static final fun initForTest (Lio/sentry/SentryOptions;)V - public static final fun initForTest (Ljava/lang/String;)V -} - -public final class io/sentry/test/MocksKt { - public static final fun createSentryClientMock (Z)Lio/sentry/ISentryClient; - public static synthetic fun createSentryClientMock$default (ZILjava/lang/Object;)Lio/sentry/ISentryClient; - public static final fun createTestScopes (Lio/sentry/SentryOptions;ZLio/sentry/IScope;Lio/sentry/IScope;Lio/sentry/IScope;)Lio/sentry/Scopes; - public static synthetic fun createTestScopes$default (Lio/sentry/SentryOptions;ZLio/sentry/IScope;Lio/sentry/IScope;Lio/sentry/IScope;ILjava/lang/Object;)Lio/sentry/Scopes; -} - -public final class io/sentry/test/NonOverridableNoOpSentryExecutorService : io/sentry/ISentryExecutorService { - public fun ()V - public fun close (J)V - public fun isClosed ()Z - public fun prewarm ()V - public fun schedule (Ljava/lang/Runnable;J)Ljava/util/concurrent/Future; - public fun submit (Ljava/lang/Runnable;)Ljava/util/concurrent/Future; - public fun submit (Ljava/util/concurrent/Callable;)Ljava/util/concurrent/Future; -} - -public final class io/sentry/test/ReflectionKt { - public static final fun collectInterfaceHierarchy (Ljava/lang/Class;)Ljava/util/List; - public static final fun containsMethod (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Class;)Z - public static final fun containsMethod (Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;)Z - public static final fun getCtor (Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor; - public static final fun getDeclaredCtor (Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor; -} - diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 70489c580a5..1250c6cbab9 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -326,7 +326,7 @@ def start_tomcat_server(self, sample_module: str) -> None: # Start the Tomcat server with open("tomcat-server.txt", "w") as log_file: self.tomcat_server.process = subprocess.Popen( - ["./gradlew", f"sentry-samples:{sample_module}:run"], + ["./gradlew", f"sentry-samples:{sample_module}:run", "--console=plain"], env=env, stdout=log_file, stderr=subprocess.STDOUT @@ -406,6 +406,8 @@ def wait_for_spring(self, max_attempts: int = 20) -> bool: print("Waiting for Spring application to be ready...") for attempt in range(1, max_attempts + 1): + # All current Spring Boot samples expose actuator/health. Waiting for the + # health endpoint avoids false positives from unrelated services on 8080. try: response = requests.head( "http://localhost:8080/actuator/health", @@ -528,18 +530,23 @@ def stop_spring_server(self) -> None: # Clean up PID file and instance variable cleanup_pid(self.spring_server) - def get_build_task(self, server_type: Optional[ServerType]) -> str: + def get_build_task(self, sample_module: str, server_type: Optional[ServerType]) -> str: """Get the appropriate build task for a module.""" if server_type == ServerType.TOMCAT: return "war" elif server_type == ServerType.SPRING: + # Modules using Shadow plugin (e.g. Spring Boot 2 samples) use shadowJar, + # modules using Spring Boot plugin (SB3/SB4 samples) use bootJar + build_file = Path(f"sentry-samples/{sample_module}/build.gradle.kts") + if build_file.exists() and "shadow" in build_file.read_text(): + return "shadowJar" return "bootJar" return "assemble" def build_module(self, sample_module: str, server_type: Optional[ServerType]) -> int: """Build a sample module using the appropriate task.""" - build_task = self.get_build_task(server_type) + build_task = self.get_build_task(sample_module, server_type) print(f"Building {sample_module} using {build_task} task") return self.run_gradle_task(f":sentry-samples:{sample_module}:{build_task}") @@ -547,7 +554,7 @@ def run_gradle_task(self, task: str) -> int: """Run a Gradle task and return the exit code.""" print(f"Running: ./gradlew {task}") try: - result = subprocess.run(["./gradlew", task], check=False) + result = subprocess.run(["./gradlew", task, "--console=plain"], check=False) return result.returncode except Exception as e: print(f"Failed to run Gradle task: {e}") From de6a178ca26079db56d6b52388281e87621c91df Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 16 Apr 2026 14:35:13 +0200 Subject: [PATCH 101/391] fix(gestures): Replace GestureDetectorCompat with lightweight detector to fix ANR (#5138) * fix(android): Replace GestureDetectorCompat with lightweight SentryGestureDetector to fix ANR GestureDetectorCompat internally uses Handler.sendMessage/removeMessages which acquires a synchronized lock on the main thread MessageQueue, plus recordGestureClassification triggers IPC calls. This caused ANRs under load (SDK-CRASHES-JAVA-596, 175K+ occurrences). Replace with a minimal custom detector that only detects click, scroll, and fling without any Handler scheduling, MessageQueue contention, or IPC overhead. Co-Authored-By: Claude Opus 4.6 * test(android): Add unit tests for SentryGestureDetector Co-Authored-By: Claude Opus 4.6 * changelog Co-Authored-By: Claude Opus 4.6 * fix(gestures): Clear VelocityTracker on ACTION_DOWN to prevent stale velocity data Matches GestureDetector behavior: if consecutive ACTION_DOWN events arrive without an intervening ACTION_UP/ACTION_CANCEL, stale motion data could bleed into fling detection. Co-Authored-By: Claude Opus 4.6 * fix(gestures): Remove stale GestureDetectorCompat class availability check UserInteractionIntegration gated itself on GestureDetectorCompat being available via classloader check, but SentryGestureDetector only uses Android SDK classes. Remove the check so the integration works without androidx.core. Also remove the stale proguard -keep rule. Co-Authored-By: Claude Opus 4.6 * Move changelog entry * ref(gestures): Simplify SentryGestureDetector resource lifecycle Keep VelocityTracker alive across gesture cycles instead of obtain/recycle churn on every gesture. Add release() method called from SentryWindowCallback.stopTracking() to prevent native resource leaks when activity is destroyed mid-gesture. Also fix broken Javadoc @link to removed dependency, change onTouchEvent return to void, and remove redundant null check. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(gestures): Handle multi-touch to prevent spurious tap detection When a second finger touches the screen (ACTION_POINTER_DOWN), cancel tap detection by setting isInTapRegion to false. Previously, pinch-to-zoom gestures where the first finger stayed still would incorrectly trigger onSingleTapUp, producing false click breadcrumbs. Co-Authored-By: Claude Opus 4.6 (1M context) * chore: Register btrace-perfetto skill in agents.toml Add local btrace-perfetto skill for capturing and comparing Perfetto traces on Android devices using btrace 3.0. Co-Authored-By: Claude Opus 4.6 (1M context) * chore: Add btrace-perfetto skill for Perfetto trace capture Workflow skill that automates capturing and comparing Perfetto traces using btrace 3.0 on Android devices. Includes a Perfetto UI viewer template with SQL query deep-linking via postMessage API. Co-Authored-By: Claude Opus 4.6 (1M context) * chore: Update btrace skill with release builds and sound cues Use release builds for accurate profiling, add ProGuard keep rules for btrace and Sentry class names, increase trace duration to 30s, and play a Ping sound synced to the actual trace start. Co-Authored-By: Claude Opus 4.6 (1M context) * chore: Update btrace-perfetto skill with debug builds and trace comparison Prefer debug builds for richer tracing instrumentation (Handler, MessageQueue, Lock slices). Add trace_processor prerequisite for local querying. Add Step 6 with SQL queries and comparison table generation. Include sampling rate reference and additional troubleshooting entries. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(gestures): Suppress fling after multi-touch to prevent misclassified swipes The ACTION_POINTER_DOWN handler suppressed taps but not flings. When the last finger lifts quickly after a pinch-to-zoom, the velocity check in ACTION_UP could fire onFling, causing SentryGestureListener to misclassify the gesture as a swipe breadcrumb. Add ignoreUpEvent flag mirroring GestureDetector's mIgnoreNextUpEvent to skip the entire UP handler after multi-touch. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 --- .claude/skills/.gitignore | 2 + .claude/skills/btrace-perfetto/SKILL.md | 284 +++++++++++++ .../assets/viewer-template.html | 49 +++ CHANGELOG.md | 4 + agents.toml | 4 + sentry-android-core/proguard-rules.pro | 1 - .../core/UserInteractionIntegration.java | 33 +- .../gestures/SentryGestureDetector.java | 147 +++++++ .../gestures/SentryWindowCallback.java | 10 +- .../core/UserInteractionIntegrationTest.kt | 17 - .../gestures/SentryGestureDetectorTest.kt | 386 ++++++++++++++++++ .../gestures/SentryWindowCallbackTest.kt | 3 +- 12 files changed, 892 insertions(+), 48 deletions(-) create mode 100644 .claude/skills/btrace-perfetto/SKILL.md create mode 100644 .claude/skills/btrace-perfetto/assets/viewer-template.html create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt diff --git a/.claude/skills/.gitignore b/.claude/skills/.gitignore index 08243027e52..229f4495ee3 100644 --- a/.claude/skills/.gitignore +++ b/.claude/skills/.gitignore @@ -6,3 +6,5 @@ !create-java-pr/** !test/ !test/** +!btrace-perfetto/ +!btrace-perfetto/** diff --git a/.claude/skills/btrace-perfetto/SKILL.md b/.claude/skills/btrace-perfetto/SKILL.md new file mode 100644 index 00000000000..7cbea4841ee --- /dev/null +++ b/.claude/skills/btrace-perfetto/SKILL.md @@ -0,0 +1,284 @@ +--- +name: btrace-perfetto +description: Capture and compare Perfetto traces using btrace 3.0 on an Android device. Use when asked to "profile", "capture trace", "perfetto trace", "btrace", "compare traces", "record perfetto", "trace touch events", "measure performance on device", or benchmark Android SDK changes between branches. +allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion +argument-hint: "[branch1] [branch2] [duration] [sql-query]" +--- + +# btrace Perfetto Trace Capture + +Capture Perfetto traces with btrace 3.0 on a connected Android device, optionally comparing two branches. Opens results in Perfetto UI with a prefilled SQL query. After capture, query traces locally with `trace_processor` to compute comparison stats. + +## Prerequisites + +Before starting, verify: + +1. **Connected device**: `adb devices` shows a device (Android 8.0+, 64-bit) +2. **btrace CLI jar**: Check if `tools/btrace/rhea-trace-shell.jar` exists. If not, download it: + ```bash + mkdir -p tools/btrace/traces + curl -sL "https://repo1.maven.org/maven2/com/bytedance/btrace/rhea-trace-processor/3.0.0/rhea-trace-processor-3.0.0.jar" \ + -o tools/btrace/rhea-trace-shell.jar + ``` +3. **Perfetto trace_processor**: Check if `/tmp/trace_processor` exists. If not, download it: + ```bash + curl -sL "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor && chmod +x /tmp/trace_processor + ``` +4. **Device ABI**: Run `adb shell getprop ro.product.cpu.abi` — btrace only supports arm64-v8a and armeabi-v7a (no x86/x86_64) + +## Step 1: Parse Arguments + +| Argument | Default | Description | +|----------|---------|-------------| +| branch1 | current branch | First branch to trace | +| branch2 | `main` | Second branch to compare against | +| duration | `30` | Trace duration in seconds | +| sql-query | see below | SQL query to prefill in Perfetto UI | + +If no arguments are provided, ask the user what they want to trace and which branches to compare. If only one branch is given, capture only that branch (no comparison). + +## Step 2: Integrate btrace into Sample App + +The sample app is at `sentry-samples/sentry-samples-android/`. + +### 2a: Add btrace dependency + +In `sentry-samples/sentry-samples-android/build.gradle.kts`, add to the `dependencies` block: + +```kotlin +implementation("com.bytedance.btrace:rhea-inhouse:3.0.0") +``` + +### 2b: Restrict ABI to device architecture + +The btrace native library (shadowhook) does not support x86/x86_64. Replace the `ndk` abiFilters line in `defaultConfig` to match the connected device: + +```kotlin +ndk { abiFilters.addAll(listOf("arm64-v8a")) } +``` + +Adjust if the device reports a different ABI. + +### 2c: Initialize btrace in Application + +In `MyApplication.java`, add `attachBaseContext`: + +```java +import android.content.Context; +import com.bytedance.rheatrace.RheaTrace3; + +// Add before onCreate: +@Override +protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + RheaTrace3.init(base); +} +``` + +**Important**: The package is `com.bytedance.rheatrace`, not `com.bytedance.btrace`. + +### 2d: Add ProGuard keep rules (release builds only) + +Only needed when building release. In `sentry-samples/sentry-samples-android/proguard-rules.pro`, add: + +``` +-keep class com.bytedance.rheatrace.** { *; } +-keepnames class io.sentry.** { *; } +``` + +The first rule prevents R8 from stripping btrace's HTTP server classes (fails with `SocketException` otherwise). The second preserves Sentry class and method names so they appear readable in the Perfetto trace instead of obfuscated single-letter names. + +## Step 3: Build and Install + +Prefer **debug builds** — they provide richer tracing instrumentation (Handler, MessageQueue, Monitor:Lock slices visible) which is essential for comparing internal SDK behavior. Use the default 1kHz btrace sampling rate for debug builds. + +```bash +./gradlew :sentry-samples:sentry-samples-android:installDebug +``` + +**Release builds** are useful when you need to measure real-world performance without StrictMode/debuggable overhead or with R8 optimizations. Require the ProGuard keep rules from step 2d. Use `-sampleInterval 333000` (333μs / 3kHz) for finer granularity since release code runs faster. + +```bash +./gradlew :sentry-samples:sentry-samples-android:installRelease +``` + +## Step 4: Capture Trace + +For each branch to trace: + +### 4a: Set btrace properties and launch app + +Clear any stale port files, set properties, and launch: + +```bash +adb shell "rm -rf /storage/emulated/0/Android/data/io.sentry.samples.android/files/rhea-port" +adb shell setprop debug.rhea3.startWhenAppLaunch 1 +adb shell setprop debug.rhea3.waitTraceTimeout 60 +adb shell am force-stop io.sentry.samples.android +sleep 2 +adb shell am start -n io.sentry.samples.android/.MainActivity +sleep 5 +``` + +The app must be started AFTER `debug.rhea3.startWhenAppLaunch` is set, otherwise the trace server won't initialize. The 5s sleep after launch gives the btrace HTTP server time to start. + +### 4b: Play a sound to signal the user, then capture + +Play a sound when tracing actually starts so the user knows to begin interacting. Pipe btrace output through a loop that triggers the sound on the "start tracing" line: + +```bash +java -jar tools/btrace/rhea-trace-shell.jar \ + -a io.sentry.samples.android \ + -t ${duration} \ + -waitTraceTimeout 60 \ + -o tools/btrace/traces/${branch_name}.pb \ + sched 2>&1 | while IFS= read -r line; do + echo "$line" + if [[ "$line" == *"start tracing"* ]]; then + afplay -v 1.5 /System/Library/Sounds/Ping.aiff & + fi + done +``` + +For release builds with finer sampling, add `-sampleInterval 333000`. + +Do NOT use the `-r` flag — it fails to resolve the launcher activity because LeakCanary registers a second one. Launch the app manually in step 4a instead. + +### 4c: Switch branches for comparison + +When capturing a second branch: + +1. Stash the btrace integration changes: + ```bash + git stash push -m "btrace integration" -- \ + sentry-samples/sentry-samples-android/build.gradle.kts \ + sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java \ + sentry-samples/sentry-samples-android/proguard-rules.pro + ``` +2. Checkout the other branch +3. Pop the stash: `git stash pop` +4. Rebuild and install (same variant — debug or release — as the first branch) +5. Repeat steps 4a and 4b with a different output filename +6. Switch back to the original branch and restore files + +## Step 5: Open in Perfetto UI + +Generate a viewer HTML and serve it locally. Use the template at `assets/viewer-template.html` as a base — copy it to `tools/btrace/traces/viewer.html` and replace the placeholder values: + +- `TRACE_FILES`: array of `{file, title}` objects for each captured trace +- `SQL_QUERY`: the SQL query to prefill + +The SQL query is passed via the URL hash parameter: `https://ui.perfetto.dev/#!/?query=...` + +The trace data is sent via the postMessage API (required for local files — URL deep-linking does not work with `file://`). + +Start a local HTTP server and open the viewer: + +```bash +cd tools/btrace/traces && python3 -m http.server 8008 & +open http://localhost:8008/viewer.html +``` + +### Default SQL Query + +If no custom query is provided, use: + +```sql +SELECT + s.name AS slice_name, + s.dur / 1e6 AS dur_ms, + s.ts, + t.name AS track_name +FROM slice s +JOIN thread_track t ON s.track_id = t.id +WHERE s.name GLOB '*SentryWindowCallback.dispatch*' +ORDER BY s.ts +``` + +## Step 6: Query and Compare Traces + +After capturing both branches, use `trace_processor` to compute comparison stats locally. + +### Basic stats query + +For each trace file, run: + +```bash +/tmp/trace_processor -Q " +WITH events AS ( + SELECT s.dur / 1e6 as dur_ms FROM slice s + WHERE s.name GLOB '*${METHOD_GLOB}*' AND s.dur > 0 + ORDER BY s.dur +) +SELECT COUNT(*) as count, + ROUND(AVG(dur_ms), 4) as avg_ms, + ROUND((SELECT dur_ms FROM events LIMIT 1 OFFSET (SELECT COUNT(*)/2 FROM events)), 4) as median_ms, + ROUND(MIN(dur_ms), 4) as min_ms, + ROUND(MAX(dur_ms), 4) as max_ms +FROM events +" tools/btrace/traces/${trace_file}.pb +``` + +Replace `${METHOD_GLOB}` with the method pattern to compare (e.g. `SentryGestureDetector.onTouchEvent`, `SentryWindowCallback.dispatchTouchEvent`). + +### Finding child calls (debug builds) + +To find what happens inside a method (e.g. Handler calls, lock acquisitions): + +```bash +/tmp/trace_processor -Q " +WITH RECURSIVE descendants(id, depth) AS ( + SELECT s.id, 0 FROM slice s WHERE s.name GLOB '*${PARENT_METHOD}*' + UNION ALL + SELECT s.id, d.depth + 1 FROM slice s JOIN descendants d ON s.parent_id = d.id WHERE d.depth < 10 +) +SELECT s.name, COUNT(*) as count, ROUND(AVG(s.dur / 1e6), 3) as avg_ms +FROM slice s JOIN descendants d ON s.id = d.id +WHERE d.depth > 0 +GROUP BY s.name ORDER BY count DESC +LIMIT 20 +" tools/btrace/traces/${trace_file}.pb +``` + +### Build the comparison table + +Run the stats query on both trace files, then present a markdown table: + +``` +| Metric | Branch A | Branch B | Delta | +|--------|----------|----------|-------| +| Count | ... | ... | | +| Average| ... | ... | -X% | +| Median | ... | ... | -X% | +| Max | ... | ... | -X% | +``` + +Compute delta as `(branchA - branchB) / branchB * 100`. Negative means branch A is faster. + +### Sampling rate reference + +| Rate | Interval | `-sampleInterval` | Use case | +|------|----------|-------------------|----------| +| 1 kHz | 1ms | `1000000` (default) | Debug builds, general profiling | +| 3 kHz | 333μs | `333000` | Release builds, finer granularity | +| 10 kHz | 100μs | `100000` | Maximum detail, higher overhead | + +Higher sampling rates capture shorter method calls but add CPU overhead which can skew results. For most comparisons, the default 1kHz is sufficient. + +## Cleanup + +After tracing is complete, remind the user that the btrace integration changes to the sample app should NOT be committed. The `tools/btrace/` directory is gitignored. + +## Troubleshooting + +| Problem | Solution | +|---------|----------| +| `No compatible library found [shadowhook]` | Restrict `ndk.abiFilters` to arm64-v8a only | +| `package com.bytedance.btrace does not exist` | Use `com.bytedance.rheatrace` (not `btrace`) | +| `ResolverActivity does not exist` with `-r` flag | Don't use `-r`; launch the app manually before capturing | +| `wait for trace ready timeout` on download | Set `debug.rhea3.startWhenAppLaunch=1` BEFORE launching the app, and use `-waitTraceTimeout 60` | +| Empty jar file (0 bytes) | Download from Maven Central (`repo1.maven.org`), not `oss.sonatype.org` | +| `FileNotFoundException` on sampling download | App was already running when properties were set; force-stop and relaunch | +| `SocketException: Unexpected end of file` in release builds | R8 stripped btrace classes; add `-keep class com.bytedance.rheatrace.** { *; }` to proguard-rules.pro | +| Stale port from previous session | Run `adb shell "rm -rf /storage/emulated/0/Android/data/io.sentry.samples.android/files/rhea-port"` before launching | +| Most `onTouchEvent` durations are 0ms | Increase sampling rate with `-sampleInterval 333000` (3kHz) | diff --git a/.claude/skills/btrace-perfetto/assets/viewer-template.html b/.claude/skills/btrace-perfetto/assets/viewer-template.html new file mode 100644 index 00000000000..4c31a24c342 --- /dev/null +++ b/.claude/skills/btrace-perfetto/assets/viewer-template.html @@ -0,0 +1,49 @@ + + +btrace Trace Viewer + +

Perfetto Trace Viewer

+
+

+ + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 8357f0699df..74219c17d9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Fix ANR caused by `GestureDetectorCompat` Handler/MessageQueue lock contention in `SentryWindowCallback` ([#5138](https://github.com/getsentry/sentry-java/pull/5138)) + ### Internal - Bump AGP version from v8.6.0 to v8.13.1 ([#5063](https://github.com/getsentry/sentry-java/pull/5063)) diff --git a/agents.toml b/agents.toml index b2347f8e7e6..b4c9e091b70 100644 --- a/agents.toml +++ b/agents.toml @@ -31,3 +31,7 @@ source = "path:.agents/skills/create-java-pr" [[skills]] name = "test" source = "path:.agents/skills/test" + +[[skills]] +name = "btrace-perfetto" +source = "path:.agents/skills/btrace-perfetto" diff --git a/sentry-android-core/proguard-rules.pro b/sentry-android-core/proguard-rules.pro index aca674442bf..4cd76f9a20d 100644 --- a/sentry-android-core/proguard-rules.pro +++ b/sentry-android-core/proguard-rules.pro @@ -1,7 +1,6 @@ ##---------------Begin: proguard configuration for android-core ---------- ##---------------Begin: proguard configuration for androidx.core ---------- --keep class androidx.core.view.GestureDetectorCompat { (...); } -keep class androidx.core.app.FrameMetricsAggregator { (...); } -keep interface androidx.core.view.ScrollingView { *; } ##---------------End: proguard configuration for androidx.core ---------- diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java index 9f47fc8666c..c0dd3f9eb71 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java @@ -28,14 +28,11 @@ public final class UserInteractionIntegration private @Nullable IScopes scopes; private @Nullable SentryAndroidOptions options; - private final boolean isAndroidXAvailable; private final boolean isAndroidxLifecycleAvailable; public UserInteractionIntegration( final @NotNull Application application, final @NotNull io.sentry.util.LoadClass classLoader) { this.application = Objects.requireNonNull(application, "Application is required"); - isAndroidXAvailable = - classLoader.isClassAvailable("androidx.core.view.GestureDetectorCompat", options); isAndroidxLifecycleAvailable = classLoader.isClassAvailable("androidx.lifecycle.Lifecycle", options); } @@ -128,27 +125,19 @@ public void register(@NotNull IScopes scopes, @NotNull SentryOptions options) { .log(SentryLevel.DEBUG, "UserInteractionIntegration enabled: %s", integrationEnabled); if (integrationEnabled) { - if (isAndroidXAvailable) { - application.registerActivityLifecycleCallbacks(this); - this.options.getLogger().log(SentryLevel.DEBUG, "UserInteractionIntegration installed."); - addIntegrationToSdkVersion("UserInteraction"); - - // In case of a deferred init, we hook into any resumed activity - if (isAndroidxLifecycleAvailable) { - final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity(); - if (activity instanceof LifecycleOwner) { - if (((LifecycleOwner) activity).getLifecycle().getCurrentState() - == Lifecycle.State.RESUMED) { - startTracking(activity); - } + application.registerActivityLifecycleCallbacks(this); + this.options.getLogger().log(SentryLevel.DEBUG, "UserInteractionIntegration installed."); + addIntegrationToSdkVersion("UserInteraction"); + + // In case of a deferred init, we hook into any resumed activity + if (isAndroidxLifecycleAvailable) { + final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity(); + if (activity instanceof LifecycleOwner) { + if (((LifecycleOwner) activity).getLifecycle().getCurrentState() + == Lifecycle.State.RESUMED) { + startTracking(activity); } } - } else { - options - .getLogger() - .log( - SentryLevel.INFO, - "androidx.core is not available, UserInteractionIntegration won't be installed"); } } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java new file mode 100644 index 00000000000..3196ae0189e --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java @@ -0,0 +1,147 @@ +package io.sentry.android.core.internal.gestures; + +import android.content.Context; +import android.view.GestureDetector; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A lightweight gesture detector that replaces {@code GestureDetectorCompat}/{@link + * GestureDetector} to avoid ANRs caused by Handler/MessageQueue lock contention and IPC calls + * (FrameworkStatsLog.write). + * + *

Only detects click (tap), scroll, and fling — the gestures used by {@link + * SentryGestureListener}. Long-press, show-press, and double-tap detection (which require Handler + * message scheduling) are intentionally omitted. + */ +@ApiStatus.Internal +public final class SentryGestureDetector { + + private final @NotNull GestureDetector.OnGestureListener listener; + private final int touchSlopSquare; + private final int minimumFlingVelocity; + private final int maximumFlingVelocity; + + private boolean isInTapRegion; + private boolean ignoreUpEvent; + private float downX; + private float downY; + private float lastX; + private float lastY; + private @Nullable MotionEvent currentDownEvent; + private @Nullable VelocityTracker velocityTracker; + + SentryGestureDetector( + final @NotNull Context context, final @NotNull GestureDetector.OnGestureListener listener) { + this.listener = listener; + final ViewConfiguration config = ViewConfiguration.get(context); + final int touchSlop = config.getScaledTouchSlop(); + this.touchSlopSquare = touchSlop * touchSlop; + this.minimumFlingVelocity = config.getScaledMinimumFlingVelocity(); + this.maximumFlingVelocity = config.getScaledMaximumFlingVelocity(); + } + + void onTouchEvent(final @NotNull MotionEvent event) { + final int action = event.getActionMasked(); + + if (velocityTracker == null) { + velocityTracker = VelocityTracker.obtain(); + } + + if (action == MotionEvent.ACTION_DOWN) { + velocityTracker.clear(); + } + velocityTracker.addMovement(event); + + switch (action) { + case MotionEvent.ACTION_DOWN: + downX = event.getX(); + downY = event.getY(); + lastX = downX; + lastY = downY; + isInTapRegion = true; + ignoreUpEvent = false; + + if (currentDownEvent != null) { + currentDownEvent.recycle(); + } + currentDownEvent = MotionEvent.obtain(event); + + listener.onDown(event); + break; + + case MotionEvent.ACTION_MOVE: + { + final float x = event.getX(); + final float y = event.getY(); + final float dx = x - downX; + final float dy = y - downY; + final float distanceSquare = (dx * dx) + (dy * dy); + + if (distanceSquare > touchSlopSquare) { + final float scrollX = lastX - x; + final float scrollY = lastY - y; + listener.onScroll(currentDownEvent, event, scrollX, scrollY); + isInTapRegion = false; + lastX = x; + lastY = y; + } + break; + } + + case MotionEvent.ACTION_POINTER_DOWN: + // A second finger means this is not a single tap (e.g. pinch-to-zoom). + // Also suppress the UP handler to avoid spurious fling detection when the + // last finger lifts quickly after a pinch — mirrors GestureDetector's + // mIgnoreNextUpEvent / cancelTaps() behavior. + isInTapRegion = false; + ignoreUpEvent = true; + break; + + case MotionEvent.ACTION_UP: + if (ignoreUpEvent) { + endGesture(); + break; + } + if (isInTapRegion) { + listener.onSingleTapUp(event); + } else { + final int pointerId = event.getPointerId(0); + velocityTracker.computeCurrentVelocity(1000, maximumFlingVelocity); + final float velocityX = velocityTracker.getXVelocity(pointerId); + final float velocityY = velocityTracker.getYVelocity(pointerId); + + if (Math.abs(velocityX) > minimumFlingVelocity + || Math.abs(velocityY) > minimumFlingVelocity) { + listener.onFling(currentDownEvent, event, velocityX, velocityY); + } + } + endGesture(); + break; + + case MotionEvent.ACTION_CANCEL: + endGesture(); + break; + } + } + + /** Releases native resources. Call when the detector is no longer needed. */ + void release() { + endGesture(); + if (velocityTracker != null) { + velocityTracker.recycle(); + velocityTracker = null; + } + } + + private void endGesture() { + if (currentDownEvent != null) { + currentDownEvent.recycle(); + currentDownEvent = null; + } + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java index edb9c9f9daa..557cd4e7a29 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java @@ -1,11 +1,8 @@ package io.sentry.android.core.internal.gestures; import android.content.Context; -import android.os.Handler; -import android.os.Looper; import android.view.MotionEvent; import android.view.Window; -import androidx.core.view.GestureDetectorCompat; import io.sentry.SentryLevel; import io.sentry.SentryOptions; import io.sentry.SpanStatus; @@ -18,7 +15,7 @@ public final class SentryWindowCallback extends WindowCallbackAdapter { private final @NotNull Window.Callback delegate; private final @NotNull SentryGestureListener gestureListener; - private final @NotNull GestureDetectorCompat gestureDetector; + private final @NotNull SentryGestureDetector gestureDetector; private final @Nullable SentryOptions options; private final @NotNull MotionEventObtainer motionEventObtainer; @@ -29,7 +26,7 @@ public SentryWindowCallback( final @Nullable SentryOptions options) { this( delegate, - new GestureDetectorCompat(context, gestureListener, new Handler(Looper.getMainLooper())), + new SentryGestureDetector(context, gestureListener), gestureListener, options, new MotionEventObtainer() {}); @@ -37,7 +34,7 @@ public SentryWindowCallback( SentryWindowCallback( final @NotNull Window.Callback delegate, - final @NotNull GestureDetectorCompat gestureDetector, + final @NotNull SentryGestureDetector gestureDetector, final @NotNull SentryGestureListener gestureListener, final @Nullable SentryOptions options, final @NotNull MotionEventObtainer motionEventObtainer) { @@ -76,6 +73,7 @@ private void handleTouchEvent(final @NotNull MotionEvent motionEvent) { public void stopTracking() { gestureListener.stopTracing(SpanStatus.CANCELLED); + gestureDetector.release(); } public @NotNull Window.Callback getDelegate() { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt index 4f1495a9875..f558841e6f5 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt @@ -39,16 +39,8 @@ class UserInteractionIntegrationTest { fun getSut( callback: Window.Callback? = null, - isAndroidXAvailable: Boolean = true, isLifecycleAvailable: Boolean = true, ): UserInteractionIntegration { - whenever( - loadClass.isClassAvailable( - eq("androidx.core.view.GestureDetectorCompat"), - anyOrNull(), - ) - ) - .thenReturn(isAndroidXAvailable) whenever( loadClass.isClassAvailable( eq("androidx.lifecycle.Lifecycle"), @@ -99,15 +91,6 @@ class UserInteractionIntegrationTest { verify(fixture.application).unregisterActivityLifecycleCallbacks(any()) } - @Test - fun `when androidx is unavailable doesn't register a callback`() { - val sut = fixture.getSut(isAndroidXAvailable = false) - - sut.register(fixture.scopes, fixture.options) - - verify(fixture.application, never()).registerActivityLifecycleCallbacks(any()) - } - @Test fun `registers window callback on activity resumed`() { val sut = fixture.getSut() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt new file mode 100644 index 00000000000..be15f9c578b --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt @@ -0,0 +1,386 @@ +package io.sentry.android.core.internal.gestures + +import android.os.SystemClock +import android.view.GestureDetector +import android.view.MotionEvent +import android.view.ViewConfiguration +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import kotlin.test.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.any +import org.mockito.kotlin.anyOrNull +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify + +@RunWith(AndroidJUnit4::class) +class SentryGestureDetectorTest { + + class Fixture { + val listener = mock() + val context = ApplicationProvider.getApplicationContext() + val touchSlop = ViewConfiguration.get(context).scaledTouchSlop + + fun getSut(): SentryGestureDetector { + return SentryGestureDetector(context, listener) + } + } + + private val fixture = Fixture() + + @Test + fun `tap - DOWN followed by UP within touch slop fires onSingleTapUp`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + val up = MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 100f, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(up) + + verify(fixture.listener).onDown(down) + verify(fixture.listener).onSingleTapUp(up) + verify(fixture.listener, never()).onScroll(any(), any(), any(), any()) + verify(fixture.listener, never()).onFling(anyOrNull(), any(), any(), any()) + + down.recycle() + up.recycle() + } + + @Test + fun `no tap - DOWN followed by MOVE beyond slop and UP does not fire onSingleTapUp`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + val beyondSlop = fixture.touchSlop + 10f + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + val move = + MotionEvent.obtain( + downTime, + downTime + 16, + MotionEvent.ACTION_MOVE, + 100f + beyondSlop, + 100f, + 0, + ) + val up = + MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 100f + beyondSlop, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(move) + sut.onTouchEvent(up) + + verify(fixture.listener, never()).onSingleTapUp(any()) + + down.recycle() + move.recycle() + up.recycle() + } + + @Test + fun `scroll - DOWN followed by MOVE beyond slop fires onScroll with correct deltas`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + val beyondSlop = fixture.touchSlop + 10f + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 200f, 0) + val move = + MotionEvent.obtain( + downTime, + downTime + 16, + MotionEvent.ACTION_MOVE, + 100f + beyondSlop, + 200f, + 0, + ) + + sut.onTouchEvent(down) + sut.onTouchEvent(move) + + // scrollX = lastX - currentX = 100 - (100 + beyondSlop) = -beyondSlop + verify(fixture.listener).onScroll(anyOrNull(), eq(move), eq(-beyondSlop), eq(0f)) + + down.recycle() + move.recycle() + } + + @Test + fun `fling - fast swipe fires onFling`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + val beyondSlop = fixture.touchSlop + 10f + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + // Move far and fast (large distance in short time = high velocity) + val move = + MotionEvent.obtain( + downTime, + downTime + 10, + MotionEvent.ACTION_MOVE, + 100f + beyondSlop, + 100f, + 0, + ) + val up = MotionEvent.obtain(downTime, downTime + 20, MotionEvent.ACTION_UP, 500f, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(move) + sut.onTouchEvent(up) + + verify(fixture.listener).onFling(anyOrNull(), eq(up), any(), any()) + + down.recycle() + move.recycle() + up.recycle() + } + + @Test + fun `slow release - DOWN MOVE and slow UP does not fire onFling`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + val beyondSlop = fixture.touchSlop + 1f + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + // Move just beyond slop + val move = + MotionEvent.obtain( + downTime, + downTime + 100, + MotionEvent.ACTION_MOVE, + 100f + beyondSlop, + 100f, + 0, + ) + // Stay at the same position for a long time to ensure near-zero velocity + val moveStill = + MotionEvent.obtain( + downTime, + downTime + 10000, + MotionEvent.ACTION_MOVE, + 100f + beyondSlop, + 100f, + 0, + ) + val up = + MotionEvent.obtain( + downTime, + downTime + 10001, + MotionEvent.ACTION_UP, + 100f + beyondSlop, + 100f, + 0, + ) + + sut.onTouchEvent(down) + sut.onTouchEvent(move) + sut.onTouchEvent(moveStill) + sut.onTouchEvent(up) + + verify(fixture.listener, never()).onFling(anyOrNull(), any(), any(), any()) + + down.recycle() + move.recycle() + moveStill.recycle() + up.recycle() + } + + @Test + fun `cancel - DOWN followed by CANCEL does not fire tap or fling callbacks`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + val cancel = + MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_CANCEL, 100f, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(cancel) + + verify(fixture.listener).onDown(down) + verify(fixture.listener, never()).onSingleTapUp(any()) + verify(fixture.listener, never()).onScroll(any(), any(), any(), any()) + verify(fixture.listener, never()).onFling(anyOrNull(), any(), any(), any()) + + down.recycle() + cancel.recycle() + } + + @Test + fun `multi-touch - POINTER_DOWN cancels tap so UP does not fire onSingleTapUp`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + // Second finger touches — encoded as ACTION_POINTER_DOWN with pointer index 1 + val pointerDown = + MotionEvent.obtain( + downTime, + downTime + 20, + (1 shl MotionEvent.ACTION_POINTER_INDEX_SHIFT) or MotionEvent.ACTION_POINTER_DOWN, + 100f, + 100f, + 0, + ) + val up = MotionEvent.obtain(downTime, downTime + 100, MotionEvent.ACTION_UP, 100f, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(pointerDown) + sut.onTouchEvent(up) + + verify(fixture.listener).onDown(down) + verify(fixture.listener, never()).onSingleTapUp(any()) + + down.recycle() + pointerDown.recycle() + up.recycle() + } + + @Test + fun `multi-touch - POINTER_DOWN suppresses fling on fast UP`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + + val down = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + // Second finger touches + val pointerDown = + MotionEvent.obtain( + downTime, + downTime + 20, + (1 shl MotionEvent.ACTION_POINTER_INDEX_SHIFT) or MotionEvent.ACTION_POINTER_DOWN, + 100f, + 100f, + 0, + ) + // Second finger lifts + val pointerUp = + MotionEvent.obtain( + downTime, + downTime + 40, + (1 shl MotionEvent.ACTION_POINTER_INDEX_SHIFT) or MotionEvent.ACTION_POINTER_UP, + 100f, + 100f, + 0, + ) + // Last finger lifts quickly and far — would normally trigger fling + val up = MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 500f, 100f, 0) + + sut.onTouchEvent(down) + sut.onTouchEvent(pointerDown) + sut.onTouchEvent(pointerUp) + sut.onTouchEvent(up) + + verify(fixture.listener, never()).onSingleTapUp(any()) + verify(fixture.listener, never()).onFling(anyOrNull(), any(), any(), any()) + + down.recycle() + pointerDown.recycle() + pointerUp.recycle() + up.recycle() + } + + @Test + fun `multi-touch - tap works again after multi-touch gesture ends`() { + val sut = fixture.getSut() + var downTime = SystemClock.uptimeMillis() + + // First gesture: multi-touch (suppressed) + val down1 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + val pointerDown = + MotionEvent.obtain( + downTime, + downTime + 20, + (1 shl MotionEvent.ACTION_POINTER_INDEX_SHIFT) or MotionEvent.ACTION_POINTER_DOWN, + 100f, + 100f, + 0, + ) + val up1 = MotionEvent.obtain(downTime, downTime + 100, MotionEvent.ACTION_UP, 100f, 100f, 0) + + sut.onTouchEvent(down1) + sut.onTouchEvent(pointerDown) + sut.onTouchEvent(up1) + + verify(fixture.listener, never()).onSingleTapUp(any()) + + // Second gesture: normal tap — ignoreUpEvent should have been reset + downTime = SystemClock.uptimeMillis() + val down2 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 200f, 200f, 0) + val up2 = MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 200f, 200f, 0) + + sut.onTouchEvent(down2) + sut.onTouchEvent(up2) + + verify(fixture.listener).onSingleTapUp(up2) + + down1.recycle() + pointerDown.recycle() + up1.recycle() + down2.recycle() + up2.recycle() + } + + @Test + fun `sequential gestures - state resets between tap and scroll`() { + val sut = fixture.getSut() + val beyondSlop = fixture.touchSlop + 10f + + // First gesture: tap + var downTime = SystemClock.uptimeMillis() + val down1 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + val up1 = MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 100f, 100f, 0) + + sut.onTouchEvent(down1) + sut.onTouchEvent(up1) + verify(fixture.listener).onSingleTapUp(up1) + + // Second gesture: scroll + downTime = SystemClock.uptimeMillis() + val down2 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 200f, 200f, 0) + val move2 = + MotionEvent.obtain( + downTime, + downTime + 16, + MotionEvent.ACTION_MOVE, + 200f + beyondSlop, + 200f, + 0, + ) + val up2 = + MotionEvent.obtain( + downTime, + downTime + 5000, + MotionEvent.ACTION_UP, + 200f + beyondSlop, + 200f, + 0, + ) + + sut.onTouchEvent(down2) + sut.onTouchEvent(move2) + sut.onTouchEvent(up2) + + verify(fixture.listener).onScroll(anyOrNull(), eq(move2), any(), any()) + // onSingleTapUp should NOT have been called again for the second gesture + verify(fixture.listener, never()).onSingleTapUp(up2) + + // Third gesture: another tap to verify clean reset + downTime = SystemClock.uptimeMillis() + val down3 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 300f, 300f, 0) + val up3 = MotionEvent.obtain(downTime, downTime + 50, MotionEvent.ACTION_UP, 300f, 300f, 0) + + sut.onTouchEvent(down3) + sut.onTouchEvent(up3) + verify(fixture.listener).onSingleTapUp(up3) + + down1.recycle() + up1.recycle() + down2.recycle() + move2.recycle() + up2.recycle() + down3.recycle() + up3.recycle() + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt index 856e6d0f156..8afc1b39304 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt @@ -2,7 +2,6 @@ package io.sentry.android.core.internal.gestures import android.view.MotionEvent import android.view.Window -import androidx.core.view.GestureDetectorCompat import io.sentry.android.core.SentryAndroidOptions import io.sentry.android.core.internal.gestures.SentryWindowCallback.MotionEventObtainer import kotlin.test.Test @@ -18,7 +17,7 @@ class SentryWindowCallbackTest { class Fixture { val delegate = mock() val options = SentryAndroidOptions().apply { dsn = "https://key@sentry.io/proj" } - val gestureDetector = mock() + val gestureDetector = mock() val gestureListener = mock() val motionEventCopy = mock() From 12c8c2ace0ccd97d3efe1662e9cf8604441e1faf Mon Sep 17 00:00:00 2001 From: markushi <1411808+markushi@users.noreply.github.com> Date: Thu, 16 Apr 2026 12:56:27 +0000 Subject: [PATCH 102/391] release: 8.39.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74219c17d9d..6a2e72c1236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.39.0 ### Fixes diff --git a/gradle.properties b/gradle.properties index d9d50f79f73..5266e49135d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.38.0 +versionName=8.39.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From bfc5ee11c3861539e7ecf5d5a49dc91c80fc8781 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 17 Apr 2026 05:49:17 +0200 Subject: [PATCH 103/391] fix(sentry): Recover object readers after deserialization errors (#5293) * fix(sentry): Prevent object readers from hanging on bad values Recover from deserializer failures by advancing past the broken value instead of retrying the same token forever. This keeps list and map helpers progressing and preserves later valid entries. Track nesting in JsonObjectReader so recovery also works after a partially consumed object or array. Implement skipValue in MapObjectReader and avoid consuming stack entries before type checks so failed reads do not corrupt the remaining input. Fixes GH-5278 Co-Authored-By: Claude * fix(sentry): Guard JsonObjectReader recovery failures Abort collection recovery gracefully when the stream is already unrecoverable instead of letting recoverValue fail from inside the original error handler. Log an explicit error and stop iterating so malformed or truncated JSON does not leave the reader in a worse state while still allowing the container to close cleanly. Refs GH-5278 Co-Authored-By: Claude * ref(sentry): Extract JsonObjectReader recovery helper Move the repeated recovery logging flow behind a dedicated helper so the collection readers stay focused on parsing and keep the guarded recovery behavior aligned across all three paths. This does not change behavior. It only removes duplicated error handling around failed value recovery. Refs GH-5278 Co-Authored-By: Claude * fix(sentry): Unwind MapObjectReader failures fully Recover MapObjectReader values back to their stack checkpoint so partially consumed nested objects do not leave child entries or end sentinels behind. This keeps later values readable after a deserializer fails mid-object and adds regression coverage for list, map, and map-of-lists paths that partially enter nested values before throwing. Refs GH-5278 Co-Authored-By: Claude * changelog * fix(sentry): Track container entry during JSON recovery Track recovery state per collection element so post-parse validation failures do not cause the next sibling container to be skipped. This keeps the livelock fix while preserving later valid values after a failed object deserializer. Refs GH-5278 Co-Authored-By: Claude * fix(sentry): Track consumed values during JSON recovery Treat recovery state as consumed when the current value has already been read, including skipValue()-driven failures. This prevents the fallback recovery step from skipping the next valid sibling after a deserializer consumes a value and then throws. Add regressions for direct list recovery and nested map-of-list recovery so consumed-value failures keep later valid entries. Refs GH-5278 Co-Authored-By: Claude * fix(sentry): Log unknown key recovery failures Log a second error when unknown-field recovery itself fails. This makes nextUnknown consistent with the list and map recovery paths and makes truncated payload failures easier to diagnose. Add regression coverage for unknown-key deserialization failures that also leave the stream unrecoverable. Co-Authored-By: Claude * docs(changelog): Clarify JSON recovery log levels Clarify that collection recovery emits warning logs for skipped values, while unknown-key failures and unrecoverable recovery paths emit errors. This keeps the release note aligned with the actual logging behavior from the recovery fixes. Co-Authored-By: Claude * merge changelog lines * mark consumed afterwards instead of before * test(sentry): Remove explicit timeouts from reader recovery tests Remove the explicit JUnit timeout annotations from the new JsonObjectReader and MapObjectReader recovery tests. These tests already fail deterministically and do not need per-test timeouts. Dropping the annotations keeps the new coverage aligned with the rest of the suite and avoids extra noise in the test definitions. Co-Authored-By: Claude * test(sentry): Rename mismatched MapObjectReader recovery tests Rename the partially consumed MapObjectReader recovery tests so their names match the map iteration order. MapObjectReader reads map entries in reverse insertion order from its stack. The previous names described the surviving values as coming after the failure even though they are read before it. Co-Authored-By: Claude * fix(sentry): Mark skipped values consumed after success Move skipValue consumption tracking after the underlying Gson skip succeeds. This keeps valueConsumed aligned with the primitive reader methods and avoids marking a value as consumed before JsonReader has actually advanced past it. Co-Authored-By: Claude * fix(sentry): Handle empty collections in MapObjectReader Gate the recovery loops on the current token instead of hasNext when reading maps and lists. MapObjectReader keeps END_OBJECT and END_ARRAY sentinels on its stack, so hasNext stays true for empty collections. Checking the token preserves empty map and empty list handling after moving nextName outside the inner recovery try-catch, and the new tests cover those cases. Co-Authored-By: Claude * fix(sentry): Preserve list recovery in MapObjectReader Continue list recovery until the END_ARRAY sentinel instead of stopping at the next non-object token. A failed object element could be followed by an invalid primitive and then a valid object. The old loop stopped at the primitive, letting endArray pop the wrong stack entry and leaving the reader in an inconsistent state. The updated loop keeps recovering until the array is fully consumed, and the new tests cover empty collections and mixed invalid list contents. Co-Authored-By: Claude * fix(sentry): Continue list recovery until array end Continue JsonObjectReader list deserialization until the array boundary instead of stopping when the next token is not BEGIN_OBJECT. After recovering from a failed object element, the next unread token can be a primitive. The previous loop exited early in that case and then aborted when endArray() encountered unread content. Iterating with hasNext() keeps recovery aligned with the actual array boundary. Add a regression test covering a failing object followed by a primitive and a later valid object. Fixes GH-5278 Co-Authored-By: Claude --------- Co-authored-by: Claude --- CHANGELOG.md | 4 + .../main/java/io/sentry/JsonObjectReader.java | 218 ++++++++--- .../java/io/sentry/util/MapObjectReader.java | 56 ++- .../java/io/sentry/JsonObjectReaderTest.kt | 337 ++++++++++++++++++ .../io/sentry/util/MapObjectReaderTest.kt | 207 ++++++++++- 5 files changed, 763 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2e72c1236..7e26f52e5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Fixes +- Fix `JsonObjectReader` and `MapObjectReader` hanging indefinitely when deserialization errors leave the reader in an inconsistent state ([#5293](https://github.com/getsentry/sentry-java/pull/5293)) + - Failed collection values are now skipped so parsing can continue + - Skipped collection values emit `WARNING` logs + - Unknown-key failures and unrecoverable recovery failures emit `ERROR` logs - Fix ANR caused by `GestureDetectorCompat` Handler/MessageQueue lock contention in `SentryWindowCallback` ([#5138](https://github.com/getsentry/sentry-java/pull/5138)) ### Internal diff --git a/sentry/src/main/java/io/sentry/JsonObjectReader.java b/sentry/src/main/java/io/sentry/JsonObjectReader.java index f9fe1841847..fef9bfc71ff 100644 --- a/sentry/src/main/java/io/sentry/JsonObjectReader.java +++ b/sentry/src/main/java/io/sentry/JsonObjectReader.java @@ -4,8 +4,10 @@ import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; import java.io.Reader; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Date; +import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -18,6 +20,8 @@ public final class JsonObjectReader implements ObjectReader { private final @NotNull JsonReader jsonReader; + private final @NotNull Deque recoveryStates = new ArrayDeque<>(); + private int depth = 0; public JsonObjectReader(Reader in) { this.jsonReader = new JsonReader(in); @@ -26,25 +30,25 @@ public JsonObjectReader(Reader in) { @Override public @Nullable String nextStringOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return jsonReader.nextString(); + return nextString(); } @Override public @Nullable Double nextDoubleOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return jsonReader.nextDouble(); + return nextDouble(); } @Override public @Nullable Float nextFloatOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } return nextFloat(); @@ -52,42 +56,58 @@ public JsonObjectReader(Reader in) { @Override public float nextFloat() throws IOException { - return (float) jsonReader.nextDouble(); + final double value = jsonReader.nextDouble(); + markValueConsumed(); + return (float) value; } @Override public @Nullable Long nextLongOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return jsonReader.nextLong(); + return nextLong(); } @Override public @Nullable Integer nextIntegerOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return jsonReader.nextInt(); + return nextInt(); } @Override public @Nullable Boolean nextBooleanOrNull() throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return jsonReader.nextBoolean(); + return nextBoolean(); } @Override public void nextUnknown(ILogger logger, Map unknown, String name) { + RecoveryState recoveryState = null; try { + recoveryState = beginRecovery(peek()); unknown.put(name, nextObjectOrNull()); } catch (Exception exception) { logger.log(SentryLevel.ERROR, exception, "Error deserializing unknown key: %s", name); + if (recoveryState != null) { + try { + recoverValue(recoveryState); + } catch (Exception recoveryException) { + logger.log( + SentryLevel.ERROR, + "Stream unrecoverable after unknown key deserialization failure.", + recoveryException); + } + } + } finally { + endRecovery(recoveryState); } } @@ -95,21 +115,29 @@ public void nextUnknown(ILogger logger, Map unknown, String name public @Nullable List nextListOrNull( @NotNull ILogger logger, @NotNull JsonDeserializer deserializer) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - jsonReader.beginArray(); + beginArray(); List list = new ArrayList<>(); - if (jsonReader.hasNext()) { - do { - try { - list.add(deserializer.deserialize(this, logger)); - } catch (Exception e) { - logger.log(SentryLevel.WARNING, "Failed to deserialize object in list.", e); + while (jsonReader.hasNext()) { + final RecoveryState recoveryState = beginRecovery(peek()); + try { + list.add(deserializer.deserialize(this, logger)); + } catch (Exception e) { + if (!recoverAfterValueFailure( + logger, + e, + "Failed to deserialize object in list.", + "Stream unrecoverable, aborting list deserialization.", + recoveryState)) { + break; } - } while (jsonReader.peek() == JsonToken.BEGIN_OBJECT); + } finally { + endRecovery(recoveryState); + } } - jsonReader.endArray(); + endArray(); return list; } @@ -117,23 +145,33 @@ public void nextUnknown(ILogger logger, Map unknown, String name public @Nullable Map nextMapOrNull( @NotNull ILogger logger, @NotNull JsonDeserializer deserializer) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - jsonReader.beginObject(); + beginObject(); Map map = new HashMap<>(); if (jsonReader.hasNext()) { do { + final String key = jsonReader.nextName(); + final RecoveryState recoveryState = beginRecovery(peek()); try { - String key = jsonReader.nextName(); map.put(key, deserializer.deserialize(this, logger)); } catch (Exception e) { - logger.log(SentryLevel.WARNING, "Failed to deserialize object in map.", e); + if (!recoverAfterValueFailure( + logger, + e, + "Failed to deserialize object in map.", + "Stream unrecoverable, aborting map deserialization.", + recoveryState)) { + break; + } + } finally { + endRecovery(recoveryState); } } while (jsonReader.peek() == JsonToken.BEGIN_OBJECT || jsonReader.peek() == JsonToken.NAME); } - jsonReader.endObject(); + endObject(); return map; } @@ -151,9 +189,23 @@ public void nextUnknown(ILogger logger, Map unknown, String name if (hasNext()) { do { final @NotNull String key = nextName(); - final @Nullable List list = nextListOrNull(logger, deserializer); - if (list != null) { - result.put(key, list); + final RecoveryState recoveryState = beginRecovery(peek()); + try { + final @Nullable List list = nextListOrNull(logger, deserializer); + if (list != null) { + result.put(key, list); + } + } catch (Exception e) { + if (!recoverAfterValueFailure( + logger, + e, + "Failed to deserialize list in map.", + "Stream unrecoverable, aborting map-of-lists deserialization.", + recoveryState)) { + break; + } + } finally { + endRecovery(recoveryState); } } while (peek() == JsonToken.BEGIN_OBJECT || peek() == JsonToken.NAME); } @@ -166,7 +218,7 @@ public void nextUnknown(ILogger logger, Map unknown, String name public @Nullable T nextOrNull( @NotNull ILogger logger, @NotNull JsonDeserializer deserializer) throws Exception { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } return deserializer.deserialize(this, logger); @@ -175,20 +227,20 @@ public void nextUnknown(ILogger logger, Map unknown, String name @Override public @Nullable Date nextDateOrNull(ILogger logger) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } - return ObjectReader.dateOrNull(jsonReader.nextString(), logger); + return ObjectReader.dateOrNull(nextString(), logger); } @Override public @Nullable TimeZone nextTimeZoneOrNull(ILogger logger) throws IOException { if (jsonReader.peek() == JsonToken.NULL) { - jsonReader.nextNull(); + nextNull(); return null; } try { - return TimeZone.getTimeZone(jsonReader.nextString()); + return TimeZone.getTimeZone(nextString()); } catch (Exception e) { logger.log(SentryLevel.ERROR, "Error when deserializing TimeZone", e); } @@ -219,21 +271,27 @@ public void nextUnknown(ILogger logger, Map unknown, String name @Override public void beginObject() throws IOException { jsonReader.beginObject(); + markValueConsumed(); + depth++; } @Override public void endObject() throws IOException { jsonReader.endObject(); + depth--; } @Override public void beginArray() throws IOException { jsonReader.beginArray(); + markValueConsumed(); + depth++; } @Override public void endArray() throws IOException { jsonReader.endArray(); + depth--; } @Override @@ -243,32 +301,43 @@ public boolean hasNext() throws IOException { @Override public int nextInt() throws IOException { - return jsonReader.nextInt(); + final int value = jsonReader.nextInt(); + markValueConsumed(); + return value; } @Override public long nextLong() throws IOException { - return jsonReader.nextLong(); + final long value = jsonReader.nextLong(); + markValueConsumed(); + return value; } @Override public String nextString() throws IOException { - return jsonReader.nextString(); + final String value = jsonReader.nextString(); + markValueConsumed(); + return value; } @Override public boolean nextBoolean() throws IOException { - return jsonReader.nextBoolean(); + final boolean value = jsonReader.nextBoolean(); + markValueConsumed(); + return value; } @Override public double nextDouble() throws IOException { - return jsonReader.nextDouble(); + final double value = jsonReader.nextDouble(); + markValueConsumed(); + return value; } @Override public void nextNull() throws IOException { jsonReader.nextNull(); + markValueConsumed(); } @Override @@ -279,10 +348,79 @@ public void setLenient(boolean lenient) { @Override public void skipValue() throws IOException { jsonReader.skipValue(); + markValueConsumed(); + } + + private boolean recoverAfterValueFailure( + final @NotNull ILogger logger, + final @NotNull Exception error, + final @NotNull String warningMessage, + final @NotNull String unrecoverableMessage, + final @NotNull RecoveryState recoveryState) { + logger.log(SentryLevel.WARNING, warningMessage, error); + try { + recoverValue(recoveryState); + return true; + } catch (Exception recoveryException) { + logger.log(SentryLevel.ERROR, unrecoverableMessage, recoveryException); + return false; + } + } + + private @NotNull RecoveryState beginRecovery(final @NotNull JsonToken startToken) { + final RecoveryState recoveryState = new RecoveryState(depth, startToken); + recoveryStates.addLast(recoveryState); + return recoveryState; + } + + private void endRecovery(final @Nullable RecoveryState recoveryState) { + if (recoveryState == null) { + return; + } + if (!recoveryStates.isEmpty() && recoveryStates.peekLast() == recoveryState) { + recoveryStates.removeLast(); + } else { + recoveryStates.remove(recoveryState); + } + } + + private void markValueConsumed() { + final @Nullable RecoveryState recoveryState = recoveryStates.peekLast(); + if (recoveryState != null) { + recoveryState.valueConsumed = true; + } + } + + private void recoverValue(final @NotNull RecoveryState recoveryState) throws IOException { + while (depth > recoveryState.startDepth) { + final JsonToken token = peek(); + if (token == JsonToken.END_OBJECT) { + endObject(); + } else if (token == JsonToken.END_ARRAY) { + endArray(); + } else { + skipValue(); + } + } + + if (!recoveryState.valueConsumed && peek() == recoveryState.startToken) { + skipValue(); + } } @Override public void close() throws IOException { jsonReader.close(); } + + private static final class RecoveryState { + private final int startDepth; + private final @NotNull JsonToken startToken; + private boolean valueConsumed; + + private RecoveryState(final int startDepth, final @NotNull JsonToken startToken) { + this.startDepth = startDepth; + this.startToken = startToken; + } + } } diff --git a/sentry/src/main/java/io/sentry/util/MapObjectReader.java b/sentry/src/main/java/io/sentry/util/MapObjectReader.java index b04fbb96751..edd91190c82 100644 --- a/sentry/src/main/java/io/sentry/util/MapObjectReader.java +++ b/sentry/src/main/java/io/sentry/util/MapObjectReader.java @@ -31,10 +31,12 @@ public MapObjectReader(final Map root) { @Override public void nextUnknown( final @NotNull ILogger logger, final Map unknown, final String name) { + final int stackSizeBefore = stack.size(); try { unknown.put(name, nextObjectOrNull()); } catch (Exception exception) { logger.log(SentryLevel.ERROR, exception, "Error deserializing unknown key: %s", name); + recoverValue(stackSizeBefore); } } @@ -50,14 +52,14 @@ public List nextListOrNull( try { beginArray(); List list = new ArrayList<>(); - if (hasNext()) { - do { - try { - list.add(deserializer.deserialize(this, logger)); - } catch (Exception e) { - logger.log(SentryLevel.WARNING, "Failed to deserialize object in list.", e); - } - } while (peek() == JsonToken.BEGIN_OBJECT); + while (peek() != JsonToken.END_ARRAY) { + final int stackSizeBefore = stack.size(); + try { + list.add(deserializer.deserialize(this, logger)); + } catch (Exception e) { + logger.log(SentryLevel.WARNING, "Failed to deserialize object in list.", e); + recoverValue(stackSizeBefore); + } } endArray(); return list; @@ -78,13 +80,15 @@ public Map nextMapOrNull( try { beginObject(); Map map = new HashMap<>(); - if (hasNext()) { + if (peek() == JsonToken.NAME) { do { + final String key = nextName(); + final int stackSizeBefore = stack.size(); try { - String key = nextName(); map.put(key, deserializer.deserialize(this, logger)); } catch (Exception e) { logger.log(SentryLevel.WARNING, "Failed to deserialize object in map.", e); + recoverValue(stackSizeBefore); } } while (peek() == JsonToken.BEGIN_OBJECT || peek() == JsonToken.NAME); } @@ -106,12 +110,18 @@ public Map nextMapOrNull( try { beginObject(); - if (hasNext()) { + if (peek() == JsonToken.NAME) { do { final @NotNull String key = nextName(); - final @Nullable List list = nextListOrNull(logger, deserializer); - if (list != null) { - result.put(key, list); + final int stackSizeBefore = stack.size(); + try { + final @Nullable List list = nextListOrNull(logger, deserializer); + if (list != null) { + result.put(key, list); + } + } catch (Exception e) { + logger.log(SentryLevel.WARNING, "Failed to deserialize list in map.", e); + recoverValue(stackSizeBefore); } } while (peek() == JsonToken.BEGIN_OBJECT || peek() == JsonToken.NAME); } @@ -197,12 +207,13 @@ public String nextName() throws IOException { @Override public void beginObject() throws IOException { - final Map.Entry currentEntry = stack.removeLast(); + final Map.Entry currentEntry = stack.peekLast(); if (currentEntry == null) { throw new IOException("No more entries"); } final Object value = currentEntry.getValue(); if (value instanceof Map) { + stack.removeLast(); // insert a dummy entry to indicate end of an object stack.addLast(new AbstractMap.SimpleEntry<>(null, JsonToken.END_OBJECT)); // extract map entries onto the stack @@ -223,12 +234,13 @@ public void endObject() throws IOException { @Override public void beginArray() throws IOException { - final Map.Entry currentEntry = stack.removeLast(); + final Map.Entry currentEntry = stack.peekLast(); if (currentEntry == null) { throw new IOException("No more entries"); } final Object value = currentEntry.getValue(); if (value instanceof List) { + stack.removeLast(); // insert a dummy entry to indicate end of an object stack.addLast(new AbstractMap.SimpleEntry<>(null, JsonToken.END_ARRAY)); // extract map entries onto the stack @@ -377,7 +389,17 @@ public void nextNull() throws IOException { public void setLenient(final boolean lenient) {} @Override - public void skipValue() throws IOException {} + public void skipValue() throws IOException { + if (!stack.isEmpty()) { + stack.removeLast(); + } + } + + private void recoverValue(final int stackSizeBefore) { + while (!stack.isEmpty() && stack.size() >= stackSizeBefore) { + stack.removeLast(); + } + } @SuppressWarnings("TypeParameterUnusedInFormals") @Nullable diff --git a/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt b/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt index 45c97122ee3..d4fd525a87b 100644 --- a/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt +++ b/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt @@ -2,12 +2,15 @@ package io.sentry import java.io.StringReader import kotlin.test.assertEquals +import kotlin.test.assertFailsWith import kotlin.test.assertNull import org.junit.Test import org.mockito.kotlin.any +import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never import org.mockito.kotlin.verify +import org.mockito.kotlin.verifyNoMoreInteractions class JsonObjectReaderTest { class Fixture { @@ -18,6 +21,49 @@ class JsonObjectReaderTest { val fixture = Fixture() + private val throwingValueDeserializer = + JsonDeserializer { reader, _ -> + reader.beginObject() + reader.nextName() + val value = reader.nextString() + if (value == "fail") { + throw IllegalStateException("intentional") + } + reader.endObject() + value + } + + private val postParseThrowingValueDeserializer = + JsonDeserializer { reader, _ -> + reader.beginObject() + reader.nextName() + val value = reader.nextString() + reader.endObject() + if (value == "fail") { + throw IllegalStateException("intentional") + } + value + } + + private fun getValuesReader(jsonValue: String): JsonObjectReader = + fixture.getSut("{\"values\": $jsonValue}").apply { + beginObject() + nextName() + } + + private fun assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue: String, + goodValue: String, + expectedValue: T, + deserializer: JsonDeserializer, + ) { + val actual = + getValuesReader("{\"bad\": $badValue, \"good\": $goodValue}") + .nextMapOrNull(fixture.logger, deserializer) + + assertEquals(mapOf("good" to expectedValue), actual) + } + // nextStringOrNull @Test @@ -198,6 +244,297 @@ class JsonObjectReaderTest { verify(fixture.logger, never()).log(any(), any(), any()) } + @Test + fun `nextListOrNull skips a failing element`() { + val actual = + getValuesReader("[{\"value\": \"fail\"}]") + .nextListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(emptyList(), actual) + } + + @Test + fun `nextListOrNull skips an unconsumed failing element`() { + var callCount = 0 + val deserializer = + JsonDeserializer { reader, logger -> + if (callCount++ == 0) { + throw IllegalStateException("intentional") + } + throwingValueDeserializer.deserialize(reader, logger) + } + + val actual = + getValuesReader("[{\"value\": \"ignored\"}, {\"value\": \"two\"}]") + .nextListOrNull(fixture.logger, deserializer) + + assertEquals(listOf("two"), actual) + } + + @Test + fun `nextListOrNull keeps elements before a failing element`() { + val actual = + getValuesReader("[{\"value\": \"one\"}, {\"value\": \"fail\"}]") + .nextListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(listOf("one"), actual) + } + + @Test + fun `nextListOrNull keeps elements after a failing element`() { + val actual = + getValuesReader("[{\"value\": \"fail\"}, {\"value\": \"two\"}]") + .nextListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(listOf("two"), actual) + } + + @Test + fun `nextListOrNull keeps elements after a fully consumed failing element`() { + val actual = + getValuesReader("[{\"value\": \"fail\"}, {\"value\": \"two\"}]") + .nextListOrNull(fixture.logger, postParseThrowingValueDeserializer) + + assertEquals(listOf("two"), actual) + } + + @Test + fun `nextListOrNull keeps elements after a failing object followed by a primitive`() { + val reader = + getValuesReader( + "[{\"kind\": \"fail\", \"value\": \"bad\"}, \"oops\", {\"kind\": \"ok\", \"value\": \"two\"}]" + ) + val deserializer = + JsonDeserializer { objectReader, _ -> + objectReader.beginObject() + objectReader.nextName() + if (objectReader.nextString() == "fail") { + throw IllegalStateException("intentional") + } + objectReader.nextName() + val value = objectReader.nextString() + objectReader.endObject() + value + } + + val actual = reader.nextListOrNull(fixture.logger, deserializer) + + assertEquals(listOf("two"), actual) + assertEquals(io.sentry.vendor.gson.stream.JsonToken.END_OBJECT, reader.peek()) + } + + @Test + fun `nextListOrNull keeps elements after skipValue consumes a failing element`() { + var callCount = 0 + val deserializer = + JsonDeserializer { reader, logger -> + if (callCount++ == 0) { + reader.skipValue() + throw IllegalStateException("intentional") + } + throwingValueDeserializer.deserialize(reader, logger) + } + + val actual = + getValuesReader("[{\"value\": \"ignored\"}, {\"value\": \"two\"}]") + .nextListOrNull(fixture.logger, deserializer) + + assertEquals(listOf("two"), actual) + } + + @Test + fun `nextMapOrNull skips a failing value`() { + val actual = + getValuesReader("{\"bad\": {\"value\": \"fail\"}}") + .nextMapOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOrNull recovers after failed primitive reads`() { + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "2", + expectedValue = 2, + deserializer = JsonDeserializer { reader, _ -> reader.nextInt() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "2", + expectedValue = 2L, + deserializer = JsonDeserializer { reader, _ -> reader.nextLong() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "\"two\"", + expectedValue = "two", + deserializer = JsonDeserializer { reader, _ -> reader.nextString() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "1", + goodValue = "false", + expectedValue = false, + deserializer = JsonDeserializer { reader, _ -> reader.nextBoolean() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "2.5", + expectedValue = 2.5, + deserializer = JsonDeserializer { reader, _ -> reader.nextDouble() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "null", + expectedValue = Unit, + deserializer = JsonDeserializer { reader, _ -> reader.nextNull() }, + ) + assertNextMapOrNullRecoversAfterFailedPrimitiveRead( + badValue = "true", + goodValue = "2.5", + expectedValue = 2.5f, + deserializer = JsonDeserializer { reader, _ -> reader.nextFloat() }, + ) + } + + @Test + fun `nextMapOrNull keeps values before a failing value`() { + val actual = + getValuesReader("{\"good\": {\"value\": \"one\"}, \"bad\": {\"value\": \"fail\"}}") + .nextMapOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(mapOf("good" to "one"), actual) + } + + @Test + fun `nextMapOrNull keeps values after a failing value`() { + val actual = + getValuesReader("{\"bad\": {\"value\": \"fail\"}, \"good\": {\"value\": \"two\"}}") + .nextMapOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(mapOf("good" to "two"), actual) + } + + @Test + fun `nextMapOfListOrNull skips a failing value`() { + val actual = + getValuesReader("{\"bad\": {\"value\": \"fail\"}}") + .nextMapOfListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOfListOrNull keeps values before a failing value`() { + val actual = + getValuesReader("{\"good\": [{\"value\": \"one\"}], \"bad\": {\"value\": \"fail\"}}") + .nextMapOfListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(mapOf("good" to listOf("one")), actual) + } + + @Test + fun `nextMapOfListOrNull keeps values after a failing value`() { + val actual = + getValuesReader("{\"bad\": {\"value\": \"fail\"}, \"good\": [{\"value\": \"two\"}]}") + .nextMapOfListOrNull(fixture.logger, throwingValueDeserializer) + + assertEquals(mapOf("good" to listOf("two")), actual) + } + + @Test + fun `nextMapOfListOrNull keeps nested values after skipValue consumes a failing element`() { + var callCount = 0 + val deserializer = + JsonDeserializer { reader, logger -> + if (callCount++ == 0) { + reader.skipValue() + throw IllegalStateException("intentional") + } + throwingValueDeserializer.deserialize(reader, logger) + } + + val actual = + getValuesReader("{\"good\": [{\"value\": \"ignored\"}, {\"value\": \"two\"}]}") + .nextMapOfListOrNull(fixture.logger, deserializer) + + assertEquals(mapOf("good" to listOf("two")), actual) + } + + @Test + fun `nextListOrNull logs and aborts when recovery fails`() { + assertFailsWith { + fixture + .getSut("[{\"value\": \"fail\"") + .nextListOrNull(fixture.logger, throwingValueDeserializer) + } + + verify(fixture.logger) + .log( + eq(SentryLevel.ERROR), + eq("Stream unrecoverable, aborting list deserialization."), + any(), + ) + } + + @Test + fun `nextMapOrNull logs and aborts when recovery fails`() { + assertFailsWith { + fixture + .getSut("{\"bad\": {\"value\": \"fail\"") + .nextMapOrNull(fixture.logger, throwingValueDeserializer) + } + + verify(fixture.logger) + .log( + eq(SentryLevel.ERROR), + eq("Stream unrecoverable, aborting map deserialization."), + any(), + ) + } + + @Test + fun `nextMapOfListOrNull logs and aborts when recovery fails`() { + assertFailsWith { + fixture + .getSut("{\"bad\": [{\"value\": \"fail\"") + .nextMapOfListOrNull(fixture.logger, throwingValueDeserializer) + } + + verify(fixture.logger) + .log( + eq(SentryLevel.ERROR), + eq("Stream unrecoverable, aborting map-of-lists deserialization."), + any(), + ) + } + + @Test + fun `nextUnknown logs when recovery fails`() { + val unknown = mutableMapOf() + val reader = fixture.getSut("{\"key\": {\"value\": \"fail\"") + reader.beginObject() + val name = reader.nextName() + + reader.nextUnknown(fixture.logger, unknown, name) + + assertEquals(emptyMap(), unknown) + verify(fixture.logger) + .log( + eq(SentryLevel.ERROR), + any(), + eq("Error deserializing unknown key: %s"), + eq("key"), + ) + verify(fixture.logger) + .log( + eq(SentryLevel.ERROR), + eq("Stream unrecoverable after unknown key deserialization failure."), + any(), + ) + verifyNoMoreInteractions(fixture.logger) + } + // nextDateOrNull @Test diff --git a/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt b/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt index 26991bd4937..e7ad9bc61e3 100644 --- a/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt +++ b/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt @@ -13,8 +13,8 @@ import java.util.Currency import java.util.Date import java.util.Locale import java.util.TimeZone -import kotlin.test.Test import kotlin.test.assertEquals +import org.junit.Test class MapObjectReaderTest { enum class BasicEnum { @@ -39,9 +39,37 @@ class MapObjectReaderTest { } } + private val logger = NoOpLogger.getInstance() + + private fun getValuesReader(value: Any): MapObjectReader = + MapObjectReader(linkedMapOf("values" to value)).apply { + beginObject() + nextName() + } + + private fun serializableValue(value: String): Map = linkedMapOf("test" to value) + + private fun partialSerializableValue(kind: String, value: String): Map = + linkedMapOf("test" to value, "kind" to kind) + + private val partiallyFailingDeserializer = + JsonDeserializer { reader, _ -> + val basicSerializable = BasicSerializable() + reader.beginObject() + if (reader.nextName() == "kind") { + if (reader.nextString() == "fail") { + throw IllegalStateException("intentional") + } + } + if (reader.nextName() == "test") { + basicSerializable.test = reader.nextString() + } + reader.endObject() + basicSerializable + } + @Test fun `deserializes data correctly`() { - val logger = NoOpLogger.getInstance() val data = mutableMapOf() val writer = MapObjectWriter(data) @@ -145,4 +173,179 @@ class MapObjectReaderTest { reader.nextNull() reader.endObject() } + + @Test + fun `nextListOrNull returns empty list for empty list`() { + val actual = + getValuesReader(emptyList()).nextListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyList(), actual) + } + + @Test + fun `nextListOrNull skips a failing element`() { + val actual = + getValuesReader(listOf("fail")).nextListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyList(), actual) + } + + @Test + fun `nextListOrNull keeps elements before a failing element`() { + val actual = + getValuesReader(listOf(serializableValue("one"), "fail")) + .nextListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(listOf(BasicSerializable("one")), actual) + } + + @Test + fun `nextListOrNull keeps elements after a failing element`() { + val actual = + getValuesReader(listOf("fail", serializableValue("two"))) + .nextListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(listOf(BasicSerializable("two")), actual) + } + + @Test + fun `nextListOrNull keeps elements after a failing object followed by a primitive`() { + val reader = + getValuesReader( + listOf( + partialSerializableValue("fail", "bad"), + "oops", + partialSerializableValue("ok", "two"), + ) + ) + + val actual = reader.nextListOrNull(logger, partiallyFailingDeserializer) + + assertEquals(listOf(BasicSerializable("two")), actual) + assertEquals(JsonToken.END_OBJECT, reader.peek()) + } + + @Test + fun `nextMapOrNull returns empty map for empty map`() { + val actual = + getValuesReader(linkedMapOf()) + .nextMapOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOrNull skips a failing value`() { + val actual = + getValuesReader(linkedMapOf("bad" to "fail")) + .nextMapOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOrNull keeps values before a failing value`() { + val actual = + getValuesReader(linkedMapOf("bad" to "fail", "good" to serializableValue("one"))) + .nextMapOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(mapOf("good" to BasicSerializable("one")), actual) + } + + @Test + fun `nextMapOrNull keeps values after a failing value`() { + val actual = + getValuesReader(linkedMapOf("good" to serializableValue("two"), "bad" to "fail")) + .nextMapOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(mapOf("good" to BasicSerializable("two")), actual) + } + + @Test + fun `nextMapOfListOrNull returns empty map for empty map`() { + val actual = + getValuesReader(linkedMapOf>()) + .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOfListOrNull skips a failing value`() { + val actual = + getValuesReader(linkedMapOf("bad" to serializableValue("fail"))) + .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(emptyMap(), actual) + } + + @Test + fun `nextMapOfListOrNull keeps values before a failing value`() { + val actual = + getValuesReader( + linkedMapOf( + "bad" to serializableValue("fail"), + "good" to listOf(serializableValue("one")), + ) + ) + .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(mapOf("good" to listOf(BasicSerializable("one"))), actual) + } + + @Test + fun `nextMapOfListOrNull keeps values after a failing value`() { + val actual = + getValuesReader( + linkedMapOf( + "good" to listOf(serializableValue("two")), + "bad" to serializableValue("fail"), + ) + ) + .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) + + assertEquals(mapOf("good" to listOf(BasicSerializable("two"))), actual) + } + + @Test + fun `nextListOrNull keeps elements after a partially consumed failing element`() { + val actual = + getValuesReader( + listOf(partialSerializableValue("fail", "bad"), partialSerializableValue("ok", "two")) + ) + .nextListOrNull(logger, partiallyFailingDeserializer) + + assertEquals(listOf(BasicSerializable("two")), actual) + } + + @Test + fun `nextMapOrNull keeps values before a partially consumed failing value`() { + val actual = + getValuesReader( + linkedMapOf( + "bad" to partialSerializableValue("fail", "bad"), + "good" to partialSerializableValue("ok", "two"), + ) + ) + .nextMapOrNull(logger, partiallyFailingDeserializer) + + assertEquals(mapOf("good" to BasicSerializable("two")), actual) + } + + @Test + fun `nextMapOfListOrNull keeps values before a partially consumed failing element`() { + val actual = + getValuesReader( + linkedMapOf( + "bad" to listOf(partialSerializableValue("fail", "bad")), + "good" to listOf(partialSerializableValue("ok", "two")), + ) + ) + .nextMapOfListOrNull(logger, partiallyFailingDeserializer) + + assertEquals( + mapOf("bad" to emptyList(), "good" to listOf(BasicSerializable("two"))), + actual, + ) + } } From 7bd7bbfef09b126fd4337c16ceb6d1997272452d Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 17 Apr 2026 07:40:12 +0200 Subject: [PATCH 104/391] fix changelog for unreleased SDK hang fix (#5298) --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e26f52e5dd..3600aeb640d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 8.39.0 +## Unreleased ### Fixes @@ -8,6 +8,11 @@ - Failed collection values are now skipped so parsing can continue - Skipped collection values emit `WARNING` logs - Unknown-key failures and unrecoverable recovery failures emit `ERROR` logs + +## 8.39.0 + +### Fixes + - Fix ANR caused by `GestureDetectorCompat` Handler/MessageQueue lock contention in `SentryWindowCallback` ([#5138](https://github.com/getsentry/sentry-java/pull/5138)) ### Internal From d23b4b6a69a8936675206cb4b58b4b99d04c9293 Mon Sep 17 00:00:00 2001 From: adinauer <2542832+adinauer@users.noreply.github.com> Date: Fri, 17 Apr 2026 06:07:15 +0000 Subject: [PATCH 105/391] release: 8.39.1 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3600aeb640d..af6310208c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.39.1 ### Fixes diff --git a/gradle.properties b/gradle.properties index 5266e49135d..aee4b497d0e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.39.0 +versionName=8.39.1 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 5b1a06bd53650db11a9256a03309c1af9f8d76c6 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 17 Apr 2026 15:52:35 +0200 Subject: [PATCH 106/391] docs(readme): Link Maven Central shields to artifact pages (#5307) --- README.md | 104 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 25fedc8217f..7d9ad7ba287 100644 --- a/README.md +++ b/README.md @@ -19,58 +19,58 @@ Sentry SDK for Java and Android | Packages | Maven Central | Minimum Android API Version | |-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- | -| sentry-android | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-core?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-distribution | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-distribution?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-ndk | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-ndk?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-timber | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-timber?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-fragment | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-fragment?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-navigation | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-sqlite | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-sqlite?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-android-replay | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-replay?style=for-the-badge&logo=sentry&color=green) | 26 | -| 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) | 21 | -| 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) | -| sentry-compose | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-compose?style=for-the-badge&logo=sentry&color=green) | -| 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) | -| sentry | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-jul | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jul?style=for-the-badge&logo=sentry&color=green) | -| sentry-jdbc | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jdbc?style=for-the-badge&logo=sentry&color=green) | -| sentry-apollo | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-apollo-3 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-3?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-apollo-4 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-4?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-kotlin-extensions | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-kotlin-extensions?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-ktor-client | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-ktor-client?style=for-the-badge&logo=sentry&color=green) | 21 | -| sentry-servlet | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-servlet?style=for-the-badge&logo=sentry&color=green) | | -| sentry-servlet-jakarta | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-servlet-jakarta?style=for-the-badge&logo=sentry&color=green) | | -| sentry-spring-boot | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-boot-jakarta | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-jakarta?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-boot-4 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-4?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-boot-4-starter | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-4-starter?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-boot-starter | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-starter?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-boot-starter-jakarta | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-starter-jakarta?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-jakarta | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-jakarta?style=for-the-badge&logo=sentry&color=green) | -| sentry-spring-7 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-7?style=for-the-badge&logo=sentry&color=green) | -| sentry-logback | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-logback?style=for-the-badge&logo=sentry&color=green) | -| sentry-log4j2 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-log4j2?style=for-the-badge&logo=sentry&color=green) | -| sentry-bom | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-bom?style=for-the-badge&logo=sentry&color=green) | -| sentry-graphql | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql?style=for-the-badge&logo=sentry&color=green) | -| sentry-graphql-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-core?style=for-the-badge&logo=sentry&color=green) | -| sentry-graphql-22 | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-22?style=for-the-badge&logo=sentry&color=green) | -| sentry-jcache | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jcache?style=for-the-badge&logo=sentry&color=green) | -| sentry-quartz | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-quartz?style=for-the-badge&logo=sentry&color=green) | -| sentry-openfeign | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeign?style=for-the-badge&logo=sentry&color=green) | -| sentry-openfeature | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeature?style=for-the-badge&logo=sentry&color=green) | -| sentry-launchdarkly-android | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-launchdarkly-android?style=for-the-badge&logo=sentry&color=green) | -| sentry-launchdarkly-server | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-launchdarkly-server?style=for-the-badge&logo=sentry&color=green) | -| sentry-opentelemetry-agent | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agent?style=for-the-badge&logo=sentry&color=green) | -| sentry-opentelemetry-agentcustomization | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agentcustomization?style=for-the-badge&logo=sentry&color=green) | -| sentry-opentelemetry-core | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-core?style=for-the-badge&logo=sentry&color=green) | -| sentry-opentelemetry-otlp | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp?style=for-the-badge&logo=sentry&color=green) | -| sentry-opentelemetry-otlp-spring | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp-spring?style=for-the-badge&logo=sentry&color=green) | -| sentry-okhttp | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-okhttp?style=for-the-badge&logo=sentry&color=green) | -| sentry-reactor | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-reactor?style=for-the-badge&logo=sentry&color=green) | -| sentry-spotlight | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spotlight?style=for-the-badge&logo=sentry&color=green) | +| sentry-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android) | 21 | +| sentry-android-core | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-core?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-core) | 21 | +| sentry-android-distribution | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-distribution?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-distribution) | 21 | +| sentry-android-ndk | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-ndk?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-ndk) | 21 | +| sentry-android-timber | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-timber?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-timber) | 21 | +| sentry-android-fragment | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-fragment?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-fragment) | 21 | +| sentry-android-navigation | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-navigation?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-navigation) | 21 | +| sentry-android-sqlite | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-sqlite?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-sqlite) | 21 | +| sentry-android-replay | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-android-replay?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-android-replay) | 26 | +| 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 | +| 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) | +| 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) | +| 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) | +| 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 | +| 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) | +| 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-apollo | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo) | 21 | +| sentry-apollo-3 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-3?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo-3) | 21 | +| sentry-apollo-4 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-4?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo-4) | 21 | +| sentry-kotlin-extensions | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-kotlin-extensions?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-kotlin-extensions) | 21 | +| sentry-ktor-client | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-ktor-client?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-ktor-client) | 21 | +| sentry-servlet | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-servlet?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-servlet) | | +| sentry-servlet-jakarta | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-servlet-jakarta?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-servlet-jakarta) | | +| sentry-spring-boot | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot) | +| sentry-spring-boot-jakarta | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-jakarta?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot-jakarta) | +| sentry-spring-boot-4 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-4?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot-4) | +| sentry-spring-boot-4-starter | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-4-starter?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot-4-starter) | +| sentry-spring-boot-starter | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-starter?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot-starter) | +| sentry-spring-boot-starter-jakarta | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-boot-starter-jakarta?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-boot-starter-jakarta) | +| sentry-spring | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring) | +| sentry-spring-jakarta | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-jakarta?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-jakarta) | +| sentry-spring-7 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spring-7?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spring-7) | +| sentry-logback | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-logback?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-logback) | +| sentry-log4j2 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-log4j2?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-log4j2) | +| sentry-bom | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-bom?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-bom) | +| sentry-graphql | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-graphql) | +| sentry-graphql-core | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-core?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-graphql-core) | +| sentry-graphql-22 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql-22?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-graphql-22) | +| sentry-jcache | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jcache?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-jcache) | +| sentry-quartz | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-quartz?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-quartz) | +| sentry-openfeign | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeign?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-openfeign) | +| sentry-openfeature | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeature?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-openfeature) | +| sentry-launchdarkly-android | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-launchdarkly-android?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-launchdarkly-android) | +| sentry-launchdarkly-server | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-launchdarkly-server?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-launchdarkly-server) | +| sentry-opentelemetry-agent | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agent?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-agent) | +| sentry-opentelemetry-agentcustomization | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-agentcustomization?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-agentcustomization) | +| sentry-opentelemetry-core | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-core?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-core) | +| sentry-opentelemetry-otlp | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-otlp) | +| sentry-opentelemetry-otlp-spring | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-opentelemetry-otlp-spring?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-otlp-spring) | +| sentry-okhttp | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-okhttp?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-okhttp) | +| sentry-reactor | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-reactor?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-reactor) | +| sentry-spotlight | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-spotlight?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-spotlight) | # Releases From a5924eba1f6f39ff37c32f00bb8d590474f2131b Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Mon, 20 Apr 2026 15:03:07 +0200 Subject: [PATCH 107/391] fix(ci): Remove flaky Android 14 configuration from CI workflow (#5295) The Android 14 emulator seems to often silently drop the notification, causing the tests to fail. Let's remove it for now. --- .github/workflows/integration-tests-ui-critical.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 46b9665a099..62d7d83466b 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -67,10 +67,6 @@ jobs: target: google_apis channel: canary # Necessary for ATDs arch: x86_64 - - api-level: 34 # Android 14 - target: google_apis - channel: canary # Necessary for ATDs - arch: x86_64 - api-level: 35 # Android 15 target: google_apis channel: canary # Necessary for ATDs From 7392db311a82adae5b3157f3b50971d095fa0b7d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 15:39:37 +0200 Subject: [PATCH 108/391] chore(deps): update Native SDK to v0.13.7 (#5296) Co-authored-by: GitHub --- CHANGELOG.md | 8 ++++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af6310208c6..ad76dd5388b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +### Dependencies + +- Bump Native SDK from v0.13.6 to v0.13.7 ([#5296](https://github.com/getsentry/sentry-java/pull/5296)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0137) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.6...0.13.7) + ## 8.39.1 ### Fixes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d02e3249df7..3c62935b805 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.6" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.7" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 6a9020cf1d070f39554fc2e07588475a359c8599 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:29:14 +0200 Subject: [PATCH 109/391] build(deps): bump github/codeql-action from 4.35.1 to 4.35.2 (#5308) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.1 to 4.35.2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/c10b8064de6f491fea524254123dbe5e09572f13...95e58e9a2cdfd71adc6e0353d5c52f41a045d225) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.35.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6b30f064c49..acb0483b5ba 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # pin@v2 + uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # pin@v2 + uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # pin@v2 From 2dffe01728e47c0641dc7baec1f01a286402ded6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:29:50 +0200 Subject: [PATCH 110/391] build(deps): bump getsentry/craft from 2.25.2 to 2.25.4 (#5309) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.25.2 to 2.25.4. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/ba01e596c4a4c07692f0de10b0d4fe05f3dd0292...97d0c4286f32a80d09c8b89366d762fecc3e27b6) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.25.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2b9eaf45a2..177e8810a1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@ba01e596c4a4c07692f0de10b0d4fe05f3dd0292 # v2 + uses: getsentry/craft@97d0c4286f32a80d09c8b89366d762fecc3e27b6 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From e442d80a400ece84ad14b192665327e2381ebd78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:30:41 +0200 Subject: [PATCH 111/391] build(deps): bump actions/cache from 5.0.4 to 5.0.5 (#5310) Bumps [actions/cache](https://github.com/actions/cache) from 5.0.4 to 5.0.5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/668228422ae6a00e4ad889ee87cd7109ec5666a7...27d5ce7f107fe9357f9df03efb73ab90386fccae) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 2 +- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index d288bbef8ae..33ba8ae93e8 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -50,7 +50,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 id: avd-cache with: path: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5debd3ad5a2..089913c9727 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index dee3ddb6652..b5457751809 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -92,7 +92,7 @@ jobs: with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 id: app-plain-cache with: path: sentry-android-integration-tests/test-app-plain/build/outputs/apk/release/test-app-plain-release.apk diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 615d447cbf2..1fd6c5c2c09 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -30,7 +30,7 @@ jobs: # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 62d7d83466b..4d6c952a161 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -86,7 +86,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 id: avd-cache with: path: | diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 9ac07b7b3ee..dfe742087d6 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -50,7 +50,7 @@ jobs: # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 963b6976cc2..577f0144179 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -50,7 +50,7 @@ jobs: # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 97fd6476fed..5246cf90cdd 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -50,7 +50,7 @@ jobs: # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} From 35c8ffa9a70c59ca23c155ef416e3de6e05cf65c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:31:30 +0200 Subject: [PATCH 112/391] build(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.2 to 2.25.4 (#5311) Bumps [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) from 2.25.2 to 2.25.4. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/ba01e596c4a4c07692f0de10b0d4fe05f3dd0292...97d0c4286f32a80d09c8b89366d762fecc3e27b6) --- updated-dependencies: - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.25.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changelog-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index f22a34cba7c..d8ea91d129a 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@ba01e596c4a4c07692f0de10b0d4fe05f3dd0292 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@97d0c4286f32a80d09c8b89366d762fecc3e27b6 # v2 secrets: inherit From 16a07c40ba6ffca0e7df663453beec20661e5142 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 20 Apr 2026 18:35:38 +0200 Subject: [PATCH 113/391] fix(compose): `NoSuchMethodError` for `LayoutCoordinates.localBoundingBoxOf$default` on Compose touch dispatch with AGP 8.13 and `minSdk < 24` (#5302) * fix(compose): pass clipBounds explicitly to avoid D8 desugaring mismatch * changelog --- CHANGELOG.md | 4 ++++ .../src/main/java/io/sentry/android/replay/util/Nodes.kt | 4 +++- .../kotlin/io/sentry/compose/SentryComposeHelper.kt | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad76dd5388b..5a7e290e1fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Fix `NoSuchMethodError` for `LayoutCoordinates.localBoundingBoxOf$default` on Compose touch dispatch with AGP 8.13 and `minSdk < 24` ([#5302](https://github.com/getsentry/sentry-java/pull/5302)) + ### Dependencies - Bump Native SDK from v0.13.6 to v0.13.7 ([#5296](https://github.com/getsentry/sentry-java/pull/5296)) diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt index cd9e3dd208a..2882b2113b8 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt @@ -167,7 +167,9 @@ internal fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates val rootWidth = root.size.width.toFloat() val rootHeight = root.size.height.toFloat() - val bounds = root.localBoundingBoxOf(this) + // pass clipBounds explicitly to avoid the `localBoundingBoxOf$default` bridge that AGP 8.13's D8 + // desugars inconsistently on minSdk < 24 + val bounds = root.localBoundingBoxOf(this, true) val boundsLeft = bounds.left.fastCoerceIn(0f, rootWidth) val boundsTop = bounds.top.fastCoerceIn(0f, rootHeight) val boundsRight = bounds.right.fastCoerceIn(0f, rootWidth) diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryComposeHelper.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryComposeHelper.kt index 1f93f758756..10d02103ba1 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryComposeHelper.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryComposeHelper.kt @@ -86,7 +86,9 @@ public fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates?) val rootWidth = root.size.width.toFloat() val rootHeight = root.size.height.toFloat() - val bounds = root.localBoundingBoxOf(this) + // pass clipBounds explicitly to avoid the `localBoundingBoxOf$default` bridge that AGP 8.13's D8 + // desugars inconsistently on minSdk < 24 + val bounds = root.localBoundingBoxOf(this, true) val boundsLeft = bounds.left.fastCoerceIn(0f, rootWidth) val boundsTop = bounds.top.fastCoerceIn(0f, rootHeight) val boundsRight = bounds.right.fastCoerceIn(0f, rootWidth) From 0220a5c65e646d44283a513e5a3bdc60d7d79d87 Mon Sep 17 00:00:00 2001 From: "fix-it-felix-sentry[bot]" <260785270+fix-it-felix-sentry[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 20:01:30 +0200 Subject: [PATCH 114/391] fix(security): Add integrity verification before chmod +x in btrace-perfetto skill (#5297) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(security): Add integrity verification before chmod +x in btrace-perfetto skill Add validation to verify downloaded trace_processor file is a valid executable before making it executable. This prevents potential execution of malicious or corrupted downloads. Changes: - Verify file exists and has non-zero size - Check file type to confirm it's an executable - Remove file and exit with error if validation fails - Only chmod +x after successful verification Fixes: https://linear.app/getsentry/issue/EME-1060 Parent ticket: https://linear.app/getsentry/issue/VULN-1513 Co-Authored-By: Claude Sonnet 4.5 * fix(security): Verify magic bytes instead of file(1) for trace_processor The previous check ran `file /tmp/trace_processor | grep -q executable` after downloading the Perfetto trace_processor wrapper. That is unreliable in both directions: - get.perfetto.dev currently serves a Python wrapper script (#!/usr/bin/env python3). Depending on the file(1) version and magic database, shebang scripts may be reported as "Python script, ASCII text" without the word "executable", failing the check. - If Perfetto ever switches to native PIE ELF binaries, older file(1) versions (< 5.36) report them as "shared object" without "executable", also failing. In both cases the valid download was deleted and the workflow aborted. Check magic bytes directly instead — shebang (#!), ELF, or Mach-O — which is stable across platforms and file(1) versions. Also add `curl --fail` so HTTP errors do not leave a partial/HTML response on disk that would then be validated. Refs LINEAR-EME-1060 Co-Authored-By: Claude Opus 4.7 (1M context) --------- Co-authored-by: fix-it-felix-sentry[bot] <260785270+fix-it-felix-sentry[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 Co-authored-by: Roman Zavarnitsyn --- .claude/skills/btrace-perfetto/SKILL.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.claude/skills/btrace-perfetto/SKILL.md b/.claude/skills/btrace-perfetto/SKILL.md index 7cbea4841ee..8d9e5a6bca1 100644 --- a/.claude/skills/btrace-perfetto/SKILL.md +++ b/.claude/skills/btrace-perfetto/SKILL.md @@ -22,7 +22,26 @@ Before starting, verify: ``` 3. **Perfetto trace_processor**: Check if `/tmp/trace_processor` exists. If not, download it: ```bash - curl -sL "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor && chmod +x /tmp/trace_processor + # Download trace_processor (--fail ensures HTTP errors don't leave a file behind) + curl -sSL --fail "https://get.perfetto.dev/trace_processor" -o /tmp/trace_processor + + # Verify magic bytes directly — file(1) output is too inconsistent across + # versions/platforms to rely on for scripts or PIE binaries. + magic=$(head -c 4 /tmp/trace_processor 2>/dev/null | od -An -vtx1 -N4 | tr -d ' \n') + case "$magic" in + 2321*) ;; # #! shebang (script) + 7f454c46) ;; # ELF (Linux) + cffaedfe|cefaedfe|feedfacf|feedface) ;; # Mach-O (macOS) + cafebabe) ;; # Mach-O universal + *) + echo "Error: Downloaded file is not a valid script or executable (magic: ${magic:-empty})" + rm -f /tmp/trace_processor + exit 1 + ;; + esac + + # Make executable only after verification + chmod +x /tmp/trace_processor ``` 4. **Device ABI**: Run `adb shell getprop ro.product.cpu.abi` — btrace only supports arm64-v8a and armeabi-v7a (no x86/x86_64) From 40234a987c6bad214db8d58a919ea25404dc4c19 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Wed, 22 Apr 2026 12:18:28 +0200 Subject: [PATCH 115/391] fix(sentry-okhttp): Skip synthetic 504 for FORCE_CACHE cache misses (#5299) * fix(sentry-okhttp): Skip synthetic 504 for FORCE_CACHE cache misses OkHttp's CacheInterceptor synthesizes a 504 "Unsatisfiable Request" response when a request with `only-if-cached` (e.g. CacheControl.FORCE_CACHE) misses the cache. This is not a real server error, so don't capture it as a failed request event. Co-Authored-By: Claude Opus 4.6 (1M context) * fix: Update changelog PR link to #5299 Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + .../sentry/okhttp/SentryOkHttpInterceptor.kt | 9 +++++++ .../okhttp/SentryOkHttpInterceptorTest.kt | 25 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a7e290e1fe..13f27480154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - Fix `NoSuchMethodError` for `LayoutCoordinates.localBoundingBoxOf$default` on Compose touch dispatch with AGP 8.13 and `minSdk < 24` ([#5302](https://github.com/getsentry/sentry-java/pull/5302)) +- Fix reporting OkHttp's synthetic 504 "Unsatisfiable Request" responses as errors for `CacheControl.FORCE_CACHE` cache misses ([#5299](https://github.com/getsentry/sentry-java/pull/5299)) ### Dependencies diff --git a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt index 6e20ecbcdb8..ea8fdb44159 100644 --- a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt +++ b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt @@ -58,6 +58,8 @@ public open class SentryOkHttpInterceptor( private val failedRequestTargets: List = listOf(DEFAULT_PROPAGATION_TARGETS), ) : Interceptor { private companion object { + private const val HTTP_GATEWAY_TIMEOUT = 504 + init { SentryIntegrationPackageStorage.getInstance() .addPackage("maven:io.sentry:sentry-okhttp", BuildConfig.VERSION_NAME) @@ -386,6 +388,13 @@ public open class SentryOkHttpInterceptor( return false } + // A 504 on an only-if-cached (e.g. CacheControl.FORCE_CACHE) request is a synthetic + // cache-miss response generated by OkHttp's CacheInterceptor, not a real server error, + // so don't report it. See https://square.github.io/okhttp/recipes/#response-caching-kt-java + if (response.code == HTTP_GATEWAY_TIMEOUT && request.cacheControl.onlyIfCached) { + return false + } + return true } diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt index 6e8b8548731..9f7d8bc18fb 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt @@ -31,6 +31,7 @@ import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue import kotlin.test.fail +import okhttp3.CacheControl import okhttp3.EventListener import okhttp3.Interceptor import okhttp3.MediaType.Companion.toMediaType @@ -541,6 +542,30 @@ class SentryOkHttpInterceptorTest { ) } + @Test + fun `does not capture a synthetic 504 from OkHttp for a FORCE_CACHE cache miss`() { + // No cache is configured on the client, so FORCE_CACHE is guaranteed to miss and + // OkHttp's CacheInterceptor will synthesize a 504 "Unsatisfiable Request" response. + val sut = fixture.getSut(captureFailedRequests = true) + val request = + Request.Builder() + .url(fixture.server.url("/hello")) + .cacheControl(CacheControl.FORCE_CACHE) + .build() + val response = sut.newCall(request).execute() + + assertEquals(504, response.code) + verify(fixture.scopes, never()).captureEvent(any(), any()) + } + + @Test + fun `captures a real 504 when onlyIfCached is not set`() { + val sut = fixture.getSut(captureFailedRequests = true, httpStatusCode = 504) + sut.newCall(getRequest()).execute() + + verify(fixture.scopes).captureEvent(any(), any()) + } + @SuppressWarnings("SwallowedException") @Test fun `does not capture an error even if it throws`() { From 952b180c6fffa6995fddbb3b638f0074d60a9500 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 22 Apr 2026 15:22:22 +0200 Subject: [PATCH 116/391] fix(gestures): Prevent duplicate ui.click breadcrumbs from buried window callbacks (#5300) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(user-interaction): Restore window callbacks on close and dedup instrumentation via WeakHashMap Track wrapped windows in a thread-safe WeakHashMap so close() can restore each window's original callback chain, preventing an orphaned SentryWindowCallback from persisting after Sentry.close(). Also handle the case where another wrapper (e.g. Session Replay) has been installed on top of ours — we skip chain mutation but still invoke stopTracking() to release resources. Guards against racing lifecycle callbacks (main thread) and close() (possibly bg thread). Co-Authored-By: Claude Opus 4.7 (1M context) * fix(replay): Track wrapped windows and inert buried recorders on stop Track wrapped windows in a WeakHashMap so GestureRecorder skips re-wrapping already-instrumented windows and can locate its own recorder even when another wrapper (e.g. UserInteractionIntegration) has been installed on top of it. When our wrapper is buried in the callback chain, inert() it instead of mutating the chain so unrelated instrumentation isn't broken; the next replay session wraps on top with a fresh active recorder. Co-Authored-By: Claude Opus 4.7 (1M context) * changelog * fix(user-interaction): Inert buried SentryWindowCallback and drop its cache entry on stop Two follow-ups to the buried-wrapper path: - stopTracking() now sets an inert flag that short-circuits handleTouchEvent, so a SentryWindowCallback that can't be cut out of the chain stops forwarding events to its gesture detector and listener. Without this, the "stopped" wrapper kept emitting ui.click breadcrumbs, so as soon as a fresh wrapper was installed on top the duplicates came back. - unwrapWindow removes the wrapped window from the tracking map in the buried path too. Previously only the top-of-chain path cleared it, which meant the next startTracking() found a stale (but alive, since the inert wrapper is still referenced by the chain) entry and returned early, permanently losing gesture tracking for that window. Co-Authored-By: Claude Opus 4.7 (1M context) --------- Co-authored-by: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 1 + .../core/UserInteractionIntegration.java | 67 +++++++++++++++++-- .../gestures/SentryWindowCallback.java | 8 +++ .../core/UserInteractionIntegrationTest.kt | 64 ++++++++++++++++-- .../gestures/SentryWindowCallbackTest.kt | 14 ++++ .../replay/gestures/GestureRecorder.kt | 43 ++++++++++-- .../replay/gestures/GestureRecorderTest.kt | 44 ++++++++++-- 7 files changed, 217 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f27480154..f71dedaba95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ ### Fixes - Fix ANR caused by `GestureDetectorCompat` Handler/MessageQueue lock contention in `SentryWindowCallback` ([#5138](https://github.com/getsentry/sentry-java/pull/5138)) +- Fix duplicate `ui.click` breadcrumbs when another `Window.Callback` wraps `SentryWindowCallback` ([#5300](https://github.com/getsentry/sentry-java/pull/5300)) ### Internal diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java index c0dd3f9eb71..0d77625c718 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/UserInteractionIntegration.java @@ -18,6 +18,9 @@ import io.sentry.util.Objects; import java.io.Closeable; import java.io.IOException; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.WeakHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,6 +33,16 @@ public final class UserInteractionIntegration private final boolean isAndroidxLifecycleAvailable; + // WeakReference value, because the callback chain strongly references the wrapper — a strong + // value would prevent the window from ever being GC'd. + // + // All access must be guarded by wrappedWindowsLock — lifecycle callbacks fire on the main + // thread, but close() may be called from a background thread (e.g. Sentry.close()). + private final @NotNull WeakHashMap> wrappedWindows = + new WeakHashMap<>(); + + private final @NotNull Object wrappedWindowsLock = new Object(); + public UserInteractionIntegration( final @NotNull Application application, final @NotNull io.sentry.util.LoadClass classLoader) { this.application = Objects.requireNonNull(application, "Application is required"); @@ -47,19 +60,26 @@ private void startTracking(final @NotNull Activity activity) { } if (scopes != null && options != null) { + synchronized (wrappedWindowsLock) { + final @Nullable WeakReference cached = wrappedWindows.get(window); + if (cached != null && cached.get() != null) { + return; + } + } + Window.Callback delegate = window.getCallback(); if (delegate == null) { delegate = new NoOpWindowCallback(); } - if (delegate instanceof SentryWindowCallback) { - // already instrumented - return; - } - final SentryGestureListener gestureListener = new SentryGestureListener(activity, scopes, options); - window.setCallback(new SentryWindowCallback(delegate, activity, gestureListener, options)); + final SentryWindowCallback wrapper = + new SentryWindowCallback(delegate, activity, gestureListener, options); + window.setCallback(wrapper); + synchronized (wrappedWindowsLock) { + wrappedWindows.put(window, new WeakReference<>(wrapper)); + } } } @@ -71,7 +91,10 @@ private void stopTracking(final @NotNull Activity activity) { } return; } + unwrapWindow(window); + } + private void unwrapWindow(final @NotNull Window window) { final Window.Callback current = window.getCallback(); if (current instanceof SentryWindowCallback) { ((SentryWindowCallback) current).stopTracking(); @@ -80,6 +103,23 @@ private void stopTracking(final @NotNull Activity activity) { } else { window.setCallback(((SentryWindowCallback) current).getDelegate()); } + synchronized (wrappedWindowsLock) { + wrappedWindows.remove(window); + } + return; + } + + // Another wrapper (e.g. Session Replay) sits on top of ours — cutting it out of the chain + // would break its instrumentation, so we leave the chain alone and just call stopTracking() + // to release our resources. The upstream wrapper holds a reference to ours, so it'll be + // GC'd whenever that upstream holder is (typically when the window is destroyed). + final @Nullable SentryWindowCallback ours; + synchronized (wrappedWindowsLock) { + final @Nullable WeakReference cached = wrappedWindows.remove(window); + ours = cached != null ? cached.get() : null; + } + if (ours != null) { + ours.stopTracking(); } } @@ -146,6 +186,21 @@ public void register(@NotNull IScopes scopes, @NotNull SentryOptions options) { public void close() throws IOException { application.unregisterActivityLifecycleCallbacks(this); + // Restore original callbacks so a subsequent Sentry.init() starts from a clean chain instead + // of wrapping on top of our orphaned callback. + final ArrayList snapshot; + synchronized (wrappedWindowsLock) { + snapshot = new ArrayList<>(wrappedWindows.keySet()); + } + for (final Window window : snapshot) { + if (window != null) { + unwrapWindow(window); + } + } + synchronized (wrappedWindowsLock) { + wrappedWindows.clear(); + } + if (options != null) { options.getLogger().log(SentryLevel.DEBUG, "UserInteractionIntegration removed."); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java index 557cd4e7a29..e69756e506a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java @@ -19,6 +19,10 @@ public final class SentryWindowCallback extends WindowCallbackAdapter { private final @Nullable SentryOptions options; private final @NotNull MotionEventObtainer motionEventObtainer; + // When we can't be removed from the callback chain (see UserInteractionIntegration), + // stopTracking() flips this so handleTouchEvent short-circuits. + private volatile boolean inert; + public SentryWindowCallback( final @NotNull Window.Callback delegate, final @NotNull Context context, @@ -64,6 +68,9 @@ public boolean dispatchTouchEvent(final @Nullable MotionEvent motionEvent) { } private void handleTouchEvent(final @NotNull MotionEvent motionEvent) { + if (inert) { + return; + } gestureDetector.onTouchEvent(motionEvent); int action = motionEvent.getActionMasked(); if (action == MotionEvent.ACTION_UP) { @@ -72,6 +79,7 @@ private void handleTouchEvent(final @NotNull MotionEvent motionEvent) { } public void stopTracking() { + inert = true; gestureListener.stopTracing(SpanStatus.CANCELLED); gestureDetector.release(); } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt index f558841e6f5..8f20dbb1539 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/UserInteractionIntegrationTest.kt @@ -14,7 +14,7 @@ import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertIs import kotlin.test.assertIsNot -import kotlin.test.assertNotEquals +import kotlin.test.assertNotSame import kotlin.test.assertSame import org.junit.runner.RunWith import org.mockito.kotlin.any @@ -149,15 +149,63 @@ class UserInteractionIntegrationTest { } @Test - fun `does not instrument if the callback is already ours`() { - val existingCallback = - SentryWindowCallback(NoOpWindowCallback(), fixture.activity, mock(), mock()) - val sut = fixture.getSut(existingCallback) + fun `resume after buried pause installs a fresh wrapper on top`() { + val sut = fixture.getSut() + sut.register(fixture.scopes, fixture.options) + + sut.onActivityResumed(fixture.activity) + val originalSentryCallback = fixture.window.callback + assertIs(originalSentryCallback) + + // Third-party wraps on top of us mid-activity. + val outerWrapper = WrapperCallback(originalSentryCallback) + fixture.window.callback = outerWrapper + + sut.onActivityPaused(fixture.activity) + sut.onActivityResumed(fixture.activity) + + val newTop = fixture.window.callback + assertIs(newTop) + assertNotSame(originalSentryCallback, newTop) + assertSame(outerWrapper, newTop.delegate) + } + + @Test + fun `close unwraps windows so re-init does not double-wrap`() { + val mockCallback = mock() + fixture.window.callback = mockCallback + val sutA = fixture.getSut() + sutA.register(fixture.scopes, fixture.options) + sutA.onActivityResumed(fixture.activity) + assertIs(fixture.window.callback) + + sutA.close() + assertSame(mockCallback, fixture.window.callback) + + val sutB = UserInteractionIntegration(fixture.application, fixture.loadClass) + sutB.register(fixture.scopes, fixture.options) + sutB.onActivityResumed(fixture.activity) + + val newWrapper = fixture.window.callback + assertIs(newWrapper) + assertSame(mockCallback, newWrapper.delegate) + } + + @Test + fun `paused with another wrapper on top does not cut it out of the chain`() { + val sut = fixture.getSut() sut.register(fixture.scopes, fixture.options) + sut.onActivityResumed(fixture.activity) + val sentryCallback = fixture.window.callback as SentryWindowCallback + + val outerWrapper = WrapperCallback(sentryCallback) + fixture.window.callback = outerWrapper - assertNotEquals(existingCallback, (fixture.window.callback as SentryWindowCallback).delegate) + sut.onActivityPaused(fixture.activity) + + assertSame(outerWrapper, fixture.window.callback) } @Test @@ -205,3 +253,7 @@ class UserInteractionIntegrationTest { private class EmptyActivity : Activity(), LifecycleOwner { override val lifecycle: Lifecycle = mock() } + +/** Simulates a third-party callback wrapper (e.g. Session Replay's FixedWindowCallback). */ +private open class WrapperCallback(@JvmField val delegate: Window.Callback) : + Window.Callback by delegate diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt index 8afc1b39304..be0438d9345 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryWindowCallbackTest.kt @@ -82,4 +82,18 @@ class SentryWindowCallbackTest { verify(fixture.gestureDetector, never()).onTouchEvent(any()) } + + @Test + fun `after stopTracking does not forward touches to detector or listener`() { + val event = mock { whenever(it.actionMasked).thenReturn(MotionEvent.ACTION_UP) } + val sut = fixture.getSut() + + sut.stopTracking() + sut.dispatchTouchEvent(event) + + verify(fixture.gestureDetector, never()).onTouchEvent(any()) + verify(fixture.gestureListener, never()).onUp(any()) + // super.dispatchTouchEvent still delegates to the wrapped delegate so the chain keeps working. + verify(fixture.delegate).dispatchTouchEvent(event) + } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/GestureRecorder.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/GestureRecorder.kt index 945a0be5156..cee75fb06c0 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/GestureRecorder.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/GestureRecorder.kt @@ -11,6 +11,7 @@ import io.sentry.android.replay.phoneWindow import io.sentry.android.replay.util.FixedWindowCallback import io.sentry.util.AutoClosableReentrantLock import java.lang.ref.WeakReference +import java.util.WeakHashMap internal class GestureRecorder( private val options: SentryOptions, @@ -19,6 +20,11 @@ internal class GestureRecorder( private val rootViews = ArrayList>() private val rootViewsLock = AutoClosableReentrantLock() + // WeakReference value, because the callback chain strongly references the wrapper — a strong + // value would prevent the window from ever being GC'd. + private val wrappedWindows = WeakHashMap>() + private val wrappedWindowsLock = AutoClosableReentrantLock() + override fun onRootViewsChanged(root: View, added: Boolean) { rootViewsLock.acquire().use { if (added) { @@ -45,10 +51,16 @@ internal class GestureRecorder( return } - val delegate = window.callback - if (delegate !is SentryReplayGestureRecorder) { - window.callback = SentryReplayGestureRecorder(options, touchRecorderCallback, delegate) + wrappedWindowsLock.acquire().use { + if (wrappedWindows[window]?.get() != null) { + return + } } + + val delegate = window.callback + val wrapper = SentryReplayGestureRecorder(options, touchRecorderCallback, delegate) + window.callback = wrapper + wrappedWindowsLock.acquire().use { wrappedWindows[window] = WeakReference(wrapper) } } private fun View.stopGestureTracking() { @@ -60,14 +72,25 @@ internal class GestureRecorder( val callback = window.callback if (callback is SentryReplayGestureRecorder) { - val delegate = callback.delegate - window.callback = delegate + window.callback = callback.delegate + wrappedWindowsLock.acquire().use { wrappedWindows.remove(window) } + return + } + + // Another wrapper (e.g. UserInteractionIntegration) sits on top of ours — cutting it out of + // the chain would break its instrumentation, so we inert our buried wrapper instead. The + // next replay session will then wrap on top with a fresh active instance. + val ours: SentryReplayGestureRecorder? + wrappedWindowsLock.acquire().use { + ours = wrappedWindows[window]?.get() + wrappedWindows.remove(window) } + ours?.inert() } internal class SentryReplayGestureRecorder( private val options: SentryOptions, - private val touchRecorderCallback: TouchRecorderCallback?, + @Volatile private var touchRecorderCallback: TouchRecorderCallback?, delegate: Window.Callback?, ) : FixedWindowCallback(delegate) { override fun dispatchTouchEvent(event: MotionEvent?): Boolean { @@ -83,6 +106,14 @@ internal class GestureRecorder( } return super.dispatchTouchEvent(event) } + + /** + * Turns this wrapper into a passthrough when it can't be removed from the chain (another + * wrapper sits on top). Subsequent dispatches only delegate, skipping the recorder callback. + */ + fun inert() { + touchRecorderCallback = null + } } } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt index bf3f9cb8443..6f5a02b54c7 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt @@ -5,6 +5,7 @@ import android.app.Activity import android.os.Bundle import android.view.MotionEvent import android.view.View +import android.view.Window import android.widget.LinearLayout import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.SentryOptions @@ -14,6 +15,7 @@ import io.sentry.android.replay.phoneWindow import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertSame import kotlin.test.assertTrue import org.junit.runner.RunWith import org.robolectric.Robolectric @@ -37,17 +39,44 @@ class GestureRecorderTest { } @Test - fun `when new window added and window callback is already wrapped, does not wrap it again`() { + fun `does not double-wrap when root is added twice and another callback wraps on top`() { val activity = Robolectric.buildActivity(TestActivity::class.java).setup().get() val gestureRecorder = fixture.getSut() - activity.root.phoneWindow?.callback = SentryReplayGestureRecorder(fixture.options, null, null) gestureRecorder.onRootViewsChanged(activity.root, true) + val ourWrapper = activity.root.phoneWindow?.callback as SentryReplayGestureRecorder - assertFalse( - (activity.root.phoneWindow?.callback as SentryReplayGestureRecorder).delegate - is SentryReplayGestureRecorder - ) + val outer = WrapperCallback(ourWrapper) + activity.root.phoneWindow?.callback = outer + + gestureRecorder.onRootViewsChanged(activity.root, true) + + assertSame(outer, activity.root.phoneWindow?.callback) + } + + @Test + fun `when stopped with another wrapper on top, inerts the buried recorder`() { + var called = false + val activity = Robolectric.buildActivity(TestActivity::class.java).setup().get() + val gestureRecorder = + fixture.getSut( + touchRecorderCallback = + object : TouchRecorderCallback { + override fun onTouchEvent(event: MotionEvent) { + called = true + } + } + ) + + gestureRecorder.onRootViewsChanged(activity.root, true) + val ourWrapper = activity.root.phoneWindow?.callback as SentryReplayGestureRecorder + activity.root.phoneWindow?.callback = WrapperCallback(ourWrapper) + + gestureRecorder.onRootViewsChanged(activity.root, false) + + val motionEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, 0f, 0f, 0) + ourWrapper.dispatchTouchEvent(motionEvent) + assertFalse(called) } @Test @@ -109,6 +138,9 @@ class GestureRecorderTest { } } +private open class WrapperCallback(@JvmField val delegate: Window.Callback) : + Window.Callback by delegate + private class TestActivity : Activity() { lateinit var root: View From 2fcda643c58bb758682531d41331b5d6f18ba610 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 22 Apr 2026 16:14:16 +0200 Subject: [PATCH 117/391] fix(gestures): Thread-safe SentryGestureDetector with per-gesture VelocityTracker recycle (#5301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(gestures): Recycle VelocityTracker per gesture and guard state with a lock Recycle VelocityTracker on every ACTION_UP/ACTION_CANCEL instead of only when the detector is torn down, so the pooled native tracker isn't held across gestures (matches Android's framework GestureDetector behavior). Merges endGesture() and release() into a single recycle() method. Guard onTouchEvent and recycle with an AutoClosableReentrantLock — SentryWindowCallback.stopTracking() can be invoked from a bg thread via Sentry.close(), which would otherwise race with the UI thread's touch dispatch and cause use-after-recycle on the native MotionEvent/VelocityTracker pools. recycle() captures the native handles under the lock and performs the JNI recycle() calls outside it to keep the bg thread's critical section to a pointer swap. Co-Authored-By: Claude Opus 4.7 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 3 +- .../gestures/SentryGestureDetector.java | 173 +++++++++--------- .../gestures/SentryWindowCallback.java | 2 +- .../gestures/SentryGestureDetectorTest.kt | 28 +++ 4 files changed, 119 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f71dedaba95..9ae294f72e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Fix `NoSuchMethodError` for `LayoutCoordinates.localBoundingBoxOf$default` on Compose touch dispatch with AGP 8.13 and `minSdk < 24` ([#5302](https://github.com/getsentry/sentry-java/pull/5302)) - Fix reporting OkHttp's synthetic 504 "Unsatisfiable Request" responses as errors for `CacheControl.FORCE_CACHE` cache misses ([#5299](https://github.com/getsentry/sentry-java/pull/5299)) +- Make `SentryGestureDetector` thread-safe and recycle `VelocityTracker` per gesture ([#5301](https://github.com/getsentry/sentry-java/pull/5301)) +- Fix duplicate `ui.click` breadcrumbs when another `Window.Callback` wraps `SentryWindowCallback` ([#5300](https://github.com/getsentry/sentry-java/pull/5300)) ### Dependencies @@ -27,7 +29,6 @@ ### Fixes - Fix ANR caused by `GestureDetectorCompat` Handler/MessageQueue lock contention in `SentryWindowCallback` ([#5138](https://github.com/getsentry/sentry-java/pull/5138)) -- Fix duplicate `ui.click` breadcrumbs when another `Window.Callback` wraps `SentryWindowCallback` ([#5300](https://github.com/getsentry/sentry-java/pull/5300)) ### Internal diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java index 3196ae0189e..002938e9d60 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureDetector.java @@ -5,6 +5,8 @@ import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; +import io.sentry.ISentryLifecycleToken; +import io.sentry.util.AutoClosableReentrantLock; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,6 +37,8 @@ public final class SentryGestureDetector { private @Nullable MotionEvent currentDownEvent; private @Nullable VelocityTracker velocityTracker; + private final @NotNull AutoClosableReentrantLock lock = new AutoClosableReentrantLock(); + SentryGestureDetector( final @NotNull Context context, final @NotNull GestureDetector.OnGestureListener listener) { this.listener = listener; @@ -46,102 +50,101 @@ public final class SentryGestureDetector { } void onTouchEvent(final @NotNull MotionEvent event) { - final int action = event.getActionMasked(); + try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { + final int action = event.getActionMasked(); + + if (velocityTracker == null) { + velocityTracker = VelocityTracker.obtain(); + } + velocityTracker.addMovement(event); + + switch (action) { + case MotionEvent.ACTION_DOWN: + downX = event.getX(); + downY = event.getY(); + lastX = downX; + lastY = downY; + isInTapRegion = true; + ignoreUpEvent = false; + + if (currentDownEvent != null) { + currentDownEvent.recycle(); + } + currentDownEvent = MotionEvent.obtain(event); - if (velocityTracker == null) { - velocityTracker = VelocityTracker.obtain(); - } + listener.onDown(event); + break; - if (action == MotionEvent.ACTION_DOWN) { - velocityTracker.clear(); - } - velocityTracker.addMovement(event); - - switch (action) { - case MotionEvent.ACTION_DOWN: - downX = event.getX(); - downY = event.getY(); - lastX = downX; - lastY = downY; - isInTapRegion = true; - ignoreUpEvent = false; - - if (currentDownEvent != null) { - currentDownEvent.recycle(); - } - currentDownEvent = MotionEvent.obtain(event); - - listener.onDown(event); - break; - - case MotionEvent.ACTION_MOVE: - { - final float x = event.getX(); - final float y = event.getY(); - final float dx = x - downX; - final float dy = y - downY; - final float distanceSquare = (dx * dx) + (dy * dy); - - if (distanceSquare > touchSlopSquare) { - final float scrollX = lastX - x; - final float scrollY = lastY - y; - listener.onScroll(currentDownEvent, event, scrollX, scrollY); - isInTapRegion = false; - lastX = x; - lastY = y; + case MotionEvent.ACTION_MOVE: + { + final float x = event.getX(); + final float y = event.getY(); + final float dx = x - downX; + final float dy = y - downY; + final float distanceSquare = (dx * dx) + (dy * dy); + + if (distanceSquare > touchSlopSquare) { + final float scrollX = lastX - x; + final float scrollY = lastY - y; + listener.onScroll(currentDownEvent, event, scrollX, scrollY); + isInTapRegion = false; + lastX = x; + lastY = y; + } + break; } + + case MotionEvent.ACTION_POINTER_DOWN: + // A second finger means this is not a single tap (e.g. pinch-to-zoom). + // Also suppress the UP handler to avoid spurious fling detection when the + // last finger lifts quickly after a pinch — mirrors GestureDetector's + // mIgnoreNextUpEvent / cancelTaps() behavior. + isInTapRegion = false; + ignoreUpEvent = true; break; - } - - case MotionEvent.ACTION_POINTER_DOWN: - // A second finger means this is not a single tap (e.g. pinch-to-zoom). - // Also suppress the UP handler to avoid spurious fling detection when the - // last finger lifts quickly after a pinch — mirrors GestureDetector's - // mIgnoreNextUpEvent / cancelTaps() behavior. - isInTapRegion = false; - ignoreUpEvent = true; - break; - - case MotionEvent.ACTION_UP: - if (ignoreUpEvent) { - endGesture(); - break; - } - if (isInTapRegion) { - listener.onSingleTapUp(event); - } else { - final int pointerId = event.getPointerId(0); - velocityTracker.computeCurrentVelocity(1000, maximumFlingVelocity); - final float velocityX = velocityTracker.getXVelocity(pointerId); - final float velocityY = velocityTracker.getYVelocity(pointerId); - - if (Math.abs(velocityX) > minimumFlingVelocity - || Math.abs(velocityY) > minimumFlingVelocity) { - listener.onFling(currentDownEvent, event, velocityX, velocityY); + + case MotionEvent.ACTION_UP: + if (ignoreUpEvent) { + recycle(); + break; } - } - endGesture(); - break; + if (isInTapRegion) { + listener.onSingleTapUp(event); + } else { + final int pointerId = event.getPointerId(0); + velocityTracker.computeCurrentVelocity(1000, maximumFlingVelocity); + final float velocityX = velocityTracker.getXVelocity(pointerId); + final float velocityY = velocityTracker.getYVelocity(pointerId); + + if (Math.abs(velocityX) > minimumFlingVelocity + || Math.abs(velocityY) > minimumFlingVelocity) { + listener.onFling(currentDownEvent, event, velocityX, velocityY); + } + } + recycle(); + break; - case MotionEvent.ACTION_CANCEL: - endGesture(); - break; + case MotionEvent.ACTION_CANCEL: + recycle(); + break; + } } } - /** Releases native resources. Call when the detector is no longer needed. */ - void release() { - endGesture(); - if (velocityTracker != null) { - velocityTracker.recycle(); + void recycle() { + final @Nullable MotionEvent capturedDownEvent; + final @Nullable VelocityTracker capturedVelocityTracker; + try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { + capturedDownEvent = currentDownEvent; + currentDownEvent = null; + capturedVelocityTracker = velocityTracker; velocityTracker = null; } - } - - private void endGesture() { - if (currentDownEvent != null) { - currentDownEvent.recycle(); - currentDownEvent = null; + if (capturedDownEvent != null) { + capturedDownEvent.recycle(); + } + if (capturedVelocityTracker != null) { + capturedVelocityTracker.recycle(); } } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java index e69756e506a..612eb97946e 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryWindowCallback.java @@ -81,7 +81,7 @@ private void handleTouchEvent(final @NotNull MotionEvent motionEvent) { public void stopTracking() { inert = true; gestureListener.stopTracing(SpanStatus.CANCELLED); - gestureDetector.release(); + gestureDetector.recycle(); } public @NotNull Window.Callback getDelegate() { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt index be15f9c578b..7967c4a3f0c 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureDetectorTest.kt @@ -322,6 +322,34 @@ class SentryGestureDetectorTest { up2.recycle() } + @Test + fun `recycle mid-gesture - subsequent gesture still fires onSingleTapUp`() { + val sut = fixture.getSut() + val downTime = SystemClock.uptimeMillis() + + // Start a gesture, then simulate stopTracking() racing in mid-gesture. + val down1 = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 100f, 100f, 0) + sut.onTouchEvent(down1) + sut.recycle() + + verify(fixture.listener).onDown(down1) + + // New gesture after recycle — velocityTracker and currentDownEvent should be re-obtained + // lazily and the tap path should work as normal. + val downTime2 = SystemClock.uptimeMillis() + val down2 = MotionEvent.obtain(downTime2, downTime2, MotionEvent.ACTION_DOWN, 200f, 200f, 0) + val up2 = MotionEvent.obtain(downTime2, downTime2 + 50, MotionEvent.ACTION_UP, 200f, 200f, 0) + + sut.onTouchEvent(down2) + sut.onTouchEvent(up2) + + verify(fixture.listener).onSingleTapUp(up2) + + down1.recycle() + down2.recycle() + up2.recycle() + } + @Test fun `sequential gestures - state resets between tap and scroll`() { val sut = fixture.getSut() From 2f670da8b19d00934e13602998c127e66e2e0874 Mon Sep 17 00:00:00 2001 From: markushi <1411808+markushi@users.noreply.github.com> Date: Wed, 22 Apr 2026 15:47:33 +0000 Subject: [PATCH 118/391] release: 8.40.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ae294f72e1..6dabfab7294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.40.0 ### Fixes diff --git a/gradle.properties b/gradle.properties index aee4b497d0e..38ad043eee8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.39.1 +versionName=8.40.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 6b019b757adad61364e3f2fb04fb10060b4b5f44 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Thu, 23 Apr 2026 14:09:12 +0200 Subject: [PATCH 119/391] chore(deps): bump camerax to 1.4.0 for Android 16KB page size compatibility (#5329) --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3c62935b805..71f433d176c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ compileSdk = "36" minSdk = "21" spotless = "7.0.4" gummyBears = "0.12.0" -camerax = "1.3.0" +camerax = "1.4.0" openfeature = "1.18.2" [plugins] From b28a5d505430e7102bc539d7b6fe9303ca9dfbc2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 12:08:17 +0200 Subject: [PATCH 120/391] build(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.4 to 2.26.2 (#5335) Bumps [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) from 2.25.4 to 2.26.2. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/97d0c4286f32a80d09c8b89366d762fecc3e27b6...3dc647fee3586e57c7c31eb900fdec7cbb44f23f) --- updated-dependencies: - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changelog-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index d8ea91d129a..64e68738b2e 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@97d0c4286f32a80d09c8b89366d762fecc3e27b6 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@3dc647fee3586e57c7c31eb900fdec7cbb44f23f # v2 secrets: inherit From c3602770e7ca4635530daa547a884c27d6fc84ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 10:30:43 +0000 Subject: [PATCH 121/391] chore(deps): update Native SDK to v0.13.8 (#5334) Co-authored-by: GitHub --- CHANGELOG.md | 8 ++++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dabfab7294..81b5b7d1686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +### Dependencies + +- Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0138) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.7...0.13.8) + ## 8.40.0 ### Fixes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 71f433d176c..c04ab824c86 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.7" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.8" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 52feca702cd5b95903209091fb3511d296be7275 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 10:31:50 +0000 Subject: [PATCH 122/391] build(deps): bump getsentry/craft from 2.25.4 to 2.26.2 (#5336) Bumps [getsentry/craft](https://github.com/getsentry/craft) from 2.25.4 to 2.26.2. - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/97d0c4286f32a80d09c8b89366d762fecc3e27b6...3dc647fee3586e57c7c31eb900fdec7cbb44f23f) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.26.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 177e8810a1b..66776935d9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@97d0c4286f32a80d09c8b89366d762fecc3e27b6 # v2 + uses: getsentry/craft@3dc647fee3586e57c7c31eb900fdec7cbb44f23f # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From 61659b6eb9cf705591958eb6e4b1ce03c0a49ce3 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 30 Apr 2026 09:49:56 +0200 Subject: [PATCH 123/391] feat(android): Add queryable getFramesDelay API to SentryFrameMetricsCollector (#5248) * feat(android): Add queryable getFramesDelay API to SpanFrameMetricsCollector Expose a getFramesDelay(startNanos, endNanos) method that allows external consumers (e.g. React Native SDK) to query frame delay for arbitrary time ranges without registering a duplicate frame listener. --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .../api/sentry-android-core.api | 6 + .../android/core/SentryFramesDelayResult.java | 31 ++++ .../util/SentryFrameMetricsCollector.java | 102 ++++++++++++ .../util/SentryFrameMetricsCollectorTest.kt | 152 ++++++++++++++++++ 4 files changed, 291 insertions(+) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/SentryFramesDelayResult.java diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 0d83082548f..8af0182bb45 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -435,6 +435,12 @@ public abstract interface class io/sentry/android/core/SentryAndroidOptions$Befo public abstract fun execute (Lio/sentry/SentryEvent;Lio/sentry/Hint;Z)Z } +public final class io/sentry/android/core/SentryFramesDelayResult { + public fun (DI)V + public fun getDelaySeconds ()D + public fun getFramesContributingToDelayCount ()I +} + public final class io/sentry/android/core/SentryInitProvider { public fun ()V public fun attachInfo (Landroid/content/Context;Landroid/content/pm/ProviderInfo;)V diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryFramesDelayResult.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryFramesDelayResult.java new file mode 100644 index 00000000000..724d8446ea8 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryFramesDelayResult.java @@ -0,0 +1,31 @@ +package io.sentry.android.core; + +import org.jetbrains.annotations.ApiStatus; + +/** Result of querying frame delay for a given time range. */ +@ApiStatus.Internal +public final class SentryFramesDelayResult { + + private final double delaySeconds; + private final int framesContributingToDelayCount; + + public SentryFramesDelayResult( + final double delaySeconds, final int framesContributingToDelayCount) { + this.delaySeconds = delaySeconds; + this.framesContributingToDelayCount = framesContributingToDelayCount; + } + + /** + * @return the total frame delay in seconds, or -1 if incalculable (e.g. no frame data available) + */ + public double getDelaySeconds() { + return delaySeconds; + } + + /** + * @return the number of frames that contributed to the delay (slow + frozen frames) + */ + public int getFramesContributingToDelayCount() { + return framesContributingToDelayCount; + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java index 55342c0e4c0..241ab1e4cca 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java @@ -19,12 +19,15 @@ import io.sentry.SentryUUID; import io.sentry.android.core.BuildInfoProvider; import io.sentry.android.core.ContextUtils; +import io.sentry.android.core.SentryFramesDelayResult; import io.sentry.util.Objects; import java.lang.ref.WeakReference; import java.lang.reflect.Field; +import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.TimeUnit; import org.jetbrains.annotations.ApiStatus; @@ -35,6 +38,8 @@ public final class SentryFrameMetricsCollector implements Application.ActivityLifecycleCallbacks { private static final long oneSecondInNanos = TimeUnit.SECONDS.toNanos(1); private static final long frozenFrameThresholdNanos = TimeUnit.MILLISECONDS.toNanos(700); + private static final int MAX_FRAMES_COUNT = 3600; + private static final long MAX_FRAME_AGE_NANOS = 5L * 60 * 1_000_000_000L; // 5 minutes private final @NotNull BuildInfoProvider buildInfoProvider; private final @NotNull Set trackedWindows = new CopyOnWriteArraySet<>(); @@ -53,6 +58,10 @@ public final class SentryFrameMetricsCollector implements Application.ActivityLi private long lastFrameStartNanos = 0; private long lastFrameEndNanos = 0; + // frame buffer for getFramesDelay queries, sorted by frame end time + private final @NotNull ConcurrentSkipListSet delayedFrames = + new ConcurrentSkipListSet<>(); + @SuppressLint("NewApi") public SentryFrameMetricsCollector( final @NotNull Context context, @@ -177,6 +186,16 @@ public SentryFrameMetricsCollector( isSlow(cpuDuration, (long) ((float) oneSecondInNanos / (refreshRate - 1.0f))); final boolean isFrozen = isSlow && isFrozen(cpuDuration); + final long frameStartTime = startTime; + + // store frames with delay for getFramesDelay queries + if (delayNanos > 0) { + pruneOldFrames(lastFrameEndNanos); + if (delayedFrames.size() < MAX_FRAMES_COUNT) { + delayedFrames.add(new DelayedFrame(frameStartTime, lastFrameEndNanos, delayNanos)); + } + } + for (FrameMetricsCollectorListener l : listenerMap.values()) { l.onFrameMetricCollected( startTime, @@ -354,6 +373,89 @@ public long getLastKnownFrameStartTimeNanos() { return -1; } + /** + * Queries the frame delay for a given time range. + * + *

This is useful for external consumers (e.g. React Native SDK) that need to query frame delay + * for an arbitrary time range without registering their own frame listener. + * + * @param startSystemNanos start of the time range in {@link System#nanoTime()} units + * @param endSystemNanos end of the time range in {@link System#nanoTime()} units + * @return a {@link SentryFramesDelayResult} with the delay in seconds and the number of frames + * contributing to delay, or a result with delaySeconds=-1 if incalculable + */ + public @NotNull SentryFramesDelayResult getFramesDelay( + final long startSystemNanos, final long endSystemNanos) { + if (!isAvailable) { + return new SentryFramesDelayResult(-1, 0); + } + + if (endSystemNanos <= startSystemNanos) { + return new SentryFramesDelayResult(-1, 0); + } + + long totalDelayNanos = 0; + int delayFrameCount = 0; + + if (!delayedFrames.isEmpty()) { + final Iterator iterator = + delayedFrames.tailSet(new DelayedFrame(startSystemNanos)).iterator(); + + while (iterator.hasNext()) { + final @NotNull DelayedFrame frame = iterator.next(); + + if (frame.startNanos >= endSystemNanos) { + break; + } + + // The delay portion of a frame is at the end: [frameEnd - delay, frameEnd] + final long delayStart = frame.endNanos - frame.delayNanos; + final long delayEnd = frame.endNanos; + + // Intersect the delay interval with the query range + final long overlapStart = Math.max(delayStart, startSystemNanos); + final long overlapEnd = Math.min(delayEnd, endSystemNanos); + + if (overlapEnd > overlapStart) { + totalDelayNanos += (overlapEnd - overlapStart); + delayFrameCount++; + } + } + } + + final double delaySeconds = totalDelayNanos / 1e9d; + return new SentryFramesDelayResult(delaySeconds, delayFrameCount); + } + + private void pruneOldFrames(final long currentNanos) { + final long cutoff = currentNanos - MAX_FRAME_AGE_NANOS; + delayedFrames.headSet(new DelayedFrame(cutoff)).clear(); + } + + private static class DelayedFrame implements Comparable { + final long startNanos; + final long endNanos; + final long delayNanos; + + /** Sentinel constructor for set range queries (tailSet/headSet). */ + DelayedFrame(final long timestampNanos) { + this(timestampNanos, timestampNanos, 0); + } + + DelayedFrame(final long startNanos, final long endNanos, final long delayNanos) { + this.startNanos = startNanos; + this.endNanos = endNanos; + this.delayNanos = delayNanos; + } + + @Override + public int compareTo(final @NotNull DelayedFrame o) { + int cmp = Long.compare(this.endNanos, o.endNanos); + if (cmp != 0) return cmp; + return Long.compare(this.startNanos, o.startNanos); + } + } + @ApiStatus.Internal public interface FrameMetricsCollectorListener { /** diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt index b3b018e87b2..02f65665a9e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt @@ -577,6 +577,158 @@ class SentryFrameMetricsCollectorTest { assertEquals(0, collector.getProperty>("trackedWindows").size) } + @Test + fun `getFramesDelay returns -1 when not available`() { + val buildInfo = + mock { whenever(it.sdkInfoVersion).thenReturn(Build.VERSION_CODES.M) } + val collector = fixture.getSut(context, buildInfo) + + val result = collector.getFramesDelay(0, TimeUnit.SECONDS.toNanos(1)) + assertEquals(-1.0, result.delaySeconds) + assertEquals(0, result.framesContributingToDelayCount) + } + + @Test + fun `getFramesDelay returns -1 for invalid time range`() { + val collector = fixture.getSut(context) + + val result = collector.getFramesDelay(2000, 1000) + assertEquals(-1.0, result.delaySeconds) + assertEquals(0, result.framesContributingToDelayCount) + } + + @Test + fun `getFramesDelay returns zero delay when no slow frames recorded`() { + val buildInfo = + mock { whenever(it.sdkInfoVersion).thenReturn(Build.VERSION_CODES.O) } + val collector = fixture.getSut(context, buildInfo) + Shadows.shadowOf(Looper.getMainLooper()).idle() + val listener = + collector.getProperty("frameMetricsAvailableListener") + + collector.startCollection(mock()) + + // emit a fast frame (21ns cpu time — well under 16ms budget) + listener.onFrameMetricsAvailable(createMockWindow(), createMockFrameMetrics(), 0) + + // choreographer is at end of range so no pending delay + val choreographer = collector.getProperty("choreographer") + choreographer.injectForField("mLastFrameTimeNanos", TimeUnit.SECONDS.toNanos(1)) + + val result = collector.getFramesDelay(0, TimeUnit.SECONDS.toNanos(1)) + assertEquals(0.0, result.delaySeconds) + assertEquals(0, result.framesContributingToDelayCount) + } + + @Test + fun `getFramesDelay calculates delay from slow frames`() { + val buildInfo = + mock { whenever(it.sdkInfoVersion).thenReturn(Build.VERSION_CODES.O) } + val collector = fixture.getSut(context, buildInfo) + val listener = + collector.getProperty("frameMetricsAvailableListener") + + collector.startCollection(mock()) + + // emit a slow frame (~100ms extra = ~116ms total, well over 16ms budget) + listener.onFrameMetricsAvailable( + createMockWindow(), + createMockFrameMetrics(extraCpuDurationNanos = TimeUnit.MILLISECONDS.toNanos(100)), + 0, + ) + + // emit a frozen frame (~1000ms extra = ~1016ms total, well over 700ms) + listener.onFrameMetricsAvailable( + createMockWindow(), + createMockFrameMetrics(extraCpuDurationNanos = TimeUnit.MILLISECONDS.toNanos(1000)), + 0, + ) + + // choreographer is at end of range so no pending delay + Shadows.shadowOf(Looper.getMainLooper()).idle() + val choreographer = collector.getProperty("choreographer") + choreographer.injectForField("mLastFrameTimeNanos", TimeUnit.SECONDS.toNanos(5)) + + val result = collector.getFramesDelay(0, TimeUnit.SECONDS.toNanos(5)) + assertTrue(result.delaySeconds > 0) + assertEquals(2, result.framesContributingToDelayCount) + } + + @Test + fun `getFramesDelay handles partial frame overlap`() { + val buildInfo = + mock { whenever(it.sdkInfoVersion).thenReturn(Build.VERSION_CODES.O) } + val collector = fixture.getSut(context, buildInfo) + val listener = + collector.getProperty("frameMetricsAvailableListener") + + collector.startCollection(mock()) + + // emit a frozen frame (~1s) + listener.onFrameMetricsAvailable( + createMockWindow(), + createMockFrameMetrics(extraCpuDurationNanos = TimeUnit.SECONDS.toNanos(1)), + 0, + ) + + // choreographer is at end of range + Shadows.shadowOf(Looper.getMainLooper()).idle() + val choreographer = collector.getProperty("choreographer") + choreographer.injectForField("mLastFrameTimeNanos", TimeUnit.SECONDS.toNanos(5)) + + // The frame's delay interval is roughly [~16ms, ~1000ms]. + // Query from 500ms so the range clips the delay interval in half. + val queryStart = TimeUnit.MILLISECONDS.toNanos(500) + val queryEnd = TimeUnit.SECONDS.toNanos(5) + + val fullResult = collector.getFramesDelay(0, queryEnd) + val partialResult = collector.getFramesDelay(queryStart, queryEnd) + + // partial overlap should yield less delay than the full range + assertTrue(partialResult.delaySeconds > 0) + assertTrue(partialResult.delaySeconds < fullResult.delaySeconds) + assertEquals(1, partialResult.framesContributingToDelayCount) + } + + @Test + fun `old frames are automatically pruned`() { + val buildInfo = + mock { whenever(it.sdkInfoVersion).thenReturn(Build.VERSION_CODES.O) } + val collector = fixture.getSut(context, buildInfo) + Shadows.shadowOf(Looper.getMainLooper()).idle() + val listener = + collector.getProperty("frameMetricsAvailableListener") + val choreographer = collector.getProperty("choreographer") + + collector.startCollection(mock()) + + val t0 = TimeUnit.MINUTES.toNanos(10) // start at a realistic base time + + // emit a slow frame at t0 + val frameMetrics1 = + createMockFrameMetrics(extraCpuDurationNanos = TimeUnit.MILLISECONDS.toNanos(100)) + whenever(frameMetrics1.getMetric(FrameMetrics.INTENDED_VSYNC_TIMESTAMP)).thenReturn(t0) + listener.onFrameMetricsAvailable(createMockWindow(), frameMetrics1, 0) + + choreographer.injectForField("mLastFrameTimeNanos", t0 + TimeUnit.SECONDS.toNanos(1)) + + // verify frame exists + val resultBefore = collector.getFramesDelay(t0, t0 + TimeUnit.SECONDS.toNanos(1)) + assertEquals(1, resultBefore.framesContributingToDelayCount) + + // emit another slow frame >5 minutes later to trigger auto-pruning + val t1 = t0 + TimeUnit.MINUTES.toNanos(6) + val frameMetrics2 = + createMockFrameMetrics(extraCpuDurationNanos = TimeUnit.MILLISECONDS.toNanos(100)) + whenever(frameMetrics2.getMetric(FrameMetrics.INTENDED_VSYNC_TIMESTAMP)).thenReturn(t1) + listener.onFrameMetricsAvailable(createMockWindow(), frameMetrics2, 0) + + // the first frame should have been pruned (>5min old) + choreographer.injectForField("mLastFrameTimeNanos", t1 + TimeUnit.SECONDS.toNanos(1)) + val resultAfter = collector.getFramesDelay(t0, t0 + TimeUnit.SECONDS.toNanos(1)) + assertEquals(0, resultAfter.framesContributingToDelayCount) + } + private fun createMockWindow(refreshRate: Float = 60F): Window { val mockWindow = mock() val mockDisplay = mock() From 7659fe5e58bc7ea6eca4b32b4e34bff0810578ed Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 30 Apr 2026 13:07:38 +0200 Subject: [PATCH 124/391] ref(feedback): Rename Dialog to Form across feedback APIs (#5349) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ref(feedback): Rename Dialog to Form across feedback APIs Rename SentryUserFeedbackDialog to SentryUserFeedbackForm as the primary class. Keep SentryUserFeedbackDialog as a deprecated subclass for backward compatibility. Also rename internal APIs to use Form naming consistently: - IDialogHandler -> IFormHandler - showDialog -> showForm - setDialogHandler/getDialogHandler -> setFormHandler/getFormHandler - AndroidUserFeedbackIDialogHandler -> AndroidUserFeedbackFormHandler Add deprecated Sentry.showUserFeedbackDialog() overloads that delegate to the new Sentry.showUserFeedbackForm() methods. Co-Authored-By: Claude Opus 4.6 * fix(feedback): Preserve binary compatibility for deprecated Builder constructors Use SentryUserFeedbackDialog.OptionsConfiguration as the parameter type in the deprecated Builder constructors so old compiled code looking for the original descriptor still resolves correctly. Co-Authored-By: Claude Opus 4.6 * Make internal ctor package-private * Add missing deprecated annotaiton * Fix api * docs(changelog): Add deprecation entry for feedback Dialog to Form rename Co-Authored-By: Claude Opus 4.6 * docs(changelog): Note removal in next major version Co-Authored-By: Claude Opus 4.6 * feat(feedback): Add Sentry.feedback() API Introduce IFeedbackApi with showForm() and capture() methods, accessible via Sentry.feedback(). This consolidates all feedback operations under a single API entry point. Deprecate Sentry.showUserFeedbackForm(), Sentry.showUserFeedbackDialog(), Sentry.captureFeedback(), and Sentry.captureUserFeedback() in favor of the new Sentry.feedback() API. All deprecated methods will be removed in the next major version. Co-Authored-By: Claude Opus 4.6 * docs(changelog): Update section to Features and remove unpublished API Co-Authored-By: Claude Opus 4.6 * ref(feedback): Move FeedbackApi to IScopes Add feedback() method to IScopes, matching the pattern used by logger() and metrics(). FeedbackApi takes an IScopes reference instead of using Sentry.getCurrentScopes() statically. Implemented in Scopes, NoOpScopes, NoOpHub, HubAdapter, HubScopesWrapper, and ScopesAdapter. Sentry.feedback() now delegates to getCurrentScopes().feedback(). Co-Authored-By: Claude Opus 4.6 * ref: Rename showForm() to show() on IFeedbackApi Since the method is already namespaced under feedback(), the extra "Form" suffix is redundant. This aligns with the convention used by logger() and metrics(). Co-Authored-By: Claude Opus 4.6 * chore: Deprecate UserFeedback and captureUserFeedback, delete showUserFeedbackForm Deprecate the old `UserFeedback` class and `captureUserFeedback()` across IScopes, ISentryClient, and all implementations in favor of `Sentry.feedback().capture()` with the new `Feedback` type. Delete `Sentry.showUserFeedbackForm()` (3 overloads) as it was never published. Co-Authored-By: Claude Opus 4.6 * chore: Deprecate SentryEnvelopeItem.fromUserFeedback() Co-Authored-By: Claude Opus 4.6 * chore: Deprecate SentryClient.buildEnvelope(UserFeedback) Co-Authored-By: Claude Opus 4.6 * ref: Remove unnecessary SuppressWarnings("deprecation") Deprecated methods don't need to suppress deprecation warnings for referencing other deprecated types — the deprecation annotation itself is sufficient. Co-Authored-By: Claude Opus 4.6 * fix test * remove redudndant deprecated annotations * fix test --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 9 + .../api/sentry-android-core.api | 33 +- .../core/AndroidOptionsInitializer.java | 2 +- .../core/FeedbackShakeIntegration.java | 2 +- .../android/core/SentryAndroidOptions.java | 6 +- .../core/SentryUserFeedbackButton.java | 4 +- .../core/SentryUserFeedbackDialog.java | 356 +++------------- .../android/core/SentryUserFeedbackForm.java | 379 ++++++++++++++++++ .../core/AndroidOptionsInitializerTest.kt | 6 +- .../core/FeedbackShakeIntegrationTest.kt | 4 +- ...gTest.kt => SentryUserFeedbackFormTest.kt} | 8 +- .../uitest/android/UserFeedbackUiTest.kt | 14 +- .../compose/SentryUserFeedbackButton.kt | 2 +- sentry/api/sentry.api | 36 +- .../src/main/java/io/sentry/FeedbackApi.java | 51 +++ .../src/main/java/io/sentry/HubAdapter.java | 5 + .../main/java/io/sentry/HubScopesWrapper.java | 5 + .../src/main/java/io/sentry/IFeedbackApi.java | 29 ++ sentry/src/main/java/io/sentry/IScopes.java | 6 + .../main/java/io/sentry/ISentryClient.java | 3 + .../main/java/io/sentry/JsonSerializer.java | 1 + .../main/java/io/sentry/NoOpFeedbackApi.java | 46 +++ sentry/src/main/java/io/sentry/NoOpHub.java | 6 + .../src/main/java/io/sentry/NoOpScopes.java | 6 + .../main/java/io/sentry/NoOpSentryClient.java | 1 + sentry/src/main/java/io/sentry/Scopes.java | 8 + .../main/java/io/sentry/ScopesAdapter.java | 12 +- sentry/src/main/java/io/sentry/Sentry.java | 66 ++- .../src/main/java/io/sentry/SentryClient.java | 2 + .../java/io/sentry/SentryEnvelopeItem.java | 1 + .../java/io/sentry/SentryFeedbackOptions.java | 28 +- .../main/java/io/sentry/SentryOptions.java | 2 +- .../src/main/java/io/sentry/UserFeedback.java | 8 +- .../src/test/java/io/sentry/HubAdapterTest.kt | 2 + .../test/java/io/sentry/ScopesAdapterTest.kt | 2 + .../io/sentry/SentryFeedbackOptionsTest.kt | 8 +- .../test/java/io/sentry/SentryOptionsTest.kt | 4 +- sentry/src/test/java/io/sentry/SentryTest.kt | 32 +- 38 files changed, 786 insertions(+), 409 deletions(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java rename sentry-android-core/src/test/java/io/sentry/android/core/{SentryUserFeedbackDialogTest.kt => SentryUserFeedbackFormTest.kt} (94%) create mode 100644 sentry/src/main/java/io/sentry/FeedbackApi.java create mode 100644 sentry/src/main/java/io/sentry/IFeedbackApi.java create mode 100644 sentry/src/main/java/io/sentry/NoOpFeedbackApi.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b5b7d1686..4d1a581769c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## Unreleased +### Features + +- Add `Sentry.feedback()` API for `show()` and `capture()` ([#5349](https://github.com/getsentry/sentry-java/pull/5349)) + - `Sentry.showUserFeedbackDialog()` is deprecated in favor of `Sentry.feedback().show()` + - `Sentry.captureFeedback()` is deprecated in favor of `Sentry.feedback().capture()` + - `Sentry.captureUserFeedback()` and `UserFeedback` are deprecated in favor of `Sentry.feedback().capture()` with the new `Feedback` type + - `SentryUserFeedbackDialog` is deprecated in favor of `SentryUserFeedbackForm` + - All deprecated APIs will be removed in the next major version + ### Dependencies - Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334)) diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 8af0182bb45..3d4512fc2b4 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -502,23 +502,44 @@ public class io/sentry/android/core/SentryUserFeedbackButton : android/widget/Bu public fun setOnClickListener (Landroid/view/View$OnClickListener;)V } -public final class io/sentry/android/core/SentryUserFeedbackDialog : android/app/AlertDialog { - public fun setCancelable (Z)V - public fun setOnDismissListener (Landroid/content/DialogInterface$OnDismissListener;)V - public fun show ()V +public final class io/sentry/android/core/SentryUserFeedbackDialog : io/sentry/android/core/SentryUserFeedbackForm { } -public class io/sentry/android/core/SentryUserFeedbackDialog$Builder { +public class io/sentry/android/core/SentryUserFeedbackDialog$Builder : io/sentry/android/core/SentryUserFeedbackForm$Builder { public fun (Landroid/content/Context;)V public fun (Landroid/content/Context;I)V public fun (Landroid/content/Context;ILio/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration;)V public fun (Landroid/content/Context;Lio/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration;)V public fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackDialog$Builder; + public synthetic fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder; public fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackDialog$Builder; + public synthetic fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder; public fun create ()Lio/sentry/android/core/SentryUserFeedbackDialog; + public synthetic fun create ()Lio/sentry/android/core/SentryUserFeedbackForm; +} + +public abstract interface class io/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration : io/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration { +} + +public class io/sentry/android/core/SentryUserFeedbackForm : android/app/AlertDialog { + protected fun onCreate (Landroid/os/Bundle;)V + protected fun onStart ()V + public fun setCancelable (Z)V + public fun setOnDismissListener (Landroid/content/DialogInterface$OnDismissListener;)V + public fun show ()V +} + +public class io/sentry/android/core/SentryUserFeedbackForm$Builder { + public fun (Landroid/content/Context;)V + public fun (Landroid/content/Context;I)V + public fun (Landroid/content/Context;ILio/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration;)V + public fun (Landroid/content/Context;Lio/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration;)V + public fun associatedEventId (Lio/sentry/protocol/SentryId;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder; + public fun configurator (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)Lio/sentry/android/core/SentryUserFeedbackForm$Builder; + public fun create ()Lio/sentry/android/core/SentryUserFeedbackForm; } -public abstract interface class io/sentry/android/core/SentryUserFeedbackDialog$OptionsConfiguration { +public abstract interface class io/sentry/android/core/SentryUserFeedbackForm$OptionsConfiguration { public abstract fun configure (Landroid/content/Context;Lio/sentry/SentryFeedbackOptions;)V } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java index 5f7fad69b5d..5704cf7d7d4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java @@ -441,7 +441,7 @@ static void installDefaultIntegrations( } options .getFeedbackOptions() - .setDialogHandler(new SentryAndroidOptions.AndroidUserFeedbackIDialogHandler()); + .setFormHandler(new SentryAndroidOptions.AndroidUserFeedbackFormHandler()); } /** diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java index b845b6ed8c4..fc34f18152f 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java @@ -178,7 +178,7 @@ private void startShakeDetection(final @NotNull Activity activity) { } previousOnFormClose = null; }); - new SentryUserFeedbackDialog.Builder(active).create().show(); + new SentryUserFeedbackForm.Builder(active).create().show(); } catch (Throwable e) { isDialogShowing = false; options.getFeedbackOptions().setOnFormClose(previousOnFormClose); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index 054e43322a2..8fe702aad50 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -741,9 +741,9 @@ public void setEnableAnrFingerprinting(final boolean enableAnrFingerprinting) { this.enableAnrFingerprinting = enableAnrFingerprinting; } - static class AndroidUserFeedbackIDialogHandler implements SentryFeedbackOptions.IDialogHandler { + static class AndroidUserFeedbackFormHandler implements SentryFeedbackOptions.IFormHandler { @Override - public void showDialog( + public void showForm( final @Nullable SentryId associatedEventId, final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity(); @@ -758,7 +758,7 @@ public void showDialog( return; } - new SentryUserFeedbackDialog.Builder(activity) + new SentryUserFeedbackForm.Builder(activity) .associatedEventId(associatedEventId) .configurator(configurator) .create() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java index eedafd8f001..729dfd0b4e7 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java @@ -104,7 +104,7 @@ private void init( } } - // Set the default ClickListener to open the SentryUserFeedbackDialog + // Set the default ClickListener to open the SentryUserFeedbackForm setOnClickListener(delegate); } @@ -113,7 +113,7 @@ public void setOnClickListener(final @Nullable OnClickListener listener) { delegate = listener; super.setOnClickListener( v -> { - new SentryUserFeedbackDialog.Builder(getContext()).create().show(); + new SentryUserFeedbackForm.Builder(getContext()).create().show(); if (delegate != null) { delegate.onClick(v); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackDialog.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackDialog.java index 542a7027a4f..155464b7b73 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackDialog.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackDialog.java @@ -1,380 +1,114 @@ package io.sentry.android.core; -import android.app.AlertDialog; import android.content.Context; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.ImageView; -import android.widget.TextView; -import android.widget.Toast; -import io.sentry.IScopes; -import io.sentry.Sentry; import io.sentry.SentryFeedbackOptions; -import io.sentry.SentryIntegrationPackageStorage; -import io.sentry.SentryLevel; -import io.sentry.SentryOptions; -import io.sentry.protocol.Feedback; import io.sentry.protocol.SentryId; -import io.sentry.protocol.User; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public final class SentryUserFeedbackDialog extends AlertDialog { - - private boolean isCancelable = false; - private @Nullable SentryId currentReplayId; - private final @Nullable SentryId associatedEventId; - private @Nullable OnDismissListener delegate; - - private final @Nullable OptionsConfiguration configuration; - private final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator; +/** + * @deprecated Use {@link SentryUserFeedbackForm} instead. + */ +@Deprecated +public final class SentryUserFeedbackDialog extends SentryUserFeedbackForm { SentryUserFeedbackDialog( final @NotNull Context context, final int themeResId, final @Nullable SentryId associatedEventId, - final @Nullable OptionsConfiguration configuration, + final @Nullable SentryUserFeedbackForm.OptionsConfiguration configuration, final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { - super(context, themeResId); - this.associatedEventId = associatedEventId; - this.configuration = configuration; - this.configurator = configurator; - SentryIntegrationPackageStorage.getInstance().addIntegration("UserFeedbackWidget"); - } - - @Override - public void setCancelable(boolean cancelable) { - super.setCancelable(cancelable); - isCancelable = cancelable; - } - - @Override - @SuppressWarnings("deprecation") - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.sentry_dialog_user_feedback); - setCancelable(isCancelable); - - final @NotNull SentryFeedbackOptions feedbackOptions = - new SentryFeedbackOptions(Sentry.getCurrentScopes().getOptions().getFeedbackOptions()); - if (configuration != null) { - configuration.configure(getContext(), feedbackOptions); - } - if (configurator != null) { - configurator.configure(feedbackOptions); - } - final @NotNull TextView lblTitle = findViewById(R.id.sentry_dialog_user_feedback_title); - final @NotNull ImageView imgLogo = findViewById(R.id.sentry_dialog_user_feedback_logo); - final @NotNull TextView lblName = findViewById(R.id.sentry_dialog_user_feedback_txt_name); - final @NotNull EditText edtName = findViewById(R.id.sentry_dialog_user_feedback_edt_name); - final @NotNull TextView lblEmail = findViewById(R.id.sentry_dialog_user_feedback_txt_email); - final @NotNull EditText edtEmail = findViewById(R.id.sentry_dialog_user_feedback_edt_email); - final @NotNull TextView lblMessage = - findViewById(R.id.sentry_dialog_user_feedback_txt_description); - final @NotNull EditText edtMessage = - findViewById(R.id.sentry_dialog_user_feedback_edt_description); - final @NotNull Button btnSend = findViewById(R.id.sentry_dialog_user_feedback_btn_send); - final @NotNull Button btnCancel = findViewById(R.id.sentry_dialog_user_feedback_btn_cancel); - - if (feedbackOptions.isShowBranding()) { - imgLogo.setVisibility(View.VISIBLE); - } else { - imgLogo.setVisibility(View.GONE); - } - - // If name is required, ignore showName flag - if (!feedbackOptions.isShowName() && !feedbackOptions.isNameRequired()) { - lblName.setVisibility(View.GONE); - edtName.setVisibility(View.GONE); - } else { - lblName.setVisibility(View.VISIBLE); - edtName.setVisibility(View.VISIBLE); - lblName.setText(feedbackOptions.getNameLabel()); - edtName.setHint(feedbackOptions.getNamePlaceholder()); - if (feedbackOptions.isNameRequired()) { - lblName.append(feedbackOptions.getIsRequiredLabel()); - } - } - - // If email is required, ignore showEmail flag - if (!feedbackOptions.isShowEmail() && !feedbackOptions.isEmailRequired()) { - lblEmail.setVisibility(View.GONE); - edtEmail.setVisibility(View.GONE); - } else { - lblEmail.setVisibility(View.VISIBLE); - edtEmail.setVisibility(View.VISIBLE); - lblEmail.setText(feedbackOptions.getEmailLabel()); - edtEmail.setHint(feedbackOptions.getEmailPlaceholder()); - if (feedbackOptions.isEmailRequired()) { - lblEmail.append(feedbackOptions.getIsRequiredLabel()); - } - } - - // If Sentry user is set, and useSentryUser is true, populate the name and email - if (feedbackOptions.isUseSentryUser()) { - final @Nullable User user = Sentry.getCurrentScopes().getScope().getUser(); - if (user != null) { - edtName.setText(user.getUsername()); - edtEmail.setText(user.getEmail()); - } - } - - lblMessage.setText(feedbackOptions.getMessageLabel()); - lblMessage.append(feedbackOptions.getIsRequiredLabel()); - edtMessage.setHint(feedbackOptions.getMessagePlaceholder()); - lblTitle.setText(feedbackOptions.getFormTitle()); - - btnSend.setText(feedbackOptions.getSubmitButtonLabel()); - btnSend.setOnClickListener( - v -> { - // Gather fields and trim them - final @NotNull String name = edtName.getText().toString().trim(); - final @NotNull String email = edtEmail.getText().toString().trim(); - final @NotNull String message = edtMessage.getText().toString().trim(); - - // If a required field is missing, shows the error label - if (name.isEmpty() && feedbackOptions.isNameRequired()) { - edtName.setError(lblName.getText()); - return; - } - - if (email.isEmpty() && feedbackOptions.isEmailRequired()) { - edtEmail.setError(lblEmail.getText()); - return; - } - - if (message.isEmpty()) { - edtMessage.setError(lblMessage.getText()); - return; - } - - // Create the feedback object - final @NotNull Feedback feedback = new Feedback(message); - feedback.setName(name); - feedback.setContactEmail(email); - if (associatedEventId != null) { - feedback.setAssociatedEventId(associatedEventId); - } - if (currentReplayId != null) { - feedback.setReplayId(currentReplayId); - } - - // Capture the feedback. If the ID is empty, it means that the feedback was not sent - final @NotNull SentryId id = Sentry.captureFeedback(feedback); - if (!id.equals(SentryId.EMPTY_ID)) { - Toast.makeText( - getContext(), feedbackOptions.getSuccessMessageText(), Toast.LENGTH_SHORT) - .show(); - final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitSuccess = - feedbackOptions.getOnSubmitSuccess(); - if (onSubmitSuccess != null) { - onSubmitSuccess.call(feedback); - } - } else { - final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitError = - feedbackOptions.getOnSubmitError(); - if (onSubmitError != null) { - onSubmitError.call(feedback); - } - } - cancel(); - }); - - btnCancel.setText(feedbackOptions.getCancelButtonLabel()); - btnCancel.setOnClickListener(v -> cancel()); - setOnDismissListener(delegate); + super(context, themeResId, associatedEventId, configuration, configurator); } - @Override - public void setOnDismissListener(final @Nullable OnDismissListener listener) { - delegate = listener; - // If the user set a custom onDismissListener, we ensure it doesn't override the onFormClose - final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); - final @Nullable Runnable onFormClose = options.getFeedbackOptions().getOnFormClose(); - if (onFormClose != null) { - super.setOnDismissListener( - dialog -> { - onFormClose.run(); - currentReplayId = null; - if (delegate != null) { - delegate.onDismiss(dialog); - } - }); - } else { - super.setOnDismissListener(delegate); - } - } - - @Override - protected void onStart() { - super.onStart(); - final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); - final @NotNull SentryFeedbackOptions feedbackOptions = options.getFeedbackOptions(); - final @Nullable Runnable onFormOpen = feedbackOptions.getOnFormOpen(); - if (onFormOpen != null) { - onFormOpen.run(); - } - options.getReplayController().captureReplay(false); - currentReplayId = options.getReplayController().getReplayId(); - } - - @Override - public void show() { - // If Sentry is disabled, don't show the dialog, but log a warning - final @NotNull IScopes scopes = Sentry.getCurrentScopes(); - final @NotNull SentryOptions options = scopes.getOptions(); - if (!scopes.isEnabled() || !options.isEnabled()) { - options - .getLogger() - .log(SentryLevel.WARNING, "Sentry is disabled. Feedback dialog won't be shown."); - return; - } - // Otherwise, show the dialog - super.show(); - } - - public static class Builder { - - @Nullable OptionsConfiguration configuration; - @Nullable SentryFeedbackOptions.OptionsConfigurator configurator; - @Nullable SentryId associatedEventId; - final @NotNull Context context; - final int themeResId; + /** + * @deprecated Use {@link SentryUserFeedbackForm.Builder} instead. + */ + @Deprecated + public static class Builder extends SentryUserFeedbackForm.Builder { /** * Creates a builder for a {@link SentryUserFeedbackDialog} that uses the default alert dialog * theme. * - *

The default alert dialog theme is defined by {@link android.R.attr#alertDialogTheme} - * within the parent {@code context}'s theme. - * * @param context the parent context + * @deprecated Use {@link SentryUserFeedbackForm.Builder#Builder(Context)} instead. */ + @Deprecated public Builder(final @NotNull Context context) { - this(context, 0); + super(context); } /** * Creates a builder for a {@link SentryUserFeedbackDialog} that uses an explicit theme * resource. * - *

The specified theme resource ({@code themeResId}) is applied on top of the parent {@code - * context}'s theme. It may be specified as a style resource containing a fully-populated theme, - * such as {@link android.R.style#Theme_Material_Dialog}, to replace all attributes in the - * parent {@code context}'s theme including primary and accent colors. - * - *

To preserve attributes such as primary and accent colors, the {@code themeResId} may - * instead be specified as an overlay theme such as {@link - * android.R.style#ThemeOverlay_Material_Dialog}. This will override only the window attributes - * necessary to style the alert window as a dialog. - * - *

Alternatively, the {@code themeResId} may be specified as {@code 0} to use the parent - * {@code context}'s resolved value for {@link android.R.attr#alertDialogTheme}. - * * @param context the parent context - * @param themeResId the resource ID of the theme against which to inflate this dialog, or - * {@code 0} to use the parent {@code context}'s default alert dialog theme + * @param themeResId the resource ID of the theme + * @deprecated Use {@link SentryUserFeedbackForm.Builder#Builder(Context, int)} instead. */ + @Deprecated public Builder(Context context, int themeResId) { - this(context, themeResId, null); + super(context, themeResId); } /** - * Creates a builder for a {@link SentryUserFeedbackDialog} that uses the default alert dialog - * theme. The {@code configuration} can be used to configure the feedback options for this - * specific dialog. - * - *

The default alert dialog theme is defined by {@link android.R.attr#alertDialogTheme} - * within the parent {@code context}'s theme. + * Creates a builder for a {@link SentryUserFeedbackDialog} with a configuration. * * @param context the parent context - * @param configuration the configuration for the feedback options, can be {@code null} to use - * the global feedback options. + * @param configuration the configuration for the feedback options + * @deprecated Use {@link SentryUserFeedbackForm.Builder#Builder(Context, + * SentryUserFeedbackForm.OptionsConfiguration)} instead. */ + @Deprecated public Builder( final @NotNull Context context, final @Nullable OptionsConfiguration configuration) { - this(context, 0, configuration); + super(context, configuration); } /** - * Creates a builder for a {@link SentryUserFeedbackDialog} that uses an explicit theme - * resource. The {@code configuration} can be used to configure the feedback options for this - * specific dialog. - * - *

The specified theme resource ({@code themeResId}) is applied on top of the parent {@code - * context}'s theme. It may be specified as a style resource containing a fully-populated theme, - * such as {@link android.R.style#Theme_Material_Dialog}, to replace all attributes in the - * parent {@code context}'s theme including primary and accent colors. - * - *

To preserve attributes such as primary and accent colors, the {@code themeResId} may - * instead be specified as an overlay theme such as {@link - * android.R.style#ThemeOverlay_Material_Dialog}. This will override only the window attributes - * necessary to style the alert window as a dialog. - * - *

Alternatively, the {@code themeResId} may be specified as {@code 0} to use the parent - * {@code context}'s resolved value for {@link android.R.attr#alertDialogTheme}. + * Creates a builder for a {@link SentryUserFeedbackDialog} with a theme and configuration. * * @param context the parent context - * @param themeResId the resource ID of the theme against which to inflate this dialog, or - * {@code 0} to use the parent {@code context}'s default alert dialog theme - * @param configuration the configuration for the feedback options, can be {@code null} to use - * the global feedback options. + * @param themeResId the resource ID of the theme + * @param configuration the configuration for the feedback options + * @deprecated Use {@link SentryUserFeedbackForm.Builder#Builder(Context, int, + * SentryUserFeedbackForm.OptionsConfiguration)} instead. */ + @Deprecated public Builder( final @NotNull Context context, final int themeResId, final @Nullable OptionsConfiguration configuration) { - this.context = context; - this.themeResId = themeResId; - this.configuration = configuration; + super(context, themeResId, configuration); } - /** - * Sets the configuration for the feedback options. - * - * @param configurator the configuration for the feedback options, can be {@code null} to use - * the global feedback options. - */ + @Deprecated + @Override public Builder configurator( final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { - this.configurator = configurator; + super.configurator(configurator); return this; } - /** - * Sets the associated event ID for the feedback. - * - * @param associatedEventId the associated event ID for the feedback, can be {@code null} to - * avoid associating the feedback to an event. - */ + @Deprecated + @Override public Builder associatedEventId(final @Nullable SentryId associatedEventId) { - this.associatedEventId = associatedEventId; + super.associatedEventId(associatedEventId); return this; } - /** - * Builds a new {@link SentryUserFeedbackDialog} with the specified context, theme, and - * configuration. - * - * @return a new instance of {@link SentryUserFeedbackDialog} - */ + @Deprecated + @Override public SentryUserFeedbackDialog create() { return new SentryUserFeedbackDialog( context, themeResId, associatedEventId, configuration, configurator); } } - /** Configuration callback for feedback options. */ - public interface OptionsConfiguration { - - /** - * configure the feedback options - * - * @param context the context of the feedback dialog - * @param options the feedback options - */ - void configure(final @NotNull Context context, final @NotNull SentryFeedbackOptions options); - } + /** + * @deprecated Use {@link SentryUserFeedbackForm.OptionsConfiguration} instead. + */ + @Deprecated + public interface OptionsConfiguration extends SentryUserFeedbackForm.OptionsConfiguration {} } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java new file mode 100644 index 00000000000..0babe475491 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java @@ -0,0 +1,379 @@ +package io.sentry.android.core; + +import android.app.AlertDialog; +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; +import io.sentry.IScopes; +import io.sentry.Sentry; +import io.sentry.SentryFeedbackOptions; +import io.sentry.SentryIntegrationPackageStorage; +import io.sentry.SentryLevel; +import io.sentry.SentryOptions; +import io.sentry.protocol.Feedback; +import io.sentry.protocol.SentryId; +import io.sentry.protocol.User; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class SentryUserFeedbackForm extends AlertDialog { + + private boolean isCancelable = false; + private @Nullable SentryId currentReplayId; + private final @Nullable SentryId associatedEventId; + private @Nullable OnDismissListener delegate; + + private final @Nullable OptionsConfiguration configuration; + private final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator; + + SentryUserFeedbackForm( + final @NotNull Context context, + final int themeResId, + final @Nullable SentryId associatedEventId, + final @Nullable OptionsConfiguration configuration, + final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { + super(context, themeResId); + this.associatedEventId = associatedEventId; + this.configuration = configuration; + this.configurator = configurator; + SentryIntegrationPackageStorage.getInstance().addIntegration("UserFeedbackWidget"); + } + + @Override + public void setCancelable(boolean cancelable) { + super.setCancelable(cancelable); + isCancelable = cancelable; + } + + @Override + @SuppressWarnings("deprecation") + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.sentry_dialog_user_feedback); + setCancelable(isCancelable); + + final @NotNull SentryFeedbackOptions feedbackOptions = + new SentryFeedbackOptions(Sentry.getCurrentScopes().getOptions().getFeedbackOptions()); + if (configuration != null) { + configuration.configure(getContext(), feedbackOptions); + } + if (configurator != null) { + configurator.configure(feedbackOptions); + } + final @NotNull TextView lblTitle = findViewById(R.id.sentry_dialog_user_feedback_title); + final @NotNull ImageView imgLogo = findViewById(R.id.sentry_dialog_user_feedback_logo); + final @NotNull TextView lblName = findViewById(R.id.sentry_dialog_user_feedback_txt_name); + final @NotNull EditText edtName = findViewById(R.id.sentry_dialog_user_feedback_edt_name); + final @NotNull TextView lblEmail = findViewById(R.id.sentry_dialog_user_feedback_txt_email); + final @NotNull EditText edtEmail = findViewById(R.id.sentry_dialog_user_feedback_edt_email); + final @NotNull TextView lblMessage = + findViewById(R.id.sentry_dialog_user_feedback_txt_description); + final @NotNull EditText edtMessage = + findViewById(R.id.sentry_dialog_user_feedback_edt_description); + final @NotNull Button btnSend = findViewById(R.id.sentry_dialog_user_feedback_btn_send); + final @NotNull Button btnCancel = findViewById(R.id.sentry_dialog_user_feedback_btn_cancel); + + if (feedbackOptions.isShowBranding()) { + imgLogo.setVisibility(View.VISIBLE); + } else { + imgLogo.setVisibility(View.GONE); + } + + // If name is required, ignore showName flag + if (!feedbackOptions.isShowName() && !feedbackOptions.isNameRequired()) { + lblName.setVisibility(View.GONE); + edtName.setVisibility(View.GONE); + } else { + lblName.setVisibility(View.VISIBLE); + edtName.setVisibility(View.VISIBLE); + lblName.setText(feedbackOptions.getNameLabel()); + edtName.setHint(feedbackOptions.getNamePlaceholder()); + if (feedbackOptions.isNameRequired()) { + lblName.append(feedbackOptions.getIsRequiredLabel()); + } + } + + // If email is required, ignore showEmail flag + if (!feedbackOptions.isShowEmail() && !feedbackOptions.isEmailRequired()) { + lblEmail.setVisibility(View.GONE); + edtEmail.setVisibility(View.GONE); + } else { + lblEmail.setVisibility(View.VISIBLE); + edtEmail.setVisibility(View.VISIBLE); + lblEmail.setText(feedbackOptions.getEmailLabel()); + edtEmail.setHint(feedbackOptions.getEmailPlaceholder()); + if (feedbackOptions.isEmailRequired()) { + lblEmail.append(feedbackOptions.getIsRequiredLabel()); + } + } + + // If Sentry user is set, and useSentryUser is true, populate the name and email + if (feedbackOptions.isUseSentryUser()) { + final @Nullable User user = Sentry.getCurrentScopes().getScope().getUser(); + if (user != null) { + edtName.setText(user.getUsername()); + edtEmail.setText(user.getEmail()); + } + } + + lblMessage.setText(feedbackOptions.getMessageLabel()); + lblMessage.append(feedbackOptions.getIsRequiredLabel()); + edtMessage.setHint(feedbackOptions.getMessagePlaceholder()); + lblTitle.setText(feedbackOptions.getFormTitle()); + + btnSend.setText(feedbackOptions.getSubmitButtonLabel()); + btnSend.setOnClickListener( + v -> { + // Gather fields and trim them + final @NotNull String name = edtName.getText().toString().trim(); + final @NotNull String email = edtEmail.getText().toString().trim(); + final @NotNull String message = edtMessage.getText().toString().trim(); + + // If a required field is missing, shows the error label + if (name.isEmpty() && feedbackOptions.isNameRequired()) { + edtName.setError(lblName.getText()); + return; + } + + if (email.isEmpty() && feedbackOptions.isEmailRequired()) { + edtEmail.setError(lblEmail.getText()); + return; + } + + if (message.isEmpty()) { + edtMessage.setError(lblMessage.getText()); + return; + } + + // Create the feedback object + final @NotNull Feedback feedback = new Feedback(message); + feedback.setName(name); + feedback.setContactEmail(email); + if (associatedEventId != null) { + feedback.setAssociatedEventId(associatedEventId); + } + if (currentReplayId != null) { + feedback.setReplayId(currentReplayId); + } + + // Capture the feedback. If the ID is empty, it means that the feedback was not sent + final @NotNull SentryId id = Sentry.feedback().capture(feedback); + if (!id.equals(SentryId.EMPTY_ID)) { + Toast.makeText( + getContext(), feedbackOptions.getSuccessMessageText(), Toast.LENGTH_SHORT) + .show(); + final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitSuccess = + feedbackOptions.getOnSubmitSuccess(); + if (onSubmitSuccess != null) { + onSubmitSuccess.call(feedback); + } + } else { + final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitError = + feedbackOptions.getOnSubmitError(); + if (onSubmitError != null) { + onSubmitError.call(feedback); + } + } + cancel(); + }); + + btnCancel.setText(feedbackOptions.getCancelButtonLabel()); + btnCancel.setOnClickListener(v -> cancel()); + setOnDismissListener(delegate); + } + + @Override + public void setOnDismissListener(final @Nullable OnDismissListener listener) { + delegate = listener; + // If the user set a custom onDismissListener, we ensure it doesn't override the onFormClose + final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); + final @Nullable Runnable onFormClose = options.getFeedbackOptions().getOnFormClose(); + if (onFormClose != null) { + super.setOnDismissListener( + dialog -> { + onFormClose.run(); + currentReplayId = null; + if (delegate != null) { + delegate.onDismiss(dialog); + } + }); + } else { + super.setOnDismissListener(delegate); + } + } + + @Override + protected void onStart() { + super.onStart(); + final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); + final @NotNull SentryFeedbackOptions feedbackOptions = options.getFeedbackOptions(); + final @Nullable Runnable onFormOpen = feedbackOptions.getOnFormOpen(); + if (onFormOpen != null) { + onFormOpen.run(); + } + options.getReplayController().captureReplay(false); + currentReplayId = options.getReplayController().getReplayId(); + } + + @Override + public void show() { + // If Sentry is disabled, don't show the dialog, but log a warning + final @NotNull IScopes scopes = Sentry.getCurrentScopes(); + final @NotNull SentryOptions options = scopes.getOptions(); + if (!scopes.isEnabled() || !options.isEnabled()) { + options + .getLogger() + .log(SentryLevel.WARNING, "Sentry is disabled. Feedback dialog won't be shown."); + return; + } + // Otherwise, show the dialog + super.show(); + } + + public static class Builder { + + @Nullable OptionsConfiguration configuration; + @Nullable SentryFeedbackOptions.OptionsConfigurator configurator; + @Nullable SentryId associatedEventId; + final @NotNull Context context; + final int themeResId; + + /** + * Creates a builder for a {@link SentryUserFeedbackForm} that uses the default alert dialog + * theme. + * + *

The default alert dialog theme is defined by {@link android.R.attr#alertDialogTheme} + * within the parent {@code context}'s theme. + * + * @param context the parent context + */ + public Builder(final @NotNull Context context) { + this(context, 0); + } + + /** + * Creates a builder for a {@link SentryUserFeedbackForm} that uses an explicit theme resource. + * + *

The specified theme resource ({@code themeResId}) is applied on top of the parent {@code + * context}'s theme. It may be specified as a style resource containing a fully-populated theme, + * such as {@link android.R.style#Theme_Material_Dialog}, to replace all attributes in the + * parent {@code context}'s theme including primary and accent colors. + * + *

To preserve attributes such as primary and accent colors, the {@code themeResId} may + * instead be specified as an overlay theme such as {@link + * android.R.style#ThemeOverlay_Material_Dialog}. This will override only the window attributes + * necessary to style the alert window as a dialog. + * + *

Alternatively, the {@code themeResId} may be specified as {@code 0} to use the parent + * {@code context}'s resolved value for {@link android.R.attr#alertDialogTheme}. + * + * @param context the parent context + * @param themeResId the resource ID of the theme against which to inflate this dialog, or + * {@code 0} to use the parent {@code context}'s default alert dialog theme + */ + public Builder(Context context, int themeResId) { + this(context, themeResId, null); + } + + /** + * Creates a builder for a {@link SentryUserFeedbackForm} that uses the default alert dialog + * theme. The {@code configuration} can be used to configure the feedback options for this + * specific dialog. + * + *

The default alert dialog theme is defined by {@link android.R.attr#alertDialogTheme} + * within the parent {@code context}'s theme. + * + * @param context the parent context + * @param configuration the configuration for the feedback options, can be {@code null} to use + * the global feedback options. + */ + public Builder( + final @NotNull Context context, final @Nullable OptionsConfiguration configuration) { + this(context, 0, configuration); + } + + /** + * Creates a builder for a {@link SentryUserFeedbackForm} that uses an explicit theme resource. + * The {@code configuration} can be used to configure the feedback options for this specific + * dialog. + * + *

The specified theme resource ({@code themeResId}) is applied on top of the parent {@code + * context}'s theme. It may be specified as a style resource containing a fully-populated theme, + * such as {@link android.R.style#Theme_Material_Dialog}, to replace all attributes in the + * parent {@code context}'s theme including primary and accent colors. + * + *

To preserve attributes such as primary and accent colors, the {@code themeResId} may + * instead be specified as an overlay theme such as {@link + * android.R.style#ThemeOverlay_Material_Dialog}. This will override only the window attributes + * necessary to style the alert window as a dialog. + * + *

Alternatively, the {@code themeResId} may be specified as {@code 0} to use the parent + * {@code context}'s resolved value for {@link android.R.attr#alertDialogTheme}. + * + * @param context the parent context + * @param themeResId the resource ID of the theme against which to inflate this dialog, or + * {@code 0} to use the parent {@code context}'s default alert dialog theme + * @param configuration the configuration for the feedback options, can be {@code null} to use + * the global feedback options. + */ + public Builder( + final @NotNull Context context, + final int themeResId, + final @Nullable OptionsConfiguration configuration) { + this.context = context; + this.themeResId = themeResId; + this.configuration = configuration; + } + + /** + * Sets the configuration for the feedback options. + * + * @param configurator the configuration for the feedback options, can be {@code null} to use + * the global feedback options. + */ + public Builder configurator( + final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { + this.configurator = configurator; + return this; + } + + /** + * Sets the associated event ID for the feedback. + * + * @param associatedEventId the associated event ID for the feedback, can be {@code null} to + * avoid associating the feedback to an event. + */ + public Builder associatedEventId(final @Nullable SentryId associatedEventId) { + this.associatedEventId = associatedEventId; + return this; + } + + /** + * Builds a new {@link SentryUserFeedbackForm} with the specified context, theme, and + * configuration. + * + * @return a new instance of {@link SentryUserFeedbackForm} + */ + public SentryUserFeedbackForm create() { + return new SentryUserFeedbackForm( + context, themeResId, associatedEventId, configuration, configurator); + } + } + + /** Configuration callback for feedback options. */ + public interface OptionsConfiguration { + + /** + * configure the feedback options + * + * @param context the context of the feedback dialog + * @param options the feedback options + */ + void configure(final @NotNull Context context, final @NotNull SentryFeedbackOptions options); + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt index be54bf7768b..f8724d286f8 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt @@ -18,7 +18,7 @@ import io.sentry.MainEventProcessor import io.sentry.NoOpContinuousProfiler import io.sentry.NoOpTransactionProfiler import io.sentry.SentryOptions -import io.sentry.android.core.SentryAndroidOptions.AndroidUserFeedbackIDialogHandler +import io.sentry.android.core.SentryAndroidOptions.AndroidUserFeedbackFormHandler import io.sentry.android.core.cache.AndroidEnvelopeCache import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader import io.sentry.android.core.internal.gestures.AndroidViewGestureTargetLocator @@ -882,9 +882,9 @@ class AndroidOptionsInitializerTest { } @Test - fun `AndroidUserFeedbackIDialogHandler is set as feedback dialog handler`() { + fun `AndroidUserFeedbackFormHandler is set as feedback form handler`() { fixture.initSut() - assertIs(fixture.sentryOptions.feedbackOptions.dialogHandler) + assertIs(fixture.sentryOptions.feedbackOptions.formHandler) } @Test diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt index cb940686c30..bddc9395c0d 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt @@ -22,10 +22,10 @@ class FeedbackShakeIntegrationTest { val scopes = mock() val options = SentryAndroidOptions().apply { dsn = "https://key@sentry.io/proj" } val activity = mock() - val dialogHandler = mock() + val formHandler = mock() init { - options.feedbackOptions.setDialogHandler(dialogHandler) + options.feedbackOptions.setFormHandler(formHandler) } fun getSut(useShakeGesture: Boolean = true): FeedbackShakeIntegration { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackDialogTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt similarity index 94% rename from sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackDialogTest.kt rename to sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt index bd60859c608..04f6a35716b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackDialogTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt @@ -26,7 +26,7 @@ import org.mockito.kotlin.verifyNoInteractions import org.mockito.kotlin.whenever @RunWith(AndroidJUnit4::class) -class SentryUserFeedbackDialogTest { +class SentryUserFeedbackFormTest { class Fixture { val application: Context = ApplicationProvider.getApplicationContext() private val mockDsn = "http://key@localhost/proj" @@ -55,10 +55,10 @@ class SentryUserFeedbackDialogTest { fun getSut( associatedEventId: SentryId? = null, - configuration: SentryUserFeedbackDialog.OptionsConfiguration? = null, + configuration: SentryUserFeedbackForm.OptionsConfiguration? = null, configurator: SentryFeedbackOptions.OptionsConfigurator? = null, - ): SentryUserFeedbackDialog = - SentryUserFeedbackDialog(application, 0, associatedEventId, configuration, configurator) + ): SentryUserFeedbackForm = + SentryUserFeedbackForm(application, 0, associatedEventId, configuration, configurator) } private val fixture = Fixture() diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt index 39dfae40203..bfcaf2845b3 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt @@ -28,7 +28,7 @@ import io.sentry.SentryOptions import io.sentry.android.core.AndroidLogger import io.sentry.android.core.R import io.sentry.android.core.SentryUserFeedbackButton -import io.sentry.android.core.SentryUserFeedbackDialog +import io.sentry.android.core.SentryUserFeedbackForm import io.sentry.assertEnvelopeFeedback import io.sentry.protocol.SentryId import io.sentry.protocol.User @@ -49,21 +49,21 @@ class UserFeedbackUiTest : BaseUiTest() { @Test fun userFeedbackNotShownWhenSdkDisabled() { launchActivity().onActivity { - SentryUserFeedbackDialog.Builder(it).create().show() + SentryUserFeedbackForm.Builder(it).create().show() } onView(withId(R.id.sentry_dialog_user_feedback_layout)).check(doesNotExist()) } @Test fun userFeedbackNotShownWhenSdkDisabledViaApi() { - launchActivity().onActivity { Sentry.showUserFeedbackDialog() } + launchActivity().onActivity { Sentry.feedback().show() } onView(withId(R.id.sentry_dialog_user_feedback_layout)).check(doesNotExist()) } @Test fun userFeedbackShownViaApi() { initSentry() - launchActivity().onActivity { Sentry.showUserFeedbackDialog() } + launchActivity().onActivity { Sentry.feedback().show() } onView(withId(R.id.sentry_dialog_user_feedback_layout)) .inRoot(isDialog()) @@ -639,12 +639,12 @@ class UserFeedbackUiTest : BaseUiTest() { private fun showDialogAndCheck( associatedEventId: SentryId? = null, - checker: (dialog: SentryUserFeedbackDialog) -> Unit = {}, + checker: (dialog: SentryUserFeedbackForm) -> Unit = {}, ) { - lateinit var dialog: SentryUserFeedbackDialog + lateinit var dialog: SentryUserFeedbackForm val feedbackScenario = launchActivity() feedbackScenario.onActivity { - dialog = SentryUserFeedbackDialog.Builder(it).associatedEventId(associatedEventId).create() + dialog = SentryUserFeedbackForm.Builder(it).associatedEventId(associatedEventId).create() dialog.show() } diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt index 93460b88893..0836c826d32 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt @@ -21,7 +21,7 @@ public fun SentryUserFeedbackButton( text: String = "Report a Bug", configurator: SentryFeedbackOptions.OptionsConfigurator? = null, ) { - Button(modifier = modifier, onClick = { Sentry.showUserFeedbackDialog(configurator) }) { + Button(modifier = modifier, onClick = { Sentry.feedback().show(configurator) }) { Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center, diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index b9cbb2ae1b2..8bd1e90e094 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -664,6 +664,7 @@ public final class io/sentry/HubAdapter : io/sentry/IHub { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -740,6 +741,7 @@ public final class io/sentry/HubScopesWrapper : io/sentry/IHub { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -834,6 +836,15 @@ public abstract interface class io/sentry/IEnvelopeSender { public abstract fun processEnvelopeFile (Ljava/lang/String;Lio/sentry/Hint;)V } +public abstract interface class io/sentry/IFeedbackApi { + public abstract fun capture (Lio/sentry/protocol/Feedback;)Lio/sentry/protocol/SentryId; + public abstract fun capture (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; + public abstract fun capture (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; + public abstract fun show ()V + public abstract fun show (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V + public abstract fun show (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V +} + public abstract interface class io/sentry/IHub : io/sentry/IScopes { } @@ -1012,6 +1023,7 @@ public abstract interface class io/sentry/IScopes { public abstract fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public abstract fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public abstract fun endSession ()V + public abstract fun feedback ()Lio/sentry/IFeedbackApi; public abstract fun flush (J)V public abstract fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public abstract fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -1569,6 +1581,16 @@ public final class io/sentry/NoOpEnvelopeReader : io/sentry/IEnvelopeReader { public fun read (Ljava/io/InputStream;)Lio/sentry/SentryEnvelope; } +public final class io/sentry/NoOpFeedbackApi : io/sentry/IFeedbackApi { + public fun capture (Lio/sentry/protocol/Feedback;)Lio/sentry/protocol/SentryId; + public fun capture (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; + public fun capture (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; + public static fun getInstance ()Lio/sentry/NoOpFeedbackApi; + public fun show ()V + public fun show (Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V + public fun show (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V +} + public final class io/sentry/NoOpHub : io/sentry/IHub { public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V public fun addBreadcrumb (Lio/sentry/Breadcrumb;Lio/sentry/Hint;)V @@ -1595,6 +1617,7 @@ public final class io/sentry/NoOpHub : io/sentry/IHub { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -1781,6 +1804,7 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -2517,6 +2541,7 @@ public final class io/sentry/Scopes : io/sentry/IScopes { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -2596,6 +2621,7 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes { public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public fun endSession ()V + public fun feedback ()Lio/sentry/IFeedbackApi; public fun flush (J)V public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -2720,6 +2746,7 @@ public final class io/sentry/Sentry { public static fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; public static fun distribution ()Lio/sentry/IDistributionApi; public static fun endSession ()V + public static fun feedback ()Lio/sentry/IFeedbackApi; public static fun flush (J)V public static fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; public static fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; @@ -3151,12 +3178,11 @@ public final class io/sentry/SentryExecutorService : io/sentry/ISentryExecutorSe } public final class io/sentry/SentryFeedbackOptions { - public fun (Lio/sentry/SentryFeedbackOptions$IDialogHandler;)V public fun (Lio/sentry/SentryFeedbackOptions;)V public fun getCancelButtonLabel ()Ljava/lang/CharSequence; - public fun getDialogHandler ()Lio/sentry/SentryFeedbackOptions$IDialogHandler; public fun getEmailLabel ()Ljava/lang/CharSequence; public fun getEmailPlaceholder ()Ljava/lang/CharSequence; + public fun getFormHandler ()Lio/sentry/SentryFeedbackOptions$IFormHandler; public fun getFormTitle ()Ljava/lang/CharSequence; public fun getIsRequiredLabel ()Ljava/lang/CharSequence; public fun getMessageLabel ()Ljava/lang/CharSequence; @@ -3177,10 +3203,10 @@ public final class io/sentry/SentryFeedbackOptions { public fun isUseSentryUser ()Z public fun isUseShakeGesture ()Z public fun setCancelButtonLabel (Ljava/lang/CharSequence;)V - public fun setDialogHandler (Lio/sentry/SentryFeedbackOptions$IDialogHandler;)V public fun setEmailLabel (Ljava/lang/CharSequence;)V public fun setEmailPlaceholder (Ljava/lang/CharSequence;)V public fun setEmailRequired (Z)V + public fun setFormHandler (Lio/sentry/SentryFeedbackOptions$IFormHandler;)V public fun setFormTitle (Ljava/lang/CharSequence;)V public fun setIsRequiredLabel (Ljava/lang/CharSequence;)V public fun setMessageLabel (Ljava/lang/CharSequence;)V @@ -3202,8 +3228,8 @@ public final class io/sentry/SentryFeedbackOptions { public fun toString ()Ljava/lang/String; } -public abstract interface class io/sentry/SentryFeedbackOptions$IDialogHandler { - public abstract fun showDialog (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V +public abstract interface class io/sentry/SentryFeedbackOptions$IFormHandler { + public abstract fun showForm (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V } public abstract interface class io/sentry/SentryFeedbackOptions$OptionsConfigurator { diff --git a/sentry/src/main/java/io/sentry/FeedbackApi.java b/sentry/src/main/java/io/sentry/FeedbackApi.java new file mode 100644 index 00000000000..b8b8a3c9b9a --- /dev/null +++ b/sentry/src/main/java/io/sentry/FeedbackApi.java @@ -0,0 +1,51 @@ +package io.sentry; + +import io.sentry.protocol.Feedback; +import io.sentry.protocol.SentryId; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +final class FeedbackApi implements IFeedbackApi { + + private final @NotNull IScopes scopes; + + FeedbackApi(final @NotNull IScopes scopes) { + this.scopes = scopes; + } + + @Override + public void show() { + show(null, null); + } + + @Override + public void show(final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { + show(null, configurator); + } + + @Override + public void show( + final @Nullable SentryId associatedEventId, + final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { + final @NotNull SentryOptions options = scopes.getOptions(); + options.getFeedbackOptions().getFormHandler().showForm(associatedEventId, configurator); + } + + @Override + public @NotNull SentryId capture(final @NotNull Feedback feedback) { + return scopes.captureFeedback(feedback); + } + + @Override + public @NotNull SentryId capture(final @NotNull Feedback feedback, final @Nullable Hint hint) { + return scopes.captureFeedback(feedback, hint); + } + + @Override + public @NotNull SentryId capture( + final @NotNull Feedback feedback, + final @Nullable Hint hint, + final @Nullable ScopeCallback callback) { + return scopes.captureFeedback(feedback, hint, callback); + } +} diff --git a/sentry/src/main/java/io/sentry/HubAdapter.java b/sentry/src/main/java/io/sentry/HubAdapter.java index cf90eb1fe65..5e2d91a9ae8 100644 --- a/sentry/src/main/java/io/sentry/HubAdapter.java +++ b/sentry/src/main/java/io/sentry/HubAdapter.java @@ -395,6 +395,11 @@ public void reportFullyDisplayed() { return Sentry.getCurrentScopes().metrics(); } + @Override + public @NotNull IFeedbackApi feedback() { + return Sentry.getCurrentScopes().feedback(); + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) { Sentry.setAttribute(key, value); diff --git a/sentry/src/main/java/io/sentry/HubScopesWrapper.java b/sentry/src/main/java/io/sentry/HubScopesWrapper.java index 66a34b4dc36..00395292fd5 100644 --- a/sentry/src/main/java/io/sentry/HubScopesWrapper.java +++ b/sentry/src/main/java/io/sentry/HubScopesWrapper.java @@ -380,6 +380,11 @@ public void reportFullyDisplayed() { return scopes.metrics(); } + @Override + public @NotNull IFeedbackApi feedback() { + return scopes.feedback(); + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) { scopes.setAttribute(key, value); diff --git a/sentry/src/main/java/io/sentry/IFeedbackApi.java b/sentry/src/main/java/io/sentry/IFeedbackApi.java new file mode 100644 index 00000000000..5bab630fa8b --- /dev/null +++ b/sentry/src/main/java/io/sentry/IFeedbackApi.java @@ -0,0 +1,29 @@ +package io.sentry; + +import io.sentry.protocol.Feedback; +import io.sentry.protocol.SentryId; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public interface IFeedbackApi { + + void show(); + + void show(final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator); + + void show( + final @Nullable SentryId associatedEventId, + final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator); + + @NotNull + SentryId capture(final @NotNull Feedback feedback); + + @NotNull + SentryId capture(final @NotNull Feedback feedback, final @Nullable Hint hint); + + @NotNull + SentryId capture( + final @NotNull Feedback feedback, + final @Nullable Hint hint, + final @Nullable ScopeCallback callback); +} diff --git a/sentry/src/main/java/io/sentry/IScopes.java b/sentry/src/main/java/io/sentry/IScopes.java index b1b437f72e5..26ea0dcc3ea 100644 --- a/sentry/src/main/java/io/sentry/IScopes.java +++ b/sentry/src/main/java/io/sentry/IScopes.java @@ -217,7 +217,10 @@ SentryId captureException( * Captures a manually created user feedback and sends it to Sentry. * * @param userFeedback The user feedback to send to Sentry. + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#capture(io.sentry.protocol.Feedback) + * capture(feedback)} with the new {@link io.sentry.protocol.Feedback} type instead. */ + @Deprecated void captureUserFeedback(@NotNull UserFeedback userFeedback); /** Starts a new session. If there's a running session, it ends it before starting the new one. */ @@ -748,6 +751,9 @@ default boolean isNoOp() { @NotNull IMetricsApi metrics(); + @NotNull + IFeedbackApi feedback(); + /** * Sets an attribute. * diff --git a/sentry/src/main/java/io/sentry/ISentryClient.java b/sentry/src/main/java/io/sentry/ISentryClient.java index 98b6034bb78..2a1df15f812 100644 --- a/sentry/src/main/java/io/sentry/ISentryClient.java +++ b/sentry/src/main/java/io/sentry/ISentryClient.java @@ -174,7 +174,10 @@ SentryId captureReplayEvent( * Captures a manually created user feedback and sends it to Sentry. * * @param userFeedback The user feedback to send to Sentry. + * @deprecated Use {@link IFeedbackApi#capture(io.sentry.protocol.Feedback)} with the new {@link + * io.sentry.protocol.Feedback} type instead. */ + @Deprecated void captureUserFeedback(@NotNull UserFeedback userFeedback); /** diff --git a/sentry/src/main/java/io/sentry/JsonSerializer.java b/sentry/src/main/java/io/sentry/JsonSerializer.java index a0fa80879aa..2b24090d0cc 100644 --- a/sentry/src/main/java/io/sentry/JsonSerializer.java +++ b/sentry/src/main/java/io/sentry/JsonSerializer.java @@ -72,6 +72,7 @@ public final class JsonSerializer implements ISerializer { /** * All our custom deserializers need to be registered to be used with the deserializer instance. * */ + @SuppressWarnings("deprecation") public JsonSerializer(@NotNull SentryOptions options) { this.options = options; diff --git a/sentry/src/main/java/io/sentry/NoOpFeedbackApi.java b/sentry/src/main/java/io/sentry/NoOpFeedbackApi.java new file mode 100644 index 00000000000..bdef5d37590 --- /dev/null +++ b/sentry/src/main/java/io/sentry/NoOpFeedbackApi.java @@ -0,0 +1,46 @@ +package io.sentry; + +import io.sentry.protocol.Feedback; +import io.sentry.protocol.SentryId; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public final class NoOpFeedbackApi implements IFeedbackApi { + + private static final NoOpFeedbackApi instance = new NoOpFeedbackApi(); + + private NoOpFeedbackApi() {} + + public static NoOpFeedbackApi getInstance() { + return instance; + } + + @Override + public void show() {} + + @Override + public void show(final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) {} + + @Override + public void show( + final @Nullable SentryId associatedEventId, + final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) {} + + @Override + public @NotNull SentryId capture(final @NotNull Feedback feedback) { + return SentryId.EMPTY_ID; + } + + @Override + public @NotNull SentryId capture(final @NotNull Feedback feedback, final @Nullable Hint hint) { + return SentryId.EMPTY_ID; + } + + @Override + public @NotNull SentryId capture( + final @NotNull Feedback feedback, + final @Nullable Hint hint, + final @Nullable ScopeCallback callback) { + return SentryId.EMPTY_ID; + } +} diff --git a/sentry/src/main/java/io/sentry/NoOpHub.java b/sentry/src/main/java/io/sentry/NoOpHub.java index 4a02be1bd40..d5ef143d342 100644 --- a/sentry/src/main/java/io/sentry/NoOpHub.java +++ b/sentry/src/main/java/io/sentry/NoOpHub.java @@ -80,6 +80,7 @@ public boolean isEnabled() { return SentryId.EMPTY_ID; } + @Deprecated @Override public void captureUserFeedback(@NotNull UserFeedback userFeedback) {} @@ -338,6 +339,11 @@ public boolean isNoOp() { return NoOpMetricsApi.getInstance(); } + @Override + public @NotNull IFeedbackApi feedback() { + return NoOpFeedbackApi.getInstance(); + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) {} diff --git a/sentry/src/main/java/io/sentry/NoOpScopes.java b/sentry/src/main/java/io/sentry/NoOpScopes.java index 1ae357d502e..345c74cc0ee 100644 --- a/sentry/src/main/java/io/sentry/NoOpScopes.java +++ b/sentry/src/main/java/io/sentry/NoOpScopes.java @@ -77,6 +77,7 @@ public boolean isEnabled() { return SentryId.EMPTY_ID; } + @Deprecated @Override public void captureUserFeedback(@NotNull UserFeedback userFeedback) {} @@ -336,6 +337,11 @@ public boolean isNoOp() { return NoOpMetricsApi.getInstance(); } + @Override + public @NotNull IFeedbackApi feedback() { + return NoOpFeedbackApi.getInstance(); + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) {} diff --git a/sentry/src/main/java/io/sentry/NoOpSentryClient.java b/sentry/src/main/java/io/sentry/NoOpSentryClient.java index 961ef9031be..ac9ff2344bf 100644 --- a/sentry/src/main/java/io/sentry/NoOpSentryClient.java +++ b/sentry/src/main/java/io/sentry/NoOpSentryClient.java @@ -44,6 +44,7 @@ public void flush(long timeoutMillis) {} return SentryId.EMPTY_ID; } + @Deprecated @Override public void captureUserFeedback(@NotNull UserFeedback userFeedback) {} diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index 82c03feac4b..3b67b94916e 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -34,6 +34,7 @@ public final class Scopes implements IScopes { private final @NotNull CombinedScopeView combinedScope; private final @NotNull ILoggerApi logger; private final @NotNull IMetricsApi metrics; + private final @NotNull IFeedbackApi feedbackApi; public Scopes( final @NotNull IScope scope, @@ -61,6 +62,7 @@ private Scopes( this.compositePerformanceCollector = options.getCompositePerformanceCollector(); this.logger = new LoggerApi(this); this.metrics = new MetricsApi(this); + this.feedbackApi = new FeedbackApi(this); } public @NotNull String getCreator() { @@ -344,6 +346,7 @@ private void assignTraceContext(final @NotNull SentryEvent event) { return sentryId; } + @Deprecated @Override public void captureUserFeedback(final @NotNull UserFeedback userFeedback) { if (!isEnabled()) { @@ -1245,6 +1248,11 @@ public void reportFullyDisplayed() { return metrics; } + @Override + public @NotNull IFeedbackApi feedback() { + return feedbackApi; + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) { if (!isEnabled()) { diff --git a/sentry/src/main/java/io/sentry/ScopesAdapter.java b/sentry/src/main/java/io/sentry/ScopesAdapter.java index b66b681a332..b697a950501 100644 --- a/sentry/src/main/java/io/sentry/ScopesAdapter.java +++ b/sentry/src/main/java/io/sentry/ScopesAdapter.java @@ -51,18 +51,18 @@ public boolean isEnabled() { @Override public @NotNull SentryId captureFeedback(@NotNull Feedback feedback) { - return Sentry.captureFeedback(feedback); + return Sentry.feedback().capture(feedback); } @Override public @NotNull SentryId captureFeedback(@NotNull Feedback feedback, @Nullable Hint hint) { - return Sentry.captureFeedback(feedback, hint); + return Sentry.feedback().capture(feedback, hint); } @Override public @NotNull SentryId captureFeedback( @NotNull Feedback feedback, @Nullable Hint hint, @Nullable ScopeCallback callback) { - return Sentry.captureFeedback(feedback, hint, callback); + return Sentry.feedback().capture(feedback, hint, callback); } @ApiStatus.Internal @@ -82,6 +82,7 @@ public boolean isEnabled() { return Sentry.captureException(throwable, hint, callback); } + @Deprecated @Override public void captureUserFeedback(@NotNull UserFeedback userFeedback) { Sentry.captureUserFeedback(userFeedback); @@ -392,6 +393,11 @@ public void reportFullyDisplayed() { return Sentry.getCurrentScopes().metrics(); } + @Override + public @NotNull IFeedbackApi feedback() { + return Sentry.getCurrentScopes().feedback(); + } + @Override public void setAttribute(final @Nullable String key, final @Nullable Object value) { Sentry.setAttribute(key, value); diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index fee19dc4d09..919607e5879 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -827,40 +827,37 @@ public static void close() { } /** - * Captures the feedback. - * - * @param feedback The feedback to send. - * @return The Id (SentryId object) of the event + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#capture(Feedback) capture(feedback)} + * instead. */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static @NotNull SentryId captureFeedback(final @NotNull Feedback feedback) { - return getCurrentScopes().captureFeedback(feedback); + return feedback().capture(feedback); } /** - * Captures the feedback. - * - * @param feedback The feedback to send. - * @param hint An optional hint to be applied to the event. - * @return The Id (SentryId object) of the event + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#capture(Feedback, Hint) + * capture(feedback, hint)} instead. */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static @NotNull SentryId captureFeedback( final @NotNull Feedback feedback, final @Nullable Hint hint) { - return getCurrentScopes().captureFeedback(feedback, hint); + return feedback().capture(feedback, hint); } /** - * Captures the feedback. - * - * @param feedback The feedback to send. - * @param hint An optional hint to be applied to the event. - * @param callback The callback to configure the scope for a single invocation. - * @return The Id (SentryId object) of the event + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#capture(Feedback, Hint, ScopeCallback) + * capture(feedback, hint, callback)} instead. */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static @NotNull SentryId captureFeedback( final @NotNull Feedback feedback, final @Nullable Hint hint, final @Nullable ScopeCallback callback) { - return getCurrentScopes().captureFeedback(feedback, hint, callback); + return feedback().capture(feedback, hint, callback); } /** @@ -916,7 +913,11 @@ public static void close() { * Captures a manually created user feedback and sends it to Sentry. * * @param userFeedback The user feedback to send to Sentry. + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#capture(Feedback) capture(feedback)} + * with the new {@link Feedback} type instead. */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static void captureUserFeedback(final @NotNull UserFeedback userFeedback) { getCurrentScopes().captureUserFeedback(userFeedback); } @@ -1355,20 +1356,41 @@ public static IMetricsApi metrics() { return getCurrentScopes().metrics(); } + @NotNull + public static IFeedbackApi feedback() { + return getCurrentScopes().feedback(); + } + + /** + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#show() show()} instead. + */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static void showUserFeedbackDialog() { - showUserFeedbackDialog(null); + feedback().show(); } + /** + * @deprecated Use {@link #feedback()}.{@link + * IFeedbackApi#show(SentryFeedbackOptions.OptionsConfigurator) show(configurator)} instead. + */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static void showUserFeedbackDialog( final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { - showUserFeedbackDialog(null, configurator); + feedback().show(configurator); } + /** + * @deprecated Use {@link #feedback()}.{@link IFeedbackApi#show(SentryId, + * SentryFeedbackOptions.OptionsConfigurator) show(associatedEventId, configurator)} instead. + */ + @Deprecated + @SuppressWarnings("InlineMeSuggester") public static void showUserFeedbackDialog( final @Nullable SentryId associatedEventId, final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { - final @NotNull SentryOptions options = getCurrentScopes().getOptions(); - options.getFeedbackOptions().getDialogHandler().showDialog(associatedEventId, configurator); + feedback().show(associatedEventId, configurator); } /** diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index b8178e35517..c99fcaeaa2f 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -688,6 +688,7 @@ private SentryEvent processFeedbackEvent( return feedbackEvent; } + @Deprecated @Override public void captureUserFeedback(final @NotNull UserFeedback userFeedback) { Objects.requireNonNull(userFeedback, "SentryEvent is required."); @@ -714,6 +715,7 @@ public void captureUserFeedback(final @NotNull UserFeedback userFeedback) { } } + @Deprecated private @NotNull SentryEnvelope buildEnvelope(final @NotNull UserFeedback userFeedback) { final List envelopeItems = new ArrayList<>(); diff --git a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java index dd47d2b99d0..dbbc36524db 100644 --- a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java +++ b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java @@ -169,6 +169,7 @@ public final class SentryEnvelopeItem { } } + @Deprecated public static SentryEnvelopeItem fromUserFeedback( final @NotNull ISerializer serializer, final @NotNull UserFeedback userFeedback) { Objects.requireNonNull(serializer, "ISerializer is required."); diff --git a/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java b/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java index 2a0ead54234..a72b352317e 100644 --- a/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java +++ b/sentry/src/main/java/io/sentry/SentryFeedbackOptions.java @@ -91,10 +91,10 @@ public final class SentryFeedbackOptions { /** Callback called when there is an error submitting feedback via the prepared form. */ private @Nullable SentryFeedbackCallback onSubmitError; - private @NotNull IDialogHandler iDialogHandler; + private @NotNull IFormHandler iFormHandler; - public SentryFeedbackOptions(@NotNull IDialogHandler iDialogHandler) { - this.iDialogHandler = iDialogHandler; + SentryFeedbackOptions(@NotNull IFormHandler iFormHandler) { + this.iFormHandler = iFormHandler; } /** Creates a copy of the passed {@link SentryFeedbackOptions}. */ @@ -121,7 +121,7 @@ public SentryFeedbackOptions(final @NotNull SentryFeedbackOptions other) { this.onFormClose = other.onFormClose; this.onSubmitSuccess = other.onSubmitSuccess; this.onSubmitError = other.onSubmitError; - this.iDialogHandler = other.iDialogHandler; + this.iFormHandler = other.iFormHandler; } /** @@ -535,23 +535,23 @@ public void setOnSubmitError(final @Nullable SentryFeedbackCallback onSubmitErro } /** - * Sets the dialog handler to be used to show the feedback form. + * Sets the form handler to be used to show the feedback form. * - * @param iDialogHandler the dialog handler to be used to show the feedback form + * @param iFormHandler the form handler to be used to show the feedback form */ @ApiStatus.Internal - public void setDialogHandler(final @NotNull IDialogHandler iDialogHandler) { - this.iDialogHandler = iDialogHandler; + public void setFormHandler(final @NotNull IFormHandler iFormHandler) { + this.iFormHandler = iFormHandler; } /** - * Gets the dialog handler to be used to show the feedback form. + * Gets the form handler to be used to show the feedback form. * - * @return the dialog handler to be used to show the feedback form + * @return the form handler to be used to show the feedback form */ @ApiStatus.Internal - public @NotNull IDialogHandler getDialogHandler() { - return iDialogHandler; + public @NotNull IFormHandler getFormHandler() { + return iFormHandler; } @Override @@ -609,8 +609,8 @@ public interface SentryFeedbackCallback { } @ApiStatus.Internal - public interface IDialogHandler { - void showDialog( + public interface IFormHandler { + void showForm( final @Nullable SentryId associatedEventId, final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator); } diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 86086f8816b..a6f78cfad9c 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -3397,7 +3397,7 @@ private SentryOptions(final boolean empty) { feedbackOptions = new SentryFeedbackOptions( (associatedEventId, configurator) -> - logger.log(SentryLevel.WARNING, "showDialog() can only be called in Android.")); + logger.log(SentryLevel.WARNING, "showForm() can only be called in Android.")); if (!empty) { setSpanFactory(SpanFactoryFactory.create(new LoadClass(), NoOpLogger.getInstance())); diff --git a/sentry/src/main/java/io/sentry/UserFeedback.java b/sentry/src/main/java/io/sentry/UserFeedback.java index b580744ee77..b9d0ade0f9d 100644 --- a/sentry/src/main/java/io/sentry/UserFeedback.java +++ b/sentry/src/main/java/io/sentry/UserFeedback.java @@ -8,7 +8,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -/** Adds additional information about what happened to an event. */ +/** + * Adds additional information about what happened to an event. + * + * @deprecated Use {@link io.sentry.protocol.Feedback} with {@link Sentry#feedback()}.{@link + * IFeedbackApi#capture(io.sentry.protocol.Feedback) capture(feedback)} instead. + */ +@Deprecated public final class UserFeedback implements JsonUnknown, JsonSerializable { private final SentryId eventId; diff --git a/sentry/src/test/java/io/sentry/HubAdapterTest.kt b/sentry/src/test/java/io/sentry/HubAdapterTest.kt index 9b97d8935f7..0dbb6a43c11 100644 --- a/sentry/src/test/java/io/sentry/HubAdapterTest.kt +++ b/sentry/src/test/java/io/sentry/HubAdapterTest.kt @@ -14,6 +14,7 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.reset import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever class HubAdapterTest { val scopes: IScopes = mock() @@ -63,6 +64,7 @@ class HubAdapterTest { val hint = Hint() val scopeCallback = mock() val feedback = Feedback("message") + whenever(scopes.feedback()).thenReturn(FeedbackApi(scopes)) HubAdapter.getInstance().captureFeedback(feedback) verify(scopes).captureFeedback(eq(feedback)) diff --git a/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt b/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt index 43cb5b155a7..1de22cfd3c3 100644 --- a/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt @@ -14,6 +14,7 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.reset import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever class ScopesAdapterTest { val scopes: IScopes = mock() @@ -63,6 +64,7 @@ class ScopesAdapterTest { val scopeCallback = mock() val hint = mock() val feedback = Feedback("message") + whenever(scopes.feedback()).thenReturn(FeedbackApi(scopes)) ScopesAdapter.getInstance().captureFeedback(feedback) verify(scopes).captureFeedback(eq(feedback)) diff --git a/sentry/src/test/java/io/sentry/SentryFeedbackOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryFeedbackOptionsTest.kt index a50aff02dc5..e4b96cb17d0 100644 --- a/sentry/src/test/java/io/sentry/SentryFeedbackOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryFeedbackOptionsTest.kt @@ -1,6 +1,6 @@ package io.sentry -import io.sentry.SentryFeedbackOptions.IDialogHandler +import io.sentry.SentryFeedbackOptions.IFormHandler import kotlin.test.Test import kotlin.test.assertEquals import org.mockito.kotlin.mock @@ -8,7 +8,7 @@ import org.mockito.kotlin.mock class SentryFeedbackOptionsTest { @Test fun `feedback options is initialized with default values`() { - val options = SentryFeedbackOptions(mock()) + val options = SentryFeedbackOptions(mock()) assertEquals(false, options.isNameRequired) assertEquals(true, options.isShowName) assertEquals(false, options.isEmailRequired) @@ -35,7 +35,7 @@ class SentryFeedbackOptionsTest { @Test fun `feedback options copy constructor`() { val options = - SentryFeedbackOptions(mock()).apply { + SentryFeedbackOptions(mock()).apply { isNameRequired = true isShowName = false isEmailRequired = true @@ -80,6 +80,6 @@ class SentryFeedbackOptionsTest { assertEquals(options.onFormClose, optionsCopy.onFormClose) assertEquals(options.onSubmitSuccess, optionsCopy.onSubmitSuccess) assertEquals(options.onSubmitError, optionsCopy.onSubmitError) - assertEquals(options.dialogHandler, optionsCopy.dialogHandler) + assertEquals(options.formHandler, optionsCopy.formHandler) } } diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index da014b30f74..e08d0ed8f72 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -907,8 +907,8 @@ class SentryOptionsTest { setLogger(logger) isDebug = true } - options.feedbackOptions.dialogHandler.showDialog(mock(), mock()) - verify(logger).log(eq(SentryLevel.WARNING), eq("showDialog() can only be called in Android.")) + options.feedbackOptions.formHandler.showForm(mock(), mock()) + verify(logger).log(eq(SentryLevel.WARNING), eq("showForm() can only be called in Android.")) } @Test diff --git a/sentry/src/test/java/io/sentry/SentryTest.kt b/sentry/src/test/java/io/sentry/SentryTest.kt index 25f45816b74..3712b083de7 100644 --- a/sentry/src/test/java/io/sentry/SentryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTest.kt @@ -1,6 +1,6 @@ package io.sentry -import io.sentry.SentryFeedbackOptions.IDialogHandler +import io.sentry.SentryFeedbackOptions.IFormHandler import io.sentry.SentryOptions.ProfilesSamplerCallback import io.sentry.SentryOptions.TracesSamplerCallback import io.sentry.backpressure.BackpressureMonitor @@ -1504,39 +1504,39 @@ class SentryTest { } @Test - fun `showUserFeedbackDialog forwards to feedbackOptions_dialogHandler`() { - val mockDialogHandler = mock() + fun `feedback show forwards to feedbackOptions_formHandler`() { + val mockFormHandler = mock() initForTest { it.dsn = dsn - it.feedbackOptions.dialogHandler = mockDialogHandler + it.feedbackOptions.setFormHandler(mockFormHandler) } - Sentry.showUserFeedbackDialog() - verify(mockDialogHandler).showDialog(eq(null), eq(null)) + Sentry.feedback().show() + verify(mockFormHandler).showForm(eq(null), eq(null)) } @Test - fun `showUserFeedbackDialog forwards to feedbackOptions_dialogHandler with configurator`() { - val mockDialogHandler = mock() + fun `feedback show forwards to feedbackOptions_formHandler with configurator`() { + val mockFormHandler = mock() val configurator = mock() initForTest { it.dsn = dsn - it.feedbackOptions.dialogHandler = mockDialogHandler + it.feedbackOptions.setFormHandler(mockFormHandler) } - Sentry.showUserFeedbackDialog(configurator) - verify(mockDialogHandler).showDialog(eq(null), eq(configurator)) + Sentry.feedback().show(configurator) + verify(mockFormHandler).showForm(eq(null), eq(configurator)) } @Test - fun `showUserFeedbackDialog forwards to feedbackOptions_dialogHandler with associatedEventId and configurator`() { - val mockDialogHandler = mock() + fun `feedback show forwards to feedbackOptions_formHandler with associatedEventId and configurator`() { + val mockFormHandler = mock() val configurator = mock() val associatedEventId = SentryId() initForTest { it.dsn = dsn - it.feedbackOptions.dialogHandler = mockDialogHandler + it.feedbackOptions.setFormHandler(mockFormHandler) } - Sentry.showUserFeedbackDialog(associatedEventId, configurator) - verify(mockDialogHandler).showDialog(eq(associatedEventId), eq(configurator)) + Sentry.feedback().show(associatedEventId, configurator) + verify(mockFormHandler).showForm(eq(associatedEventId), eq(configurator)) } @Test From e63ad341cb0d79622e0dbafcf1fe9a2ec5e5f12b Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 30 Apr 2026 13:26:36 +0200 Subject: [PATCH 125/391] ref(feedback): Deprecate SentryUserFeedbackButton (#5350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ref(feedback): Rename Dialog to Form across feedback APIs Rename SentryUserFeedbackDialog to SentryUserFeedbackForm as the primary class. Keep SentryUserFeedbackDialog as a deprecated subclass for backward compatibility. Also rename internal APIs to use Form naming consistently: - IDialogHandler -> IFormHandler - showDialog -> showForm - setDialogHandler/getDialogHandler -> setFormHandler/getFormHandler - AndroidUserFeedbackIDialogHandler -> AndroidUserFeedbackFormHandler Add deprecated Sentry.showUserFeedbackDialog() overloads that delegate to the new Sentry.showUserFeedbackForm() methods. Co-Authored-By: Claude Opus 4.6 * fix(feedback): Preserve binary compatibility for deprecated Builder constructors Use SentryUserFeedbackDialog.OptionsConfiguration as the parameter type in the deprecated Builder constructors so old compiled code looking for the original descriptor still resolves correctly. Co-Authored-By: Claude Opus 4.6 * Make internal ctor package-private * Add missing deprecated annotaiton * Fix api * docs(changelog): Add deprecation entry for feedback Dialog to Form rename Co-Authored-By: Claude Opus 4.6 * docs(changelog): Note removal in next major version Co-Authored-By: Claude Opus 4.6 * feat(feedback): Add Sentry.feedback() API Introduce IFeedbackApi with showForm() and capture() methods, accessible via Sentry.feedback(). This consolidates all feedback operations under a single API entry point. Deprecate Sentry.showUserFeedbackForm(), Sentry.showUserFeedbackDialog(), Sentry.captureFeedback(), and Sentry.captureUserFeedback() in favor of the new Sentry.feedback() API. All deprecated methods will be removed in the next major version. Co-Authored-By: Claude Opus 4.6 * docs(changelog): Update section to Features and remove unpublished API Co-Authored-By: Claude Opus 4.6 * ref(feedback): Move FeedbackApi to IScopes Add feedback() method to IScopes, matching the pattern used by logger() and metrics(). FeedbackApi takes an IScopes reference instead of using Sentry.getCurrentScopes() statically. Implemented in Scopes, NoOpScopes, NoOpHub, HubAdapter, HubScopesWrapper, and ScopesAdapter. Sentry.feedback() now delegates to getCurrentScopes().feedback(). Co-Authored-By: Claude Opus 4.6 * ref: Rename showForm() to show() on IFeedbackApi Since the method is already namespaced under feedback(), the extra "Form" suffix is redundant. This aligns with the convention used by logger() and metrics(). Co-Authored-By: Claude Opus 4.6 * chore: Deprecate UserFeedback and captureUserFeedback, delete showUserFeedbackForm Deprecate the old `UserFeedback` class and `captureUserFeedback()` across IScopes, ISentryClient, and all implementations in favor of `Sentry.feedback().capture()` with the new `Feedback` type. Delete `Sentry.showUserFeedbackForm()` (3 overloads) as it was never published. Co-Authored-By: Claude Opus 4.6 * chore: Deprecate SentryEnvelopeItem.fromUserFeedback() Co-Authored-By: Claude Opus 4.6 * chore: Deprecate SentryClient.buildEnvelope(UserFeedback) Co-Authored-By: Claude Opus 4.6 * ref: Remove unnecessary SuppressWarnings("deprecation") Deprecated methods don't need to suppress deprecation warnings for referencing other deprecated types — the deprecation annotation itself is sufficient. Co-Authored-By: Claude Opus 4.6 * fix test * remove redudndant deprecated annotations * fix test * ref(feedback): Deprecate SentryUserFeedbackButton * Changelog * chore: Deprecate SentryUserFeedbackButton in sentry-compose Co-Authored-By: Claude Opus 4.6 * changelog * message --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 2 ++ .../io/sentry/android/core/SentryUserFeedbackButton.java | 8 ++++++++ .../kotlin/io/sentry/compose/SentryUserFeedbackButton.kt | 1 + 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d1a581769c..beabdfb7f15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - `Sentry.captureUserFeedback()` and `UserFeedback` are deprecated in favor of `Sentry.feedback().capture()` with the new `Feedback` type - `SentryUserFeedbackDialog` is deprecated in favor of `SentryUserFeedbackForm` - All deprecated APIs will be removed in the next major version +- Deprecate `SentryUserFeedbackButton` (View-based and Compose-based) ([#5350](https://github.com/getsentry/sentry-java/pull/5350)) + - It will be removed in the next major version ### Dependencies diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java index 729dfd0b4e7..f842f18674b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java @@ -10,25 +10,33 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * @deprecated `SentryUserFeedbackButton` will be removed in the next major version + */ +@Deprecated public class SentryUserFeedbackButton extends Button { private @Nullable OnClickListener delegate; + @Deprecated public SentryUserFeedbackButton(Context context) { super(context); init(context, null, 0, 0); } + @Deprecated public SentryUserFeedbackButton(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs, 0, 0); } + @Deprecated public SentryUserFeedbackButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs, defStyleAttr, 0); } + @Deprecated public SentryUserFeedbackButton( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt index 0836c826d32..d82451b79e2 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryUserFeedbackButton.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.unit.dp import io.sentry.Sentry import io.sentry.SentryFeedbackOptions +@Deprecated("`SentryUserFeedbackButton` will be removed in the next major version") @Composable public fun SentryUserFeedbackButton( modifier: Modifier = Modifier, From 867648ba476b1a8bf3febf364387743e635cdf58 Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Mon, 4 May 2026 08:06:33 +0200 Subject: [PATCH 126/391] fix: git-fallback for tombstone proto schema check (#5356) --- scripts/check-tombstone-proto-schema.sh | 228 ++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 17 deletions(-) diff --git a/scripts/check-tombstone-proto-schema.sh b/scripts/check-tombstone-proto-schema.sh index abb7212c4af..ecf492af7e8 100755 --- a/scripts/check-tombstone-proto-schema.sh +++ b/scripts/check-tombstone-proto-schema.sh @@ -1,25 +1,219 @@ #!/usr/bin/env bash -set -euo pipefail +set -Eeuo pipefail TRACKED_COMMIT="981d145117e8992842cdddee555c57e60c7a220a" +REMOTE_URL='https://android.googlesource.com/platform/system/core' +REMOTE_BRANCH='main' +PROTO_PATH='debuggerd/proto/tombstone.proto' +GITILES_REF="refs/heads/${REMOTE_BRANCH}" +GITILES_LOG_URL="${REMOTE_URL}/+log/${GITILES_REF}/${PROTO_PATH}?format=JSON" -# tail -n +2 to remove the magic anti-XSSI prefix from the Gitiles JSON response -LATEST_COMMIT=$(curl -sf \ - 'https://android.googlesource.com/platform/system/core/+log/refs/heads/main/debuggerd/proto/tombstone.proto?format=JSON' \ - | tail -n +2 \ - | jq -r '.log[0].commit') +MODE=auto +case "${1:-}" in + "") + ;; + --git-only) + MODE=git + ;; + --gitiles-only) + MODE=gitiles + ;; + *) + echo "Usage: $0 [--git-only|--gitiles-only]" >&2 + exit 2 + ;; +esac -if [ -z "$LATEST_COMMIT" ] || [ "$LATEST_COMMIT" = "null" ]; then - echo "ERROR: Failed to fetch latest commit from Gitiles" >&2 - exit 1 -fi +TEMP_FILES=() +TEMP_DIRS=() +LATEST_COMMIT="" -echo "Tracked commit: $TRACKED_COMMIT" -echo "Latest commit: $LATEST_COMMIT" +error() { + echo "ERROR: $*" >&2 +} -if [ "$LATEST_COMMIT" != "$TRACKED_COMMIT" ]; then - echo "Schema has been updated! Latest: https://android.googlesource.com/platform/system/core/+/${LATEST_COMMIT}/debuggerd/proto/tombstone.proto" - exit 1 -fi +show_output() { + local label=$1 + local file=$2 -echo "Schema is up to date." + if [ -s "$file" ]; then + echo "$label:" >&2 + sed 's/^/ /' "$file" >&2 + fi +} + +require_command() { + local command_name=$1 + + if ! command -v "$command_name" >/dev/null 2>&1; then + error "Required command not found: $command_name" + return 1 + fi +} + +make_temp_file() { + local file + file=$(mktemp) + TEMP_FILES+=("$file") + printf '%s\n' "$file" +} + +make_temp_dir() { + local dir + dir=$(mktemp -d) + TEMP_DIRS+=("$dir") + printf '%s\n' "$dir" +} + +cleanup() { + local path + + for path in "${TEMP_FILES[@]}"; do + rm -f "$path" + done + + for path in "${TEMP_DIRS[@]}"; do + rm -rf "$path" + done +} + +handle_unexpected_error() { + local exit_code=$? + error "Unexpected failure at line $1 while running: $2 (exit $exit_code)" + exit "$exit_code" +} + +trap 'handle_unexpected_error "$LINENO" "$BASH_COMMAND"' ERR +trap cleanup EXIT + +run_gitiles_check() { + local response_file + local stderr_file + local status + + require_command curl || return 1 + require_command jq || return 1 + + response_file=$(make_temp_file) + stderr_file=$(make_temp_file) + + if curl -fsS "$GITILES_LOG_URL" -o "$response_file" 2>"$stderr_file"; then + : + else + status=$? + error "Failed to fetch Gitiles history from:" + error " $GITILES_LOG_URL" + error "curl exited with status $status." + show_output "curl output" "$stderr_file" + return 1 + fi + + if LATEST_COMMIT=$(tail -n +2 "$response_file" | jq -er '.log[0].commit' 2>"$stderr_file"); then + : + else + status=$? + error "Failed to parse the latest commit from the Gitiles response." + error "jq exited with status $status." + show_output "jq output" "$stderr_file" + echo "Response preview:" >&2 + head -n 20 "$response_file" >&2 + return 1 + fi + + if [ -z "$LATEST_COMMIT" ]; then + error "Gitiles response did not contain a commit hash." + echo "Response preview:" >&2 + head -n 20 "$response_file" >&2 + return 1 + fi +} + +run_git_check() { + local repo_dir + local stderr_file + local status + + require_command git || return 1 + + repo_dir=$(make_temp_dir) + stderr_file=$(make_temp_file) + + if GIT_TERMINAL_PROMPT=0 git clone \ + --quiet \ + --filter=blob:none \ + --single-branch \ + --branch "$REMOTE_BRANCH" \ + --no-checkout \ + "$REMOTE_URL" "$repo_dir" 2>"$stderr_file"; then + : + else + status=$? + error "Failed to clone $REMOTE_BRANCH from:" + error " $REMOTE_URL" + error "git clone exited with status $status." + show_output "git clone output" "$stderr_file" + return 1 + fi + + if LATEST_COMMIT=$(git -C "$repo_dir" log -n 1 --format=%H HEAD -- "$PROTO_PATH" 2>"$stderr_file"); then + : + else + status=$? + error "Failed to determine the latest commit that modified:" + error " $PROTO_PATH" + error "git log exited with status $status." + show_output "git log output" "$stderr_file" + return 1 + fi + + if [ -z "$LATEST_COMMIT" ]; then + error "Git history did not contain a commit for:" + error " $PROTO_PATH" + return 1 + fi +} + +report_result() { + echo "Tracked commit: $TRACKED_COMMIT" + echo "Latest commit: $LATEST_COMMIT" + + if [ "$LATEST_COMMIT" != "$TRACKED_COMMIT" ]; then + echo "Schema has been updated! Latest: ${REMOTE_URL}/+/${LATEST_COMMIT}/${PROTO_PATH}" + exit 1 + fi + + echo "Schema is up to date." +} + +case "$MODE" in + auto) + if run_gitiles_check; then + report_result + exit 0 + fi + + echo "Falling back to git-based check." >&2 + if run_git_check; then + report_result + exit 0 + fi + + exit 1 + ;; + gitiles) + if run_gitiles_check; then + report_result + exit 0 + fi + + exit 1 + ;; + git) + if run_git_check; then + report_result + exit 0 + fi + + exit 1 + ;; +esac From b469e467b75db6863d3cf24629c2d9b3938961b1 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 4 May 2026 11:38:50 +0200 Subject: [PATCH 127/391] fix(feedback): Show soft input keyboard on the Feedback form (#5359) * fix(feedback): Show soft input keyboard on the Feedback form * test(feedback): Add test verifying soft keyboard is not blocked by dialog window flags Co-Authored-By: Claude Opus 4.6 (1M context) * changelog(feedback): Add entry for soft keyboard fix Co-Authored-By: Claude Opus 4.6 (1M context) * formatting --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 ++++ .../sentry/android/core/SentryUserFeedbackForm.java | 6 ++++++ .../android/core/SentryUserFeedbackFormTest.kt | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index beabdfb7f15..71af3a9e159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ - Deprecate `SentryUserFeedbackButton` (View-based and Compose-based) ([#5350](https://github.com/getsentry/sentry-java/pull/5350)) - It will be removed in the next major version +### Fixes + +- Fix soft input keyboard not being shown on the Feedback form ([#5359](https://github.com/getsentry/sentry-java/pull/5359)) + ### Dependencies - Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334)) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java index 0babe475491..722fc9110db 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java @@ -4,6 +4,8 @@ import android.content.Context; import android.os.Bundle; import android.view.View; +import android.view.Window; +import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; @@ -55,6 +57,10 @@ public void setCancelable(boolean cancelable) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sentry_dialog_user_feedback); + final @Nullable Window window = getWindow(); + if (window != null) { + window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); + } setCancelable(isCancelable); final @NotNull SentryFeedbackOptions feedbackOptions = diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt index 04f6a35716b..9df2a16d72e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt @@ -1,6 +1,7 @@ package io.sentry.android.core import android.content.Context +import android.view.WindowManager import android.widget.TextView import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -17,6 +18,7 @@ import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotEquals +import kotlin.test.assertNotNull import org.junit.runner.RunWith import org.mockito.Mockito.mockStatic import org.mockito.kotlin.eq @@ -130,4 +132,15 @@ class SentryUserFeedbackFormTest { // And the original options should not be modified assertNotEquals("custom title", fixture.options.feedbackOptions.formTitle) } + + @Test + fun `dialog window does not have FLAG_ALT_FOCUSABLE_IM so soft keyboard can appear`() { + fixture.options.isEnabled = true + val sut = fixture.getSut() + sut.show() + val window = sut.window + assertNotNull(window) + val flags = window.attributes.flags + assertEquals(0, flags and WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) + } } From 8558cacae503ef0248a7afe38f2f4e84610c3c7d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 4 May 2026 14:34:45 +0200 Subject: [PATCH 128/391] feat(feedback): Add per-form shake detection and sample app showcases (#5353) * feat(feedback): Add per-form shake detection and sample app showcases Resolve feedback options once in the constructor and reuse them in onCreate, avoiding duplicate resolution. Add per-form shake-to-show support via SentryShakeDetector that skips activation when the global FeedbackShakeIntegration is already enabled. Update sample app with custom form builder, auto-dismiss, programmatic capture, and shake-to-show examples. Co-Authored-By: Claude Opus 4.6 * docs(changelog): Add per-form shake detection entry Co-Authored-By: Claude Opus 4.6 * Format code * docs(changelog): Add usage example for per-form shake detection Co-Authored-By: Claude Opus 4.6 * docs(changelog): Use Kotlin example and clarify per-screen usage Co-Authored-By: Claude Opus 4.6 * ref(feedback): Extract shared shake listener in SentryUserFeedbackForm Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 7 + .../android/core/SentryUserFeedbackForm.java | 132 ++++++++++++++++-- .../src/main/AndroidManifest.xml | 1 + .../io/sentry/samples/android/MainActivity.kt | 107 +++++++++++++- 4 files changed, 232 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71af3a9e159..042e87b9713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,13 @@ - All deprecated APIs will be removed in the next major version - Deprecate `SentryUserFeedbackButton` (View-based and Compose-based) ([#5350](https://github.com/getsentry/sentry-java/pull/5350)) - It will be removed in the next major version +- Add per-form shake-to-show support for `SentryUserFeedbackForm` ([#5353](https://github.com/getsentry/sentry-java/pull/5353)) + - Useful for enabling shake-to-report on specific screens instead of globally + ```kotlin + SentryUserFeedbackForm.Builder(activity) + .configurator { it.isUseShakeGesture = true } + .create() + ``` ### Fixes diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java index 722fc9110db..2800d5670a8 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java @@ -1,7 +1,10 @@ package io.sentry.android.core; +import android.app.Activity; import android.app.AlertDialog; +import android.app.Application; import android.content.Context; +import android.content.ContextWrapper; import android.os.Bundle; import android.view.View; import android.view.Window; @@ -20,6 +23,7 @@ import io.sentry.protocol.Feedback; import io.sentry.protocol.SentryId; import io.sentry.protocol.User; +import java.lang.ref.WeakReference; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,8 +34,10 @@ public class SentryUserFeedbackForm extends AlertDialog { private final @Nullable SentryId associatedEventId; private @Nullable OnDismissListener delegate; - private final @Nullable OptionsConfiguration configuration; - private final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator; + private final @NotNull SentryFeedbackOptions resolvedFeedbackOptions; + + private @Nullable SentryShakeDetector shakeDetector; + private @Nullable Application.ActivityLifecycleCallbacks shakeLifecycleCallbacks; SentryUserFeedbackForm( final @NotNull Context context, @@ -41,9 +47,118 @@ public class SentryUserFeedbackForm extends AlertDialog { final @Nullable SentryFeedbackOptions.OptionsConfigurator configurator) { super(context, themeResId); this.associatedEventId = associatedEventId; - this.configuration = configuration; - this.configurator = configurator; + this.resolvedFeedbackOptions = + new SentryFeedbackOptions(Sentry.getCurrentScopes().getOptions().getFeedbackOptions()); + if (configuration != null) { + configuration.configure(context, resolvedFeedbackOptions); + } + if (configurator != null) { + configurator.configure(resolvedFeedbackOptions); + } SentryIntegrationPackageStorage.getInstance().addIntegration("UserFeedbackWidget"); + maybeStartShakeDetection(context); + } + + private void maybeStartShakeDetection(final @NotNull Context context) { + final @NotNull SentryFeedbackOptions globalFeedbackOptions = + Sentry.getCurrentScopes().getOptions().getFeedbackOptions(); + if (!resolvedFeedbackOptions.isUseShakeGesture() || globalFeedbackOptions.isUseShakeGesture()) { + return; + } + final @Nullable Activity activity = getActivity(context); + if (activity == null) { + return; + } + final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); + shakeDetector = new SentryShakeDetector(options.getLogger()); + final @NotNull WeakReference activityRef = new WeakReference<>(activity); + shakeDetector.start(activity, shakeListener(activityRef)); + final @NotNull Application app = activity.getApplication(); + shakeLifecycleCallbacks = new ShakeLifecycleCallbacks(activityRef); + app.registerActivityLifecycleCallbacks(shakeLifecycleCallbacks); + } + + private void stopShakeDetection() { + if (shakeDetector != null) { + shakeDetector.close(); + shakeDetector = null; + } + if (shakeLifecycleCallbacks != null) { + final @Nullable Activity activity = getActivity(getContext()); + if (activity != null) { + activity.getApplication().unregisterActivityLifecycleCallbacks(shakeLifecycleCallbacks); + } + shakeLifecycleCallbacks = null; + } + } + + private @NotNull SentryShakeDetector.Listener shakeListener( + final @NotNull WeakReference activityRef) { + return () -> { + final @Nullable Activity active = activityRef.get(); + if (active != null && !active.isFinishing() && !active.isDestroyed()) { + active.runOnUiThread( + () -> { + if (!active.isFinishing() && !active.isDestroyed()) { + show(); + } + }); + } + }; + } + + private static @Nullable Activity getActivity(final @NotNull Context context) { + Context current = context; + while (current instanceof ContextWrapper) { + if (current instanceof Activity) { + return (Activity) current; + } + current = ((ContextWrapper) current).getBaseContext(); + } + return null; + } + + private class ShakeLifecycleCallbacks implements Application.ActivityLifecycleCallbacks { + private final @NotNull WeakReference activityRef; + + ShakeLifecycleCallbacks(final @NotNull WeakReference activityRef) { + this.activityRef = activityRef; + } + + @Override + public void onActivityResumed(final @NotNull Activity activity) { + if (activity == activityRef.get() && shakeDetector != null) { + shakeDetector.start(activity, shakeListener(activityRef)); + } + } + + @Override + public void onActivityPaused(final @NotNull Activity activity) { + if (activity == activityRef.get() && shakeDetector != null) { + shakeDetector.stop(); + } + } + + @Override + public void onActivityDestroyed(final @NotNull Activity activity) { + if (activity == activityRef.get()) { + stopShakeDetection(); + } + } + + @Override + public void onActivityCreated( + final @NotNull Activity activity, final @Nullable Bundle savedInstanceState) {} + + @Override + public void onActivityStarted(final @NotNull Activity activity) {} + + @Override + public void onActivityStopped(final @NotNull Activity activity) {} + + @Override + public void onActivitySaveInstanceState( + final @NotNull Activity activity, final @NotNull Bundle outState) {} } @Override @@ -63,14 +178,7 @@ protected void onCreate(Bundle savedInstanceState) { } setCancelable(isCancelable); - final @NotNull SentryFeedbackOptions feedbackOptions = - new SentryFeedbackOptions(Sentry.getCurrentScopes().getOptions().getFeedbackOptions()); - if (configuration != null) { - configuration.configure(getContext(), feedbackOptions); - } - if (configurator != null) { - configurator.configure(feedbackOptions); - } + final @NotNull SentryFeedbackOptions feedbackOptions = resolvedFeedbackOptions; final @NotNull TextView lblTitle = findViewById(R.id.sentry_dialog_user_feedback_title); final @NotNull ImageView imgLogo = findViewById(R.id.sentry_dialog_user_feedback_logo); final @NotNull TextView lblName = findViewById(R.id.sentry_dialog_user_feedback_txt_name); diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 548e5e8ac0d..26f526124b4 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -271,6 +271,7 @@ + diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt index 4c4ef05fb1a..e000b54e4cc 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt @@ -43,6 +43,7 @@ import androidx.compose.material.icons.filled.Settings import androidx.compose.material.icons.filled.Speed import androidx.compose.material.icons.filled.Videocam import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -62,6 +63,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.rotate @@ -79,8 +81,9 @@ import io.sentry.MeasurementUnit import io.sentry.Sentry import io.sentry.SentryLogLevel import io.sentry.UpdateStatus +import io.sentry.android.core.SentryUserFeedbackForm import io.sentry.compose.SentryTraced -import io.sentry.compose.SentryUserFeedbackButton +import io.sentry.protocol.Feedback import io.sentry.protocol.User import java.io.File import java.io.FileOutputStream @@ -615,8 +618,106 @@ fun UserFeedbackScreen() { } } - // SentryUserFeedbackButton as a special item - item(span = { GridItemSpan(maxLineSpan) }) { SentryUserFeedbackButton(modifier = Modifier) } + // Bring up User Feedback Form from a custom button using the global Sentry.feedback() API + item(span = { GridItemSpan(maxLineSpan) }) { + Button(modifier = Modifier, onClick = { Sentry.feedback().show() }) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ) { + Icon( + painter = + painterResource( + id = io.sentry.compose.R.drawable.sentry_user_feedback_compose_button_logo_24 + ), + contentDescription = null, + ) + Spacer(Modifier.padding(horizontal = 4.dp)) + Text(text = "Report a Bug") + } + } + } + + // Create a SentryUserFeedbackForm programmatically and show it + item(span = { GridItemSpan(maxLineSpan) }) { + Button( + modifier = Modifier, + onClick = { + SentryUserFeedbackForm.Builder(activity) + .configurator { options -> + options.formTitle = "Custom Form" + options.submitButtonLabel = "Send" + options.cancelButtonLabel = "Never mind" + options.messageLabel = "What happened?" + options.messagePlaceholder = "Describe the issue..." + options.isShowBranding = false + options.isNameRequired = true + options.isEmailRequired = true + options.setOnSubmitSuccess { feedback -> + Toast.makeText(activity, "Thanks for the feedback!", Toast.LENGTH_SHORT).show() + } + } + .create() + .show() + }, + ) { + Text(text = "Custom Form (Builder)") + } + } + + // Showcases how to manually show and dismiss a form programmatically + item(span = { GridItemSpan(maxLineSpan) }) { + Button( + modifier = Modifier, + onClick = { + val form = + SentryUserFeedbackForm.Builder(activity) + .configurator { options -> options.formTitle = "Quick! You have 2 seconds" } + .create() + form.show() + Handler(Looper.getMainLooper()).postDelayed({ form.dismiss() }, 2000) + }, + ) { + Text(text = "Auto-dismiss Form (2s)") + } + } + + // Send feedback programmatically without showing a form + item(span = { GridItemSpan(maxLineSpan) }) { + Button( + modifier = Modifier, + onClick = { + val feedback = + Feedback("The app crashed when I tapped the button").apply { + name = "Jane Doe" + contactEmail = "jane@example.com" + url = "https://example.com/page" + } + val eventId = Sentry.feedback().capture(feedback) + Toast.makeText(activity, "Feedback sent: $eventId", Toast.LENGTH_SHORT).show() + }, + ) { + Text(text = "Send Feedback (no form)") + } + } + + // Enable shake-to-show for a specific form instance + item(span = { GridItemSpan(maxLineSpan) }) { + Button( + modifier = Modifier, + onClick = { + SentryUserFeedbackForm.Builder(activity) + .configurator { options -> + options.isUseShakeGesture = true + options.formTitle = "Shake Feedback" + } + .create() + Toast.makeText(activity, "Shake your device to open the form!", Toast.LENGTH_SHORT).show() + }, + ) { + Text(text = "Enable Shake-to-Show") + } + } } } From 5bc94fce3ac6668d6626c29dc447e5fe430f7c70 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 13:08:33 +0200 Subject: [PATCH 129/391] chore(deps): update Gradle to v9.5.0 (#5344) Co-authored-by: GitHub --- CHANGELOG.md | 3 +++ gradle/wrapper/gradle-wrapper.jar | Bin 43764 -> 48966 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 7 ++----- gradlew.bat | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 042e87b9713..2aee24e7775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ - Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0138) - [diff](https://github.com/getsentry/sentry-native/compare/0.13.7...0.13.8) +- Bump Gradle from v9.4.1 to v9.5.0 ([#5344](https://github.com/getsentry/sentry-java/pull/5344)) + - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v950) + - [diff](https://github.com/gradle/gradle/compare/v9.4.1...v9.5.0) ## 8.40.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55baabb587c669f562ae36f953de2481846..d997cfc60f4cff0e7451d19d49a82fa986695d07 100644 GIT binary patch delta 40557 zcmXVXQ+Oq9*Yw2Nv36|Rwrxyo+ujq~w(Xf%6LaEBY}@8P@ALg9eb85*bl+=L^{T3M z{}+7t6THC=2{btgAIyvbx$R4Qm4LlG^O&Jqp$eHQ3aVdgvmqW%2zh*{ZeB7z%!cm1 zpfPV#llOR(JwJ&1Wdk2ad5d$0*8kT+N;ZeoBW{q)1Qvs*GbfsAVKG4oQloXj-jRm3 z5F#sayFnFE2U#kdhK6NC1W8CdfK%MzFki1TCza4Jj;uhxXA5!_sMFd}x3k#NL4z>G z{RXZq2Lo#}J)x8O?c2BZZ^<`&_{k{9vIxlV2KP@=gK*AMGsHq_>TmqT%uPzw1hAkHmSHvpbL&H-m?>B-<=zh0I9}hC8yswH)x_ zyinmFe1Z4B@38$UFHQ>f?VD5bH6KB812bVVN*RL&ND((6{1nTZyg_%%axtr06dGx&V&`HbEZ;R|ge=f(5J z>RaDDy=oco@$m@J%b$j`NrcbO)T3gfw}GBkmV)6fHAYjlVTDWi1XvsAvQtprL@nE{ zD~JcVUmpJLP<~q19MF*ETX&OCv_5@-c05ERGA(QwZ62bia*w+B%uTaa?XSIirw{F) zLzIIZX>c3AL>Qr99LKgiw21OnIHz-b>jj!H6()N*|oQ-t7zdAtZRWvtI3oHgqg`k;Y)aLD;8oN&VEL_{Xo{`8|?E>`!`v5l_J z>LMC@w#5|hZpV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/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a93670..739907dfd15 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac207e..c4bdd3ab8e3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell From c7ed38cb3bf1241be0ebf27a7df97a2b13b118e8 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 5 May 2026 13:49:10 +0200 Subject: [PATCH 130/391] feat(ci): Notify linked issues on release (#5367) Add a release workflow that comments on GitHub issues closed by PRs included in a published stable release. Also document that PR authors need to use GitHub closing keywords for linked issues to receive the release notification. Co-authored-by: Claude Opus 4.6 --- .github/workflows/release-comment-issues.yml | 39 ++++++++++++++++++++ CONTRIBUTING.md | 7 ++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/release-comment-issues.yml diff --git a/.github/workflows/release-comment-issues.yml b/.github/workflows/release-comment-issues.yml new file mode 100644 index 00000000000..0eeff26b9d8 --- /dev/null +++ b/.github/workflows/release-comment-issues.yml @@ -0,0 +1,39 @@ +name: 'Automation: Notify issues for release' +on: + release: + types: + - published + workflow_dispatch: + inputs: + version: + description: Which version to notify issues for + required: true + +permissions: + contents: read + issues: write + pull-requests: read + +jobs: + release-comment-issues: + runs-on: ubuntu-24.04 + name: 'Notify issues' + steps: + - name: Get version + id: get_version + env: + INPUTS_VERSION: ${{ github.event.inputs.version }} + RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} + run: echo "version=${INPUTS_VERSION:-$RELEASE_TAG_NAME}" >> "$GITHUB_OUTPUT" + + - name: Comment on linked issues that are mentioned in release + if: | + steps.get_version.outputs.version != '' + && !contains(steps.get_version.outputs.version, '-beta.') + && !contains(steps.get_version.outputs.version, '-alpha.') + && !contains(steps.get_version.outputs.version, '-rc.') + + uses: getsentry/release-comment-issues-gh-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + version: ${{ steps.get_version.outputs.version }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e2c8b78bf1..7eb38413d64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,6 +57,13 @@ or However, if your change did not intend to modify the public API, consider changing the method/property visibility or removing the change altogether. +# Linking issues + +If a PR should notify a linked issue after release, use a GitHub closing keyword in the PR +description, such as `Fixes #123`, `Closes #123`, or `Resolves #123`. Release notification +automation only comments on issues GitHub recognizes as closed by the released PR; mentioning an +issue without a closing keyword is not enough. + # CI Build and tests are automatically run against branches and pull requests From d25ef951db8d52542757932b3dbe4497e60f8465 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 14:32:55 +0200 Subject: [PATCH 131/391] chore(deps): update Native SDK to v0.14.0 (#5365) Co-authored-by: GitHub --- CHANGELOG.md | 6 +++--- gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aee24e7775..213fe354ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,9 +26,9 @@ ### Dependencies -- Bump Native SDK from v0.13.7 to v0.13.8 ([#5334](https://github.com/getsentry/sentry-java/pull/5334)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0138) - - [diff](https://github.com/getsentry/sentry-native/compare/0.13.7...0.13.8) +- Bump Native SDK from v0.13.7 to v0.14.0 ([#5334](https://github.com/getsentry/sentry-java/pull/5334), [#5365](https://github.com/getsentry/sentry-java/pull/5365)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0140) + - [diff](https://github.com/getsentry/sentry-native/compare/0.13.7...0.14.0) - Bump Gradle from v9.4.1 to v9.5.0 ([#5344](https://github.com/getsentry/sentry-java/pull/5344)) - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v950) - [diff](https://github.com/gradle/gradle/compare/v9.4.1...v9.5.0) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c04ab824c86..cf7bc7b4f32 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.13.8" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.0" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From e3e78e1c6cc641228dd910ee39c28ed6cf1ee710 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 5 May 2026 14:37:35 +0200 Subject: [PATCH 132/391] fix(feedback): Improve shake detection sensitivity (#5366) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(feedback): Improve shake detection sensitivity Replace the threshold-counting approach (2.7g, 2 spikes in 1.5s) with a rolling sample window based on Square's Seismic library. A shake is now detected when >75% of accelerometer readings in a 0.5s window exceed 13 m/s² (~1.33g), which works reliably on budget devices with less sensitive accelerometers. Fixes GH-5331 Co-Authored-By: Claude Opus 4.6 * docs: Add license attribution for Square's Seismic library Co-Authored-By: Claude Opus 4.6 * docs: Add third-party code attribution guidelines to AGENTS.md Co-Authored-By: Claude Opus 4.6 * Format code * docs(changelog): Add shake detection fix entry Co-Authored-By: Claude Opus 4.6 * fix(feedback): Clear message field when form is re-shown via shake Co-Authored-By: Claude Opus 4.6 * fix(feedback): Synchronize SampleQueue access across threads stop() runs on the main thread while onSensorChanged() runs on the background HandlerThread. Without synchronization, concurrent access to the linked list and object pool can corrupt next-pointers and cause clear() to loop forever. Co-Authored-By: Claude Opus 4.6 * ref(feedback): Replace synchronized block with handler.post for queue clear Post queue.clear() to the HandlerThread instead of synchronizing every sensor event. All queue access now stays single-threaded with zero lock contention. quitSafely() drains pending messages before exiting. Co-Authored-By: Claude Opus 4.6 * dont use method ref * ref(feedback): Remove queue.clear() from stop(), rely on timestamp purge Sensor events are delivered via fd callbacks, not Handler messages, so posting clear() to the HandlerThread doesn't guarantee ordering with new events after re-registration. The SampleQueue already purges stale samples by timestamp in add(), so explicit clearing on stop is unnecessary. Co-Authored-By: Claude Opus 4.6 * ref(feedback): Restore handler.post(clear) in stop() Both fd callbacks and posted Messages are serialized by the Looper, so there is no concurrent access risk. Explicit clear is cleaner than relying on timestamp purge alone. Co-Authored-By: Claude Opus 4.6 * fix(feedback): Require minimum sample count before triggering shake The 75% bit-shift formula degrades at low sample counts (e.g. 33% at 3 samples). With SENSOR_DELAY_NORMAL (~5Hz) the queue may hold only 3 samples in 0.5s. Adding a MIN_QUEUE_SIZE guard ensures the threshold stays accurate and prevents false triggers from walking. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: Sentry Github Bot --- AGENTS.md | 11 ++ CHANGELOG.md | 2 + THIRD_PARTY_NOTICES.md | 28 +++ .../android/core/SentryShakeDetector.java | 160 +++++++++++++----- .../android/core/SentryUserFeedbackForm.java | 6 + .../android/core/SentryShakeDetectorTest.kt | 88 ++++++++-- 6 files changed, 239 insertions(+), 56 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index fad3dc5a54e..42a8e651004 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -144,6 +144,17 @@ The repository is organized into multiple modules: 4. New features must be **opt-in by default** - extend `SentryOptions` or similar Option classes with getters/setters 5. Consider backwards compatibility +### Third-Party Code Attribution +When adapting code from third-party libraries: +1. Add a license header at the top of the adapted file (before the `package` statement): + ```java + // Adapted from . + // Copyright . + // Licensed under the . + // + ``` +2. Add a full attribution entry to `THIRD_PARTY_NOTICES.md` following the existing format (Source, License, Copyright, Scope, full license text) + ### Getting PR Information Use `gh pr view` to get PR details from the current branch. This is needed when adding changelog entries, which require the PR number. diff --git a/CHANGELOG.md b/CHANGELOG.md index 213fe354ffe..ea6befb4b35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ ### Fixes - Fix soft input keyboard not being shown on the Feedback form ([#5359](https://github.com/getsentry/sentry-java/pull/5359)) +- Fix shake-to-report not triggering on some devices due to high acceleration threshold ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) +- Fix feedback form retaining previous message when shown again via shake ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) ### Dependencies diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 8b2141cc59e..5a48d567fac 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -118,6 +118,34 @@ limitations under the License. --- +## Square — Seismic (Apache 2.0) + +**Source:** https://github.com/square/seismic
+**License:** Apache License 2.0
+**Copyright:** Copyright 2010 Square, Inc. + +### Scope + +The Sentry Java SDK includes an adapted version of Square's Seismic shake detection algorithm. The rolling sample window approach and `SampleQueue`/`SamplePool` data structures in `io.sentry.android.core.SentryShakeDetector` are based on Seismic's `ShakeDetector`. + +``` +Copyright 2010 Square, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + ## Square — Curtains (Apache 2.0) **Source:** https://github.com/square/curtains (v1.2.5)
diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java index 5b6f63309ff..a4c4ae0c4f5 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java @@ -1,3 +1,7 @@ +// Adapted from Square's Seismic library. +// Copyright 2010 Square, Inc. +// Licensed under the Apache License, Version 2.0. +// https://github.com/square/seismic package io.sentry.android.core; import android.content.Context; @@ -7,10 +11,8 @@ import android.hardware.SensorManager; import android.os.Handler; import android.os.HandlerThread; -import android.os.SystemClock; import io.sentry.ILogger; import io.sentry.SentryLevel; -import java.util.concurrent.atomic.AtomicLong; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -21,8 +23,8 @@ *

The accelerometer sensor (TYPE_ACCELEROMETER) does NOT require any special permissions on * Android. The BODY_SENSORS permission is only needed for heart rate and similar body sensors. * - *

Requires at least {@link #SHAKE_COUNT_THRESHOLD} accelerometer readings above {@link - * #SHAKE_THRESHOLD_GRAVITY} within {@link #SHAKE_WINDOW_MS} to trigger a shake event. + *

Uses a rolling sample window: if more than 75% of accelerometer readings in the past 0.5s + * exceed {@link #ACCELERATION_THRESHOLD}, a shake is detected. Based on Square's Seismic library. * *

Sensor events are delivered on a background {@link HandlerThread} to avoid polluting the main * thread. @@ -30,21 +32,16 @@ @ApiStatus.Internal public final class SentryShakeDetector implements SensorEventListener { - private static final float SHAKE_THRESHOLD_GRAVITY = 2.7f; - private static final int SHAKE_WINDOW_MS = 1500; - private static final int SHAKE_COUNT_THRESHOLD = 2; - private static final int SHAKE_COOLDOWN_MS = 1000; + static final int ACCELERATION_THRESHOLD = 13; private @Nullable SensorManager sensorManager; private @Nullable Sensor accelerometer; private @Nullable HandlerThread handlerThread; private @Nullable Handler handler; - private final @NotNull AtomicLong lastShakeTimestamp = new AtomicLong(0); private volatile @Nullable Listener listener; private @NotNull ILogger logger; - private int shakeCount = 0; - private long firstShakeTimestamp = 0; + private final @NotNull SampleQueue queue = new SampleQueue(); public interface Listener { void onShake(); @@ -94,17 +91,24 @@ public void start(final @NotNull Context context, final @NotNull Listener shakeL public void stop() { listener = null; - shakeCount = 0; - firstShakeTimestamp = 0; if (sensorManager != null) { sensorManager.unregisterListener(this); } + final @Nullable Handler h = handler; + if (h != null) { + h.post( + () -> { + //noinspection Convert2MethodRef + queue.clear(); + }); + } } /** Stops detection and releases the background thread. */ public void close() { stop(); if (handlerThread != null) { + // quitSafely drains pending messages (including the clear posted by stop) before exiting handlerThread.quitSafely(); handlerThread = null; handler = null; @@ -116,32 +120,17 @@ public void onSensorChanged(final @NotNull SensorEvent event) { if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER) { return; } - float gX = event.values[0] / SensorManager.GRAVITY_EARTH; - float gY = event.values[1] / SensorManager.GRAVITY_EARTH; - float gZ = event.values[2] / SensorManager.GRAVITY_EARTH; - double gForceSquared = gX * gX + gY * gY + gZ * gZ; - if (gForceSquared > SHAKE_THRESHOLD_GRAVITY * SHAKE_THRESHOLD_GRAVITY) { - long now = SystemClock.elapsedRealtime(); - - // Reset counter if outside the detection window - if (now - firstShakeTimestamp > SHAKE_WINDOW_MS) { - shakeCount = 0; - firstShakeTimestamp = now; - } - - shakeCount++; - - if (shakeCount >= SHAKE_COUNT_THRESHOLD) { - // Enforce cooldown so we don't fire repeatedly - long lastShake = lastShakeTimestamp.get(); - if (now - lastShake > SHAKE_COOLDOWN_MS) { - lastShakeTimestamp.set(now); - shakeCount = 0; - final @Nullable Listener currentListener = listener; - if (currentListener != null) { - currentListener.onShake(); - } - } + final float ax = event.values[0]; + final float ay = event.values[1]; + final float az = event.values[2]; + final boolean accelerating = Math.sqrt(ax * ax + ay * ay + az * az) > ACCELERATION_THRESHOLD; + + queue.add(event.timestamp, accelerating); + if (queue.isShaking()) { + queue.clear(); + final @Nullable Listener currentListener = listener; + if (currentListener != null) { + currentListener.onShake(); } } } @@ -150,4 +139,97 @@ public void onSensorChanged(final @NotNull SensorEvent event) { public void onAccuracyChanged(final @NotNull Sensor sensor, final int accuracy) { // Not needed for shake detection. } + + static class SampleQueue { + private static final long MAX_WINDOW_SIZE_NS = 500_000_000L; // 0.5s + private static final long MIN_WINDOW_SIZE_NS = MAX_WINDOW_SIZE_NS >> 1; // 0.25s + private static final int MIN_QUEUE_SIZE = 4; + + private final @NotNull SamplePool pool = new SamplePool(); + private @Nullable Sample oldest; + private @Nullable Sample newest; + private int sampleCount; + private int acceleratingCount; + + void add(final long timestamp, final boolean accelerating) { + purge(timestamp - MAX_WINDOW_SIZE_NS); + + final @NotNull Sample added = pool.acquire(); + added.timestamp = timestamp; + added.accelerating = accelerating; + added.next = null; + if (newest != null) { + newest.next = added; + } + newest = added; + if (oldest == null) { + oldest = added; + } + + sampleCount++; + if (accelerating) { + acceleratingCount++; + } + } + + void clear() { + while (oldest != null) { + final @NotNull Sample removed = oldest; + oldest = removed.next; + pool.release(removed); + } + newest = null; + sampleCount = 0; + acceleratingCount = 0; + } + + private void purge(final long cutoff) { + while (sampleCount >= MIN_QUEUE_SIZE && oldest != null && cutoff - oldest.timestamp > 0) { + final @NotNull Sample removed = oldest; + if (removed.accelerating) { + acceleratingCount--; + } + sampleCount--; + oldest = removed.next; + if (oldest == null) { + newest = null; + } + pool.release(removed); + } + } + + boolean isShaking() { + return newest != null + && oldest != null + && sampleCount >= MIN_QUEUE_SIZE + && newest.timestamp - oldest.timestamp >= MIN_WINDOW_SIZE_NS + && acceleratingCount >= (sampleCount >> 1) + (sampleCount >> 2); + } + } + + static class Sample { + long timestamp; + boolean accelerating; + @Nullable Sample next; + } + + static class SamplePool { + private @Nullable Sample head; + + @NotNull + Sample acquire() { + Sample acquired = head; + if (acquired == null) { + acquired = new Sample(); + } else { + head = acquired.next; + } + return acquired; + } + + void release(final @NotNull Sample sample) { + sample.next = head; + head = sample; + } + } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java index 2800d5670a8..43500d50ebc 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java @@ -324,6 +324,12 @@ public void setOnDismissListener(final @Nullable OnDismissListener listener) { @Override protected void onStart() { super.onStart(); + // Clear the message field so subsequent show() calls start with a fresh form + final @NotNull EditText edtMessage = + findViewById(R.id.sentry_dialog_user_feedback_edt_description); + edtMessage.getText().clear(); + edtMessage.setError(null); + final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); final @NotNull SentryFeedbackOptions feedbackOptions = options.getFeedbackOptions(); final @Nullable Runnable onFormOpen = feedbackOptions.getOnFormOpen(); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt index 98441e48a8d..24ccfceaa86 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShakeDetectorTest.kt @@ -5,10 +5,11 @@ import android.hardware.Sensor import android.hardware.SensorEvent import android.hardware.SensorManager import android.os.Handler -import android.os.SystemClock import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.ILogger import kotlin.test.Test +import kotlin.test.assertFalse +import kotlin.test.assertTrue import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.eq @@ -88,29 +89,27 @@ class SentryShakeDetectorTest { } @Test - fun `triggers listener when shake is detected`() { - // Advance clock so cooldown check (now - 0 > 1000) passes - SystemClock.setCurrentTimeMillis(2000) - + fun `triggers listener when sustained shake is detected`() { val sut = fixture.getSut() sut.start(fixture.context, fixture.listener) - // Needs at least SHAKE_COUNT_THRESHOLD (2) readings above threshold - val event1 = createSensorEvent(floatArrayOf(30f, 0f, 0f)) - sut.onSensorChanged(event1) - val event2 = createSensorEvent(floatArrayOf(30f, 0f, 0f)) - sut.onSensorChanged(event2) + // Send enough accelerating samples over 0.25s+ to trigger (>75% accelerating) + val baseTimestamp = 1_000_000_000L // 1s in nanos + val intervalNs = 20_000_000L // 20ms between samples (~50Hz) + for (i in 0 until 20) { + val event = createSensorEvent(floatArrayOf(20f, 0f, 0f), baseTimestamp + i * intervalNs) + sut.onSensorChanged(event) + } verify(fixture.listener).onShake() } @Test - fun `does not trigger listener on single shake`() { + fun `does not trigger listener on single spike`() { val sut = fixture.getSut() sut.start(fixture.context, fixture.listener) - // A single threshold crossing should not trigger - val event = createSensorEvent(floatArrayOf(30f, 0f, 0f)) + val event = createSensorEvent(floatArrayOf(30f, 0f, 0f), 1_000_000_000L) sut.onSensorChanged(event) verify(fixture.listener, never()).onShake() @@ -121,9 +120,16 @@ class SentryShakeDetectorTest { val sut = fixture.getSut() sut.start(fixture.context, fixture.listener) - // Gravity only (1G) - no shake - val event = createSensorEvent(floatArrayOf(0f, 0f, SensorManager.GRAVITY_EARTH)) - sut.onSensorChanged(event) + val baseTimestamp = 1_000_000_000L + val intervalNs = 20_000_000L + for (i in 0 until 20) { + val event = + createSensorEvent( + floatArrayOf(0f, 0f, SensorManager.GRAVITY_EARTH), + baseTimestamp + i * intervalNs, + ) + sut.onSensorChanged(event) + } verify(fixture.listener, never()).onShake() } @@ -133,7 +139,7 @@ class SentryShakeDetectorTest { val sut = fixture.getSut() sut.start(fixture.context, fixture.listener) - val event = createSensorEvent(floatArrayOf(30f, 0f, 0f), sensorType = Sensor.TYPE_GYROSCOPE) + val event = createSensorEvent(floatArrayOf(30f, 0f, 0f), 1_000_000_000L, Sensor.TYPE_GYROSCOPE) sut.onSensorChanged(event) verify(fixture.listener, never()).onShake() @@ -145,8 +151,53 @@ class SentryShakeDetectorTest { sut.stop() } + @Test + fun `sample queue triggers when 75 percent of samples are accelerating`() { + val queue = SentryShakeDetector.SampleQueue() + val intervalNs = 20_000_000L + + // 15 accelerating + 5 not = 75% in a 0.4s window (> 0.25s minimum) + for (i in 0 until 15) { + queue.add(i * intervalNs, true) + } + for (i in 15 until 20) { + queue.add(i * intervalNs, false) + } + + assertTrue(queue.isShaking()) + } + + @Test + fun `sample queue does not trigger below 75 percent`() { + val queue = SentryShakeDetector.SampleQueue() + val intervalNs = 20_000_000L + + // 10 accelerating + 10 not = 50% + for (i in 0 until 10) { + queue.add(i * intervalNs, true) + } + for (i in 10 until 20) { + queue.add(i * intervalNs, false) + } + + assertFalse(queue.isShaking()) + } + + @Test + fun `sample queue does not trigger below minimum window`() { + val queue = SentryShakeDetector.SampleQueue() + + // All accelerating but only 0.06s apart (below 0.25s minimum) + for (i in 0 until 4) { + queue.add(i * 20_000_000L, true) + } + + assertFalse(queue.isShaking()) + } + private fun createSensorEvent( values: FloatArray, + timestamp: Long = 0L, sensorType: Int = Sensor.TYPE_ACCELEROMETER, ): SensorEvent { val sensor = mock() @@ -160,6 +211,9 @@ class SentryShakeDetectorTest { val sensorField = SensorEvent::class.java.getField("sensor") sensorField.set(event, sensor) + val timestampField = SensorEvent::class.java.getField("timestamp") + timestampField.set(event, timestamp) + return event } } From 83a416d1cfa89e79f71fd8eb9fe05d8e5058f665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Andra=C5=A1ec?= Date: Wed, 6 May 2026 10:50:23 +0200 Subject: [PATCH 133/391] fix: Avoid stack overflow when deserializing large flat JSON objects (#5361) * fix: Avoid stack overflow when deserializing large flat JSON objects Replace JsonObjectDeserializer's recursive token parsing with an iterative loop. The parser already tracks state explicitly, so recursion was only used to advance to the next JSON token and could overflow on large flat maps. Relates to https://github.com/getsentry/sentry-dart/issues/3668 * use larger module count vm might not respect stack size, so increase the frame count (with smaller payload) to make test more robust * add cl entries * fix cl entry * Update CHANGELOG.md --------- Co-authored-by: Giancarlo Buenaflor --- CHANGELOG.md | 4 + .../io/sentry/JsonObjectDeserializer.java | 85 +++++++++---------- .../test/java/io/sentry/SentryEventTest.kt | 44 ++++++++++ 3 files changed, 90 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea6befb4b35..a5c606a2bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,10 @@ - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v950) - [diff](https://github.com/gradle/gradle/compare/v9.4.1...v9.5.0) +### Fixes + +- Avoid stack overflow when deserializing large flat JSON objects ([#5361](https://github.com/getsentry/sentry-java/pull/5361)) + ## 8.40.0 ### Fixes diff --git a/sentry/src/main/java/io/sentry/JsonObjectDeserializer.java b/sentry/src/main/java/io/sentry/JsonObjectDeserializer.java index e7753d44ea7..0916f6e82d5 100644 --- a/sentry/src/main/java/io/sentry/JsonObjectDeserializer.java +++ b/sentry/src/main/java/io/sentry/JsonObjectDeserializer.java @@ -82,49 +82,48 @@ private static final class TokenMap implements Token { private void parse(@NotNull JsonObjectReader reader) throws IOException { boolean done = false; - switch (reader.peek()) { - case BEGIN_ARRAY: - reader.beginArray(); - pushCurrentToken(new TokenArray()); - break; - case END_ARRAY: - reader.endArray(); - done = handleArrayOrMapEnd(); - break; - case BEGIN_OBJECT: - reader.beginObject(); - pushCurrentToken(new TokenMap()); - break; - case END_OBJECT: - reader.endObject(); - done = handleArrayOrMapEnd(); - break; - case NAME: - pushCurrentToken(new TokenName(reader.nextName())); - break; - case STRING: - // avoid method refs on Android due to some issues with older AGP setups - // noinspection Convert2MethodRef - done = handlePrimitive(() -> reader.nextString()); - break; - case NUMBER: - done = handlePrimitive(() -> nextNumber(reader)); - break; - case BOOLEAN: - // avoid method refs on Android due to some issues with older AGP setups - // noinspection Convert2MethodRef - done = handlePrimitive(() -> reader.nextBoolean()); - break; - case NULL: - reader.nextNull(); - done = handlePrimitive(() -> null); - break; - case END_DOCUMENT: - done = true; - break; - } - if (!done) { - parse(reader); + while (!done) { + switch (reader.peek()) { + case BEGIN_ARRAY: + reader.beginArray(); + pushCurrentToken(new TokenArray()); + break; + case END_ARRAY: + reader.endArray(); + done = handleArrayOrMapEnd(); + break; + case BEGIN_OBJECT: + reader.beginObject(); + pushCurrentToken(new TokenMap()); + break; + case END_OBJECT: + reader.endObject(); + done = handleArrayOrMapEnd(); + break; + case NAME: + pushCurrentToken(new TokenName(reader.nextName())); + break; + case STRING: + // avoid method refs on Android due to some issues with older AGP setups + // noinspection Convert2MethodRef + done = handlePrimitive(() -> reader.nextString()); + break; + case NUMBER: + done = handlePrimitive(() -> nextNumber(reader)); + break; + case BOOLEAN: + // avoid method refs on Android due to some issues with older AGP setups + // noinspection Convert2MethodRef + done = handlePrimitive(() -> reader.nextBoolean()); + break; + case NULL: + reader.nextNull(); + done = handlePrimitive(() -> null); + break; + case END_DOCUMENT: + done = true; + break; + } } } diff --git a/sentry/src/test/java/io/sentry/SentryEventTest.kt b/sentry/src/test/java/io/sentry/SentryEventTest.kt index 36782c153e1..70514a6b72d 100644 --- a/sentry/src/test/java/io/sentry/SentryEventTest.kt +++ b/sentry/src/test/java/io/sentry/SentryEventTest.kt @@ -3,9 +3,11 @@ package io.sentry import io.sentry.exception.ExceptionMechanismException import io.sentry.protocol.Mechanism import io.sentry.protocol.SentryId +import java.io.StringReader import java.time.Instant import java.time.temporal.ChronoUnit import java.util.Collections +import java.util.concurrent.atomic.AtomicReference import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -174,6 +176,48 @@ class SentryEventTest { } } + @Test + fun `deserializes event with large flat modules map on a small stack`() { + val moduleCount = 50000 + val json = buildString { + append("{\"event_id\":\"00000000000000000000000000000000\",\"modules\":{") + repeat(moduleCount) { + if (it > 0) { + append(',') + } + append("\"m") + append(it) + append("\":\"v\"") + } + append("}}") + } + + val error = AtomicReference() + val event = AtomicReference() + val thread = + Thread( + null, + Runnable { + try { + event.set( + JsonSerializer(SentryOptions()) + .deserialize(StringReader(json), SentryEvent::class.java) + ) + } catch (throwable: Throwable) { + error.set(throwable) + } + }, + "large-flat-modules-repro", + 1024L * 1024L, + ) + + thread.start() + thread.join() + + assertNull(error.get()) + assertEquals(moduleCount, event.get()?.modules?.size) + } + @Test fun `null tag does not cause NPE`() { val event = SentryEvent() From 0188f486bee02039e435beaa70a120f93bcf390c Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 6 May 2026 13:18:01 +0200 Subject: [PATCH 134/391] chore: Fix entry in `CHANGELOG` Refactored duplicate `Fixes` entry --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c606a2bce..9b945938d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Fix soft input keyboard not being shown on the Feedback form ([#5359](https://github.com/getsentry/sentry-java/pull/5359)) - Fix shake-to-report not triggering on some devices due to high acceleration threshold ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) - Fix feedback form retaining previous message when shown again via shake ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) +- Avoid stack overflow when deserializing large flat JSON objects ([#5361](https://github.com/getsentry/sentry-java/pull/5361)) ### Dependencies @@ -35,10 +36,6 @@ - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v950) - [diff](https://github.com/gradle/gradle/compare/v9.4.1...v9.5.0) -### Fixes - -- Avoid stack overflow when deserializing large flat JSON objects ([#5361](https://github.com/getsentry/sentry-java/pull/5361)) - ## 8.40.0 ### Fixes From 11ad3372fed13e4508810060fd3997fb786ac176 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 6 May 2026 15:39:45 +0200 Subject: [PATCH 135/391] feat(core): Queue Instrumentation for Kafka (#5249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * collection: Queue Instrumentation * feat(core): Add enableQueueTracing option and messaging span data conventions Add enableQueueTracing boolean to SentryOptions (default false) and ExternalOptions (nullable Boolean) with merge support. Add messaging.* keys to SpanDataConvention for queue instrumentation span data. Co-Authored-By: Claude * changelog * feat(samples): Add Kafka producer and consumer to Spring Boot 3 sample app Add spring-kafka dependency and a simple Kafka producer/consumer setup behind a 'kafka' Spring profile. Includes a REST endpoint to produce messages and a KafkaListener that consumes them. Kafka auto-configuration is excluded by default and only activated when the 'kafka' profile is enabled. Co-Authored-By: Claude * feat(spring-jakarta): Add Kafka producer instrumentation Add SentryKafkaProducerWrapper that overrides doSend to create queue.publish spans for all KafkaTemplate send operations. Injects sentry-trace, baggage, and sentry-task-enqueued-time headers for distributed tracing and receive latency calculation. Add SentryKafkaProducerBeanPostProcessor to automatically wrap KafkaTemplate beans. Co-Authored-By: Claude * changelog * feat(spring-jakarta): Add Kafka consumer instrumentation Add SentryKafkaRecordInterceptor that creates queue.process transactions for incoming Kafka records. Forks scopes per record, extracts sentry-trace and baggage headers for distributed tracing via continueTrace, and calculates messaging.message.receive.latency from the enqueued-time header. Composes with existing RecordInterceptor via delegation. Span lifecycle is managed through success/failure callbacks. Add SentryKafkaConsumerBeanPostProcessor to register the interceptor on ConcurrentKafkaListenerContainerFactory beans. Co-Authored-By: Claude * changelog * feat(spring-boot-jakarta): Add Kafka queue auto-configuration Register SentryKafkaProducerBeanPostProcessor and SentryKafkaConsumerBeanPostProcessor when spring-kafka is on the classpath and sentry.enable-queue-tracing=true. Follows the same pattern as SentryCacheConfiguration. Co-Authored-By: Claude * changelog * test(samples): Add Kafka queue system tests for Spring Boot 3 Add KafkaQueueSystemTest with e2e tests for: - Producer endpoint creates queue.publish span - Consumer creates queue.process transaction - Distributed tracing (producer and consumer share same trace) - Messaging attributes on publish span and process transaction Also add produceKafkaMessage to RestTestClient and enable sentry.enable-queue-tracing in the kafka profile properties. Requires a running Kafka broker at localhost:9092 and the sample app started with --spring.profiles.active=kafka. Co-Authored-By: Claude * docs: Add rule against force-pushing stack branches Force-pushing a stack branch can cause GitHub to auto-merge or auto-close other PRs in the stack. Add explicit guidance to never use --force, --force-with-lease, or amend+push on stack branches. * docs: Also prohibit --amend on stack branches * feat(samples): Add Kafka producer and consumer to Spring Boot 3 OTel sample apps Add Kafka queue tracing support to both the OTel agent and agentless Spring Boot 3 sample applications. Each sample gets a KafkaController for producing messages and a KafkaConsumer listener, activated via the 'kafka' Spring profile. Kafka auto-configuration is excluded by default and only enabled when the kafka profile is active. * fix(spring-boot-jakarta): Disable Sentry Kafka instrumentation when OTel is active Skip registration of SentryKafkaProducerBeanPostProcessor and SentryKafkaConsumerBeanPostProcessor when a Sentry OpenTelemetry integration (agent or agentless) is on the classpath. OpenTelemetry provides its own Kafka instrumentation, so Sentry's would create duplicate spans. * fix(core): Add Kafka span origins to ignored list for OpenTelemetry Add auto.queue.spring_jakarta.kafka.producer and auto.queue.spring_jakarta.kafka.consumer to the ignored span origins when running with OTel agent or agentless-spring. Prevents duplicate spans when both Sentry and OTel Kafka instrumentation are active. * ref(spring-jakarta): Replace SentryKafkaProducerWrapper with SentryProducerInterceptor Replace the KafkaTemplate subclass approach with a Kafka-native ProducerInterceptor. The BeanPostProcessor now sets the interceptor on the existing KafkaTemplate instead of replacing the bean, which preserves any custom configuration on the template. Existing customer interceptors are composed using Spring's CompositeProducerInterceptor. If reflection fails to read the existing interceptor, a warning is logged. Co-Authored-By: Claude * fix(spring-jakarta): Update consumer references and add reflection warning log Update SentryKafkaRecordInterceptor and its test to reference SentryProducerInterceptor instead of the removed SentryKafkaProducerWrapper. Add a warning log in SentryKafkaConsumerBeanPostProcessor when reflection fails to read the existing RecordInterceptor, so users know their custom interceptor may not be chained. Co-Authored-By: Claude * fix(spring-jakarta): Initialize Sentry in SentryProducerInterceptorTest TransactionContext constructor requires ScopesAdapter.getOptions() to be non-null for thread checker access. Add initForTest/close to ensure Sentry is properly initialized during tests. Co-Authored-By: Claude * fix(spring-jakarta): Initialize Sentry in consumer test, fix API file ordering Add initForTest/close to SentryKafkaRecordInterceptorTest to fix NPE from TransactionContext constructor requiring initialized Sentry. Regenerate API file to fix alphabetical ordering of SentryProducerInterceptor entry. Co-Authored-By: Claude * fix(spring-jakarta): Clean up stale ThreadLocal context in Kafka consumer interceptor Implement clearThreadState() and defensive cleanup in intercept() to prevent ThreadLocal leaks of SentryRecordContext. Spring Kafka calls clearThreadState() in the poll loop's finally block, making it the most reliable cleanup hook for edge cases where success()/failure() callbacks are skipped (e.g. Error thrown by listener). Also add defensive cleanup at the start of intercept() to handle any stale context from a previous record that was not properly cleaned up. Co-Authored-By: Claude * fix(spring-jakarta): Fork root scopes and skip when OTel is active in Kafka consumer interceptor Use Sentry.forkedRootScopes() instead of scopes.forkedScopes() so each Kafka message starts with a clean scope from root, matching the pattern used by SentryWebFilter for reactive request boundaries. Add isIgnored() check using SpanUtils.isIgnored() on the trace origin so the interceptor no-ops when OTel is active and the origin is in the ignored span origins list, consistent with SentryTracingFilter. Co-Authored-By: Claude * fix(spring-jakarta): Guard entire span lifecycle in Kafka producer interceptor Wrap all span operations (startChild, setData, injectHeaders, finish) in a single try-catch so instrumentation can never break the customer's Kafka send. The record is always returned regardless of any exception in Sentry code. Co-Authored-By: Claude * fix(spring-jakarta): [Queue Instrumentation 12] Add Kafka retry count attribute Set messaging.message.retry.count on queue.process transactions when the Spring Kafka delivery attempt header is present. This keeps retry context on consumer traces without changing transaction lifecycle behavior. Co-Authored-By: Claude * fix(spring-jakarta): [Queue Instrumentation 13] Align enqueue time with Python Store sentry-task-enqueued-time as epoch seconds and compute receive latency from seconds on the consumer side. This aligns Java Kafka queue instrumentation with sentry-python Celery behavior for cross-SDK interoperability. Co-Authored-By: Claude * ref(kafka): Extract sentry-kafka module from spring-jakarta Move Kafka producer interceptor to a new sentry-kafka module and rename to SentryKafkaProducerInterceptor. Add SentryKafkaConsumerInterceptor for vanilla kafka-clients users. Spring integration now depends on sentry-kafka and passes a Spring-specific trace origin. This allows non-Spring applications to use Kafka queue instrumentation directly via kafka-clients interceptor config. Co-Authored-By: Claude * changelog * feat(kafka): Add no-arg producer interceptor for Kafka config Allow kafka-clients to instantiate SentryKafkaProducerInterceptor via interceptor.classes by adding a no-arg constructor that uses ScopesAdapter. This makes native Kafka interceptor wiring work out of the box in applications and samples.\n\nAlso add a Kafka tracing example to the console sample with a transaction-scoped producer send, and cover no-arg constructor behavior in sentry-kafka tests. Co-Authored-By: Claude * feat(kafka): Add consumer demo to console sample Show end-to-end Kafka queue tracing in the console sample by running a background consumer thread, producing a message, and waiting for consume before exit.\n\nAdd a no-arg constructor to SentryKafkaConsumerInterceptor so kafka-clients can instantiate it from interceptor.classes, and add test coverage for that constructor. Co-Authored-By: Claude * ref(samples): Extract Kafka console showcase into dedicated class Move Kafka producer/consumer showcase logic out of Main into KafkaShowcase to make the sample easier to read and follow. Keep runtime behavior unchanged by preserving the same demo entry point and flow. Co-Authored-By: Claude * feat(samples): Add opt-in Kafka console e2e coverage Gate the console Kafka showcase behind SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS so Kafka behavior is enabled only when configured. Keep the showcase isolated in KafkaShowcase and use fail-fast Kafka client timeouts for local runs.\n\nExtend console system tests to assert producer and consumer queue tracing when Kafka is enabled. Update system-test-runner to provision or reuse a local Kafka broker for the console module and clean up runner-managed resources. Co-Authored-By: Claude * ref(samples): Move KafkaShowcase to kafka subpackage Move KafkaShowcase under io.sentry.samples.console.kafka and update Main to import the relocated class. This keeps Kafka-specific sample code grouped in a dedicated package without changing runtime behavior. Co-Authored-By: Claude * Update KafkaShowcase.java extract constant * Update KafkaShowcase.java extract methods * Update KafkaShowcase.java refactor * Format code * fix * ref(samples): Clarify Kafka setup in console showcase Restructure KafkaShowcase to highlight the required Sentry interceptor configuration for producer and consumer setups. Split property construction into explicit helper methods and rename the entrypoint to make customer integration requirements easier to follow without changing behavior. Co-Authored-By: Claude * fix(test): Enable Kafka profile for Spring Kafka system tests Make the system test runner configure Kafka requirements by module. Start Kafka and set SPRING_PROFILES_ACTIVE=kafka for modules that need Kafka-backed Spring endpoints so queue system tests run with the expected routing and broker configuration. Co-Authored-By: Claude * fix(spring): Guard Kafka auto-config on sentry-kafka Require the sentry-kafka producer interceptor class before activating Spring Boot Jakarta queue auto-configuration. This keeps sentry-kafka optional for customers who only use the starter without Kafka queue tracing support on the classpath. Add a regression test that hides sentry-kafka from the classloader and verifies the Kafka bean post-processors are skipped instead of being registered. Co-Authored-By: Claude * feat(kafka): [Queue Instrumentation 17] Add manual consumer tracing helper Add an experimental helper for wrapping raw Kafka consumer record processing in queue.process transactions. This exposes Kafka consumer tracing outside interceptor-based integrations. Capture messaging metadata and distributed tracing context in the helper so future queue instrumentation can reuse the same behavior. Co-Authored-By: Claude * ref(kafka): Remove raw consumer interceptor Remove the raw Kafka consumer interceptor from sentry-kafka and update the console sample to use the manual consumer tracing helper instead. Keep producer tracing on the interceptor path and move consumer tracing to explicit record processing. Co-Authored-By: Claude * ref(samples): Clarify Kafka consumer tracing sample Print the consumed Kafka record inside the manual consumer tracing callback so the sample shows where application processing happens. Update the console system test to assert the manual queue.process transaction and its manual consumer origin. Co-Authored-By: Claude * fix(kafka): Honor ignored producer span origins Short-circuit the raw Kafka producer interceptor when its trace origin is configured in ignoredSpanOrigins. This lets customers disable the integration quickly without relying on the later no-op span path, and keeps the interceptor from injecting tracing headers when the origin is ignored. Co-Authored-By: Claude * ref(spring): Use injected scopes in Kafka interceptor Stop the Spring Kafka record interceptor from reaching through the static Sentry API when forking root scopes. This keeps the raw Kafka and Spring Kafka paths aligned and makes the interceptor easier to test. Co-Authored-By: Claude * ref(samples): [Queue Instrumentation 18] Move Kafka sources into queues.kafka package Move KafkaConsumer and KafkaController in the three Spring Boot Jakarta samples (jakarta, jakarta-opentelemetry, jakarta-opentelemetry-noagent) into a queues.kafka sub-package. No behavior change. Groups the Kafka-specific sample sources so future queue integrations can sit next to them under queues. Co-Authored-By: Claude * ref(samples): [Queue Instrumentation 19] Drop Kafka auto-config exclude from Spring Boot samples Remove `spring.autoconfigure.exclude=KafkaAutoConfiguration` from the default `application.properties` and the matching empty override from `application-kafka.properties` in the three Spring Boot Jakarta samples. `spring.autoconfigure.exclude` is a single list property, so overriding it in a profile replaces the whole list rather than merging. Adding a sibling `rabbitmq` profile with the same pattern would not compose — activating one profile would unsilence the other's auto-config. The `@Profile("kafka")` annotations already on `KafkaConsumer` and `KafkaController` gate the actual listener container and endpoint, so no broker connection is attempted when the profile is inactive. `KafkaAutoConfiguration` still runs and creates an unused `KafkaTemplate` bean in that case, which is harmless. Sentry's own Kafka auto-config remains gated on `sentry.enable-queue-tracing=true`, which is only set in `application-kafka.properties`, so Sentry instrumentation behavior is unchanged. * ref(kafka): [Queue Instrumentation 20] Log Kafka instrumentation failures Previously `SentryKafkaProducerInterceptor.onSend(...)` and `SentryKafkaConsumerTracing` silently swallowed any `Throwable` thrown while instrumenting a Kafka record. That protects customer Kafka I/O from breakage, but makes instrumentation bugs invisible. Log each caught `Throwable` to the SDK logger at `SentryLevel.ERROR` (matching the existing pattern in `RequestPayloadExtractor`) before continuing the fail-open path: - `SentryKafkaProducerInterceptor`: producer span creation / header injection - `SentryKafkaConsumerTracing`: scope fork + `makeCurrent`, transaction start, transaction finish No behavior change for customer callbacks or Kafka send/receive: the catches still swallow the throwable, they now just surface it via the SDK's own logger. `SentryKafkaRecordInterceptor` (Spring) was reviewed and intentionally left as-is — it does not wrap its instrumentation in `catch (Throwable)` blocks, so there is nothing silent to log. The `NumberFormatException` branches on malformed `sentry-task-enqueued-time` headers are expected input, not instrumentation faults, and remain silent. * fix(kafka): [Queue Instrumentation 21] Preserve third-party baggage on Kafka producer records `SentryKafkaProducerInterceptor.injectHeaders(...)` previously removed and overwrote the outgoing `baggage` header on every record, discarding any third-party baggage entries already present (e.g. set by another vendor's instrumentation or the application itself). Read the existing `baggage` header values off the `ProducerRecord` and pass them to `TracingUtils.trace(...)`. The downstream `BaggageHeader.fromBaggageAndOutgoingHeader` preserves non-`sentry-*` entries in the outgoing header while Sentry continues to own its own keys. Co-Authored-By: Claude * test(spring-boot-jakarta): [Queue Instrumentation 22] Cover spring-kafka class-absence gate `SentryKafkaQueueConfiguration` in `SentryAutoConfiguration` gates the Kafka BPPs on both `org.springframework.kafka.core.KafkaTemplate` and `io.sentry.kafka.SentryKafkaProducerInterceptor` being present on the classpath. Only the latter was covered by a test. Add a `FilteredClassLoader(KafkaTemplate::class.java)` test that asserts neither `SentryKafkaProducerBeanPostProcessor` nor `SentryKafkaConsumerBeanPostProcessor` is registered when spring-kafka is missing, even with `sentry.enable-queue-tracing=true`. Co-Authored-By: Claude * fix(spring-jakarta): [Queue Instrumentation 23] Install Kafka context before trace setup Store the lifecycle token in the thread-local context immediately after makeCurrent() so Spring's failure and clearThreadState callbacks can always clean it up. Previously, exceptions from trace continuation or transaction setup could happen before the context was published, leaving cleanup dependent on later stale-context handling instead of the normal interceptor callback path. * fix(kafka): [Queue Instrumentation 24] Read all baggage headers on consumers Pass every Kafka baggage header through trace continuation in both the raw Kafka helper and the Spring Kafka record interceptor. Previously both consumer paths used lastHeader("baggage"), which dropped all earlier baggage values and could break interop with upstream OTel or other W3C baggage producers. Reading the full header list preserves the existing baggage context during queue trace continuation. * fix(kafka): [Queue Instrumentation 25] Finish producer spans on failures Keep a local producer child span reference and always finish it when instrumentation fails after span creation. This preserves fail-open send behavior without leaking unfinished queue.publish spans. Add a regression test covering header injection failures. Co-Authored-By: Claude * fix(kafka): [Queue Instrumentation 26] Mark producer interceptor experimental The raw kafka producer path requires customers to reference SentryKafkaProducerInterceptor directly by class name, so it should not be marked internal. Align it with the customer-facing queue tracing surface by marking it experimental instead. Audit the remaining Kafka classes still marked internal and keep them as-is: the Spring bean post processors and Spring record interceptor remain framework wiring internals rather than direct customer entry points. Co-Authored-By: Claude * fix(spring-jakarta): [Queue Instrumentation 27] Delegate Kafka record thread-state hooks SentryKafkaRecordInterceptor wraps an existing customer RecordInterceptor when one is present on the listener container factory, but it previously only delegated intercept, success, failure, and afterRecord. setupThreadState was not overridden, so the default no-op from ThreadStateProcessor shadowed any delegate implementation. clearThreadState performed Sentry cleanup but never forwarded to the delegate either. Customers relying on these hooks for MDC, security context, or other thread-local state on Kafka listener threads would silently lose that behavior once Sentry auto-wrapped their interceptor. Delegate setupThreadState to the wrapped interceptor, and in clearThreadState run Sentry cleanup inside try and delegate to the wrapped interceptor in finally so delegate cleanup still executes if Sentry cleanup throws. Co-Authored-By: Claude * test(samples): Cover OTel Jakarta Kafka coexistence end-to-end Enable the Kafka Spring profile (and Kafka broker) for the two OTel Spring Boot 3 Jakarta sample modules in the system-test runner, and add a Kafka system test in each that produces a message and asserts no Sentry-style `queue.publish` / `queue.process` span/transaction is emitted. SentryKafkaQueueConfiguration is guarded by @ConditionalOnMissingClass("io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider"), so the Sentry Kafka bean post-processors must not be wired when the Sentry OTel integration is present. The new assertions lock that suppression into CI for both the agent and noagent OTel Jakarta samples. Addresses review finding F-011. * fix(spring-jakarta): [Queue Instrumentation 29] Set body_size on Spring Kafka consumer transaction The Spring Kafka consumer path (`SentryKafkaRecordInterceptor`) never set `messaging.message.body_size`, while the raw Kafka consumer helper (`SentryKafkaConsumerTracing`) already sets it from `ConsumerRecord#serializedValueSize()`. Both are first-party Kafka consumer integrations shipped in the same stack and should emit the same messaging schema so dashboards and queries remain consistent across Spring vs. raw Kafka setups. Mirror the raw helper: set `SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE` on the `queue.process` transaction when `serializedValueSize() >= 0`. Add regression tests for both the positive and the -1 (unknown) cases. #skip-changelog * test(spring-jakarta): [Queue Instrumentation 30] Cover Kafka record interceptor lifecycle edge cases Add three regression tests for SentryKafkaRecordInterceptor that pin down the lifecycle contract around clearThreadState cleanup: - full lifecycle intercept -> success -> clearThreadState closes the lifecycle token exactly once and does not double-finish the transaction - when a delegating interceptor returns null from intercept (filtering the record), the safety net in clearThreadState still finishes the transaction and closes the token - when a delegating interceptor throws from intercept, clearThreadState still finishes the transaction and closes the token after the exception has propagated Addresses review finding R6-F001. Co-Authored-By: Claude * fix(kafka): [Queue Instrumentation 31] Write enqueued-time header as plain decimal The sentry-task-enqueued-time Kafka header was serialized via String.valueOf(double), which emits scientific notation (e.g. 1.776933649613E9) for epoch-seconds values. Cross-SDK consumers (sentry-python, -ruby, -php, -dotnet) expect a plain decimal like 1776938295.692000 and could not parse the Java output, defeating the cross-SDK alignment goal of #5283. Route the value through DateUtils.doubleToBigDecimal(...).toString(), the same helper already used to serialize epoch-seconds timestamps in SentryTransaction, SentrySpan, SentryLogEvent, etc. At the pinned scale of 6, BigDecimal.toString() produces plain decimal form for all realistic epoch-seconds magnitudes. Add regression assertions that reject scientific notation and pin the plain-decimal format in SentryKafkaProducerInterceptorTest. Co-Authored-By: Claude * changelog * test(spring-boot-jakarta): [Queue Instrumentation 32] Filter OTel in Kafka auto-config negative tests The regression tests "does not register Kafka BPPs when sentry-kafka is not present" and "...when spring-kafka is not present" previously passed for the wrong reason: OTel's SentryAutoConfigurationCustomizerProvider is on the test classpath as a testImplementation dependency, so the @ConditionalOnMissingClass(OTel) gate on SentryKafkaQueueConfiguration was already blocking the beans independent of the @ConditionalOnClass check the tests were meant to validate. Make noSentryKafkaClassLoader and noSpringKafkaClassLoader additionally filter SentryAutoConfigurationCustomizerProvider so only the gate under test can be the blocker. Verified by temporarily removing SentryKafkaProducerInterceptor from the @ConditionalOnClass list: the test now correctly fails, proving it actually guards against the regression it is named for. Co-Authored-By: Claude * feat(opentelemetry): [Queue Instrumentation 33] Map OTel messaging spans to Sentry queue ops Wire OTel messaging spans into the Sentry Queues product when `sentry.enable-queue-tracing=true` so OTel-only setups (e.g. the agentless Spring Boot Jakarta sample) populate queue dashboards without needing the Sentry-native Kafka interceptors. `SpanDescriptionExtractor` now recognizes spans carrying `messaging.system` and maps them to `queue.publish` / `queue.process` / `queue.receive` ops, using the destination name as the description and `TransactionNameSource.TASK`. Op selection prefers `messaging.operation.type` (current OTel semconv), falls back to the deprecated `messaging.operation`, and only as a last resort consults `SpanKind` — `SpanKind.CONSUMER` is overloaded for both `receive` and `process`, so attribute-driven mapping is required to disambiguate. The extractor takes `SentryOptions` so the mapping stays gated; when the flag is off, behavior is unchanged. `SentrySpanExporter` additionally transfers the messaging attributes (`system`, `destination.name`, `operation.type`, `message.id`, `message.body.size`, `message.envelope.size`) onto root transactions. Root transactions don't bulk-copy OTel attributes the way child spans do, but the Queues product reads `trace.data.messaging.*`, so consumer root transactions need them propagated explicitly. These are operational metadata only (no payload contents), so the transfer is unconditional. Add `MESSAGING_OPERATION_TYPE` and `MESSAGING_MESSAGE_ENVELOPE_SIZE` to `SpanDataConvention` for use by the exporter and downstream integrations. Document the OTel-mode behavior in the two Jakarta OTel sample `application-kafka.properties` so users know the flag activates the OTel remapping path here, not the Sentry-native Kafka auto-config (which stays suppressed by its `@ConditionalOnMissingClass` OTel guard). * fix(otel): Prefer messaging over http mapping when queue tracing enabled Some OTel instrumentations (notably aws-sdk-2.2 SQS) attach both `http.request.method` and `messaging.system` to the same span. With the previous gate order, those spans resolved to http.client and the Sentry Queues product never lit up for one of the most common OTel-coexistence targets. When `enableQueueTracing` is true and `messaging.system` is present, map to a queue.* op before the http and db checks. When the flag is off, the existing http-first ordering is preserved. Co-Authored-By: Claude * fix(otel): Map messaging "create" to queue.create instead of queue.publish The OTel messaging semconv defines "create" and "publish" as distinct operations: "create" represents message construction, "publish" the network send. Folding both into queue.publish risks double-counting producer transactions on instrumentations that emit a separate create span (per OTel semconv guidance). Per the Sentry Queues telemetry spec (https://develop.sentry.dev/sdk/telemetry/traces/modules/queues/), queue.create is a canonical op distinct from queue.publish, so map "create" to its spec-correct destination rather than dropping it. Empirically, current Kafka OTel instrumentation does not emit a separate create span, so this is a no-op for Kafka users today; the change future-proofs other systems and any future Kafka OTel version. Co-Authored-By: Claude * docs(options): Clarify enableQueueTracing covers native + OTel paths The setEnableQueueTracing Javadoc said only "Whether queue operations (publish, process) should be traced." — silent on the fact that the flag also drives OTel messaging-span transformation when sentry-opentelemetry is on the classpath. Reword on both the getter and setter to make explicit that the flag both emits Sentry-native queue spans and transforms OTel messaging spans to match Sentry's queue conventions, so customers grepping their IDE see what the flag does in either integration mode. Co-Authored-By: Claude * fix(otel): Map messaging "settle" to queue.settle OTel messaging semconv defines messaging.operation.type=settle for consumer ack/nack/reject spans (JMS, RabbitMQ, Pulsar acknowledge). The switch had no case for "settle", so settle spans on SpanKind.CONSUMER were falling through to the SpanKind fallback and becoming queue.process — duplicating the real process span — while on SpanKind.CLIENT they became the generic "queue" default. queue.settle is one of the canonical Queues telemetry ops per https://develop.sentry.dev/sdk/telemetry/traces/modules/queues/, so add the explicit mapping. Co-Authored-By: Claude * chore(samples): Drop verbose comment above sentry.enable-queue-tracing The OTel Kafka sample properties carried a 10-line comment explaining the OTel->Sentry remapping mechanism and SentryKafkaQueueConfiguration suppression behavior. That belongs in the SDK docs, not in a sample config — drop it so the property line speaks for itself. Co-Authored-By: Claude * feat(kafka): [Queue Instrumentation 34] Wrap Producer for send spans Replace SentryKafkaProducerInterceptor with SentryKafkaProducer, a Producer wrapper that records a queue.publish span around each send and finishes it when the broker ack callback fires. The span now reflects the full async send lifecycle, not just the synchronous onSend window. For Spring Boot, the SentryKafkaProducerBeanPostProcessor switches from patching KafkaTemplate.setProducerInterceptor(...) to installing a ProducerPostProcessor on every ProducerFactory bean via ProducerFactory.addPostProcessor(...). KafkaTemplate beans are no longer touched, so all customer-configured listeners, interceptors and observation settings are preserved. The console sample now wraps the raw KafkaProducer instead of setting INTERCEPTOR_CLASSES_CONFIG. Spring Boot samples need no change — the auto-configured ProducerPostProcessor is transparent. Co-Authored-By: Claude * fix(kafka): Inject trace headers even without active span Decouple header injection from span creation in SentryKafkaProducer so that distributed tracing works for background workers, @Scheduled jobs, and startup publishers that have no active span. Restructure send() to match the SentryFeignClient/OkHttp pattern: - isIgnored: pure delegate, no headers, no span - No active span: inject headers from PropagationContext, no span - Active span: start child span, inject headers, wrap callback Also simplify the implementation: - Rename injectHeaders to maybeInjectHeaders with encapsulated try/catch (matches Feign's maybeAddTracingHeaders pattern) - Remove outer try/catch around span setup - Remove redundant span.isNoOp() early-return branch - Remove redundant isFinished() guards before finish() calls Co-Authored-By: Claude * changelog * ref(kafka): Reimplement SentryKafkaProducer as a dynamic Proxy Replace the concrete `implements Producer` class with a `Proxy.newProxyInstance`-based wrapper that intercepts only the two `send()` overloads and forwards every other method reflectively to the delegate. The concrete class required explicitly delegating every method on the `Producer` interface, coupling the wrapper to a specific Kafka version: `clientInstanceId(Duration)` was added in Kafka 3.7, and the deprecated `sendOffsetsToTransaction(Map, String)` was removed in Kafka 4.0. The dynamic proxy has no such coupling — new or removed interface methods are handled automatically, giving full compatibility across all Kafka client versions. Public API change: `SentryKafkaProducer` is now a utility class with static `wrap()` overloads instead of constructors. Callers wrap a producer with `SentryKafkaProducer.wrap(producer)`. The Spring BPP and console sample are updated accordingly. Co-Authored-By: Claude * fix(spring-jakarta): Warn when Kafka producer tracing silently fails When ProducerFactory.addPostProcessor() is a no-op (the interface default), the Sentry post-processor is silently dropped and the customer gets zero producer tracing with no signal. Verify registration succeeded via getPostProcessors() after each addPostProcessor() call, and log a WARNING naming the factory bean and pointing toward SentryKafkaProducer.wrap() as the manual fallback. Co-Authored-By: Claude * fix(kafka): Preserve existing consumer interceptor on reflection failure If reading recordInterceptor via reflection fails, leave the container\nfactory untouched instead of installing Sentry's interceptor with a\nnull delegate. This avoids silently dropping customer-configured\ninterceptors for DLQ routing, auditing, or other message handling\nconcerns.\n\nAdd tests that preserve customer interceptors both when chaining\nsucceeds and when reflection cannot safely determine the existing\ninterceptor.\n\nCo-Authored-By: Claude * fix(spring-boot-jakarta): Skip Kafka autoconfig for OTel agent * fix(spring-jakarta): Close leaked Kafka interceptor scope Store the lifecycle token in the thread-local before trace continuation or transaction startup can throw. This keeps the cleanup path reachable and closes the forked scopes even when interceptor preparation fails. Also log the preparation failure instead of letting the interceptor break customer processing. * fix(test): Remove stale Kafka container before startup Always remove the named Kafka system-test container before starting a new broker. This avoids docker name conflicts after crashed or interrupted runs while still keeping stop_kafka_broker ownership-aware for reused brokers. Co-Authored-By: Claude * test(otel): Add send and deliver mapping coverage * test(kafka): Add no-op producer span coverage * fix(kafka): Pass consumer interceptor log throwable correctly * test(kafka): Exercise consumer interceptor reflection failure Force the reflection-failure path in the consumer bean post processor test so it proves customer interceptors remain untouched when Sentry skips installation. Co-Authored-By: Claude * fix(test): Set SENTRY_ENABLE_QUEUE_TRACING for Kafka system tests When SENTRY_AUTO_INIT=true with the OTel agent, Sentry is initialized early by SentryAutoConfigurationCustomizerProvider before Spring Boot loads application-kafka.properties. Without the env var, queue tracing stays disabled and OTel messaging spans are not mapped to queue.publish/queue.process ops, causing KafkaOtelCoexistenceSystemTest to fail. Co-Authored-By: Claude * feat(spring): Add Kafka queue tracing for Spring Boot 4 Port the Spring Boot 3 Kafka queue tracing support to the Spring 7 and Spring Boot 4 modules. Add Spring Kafka bean post-processors, Boot 4 auto-configuration, and matching sample system-test coverage. Co-Authored-By: Claude * changelog * feat(spring): Add Kafka queue tracing for Spring Boot 2 Port Kafka queue tracing to the Spring and Spring Boot 2 modules. Add Spring Kafka bean post-processors, Boot 2 auto-configuration, and matching sample system-test coverage. Co-Authored-By: Claude * docs(rules): Add queue tracing cursor rules Document when to load queue-specific Cursor rules and summarize how Sentry Queues data is produced by the Java SDK Kafka instrumentation. Co-Authored-By: Claude * changelog * build(samples): Use Spring Boot Kafka starter in Boot 4 samples * fix(queue): Apply queue instrumentation review changes * test(spring): Address Kafka tracing review comments Simplify Kafka interceptor test delegates and rely on Kotlin type inference in Spring Kafka tests. Co-Authored-By: Claude * test(spring): Initialize Sentry in Kafka BPP tests Initialize Sentry before each Kafka bean post-processor test and close it afterwards so logging paths do not depend on test execution order. This prevents failures when earlier tests close the SDK before these tests run. Co-Authored-By: Claude * test(spring): Address Kafka review comments Simplify Spring Kafka test interceptors and cover intercepting records without a consumer. Co-Authored-By: Claude * test(spring): Isolate capture exception advice scopes Initialize Sentry before installing the mocked scopes used by the capture exception parameter advice test. Close Sentry after the test so the mocked scopes do not leak into later tests. Co-Authored-By: Claude * changelog entry * fix README changes * test(otel): Relax Kafka coexistence span assertion Avoid requiring the async Kafka producer span to be embedded in the HTTP transaction. OTel can finish and export the producer span after the request transaction, so this assertion flakes while the test still verifies OTel instrumentation suppresses Spring Kafka integration. Refs #5373 Co-Authored-By: Claude * fix(kafka): Make producer proxy equality reflexive Return true when the Kafka producer proxy is compared with itself. This preserves existing delegate equality behavior for other comparisons while satisfying the equals contract. Co-Authored-By: Claude --------- Co-authored-by: Claude Co-authored-by: Sentry Github Bot --- .cursor/rules/overview_dev.mdc | 10 + .cursor/rules/pr.mdc | 2 + .cursor/rules/queues.mdc | 82 +++ CHANGELOG.md | 10 + README.md | 1 + buildSrc/src/main/java/Config.kt | 1 + gradle/libs.versions.toml | 5 + sentry-kafka/README.md | 5 + sentry-kafka/api/sentry-kafka.api | 19 + sentry-kafka/build.gradle.kts | 83 +++ .../kafka/SentryKafkaConsumerTracing.java | 280 ++++++++++ .../io/sentry/kafka/SentryKafkaProducer.java | 265 ++++++++++ .../kafka/SentryKafkaConsumerTracingTest.kt | 254 +++++++++ .../sentry/kafka/SentryKafkaProducerTest.kt | 375 ++++++++++++++ .../api/sentry-opentelemetry-core.api | 2 +- .../opentelemetry/SentrySpanExporter.java | 18 +- .../opentelemetry/SentrySpanProcessor.java | 4 +- .../SpanDescriptionExtractor.java | 61 ++- .../kotlin/SpanDescriptionExtractorTest.kt | 251 ++++++++- .../sentry-samples-console/build.gradle.kts | 2 + .../java/io/sentry/samples/console/Main.java | 13 + .../samples/console/kafka/KafkaShowcase.java | 143 ++++++ .../ConsoleApplicationSystemTest.kt | 49 +- .../build.gradle.kts | 4 + .../boot4/queues/kafka/KafkaConsumer.java | 19 + .../boot4/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../boot4/queues/kafka/KafkaConsumer.java | 19 + .../boot4/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../boot4/queues/kafka/KafkaConsumer.java | 19 + .../boot4/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 10 + .../sentry/systemtest/KafkaQueueSystemTest.kt | 117 +++++ .../build.gradle.kts | 4 + .../jakarta/queues/kafka/KafkaConsumer.java | 19 + .../jakarta/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../jakarta/queues/kafka/KafkaConsumer.java | 19 + .../jakarta/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../jakarta/queues/kafka/KafkaConsumer.java | 19 + .../jakarta/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 10 + .../src/main/resources/application.properties | 1 + .../sentry/systemtest/KafkaQueueSystemTest.kt | 117 +++++ .../build.gradle.kts | 4 + .../boot/queues/kafka/KafkaConsumer.java | 19 + .../boot/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../boot/queues/kafka/KafkaConsumer.java | 19 + .../boot/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 12 + .../KafkaOtelCoexistenceSystemTest.kt | 37 ++ .../build.gradle.kts | 4 + .../boot/queues/kafka/KafkaConsumer.java | 19 + .../boot/queues/kafka/KafkaController.java | 26 + .../resources/application-kafka.properties | 10 + .../sentry/systemtest/KafkaQueueSystemTest.kt | 117 +++++ sentry-spring-7/api/sentry-spring-7.api | 23 + sentry-spring-7/build.gradle.kts | 4 + .../SentryKafkaConsumerBeanPostProcessor.java | 98 ++++ .../SentryKafkaProducerBeanPostProcessor.java | 76 +++ .../kafka/SentryKafkaRecordInterceptor.java | 292 +++++++++++ ...entryKafkaConsumerBeanPostProcessorTest.kt | 124 +++++ ...entryKafkaProducerBeanPostProcessorTest.kt | 109 ++++ .../kafka/SentryKafkaRecordInterceptorTest.kt | 473 +++++++++++++++++ sentry-spring-boot-4/build.gradle.kts | 3 + .../spring/boot4/SentryAutoConfiguration.java | 30 ++ .../boot4/SentryKafkaAutoConfigurationTest.kt | 125 +++++ sentry-spring-boot-jakarta/build.gradle.kts | 3 + .../boot/jakarta/SentryAutoConfiguration.java | 30 ++ .../SentryKafkaAutoConfigurationTest.kt | 125 +++++ sentry-spring-boot/build.gradle.kts | 4 + .../spring/boot/SentryAutoConfiguration.java | 30 ++ .../boot/SentryKafkaAutoConfigurationTest.kt | 125 +++++ .../api/sentry-spring-jakarta.api | 23 + sentry-spring-jakarta/build.gradle.kts | 4 + .../SentryKafkaConsumerBeanPostProcessor.java | 98 ++++ .../SentryKafkaProducerBeanPostProcessor.java | 76 +++ .../kafka/SentryKafkaRecordInterceptor.java | 292 +++++++++++ ...entryKafkaConsumerBeanPostProcessorTest.kt | 124 +++++ ...entryKafkaProducerBeanPostProcessorTest.kt | 109 ++++ .../kafka/SentryKafkaRecordInterceptorTest.kt | 476 +++++++++++++++++ sentry-spring/api/sentry-spring.api | 24 + sentry-spring/build.gradle.kts | 4 + .../SentryKafkaConsumerBeanPostProcessor.java | 98 ++++ .../SentryKafkaProducerBeanPostProcessor.java | 76 +++ .../kafka/SentryKafkaRecordInterceptor.java | 298 +++++++++++ ...ntryCaptureExceptionParameterAdviceTest.kt | 9 + ...entryKafkaConsumerBeanPostProcessorTest.kt | 110 ++++ ...entryKafkaProducerBeanPostProcessorTest.kt | 95 ++++ .../kafka/SentryKafkaRecordInterceptorTest.kt | 486 ++++++++++++++++++ .../sentry/systemtest/util/RestTestClient.kt | 6 + sentry/api/sentry.api | 12 + .../main/java/io/sentry/ExternalOptions.java | 11 + .../main/java/io/sentry/SentryOptions.java | 26 + .../java/io/sentry/SpanDataConvention.java | 8 + .../main/java/io/sentry/util/SpanUtils.java | 4 + .../java/io/sentry/ExternalOptionsTest.kt | 14 + .../test/java/io/sentry/SentryOptionsTest.kt | 22 + settings.gradle.kts | 1 + test/system-test-runner.py | 124 +++++ 113 files changed, 7335 insertions(+), 21 deletions(-) create mode 100644 .cursor/rules/queues.mdc create mode 100644 sentry-kafka/README.md create mode 100644 sentry-kafka/api/sentry-kafka.api create mode 100644 sentry-kafka/build.gradle.kts create mode 100644 sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaConsumerTracing.java create mode 100644 sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaProducer.java create mode 100644 sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaConsumerTracingTest.kt create mode 100644 sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaProducerTest.kt create mode 100644 sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka/KafkaShowcase.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt create mode 100644 sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java create mode 100644 sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java create mode 100644 sentry-samples/sentry-samples-spring-boot/src/main/resources/application-kafka.properties create mode 100644 sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessor.java create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessor.java create mode 100644 sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaRecordInterceptor.java create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt create mode 100644 sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaRecordInterceptorTest.kt create mode 100644 sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryKafkaAutoConfigurationTest.kt create mode 100644 sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryKafkaAutoConfigurationTest.kt create mode 100644 sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryKafkaAutoConfigurationTest.kt create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessor.java create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessor.java create mode 100644 sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor.java create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt create mode 100644 sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptorTest.kt create mode 100644 sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessor.java create mode 100644 sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessor.java create mode 100644 sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaRecordInterceptor.java create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt create mode 100644 sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaRecordInterceptorTest.kt diff --git a/.cursor/rules/overview_dev.mdc b/.cursor/rules/overview_dev.mdc index 17ce98f07be..b837be34add 100644 --- a/.cursor/rules/overview_dev.mdc +++ b/.cursor/rules/overview_dev.mdc @@ -66,6 +66,15 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - `SentryMetricsEvent`, `SentryMetricsEvents` - `SentryOptions.getMetrics()`, `beforeSend` callback +- **`queues`**: Use when working with: + - Sentry Queues product data or messaging span conventions + - Queue tracing spans/transactions (`queue.publish`, `queue.process`) + - `enableQueueTracing` option and `sentry.enable-queue-tracing` + - Kafka instrumentation (`sentry-kafka`, `SentryKafkaProducer`, `SentryKafkaConsumerTracing`) + - Spring Kafka queue auto-instrumentation and `SentryKafkaRecordInterceptor` + - Messaging span data (`messaging.system`, `messaging.destination.name`, receive latency, retry count) + - `sentry-task-enqueued-time` header and distributed trace propagation through queues + - **`continuous_profiling_jvm`**: Use when working with: - JVM continuous profiling (`sentry-async-profiler` module) - `IContinuousProfiler`, `JavaContinuousProfiler` @@ -118,6 +127,7 @@ Use the `fetch_rules` tool to include these rules when working on specific areas - System test/e2e/sample → `e2e_tests` - Feature flag/addFeatureFlag/flag evaluation → `feature_flags` - Metrics/count/distribution/gauge → `metrics` + - Queues/queue tracing/Kafka/Spring Kafka/queue.publish/queue.process/enableQueueTracing/messaging spans → `queues` - PR/pull request/stacked PR/stack → `pr` - JVM continuous profiling/async-profiler/JFR/ProfileChunk → `continuous_profiling_jvm` - Android continuous profiling/AndroidProfiler/frame metrics/method tracing → no dedicated rule yet; inspect the code directly diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index 08a07511c67..e15c0a0a563 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -258,3 +258,5 @@ git push **Never merge into the collection branch.** Syncing only happens between stack PR branches. The collection branch is untouched until the user merges PRs through GitHub. Prefer merge over rebase — it preserves commit history, doesn't invalidate existing review comments, and avoids the need for force-pushing. Only rebase if explicitly requested. + +**Never amend or force-push stack branches.** Do not use `git commit --amend`, `--force`, or `--force-with-lease` on branches that are part of a stack. Amending a pushed commit requires a force-push, which can cause GitHub to auto-merge or auto-close other PRs in the stack. If a commit needs fixing, add a new fixup commit instead. diff --git a/.cursor/rules/queues.mdc b/.cursor/rules/queues.mdc new file mode 100644 index 00000000000..fe082c3b854 --- /dev/null +++ b/.cursor/rules/queues.mdc @@ -0,0 +1,82 @@ +--- +alwaysApply: false +description: Sentry Queues module and Java SDK queue tracing +--- +# Sentry Queues and Java SDK Queue Tracing + +## Product model + +Sentry Queues is built from tracing data. SDKs mark queue work with queue-specific span operations and messaging span data so Sentry can identify producers, consumers, destinations, latency, and failures. + +The important concepts are: +- `queue.publish`: a span for enqueueing/publishing a message to a queue or topic. +- `queue.process`: a transaction for processing a dequeued message. +- Messaging span data, especially: + - `messaging.system` (for example `kafka`) + - `messaging.destination.name` (queue/topic name) + - `messaging.message.id` + - `messaging.message.retry.count` + - `messaging.message.body.size` + - `messaging.message.envelope.size` + - `messaging.message.receive.latency` +- Distributed tracing headers (`sentry-trace` and `baggage`) link producer-side work to consumer-side processing. +- Queue receive latency is the time a message spent waiting between publish/enqueue and processing. For Java Kafka, this comes from the `sentry-task-enqueued-time` header that the producer writes and the consumer reads. + +The Queues UI is not backed by a separate Java event type. The Java SDK contributes data through spans/transactions with the expected operations, trace context, statuses, and messaging attributes. + +## Java SDK implementation + +Queue tracing is opt-in. `SentryOptions.isEnableQueueTracing()` defaults to `false` and can be enabled with `setEnableQueueTracing(true)` or external config key `enable-queue-tracing` (`sentry.enable-queue-tracing` in Spring Boot). Captured queue spans/transactions still depend on tracing being enabled and sampled. + +Kafka support lives in `sentry-kafka`: +- `SentryKafkaProducer.wrap(Producer)` wraps Kafka `Producer.send(...)` calls. + - Creates a `queue.publish` child span when there is an active span. + - Sets `messaging.system=kafka` and `messaging.destination.name=`. + - Injects `sentry-trace`, `baggage`, and `sentry-task-enqueued-time` headers. + - Still injects tracing/enqueued-time headers when queue tracing is enabled but there is no active span, so background producers can link to consumers. + - Finishes the span from the Kafka callback with `OK` or `INTERNAL_ERROR`. +- `SentryKafkaConsumerTracing.withTracing(record, callback)` is the manual raw-Kafka consumer helper. + - Forks root scopes for the processing lifecycle and makes them current. + - Continues the trace from Kafka headers. + - Starts a `queue.process` transaction bound to scope when tracing is enabled. + - Sets Kafka messaging data, body size, retry count, and receive latency when available. + - Finishes with `OK` or `INTERNAL_ERROR` and never lets instrumentation failures break customer processing. + +Spring Kafka support lives in `sentry-spring`, `sentry-spring-jakarta`, and `sentry-spring-7`: +- `SentryKafkaProducerBeanPostProcessor` installs a producer post-processor on `DefaultKafkaProducerFactory` and wraps created producers with `SentryKafkaProducer.wrap(...)`. +- `SentryKafkaConsumerBeanPostProcessor` installs `SentryKafkaRecordInterceptor` on listener container factories. +- `SentryKafkaRecordInterceptor` starts/finishes `queue.process` transactions around listener processing, continues traces from headers, forks scopes for the record lifecycle, and preserves any existing delegate interceptor. +- Spring Boot auto-configuration registers both post-processors only when Spring Kafka and `sentry-kafka` are present and `sentry.enable-queue-tracing=true`. +- Spring Boot queue auto-configuration is disabled when Sentry OpenTelemetry integration classes are present to avoid duplicate Kafka instrumentation. + +## Trace origins and suppression + +Queue instrumentation sets span origins so it can be identified and suppressed with `ignoredSpanOrigins`: +- Raw Kafka producer: `auto.queue.kafka.producer` +- Raw Kafka consumer helper: `manual.queue.kafka.consumer` +- Spring Kafka producer: `auto.queue.spring.kafka.producer`, `auto.queue.spring_jakarta.kafka.producer`, `auto.queue.spring7.kafka.producer` +- Spring Kafka consumer: `auto.queue.spring.kafka.consumer`, `auto.queue.spring_jakarta.kafka.consumer`, `auto.queue.spring7.kafka.consumer` + +## Files to inspect when changing queue tracing + +- Core option and conventions: + - `sentry/src/main/java/io/sentry/SentryOptions.java` + - `sentry/src/main/java/io/sentry/ExternalOptions.java` + - `sentry/src/main/java/io/sentry/SpanDataConvention.java` +- Raw Kafka: + - `sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaProducer.java` + - `sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaConsumerTracing.java` + - `sentry-kafka/src/test/kotlin/io/sentry/kafka/*Test.kt` +- Spring Kafka: + - `sentry-spring*/src/main/java/io/sentry/**/kafka/*` + - `sentry-spring*/src/test/kotlin/io/sentry/**/kafka/*Test.kt` + - `sentry-spring-boot*/src/main/java/io/sentry/**/SentryAutoConfiguration.java` + - `sentry-spring-boot*/src/test/kotlin/io/sentry/**/SentryKafkaAutoConfigurationTest.kt` + +## Related rules + +Also fetch: +- `options` when changing `enableQueueTracing` or configuration surfaces. +- `scopes` when changing consumer scope forking/lifecycle. +- `opentelemetry` when changing coexistence with OTel auto-instrumentation. +- `api` when changing public Kafka APIs or option methods. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b945938d2b..244d229b994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,16 @@ .configurator { it.isUseShakeGesture = true } .create() ``` +- Add support for Kafka ([#5249](https://github.com/getsentry/sentry-java/pull/5249)) + - You will need to add the `sentry-kafka` dependency and opt-in via the new option. + - Set `options.setEnableQueueTracing(true)` on `Sentry.init` + - Or set `sentry.enable-queue-tracing=true` in `application.properties` + - For Spring Boot Kafka is auto instrumented and no further configuration is needed. + - also see https://docs.sentry.io/platforms/java/guides/spring-boot/integrations/kafka/ + - When using `kafka-clients` directly + - you need to wrap your `KafkaProducer` via `SentryKafkaProducer.wrap(kafkaProducer)` to get `queue.publish` spans + - and you may use our `SentryKafkaConsumerTracing.withTracing` helper to instrument the consumer side manually. + - also see https://docs.sentry.io/platforms/java/integrations/kafka/ ### Fixes diff --git a/README.md b/README.md index 7d9ad7ba287..9aaf7aca4d8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Sentry SDK for Java and Android | 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 | | 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) | | 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-kafka | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-kafka?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-kafka) | | sentry-apollo | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo) | 21 | | sentry-apollo-3 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-3?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo-3) | 21 | | sentry-apollo-4 | [![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-apollo-4?style=for-the-badge&logo=sentry&color=green)](https://central.sonatype.com/artifact/io.sentry/sentry-apollo-4) | 21 | diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 3285db23a98..3410d9601d3 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -80,6 +80,7 @@ object Config { val SENTRY_JCACHE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jcache" val SENTRY_QUARTZ_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.quartz" val SENTRY_JDBC_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jdbc" + val SENTRY_KAFKA_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.kafka" val SENTRY_OPENFEATURE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.openfeature" val SENTRY_LAUNCHDARKLY_SERVER_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.launchdarkly-server" val SENTRY_LAUNCHDARKLY_ANDROID_SDK_NAME = "$SENTRY_ANDROID_SDK_NAME.launchdarkly" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cf7bc7b4f32..50d415c212a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -184,6 +184,10 @@ springboot3-starter-security = { module = "org.springframework.boot:spring-boot- springboot3-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot3" } springboot3-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot3" } springboot3-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot3" } +spring-kafka2 = { module = "org.springframework.kafka:spring-kafka", version = "2.8.11" } +spring-kafka3 = { module = "org.springframework.kafka:spring-kafka", version = "3.3.5" } +spring-kafka4 = { module = "org.springframework.kafka:spring-kafka" } +kafka-clients = { module = "org.apache.kafka:kafka-clients", version = "3.8.1" } springboot4-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" } springboot4-resttestclient = { module = "org.springframework.boot:spring-boot-resttestclient", version.ref = "springboot4" } springboot4-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot4" } @@ -200,6 +204,7 @@ springboot4-starter-webclient = { module = "org.springframework.boot:spring-boot springboot4-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot4" } springboot4-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot4" } springboot4-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot4" } +springboot4-starter-kafka = { module = "org.springframework.boot:spring-boot-starter-kafka", version.ref = "springboot4" } timber = { module = "com.jakewharton.timber:timber", version = "4.7.1" } # Animalsniffer signature diff --git a/sentry-kafka/README.md b/sentry-kafka/README.md new file mode 100644 index 00000000000..1b1b69238e5 --- /dev/null +++ b/sentry-kafka/README.md @@ -0,0 +1,5 @@ +# sentry-kafka + +This module provides Kafka-native queue instrumentation for applications using `kafka-clients` directly. + +Spring users should use the Sentry Spring (Boot) SDKs, which provide higher-fidelity consumer instrumentation via Spring Kafka hooks. diff --git a/sentry-kafka/api/sentry-kafka.api b/sentry-kafka/api/sentry-kafka.api new file mode 100644 index 00000000000..00649245845 --- /dev/null +++ b/sentry-kafka/api/sentry-kafka.api @@ -0,0 +1,19 @@ +public final class io/sentry/kafka/BuildConfig { + public static final field SENTRY_KAFKA_SDK_NAME Ljava/lang/String; + public static final field VERSION_NAME Ljava/lang/String; +} + +public final class io/sentry/kafka/SentryKafkaConsumerTracing { + public static final field TRACE_ORIGIN Ljava/lang/String; + public static fun withTracing (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Ljava/lang/Runnable;)V + public static fun withTracing (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Ljava/util/concurrent/Callable;)Ljava/lang/Object; +} + +public final class io/sentry/kafka/SentryKafkaProducer { + public static final field SENTRY_ENQUEUED_TIME_HEADER Ljava/lang/String; + public static final field TRACE_ORIGIN Ljava/lang/String; + public static fun wrap (Lorg/apache/kafka/clients/producer/Producer;)Lorg/apache/kafka/clients/producer/Producer; + public static fun wrap (Lorg/apache/kafka/clients/producer/Producer;Lio/sentry/IScopes;)Lorg/apache/kafka/clients/producer/Producer; + public static fun wrap (Lorg/apache/kafka/clients/producer/Producer;Lio/sentry/IScopes;Ljava/lang/String;)Lorg/apache/kafka/clients/producer/Producer; +} + diff --git a/sentry-kafka/build.gradle.kts b/sentry-kafka/build.gradle.kts new file mode 100644 index 00000000000..ee3ba0d4a60 --- /dev/null +++ b/sentry-kafka/build.gradle.kts @@ -0,0 +1,83 @@ +import net.ltgt.gradle.errorprone.errorprone +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `java-library` + id("io.sentry.javadoc") + alias(libs.plugins.kotlin.jvm) + jacoco + alias(libs.plugins.errorprone) + alias(libs.plugins.gradle.versions) + alias(libs.plugins.buildconfig) +} + +tasks.withType().configureEach { + compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 +} + +dependencies { + api(projects.sentry) + compileOnly(libs.kafka.clients) + compileOnly(libs.jetbrains.annotations) + compileOnly(libs.nopen.annotations) + + errorprone(libs.errorprone.core) + errorprone(libs.nopen.checker) + errorprone(libs.nullaway) + + // tests + testImplementation(projects.sentryTestSupport) + testImplementation(kotlin(Config.kotlinStdLib)) + testImplementation(libs.kotlin.test.junit) + testImplementation(libs.mockito.kotlin) + testImplementation(libs.mockito.inline) + testImplementation(libs.kafka.clients) +} + +configure { test { java.srcDir("src/test/java") } } + +jacoco { toolVersion = libs.versions.jacoco.get() } + +tasks.jacocoTestReport { + reports { + xml.required.set(true) + html.required.set(false) + } +} + +tasks { + jacocoTestCoverageVerification { + violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } + } + check { + dependsOn(jacocoTestCoverageVerification) + dependsOn(jacocoTestReport) + } +} + +tasks.withType().configureEach { + options.errorprone { + check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) + option("NullAway:AnnotatedPackages", "io.sentry") + } +} + +buildConfig { + useJavaOutput() + packageName("io.sentry.kafka") + buildConfigField("String", "SENTRY_KAFKA_SDK_NAME", "\"${Config.Sentry.SENTRY_KAFKA_SDK_NAME}\"") + buildConfigField("String", "VERSION_NAME", "\"${project.version}\"") +} + +tasks.jar { + manifest { + attributes( + "Sentry-Version-Name" to project.version, + "Sentry-SDK-Name" to Config.Sentry.SENTRY_KAFKA_SDK_NAME, + "Sentry-SDK-Package-Name" to "maven:io.sentry:sentry-kafka", + "Implementation-Vendor" to "Sentry", + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + ) + } +} diff --git a/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaConsumerTracing.java b/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaConsumerTracing.java new file mode 100644 index 00000000000..dbce760de99 --- /dev/null +++ b/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaConsumerTracing.java @@ -0,0 +1,280 @@ +package io.sentry.kafka; + +import io.sentry.BaggageHeader; +import io.sentry.DateUtils; +import io.sentry.IScopes; +import io.sentry.ISentryLifecycleToken; +import io.sentry.ITransaction; +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.SpanDataConvention; +import io.sentry.SpanStatus; +import io.sentry.TransactionContext; +import io.sentry.TransactionOptions; +import io.sentry.util.SpanUtils; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.header.Header; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** Helper methods for instrumenting raw Kafka consumer record processing. */ +@ApiStatus.Experimental +public final class SentryKafkaConsumerTracing { + + public static final @NotNull String TRACE_ORIGIN = "manual.queue.kafka.consumer"; + + private static final @NotNull String CREATOR = "SentryKafkaConsumerTracing"; + private static final @NotNull String DELIVERY_ATTEMPT_HEADER = "kafka_deliveryAttempt"; + private static final @NotNull String MESSAGE_ID_HEADER = "messaging.message.id"; + + private final @NotNull IScopes scopes; + + SentryKafkaConsumerTracing(final @NotNull IScopes scopes) { + this.scopes = scopes; + } + + /** + * Runs the provided {@link Callable} with a Kafka consumer processing transaction for the given + * record. + * + * @param record the Kafka record being processed + * @param callable the processing callback + * @return the return value of the callback + * @param the Kafka record key type + * @param the Kafka record value type + * @param the callback return type + */ + public static U withTracing( + final @NotNull ConsumerRecord record, final @NotNull Callable callable) + throws Exception { + return new SentryKafkaConsumerTracing(ScopesAdapter.getInstance()) + .withTracingImpl(record, callable); + } + + /** + * Runs the provided {@link Runnable} with a Kafka consumer processing transaction for the given + * record. + * + * @param record the Kafka record being processed + * @param runnable the processing callback + * @param the Kafka record key type + * @param the Kafka record value type + */ + public static void withTracing( + final @NotNull ConsumerRecord record, final @NotNull Runnable runnable) { + new SentryKafkaConsumerTracing(ScopesAdapter.getInstance()).withTracingImpl(record, runnable); + } + + U withTracingImpl( + final @NotNull ConsumerRecord record, final @NotNull Callable callable) + throws Exception { + if (!scopes.getOptions().isEnableQueueTracing() || isIgnored()) { + return callable.call(); + } + + final @NotNull IScopes forkedScopes; + final @NotNull ISentryLifecycleToken lifecycleToken; + try { + forkedScopes = scopes.forkedRootScopes(CREATOR); + lifecycleToken = forkedScopes.makeCurrent(); + } catch (Throwable t) { + scopes + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to fork scopes for Kafka consumer tracing.", t); + return callable.call(); + } + + try (final @NotNull ISentryLifecycleToken ignored = lifecycleToken) { + final @Nullable ITransaction transaction = startTransaction(forkedScopes, record); + boolean didError = false; + @Nullable Throwable callbackThrowable = null; + + try { + return callable.call(); + } catch (Throwable t) { + didError = true; + callbackThrowable = t; + throw t; + } finally { + finishTransaction( + transaction, didError ? SpanStatus.INTERNAL_ERROR : SpanStatus.OK, callbackThrowable); + } + } + } + + void withTracingImpl( + final @NotNull ConsumerRecord record, final @NotNull Runnable runnable) { + try { + withTracingImpl( + record, + () -> { + runnable.run(); + return null; + }); + } catch (Throwable t) { + throwUnchecked(t); + } + } + + @SuppressWarnings("unchecked") + private static void throwUnchecked(final @NotNull Throwable throwable) + throws T { + throw (T) throwable; + } + + private boolean isIgnored() { + return SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), TRACE_ORIGIN); + } + + private @Nullable ITransaction startTransaction( + final @NotNull IScopes forkedScopes, final @NotNull ConsumerRecord record) { + try { + final @Nullable TransactionContext continued = continueTrace(forkedScopes, record); + if (!forkedScopes.getOptions().isTracingEnabled()) { + return null; + } + + final @NotNull TransactionContext txContext = + continued != null ? continued : new TransactionContext(record.topic(), "queue.process"); + txContext.setName(record.topic()); + txContext.setOperation("queue.process"); + + final @NotNull TransactionOptions txOptions = new TransactionOptions(); + txOptions.setOrigin(TRACE_ORIGIN); + txOptions.setBindToScope(true); + + final @NotNull ITransaction transaction = forkedScopes.startTransaction(txContext, txOptions); + if (transaction.isNoOp()) { + return null; + } + + transaction.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka"); + transaction.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic()); + + final @Nullable String messageId = headerValue(record, MESSAGE_ID_HEADER); + if (messageId != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_ID, messageId); + } + + final int bodySize = record.serializedValueSize(); + if (bodySize >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE, bodySize); + } + + final @Nullable Integer retryCount = retryCount(record); + if (retryCount != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT, retryCount); + } + + final @Nullable Long receiveLatency = receiveLatency(record); + if (receiveLatency != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY, receiveLatency); + } + + return transaction; + } catch (Throwable t) { + scopes + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to start Kafka consumer tracing transaction.", t); + return null; + } + } + + private void finishTransaction( + final @Nullable ITransaction transaction, + final @NotNull SpanStatus status, + final @Nullable Throwable throwable) { + if (transaction == null || transaction.isNoOp()) { + return; + } + + try { + transaction.setStatus(status); + if (throwable != null) { + transaction.setThrowable(throwable); + } + transaction.finish(); + } catch (Throwable t) { + scopes + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to finish Kafka consumer tracing transaction.", t); + } + } + + private @Nullable TransactionContext continueTrace( + final @NotNull IScopes forkedScopes, final @NotNull ConsumerRecord record) { + final @Nullable String sentryTrace = headerValue(record, SentryTraceHeader.SENTRY_TRACE_HEADER); + final @Nullable List baggageHeaders = + headerValues(record, BaggageHeader.BAGGAGE_HEADER); + return forkedScopes.continueTrace(sentryTrace, baggageHeaders); + } + + private @Nullable Integer retryCount(final @NotNull ConsumerRecord record) { + final @Nullable Header header = record.headers().lastHeader(DELIVERY_ATTEMPT_HEADER); + if (header == null) { + return null; + } + + final byte[] value = header.value(); + if (value == null || value.length != Integer.BYTES) { + return null; + } + + final int attempt = ByteBuffer.wrap(value).getInt(); + if (attempt <= 0) { + return null; + } + + return attempt - 1; + } + + private @Nullable Long receiveLatency(final @NotNull ConsumerRecord record) { + final @Nullable String enqueuedTimeStr = + headerValue(record, SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER); + if (enqueuedTimeStr == null) { + return null; + } + + try { + final double enqueuedTimeSeconds = Double.parseDouble(enqueuedTimeStr); + final double nowSeconds = DateUtils.millisToSeconds(System.currentTimeMillis()); + final long latencyMs = (long) ((nowSeconds - enqueuedTimeSeconds) * 1000); + return latencyMs >= 0 ? latencyMs : null; + } catch (NumberFormatException ignored) { + return null; + } + } + + private @Nullable String headerValue( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + final @Nullable Header header = record.headers().lastHeader(headerName); + if (header == null || header.value() == null) { + return null; + } + return new String(header.value(), StandardCharsets.UTF_8); + } + + private @Nullable List headerValues( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + @Nullable List values = null; + for (final @NotNull Header header : record.headers().headers(headerName)) { + if (header.value() != null) { + if (values == null) { + values = new ArrayList<>(); + } + values.add(new String(header.value(), StandardCharsets.UTF_8)); + } + } + return values; + } +} diff --git a/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaProducer.java b/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaProducer.java new file mode 100644 index 00000000000..bcc538e339c --- /dev/null +++ b/sentry-kafka/src/main/java/io/sentry/kafka/SentryKafkaProducer.java @@ -0,0 +1,265 @@ +package io.sentry.kafka; + +import io.sentry.BaggageHeader; +import io.sentry.DateUtils; +import io.sentry.IScopes; +import io.sentry.ISpan; +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.SpanDataConvention; +import io.sentry.SpanOptions; +import io.sentry.SpanStatus; +import io.sentry.util.SpanUtils; +import io.sentry.util.TracingUtils; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import org.apache.kafka.clients.producer.Callback; +import org.apache.kafka.clients.producer.Producer; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.apache.kafka.common.header.Header; +import org.apache.kafka.common.header.Headers; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Wraps a Kafka {@link Producer} to record a {@code queue.publish} span around each {@code send} + * and to inject Sentry trace propagation headers into the produced record. + * + *

For raw Kafka usage: + * + *

{@code
+ * Producer producer =
+ *     SentryKafkaProducer.wrap(new KafkaProducer<>(props));
+ * }
+ * + *

For Spring Kafka, the {@code SentryKafkaProducerBeanPostProcessor} installs this wrapper + * automatically. + */ +@ApiStatus.Experimental +public final class SentryKafkaProducer { + + public static final @NotNull String TRACE_ORIGIN = "auto.queue.kafka.producer"; + public static final @NotNull String SENTRY_ENQUEUED_TIME_HEADER = "sentry-task-enqueued-time"; + + private SentryKafkaProducer() {} + + /** + * Wraps the given producer with Sentry instrumentation. + * + * @param delegate the Kafka producer to wrap + * @return an instrumented producer that records {@code queue.publish} spans + * @param the Kafka record key type + * @param the Kafka record value type + */ + public static @NotNull Producer wrap(final @NotNull Producer delegate) { + return wrap(delegate, ScopesAdapter.getInstance(), TRACE_ORIGIN); + } + + /** + * Wraps the given producer with Sentry instrumentation using the provided scopes. + * + * @param delegate the Kafka producer to wrap + * @param scopes the Sentry scopes to use for span creation and header injection + * @return an instrumented producer that records {@code queue.publish} spans + * @param the Kafka record key type + * @param the Kafka record value type + */ + public static @NotNull Producer wrap( + final @NotNull Producer delegate, final @NotNull IScopes scopes) { + return wrap(delegate, scopes, TRACE_ORIGIN); + } + + /** + * Wraps the given producer with Sentry instrumentation. + * + * @param delegate the Kafka producer to wrap + * @param scopes the Sentry scopes to use for span creation and header injection + * @param traceOrigin the trace origin to set on created spans + * @return an instrumented producer that records {@code queue.publish} spans + * @param the Kafka record key type + * @param the Kafka record value type + */ + @SuppressWarnings("unchecked") + public static @NotNull Producer wrap( + final @NotNull Producer delegate, + final @NotNull IScopes scopes, + final @NotNull String traceOrigin) { + return (Producer) + Proxy.newProxyInstance( + delegate.getClass().getClassLoader(), + new Class[] {Producer.class}, + new SentryProducerHandler<>(delegate, scopes, traceOrigin)); + } + + static final class SentryProducerHandler implements InvocationHandler { + + final @NotNull Producer delegate; + private final @NotNull IScopes scopes; + private final @NotNull String traceOrigin; + + SentryProducerHandler( + final @NotNull Producer delegate, + final @NotNull IScopes scopes, + final @NotNull String traceOrigin) { + this.delegate = delegate; + this.scopes = scopes; + this.traceOrigin = traceOrigin; + } + + @Override + @SuppressWarnings("unchecked") + public @Nullable Object invoke( + final @NotNull Object proxy, final @NotNull Method method, final @Nullable Object[] args) + throws Throwable { + if ("send".equals(method.getName()) && args != null) { + if (args.length == 1) { + return instrumentedSend((ProducerRecord) args[0], null); + } else if (args.length == 2) { + return instrumentedSend((ProducerRecord) args[0], (Callback) args[1]); + } + } + + if ("equals".equals(method.getName()) + && args != null + && args.length == 1 + && proxy == args[0]) { + return true; + } + + if ("toString".equals(method.getName()) && (args == null || args.length == 0)) { + return "SentryKafkaProducer[delegate=" + delegate + "]"; + } + + try { + return method.invoke(delegate, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } + + @SuppressWarnings("unchecked") + private @NotNull Object instrumentedSend( + final @NotNull ProducerRecord record, final @Nullable Callback callback) { + if (!scopes.getOptions().isEnableQueueTracing() || isIgnored()) { + return delegate.send(record, callback); + } + + final @Nullable ISpan activeSpan = scopes.getSpan(); + if (activeSpan == null || activeSpan.isNoOp()) { + maybeInjectHeaders(record.headers(), null); + return delegate.send(record, callback); + } + + final @NotNull SpanOptions spanOptions = new SpanOptions(); + spanOptions.setOrigin(traceOrigin); + final @NotNull ISpan span = + activeSpan.startChild("queue.publish", record.topic(), spanOptions); + + span.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka"); + span.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic()); + maybeInjectHeaders(record.headers(), span); + + try { + return delegate.send(record, wrapCallback(callback, span)); + } catch (Throwable t) { + finishWithError(span, t); + throw t; + } + } + + private @NotNull Callback wrapCallback( + final @Nullable Callback userCallback, final @NotNull ISpan span) { + return (metadata, exception) -> { + try { + if (exception != null) { + span.setThrowable(exception); + span.setStatus(SpanStatus.INTERNAL_ERROR); + } else { + span.setStatus(SpanStatus.OK); + } + } catch (Throwable t) { + scopes + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to set status on Kafka producer span.", t); + } finally { + try { + span.finish(); + } finally { + if (userCallback != null) { + userCallback.onCompletion(metadata, exception); + } + } + } + }; + } + + private void finishWithError(final @NotNull ISpan span, final @NotNull Throwable t) { + span.setThrowable(t); + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.finish(); + } + + private boolean isIgnored() { + return SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), traceOrigin); + } + + private void maybeInjectHeaders(final @NotNull Headers headers, final @Nullable ISpan span) { + try { + final @Nullable List existingBaggageHeaders = + readHeaderValues(headers, BaggageHeader.BAGGAGE_HEADER); + final @Nullable TracingUtils.TracingHeaders tracingHeaders = + TracingUtils.trace(scopes, existingBaggageHeaders, span); + if (tracingHeaders != null) { + final @NotNull SentryTraceHeader sentryTraceHeader = + tracingHeaders.getSentryTraceHeader(); + headers.remove(sentryTraceHeader.getName()); + headers.add( + sentryTraceHeader.getName(), + sentryTraceHeader.getValue().getBytes(StandardCharsets.UTF_8)); + + final @Nullable BaggageHeader baggageHeader = tracingHeaders.getBaggageHeader(); + if (baggageHeader != null) { + headers.remove(baggageHeader.getName()); + headers.add( + baggageHeader.getName(), baggageHeader.getValue().getBytes(StandardCharsets.UTF_8)); + } + } + + headers.remove(SENTRY_ENQUEUED_TIME_HEADER); + headers.add( + SENTRY_ENQUEUED_TIME_HEADER, + DateUtils.doubleToBigDecimal(DateUtils.millisToSeconds(System.currentTimeMillis())) + .toString() + .getBytes(StandardCharsets.UTF_8)); + } catch (Throwable t) { + scopes + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to inject Sentry headers into Kafka record.", t); + } + } + + private static @Nullable List readHeaderValues( + final @NotNull Headers headers, final @NotNull String name) { + @Nullable List values = null; + for (final @NotNull Header header : headers.headers(name)) { + final byte @Nullable [] value = header.value(); + if (value != null) { + if (values == null) { + values = new ArrayList<>(); + } + values.add(new String(value, StandardCharsets.UTF_8)); + } + } + return values; + } + } +} diff --git a/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaConsumerTracingTest.kt b/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaConsumerTracingTest.kt new file mode 100644 index 00000000000..5529e42c715 --- /dev/null +++ b/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaConsumerTracingTest.kt @@ -0,0 +1,254 @@ +package io.sentry.kafka + +import io.sentry.BaggageHeader +import io.sentry.IScopes +import io.sentry.ISentryLifecycleToken +import io.sentry.ITransaction +import io.sentry.SentryOptions +import io.sentry.SentryTraceHeader +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import io.sentry.TransactionOptions +import java.io.IOException +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.util.Optional +import java.util.concurrent.Callable +import java.util.concurrent.atomic.AtomicBoolean +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertTrue +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.header.internals.RecordHeaders +import org.apache.kafka.common.record.TimestampType +import org.mockito.kotlin.any +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.check +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentryKafkaConsumerTracingTest { + + private lateinit var scopes: IScopes + private lateinit var forkedScopes: IScopes + private lateinit var options: SentryOptions + private lateinit var lifecycleToken: ISentryLifecycleToken + private lateinit var transaction: ITransaction + private lateinit var tracing: SentryKafkaConsumerTracing + + @BeforeTest + fun setup() { + scopes = mock() + forkedScopes = mock() + lifecycleToken = mock() + transaction = mock() + tracing = SentryKafkaConsumerTracing(scopes) + + options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + isEnableQueueTracing = true + tracesSampleRate = 1.0 + } + + whenever(scopes.options).thenReturn(options) + whenever(scopes.forkedRootScopes(any())).thenReturn(forkedScopes) + whenever(forkedScopes.options).thenReturn(options) + whenever(forkedScopes.makeCurrent()).thenReturn(lifecycleToken) + whenever(forkedScopes.startTransaction(any(), any())) + .thenReturn(transaction) + whenever(transaction.isNoOp).thenReturn(false) + } + + @Test + fun `withTracing creates queue process transaction with record metadata`() { + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val baggageValue = "sentry-sample_rate=1" + val record = + createRecord( + sentryTrace = sentryTraceValue, + baggage = baggageValue, + messageId = "message-123", + deliveryAttempt = 3, + enqueuedTime = (System.currentTimeMillis() / 1000.0 - 1.0).toString(), + serializedValueSize = 5, + ) + + val txContextCaptor = argumentCaptor() + val txOptionsCaptor = argumentCaptor() + + val result = tracing.withTracingImpl(record, Callable { "done" }) + + assertEquals("done", result) + verify(scopes).forkedRootScopes("SentryKafkaConsumerTracing") + verify(forkedScopes).makeCurrent() + verify(forkedScopes).continueTrace(eq(sentryTraceValue), eq(listOf(baggageValue))) + verify(forkedScopes).startTransaction(txContextCaptor.capture(), txOptionsCaptor.capture()) + + assertEquals("my-topic", txContextCaptor.firstValue.name) + assertEquals("queue.process", txContextCaptor.firstValue.operation) + assertEquals(SentryKafkaConsumerTracing.TRACE_ORIGIN, txOptionsCaptor.firstValue.origin) + assertTrue(txOptionsCaptor.firstValue.isBindToScope) + + verify(transaction).setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka") + verify(transaction).setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, "my-topic") + verify(transaction).setData(SpanDataConvention.MESSAGING_MESSAGE_ID, "message-123") + verify(transaction).setData(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE, 5) + verify(transaction).setData(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT, 2) + verify(transaction) + .setData( + eq(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY), + check { assertTrue(it >= 0) }, + ) + verify(transaction).setStatus(SpanStatus.OK) + verify(transaction).finish() + verify(lifecycleToken).close() + } + + @Test + fun `withTracing passes all baggage headers to continueTrace`() { + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = + createRecord( + sentryTrace = sentryTraceValue, + baggageHeaders = listOf("third=party", "sentry-sample_rate=1"), + ) + + tracing.withTracingImpl(record, Callable { "done" }) + + verify(forkedScopes) + .continueTrace(eq(sentryTraceValue), eq(listOf("third=party", "sentry-sample_rate=1"))) + } + + @Test + fun `withTracing skips scope forking when queue tracing is disabled`() { + options.isEnableQueueTracing = false + val record = createRecord() + + val result = tracing.withTracingImpl(record, Callable { "done" }) + + assertEquals("done", result) + verify(scopes, never()).forkedRootScopes(any()) + } + + @Test + fun `withTracing skips scope forking when origin is ignored`() { + options.setIgnoredSpanOrigins(listOf(SentryKafkaConsumerTracing.TRACE_ORIGIN)) + val record = createRecord() + + val result = tracing.withTracingImpl(record, Callable { "done" }) + + assertEquals("done", result) + verify(scopes, never()).forkedRootScopes(any()) + } + + @Test + fun `withTracing marks transaction as error when callback throws`() { + val record = createRecord() + val exception = RuntimeException("boom") + + val thrown = + assertFailsWith { + tracing.withTracingImpl(record, Callable { throw exception }) + } + + assertEquals(exception, thrown) + verify(transaction).setStatus(SpanStatus.INTERNAL_ERROR) + verify(transaction).setThrowable(exception) + verify(transaction).finish() + verify(lifecycleToken).close() + } + + @Test + fun `withTracing falls back to direct callback execution when instrumentation setup fails`() { + whenever(scopes.forkedRootScopes(any())) + .thenThrow(RuntimeException("broken instrumentation")) + val record = createRecord() + + val result = tracing.withTracingImpl(record, Callable { "done" }) + + assertEquals("done", result) + verify(forkedScopes, never()).makeCurrent() + verify(transaction, never()).finish() + } + + @Test + fun `withTracing runnable overload executes callback`() { + val record = createRecord() + val didRun = AtomicBoolean(false) + + tracing.withTracingImpl(record, Runnable { didRun.set(true) }) + + assertTrue(didRun.get()) + verify(transaction).setStatus(SpanStatus.OK) + verify(transaction).finish() + } + + @Test + fun `withTracing runnable overload preserves original throwable`() { + val record = createRecord() + val exception = IOException("boom") + + val thrown = + assertFailsWith { tracing.withTracingImpl(record, Runnable { throw exception }) } + + assertEquals(exception, thrown) + verify(transaction).setStatus(SpanStatus.INTERNAL_ERROR) + verify(transaction).setThrowable(exception) + verify(transaction).finish() + } + + private fun createRecord( + topic: String = "my-topic", + sentryTrace: String? = null, + baggage: String? = null, + baggageHeaders: List? = null, + messageId: String? = null, + deliveryAttempt: Int? = null, + enqueuedTime: String? = null, + serializedValueSize: Int = -1, + ): ConsumerRecord { + val headers = RecordHeaders() + sentryTrace?.let { + headers.add(SentryTraceHeader.SENTRY_TRACE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggage?.let { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggageHeaders?.forEach { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + messageId?.let { + headers.add(SpanDataConvention.MESSAGING_MESSAGE_ID, it.toByteArray(StandardCharsets.UTF_8)) + } + deliveryAttempt?.let { + headers.add("kafka_deliveryAttempt", ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array()) + } + enqueuedTime?.let { + headers.add( + SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER, + it.toByteArray(StandardCharsets.UTF_8), + ) + } + + return ConsumerRecord( + topic, + 0, + 0L, + System.currentTimeMillis(), + TimestampType.CREATE_TIME, + 3, + serializedValueSize, + "key", + "value", + headers, + Optional.empty(), + ) + } +} diff --git a/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaProducerTest.kt b/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaProducerTest.kt new file mode 100644 index 00000000000..a4ba5254c36 --- /dev/null +++ b/sentry-kafka/src/test/kotlin/io/sentry/kafka/SentryKafkaProducerTest.kt @@ -0,0 +1,375 @@ +package io.sentry.kafka + +import io.sentry.BaggageHeader +import io.sentry.IScopes +import io.sentry.ISentryLifecycleToken +import io.sentry.ISpan +import io.sentry.NoOpSpan +import io.sentry.Scope +import io.sentry.ScopeCallback +import io.sentry.Sentry +import io.sentry.SentryOptions +import io.sentry.SentryTraceHeader +import io.sentry.SentryTracer +import io.sentry.SpanOptions +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import io.sentry.test.initForTest +import java.nio.charset.StandardCharsets +import java.util.concurrent.CompletableFuture +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.apache.kafka.clients.producer.Callback +import org.apache.kafka.clients.producer.Producer +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.common.TopicPartition +import org.apache.kafka.common.header.Header +import org.apache.kafka.common.header.Headers +import org.mockito.kotlin.any +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.doAnswer +import org.mockito.kotlin.eq +import org.mockito.kotlin.isNull +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentryKafkaProducerTest { + + private lateinit var scopes: IScopes + private lateinit var options: SentryOptions + private lateinit var delegate: Producer + + @BeforeTest + fun setup() { + initForTest { + it.dsn = "https://key@sentry.io/proj" + it.isEnableQueueTracing = true + it.tracesSampleRate = 1.0 + } + scopes = mock() + options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + isEnableQueueTracing = true + } + whenever(scopes.options).thenReturn(options) + doAnswer { (it.arguments[0] as ScopeCallback).run(Scope(options)) } + .whenever(scopes) + .configureScope(any()) + delegate = mock() + whenever(delegate.send(any(), any())).thenReturn(CompletableFuture.completedFuture(null)) + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + @Test + fun `creates queue publish span and injects headers`() { + val tx = createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + assertEquals(1, tx.spans.size) + val span = tx.spans.first() + assertEquals("queue.publish", span.operation) + assertEquals("my-topic", span.description) + assertEquals("kafka", span.data["messaging.system"]) + assertEquals("my-topic", span.data["messaging.destination.name"]) + assertEquals(SentryKafkaProducer.TRACE_ORIGIN, span.spanContext.origin) + + val sentryTraceHeader = record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER) + assertNotNull(sentryTraceHeader) + + val enqueuedTimeHeader = + record.headers().lastHeader(SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER) + assertNotNull(enqueuedTimeHeader) + val enqueuedTimeRaw = String(enqueuedTimeHeader.value(), StandardCharsets.UTF_8) + // Cross-SDK consumers (e.g. sentry-python) parse this as a plain decimal — must not use + // scientific notation. + assertFalse(enqueuedTimeRaw.contains('E') || enqueuedTimeRaw.contains('e')) + assertTrue(enqueuedTimeRaw.matches(Regex("""^\d+\.\d{6}$"""))) + } + + @Test + fun `delegates send and does not finish span synchronously`() { + val tx = createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + verify(delegate).send(eq(record), any()) + val span = tx.spans.first() + assertFalse(span.isFinished, "span should be open until callback fires") + } + + @Test + fun `finishes span as OK when broker ack callback succeeds`() { + val tx = createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + val captor = argumentCaptor() + verify(delegate).send(eq(record), captor.capture()) + val metadata = RecordMetadata(TopicPartition("my-topic", 0), 0L, 0, 0L, 0, 0) + captor.firstValue.onCompletion(metadata, null) + + val span = tx.spans.first() + assertTrue(span.isFinished) + assertEquals(SpanStatus.OK, span.status) + } + + @Test + fun `finishes span as INTERNAL_ERROR when broker ack callback fails`() { + val tx = createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + val exception = RuntimeException("boom") + + producer.send(record) + + val captor = argumentCaptor() + verify(delegate).send(eq(record), captor.capture()) + captor.firstValue.onCompletion(null, exception) + + val span = tx.spans.first() + assertTrue(span.isFinished) + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertSame(exception, span.throwable) + } + + @Test + fun `forwards user callback after finishing span`() { + createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + val userCallback = mock() + + producer.send(record, userCallback) + + val captor = argumentCaptor() + verify(delegate).send(eq(record), captor.capture()) + val metadata = RecordMetadata(TopicPartition("my-topic", 0), 0L, 0, 0L, 0, 0) + captor.firstValue.onCompletion(metadata, null) + + verify(userCallback).onCompletion(metadata, null) + } + + @Test + fun `finishes span with error when delegate send throws synchronously`() { + val tx = createTransaction() + val exception = RuntimeException("kaboom") + whenever(delegate.send(any(), any())).thenThrow(exception) + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + val thrown = runCatching { producer.send(record) }.exceptionOrNull() + + assertSame(exception, thrown) + val span = tx.spans.first() + assertTrue(span.isFinished) + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertSame(exception, span.throwable) + } + + @Test + fun `delegates send without span when queue tracing is disabled`() { + createTransaction() + options.isEnableQueueTracing = false + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + verify(delegate).send(eq(record), isNull()) + } + + @Test + fun `delegates send without span when trace origin is ignored`() { + val tx = createTransaction() + options.setIgnoredSpanOrigins(listOf(SentryKafkaProducer.TRACE_ORIGIN)) + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + assertEquals(0, tx.spans.size) + verify(delegate).send(eq(record), isNull()) + assertEquals(null, record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER)) + } + + @Test + fun `injects headers but creates no span when no active span`() { + whenever(scopes.span).thenReturn(null) + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + verify(delegate).send(eq(record), isNull()) + // Headers should still be injected from PropagationContext + assertNotNull(record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER)) + assertNotNull(record.headers().lastHeader(BaggageHeader.BAGGAGE_HEADER)) + assertNotNull(record.headers().lastHeader(SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER)) + } + + @Test + fun `injects headers but creates no span when active span is no-op`() { + whenever(scopes.span).thenReturn(NoOpSpan.getInstance()) + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + verify(delegate).send(eq(record), isNull()) + // Headers should still be injected from PropagationContext + assertNotNull(record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER)) + assertNotNull(record.headers().lastHeader(BaggageHeader.BAGGAGE_HEADER)) + assertNotNull(record.headers().lastHeader(SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER)) + } + + @Test + fun `preserves pre-existing third-party baggage header entries`() { + createTransaction() + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + record + .headers() + .add( + BaggageHeader.BAGGAGE_HEADER, + "othervendor=someValue,another=thing".toByteArray(StandardCharsets.UTF_8), + ) + + producer.send(record) + + val baggageHeaders = record.headers().headers(BaggageHeader.BAGGAGE_HEADER).toList() + assertEquals(1, baggageHeaders.size) + val baggageValue = String(baggageHeaders.first().value(), StandardCharsets.UTF_8) + assertTrue(baggageValue.contains("othervendor=someValue")) + assertTrue(baggageValue.contains("another=thing")) + assertTrue(baggageValue.contains("sentry-")) + } + + @Test + fun `header injection failure does not prevent send`() { + val activeSpan = mock() + val span = mock() + val headers = mock() + val record = mock>() + whenever(scopes.span).thenReturn(activeSpan) + whenever(activeSpan.startChild(eq("queue.publish"), eq("my-topic"), any())) + .thenReturn(span) + whenever(span.isNoOp).thenReturn(false) + whenever(span.isFinished).thenReturn(false) + whenever(span.toSentryTrace()) + .thenReturn(SentryTraceHeader("2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1")) + whenever(span.toBaggageHeader(null)).thenReturn(null) + whenever(record.topic()).thenReturn("my-topic") + whenever(record.headers()).thenReturn(headers) + whenever(headers.headers(BaggageHeader.BAGGAGE_HEADER)).thenReturn(emptyList

()) + whenever(headers.remove(SentryTraceHeader.SENTRY_TRACE_HEADER)) + .thenThrow(RuntimeException("boom")) + + val producer = SentryKafkaProducer.wrap(delegate, scopes) + producer.send(record) + + // Header injection failed silently; send still proceeds with wrapped callback for span + // lifecycle. + verify(delegate).send(eq(record), any()) + } + + @Test + fun `delegates non-send methods to underlying producer`() { + val producer = SentryKafkaProducer.wrap(delegate, scopes) + + producer.flush() + producer.partitionsFor("my-topic") + producer.metrics() + producer.close() + + verify(delegate).flush() + verify(delegate).partitionsFor("my-topic") + verify(delegate).metrics() + verify(delegate).close() + } + + @Test + fun `default wrap uses current scopes`() { + val transaction = Sentry.startTransaction("tx", "op") + val record = ProducerRecord("my-topic", "key", "value") + + try { + val token: ISentryLifecycleToken = transaction.makeCurrent() + try { + val producer = SentryKafkaProducer.wrap(delegate) + producer.send(record) + } finally { + token.close() + } + } finally { + transaction.finish() + } + + assertNotNull(record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER)) + assertNotNull(record.headers().lastHeader(SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER)) + verify(delegate).send(eq(record), any()) + } + + @Test + fun `wraps callback even when child span is no-op`() { + val tx = createTransaction() + // Set max spans to 0 so the child span is no-op (over limit) + options.maxSpans = 0 + val producer = SentryKafkaProducer.wrap(delegate, scopes) + val record = ProducerRecord("my-topic", "key", "value") + + producer.send(record) + + // Callback is still wrapped (no-op span finish is harmless) + verify(delegate).send(eq(record), any()) + // Headers should still be injected from PropagationContext + assertNotNull(record.headers().lastHeader(SentryTraceHeader.SENTRY_TRACE_HEADER)) + assertNotNull(record.headers().lastHeader(BaggageHeader.BAGGAGE_HEADER)) + assertNotNull(record.headers().lastHeader(SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER)) + } + + @Test + fun `wrapped producer equals itself`() { + val producer = SentryKafkaProducer.wrap(delegate, scopes) + + assertTrue(producer.equals(producer)) + } + + @Test + fun `wrapped producer keeps delegate hashCode`() { + val producer = SentryKafkaProducer.wrap(delegate, scopes) + + assertEquals(delegate.hashCode(), producer.hashCode()) + } + + @Test + fun `toString includes delegate`() { + val producer = SentryKafkaProducer.wrap(delegate, scopes) + assertTrue(producer.toString().startsWith("SentryKafkaProducer[delegate=")) + } + + private fun createTransaction(): SentryTracer { + val tx = SentryTracer(TransactionContext("tx", "op"), scopes) + whenever(scopes.span).thenReturn(tx) + return tx + } +} diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/api/sentry-opentelemetry-core.api b/sentry-opentelemetry/sentry-opentelemetry-core/api/sentry-opentelemetry-core.api index b51c8cc39bc..847d69bca1b 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/api/sentry-opentelemetry-core.api +++ b/sentry-opentelemetry/sentry-opentelemetry-core/api/sentry-opentelemetry-core.api @@ -149,7 +149,7 @@ public final class io/sentry/opentelemetry/SentrySpanProcessor : io/opentelemetr public final class io/sentry/opentelemetry/SpanDescriptionExtractor { public fun ()V - public fun extractSpanInfo (Lio/opentelemetry/sdk/trace/data/SpanData;Lio/sentry/opentelemetry/IOtelSpanWrapper;)Lio/sentry/opentelemetry/OtelSpanInfo; + public fun extractSpanInfo (Lio/opentelemetry/sdk/trace/data/SpanData;Lio/sentry/opentelemetry/IOtelSpanWrapper;Lio/sentry/SentryOptions;)Lio/sentry/opentelemetry/OtelSpanInfo; } public final class io/sentry/opentelemetry/SpanNode { diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java index 680177f8451..2583f4a0469 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java @@ -12,6 +12,7 @@ import io.opentelemetry.sdk.trace.data.StatusData; import io.opentelemetry.sdk.trace.export.SpanExporter; import io.opentelemetry.semconv.HttpAttributes; +import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; import io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes; import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes; import io.sentry.Baggage; @@ -200,7 +201,7 @@ private void createAndFinishSpanForOtelSpan( final @Nullable IOtelSpanWrapper sentrySpanMaybe = spanStorage.getSentrySpan(spanData.getSpanContext()); final @NotNull OtelSpanInfo spanInfo = - spanDescriptionExtractor.extractSpanInfo(spanData, sentrySpanMaybe); + spanDescriptionExtractor.extractSpanInfo(spanData, sentrySpanMaybe, scopes.getOptions()); scopes .getOptions() @@ -294,7 +295,7 @@ private void transferSpanDetails( final @NotNull IScopes scopesToUse = scopesToUseBeforeForking.forkedCurrentScope("SentrySpanExporter.createTransaction"); final @NotNull OtelSpanInfo spanInfo = - spanDescriptionExtractor.extractSpanInfo(span, sentrySpanMaybe); + spanDescriptionExtractor.extractSpanInfo(span, sentrySpanMaybe, scopesToUse.getOptions()); scopesToUse .getOptions() @@ -361,6 +362,19 @@ private void transferSpanDetails( maybeTransferOtelAttribute(span, sentryTransaction, ThreadIncubatingAttributes.THREAD_ID); maybeTransferOtelAttribute(span, sentryTransaction, ThreadIncubatingAttributes.THREAD_NAME); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_SYSTEM); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_MESSAGE_BODY_SIZE); + maybeTransferOtelAttribute( + span, sentryTransaction, MessagingIncubatingAttributes.MESSAGING_MESSAGE_ENVELOPE_SIZE); + scopesToUse.configureScope( ScopeType.CURRENT, scope -> attributesExtractor.extract(span, scope, scopesToUse.getOptions())); diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java index 9c6a51f17c3..31bd6368318 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java @@ -297,7 +297,7 @@ private boolean isSentryRequest(final @NotNull ReadableSpan otelSpan) { private void updateTransactionWithOtelData( final @NotNull ITransaction sentryTransaction, final @NotNull ReadableSpan otelSpan) { final @NotNull OtelSpanInfo otelSpanInfo = - spanDescriptionExtractor.extractSpanInfo(otelSpan.toSpanData(), null); + spanDescriptionExtractor.extractSpanInfo(otelSpan.toSpanData(), null, scopes.getOptions()); sentryTransaction.setOperation(otelSpanInfo.getOp()); String transactionName = otelSpanInfo.getDescription(); sentryTransaction.setName( @@ -334,7 +334,7 @@ private void updateSpanWithOtelData( }); final @NotNull OtelSpanInfo otelSpanInfo = - spanDescriptionExtractor.extractSpanInfo(otelSpan.toSpanData(), null); + spanDescriptionExtractor.extractSpanInfo(otelSpan.toSpanData(), null, scopes.getOptions()); sentrySpan.setOperation(otelSpanInfo.getOp()); sentrySpan.setDescription(otelSpanInfo.getDescription()); } diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SpanDescriptionExtractor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SpanDescriptionExtractor.java index b66555d68c9..3af3d8f96f0 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SpanDescriptionExtractor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SpanDescriptionExtractor.java @@ -7,6 +7,8 @@ import io.opentelemetry.semconv.UrlAttributes; import io.opentelemetry.semconv.incubating.DbIncubatingAttributes; import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes; +import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes; +import io.sentry.SentryOptions; import io.sentry.protocol.TransactionNameSource; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -17,9 +19,19 @@ public final class SpanDescriptionExtractor { @SuppressWarnings("deprecation") public @NotNull OtelSpanInfo extractSpanInfo( - final @NotNull SpanData otelSpan, final @Nullable IOtelSpanWrapper sentrySpan) { + final @NotNull SpanData otelSpan, + final @Nullable IOtelSpanWrapper sentrySpan, + final @NotNull SentryOptions options) { final @NotNull Attributes attributes = otelSpan.getAttributes(); + if (options.isEnableQueueTracing()) { + final @Nullable String messagingSystem = + attributes.get(MessagingIncubatingAttributes.MESSAGING_SYSTEM); + if (messagingSystem != null) { + return descriptionForMessagingSystem(otelSpan); + } + } + final @Nullable String httpMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD); if (httpMethod != null) { return descriptionForHttpMethod(otelSpan, httpMethod); @@ -91,6 +103,53 @@ private static boolean isRootSpan(SpanData otelSpan) { return !otelSpan.getParentSpanContext().isValid() || otelSpan.getParentSpanContext().isRemote(); } + @SuppressWarnings("deprecation") + private OtelSpanInfo descriptionForMessagingSystem(final @NotNull SpanData otelSpan) { + final @NotNull Attributes attributes = otelSpan.getAttributes(); + final @NotNull String op = opForMessaging(otelSpan); + final @Nullable String destination = + attributes.get(MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME); + final @NotNull String description = destination != null ? destination : otelSpan.getName(); + return new OtelSpanInfo(op, description, TransactionNameSource.TASK); + } + + @SuppressWarnings("deprecation") + private @NotNull String opForMessaging(final @NotNull SpanData otelSpan) { + final @NotNull Attributes attributes = otelSpan.getAttributes(); + @Nullable + String operationType = attributes.get(MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE); + if (operationType == null) { + operationType = attributes.get(MessagingIncubatingAttributes.MESSAGING_OPERATION); + } + if (operationType != null) { + switch (operationType) { + case "publish": + case "send": + return "queue.publish"; + case "create": + return "queue.create"; + case "receive": + return "queue.receive"; + case "process": + case "deliver": + return "queue.process"; + case "settle": + return "queue.settle"; + default: + break; + } + } + + final @NotNull SpanKind kind = otelSpan.getKind(); + if (SpanKind.PRODUCER.equals(kind)) { + return "queue.publish"; + } + if (SpanKind.CONSUMER.equals(kind)) { + return "queue.process"; + } + return "queue"; + } + @SuppressWarnings("deprecation") private OtelSpanInfo descriptionForDbSystem(final @NotNull SpanData otelSpan) { final @NotNull Attributes attributes = otelSpan.getAttributes(); diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt index 9c5a1a352df..a43afb849e6 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt @@ -11,6 +11,8 @@ import io.opentelemetry.semconv.HttpAttributes import io.opentelemetry.semconv.UrlAttributes import io.opentelemetry.semconv.incubating.DbIncubatingAttributes import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes +import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes +import io.sentry.SentryOptions import io.sentry.protocol.TransactionNameSource import kotlin.test.Test import kotlin.test.assertEquals @@ -228,6 +230,250 @@ class SpanDescriptionExtractorTest { assertEquals(TransactionNameSource.TASK, info.transactionNameSource) } + @Test + fun `ignores messaging system when queue tracing disabled`() { + givenSpanName("my-topic publish") + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = false) + + assertEquals("my-topic publish", info.op) + assertEquals("my-topic publish", info.description) + assertEquals(TransactionNameSource.CUSTOM, info.transactionNameSource) + } + + @Test + fun `maps messaging publish operation type to queue publish op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging send operation type to queue publish op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "send", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging process operation type to queue process op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "process", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.process", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging deliver operation type to queue process op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "deliver", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.process", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging create operation type to queue create op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "create", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.create", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging receive operation type to queue receive op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "receive", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.receive", info.op) + assertEquals("my-topic", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `maps messaging settle operation type to queue settle op`() { + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "rabbitmq", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "settle", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.settle", info.op) + assertEquals("my-queue", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `falls back to legacy messaging operation attribute`() { + @Suppress("DEPRECATION") + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "rabbitmq", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "queue-name", + MessagingIncubatingAttributes.MESSAGING_OPERATION to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("queue-name", info.description) + } + + @Test + fun `falls back to PRODUCER span kind when no operation attribute`() { + givenSpanKind(SpanKind.PRODUCER) + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("my-topic", info.description) + } + + @Test + fun `falls back to CONSUMER span kind when no operation attribute`() { + givenSpanKind(SpanKind.CONSUMER) + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.process", info.op) + assertEquals("my-topic", info.description) + } + + @Test + fun `falls back to span name as description when destination missing`() { + givenSpanName("my-topic publish") + givenAttributes( + mapOf( + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("my-topic publish", info.description) + } + + @Test + fun `messaging mapping wins over http when both attributes present and queue tracing enabled`() { + // Some OTel instrumentations (e.g. aws-sdk-2.2 SQS) attach both messaging and http + // attributes to the same span. Messaging is more specific and must win. + givenSpanKind(SpanKind.PRODUCER) + givenAttributes( + mapOf( + HttpAttributes.HTTP_REQUEST_METHOD to "POST", + UrlAttributes.URL_FULL to "https://sqs.us-east-1.amazonaws.com/", + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "aws.sqs", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = true) + + assertEquals("queue.publish", info.op) + assertEquals("my-queue", info.description) + assertEquals(TransactionNameSource.TASK, info.transactionNameSource) + } + + @Test + fun `http mapping wins over messaging when queue tracing disabled`() { + givenSpanKind(SpanKind.CLIENT) + givenAttributes( + mapOf( + HttpAttributes.HTTP_REQUEST_METHOD to "POST", + UrlAttributes.URL_FULL to "https://sqs.us-east-1.amazonaws.com/", + MessagingIncubatingAttributes.MESSAGING_SYSTEM to "aws.sqs", + MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", + MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", + ) + ) + + val info = whenExtractingSpanInfo(queueTracingEnabled = false) + + assertEquals("http.client", info.op) + assertEquals("POST https://sqs.us-east-1.amazonaws.com/", info.description) + assertEquals(TransactionNameSource.URL, info.transactionNameSource) + } + @Test fun `uses span name as op and description if no relevant attributes`() { givenSpanName("span name") @@ -289,9 +535,10 @@ class SpanDescriptionExtractorTest { builder.put(key as AttributeKey, value) } - private fun whenExtractingSpanInfo(): OtelSpanInfo { + private fun whenExtractingSpanInfo(queueTracingEnabled: Boolean = false): OtelSpanInfo { fixture.setup() - return SpanDescriptionExtractor().extractSpanInfo(fixture.otelSpan, fixture.sentrySpan) + val options = SentryOptions().apply { isEnableQueueTracing = queueTracingEnabled } + return SpanDescriptionExtractor().extractSpanInfo(fixture.otelSpan, fixture.sentrySpan, options) } private fun givenParentContext(parentContext: SpanContext) { diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index c27196e96b8..79878ab9a08 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -36,8 +36,10 @@ dependencies { implementation(projects.sentry) implementation(projects.sentryAsyncProfiler) implementation(projects.sentryJcache) + implementation(projects.sentryKafka) implementation(libs.jcache) implementation(libs.caffeine.jcache) + implementation(libs.kafka.clients) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(projects.sentry) diff --git a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java index 0ed0646c7bc..2a45ef6902c 100644 --- a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java @@ -5,6 +5,7 @@ import io.sentry.jcache.SentryJCacheWrapper; import io.sentry.protocol.Message; import io.sentry.protocol.User; +import io.sentry.samples.console.kafka.KafkaShowcase; import java.util.Collections; import javax.cache.Cache; import javax.cache.CacheManager; @@ -16,6 +17,10 @@ public class Main { private static long numberOfDiscardedSpansDueToOverflow = 0; public static void main(String[] args) throws InterruptedException { + final String kafkaBootstrapServers = System.getenv("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS"); + final boolean kafkaEnabled = + kafkaBootstrapServers != null && !kafkaBootstrapServers.trim().isEmpty(); + Sentry.init( options -> { // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in @@ -95,6 +100,7 @@ public static void main(String[] args) throws InterruptedException { // Enable cache tracing to create spans for cache operations options.setEnableCacheTracing(true); + options.setEnableQueueTracing(kafkaEnabled); // Determine traces sample rate based on the sampling context // options.setTracesSampler( @@ -178,6 +184,13 @@ public static void main(String[] args) throws InterruptedException { // cache.remove, and cache.flush spans as children of the active transaction. demonstrateCacheTracing(); + // Kafka queue tracing with the kafka-clients producer interceptor and manual consumer tracing. + // + // Enable with: SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS=localhost:9092 + if (kafkaEnabled) { + KafkaShowcase.runKafkaWithSentryTracing(kafkaBootstrapServers); + } + // Performance feature // // Transactions collect execution time of the piece of code that's executed between the start diff --git a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka/KafkaShowcase.java b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka/KafkaShowcase.java new file mode 100644 index 00000000000..de85e46b25f --- /dev/null +++ b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/kafka/KafkaShowcase.java @@ -0,0 +1,143 @@ +package io.sentry.samples.console.kafka; + +import io.sentry.ISentryLifecycleToken; +import io.sentry.ITransaction; +import io.sentry.Sentry; +import io.sentry.kafka.SentryKafkaConsumerTracing; +import io.sentry.kafka.SentryKafkaProducer; +import java.time.Duration; +import java.util.Collections; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import org.apache.kafka.clients.consumer.ConsumerConfig; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.clients.consumer.ConsumerRecords; +import org.apache.kafka.clients.consumer.KafkaConsumer; +import org.apache.kafka.clients.producer.KafkaProducer; +import org.apache.kafka.clients.producer.Producer; +import org.apache.kafka.clients.producer.ProducerConfig; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.apache.kafka.common.serialization.StringSerializer; + +public final class KafkaShowcase { + + public static final String TOPIC = "sentry-topic-console-sample"; + + private KafkaShowcase() {} + + public static void runKafkaWithSentryTracing(final String bootstrapServers) { + final CountDownLatch consumedLatch = new CountDownLatch(1); + final Thread consumerThread = startConsumerWithSentryTracing(bootstrapServers, consumedLatch); + final Properties producerProperties = createProducerProperties(bootstrapServers); + + final ITransaction transaction = Sentry.startTransaction("kafka-demo", "demo"); + try (ISentryLifecycleToken ignored = transaction.makeCurrent()) { + // 1. Create the raw Kafka producer as you normally would. + final KafkaProducer rawProducer = new KafkaProducer<>(producerProperties); + + // 2. >>> Sentry instrumentation <<< + // Wrap it with SentryKafkaProducer.wrap() so every send is captured as a + // `queue.publish` span that closes when the broker ack callback fires. + final Producer producer = SentryKafkaProducer.wrap(rawProducer); + + try (producer) { + Thread.sleep(500); + producer.send(new ProducerRecord<>(TOPIC, "sentry-kafka sample message")).get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (Exception ignoredException) { + // local broker may not be available when running the sample + } + + try { + consumedLatch.await(5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } finally { + consumerThread.interrupt(); + try { + consumerThread.join(1000); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + transaction.finish(); + } + } + + public static Properties createProducerProperties(final String bootstrapServers) { + final Properties producerProperties = new Properties(); + producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); + producerProperties.put( + ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + producerProperties.put( + ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + + // Optional tuning for sample stability in CI/local runs. + producerProperties.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, 2000); + producerProperties.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 2000); + producerProperties.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 3000); + + return producerProperties; + } + + public static Properties createConsumerProperties(final String bootstrapServers) { + final Properties consumerProperties = new Properties(); + consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); + consumerProperties.put( + ConsumerConfig.GROUP_ID_CONFIG, "sentry-console-sample-" + UUID.randomUUID()); + consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); + consumerProperties.put( + ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); + consumerProperties.put( + ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); + + // Optional tuning for sample stability in CI/local runs. + consumerProperties.put(ConsumerConfig.DEFAULT_API_TIMEOUT_MS_CONFIG, 2000); + consumerProperties.put(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG, 2000); + + return consumerProperties; + } + + private static Thread startConsumerWithSentryTracing( + final String bootstrapServers, final CountDownLatch consumedLatch) { + final Thread consumerThread = + new Thread( + () -> { + final Properties consumerProperties = createConsumerProperties(bootstrapServers); + + try (KafkaConsumer consumer = + new KafkaConsumer<>(consumerProperties)) { + consumer.subscribe(Collections.singletonList(TOPIC)); + + while (!Thread.currentThread().isInterrupted() && consumedLatch.getCount() > 0) { + final ConsumerRecords records = + consumer.poll(Duration.ofMillis(500)); + for (final ConsumerRecord record : records) { + SentryKafkaConsumerTracing.withTracing( + record, + () -> { + System.out.println( + "Consumed Kafka message from " + + record.topic() + + ": " + + record.value()); + consumedLatch.countDown(); + }); + if (consumedLatch.getCount() == 0) { + break; + } + } + } + } catch (Exception ignored) { + // local broker may not be available when running the sample + } + }, + "sentry-kafka-sample-consumer"); + consumerThread.start(); + return consumerThread; + } +} diff --git a/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt b/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt index 2b009167acb..db6f54a616b 100644 --- a/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt +++ b/sentry-samples/sentry-samples-console/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt @@ -19,19 +19,7 @@ class ConsoleApplicationSystemTest { @Test fun `console application sends expected events when run as JAR`() { - val jarFile = testHelper.findJar("sentry-samples-console") - val process = - testHelper.launch( - jarFile, - mapOf( - "SENTRY_DSN" to testHelper.dsn, - "SENTRY_TRACES_SAMPLE_RATE" to "1.0", - "SENTRY_ENABLE_PRETTY_SERIALIZATION_OUTPUT" to "false", - "SENTRY_DEBUG" to "true", - "SENTRY_PROFILE_SESSION_SAMPLE_RATE" to "1.0", - "SENTRY_PROFILE_LIFECYCLE" to "TRACE", - ), - ) + val process = launchConsoleProcess() process.waitFor(30, TimeUnit.SECONDS) assertEquals(0, process.exitValue()) @@ -40,6 +28,41 @@ class ConsoleApplicationSystemTest { verifyExpectedEvents() } + @Test + fun `console application sends kafka producer and consumer tracing when kafka is enabled`() { + val process = + launchConsoleProcess(mapOf("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS" to "localhost:9092")) + + process.waitFor(30, TimeUnit.SECONDS) + assertEquals(0, process.exitValue()) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "kafka-demo" && + testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish") + } + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionHaveOp(transaction, "queue.process") && + transaction.contexts.trace?.origin == "manual.queue.kafka.consumer" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" + } + } + + private fun launchConsoleProcess(overrides: Map = emptyMap()): Process { + val jarFile = testHelper.findJar("sentry-samples-console") + val env = + mutableMapOf( + "SENTRY_DSN" to testHelper.dsn, + "SENTRY_TRACES_SAMPLE_RATE" to "1.0", + "SENTRY_ENABLE_PRETTY_SERIALIZATION_OUTPUT" to "false", + "SENTRY_DEBUG" to "true", + "SENTRY_PROFILE_SESSION_SAMPLE_RATE" to "1.0", + "SENTRY_PROFILE_LIFECYCLE" to "TRACE", + ) + env.putAll(overrides) + return testHelper.launch(jarFile, env) + } + private fun verifyExpectedEvents() { var profilerId: SentryId? = null // Verify we received a "Fatal message!" event diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index a7b2d939cdc..64ef57692c3 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -58,6 +58,10 @@ dependencies { implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) implementation(projects.sentryAsyncProfiler) + // kafka + implementation(libs.springboot4.starter.kafka) + implementation(projects.sentryKafka) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..0c3bea3b757 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..8c7b166fd33 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index d43a628eb9a..e12b960e0fd 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -59,6 +59,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(libs.otel) + // kafka + implementation(libs.springboot4.starter.kafka) + implementation(projects.sentryKafka) + // cache tracing implementation(libs.springboot4.starter.cache) implementation(libs.caffeine) diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..0c3bea3b757 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..8c7b166fd33 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index d96e5602483..cdb33ecc675 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -61,6 +61,10 @@ dependencies { implementation(libs.springboot4.starter.cache) implementation(libs.caffeine) + // kafka + implementation(libs.springboot4.starter.kafka) + implementation(projects.sentryKafka) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..0c3bea3b757 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..8c7b166fd33 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot4.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..eaaa62af13b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application-kafka.properties @@ -0,0 +1,10 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt new file mode 100644 index 00000000000..43781cf2c56 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-4/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt @@ -0,0 +1,117 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +/** + * System tests for Kafka queue instrumentation. + * + * Requires: + * - The sample app running with `--spring.profiles.active=kafka` + * - A Kafka broker at localhost:9092 + * - The mock Sentry server at localhost:8000 + */ +class KafkaQueueSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `producer endpoint creates queue publish span`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish") + } + } + + @Test + fun `consumer creates queue process transaction`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-consumer-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // The consumer runs asynchronously, so wait for the queue.process transaction + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionHaveOp(transaction, "queue.process") + } + } + + @Test + fun `producer and consumer share same trace`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("trace-test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // Capture the trace ID from the producer transaction (has queue.publish span) + var producerTraceId: String? = null + testHelper.ensureTransactionReceived { transaction, _ -> + if (testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish")) { + producerTraceId = transaction.contexts.trace?.traceId?.toString() + true + } else { + false + } + } + + // Verify the consumer transaction has the same trace ID + // Use retryCount=3 since the consumer may take a moment to process + testHelper.ensureEnvelopeReceived(retryCount = 3) { envelopeString -> + val envelope = + testHelper.jsonSerializer.deserializeEnvelope(envelopeString.byteInputStream()) + ?: return@ensureEnvelopeReceived false + val txItem = + envelope.items.firstOrNull { it.header.type == io.sentry.SentryItemType.Transaction } + ?: return@ensureEnvelopeReceived false + val tx = + txItem.getTransaction(testHelper.jsonSerializer) ?: return@ensureEnvelopeReceived false + + tx.contexts.trace?.operation == "queue.process" && + tx.contexts.trace?.traceId?.toString() == producerTraceId + } + } + + @Test + fun `queue publish span has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + val span = transaction.spans.firstOrNull { it.op == "queue.publish" } + if (span == null) return@ensureTransactionReceived false + + val data = span.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } + + @Test + fun `queue process transaction has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("process-attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + if (!testHelper.doesTransactionHaveOp(transaction, "queue.process")) { + return@ensureTransactionReceived false + } + + val data = transaction.contexts.trace?.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index c7fc0106131..ed0af32b031 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -55,6 +55,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) + // kafka + implementation(libs.spring.kafka3) + implementation(projects.sentryKafka) + // cache tracing implementation(libs.springboot3.starter.cache) implementation(libs.caffeine) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..5931efa3a3b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..b17d231951d --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index 767208a6082..d3d66c469b7 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -59,6 +59,10 @@ dependencies { implementation(libs.otel) implementation(projects.sentryAsyncProfiler) + // kafka + implementation(libs.spring.kafka3) + implementation(projects.sentryKafka) + // cache tracing implementation(libs.springboot3.starter.cache) implementation(libs.caffeine) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..5931efa3a3b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..b17d231951d --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index 98f7ba434ff..ae3ef70ad70 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -62,6 +62,10 @@ dependencies { implementation(libs.springboot3.starter.cache) implementation(libs.caffeine) + // kafka + implementation(libs.spring.kafka3) + implementation(projects.sentryKafka) + // OpenFeature SDK implementation(libs.openfeature) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..5931efa3a3b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..b17d231951d --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.jakarta.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..eaaa62af13b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties @@ -0,0 +1,10 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 60b92d369d5..20f9463aabc 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -37,6 +37,7 @@ spring.quartz.job-store-type=memory # Cache tracing sentry.enable-cache-tracing=true + spring.cache.cache-names=todos spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt new file mode 100644 index 00000000000..43781cf2c56 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt @@ -0,0 +1,117 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +/** + * System tests for Kafka queue instrumentation. + * + * Requires: + * - The sample app running with `--spring.profiles.active=kafka` + * - A Kafka broker at localhost:9092 + * - The mock Sentry server at localhost:8000 + */ +class KafkaQueueSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `producer endpoint creates queue publish span`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish") + } + } + + @Test + fun `consumer creates queue process transaction`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-consumer-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // The consumer runs asynchronously, so wait for the queue.process transaction + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionHaveOp(transaction, "queue.process") + } + } + + @Test + fun `producer and consumer share same trace`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("trace-test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // Capture the trace ID from the producer transaction (has queue.publish span) + var producerTraceId: String? = null + testHelper.ensureTransactionReceived { transaction, _ -> + if (testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish")) { + producerTraceId = transaction.contexts.trace?.traceId?.toString() + true + } else { + false + } + } + + // Verify the consumer transaction has the same trace ID + // Use retryCount=3 since the consumer may take a moment to process + testHelper.ensureEnvelopeReceived(retryCount = 3) { envelopeString -> + val envelope = + testHelper.jsonSerializer.deserializeEnvelope(envelopeString.byteInputStream()) + ?: return@ensureEnvelopeReceived false + val txItem = + envelope.items.firstOrNull { it.header.type == io.sentry.SentryItemType.Transaction } + ?: return@ensureEnvelopeReceived false + val tx = + txItem.getTransaction(testHelper.jsonSerializer) ?: return@ensureEnvelopeReceived false + + tx.contexts.trace?.operation == "queue.process" && + tx.contexts.trace?.traceId?.toString() == producerTraceId + } + } + + @Test + fun `queue publish span has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + val span = transaction.spans.firstOrNull { it.op == "queue.publish" } + if (span == null) return@ensureTransactionReceived false + + val data = span.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } + + @Test + fun `queue process transaction has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("process-attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + if (!testHelper.doesTransactionHaveOp(transaction, "queue.process")) { + return@ensureTransactionReceived false + } + + val data = transaction.contexts.trace?.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index d96c59ac871..f1665f513d1 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -60,6 +60,10 @@ dependencies { implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) implementation(projects.sentryAsyncProfiler) + // kafka + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..013b3590a71 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..779171942d5 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index 1a7f62f6e74..7c84875ca07 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -56,6 +56,10 @@ dependencies { implementation(projects.sentryAsyncProfiler) implementation(libs.otel) + // kafka + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) + // database query tracing implementation(projects.sentryJdbc) runtimeOnly(libs.hsqldb) diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..013b3590a71 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..779171942d5 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..e0abadf5f9c --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application-kafka.properties @@ -0,0 +1,12 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer + +logging.level.org.apache.kafka=warn diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt new file mode 100644 index 00000000000..c401c91463e --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/KafkaOtelCoexistenceSystemTest.kt @@ -0,0 +1,37 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +class KafkaOtelCoexistenceSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `Sentry Kafka integration is suppressed when OTel is active`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("otel-coexistence-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.transaction == "GET /kafka/produce" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + + testHelper.ensureTransactionReceived { transaction, _ -> + transaction.contexts.trace?.operation == "queue.process" && + transaction.contexts.trace?.origin == "auto.opentelemetry" && + transaction.contexts.trace?.data?.get("messaging.system") == "kafka" && + transaction.sdk?.integrationSet?.contains("SpringKafka") != true + } + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index 5b89ef568e4..cc535c725e1 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -47,6 +47,10 @@ dependencies { implementation(libs.springboot.starter.cache) implementation(libs.springboot.starter.websocket) implementation(libs.caffeine) + + // kafka + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) implementation(Config.Libs.aspectj) implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java new file mode 100644 index 00000000000..013b3590a71 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaConsumer.java @@ -0,0 +1,19 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +@Component +@Profile("kafka") +public class KafkaConsumer { + + private static final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class); + + @KafkaListener(topics = "sentry-topic", groupId = "sentry-sample-group") + public void listen(String message) { + logger.info("Received message: {}", message); + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java new file mode 100644 index 00000000000..779171942d5 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/queues/kafka/KafkaController.java @@ -0,0 +1,26 @@ +package io.sentry.samples.spring.boot.queues.kafka; + +import org.springframework.context.annotation.Profile; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Profile("kafka") +@RequestMapping("/kafka") +public class KafkaController { + + private final KafkaTemplate kafkaTemplate; + + public KafkaController(KafkaTemplate kafkaTemplate) { + this.kafkaTemplate = kafkaTemplate; + } + + @GetMapping("/produce") + String produce(@RequestParam(defaultValue = "hello from sentry!") String message) { + kafkaTemplate.send("sentry-topic", message); + return "Message sent: " + message; + } +} diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application-kafka.properties new file mode 100644 index 00000000000..eaaa62af13b --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application-kafka.properties @@ -0,0 +1,10 @@ +# Kafka — activate with: --spring.profiles.active=kafka +sentry.enable-queue-tracing=true + +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.consumer.group-id=sentry-sample-group +spring.kafka.consumer.auto-offset-reset=earliest +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt new file mode 100644 index 00000000000..43781cf2c56 --- /dev/null +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/KafkaQueueSystemTest.kt @@ -0,0 +1,117 @@ +package io.sentry.systemtest + +import io.sentry.systemtest.util.TestHelper +import kotlin.test.Test +import kotlin.test.assertEquals +import org.junit.Before + +/** + * System tests for Kafka queue instrumentation. + * + * Requires: + * - The sample app running with `--spring.profiles.active=kafka` + * - A Kafka broker at localhost:9092 + * - The mock Sentry server at localhost:8000 + */ +class KafkaQueueSystemTest { + lateinit var testHelper: TestHelper + + @Before + fun setup() { + testHelper = TestHelper("http://localhost:8080") + testHelper.reset() + } + + @Test + fun `producer endpoint creates queue publish span`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish") + } + } + + @Test + fun `consumer creates queue process transaction`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("test-consumer-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // The consumer runs asynchronously, so wait for the queue.process transaction + testHelper.ensureTransactionReceived { transaction, _ -> + testHelper.doesTransactionHaveOp(transaction, "queue.process") + } + } + + @Test + fun `producer and consumer share same trace`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("trace-test-message") + assertEquals(200, restClient.lastKnownStatusCode) + + // Capture the trace ID from the producer transaction (has queue.publish span) + var producerTraceId: String? = null + testHelper.ensureTransactionReceived { transaction, _ -> + if (testHelper.doesTransactionContainSpanWithOp(transaction, "queue.publish")) { + producerTraceId = transaction.contexts.trace?.traceId?.toString() + true + } else { + false + } + } + + // Verify the consumer transaction has the same trace ID + // Use retryCount=3 since the consumer may take a moment to process + testHelper.ensureEnvelopeReceived(retryCount = 3) { envelopeString -> + val envelope = + testHelper.jsonSerializer.deserializeEnvelope(envelopeString.byteInputStream()) + ?: return@ensureEnvelopeReceived false + val txItem = + envelope.items.firstOrNull { it.header.type == io.sentry.SentryItemType.Transaction } + ?: return@ensureEnvelopeReceived false + val tx = + txItem.getTransaction(testHelper.jsonSerializer) ?: return@ensureEnvelopeReceived false + + tx.contexts.trace?.operation == "queue.process" && + tx.contexts.trace?.traceId?.toString() == producerTraceId + } + } + + @Test + fun `queue publish span has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + val span = transaction.spans.firstOrNull { it.op == "queue.publish" } + if (span == null) return@ensureTransactionReceived false + + val data = span.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } + + @Test + fun `queue process transaction has messaging attributes`() { + val restClient = testHelper.restClient + + restClient.produceKafkaMessage("process-attrs-test") + assertEquals(200, restClient.lastKnownStatusCode) + + testHelper.ensureTransactionReceived { transaction, _ -> + if (!testHelper.doesTransactionHaveOp(transaction, "queue.process")) { + return@ensureTransactionReceived false + } + + val data = transaction.contexts.trace?.data ?: return@ensureTransactionReceived false + data["messaging.system"] == "kafka" && data["messaging.destination.name"] == "sentry-topic" + } + } +} diff --git a/sentry-spring-7/api/sentry-spring-7.api b/sentry-spring-7/api/sentry-spring-7.api index 71a8a022bf6..c9250b550fd 100644 --- a/sentry-spring-7/api/sentry-spring-7.api +++ b/sentry-spring-7/api/sentry-spring-7.api @@ -244,6 +244,29 @@ public final class io/sentry/spring7/graphql/SentrySpringSubscriptionHandler : i public fun onSubscriptionResult (Ljava/lang/Object;Lio/sentry/IScopes;Lio/sentry/graphql/ExceptionReporter;Lgraphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters;)Ljava/lang/Object; } +public final class io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring7/kafka/SentryKafkaRecordInterceptor : org/springframework/kafka/listener/RecordInterceptor { + public fun (Lio/sentry/IScopes;)V + public fun (Lio/sentry/IScopes;Lorg/springframework/kafka/listener/RecordInterceptor;)V + public fun afterRecord (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun clearThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun failure (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Ljava/lang/Exception;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun intercept (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)Lorg/apache/kafka/clients/consumer/ConsumerRecord; + public fun setupThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun success (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V +} + public class io/sentry/spring7/opentelemetry/SentryOpenTelemetryAgentWithoutAutoInitConfiguration { public fun ()V public fun sentryOpenTelemetryOptionsConfiguration ()Lio/sentry/Sentry$OptionsConfiguration; diff --git a/sentry-spring-7/build.gradle.kts b/sentry-spring-7/build.gradle.kts index 8102909afb0..ae8269e7825 100644 --- a/sentry-spring-7/build.gradle.kts +++ b/sentry-spring-7/build.gradle.kts @@ -43,10 +43,12 @@ dependencies { compileOnly(libs.slf4j.api) compileOnly(libs.springboot4.starter.graphql) compileOnly(libs.springboot4.starter.quartz) + compileOnly(libs.spring.kafka4) compileOnly(Config.Libs.springWebflux) compileOnly(projects.sentryGraphql) compileOnly(projects.sentryGraphql22) + compileOnly(projects.sentryKafka) compileOnly(projects.sentryQuartz) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap) @@ -60,6 +62,7 @@ dependencies { // tests testImplementation(projects.sentryTestSupport) testImplementation(projects.sentryGraphql) + testImplementation(projects.sentryKafka) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(libs.awaitility.kotlin.spring7) testImplementation(libs.context.propagation) @@ -69,6 +72,7 @@ dependencies { testImplementation(libs.mockito.inline) testImplementation(libs.springboot4.starter.aspectj) testImplementation(libs.springboot4.starter.graphql) + testImplementation(libs.spring.kafka4) testImplementation(libs.springboot4.starter.security) testImplementation(libs.springboot4.starter.test) testImplementation(libs.springboot4.starter.web) diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessor.java b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessor.java new file mode 100644 index 00000000000..069330a4247 --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessor.java @@ -0,0 +1,98 @@ +package io.sentry.spring7.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import java.lang.reflect.Field; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.config.AbstractKafkaListenerContainerFactory; +import org.springframework.kafka.listener.RecordInterceptor; + +/** + * Registers {@link SentryKafkaRecordInterceptor} on {@link AbstractKafkaListenerContainerFactory} + * beans. If an existing {@link RecordInterceptor} is already set, it is composed as a delegate. + */ +@ApiStatus.Internal +public final class SentryKafkaConsumerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + private static final @NotNull String RECORD_INTERCEPTOR_FIELD_NAME = "recordInterceptor"; + + private final @NotNull String recordInterceptorFieldName; + + public SentryKafkaConsumerBeanPostProcessor() { + this(RECORD_INTERCEPTOR_FIELD_NAME); + } + + SentryKafkaConsumerBeanPostProcessor(final @NotNull String recordInterceptorFieldName) { + this.recordInterceptorFieldName = recordInterceptorFieldName; + } + + private static final class InterceptorReadFailedException extends Exception { + private static final long serialVersionUID = 1L; + + InterceptorReadFailedException(final @NotNull Throwable cause) { + super(cause); + } + } + + @Override + @SuppressWarnings("unchecked") + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof AbstractKafkaListenerContainerFactory) { + final @NotNull AbstractKafkaListenerContainerFactory factory = + (AbstractKafkaListenerContainerFactory) bean; + + final @Nullable RecordInterceptor existing; + try { + existing = getExistingInterceptor(factory); + } catch (InterceptorReadFailedException e) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.ERROR, + e, + "Sentry Kafka consumer tracing disabled for factory '%s' \u2014 could not read " + + "existing recordInterceptor via reflection. Refusing to install Sentry's " + + "interceptor to avoid overwriting a customer-configured RecordInterceptor.", + beanName); + return bean; + } + + if (existing instanceof SentryKafkaRecordInterceptor) { + return bean; + } + + @SuppressWarnings("rawtypes") + final RecordInterceptor sentryInterceptor = + new SentryKafkaRecordInterceptor<>(ScopesAdapter.getInstance(), existing); + factory.setRecordInterceptor(sentryInterceptor); + } + return bean; + } + + private @Nullable RecordInterceptor getExistingInterceptor( + final @NotNull AbstractKafkaListenerContainerFactory factory) + throws InterceptorReadFailedException { + try { + final @NotNull Field field = + AbstractKafkaListenerContainerFactory.class.getDeclaredField(recordInterceptorFieldName); + field.setAccessible(true); + return (RecordInterceptor) field.get(factory); + } catch (NoSuchFieldException | IllegalAccessException | RuntimeException e) { + throw new InterceptorReadFailedException(e); + } + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessor.java b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessor.java new file mode 100644 index 00000000000..eff0b4154bb --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessor.java @@ -0,0 +1,76 @@ +package io.sentry.spring7.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.kafka.SentryKafkaProducer; +import org.apache.kafka.clients.producer.Producer; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.core.ProducerFactory; +import org.springframework.kafka.core.ProducerPostProcessor; + +/** + * Installs a {@link ProducerPostProcessor} on every {@link ProducerFactory} bean so that each + * {@link Producer} created by Spring Kafka is wrapped via {@link SentryKafkaProducer#wrap + * SentryKafkaProducer.wrap(Producer)}. + * + *

The wrapper records a {@code queue.publish} span around each {@code send(...)} that finishes + * when the broker ack callback fires, giving a real producer-send lifecycle span. {@code + * KafkaTemplate} beans are left untouched, so all customer-configured listeners, interceptors and + * observation settings are preserved. + * + *

Note: {@link ProducerFactory#addPostProcessor(ProducerPostProcessor)} is a default method on + * the interface that is a no-op unless overridden. Custom factories that do not extend {@code + * DefaultKafkaProducerFactory} will not receive Sentry producer instrumentation; a warning is + * logged at startup in that case. + */ +@ApiStatus.Internal +public final class SentryKafkaProducerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + @Override + @SuppressWarnings({"unchecked", "rawtypes"}) + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof ProducerFactory) { + final @NotNull ProducerFactory factory = (ProducerFactory) bean; + final @NotNull SentryProducerPostProcessor pp = new SentryProducerPostProcessor<>(); + factory.addPostProcessor(pp); + if (!factory.getPostProcessors().contains(pp)) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Sentry Kafka producer tracing not active for ProducerFactory '%s' (%s). " + + "addPostProcessor() was not honored — the factory may not extend " + + "DefaultKafkaProducerFactory. Wrap producers manually with " + + "SentryKafkaProducer.wrap(producer).", + beanName, + factory.getClass().getName()); + } + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } + + /** + * Marker {@link ProducerPostProcessor} that wraps the freshly created Kafka {@link Producer} via + * {@link SentryKafkaProducer#wrap}. + */ + static final class SentryProducerPostProcessor implements ProducerPostProcessor { + @Override + public @NotNull Producer apply(final @NotNull Producer producer) { + return SentryKafkaProducer.wrap( + producer, ScopesAdapter.getInstance(), "auto.queue.spring7.kafka.producer"); + } + } +} diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaRecordInterceptor.java b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaRecordInterceptor.java new file mode 100644 index 00000000000..b2b4d20b948 --- /dev/null +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/kafka/SentryKafkaRecordInterceptor.java @@ -0,0 +1,292 @@ +package io.sentry.spring7.kafka; + +import io.sentry.BaggageHeader; +import io.sentry.DateUtils; +import io.sentry.IScopes; +import io.sentry.ISentryLifecycleToken; +import io.sentry.ITransaction; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.SpanDataConvention; +import io.sentry.SpanStatus; +import io.sentry.TransactionContext; +import io.sentry.TransactionOptions; +import io.sentry.kafka.SentryKafkaProducer; +import io.sentry.util.SpanUtils; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import org.apache.kafka.clients.consumer.Consumer; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.header.Header; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.kafka.listener.RecordInterceptor; +import org.springframework.kafka.support.KafkaHeaders; + +/** + * A {@link RecordInterceptor} that creates {@code queue.process} transactions for incoming Kafka + * records with distributed tracing support. + */ +@ApiStatus.Internal +public final class SentryKafkaRecordInterceptor implements RecordInterceptor { + + static final String TRACE_ORIGIN = "auto.queue.spring7.kafka.consumer"; + + private final @NotNull IScopes scopes; + private final @Nullable RecordInterceptor delegate; + + private static final @NotNull ThreadLocal currentContext = + new ThreadLocal<>(); + + public SentryKafkaRecordInterceptor(final @NotNull IScopes scopes) { + this(scopes, null); + } + + public SentryKafkaRecordInterceptor( + final @NotNull IScopes scopes, final @Nullable RecordInterceptor delegate) { + this.scopes = scopes; + this.delegate = delegate; + } + + @Override + public @Nullable ConsumerRecord intercept( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (!scopes.getOptions().isEnableQueueTracing() || isIgnored()) { + return delegateIntercept(record, consumer); + } + + try { + finishStaleContext(); + + final @NotNull IScopes forkedScopes = scopes.forkedRootScopes("SentryKafkaRecordInterceptor"); + final @NotNull ISentryLifecycleToken lifecycleToken = forkedScopes.makeCurrent(); + currentContext.set(new SentryRecordContext(lifecycleToken, null)); + + final @Nullable TransactionContext transactionContext = continueTrace(forkedScopes, record); + + final @Nullable ITransaction transaction = + startTransaction(forkedScopes, record, transactionContext); + currentContext.set(new SentryRecordContext(lifecycleToken, transaction)); + } catch (Throwable t) { + scopes.getOptions().getLogger().log(SentryLevel.ERROR, "Unable to wrap Kafka consumer.", t); + } + return delegateIntercept(record, consumer); + } + + @Override + public void success( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.success(record, consumer); + } + } finally { + finishSpan(SpanStatus.OK, null); + } + } + + @Override + public void failure( + final @NotNull ConsumerRecord record, + final @NotNull Exception exception, + final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.failure(record, exception, consumer); + } + } finally { + finishSpan(SpanStatus.INTERNAL_ERROR, exception); + } + } + + @Override + public void afterRecord( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.afterRecord(record, consumer); + } + } + + @Override + public void setupThreadState(final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.setupThreadState(consumer); + } + } + + @Override + public void clearThreadState(final @NotNull Consumer consumer) { + try { + finishStaleContext(); + } finally { + if (delegate != null) { + delegate.clearThreadState(consumer); + } + } + } + + private boolean isIgnored() { + return SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), TRACE_ORIGIN); + } + + private @Nullable ConsumerRecord delegateIntercept( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (delegate != null) { + return delegate.intercept(record, consumer); + } + return record; + } + + private @Nullable TransactionContext continueTrace( + final @NotNull IScopes forkedScopes, final @NotNull ConsumerRecord record) { + final @Nullable String sentryTrace = headerValue(record, SentryTraceHeader.SENTRY_TRACE_HEADER); + final @Nullable List baggageHeaders = + headerValues(record, BaggageHeader.BAGGAGE_HEADER); + return forkedScopes.continueTrace(sentryTrace, baggageHeaders); + } + + private @Nullable ITransaction startTransaction( + final @NotNull IScopes forkedScopes, + final @NotNull ConsumerRecord record, + final @Nullable TransactionContext transactionContext) { + if (!forkedScopes.getOptions().isTracingEnabled()) { + return null; + } + + final @NotNull TransactionContext txContext = + transactionContext != null + ? transactionContext + : new TransactionContext(record.topic(), "queue.process"); + txContext.setName(record.topic()); + txContext.setOperation("queue.process"); + + final @NotNull TransactionOptions txOptions = new TransactionOptions(); + txOptions.setOrigin(TRACE_ORIGIN); + txOptions.setBindToScope(true); + + final @NotNull ITransaction transaction = forkedScopes.startTransaction(txContext, txOptions); + + if (transaction.isNoOp()) { + return null; + } + + transaction.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka"); + transaction.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic()); + + final @Nullable String messageId = headerValue(record, "messaging.message.id"); + if (messageId != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_ID, messageId); + } + + final int bodySize = record.serializedValueSize(); + if (bodySize >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE, bodySize); + } + + final @Nullable Integer retryCount = retryCount(record); + if (retryCount != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT, retryCount); + } + + final @Nullable String enqueuedTimeStr = + headerValue(record, SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER); + if (enqueuedTimeStr != null) { + try { + final double enqueuedTimeSeconds = Double.parseDouble(enqueuedTimeStr); + final double nowSeconds = DateUtils.millisToSeconds(System.currentTimeMillis()); + final long latencyMs = (long) ((nowSeconds - enqueuedTimeSeconds) * 1000); + if (latencyMs >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY, latencyMs); + } + } catch (NumberFormatException ignored) { + // ignore malformed header + } + } + + return transaction; + } + + private @Nullable Integer retryCount(final @NotNull ConsumerRecord record) { + final @Nullable Header header = record.headers().lastHeader(KafkaHeaders.DELIVERY_ATTEMPT); + if (header == null) { + return null; + } + + final byte[] value = header.value(); + if (value == null || value.length != Integer.BYTES) { + return null; + } + + final int attempt = ByteBuffer.wrap(value).getInt(); + if (attempt <= 0) { + return null; + } + + return attempt - 1; + } + + private void finishStaleContext() { + if (currentContext.get() != null) { + finishSpan(SpanStatus.UNKNOWN, null); + } + } + + private void finishSpan(final @NotNull SpanStatus status, final @Nullable Throwable throwable) { + final @Nullable SentryRecordContext ctx = currentContext.get(); + if (ctx == null) { + return; + } + currentContext.remove(); + + try { + final @Nullable ITransaction transaction = ctx.transaction; + if (transaction != null) { + transaction.setStatus(status); + if (throwable != null) { + transaction.setThrowable(throwable); + } + transaction.finish(); + } + } finally { + ctx.lifecycleToken.close(); + } + } + + private @Nullable String headerValue( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + final @Nullable Header header = record.headers().lastHeader(headerName); + if (header == null || header.value() == null) { + return null; + } + return new String(header.value(), StandardCharsets.UTF_8); + } + + private @Nullable List headerValues( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + @Nullable List values = null; + for (final @NotNull Header header : record.headers().headers(headerName)) { + if (header.value() != null) { + if (values == null) { + values = new ArrayList<>(); + } + values.add(new String(header.value(), StandardCharsets.UTF_8)); + } + } + return values; + } + + private static final class SentryRecordContext { + final @NotNull ISentryLifecycleToken lifecycleToken; + final @Nullable ITransaction transaction; + + SentryRecordContext( + final @NotNull ISentryLifecycleToken lifecycleToken, + final @Nullable ITransaction transaction) { + this.lifecycleToken = lifecycleToken; + this.transaction = transaction; + } + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..e5eb3b55292 --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt @@ -0,0 +1,124 @@ +package io.sentry.spring7.kafka + +import io.sentry.Sentry +import io.sentry.test.initForTest +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory +import org.springframework.kafka.core.ConsumerFactory +import org.springframework.kafka.listener.RecordInterceptor + +class SentryKafkaConsumerBeanPostProcessorTest { + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + @Test + fun `wraps ConcurrentKafkaListenerContainerFactory with SentryKafkaRecordInterceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.setConsumerFactory(consumerFactory) + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + // Verify via reflection that the interceptor was set + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val interceptor = field.get(factory) + assertTrue(interceptor is SentryKafkaRecordInterceptor<*, *>) + } + + @Test + fun `does not double-wrap when SentryKafkaRecordInterceptor already set`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.setConsumerFactory(consumerFactory) + + val processor = SentryKafkaConsumerBeanPostProcessor() + // First wrap + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val firstInterceptor = field.get(factory) + + // Second wrap — should be idempotent + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + val secondInterceptor = field.get(factory) + + assertSame(firstInterceptor, secondInterceptor) + } + + @Test + fun `does not wrap non-factory beans`() { + val someBean = "not a factory" + val processor = SentryKafkaConsumerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `chains existing customer RecordInterceptor as delegate`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.setConsumerFactory(consumerFactory) + + val customerInterceptor = RecordInterceptor { record, _ -> record } + factory.setRecordInterceptor(customerInterceptor) + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val installed = field.get(factory) + assertTrue( + installed is SentryKafkaRecordInterceptor<*, *>, + "expected SentryKafkaRecordInterceptor, got ${installed?.javaClass}", + ) + + val delegateField = SentryKafkaRecordInterceptor::class.java.getDeclaredField("delegate") + delegateField.isAccessible = true + assertSame( + customerInterceptor, + delegateField.get(installed), + "customer interceptor must be preserved as delegate", + ) + } + + @Test + fun `skips installation when reflection fails and preserves customer interceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.setConsumerFactory(consumerFactory) + val customerInterceptor = RecordInterceptor { record, _ -> record } + factory.setRecordInterceptor(customerInterceptor) + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + assertSame(customerInterceptor, field.get(factory)) + + val processor = SentryKafkaConsumerBeanPostProcessor("missingRecordInterceptor") + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + assertSame( + customerInterceptor, + field.get(factory), + "customer interceptor must remain installed when Sentry cannot read it", + ) + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..d11ac1e6c1b --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -0,0 +1,109 @@ +package io.sentry.spring7.kafka + +import io.sentry.Sentry +import io.sentry.test.initForTest +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.apache.kafka.clients.producer.Producer +import org.mockito.kotlin.any +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.core.DefaultKafkaProducerFactory +import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.core.ProducerPostProcessor + +class SentryKafkaProducerBeanPostProcessorTest { + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + @Test + fun `registers Sentry post-processor on ProducerFactory`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + val captor = argumentCaptor>() + verify(factory).addPostProcessor(captor.capture()) + assertTrue( + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } + + @Test + fun `does not throw when addPostProcessor is a no-op (default interface method)`() { + // Factory using the default no-op addPostProcessor / getPostProcessors + val factory = mock>() + whenever(factory.postProcessors).thenReturn(emptyList()) + val processor = SentryKafkaProducerBeanPostProcessor() + + // Should complete without throwing, and log a warning via ScopesAdapter + processor.postProcessAfterInitialization(factory, "myFactory") + + verify(factory).addPostProcessor(any()) + } + + @Test + fun `does not modify non-ProducerFactory beans`() { + val someBean = "not a producer factory" + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `returns the same bean instance`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertSame(factory, result, "BPP must return the same bean, not a replacement") + } + + @Test + fun `registered post-processor wraps producers via SentryKafkaProducer wrap`() { + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + val raw = mock>() + + val wrapped = pp.apply(raw) + + assertTrue(java.lang.reflect.Proxy.isProxyClass(wrapped.javaClass)) + } + + @Test + fun `integrates with DefaultKafkaProducerFactory addPostProcessor contract`() { + // Sanity check against the real Spring Kafka API surface — DefaultKafkaProducerFactory + // honors addPostProcessor and exposes it via getPostProcessors(). + val factory = DefaultKafkaProducerFactory(emptyMap()) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertEquals(1, factory.postProcessors.size) + assertTrue( + factory.postProcessors.first() + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } +} diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaRecordInterceptorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaRecordInterceptorTest.kt new file mode 100644 index 00000000000..2738f99f4df --- /dev/null +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaRecordInterceptorTest.kt @@ -0,0 +1,473 @@ +package io.sentry.spring7.kafka + +import io.sentry.BaggageHeader +import io.sentry.IScopes +import io.sentry.ISentryLifecycleToken +import io.sentry.Sentry +import io.sentry.SentryOptions +import io.sentry.SentryTraceHeader +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.TransactionContext +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.test.initForTest +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.util.Optional +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.apache.kafka.clients.consumer.Consumer +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.header.internals.RecordHeaders +import org.apache.kafka.common.record.TimestampType +import org.mockito.kotlin.any +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.listener.RecordInterceptor +import org.springframework.kafka.support.KafkaHeaders + +class SentryKafkaRecordInterceptorTest { + + private lateinit var scopes: IScopes + private lateinit var forkedScopes: IScopes + private lateinit var options: SentryOptions + private lateinit var consumer: Consumer + private lateinit var lifecycleToken: ISentryLifecycleToken + private lateinit var transaction: SentryTracer + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + scopes = mock() + consumer = mock() + lifecycleToken = mock() + options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + isEnableQueueTracing = true + tracesSampleRate = 1.0 + } + whenever(scopes.options).thenReturn(options) + whenever(scopes.isEnabled).thenReturn(true) + + forkedScopes = mock() + whenever(scopes.forkedRootScopes(any())).thenReturn(forkedScopes) + whenever(forkedScopes.options).thenReturn(options) + whenever(forkedScopes.makeCurrent()).thenReturn(lifecycleToken) + + transaction = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes) + whenever(forkedScopes.startTransaction(any(), any())) + .thenReturn(transaction) + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + private fun createRecord( + topic: String = "my-topic", + headers: RecordHeaders = RecordHeaders(), + serializedValueSize: Int = -1, + ): ConsumerRecord { + return ConsumerRecord( + topic, + 0, + 0L, + System.currentTimeMillis(), + TimestampType.CREATE_TIME, + 3, + serializedValueSize, + "key", + "value", + headers, + Optional.empty(), + ) + } + + private fun createRecordWithHeaders( + sentryTrace: String? = null, + baggage: String? = null, + baggageHeaders: List? = null, + enqueuedTime: String? = null, + deliveryAttempt: Int? = null, + ): ConsumerRecord { + val headers = RecordHeaders() + sentryTrace?.let { + headers.add(SentryTraceHeader.SENTRY_TRACE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggage?.let { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggageHeaders?.forEach { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + enqueuedTime?.let { + headers.add( + SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER, + it.toByteArray(StandardCharsets.UTF_8), + ) + } + deliveryAttempt?.let { + headers.add( + KafkaHeaders.DELIVERY_ATTEMPT, + ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array(), + ) + } + val record = ConsumerRecord("my-topic", 0, 0L, "key", "value") + headers.forEach { record.headers().add(it) } + return record + } + + @Test + fun `intercept forks root scopes`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(scopes).forkedRootScopes("SentryKafkaRecordInterceptor") + verify(forkedScopes).makeCurrent() + verify(forkedScopes) + .startTransaction( + org.mockito.kotlin.check { + assertEquals("my-topic", it.name) + assertEquals("queue.process", it.operation) + }, + any(), + ) + } + + @Test + fun `intercept continues trace from headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = createRecordWithHeaders(sentryTrace = sentryTraceValue) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace(org.mockito.kotlin.eq(sentryTraceValue), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept calls continueTrace with null when no headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(forkedScopes).continueTrace(org.mockito.kotlin.isNull(), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept passes all baggage headers to continueTrace`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = + createRecordWithHeaders( + sentryTrace = sentryTraceValue, + baggageHeaders = listOf("third=party", "sentry-sample_rate=1"), + ) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace( + org.mockito.kotlin.eq(sentryTraceValue), + org.mockito.kotlin.eq(listOf("third=party", "sentry-sample_rate=1")), + ) + } + + @Test + fun `sets body size from serializedValueSize`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = 42) + + interceptor.intercept(record, consumer) + + assertEquals(42, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `does not set body size when serializedValueSize is negative`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = -1) + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `sets retry count from delivery attempt header`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecordWithHeaders(deliveryAttempt = 3) + + interceptor.intercept(record, consumer) + + assertEquals(2, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `does not set retry count when delivery attempt header is missing`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `sets receive latency from enqueued time in epoch seconds`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val enqueuedTime = (System.currentTimeMillis() / 1000.0 - 1.0).toString() + val record = createRecordWithHeaders(enqueuedTime = enqueuedTime) + + interceptor.intercept(record, consumer) + + val latency = transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY) + assertTrue(latency is Long && latency >= 0) + } + + @Test + fun `does not create span when queue tracing is disabled`() { + options.isEnableQueueTracing = false + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `does not create span when origin is ignored`() { + options.setIgnoredSpanOrigins(listOf(SentryKafkaRecordInterceptor.TRACE_ORIGIN)) + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `delegates to existing interceptor`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + interceptor.intercept(record, consumer) + + verify(delegate).intercept(record, consumer) + } + + @Test + fun `success finishes transaction and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + + verify(delegate).success(record, consumer) + } + + @Test + fun `failure finishes transaction with error and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + val exception = RuntimeException("processing failed") + + interceptor.intercept(record, consumer) + interceptor.failure(record, exception, consumer) + + verify(delegate).failure(record, exception, consumer) + } + + @Test + fun `afterRecord delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.afterRecord(record, consumer) + + verify(delegate).afterRecord(record, consumer) + } + + @Test + fun `trace origin is set correctly`() { + assertEquals("auto.queue.spring7.kafka.consumer", SentryKafkaRecordInterceptor.TRACE_ORIGIN) + } + + @Test + fun `clearThreadState cleans up stale context`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken).close() + } + + @Test + fun `clearThreadState is no-op when no context exists`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.clearThreadState(consumer) + } + + @Test + fun `setupThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + + verify(delegate).setupThreadState(consumer) + } + + @Test + fun `setupThreadState is no-op without delegate`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.setupThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.clearThreadState(consumer) + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor even when sentry cleanup throws`() { + val delegate = mock>() + whenever(lifecycleToken.close()).thenThrow(RuntimeException("boom")) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + + try { + interceptor.clearThreadState(consumer) + } catch (ignored: RuntimeException) { + // expected + } + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `full lifecycle intercept success clearThreadState closes token exactly once`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + interceptor.clearThreadState(consumer) + + // token closed once by success(); clearThreadState must not re-close it + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + // delegate hooks still delegated across the full lifecycle + verify(delegate).setupThreadState(consumer) + verify(delegate).success(record, consumer) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept returns null clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + // delegate filters the record — per Spring Kafka contract, success/failure will not be invoked + whenever(delegate.intercept(record, consumer)).thenReturn(null) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val result = interceptor.intercept(record, consumer) + interceptor.clearThreadState(consumer) + + assertNull(result) + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept throws clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + val boom = RuntimeException("delegate boom") + whenever(delegate.intercept(record, consumer)).thenThrow(boom) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val thrown = assertFailsWith { interceptor.intercept(record, consumer) } + assertEquals(boom, thrown) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `intercept cleans up stale context from previous record`() { + val lifecycleToken2 = mock() + val forkedScopes2 = mock() + whenever(forkedScopes2.options).thenReturn(options) + whenever(forkedScopes2.makeCurrent()).thenReturn(lifecycleToken2) + val tx2 = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes2) + whenever(forkedScopes2.startTransaction(any(), any())).thenReturn(tx2) + + var callCount = 0 + + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + whenever(scopes.forkedRootScopes(any())).thenAnswer { + callCount++ + if (callCount == 1) forkedScopes else forkedScopes2 + } + + // First intercept sets up context + interceptor.intercept(record, consumer) + + // Second intercept without success/failure — should clean up stale context first + interceptor.intercept(record, consumer) + + // First lifecycle token should have been closed by the defensive cleanup + verify(lifecycleToken).close() + } +} diff --git a/sentry-spring-boot-4/build.gradle.kts b/sentry-spring-boot-4/build.gradle.kts index 69a40f7b64f..3b0b3be8630 100644 --- a/sentry-spring-boot-4/build.gradle.kts +++ b/sentry-spring-boot-4/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { compileOnly(projects.sentryGraphql) compileOnly(projects.sentryGraphql22) compileOnly(projects.sentryQuartz) + compileOnly(libs.spring.kafka4) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springWebflux) compileOnly(libs.context.propagation) @@ -68,6 +69,7 @@ dependencies { testImplementation(projects.sentryApacheHttpClient5) testImplementation(projects.sentryGraphql) testImplementation(projects.sentryGraphql22) + testImplementation(projects.sentryKafka) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryCore) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryAgent) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) @@ -96,6 +98,7 @@ dependencies { testImplementation(libs.springboot4.starter) testImplementation(libs.springboot4.starter.aspectj) testImplementation(libs.springboot4.starter.graphql) + testImplementation(libs.spring.kafka4) testImplementation(libs.springboot4.starter.quartz) testImplementation(libs.springboot4.starter.security) testImplementation(libs.springboot4.starter.test) diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java index ae9e3ac50fe..2429c1e7446 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java @@ -31,6 +31,8 @@ import io.sentry.spring7.checkin.SentryQuartzConfiguration; import io.sentry.spring7.exception.SentryCaptureExceptionParameterPointcutConfiguration; import io.sentry.spring7.exception.SentryExceptionParameterAdviceConfiguration; +import io.sentry.spring7.kafka.SentryKafkaConsumerBeanPostProcessor; +import io.sentry.spring7.kafka.SentryKafkaProducerBeanPostProcessor; import io.sentry.spring7.opentelemetry.SentryOpenTelemetryAgentWithoutAutoInitConfiguration; import io.sentry.spring7.opentelemetry.SentryOpenTelemetryNoAgentConfiguration; import io.sentry.spring7.tracing.CombinedTransactionNameProvider; @@ -244,6 +246,34 @@ static class SentryCacheConfiguration { } } + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass( + name = { + "org.springframework.kafka.core.KafkaTemplate", + "io.sentry.kafka.SentryKafkaProducer" + }) + @ConditionalOnProperty(name = "sentry.enable-queue-tracing", havingValue = "true") + @ConditionalOnMissingClass({ + "io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider", + "io.sentry.opentelemetry.agent.AgentMarker" + }) + @Open + static class SentryKafkaQueueConfiguration { + + @Bean + public static @NotNull SentryKafkaProducerBeanPostProcessor + sentryKafkaProducerBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringKafka"); + return new SentryKafkaProducerBeanPostProcessor(); + } + + @Bean + public static @NotNull SentryKafkaConsumerBeanPostProcessor + sentryKafkaConsumerBeanPostProcessor() { + return new SentryKafkaConsumerBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryKafkaAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryKafkaAutoConfigurationTest.kt new file mode 100644 index 00000000000..d4d2b439427 --- /dev/null +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryKafkaAutoConfigurationTest.kt @@ -0,0 +1,125 @@ +package io.sentry.spring.boot4 + +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider +import io.sentry.opentelemetry.agent.AgentMarker +import io.sentry.spring7.kafka.SentryKafkaConsumerBeanPostProcessor +import io.sentry.spring7.kafka.SentryKafkaProducerBeanPostProcessor +import kotlin.test.Test +import org.assertj.core.api.Assertions.assertThat +import org.springframework.boot.autoconfigure.AutoConfigurations +import org.springframework.boot.test.context.FilteredClassLoader +import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.kafka.core.KafkaTemplate + +class SentryKafkaAutoConfigurationTest { + + private val contextRunner = + ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(SentryAutoConfiguration::class.java)) + .withPropertyValues( + "sentry.dsn=http://key@localhost/proj", + "sentry.traces-sample-rate=1.0", + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", + "sentry.debug=false", + ) + + private val noOtelClassLoader = + FilteredClassLoader( + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noOtelCustomizerClassLoader = + FilteredClassLoader(SentryAutoConfigurationCustomizerProvider::class.java) + + private val noSentryKafkaClassLoader = + FilteredClassLoader( + SentryKafkaProducer::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noSpringKafkaClassLoader = + FilteredClassLoader( + KafkaTemplate::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + @Test + fun `registers Kafka BPPs when queue tracing is enabled`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).hasSingleBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).hasSingleBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is disabled`() { + contextRunner.withClassLoader(noOtelClassLoader).run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when sentry-kafka is not present`() { + contextRunner + .withClassLoader(noSentryKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when spring-kafka is not present`() { + contextRunner + .withClassLoader(noSpringKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is explicitly false`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=false") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry agent is present`() { + contextRunner + .withClassLoader(noOtelCustomizerClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry integration is present`() { + contextRunner.withPropertyValues("sentry.enable-queue-tracing=true").run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } +} diff --git a/sentry-spring-boot-jakarta/build.gradle.kts b/sentry-spring-boot-jakarta/build.gradle.kts index 04166519240..36b7dad3cc6 100644 --- a/sentry-spring-boot-jakarta/build.gradle.kts +++ b/sentry-spring-boot-jakarta/build.gradle.kts @@ -40,6 +40,7 @@ dependencies { compileOnly(projects.sentryGraphql) compileOnly(projects.sentryGraphql22) compileOnly(projects.sentryQuartz) + compileOnly(libs.spring.kafka3) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springWebflux) compileOnly(libs.context.propagation) @@ -70,6 +71,7 @@ dependencies { testImplementation(projects.sentryApacheHttpClient5) testImplementation(projects.sentryGraphql) testImplementation(projects.sentryGraphql22) + testImplementation(projects.sentryKafka) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryCore) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryAgent) testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) @@ -90,6 +92,7 @@ dependencies { testImplementation(libs.springboot3.starter) testImplementation(libs.springboot3.starter.aop) testImplementation(libs.springboot3.starter.graphql) + testImplementation(libs.spring.kafka3) testImplementation(libs.springboot3.starter.quartz) testImplementation(libs.springboot3.starter.security) testImplementation(libs.springboot3.starter.test) diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java index ef57868ad87..e1f8b026274 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java @@ -31,6 +31,8 @@ import io.sentry.spring.jakarta.checkin.SentryQuartzConfiguration; import io.sentry.spring.jakarta.exception.SentryCaptureExceptionParameterPointcutConfiguration; import io.sentry.spring.jakarta.exception.SentryExceptionParameterAdviceConfiguration; +import io.sentry.spring.jakarta.kafka.SentryKafkaConsumerBeanPostProcessor; +import io.sentry.spring.jakarta.kafka.SentryKafkaProducerBeanPostProcessor; import io.sentry.spring.jakarta.opentelemetry.SentryOpenTelemetryAgentWithoutAutoInitConfiguration; import io.sentry.spring.jakarta.opentelemetry.SentryOpenTelemetryNoAgentConfiguration; import io.sentry.spring.jakarta.tracing.CombinedTransactionNameProvider; @@ -246,6 +248,34 @@ static class SentryCacheConfiguration { } } + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass( + name = { + "org.springframework.kafka.core.KafkaTemplate", + "io.sentry.kafka.SentryKafkaProducer" + }) + @ConditionalOnProperty(name = "sentry.enable-queue-tracing", havingValue = "true") + @ConditionalOnMissingClass({ + "io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider", + "io.sentry.opentelemetry.agent.AgentMarker" + }) + @Open + static class SentryKafkaQueueConfiguration { + + @Bean + public static @NotNull SentryKafkaProducerBeanPostProcessor + sentryKafkaProducerBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringKafka"); + return new SentryKafkaProducerBeanPostProcessor(); + } + + @Bean + public static @NotNull SentryKafkaConsumerBeanPostProcessor + sentryKafkaConsumerBeanPostProcessor() { + return new SentryKafkaConsumerBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryKafkaAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryKafkaAutoConfigurationTest.kt new file mode 100644 index 00000000000..392e5184759 --- /dev/null +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryKafkaAutoConfigurationTest.kt @@ -0,0 +1,125 @@ +package io.sentry.spring.boot.jakarta + +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider +import io.sentry.opentelemetry.agent.AgentMarker +import io.sentry.spring.jakarta.kafka.SentryKafkaConsumerBeanPostProcessor +import io.sentry.spring.jakarta.kafka.SentryKafkaProducerBeanPostProcessor +import kotlin.test.Test +import org.assertj.core.api.Assertions.assertThat +import org.springframework.boot.autoconfigure.AutoConfigurations +import org.springframework.boot.test.context.FilteredClassLoader +import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.kafka.core.KafkaTemplate + +class SentryKafkaAutoConfigurationTest { + + private val contextRunner = + ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(SentryAutoConfiguration::class.java)) + .withPropertyValues( + "sentry.dsn=http://key@localhost/proj", + "sentry.traces-sample-rate=1.0", + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", + "sentry.debug=false", + ) + + private val noOtelClassLoader = + FilteredClassLoader( + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noOtelCustomizerClassLoader = + FilteredClassLoader(SentryAutoConfigurationCustomizerProvider::class.java) + + private val noSentryKafkaClassLoader = + FilteredClassLoader( + SentryKafkaProducer::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noSpringKafkaClassLoader = + FilteredClassLoader( + KafkaTemplate::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + @Test + fun `registers Kafka BPPs when queue tracing is enabled`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).hasSingleBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).hasSingleBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is disabled`() { + contextRunner.withClassLoader(noOtelClassLoader).run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when sentry-kafka is not present`() { + contextRunner + .withClassLoader(noSentryKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when spring-kafka is not present`() { + contextRunner + .withClassLoader(noSpringKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is explicitly false`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=false") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry agent is present`() { + contextRunner + .withClassLoader(noOtelCustomizerClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry integration is present`() { + contextRunner.withPropertyValues("sentry.enable-queue-tracing=true").run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } +} diff --git a/sentry-spring-boot/build.gradle.kts b/sentry-spring-boot/build.gradle.kts index 43150869db5..74f5d7c87bb 100644 --- a/sentry-spring-boot/build.gradle.kts +++ b/sentry-spring-boot/build.gradle.kts @@ -38,11 +38,13 @@ dependencies { compileOnly(libs.springboot.starter.graphql) compileOnly(libs.springboot.starter.quartz) compileOnly(libs.springboot.starter.security) + compileOnly(libs.spring.kafka2) compileOnly(platform(libs.springboot2.bom)) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springWebflux) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryCore) compileOnly(projects.sentryGraphql) + compileOnly(projects.sentryKafka) compileOnly(projects.sentryQuartz) annotationProcessor(platform(libs.springboot2.bom)) @@ -57,6 +59,7 @@ dependencies { testImplementation(projects.sentryLogback) testImplementation(projects.sentryQuartz) testImplementation(projects.sentryApacheHttpClient5) + testImplementation(projects.sentryKafka) testImplementation(projects.sentryTestSupport) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(libs.kotlin.test.junit) @@ -69,6 +72,7 @@ dependencies { testImplementation(libs.springboot.starter.aop) testImplementation(libs.springboot.starter.quartz) testImplementation(libs.springboot.starter.security) + testImplementation(libs.spring.kafka2) testImplementation(libs.springboot.starter.test) testImplementation(libs.springboot.starter.web) testImplementation(libs.springboot.starter.webflux) diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java index 99fd602f74b..c7d5a892e9f 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java @@ -31,6 +31,8 @@ import io.sentry.spring.checkin.SentryQuartzConfiguration; import io.sentry.spring.exception.SentryCaptureExceptionParameterPointcutConfiguration; import io.sentry.spring.exception.SentryExceptionParameterAdviceConfiguration; +import io.sentry.spring.kafka.SentryKafkaConsumerBeanPostProcessor; +import io.sentry.spring.kafka.SentryKafkaProducerBeanPostProcessor; import io.sentry.spring.opentelemetry.SentryOpenTelemetryAgentWithoutAutoInitConfiguration; import io.sentry.spring.opentelemetry.SentryOpenTelemetryNoAgentConfiguration; import io.sentry.spring.tracing.CombinedTransactionNameProvider; @@ -231,6 +233,34 @@ static class SentryCacheConfiguration { } } + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass( + name = { + "org.springframework.kafka.core.KafkaTemplate", + "io.sentry.kafka.SentryKafkaProducer" + }) + @ConditionalOnProperty(name = "sentry.enable-queue-tracing", havingValue = "true") + @ConditionalOnMissingClass({ + "io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider", + "io.sentry.opentelemetry.agent.AgentMarker" + }) + @Open + static class SentryKafkaQueueConfiguration { + + @Bean + public static @NotNull SentryKafkaProducerBeanPostProcessor + sentryKafkaProducerBeanPostProcessor() { + SentryIntegrationPackageStorage.getInstance().addIntegration("SpringKafka"); + return new SentryKafkaProducerBeanPostProcessor(); + } + + @Bean + public static @NotNull SentryKafkaConsumerBeanPostProcessor + sentryKafkaConsumerBeanPostProcessor() { + return new SentryKafkaConsumerBeanPostProcessor(); + } + } + @Configuration(proxyBeanMethods = false) @ConditionalOnClass(ProceedingJoinPoint.class) @ConditionalOnProperty( diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryKafkaAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryKafkaAutoConfigurationTest.kt new file mode 100644 index 00000000000..fdf12bacf00 --- /dev/null +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryKafkaAutoConfigurationTest.kt @@ -0,0 +1,125 @@ +package io.sentry.spring.boot + +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider +import io.sentry.opentelemetry.agent.AgentMarker +import io.sentry.spring.kafka.SentryKafkaConsumerBeanPostProcessor +import io.sentry.spring.kafka.SentryKafkaProducerBeanPostProcessor +import kotlin.test.Test +import org.assertj.core.api.Assertions.assertThat +import org.springframework.boot.autoconfigure.AutoConfigurations +import org.springframework.boot.test.context.FilteredClassLoader +import org.springframework.boot.test.context.runner.ApplicationContextRunner +import org.springframework.kafka.core.KafkaTemplate + +class SentryKafkaAutoConfigurationTest { + + private val contextRunner = + ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(SentryAutoConfiguration::class.java)) + .withPropertyValues( + "sentry.dsn=http://key@localhost/proj", + "sentry.traces-sample-rate=1.0", + "sentry.shutdownTimeoutMillis=0", + "sentry.sessionFlushTimeoutMillis=0", + "sentry.flushTimeoutMillis=0", + "sentry.readTimeoutMillis=50", + "sentry.connectionTimeoutMillis=50", + "sentry.send-modules=false", + "sentry.debug=false", + ) + + private val noOtelClassLoader = + FilteredClassLoader( + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noOtelCustomizerClassLoader = + FilteredClassLoader(SentryAutoConfigurationCustomizerProvider::class.java) + + private val noSentryKafkaClassLoader = + FilteredClassLoader( + SentryKafkaProducer::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + private val noSpringKafkaClassLoader = + FilteredClassLoader( + KafkaTemplate::class.java, + SentryAutoConfigurationCustomizerProvider::class.java, + AgentMarker::class.java, + ) + + @Test + fun `registers Kafka BPPs when queue tracing is enabled`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).hasSingleBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).hasSingleBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is disabled`() { + contextRunner.withClassLoader(noOtelClassLoader).run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when sentry-kafka is not present`() { + contextRunner + .withClassLoader(noSentryKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when spring-kafka is not present`() { + contextRunner + .withClassLoader(noSpringKafkaClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when queue tracing is explicitly false`() { + contextRunner + .withClassLoader(noOtelClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=false") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry agent is present`() { + contextRunner + .withClassLoader(noOtelCustomizerClassLoader) + .withPropertyValues("sentry.enable-queue-tracing=true") + .run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } + + @Test + fun `does not register Kafka BPPs when OpenTelemetry integration is present`() { + contextRunner.withPropertyValues("sentry.enable-queue-tracing=true").run { context -> + assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) + assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) + } + } +} diff --git a/sentry-spring-jakarta/api/sentry-spring-jakarta.api b/sentry-spring-jakarta/api/sentry-spring-jakarta.api index fe634da6f4c..24b9af7e14b 100644 --- a/sentry-spring-jakarta/api/sentry-spring-jakarta.api +++ b/sentry-spring-jakarta/api/sentry-spring-jakarta.api @@ -244,6 +244,29 @@ public final class io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHand public fun onSubscriptionResult (Ljava/lang/Object;Lio/sentry/IScopes;Lio/sentry/graphql/ExceptionReporter;Lgraphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters;)Ljava/lang/Object; } +public final class io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor : org/springframework/kafka/listener/RecordInterceptor { + public fun (Lio/sentry/IScopes;)V + public fun (Lio/sentry/IScopes;Lorg/springframework/kafka/listener/RecordInterceptor;)V + public fun afterRecord (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun clearThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun failure (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Ljava/lang/Exception;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun intercept (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)Lorg/apache/kafka/clients/consumer/ConsumerRecord; + public fun setupThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun success (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V +} + public class io/sentry/spring/jakarta/opentelemetry/SentryOpenTelemetryAgentWithoutAutoInitConfiguration { public fun ()V public fun sentryOpenTelemetryOptionsConfiguration ()Lio/sentry/Sentry$OptionsConfiguration; diff --git a/sentry-spring-jakarta/build.gradle.kts b/sentry-spring-jakarta/build.gradle.kts index f1920e24510..cbf2e5346b5 100644 --- a/sentry-spring-jakarta/build.gradle.kts +++ b/sentry-spring-jakarta/build.gradle.kts @@ -29,6 +29,7 @@ tasks.withType().configureEach { dependencies { api(projects.sentry) + compileOnly(projects.sentryKafka) compileOnly(platform(SpringBootPlugin.BOM_COORDINATES)) compileOnly(Config.Libs.springWeb) compileOnly(Config.Libs.springAop) @@ -41,6 +42,7 @@ dependencies { compileOnly(libs.servlet.jakarta.api) compileOnly(libs.slf4j.api) compileOnly(libs.springboot3.starter.graphql) + compileOnly(libs.spring.kafka3) compileOnly(libs.springboot3.starter.quartz) compileOnly(Config.Libs.springWebflux) @@ -58,6 +60,7 @@ dependencies { // tests testImplementation(projects.sentryTestSupport) testImplementation(projects.sentryGraphql) + testImplementation(projects.sentryKafka) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(libs.awaitility.kotlin) testImplementation(libs.context.propagation) @@ -68,6 +71,7 @@ dependencies { testImplementation(libs.springboot3.starter.aop) testImplementation(libs.springboot3.starter.graphql) testImplementation(libs.springboot3.starter.security) + testImplementation(libs.spring.kafka3) testImplementation(libs.springboot3.starter.test) testImplementation(libs.springboot3.starter.web) testImplementation(libs.springboot3.starter.webflux) diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessor.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessor.java new file mode 100644 index 00000000000..e4676b79cfd --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessor.java @@ -0,0 +1,98 @@ +package io.sentry.spring.jakarta.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import java.lang.reflect.Field; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.config.AbstractKafkaListenerContainerFactory; +import org.springframework.kafka.listener.RecordInterceptor; + +/** + * Registers {@link SentryKafkaRecordInterceptor} on {@link AbstractKafkaListenerContainerFactory} + * beans. If an existing {@link RecordInterceptor} is already set, it is composed as a delegate. + */ +@ApiStatus.Internal +public final class SentryKafkaConsumerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + private static final @NotNull String RECORD_INTERCEPTOR_FIELD_NAME = "recordInterceptor"; + + private final @NotNull String recordInterceptorFieldName; + + public SentryKafkaConsumerBeanPostProcessor() { + this(RECORD_INTERCEPTOR_FIELD_NAME); + } + + SentryKafkaConsumerBeanPostProcessor(final @NotNull String recordInterceptorFieldName) { + this.recordInterceptorFieldName = recordInterceptorFieldName; + } + + private static final class InterceptorReadFailedException extends Exception { + private static final long serialVersionUID = 1L; + + InterceptorReadFailedException(final @NotNull Throwable cause) { + super(cause); + } + } + + @Override + @SuppressWarnings("unchecked") + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof AbstractKafkaListenerContainerFactory) { + final @NotNull AbstractKafkaListenerContainerFactory factory = + (AbstractKafkaListenerContainerFactory) bean; + + final @Nullable RecordInterceptor existing; + try { + existing = getExistingInterceptor(factory); + } catch (InterceptorReadFailedException e) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.ERROR, + e, + "Sentry Kafka consumer tracing disabled for factory '%s' \u2014 could not read " + + "existing recordInterceptor via reflection. Refusing to install Sentry's " + + "interceptor to avoid overwriting a customer-configured RecordInterceptor.", + beanName); + return bean; + } + + if (existing instanceof SentryKafkaRecordInterceptor) { + return bean; + } + + @SuppressWarnings("rawtypes") + final RecordInterceptor sentryInterceptor = + new SentryKafkaRecordInterceptor<>(ScopesAdapter.getInstance(), existing); + factory.setRecordInterceptor(sentryInterceptor); + } + return bean; + } + + private @Nullable RecordInterceptor getExistingInterceptor( + final @NotNull AbstractKafkaListenerContainerFactory factory) + throws InterceptorReadFailedException { + try { + final @NotNull Field field = + AbstractKafkaListenerContainerFactory.class.getDeclaredField(recordInterceptorFieldName); + field.setAccessible(true); + return (RecordInterceptor) field.get(factory); + } catch (NoSuchFieldException | IllegalAccessException | RuntimeException e) { + throw new InterceptorReadFailedException(e); + } + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessor.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessor.java new file mode 100644 index 00000000000..8a06e4e338e --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessor.java @@ -0,0 +1,76 @@ +package io.sentry.spring.jakarta.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.kafka.SentryKafkaProducer; +import org.apache.kafka.clients.producer.Producer; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.core.ProducerFactory; +import org.springframework.kafka.core.ProducerPostProcessor; + +/** + * Installs a {@link ProducerPostProcessor} on every {@link ProducerFactory} bean so that each + * {@link Producer} created by Spring Kafka is wrapped via {@link SentryKafkaProducer#wrap + * SentryKafkaProducer.wrap(Producer)}. + * + *

The wrapper records a {@code queue.publish} span around each {@code send(...)} that finishes + * when the broker ack callback fires, giving a real producer-send lifecycle span. {@code + * KafkaTemplate} beans are left untouched, so all customer-configured listeners, interceptors and + * observation settings are preserved. + * + *

Note: {@link ProducerFactory#addPostProcessor(ProducerPostProcessor)} is a default method on + * the interface that is a no-op unless overridden. Custom factories that do not extend {@code + * DefaultKafkaProducerFactory} will not receive Sentry producer instrumentation; a warning is + * logged at startup in that case. + */ +@ApiStatus.Internal +public final class SentryKafkaProducerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + @Override + @SuppressWarnings({"unchecked", "rawtypes"}) + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof ProducerFactory) { + final @NotNull ProducerFactory factory = (ProducerFactory) bean; + final @NotNull SentryProducerPostProcessor pp = new SentryProducerPostProcessor<>(); + factory.addPostProcessor(pp); + if (!factory.getPostProcessors().contains(pp)) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Sentry Kafka producer tracing not active for ProducerFactory '%s' (%s). " + + "addPostProcessor() was not honored — the factory may not extend " + + "DefaultKafkaProducerFactory. Wrap producers manually with " + + "SentryKafkaProducer.wrap(producer).", + beanName, + factory.getClass().getName()); + } + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } + + /** + * Marker {@link ProducerPostProcessor} that wraps the freshly created Kafka {@link Producer} via + * {@link SentryKafkaProducer#wrap}. + */ + static final class SentryProducerPostProcessor implements ProducerPostProcessor { + @Override + public @NotNull Producer apply(final @NotNull Producer producer) { + return SentryKafkaProducer.wrap( + producer, ScopesAdapter.getInstance(), "auto.queue.spring_jakarta.kafka.producer"); + } + } +} diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor.java new file mode 100644 index 00000000000..72535712695 --- /dev/null +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptor.java @@ -0,0 +1,292 @@ +package io.sentry.spring.jakarta.kafka; + +import io.sentry.BaggageHeader; +import io.sentry.DateUtils; +import io.sentry.IScopes; +import io.sentry.ISentryLifecycleToken; +import io.sentry.ITransaction; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.SpanDataConvention; +import io.sentry.SpanStatus; +import io.sentry.TransactionContext; +import io.sentry.TransactionOptions; +import io.sentry.kafka.SentryKafkaProducer; +import io.sentry.util.SpanUtils; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import org.apache.kafka.clients.consumer.Consumer; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.header.Header; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.kafka.listener.RecordInterceptor; +import org.springframework.kafka.support.KafkaHeaders; + +/** + * A {@link RecordInterceptor} that creates {@code queue.process} transactions for incoming Kafka + * records with distributed tracing support. + */ +@ApiStatus.Internal +public final class SentryKafkaRecordInterceptor implements RecordInterceptor { + + static final String TRACE_ORIGIN = "auto.queue.spring_jakarta.kafka.consumer"; + + private final @NotNull IScopes scopes; + private final @Nullable RecordInterceptor delegate; + + private static final @NotNull ThreadLocal currentContext = + new ThreadLocal<>(); + + public SentryKafkaRecordInterceptor(final @NotNull IScopes scopes) { + this(scopes, null); + } + + public SentryKafkaRecordInterceptor( + final @NotNull IScopes scopes, final @Nullable RecordInterceptor delegate) { + this.scopes = scopes; + this.delegate = delegate; + } + + @Override + public @Nullable ConsumerRecord intercept( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (!scopes.getOptions().isEnableQueueTracing() || isIgnored()) { + return delegateIntercept(record, consumer); + } + + try { + finishStaleContext(); + + final @NotNull IScopes forkedScopes = scopes.forkedRootScopes("SentryKafkaRecordInterceptor"); + final @NotNull ISentryLifecycleToken lifecycleToken = forkedScopes.makeCurrent(); + currentContext.set(new SentryRecordContext(lifecycleToken, null)); + + final @Nullable TransactionContext transactionContext = continueTrace(forkedScopes, record); + + final @Nullable ITransaction transaction = + startTransaction(forkedScopes, record, transactionContext); + currentContext.set(new SentryRecordContext(lifecycleToken, transaction)); + } catch (Throwable t) { + scopes.getOptions().getLogger().log(SentryLevel.ERROR, "Unable to wrap Kafka consumer.", t); + } + return delegateIntercept(record, consumer); + } + + @Override + public void success( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.success(record, consumer); + } + } finally { + finishSpan(SpanStatus.OK, null); + } + } + + @Override + public void failure( + final @NotNull ConsumerRecord record, + final @NotNull Exception exception, + final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.failure(record, exception, consumer); + } + } finally { + finishSpan(SpanStatus.INTERNAL_ERROR, exception); + } + } + + @Override + public void afterRecord( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.afterRecord(record, consumer); + } + } + + @Override + public void setupThreadState(final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.setupThreadState(consumer); + } + } + + @Override + public void clearThreadState(final @NotNull Consumer consumer) { + try { + finishStaleContext(); + } finally { + if (delegate != null) { + delegate.clearThreadState(consumer); + } + } + } + + private boolean isIgnored() { + return SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), TRACE_ORIGIN); + } + + private @Nullable ConsumerRecord delegateIntercept( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (delegate != null) { + return delegate.intercept(record, consumer); + } + return record; + } + + private @Nullable TransactionContext continueTrace( + final @NotNull IScopes forkedScopes, final @NotNull ConsumerRecord record) { + final @Nullable String sentryTrace = headerValue(record, SentryTraceHeader.SENTRY_TRACE_HEADER); + final @Nullable List baggageHeaders = + headerValues(record, BaggageHeader.BAGGAGE_HEADER); + return forkedScopes.continueTrace(sentryTrace, baggageHeaders); + } + + private @Nullable ITransaction startTransaction( + final @NotNull IScopes forkedScopes, + final @NotNull ConsumerRecord record, + final @Nullable TransactionContext transactionContext) { + if (!forkedScopes.getOptions().isTracingEnabled()) { + return null; + } + + final @NotNull TransactionContext txContext = + transactionContext != null + ? transactionContext + : new TransactionContext(record.topic(), "queue.process"); + txContext.setName(record.topic()); + txContext.setOperation("queue.process"); + + final @NotNull TransactionOptions txOptions = new TransactionOptions(); + txOptions.setOrigin(TRACE_ORIGIN); + txOptions.setBindToScope(true); + + final @NotNull ITransaction transaction = forkedScopes.startTransaction(txContext, txOptions); + + if (transaction.isNoOp()) { + return null; + } + + transaction.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka"); + transaction.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic()); + + final @Nullable String messageId = headerValue(record, "messaging.message.id"); + if (messageId != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_ID, messageId); + } + + final int bodySize = record.serializedValueSize(); + if (bodySize >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE, bodySize); + } + + final @Nullable Integer retryCount = retryCount(record); + if (retryCount != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT, retryCount); + } + + final @Nullable String enqueuedTimeStr = + headerValue(record, SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER); + if (enqueuedTimeStr != null) { + try { + final double enqueuedTimeSeconds = Double.parseDouble(enqueuedTimeStr); + final double nowSeconds = DateUtils.millisToSeconds(System.currentTimeMillis()); + final long latencyMs = (long) ((nowSeconds - enqueuedTimeSeconds) * 1000); + if (latencyMs >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY, latencyMs); + } + } catch (NumberFormatException ignored) { + // ignore malformed header + } + } + + return transaction; + } + + private @Nullable Integer retryCount(final @NotNull ConsumerRecord record) { + final @Nullable Header header = record.headers().lastHeader(KafkaHeaders.DELIVERY_ATTEMPT); + if (header == null) { + return null; + } + + final byte[] value = header.value(); + if (value == null || value.length != Integer.BYTES) { + return null; + } + + final int attempt = ByteBuffer.wrap(value).getInt(); + if (attempt <= 0) { + return null; + } + + return attempt - 1; + } + + private void finishStaleContext() { + if (currentContext.get() != null) { + finishSpan(SpanStatus.UNKNOWN, null); + } + } + + private void finishSpan(final @NotNull SpanStatus status, final @Nullable Throwable throwable) { + final @Nullable SentryRecordContext ctx = currentContext.get(); + if (ctx == null) { + return; + } + currentContext.remove(); + + try { + final @Nullable ITransaction transaction = ctx.transaction; + if (transaction != null) { + transaction.setStatus(status); + if (throwable != null) { + transaction.setThrowable(throwable); + } + transaction.finish(); + } + } finally { + ctx.lifecycleToken.close(); + } + } + + private @Nullable String headerValue( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + final @Nullable Header header = record.headers().lastHeader(headerName); + if (header == null || header.value() == null) { + return null; + } + return new String(header.value(), StandardCharsets.UTF_8); + } + + private @Nullable List headerValues( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + @Nullable List values = null; + for (final @NotNull Header header : record.headers().headers(headerName)) { + if (header.value() != null) { + if (values == null) { + values = new ArrayList<>(); + } + values.add(new String(header.value(), StandardCharsets.UTF_8)); + } + } + return values; + } + + private static final class SentryRecordContext { + final @NotNull ISentryLifecycleToken lifecycleToken; + final @Nullable ITransaction transaction; + + SentryRecordContext( + final @NotNull ISentryLifecycleToken lifecycleToken, + final @Nullable ITransaction transaction) { + this.lifecycleToken = lifecycleToken; + this.transaction = transaction; + } + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..3d52378e35a --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt @@ -0,0 +1,124 @@ +package io.sentry.spring.jakarta.kafka + +import io.sentry.Sentry +import io.sentry.test.initForTest +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory +import org.springframework.kafka.core.ConsumerFactory +import org.springframework.kafka.listener.RecordInterceptor + +class SentryKafkaConsumerBeanPostProcessorTest { + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + @Test + fun `wraps ConcurrentKafkaListenerContainerFactory with SentryKafkaRecordInterceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + // Verify via reflection that the interceptor was set + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val interceptor = field.get(factory) + assertTrue(interceptor is SentryKafkaRecordInterceptor<*, *>) + } + + @Test + fun `does not double-wrap when SentryKafkaRecordInterceptor already set`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val processor = SentryKafkaConsumerBeanPostProcessor() + // First wrap + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val firstInterceptor = field.get(factory) + + // Second wrap — should be idempotent + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + val secondInterceptor = field.get(factory) + + assertSame(firstInterceptor, secondInterceptor) + } + + @Test + fun `does not wrap non-factory beans`() { + val someBean = "not a factory" + val processor = SentryKafkaConsumerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `chains existing customer RecordInterceptor as delegate`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val customerInterceptor = RecordInterceptor { record, _ -> record } + factory.setRecordInterceptor(customerInterceptor) + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val installed = field.get(factory) + assertTrue( + installed is SentryKafkaRecordInterceptor<*, *>, + "expected SentryKafkaRecordInterceptor, got ${installed?.javaClass}", + ) + + val delegateField = SentryKafkaRecordInterceptor::class.java.getDeclaredField("delegate") + delegateField.isAccessible = true + assertSame( + customerInterceptor, + delegateField.get(installed), + "customer interceptor must be preserved as delegate", + ) + } + + @Test + fun `skips installation when reflection fails and preserves customer interceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + val customerInterceptor = RecordInterceptor { record, _ -> record } + factory.setRecordInterceptor(customerInterceptor) + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + assertSame(customerInterceptor, field.get(factory)) + + val processor = SentryKafkaConsumerBeanPostProcessor("missingRecordInterceptor") + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + assertSame( + customerInterceptor, + field.get(factory), + "customer interceptor must remain installed when Sentry cannot read it", + ) + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..b3a1a268682 --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -0,0 +1,109 @@ +package io.sentry.spring.jakarta.kafka + +import io.sentry.Sentry +import io.sentry.test.initForTest +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.apache.kafka.clients.producer.Producer +import org.mockito.kotlin.any +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.core.DefaultKafkaProducerFactory +import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.core.ProducerPostProcessor + +class SentryKafkaProducerBeanPostProcessorTest { + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + @Test + fun `registers Sentry post-processor on ProducerFactory`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + val captor = argumentCaptor>() + verify(factory).addPostProcessor(captor.capture()) + assertTrue( + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } + + @Test + fun `does not throw when addPostProcessor is a no-op (default interface method)`() { + // Factory using the default no-op addPostProcessor / getPostProcessors + val factory = mock>() + whenever(factory.postProcessors).thenReturn(emptyList()) + val processor = SentryKafkaProducerBeanPostProcessor() + + // Should complete without throwing, and log a warning via ScopesAdapter + processor.postProcessAfterInitialization(factory, "myFactory") + + verify(factory).addPostProcessor(any()) + } + + @Test + fun `does not modify non-ProducerFactory beans`() { + val someBean = "not a producer factory" + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `returns the same bean instance`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertSame(factory, result, "BPP must return the same bean, not a replacement") + } + + @Test + fun `registered post-processor wraps producers via SentryKafkaProducer wrap`() { + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + val raw = mock>() + + val wrapped = pp.apply(raw) + + assertTrue(java.lang.reflect.Proxy.isProxyClass(wrapped.javaClass)) + } + + @Test + fun `integrates with DefaultKafkaProducerFactory addPostProcessor contract`() { + // Sanity check against the real Spring Kafka API surface — DefaultKafkaProducerFactory + // honors addPostProcessor and exposes it via getPostProcessors(). + val factory = DefaultKafkaProducerFactory(emptyMap()) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertEquals(1, factory.postProcessors.size) + assertTrue( + factory.postProcessors.first() + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } +} diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptorTest.kt new file mode 100644 index 00000000000..b09d4f5e147 --- /dev/null +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptorTest.kt @@ -0,0 +1,476 @@ +package io.sentry.spring.jakarta.kafka + +import io.sentry.BaggageHeader +import io.sentry.IScopes +import io.sentry.ISentryLifecycleToken +import io.sentry.Sentry +import io.sentry.SentryOptions +import io.sentry.SentryTraceHeader +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.TransactionContext +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.test.initForTest +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.util.Optional +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.apache.kafka.clients.consumer.Consumer +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.header.internals.RecordHeaders +import org.apache.kafka.common.record.TimestampType +import org.mockito.kotlin.any +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.listener.RecordInterceptor +import org.springframework.kafka.support.KafkaHeaders + +class SentryKafkaRecordInterceptorTest { + + private lateinit var scopes: IScopes + private lateinit var forkedScopes: IScopes + private lateinit var options: SentryOptions + private lateinit var consumer: Consumer + private lateinit var lifecycleToken: ISentryLifecycleToken + private lateinit var transaction: SentryTracer + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + scopes = mock() + consumer = mock() + lifecycleToken = mock() + options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + isEnableQueueTracing = true + tracesSampleRate = 1.0 + } + whenever(scopes.options).thenReturn(options) + whenever(scopes.isEnabled).thenReturn(true) + + forkedScopes = mock() + whenever(scopes.forkedRootScopes(any())).thenReturn(forkedScopes) + whenever(forkedScopes.options).thenReturn(options) + whenever(forkedScopes.makeCurrent()).thenReturn(lifecycleToken) + + transaction = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes) + whenever(forkedScopes.startTransaction(any(), any())) + .thenReturn(transaction) + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + private fun createRecord( + topic: String = "my-topic", + headers: RecordHeaders = RecordHeaders(), + serializedValueSize: Int = -1, + ): ConsumerRecord { + return ConsumerRecord( + topic, + 0, + 0L, + System.currentTimeMillis(), + TimestampType.CREATE_TIME, + 3, + serializedValueSize, + "key", + "value", + headers, + Optional.empty(), + ) + } + + private fun createRecordWithHeaders( + sentryTrace: String? = null, + baggage: String? = null, + baggageHeaders: List? = null, + enqueuedTime: String? = null, + deliveryAttempt: Int? = null, + ): ConsumerRecord { + val headers = RecordHeaders() + sentryTrace?.let { + headers.add(SentryTraceHeader.SENTRY_TRACE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggage?.let { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggageHeaders?.forEach { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + enqueuedTime?.let { + headers.add( + SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER, + it.toByteArray(StandardCharsets.UTF_8), + ) + } + deliveryAttempt?.let { + headers.add( + KafkaHeaders.DELIVERY_ATTEMPT, + ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array(), + ) + } + val record = ConsumerRecord("my-topic", 0, 0L, "key", "value") + headers.forEach { record.headers().add(it) } + return record + } + + @Test + fun `intercept forks root scopes`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(scopes).forkedRootScopes("SentryKafkaRecordInterceptor") + verify(forkedScopes).makeCurrent() + verify(forkedScopes) + .startTransaction( + org.mockito.kotlin.check { + assertEquals("my-topic", it.name) + assertEquals("queue.process", it.operation) + }, + any(), + ) + } + + @Test + fun `intercept continues trace from headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = createRecordWithHeaders(sentryTrace = sentryTraceValue) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace(org.mockito.kotlin.eq(sentryTraceValue), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept calls continueTrace with null when no headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(forkedScopes).continueTrace(org.mockito.kotlin.isNull(), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept passes all baggage headers to continueTrace`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = + createRecordWithHeaders( + sentryTrace = sentryTraceValue, + baggageHeaders = listOf("third=party", "sentry-sample_rate=1"), + ) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace( + org.mockito.kotlin.eq(sentryTraceValue), + org.mockito.kotlin.eq(listOf("third=party", "sentry-sample_rate=1")), + ) + } + + @Test + fun `sets body size from serializedValueSize`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = 42) + + interceptor.intercept(record, consumer) + + assertEquals(42, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `does not set body size when serializedValueSize is negative`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = -1) + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `sets retry count from delivery attempt header`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecordWithHeaders(deliveryAttempt = 3) + + interceptor.intercept(record, consumer) + + assertEquals(2, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `does not set retry count when delivery attempt header is missing`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `sets receive latency from enqueued time in epoch seconds`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val enqueuedTime = (System.currentTimeMillis() / 1000.0 - 1.0).toString() + val record = createRecordWithHeaders(enqueuedTime = enqueuedTime) + + interceptor.intercept(record, consumer) + + val latency = transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY) + assertTrue(latency is Long && latency >= 0) + } + + @Test + fun `does not create span when queue tracing is disabled`() { + options.isEnableQueueTracing = false + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `does not create span when origin is ignored`() { + options.setIgnoredSpanOrigins(listOf(SentryKafkaRecordInterceptor.TRACE_ORIGIN)) + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `delegates to existing interceptor`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + interceptor.intercept(record, consumer) + + verify(delegate).intercept(record, consumer) + } + + @Test + fun `success finishes transaction and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + + verify(delegate).success(record, consumer) + } + + @Test + fun `failure finishes transaction with error and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + val exception = RuntimeException("processing failed") + + interceptor.intercept(record, consumer) + interceptor.failure(record, exception, consumer) + + verify(delegate).failure(record, exception, consumer) + } + + @Test + fun `afterRecord delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.afterRecord(record, consumer) + + verify(delegate).afterRecord(record, consumer) + } + + @Test + fun `trace origin is set correctly`() { + assertEquals( + "auto.queue.spring_jakarta.kafka.consumer", + SentryKafkaRecordInterceptor.TRACE_ORIGIN, + ) + } + + @Test + fun `clearThreadState cleans up stale context`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken).close() + } + + @Test + fun `clearThreadState is no-op when no context exists`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.clearThreadState(consumer) + } + + @Test + fun `setupThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + + verify(delegate).setupThreadState(consumer) + } + + @Test + fun `setupThreadState is no-op without delegate`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.setupThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.clearThreadState(consumer) + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor even when sentry cleanup throws`() { + val delegate = mock>() + whenever(lifecycleToken.close()).thenThrow(RuntimeException("boom")) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + + try { + interceptor.clearThreadState(consumer) + } catch (ignored: RuntimeException) { + // expected + } + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `full lifecycle intercept success clearThreadState closes token exactly once`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + interceptor.clearThreadState(consumer) + + // token closed once by success(); clearThreadState must not re-close it + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + // delegate hooks still delegated across the full lifecycle + verify(delegate).setupThreadState(consumer) + verify(delegate).success(record, consumer) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept returns null clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + // delegate filters the record — per Spring Kafka contract, success/failure will not be invoked + whenever(delegate.intercept(record, consumer)).thenReturn(null) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val result = interceptor.intercept(record, consumer) + interceptor.clearThreadState(consumer) + + assertNull(result) + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept throws clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + val boom = RuntimeException("delegate boom") + whenever(delegate.intercept(record, consumer)).thenThrow(boom) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val thrown = assertFailsWith { interceptor.intercept(record, consumer) } + assertEquals(boom, thrown) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `intercept cleans up stale context from previous record`() { + val lifecycleToken2 = mock() + val forkedScopes2 = mock() + whenever(forkedScopes2.options).thenReturn(options) + whenever(forkedScopes2.makeCurrent()).thenReturn(lifecycleToken2) + val tx2 = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes2) + whenever(forkedScopes2.startTransaction(any(), any())).thenReturn(tx2) + + var callCount = 0 + + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + whenever(scopes.forkedRootScopes(any())).thenAnswer { + callCount++ + if (callCount == 1) forkedScopes else forkedScopes2 + } + + // First intercept sets up context + interceptor.intercept(record, consumer) + + // Second intercept without success/failure — should clean up stale context first + interceptor.intercept(record, consumer) + + // First lifecycle token should have been closed by the defensive cleanup + verify(lifecycleToken).close() + } +} diff --git a/sentry-spring/api/sentry-spring.api b/sentry-spring/api/sentry-spring.api index 7148277e2ef..4e1bea84288 100644 --- a/sentry-spring/api/sentry-spring.api +++ b/sentry-spring/api/sentry-spring.api @@ -234,6 +234,30 @@ public final class io/sentry/spring/graphql/SentrySpringSubscriptionHandler : io public fun onSubscriptionResult (Ljava/lang/Object;Lio/sentry/IScopes;Lio/sentry/graphql/ExceptionReporter;Lgraphql/execution/instrumentation/parameters/InstrumentationFieldFetchParameters;)Ljava/lang/Object; } +public final class io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessor : org/springframework/beans/factory/config/BeanPostProcessor, org/springframework/core/PriorityOrdered { + public fun ()V + public fun getOrder ()I + public fun postProcessAfterInitialization (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; +} + +public final class io/sentry/spring/kafka/SentryKafkaRecordInterceptor : org/springframework/kafka/listener/RecordInterceptor { + public fun (Lio/sentry/IScopes;)V + public fun (Lio/sentry/IScopes;Lorg/springframework/kafka/listener/RecordInterceptor;)V + public fun afterRecord (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun clearThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun failure (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Ljava/lang/Exception;Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun intercept (Lorg/apache/kafka/clients/consumer/ConsumerRecord;)Lorg/apache/kafka/clients/consumer/ConsumerRecord; + public fun intercept (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)Lorg/apache/kafka/clients/consumer/ConsumerRecord; + public fun setupThreadState (Lorg/apache/kafka/clients/consumer/Consumer;)V + public fun success (Lorg/apache/kafka/clients/consumer/ConsumerRecord;Lorg/apache/kafka/clients/consumer/Consumer;)V +} + public class io/sentry/spring/opentelemetry/SentryOpenTelemetryAgentWithoutAutoInitConfiguration { public fun ()V public fun sentryOpenTelemetryOptionsConfiguration ()Lio/sentry/Sentry$OptionsConfiguration; diff --git a/sentry-spring/build.gradle.kts b/sentry-spring/build.gradle.kts index b651a9e62b2..c4c75cb5f07 100644 --- a/sentry-spring/build.gradle.kts +++ b/sentry-spring/build.gradle.kts @@ -27,6 +27,7 @@ dependencies { compileOnly(Config.Libs.aspectj) compileOnly(Config.Libs.springWebflux) compileOnly(projects.sentryGraphql) + compileOnly(projects.sentryKafka) compileOnly(projects.sentryQuartz) compileOnly(libs.jetbrains.annotations) compileOnly(libs.nopen.annotations) @@ -35,6 +36,7 @@ dependencies { compileOnly(libs.slf4j.api) compileOnly(libs.springboot.starter.graphql) compileOnly(libs.springboot.starter.quartz) + compileOnly(libs.spring.kafka2) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap) @@ -45,6 +47,7 @@ dependencies { // tests testImplementation(projects.sentryTestSupport) testImplementation(projects.sentryGraphql) + testImplementation(projects.sentryKafka) testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(libs.awaitility.kotlin) testImplementation(libs.graphql.java17) @@ -54,6 +57,7 @@ dependencies { testImplementation(libs.springboot.starter.aop) testImplementation(libs.springboot.starter.graphql) testImplementation(libs.springboot.starter.security) + testImplementation(libs.spring.kafka2) testImplementation(libs.springboot.starter.test) testImplementation(libs.springboot.starter.web) testImplementation(libs.springboot.starter.webflux) diff --git a/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessor.java b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessor.java new file mode 100644 index 00000000000..7a3ba1caa27 --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessor.java @@ -0,0 +1,98 @@ +package io.sentry.spring.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import java.lang.reflect.Field; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.config.AbstractKafkaListenerContainerFactory; +import org.springframework.kafka.listener.RecordInterceptor; + +/** + * Registers {@link SentryKafkaRecordInterceptor} on {@link AbstractKafkaListenerContainerFactory} + * beans. If an existing {@link RecordInterceptor} is already set, it is composed as a delegate. + */ +@ApiStatus.Internal +public final class SentryKafkaConsumerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + private static final @NotNull String RECORD_INTERCEPTOR_FIELD_NAME = "recordInterceptor"; + + private final @NotNull String recordInterceptorFieldName; + + public SentryKafkaConsumerBeanPostProcessor() { + this(RECORD_INTERCEPTOR_FIELD_NAME); + } + + SentryKafkaConsumerBeanPostProcessor(final @NotNull String recordInterceptorFieldName) { + this.recordInterceptorFieldName = recordInterceptorFieldName; + } + + private static final class InterceptorReadFailedException extends Exception { + private static final long serialVersionUID = 1L; + + InterceptorReadFailedException(final @NotNull Throwable cause) { + super(cause); + } + } + + @Override + @SuppressWarnings("unchecked") + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof AbstractKafkaListenerContainerFactory) { + final @NotNull AbstractKafkaListenerContainerFactory factory = + (AbstractKafkaListenerContainerFactory) bean; + + final @Nullable RecordInterceptor existing; + try { + existing = getExistingInterceptor(factory); + } catch (InterceptorReadFailedException e) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.ERROR, + e, + "Sentry Kafka consumer tracing disabled for factory '%s' \u2014 could not read " + + "existing recordInterceptor via reflection. Refusing to install Sentry's " + + "interceptor to avoid overwriting a customer-configured RecordInterceptor.", + beanName); + return bean; + } + + if (existing instanceof SentryKafkaRecordInterceptor) { + return bean; + } + + @SuppressWarnings("rawtypes") + final RecordInterceptor sentryInterceptor = + new SentryKafkaRecordInterceptor<>(ScopesAdapter.getInstance(), existing); + factory.setRecordInterceptor(sentryInterceptor); + } + return bean; + } + + private @Nullable RecordInterceptor getExistingInterceptor( + final @NotNull AbstractKafkaListenerContainerFactory factory) + throws InterceptorReadFailedException { + try { + final @NotNull Field field = + AbstractKafkaListenerContainerFactory.class.getDeclaredField(recordInterceptorFieldName); + field.setAccessible(true); + return (RecordInterceptor) field.get(factory); + } catch (NoSuchFieldException | IllegalAccessException | RuntimeException e) { + throw new InterceptorReadFailedException(e); + } + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessor.java b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessor.java new file mode 100644 index 00000000000..7b3266a3510 --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessor.java @@ -0,0 +1,76 @@ +package io.sentry.spring.kafka; + +import io.sentry.ScopesAdapter; +import io.sentry.SentryLevel; +import io.sentry.kafka.SentryKafkaProducer; +import org.apache.kafka.clients.producer.Producer; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.PriorityOrdered; +import org.springframework.kafka.core.ProducerFactory; +import org.springframework.kafka.core.ProducerPostProcessor; + +/** + * Installs a {@link ProducerPostProcessor} on every {@link ProducerFactory} bean so that each + * {@link Producer} created by Spring Kafka is wrapped via {@link SentryKafkaProducer#wrap + * SentryKafkaProducer.wrap(Producer)}. + * + *

The wrapper records a {@code queue.publish} span around each {@code send(...)} that finishes + * when the broker ack callback fires, giving a real producer-send lifecycle span. {@code + * KafkaTemplate} beans are left untouched, so all customer-configured listeners, interceptors and + * observation settings are preserved. + * + *

Note: {@link ProducerFactory#addPostProcessor(ProducerPostProcessor)} is a default method on + * the interface that is a no-op unless overridden. Custom factories that do not extend {@code + * DefaultKafkaProducerFactory} will not receive Sentry producer instrumentation; a warning is + * logged at startup in that case. + */ +@ApiStatus.Internal +public final class SentryKafkaProducerBeanPostProcessor + implements BeanPostProcessor, PriorityOrdered { + + @Override + @SuppressWarnings({"unchecked", "rawtypes"}) + public @NotNull Object postProcessAfterInitialization( + final @NotNull Object bean, final @NotNull String beanName) throws BeansException { + if (bean instanceof ProducerFactory) { + final @NotNull ProducerFactory factory = (ProducerFactory) bean; + final @NotNull SentryProducerPostProcessor pp = new SentryProducerPostProcessor<>(); + factory.addPostProcessor(pp); + if (!factory.getPostProcessors().contains(pp)) { + ScopesAdapter.getInstance() + .getOptions() + .getLogger() + .log( + SentryLevel.WARNING, + "Sentry Kafka producer tracing not active for ProducerFactory '%s' (%s). " + + "addPostProcessor() was not honored — the factory may not extend " + + "DefaultKafkaProducerFactory. Wrap producers manually with " + + "SentryKafkaProducer.wrap(producer).", + beanName, + factory.getClass().getName()); + } + } + return bean; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE; + } + + /** + * Marker {@link ProducerPostProcessor} that wraps the freshly created Kafka {@link Producer} via + * {@link SentryKafkaProducer#wrap}. + */ + static final class SentryProducerPostProcessor implements ProducerPostProcessor { + @Override + public @NotNull Producer apply(final @NotNull Producer producer) { + return SentryKafkaProducer.wrap( + producer, ScopesAdapter.getInstance(), "auto.queue.spring.kafka.producer"); + } + } +} diff --git a/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaRecordInterceptor.java b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaRecordInterceptor.java new file mode 100644 index 00000000000..d1ad3086098 --- /dev/null +++ b/sentry-spring/src/main/java/io/sentry/spring/kafka/SentryKafkaRecordInterceptor.java @@ -0,0 +1,298 @@ +package io.sentry.spring.kafka; + +import io.sentry.BaggageHeader; +import io.sentry.DateUtils; +import io.sentry.IScopes; +import io.sentry.ISentryLifecycleToken; +import io.sentry.ITransaction; +import io.sentry.SentryLevel; +import io.sentry.SentryTraceHeader; +import io.sentry.SpanDataConvention; +import io.sentry.SpanStatus; +import io.sentry.TransactionContext; +import io.sentry.TransactionOptions; +import io.sentry.kafka.SentryKafkaProducer; +import io.sentry.util.SpanUtils; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import org.apache.kafka.clients.consumer.Consumer; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.header.Header; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.kafka.listener.RecordInterceptor; +import org.springframework.kafka.support.KafkaHeaders; + +/** + * A {@link RecordInterceptor} that creates {@code queue.process} transactions for incoming Kafka + * records with distributed tracing support. + */ +@ApiStatus.Internal +@SuppressWarnings("deprecation") +public final class SentryKafkaRecordInterceptor implements RecordInterceptor { + + static final String TRACE_ORIGIN = "auto.queue.spring.kafka.consumer"; + + private final @NotNull IScopes scopes; + private final @Nullable RecordInterceptor delegate; + + private static final @NotNull ThreadLocal currentContext = + new ThreadLocal<>(); + + public SentryKafkaRecordInterceptor(final @NotNull IScopes scopes) { + this(scopes, null); + } + + public SentryKafkaRecordInterceptor( + final @NotNull IScopes scopes, final @Nullable RecordInterceptor delegate) { + this.scopes = scopes; + this.delegate = delegate; + } + + @Override + public @Nullable ConsumerRecord intercept(final @NotNull ConsumerRecord record) { + return intercept(record, null); + } + + @Override + public @Nullable ConsumerRecord intercept( + final @NotNull ConsumerRecord record, final @Nullable Consumer consumer) { + if (!scopes.getOptions().isEnableQueueTracing() || isIgnored()) { + return delegateIntercept(record, consumer); + } + + try { + finishStaleContext(); + + final @NotNull IScopes forkedScopes = scopes.forkedRootScopes("SentryKafkaRecordInterceptor"); + final @NotNull ISentryLifecycleToken lifecycleToken = forkedScopes.makeCurrent(); + currentContext.set(new SentryRecordContext(lifecycleToken, null)); + + final @Nullable TransactionContext transactionContext = continueTrace(forkedScopes, record); + + final @Nullable ITransaction transaction = + startTransaction(forkedScopes, record, transactionContext); + currentContext.set(new SentryRecordContext(lifecycleToken, transaction)); + } catch (Throwable t) { + scopes.getOptions().getLogger().log(SentryLevel.ERROR, "Unable to wrap Kafka consumer.", t); + } + return delegateIntercept(record, consumer); + } + + @Override + public void success( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.success(record, consumer); + } + } finally { + finishSpan(SpanStatus.OK, null); + } + } + + @Override + public void failure( + final @NotNull ConsumerRecord record, + final @NotNull Exception exception, + final @NotNull Consumer consumer) { + try { + if (delegate != null) { + delegate.failure(record, exception, consumer); + } + } finally { + finishSpan(SpanStatus.INTERNAL_ERROR, exception); + } + } + + @Override + public void afterRecord( + final @NotNull ConsumerRecord record, final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.afterRecord(record, consumer); + } + } + + @Override + public void setupThreadState(final @NotNull Consumer consumer) { + if (delegate != null) { + delegate.setupThreadState(consumer); + } + } + + @Override + public void clearThreadState(final @NotNull Consumer consumer) { + try { + finishStaleContext(); + } finally { + if (delegate != null) { + delegate.clearThreadState(consumer); + } + } + } + + private boolean isIgnored() { + return SpanUtils.isIgnored(scopes.getOptions().getIgnoredSpanOrigins(), TRACE_ORIGIN); + } + + private @Nullable ConsumerRecord delegateIntercept( + final @NotNull ConsumerRecord record, final @Nullable Consumer consumer) { + if (delegate != null) { + return consumer != null ? delegate.intercept(record, consumer) : delegate.intercept(record); + } + return record; + } + + private @Nullable TransactionContext continueTrace( + final @NotNull IScopes forkedScopes, final @NotNull ConsumerRecord record) { + final @Nullable String sentryTrace = headerValue(record, SentryTraceHeader.SENTRY_TRACE_HEADER); + final @Nullable List baggageHeaders = + headerValues(record, BaggageHeader.BAGGAGE_HEADER); + return forkedScopes.continueTrace(sentryTrace, baggageHeaders); + } + + private @Nullable ITransaction startTransaction( + final @NotNull IScopes forkedScopes, + final @NotNull ConsumerRecord record, + final @Nullable TransactionContext transactionContext) { + if (!forkedScopes.getOptions().isTracingEnabled()) { + return null; + } + + final @NotNull TransactionContext txContext = + transactionContext != null + ? transactionContext + : new TransactionContext(record.topic(), "queue.process"); + txContext.setName(record.topic()); + txContext.setOperation("queue.process"); + + final @NotNull TransactionOptions txOptions = new TransactionOptions(); + txOptions.setOrigin(TRACE_ORIGIN); + txOptions.setBindToScope(true); + + final @NotNull ITransaction transaction = forkedScopes.startTransaction(txContext, txOptions); + + if (transaction.isNoOp()) { + return null; + } + + transaction.setData(SpanDataConvention.MESSAGING_SYSTEM, "kafka"); + transaction.setData(SpanDataConvention.MESSAGING_DESTINATION_NAME, record.topic()); + + final @Nullable String messageId = headerValue(record, "messaging.message.id"); + if (messageId != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_ID, messageId); + } + + final int bodySize = record.serializedValueSize(); + if (bodySize >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE, bodySize); + } + + final @Nullable Integer retryCount = retryCount(record); + if (retryCount != null) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT, retryCount); + } + + final @Nullable String enqueuedTimeStr = + headerValue(record, SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER); + if (enqueuedTimeStr != null) { + try { + final double enqueuedTimeSeconds = Double.parseDouble(enqueuedTimeStr); + final double nowSeconds = DateUtils.millisToSeconds(System.currentTimeMillis()); + final long latencyMs = (long) ((nowSeconds - enqueuedTimeSeconds) * 1000); + if (latencyMs >= 0) { + transaction.setData(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY, latencyMs); + } + } catch (NumberFormatException ignored) { + // ignore malformed header + } + } + + return transaction; + } + + private @Nullable Integer retryCount(final @NotNull ConsumerRecord record) { + final @Nullable Header header = record.headers().lastHeader(KafkaHeaders.DELIVERY_ATTEMPT); + if (header == null) { + return null; + } + + final byte[] value = header.value(); + if (value == null || value.length != Integer.BYTES) { + return null; + } + + final int attempt = ByteBuffer.wrap(value).getInt(); + if (attempt <= 0) { + return null; + } + + return attempt - 1; + } + + private void finishStaleContext() { + if (currentContext.get() != null) { + finishSpan(SpanStatus.UNKNOWN, null); + } + } + + private void finishSpan(final @NotNull SpanStatus status, final @Nullable Throwable throwable) { + final @Nullable SentryRecordContext ctx = currentContext.get(); + if (ctx == null) { + return; + } + currentContext.remove(); + + try { + final @Nullable ITransaction transaction = ctx.transaction; + if (transaction != null) { + transaction.setStatus(status); + if (throwable != null) { + transaction.setThrowable(throwable); + } + transaction.finish(); + } + } finally { + ctx.lifecycleToken.close(); + } + } + + private @Nullable String headerValue( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + final @Nullable Header header = record.headers().lastHeader(headerName); + if (header == null || header.value() == null) { + return null; + } + return new String(header.value(), StandardCharsets.UTF_8); + } + + private @Nullable List headerValues( + final @NotNull ConsumerRecord record, final @NotNull String headerName) { + @Nullable List values = null; + for (final @NotNull Header header : record.headers().headers(headerName)) { + if (header.value() != null) { + if (values == null) { + values = new ArrayList<>(); + } + values.add(new String(header.value(), StandardCharsets.UTF_8)); + } + } + return values; + } + + private static final class SentryRecordContext { + final @NotNull ISentryLifecycleToken lifecycleToken; + final @Nullable ITransaction transaction; + + SentryRecordContext( + final @NotNull ISentryLifecycleToken lifecycleToken, + final @Nullable ITransaction transaction) { + this.lifecycleToken = lifecycleToken; + this.transaction = transaction; + } + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/exception/SentryCaptureExceptionParameterAdviceTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/exception/SentryCaptureExceptionParameterAdviceTest.kt index f7b43867252..29ab6683450 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/exception/SentryCaptureExceptionParameterAdviceTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/exception/SentryCaptureExceptionParameterAdviceTest.kt @@ -4,6 +4,8 @@ import io.sentry.Hint import io.sentry.IScopes import io.sentry.Sentry import io.sentry.exception.ExceptionMechanismException +import io.sentry.test.initForTest +import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals @@ -32,6 +34,13 @@ class SentryCaptureExceptionParameterAdviceTest { @BeforeTest fun setup() { reset(scopes) + initForTest { it.dsn = "https://key@sentry.io/proj" } + Sentry.setCurrentScopes(scopes) + } + + @AfterTest + fun teardown() { + Sentry.close() } @Test diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..76dfd81cd0b --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt @@ -0,0 +1,110 @@ +package io.sentry.spring.kafka + +import kotlin.test.Test +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory +import org.springframework.kafka.core.ConsumerFactory +import org.springframework.kafka.listener.RecordInterceptor + +class SentryKafkaConsumerBeanPostProcessorTest { + + @Test + fun `wraps ConcurrentKafkaListenerContainerFactory with SentryKafkaRecordInterceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + // Verify via reflection that the interceptor was set + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val interceptor = field.get(factory) + assertTrue(interceptor is SentryKafkaRecordInterceptor<*, *>) + } + + @Test + fun `does not double-wrap when SentryKafkaRecordInterceptor already set`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val processor = SentryKafkaConsumerBeanPostProcessor() + // First wrap + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val firstInterceptor = field.get(factory) + + // Second wrap — should be idempotent + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + val secondInterceptor = field.get(factory) + + assertSame(firstInterceptor, secondInterceptor) + } + + @Test + fun `does not wrap non-factory beans`() { + val someBean = "not a factory" + val processor = SentryKafkaConsumerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `chains existing customer RecordInterceptor as delegate`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + + val customerInterceptor = RecordInterceptor { record -> record } + factory.setRecordInterceptor(customerInterceptor) + + val processor = SentryKafkaConsumerBeanPostProcessor() + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + val installed = field.get(factory) + assertTrue( + installed is SentryKafkaRecordInterceptor<*, *>, + "expected SentryKafkaRecordInterceptor, got ${installed?.javaClass}", + ) + + val delegateField = SentryKafkaRecordInterceptor::class.java.getDeclaredField("delegate") + delegateField.isAccessible = true + assertSame( + customerInterceptor, + delegateField.get(installed), + "customer interceptor must be preserved as delegate", + ) + } + + @Test + fun `skips installation when reflection fails and preserves customer interceptor`() { + val consumerFactory = mock>() + val factory = ConcurrentKafkaListenerContainerFactory() + factory.consumerFactory = consumerFactory + val customerInterceptor = RecordInterceptor { record -> record } + factory.setRecordInterceptor(customerInterceptor) + + val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor") + field.isAccessible = true + assertSame(customerInterceptor, field.get(factory)) + + val processor = SentryKafkaConsumerBeanPostProcessor("missingRecordInterceptor") + processor.postProcessAfterInitialization(factory, "kafkaListenerContainerFactory") + + assertSame( + customerInterceptor, + field.get(factory), + "customer interceptor must remain installed when Sentry cannot read it", + ) + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt new file mode 100644 index 00000000000..11a943307c8 --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -0,0 +1,95 @@ +package io.sentry.spring.kafka + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.apache.kafka.clients.producer.Producer +import org.mockito.kotlin.any +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.core.DefaultKafkaProducerFactory +import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.core.ProducerPostProcessor + +class SentryKafkaProducerBeanPostProcessorTest { + + @Test + fun `registers Sentry post-processor on ProducerFactory`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + val captor = argumentCaptor>() + verify(factory).addPostProcessor(captor.capture()) + assertTrue( + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } + + @Test + fun `does not throw when addPostProcessor is a no-op (default interface method)`() { + // Factory using the default no-op addPostProcessor / getPostProcessors + val factory = mock>() + whenever(factory.postProcessors).thenReturn(emptyList()) + val processor = SentryKafkaProducerBeanPostProcessor() + + // Should complete without throwing, and log a warning via ScopesAdapter + processor.postProcessAfterInitialization(factory, "myFactory") + + verify(factory).addPostProcessor(any()) + } + + @Test + fun `does not modify non-ProducerFactory beans`() { + val someBean = "not a producer factory" + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(someBean, "someBean") + + assertSame(someBean, result) + } + + @Test + fun `returns the same bean instance`() { + val factory = mock>() + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + whenever(factory.postProcessors).thenReturn(listOf(pp)) + val processor = SentryKafkaProducerBeanPostProcessor() + + val result = processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertSame(factory, result, "BPP must return the same bean, not a replacement") + } + + @Test + fun `registered post-processor wraps producers via SentryKafkaProducer wrap`() { + val pp = SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor() + val raw = mock>() + + val wrapped = pp.apply(raw) + + assertTrue(java.lang.reflect.Proxy.isProxyClass(wrapped.javaClass)) + } + + @Test + fun `integrates with DefaultKafkaProducerFactory addPostProcessor contract`() { + // Sanity check against the real Spring Kafka API surface — DefaultKafkaProducerFactory + // honors addPostProcessor and exposes it via getPostProcessors(). + val factory = DefaultKafkaProducerFactory(emptyMap()) + val processor = SentryKafkaProducerBeanPostProcessor() + + processor.postProcessAfterInitialization(factory, "kafkaProducerFactory") + + assertEquals(1, factory.postProcessors.size) + assertTrue( + factory.postProcessors.first() + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + ) + } +} diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaRecordInterceptorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaRecordInterceptorTest.kt new file mode 100644 index 00000000000..17df004d40c --- /dev/null +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaRecordInterceptorTest.kt @@ -0,0 +1,486 @@ +package io.sentry.spring.kafka + +import io.sentry.BaggageHeader +import io.sentry.IScopes +import io.sentry.ISentryLifecycleToken +import io.sentry.Sentry +import io.sentry.SentryOptions +import io.sentry.SentryTraceHeader +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.TransactionContext +import io.sentry.kafka.SentryKafkaProducer +import io.sentry.test.initForTest +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.util.Optional +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.apache.kafka.clients.consumer.Consumer +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.common.header.internals.RecordHeaders +import org.apache.kafka.common.record.TimestampType +import org.mockito.kotlin.any +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever +import org.springframework.kafka.listener.RecordInterceptor +import org.springframework.kafka.support.KafkaHeaders + +class SentryKafkaRecordInterceptorTest { + + private lateinit var scopes: IScopes + private lateinit var forkedScopes: IScopes + private lateinit var options: SentryOptions + private lateinit var consumer: Consumer + private lateinit var lifecycleToken: ISentryLifecycleToken + private lateinit var transaction: SentryTracer + + @BeforeTest + fun setup() { + initForTest { it.dsn = "https://key@sentry.io/proj" } + scopes = mock() + consumer = mock() + lifecycleToken = mock() + options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + isEnableQueueTracing = true + tracesSampleRate = 1.0 + } + whenever(scopes.options).thenReturn(options) + whenever(scopes.isEnabled).thenReturn(true) + + forkedScopes = mock() + whenever(scopes.forkedRootScopes(any())).thenReturn(forkedScopes) + whenever(forkedScopes.options).thenReturn(options) + whenever(forkedScopes.makeCurrent()).thenReturn(lifecycleToken) + + transaction = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes) + whenever(forkedScopes.startTransaction(any(), any())) + .thenReturn(transaction) + } + + @AfterTest + fun teardown() { + Sentry.close() + } + + private fun createRecord( + topic: String = "my-topic", + headers: RecordHeaders = RecordHeaders(), + serializedValueSize: Int = -1, + ): ConsumerRecord { + return ConsumerRecord( + topic, + 0, + 0L, + System.currentTimeMillis(), + TimestampType.CREATE_TIME, + 3, + serializedValueSize, + "key", + "value", + headers, + Optional.empty(), + ) + } + + private fun createRecordWithHeaders( + sentryTrace: String? = null, + baggage: String? = null, + baggageHeaders: List? = null, + enqueuedTime: String? = null, + deliveryAttempt: Int? = null, + ): ConsumerRecord { + val headers = RecordHeaders() + sentryTrace?.let { + headers.add(SentryTraceHeader.SENTRY_TRACE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggage?.let { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + baggageHeaders?.forEach { + headers.add(BaggageHeader.BAGGAGE_HEADER, it.toByteArray(StandardCharsets.UTF_8)) + } + enqueuedTime?.let { + headers.add( + SentryKafkaProducer.SENTRY_ENQUEUED_TIME_HEADER, + it.toByteArray(StandardCharsets.UTF_8), + ) + } + deliveryAttempt?.let { + headers.add( + KafkaHeaders.DELIVERY_ATTEMPT, + ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array(), + ) + } + val record = ConsumerRecord("my-topic", 0, 0L, "key", "value") + headers.forEach { record.headers().add(it) } + return record + } + + @Test + fun `intercept forks root scopes`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(scopes).forkedRootScopes("SentryKafkaRecordInterceptor") + verify(forkedScopes).makeCurrent() + verify(forkedScopes) + .startTransaction( + org.mockito.kotlin.check { + assertEquals("my-topic", it.name) + assertEquals("queue.process", it.operation) + }, + any(), + ) + } + + @Test + fun `intercept continues trace from headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = createRecordWithHeaders(sentryTrace = sentryTraceValue) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace(org.mockito.kotlin.eq(sentryTraceValue), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept calls continueTrace with null when no headers`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + verify(forkedScopes).continueTrace(org.mockito.kotlin.isNull(), org.mockito.kotlin.isNull()) + } + + @Test + fun `intercept passes all baggage headers to continueTrace`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val sentryTraceValue = "2722d9f6ec019ade60c776169d9a8904-cedf5b7571cb4972-1" + val record = + createRecordWithHeaders( + sentryTrace = sentryTraceValue, + baggageHeaders = listOf("third=party", "sentry-sample_rate=1"), + ) + + interceptor.intercept(record, consumer) + + verify(forkedScopes) + .continueTrace( + org.mockito.kotlin.eq(sentryTraceValue), + org.mockito.kotlin.eq(listOf("third=party", "sentry-sample_rate=1")), + ) + } + + @Test + fun `sets body size from serializedValueSize`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = 42) + + interceptor.intercept(record, consumer) + + assertEquals(42, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `does not set body size when serializedValueSize is negative`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord(serializedValueSize = -1) + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_BODY_SIZE)) + } + + @Test + fun `sets retry count from delivery attempt header`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecordWithHeaders(deliveryAttempt = 3) + + interceptor.intercept(record, consumer) + + assertEquals(2, transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `does not set retry count when delivery attempt header is missing`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + assertNull(transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RETRY_COUNT)) + } + + @Test + fun `sets receive latency from enqueued time in epoch seconds`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val enqueuedTime = (System.currentTimeMillis() / 1000.0 - 1.0).toString() + val record = createRecordWithHeaders(enqueuedTime = enqueuedTime) + + interceptor.intercept(record, consumer) + + val latency = transaction.data?.get(SpanDataConvention.MESSAGING_MESSAGE_RECEIVE_LATENCY) + assertTrue(latency is Long && latency >= 0) + } + + @Test + fun `does not create span when queue tracing is disabled`() { + options.isEnableQueueTracing = false + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `does not create span when origin is ignored`() { + options.setIgnoredSpanOrigins(listOf(SentryKafkaRecordInterceptor.TRACE_ORIGIN)) + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + val result = interceptor.intercept(record, consumer) + + verify(scopes, never()).forkedRootScopes(any()) + verify(forkedScopes, never()).makeCurrent() + assertEquals(record, result) + } + + @Test + fun `delegates to existing interceptor`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + interceptor.intercept(record, consumer) + + verify(delegate).intercept(record, consumer) + } + + @Test + fun `delegates to existing interceptor when consumer is null`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record)).thenReturn(record) + + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val result = interceptor.intercept(record) + + assertEquals(record, result) + verify(delegate).intercept(record) + } + + @Test + fun `success finishes transaction and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + + verify(delegate).success(record, consumer) + } + + @Test + fun `failure finishes transaction with error and delegates`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + val exception = RuntimeException("processing failed") + + interceptor.intercept(record, consumer) + interceptor.failure(record, exception, consumer) + + verify(delegate).failure(record, exception, consumer) + } + + @Test + fun `afterRecord delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.afterRecord(record, consumer) + + verify(delegate).afterRecord(record, consumer) + } + + @Test + fun `trace origin is set correctly`() { + assertEquals("auto.queue.spring.kafka.consumer", SentryKafkaRecordInterceptor.TRACE_ORIGIN) + } + + @Test + fun `clearThreadState cleans up stale context`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + interceptor.intercept(record, consumer) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken).close() + } + + @Test + fun `clearThreadState is no-op when no context exists`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.clearThreadState(consumer) + } + + @Test + fun `setupThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + + verify(delegate).setupThreadState(consumer) + } + + @Test + fun `setupThreadState is no-op without delegate`() { + val interceptor = SentryKafkaRecordInterceptor(scopes) + + // should not throw + interceptor.setupThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor`() { + val delegate = mock>() + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.clearThreadState(consumer) + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `clearThreadState delegates to existing interceptor even when sentry cleanup throws`() { + val delegate = mock>() + whenever(lifecycleToken.close()).thenThrow(RuntimeException("boom")) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + val record = createRecord() + + interceptor.intercept(record, consumer) + + try { + interceptor.clearThreadState(consumer) + } catch (ignored: RuntimeException) { + // expected + } + + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `full lifecycle intercept success clearThreadState closes token exactly once`() { + val delegate = mock>() + val record = createRecord() + whenever(delegate.intercept(record, consumer)).thenReturn(record) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + interceptor.intercept(record, consumer) + interceptor.success(record, consumer) + interceptor.clearThreadState(consumer) + + // token closed once by success(); clearThreadState must not re-close it + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + // delegate hooks still delegated across the full lifecycle + verify(delegate).setupThreadState(consumer) + verify(delegate).success(record, consumer) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept returns null clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + // delegate filters the record — per Spring Kafka contract, success/failure will not be invoked + whenever(delegate.intercept(record, consumer)).thenReturn(null) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val result = interceptor.intercept(record, consumer) + interceptor.clearThreadState(consumer) + + assertNull(result) + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `when delegate intercept throws clearThreadState still finishes transaction and closes token`() { + val delegate = mock>() + val record = createRecord() + val boom = RuntimeException("delegate boom") + whenever(delegate.intercept(record, consumer)).thenThrow(boom) + val interceptor = SentryKafkaRecordInterceptor(scopes, delegate) + + interceptor.setupThreadState(consumer) + val thrown = assertFailsWith { interceptor.intercept(record, consumer) } + assertEquals(boom, thrown) + + interceptor.clearThreadState(consumer) + + verify(lifecycleToken, times(1)).close() + assertTrue(transaction.isFinished) + verify(delegate).clearThreadState(consumer) + } + + @Test + fun `intercept cleans up stale context from previous record`() { + val lifecycleToken2 = mock() + val forkedScopes2 = mock() + whenever(forkedScopes2.options).thenReturn(options) + whenever(forkedScopes2.makeCurrent()).thenReturn(lifecycleToken2) + val tx2 = SentryTracer(TransactionContext("queue.process", "queue.process"), forkedScopes2) + whenever(forkedScopes2.startTransaction(any(), any())).thenReturn(tx2) + + var callCount = 0 + + val interceptor = SentryKafkaRecordInterceptor(scopes) + val record = createRecord() + + whenever(scopes.forkedRootScopes(any())).thenAnswer { + callCount++ + if (callCount == 1) forkedScopes else forkedScopes2 + } + + // First intercept sets up context + interceptor.intercept(record, consumer) + + // Second intercept without success/failure — should clean up stale context first + interceptor.intercept(record, consumer) + + // First lifecycle token should have been closed by the defensive cleanup + verify(lifecycleToken).close() + } +} diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt index da552ff93bc..b9dc0f3ccad 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/RestTestClient.kt @@ -81,6 +81,12 @@ class RestTestClient(private val backendBaseUrl: String) : LoggingInsecureRestCl return response?.body?.string() } + fun produceKafkaMessage(message: String = "hello from sentry!"): String? { + val request = Request.Builder().url("$backendBaseUrl/kafka/produce?message=$message") + + return callTyped(request, true) + } + fun getCountMetric(): String? { val request = Request.Builder().url("$backendBaseUrl/metric/count") diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 8bd1e90e094..13dfd6b9b39 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -529,6 +529,7 @@ public final class io/sentry/ExternalOptions { public fun isEnableLogs ()Ljava/lang/Boolean; public fun isEnableMetrics ()Ljava/lang/Boolean; public fun isEnablePrettySerializationOutput ()Ljava/lang/Boolean; + public fun isEnableQueueTracing ()Ljava/lang/Boolean; public fun isEnableSpotlight ()Ljava/lang/Boolean; public fun isEnabled ()Ljava/lang/Boolean; public fun isForceInit ()Ljava/lang/Boolean; @@ -548,6 +549,7 @@ public final class io/sentry/ExternalOptions { public fun setEnableLogs (Ljava/lang/Boolean;)V public fun setEnableMetrics (Ljava/lang/Boolean;)V public fun setEnablePrettySerializationOutput (Ljava/lang/Boolean;)V + public fun setEnableQueueTracing (Ljava/lang/Boolean;)V public fun setEnableSpotlight (Ljava/lang/Boolean;)V public fun setEnableUncaughtExceptionHandler (Ljava/lang/Boolean;)V public fun setEnabled (Ljava/lang/Boolean;)V @@ -3714,6 +3716,7 @@ public class io/sentry/SentryOptions { public fun isEnableEventSizeLimiting ()Z public fun isEnableExternalConfiguration ()Z public fun isEnablePrettySerializationOutput ()Z + public fun isEnableQueueTracing ()Z public fun isEnableScopePersistence ()Z public fun isEnableScreenTracking ()Z public fun isEnableShutdownHook ()Z @@ -3774,6 +3777,7 @@ public class io/sentry/SentryOptions { public fun setEnableEventSizeLimiting (Z)V public fun setEnableExternalConfiguration (Z)V public fun setEnablePrettySerializationOutput (Z)V + public fun setEnableQueueTracing (Z)V public fun setEnableScopePersistence (Z)V public fun setEnableScreenTracking (Z)V public fun setEnableShutdownHook (Z)V @@ -4418,6 +4422,14 @@ public abstract interface class io/sentry/SpanDataConvention { public static final field HTTP_RESPONSE_CONTENT_LENGTH_KEY Ljava/lang/String; public static final field HTTP_START_TIMESTAMP Ljava/lang/String; public static final field HTTP_STATUS_CODE_KEY Ljava/lang/String; + public static final field MESSAGING_DESTINATION_NAME Ljava/lang/String; + public static final field MESSAGING_MESSAGE_BODY_SIZE Ljava/lang/String; + public static final field MESSAGING_MESSAGE_ENVELOPE_SIZE Ljava/lang/String; + public static final field MESSAGING_MESSAGE_ID Ljava/lang/String; + public static final field MESSAGING_MESSAGE_RECEIVE_LATENCY Ljava/lang/String; + public static final field MESSAGING_MESSAGE_RETRY_COUNT Ljava/lang/String; + public static final field MESSAGING_OPERATION_TYPE Ljava/lang/String; + public static final field MESSAGING_SYSTEM Ljava/lang/String; public static final field PROFILER_ID Ljava/lang/String; public static final field THREAD_ID Ljava/lang/String; public static final field THREAD_NAME Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index e992c04466b..4e44ea422ec 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -58,6 +58,7 @@ public final class ExternalOptions { private @Nullable Boolean enableBackpressureHandling; private @Nullable Boolean enableDatabaseTransactionTracing; private @Nullable Boolean enableCacheTracing; + private @Nullable Boolean enableQueueTracing; private @Nullable Boolean globalHubMode; private @Nullable Boolean forceInit; private @Nullable Boolean captureOpenTelemetryEvents; @@ -168,6 +169,8 @@ public final class ExternalOptions { options.setEnableCacheTracing(propertiesProvider.getBooleanProperty("enable-cache-tracing")); + options.setEnableQueueTracing(propertiesProvider.getBooleanProperty("enable-queue-tracing")); + options.setGlobalHubMode(propertiesProvider.getBooleanProperty("global-hub-mode")); options.setCaptureOpenTelemetryEvents( @@ -541,6 +544,14 @@ public void setEnableCacheTracing(final @Nullable Boolean enableCacheTracing) { return enableCacheTracing; } + public void setEnableQueueTracing(final @Nullable Boolean enableQueueTracing) { + this.enableQueueTracing = enableQueueTracing; + } + + public @Nullable Boolean isEnableQueueTracing() { + return enableQueueTracing; + } + public void setGlobalHubMode(final @Nullable Boolean globalHubMode) { this.globalHubMode = globalHubMode; } diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index a6f78cfad9c..0d038482d07 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -508,6 +508,9 @@ public class SentryOptions { /** Whether cache operations (get, put, remove, flush) should be traced. */ private boolean enableCacheTracing = false; + /** Whether queue operations (publish, process) should be traced. */ + private boolean enableQueueTracing = false; + /** Date provider to retrieve the current date from. */ @ApiStatus.Internal private final @NotNull LazyEvaluator dateProvider = @@ -2704,6 +2707,26 @@ public void setEnableCacheTracing(boolean enableCacheTracing) { this.enableCacheTracing = enableCacheTracing; } + /** + * Whether Sentry emits Queue spans and transforms OpenTelemetry messaging spans to match Sentry's + * queue conventions. + * + * @return true if queue tracing is enabled + */ + public boolean isEnableQueueTracing() { + return enableQueueTracing; + } + + /** + * Whether Sentry emits Queue spans and transforms OpenTelemetry messaging spans to match Sentry's + * queue conventions. + * + * @param enableQueueTracing true to enable queue tracing + */ + public void setEnableQueueTracing(boolean enableQueueTracing) { + this.enableQueueTracing = enableQueueTracing; + } + /** * Whether Sentry is enabled. * @@ -3545,6 +3568,9 @@ public void merge(final @NotNull ExternalOptions options) { if (options.isEnableCacheTracing() != null) { setEnableCacheTracing(options.isEnableCacheTracing()); } + if (options.isEnableQueueTracing() != null) { + setEnableQueueTracing(options.isEnableQueueTracing()); + } if (options.getMaxRequestBodySize() != null) { setMaxRequestBodySize(options.getMaxRequestBodySize()); } diff --git a/sentry/src/main/java/io/sentry/SpanDataConvention.java b/sentry/src/main/java/io/sentry/SpanDataConvention.java index 647c0dacddf..4ede74505cb 100644 --- a/sentry/src/main/java/io/sentry/SpanDataConvention.java +++ b/sentry/src/main/java/io/sentry/SpanDataConvention.java @@ -30,4 +30,12 @@ public interface SpanDataConvention { String CACHE_KEY = "cache.key"; String CACHE_OPERATION = "cache.operation"; String CACHE_WRITE = "cache.write"; + String MESSAGING_SYSTEM = "messaging.system"; + String MESSAGING_DESTINATION_NAME = "messaging.destination.name"; + String MESSAGING_MESSAGE_ID = "messaging.message.id"; + String MESSAGING_MESSAGE_RETRY_COUNT = "messaging.message.retry.count"; + String MESSAGING_MESSAGE_BODY_SIZE = "messaging.message.body.size"; + String MESSAGING_MESSAGE_ENVELOPE_SIZE = "messaging.message.envelope.size"; + String MESSAGING_MESSAGE_RECEIVE_LATENCY = "messaging.message.receive.latency"; + String MESSAGING_OPERATION_TYPE = "messaging.operation.type"; } diff --git a/sentry/src/main/java/io/sentry/util/SpanUtils.java b/sentry/src/main/java/io/sentry/util/SpanUtils.java index cad4d483656..c324feed840 100644 --- a/sentry/src/main/java/io/sentry/util/SpanUtils.java +++ b/sentry/src/main/java/io/sentry/util/SpanUtils.java @@ -40,6 +40,10 @@ public final class SpanUtils { origins.add("auto.http.spring7.resttemplate"); origins.add("auto.http.openfeign"); origins.add("auto.http.ktor-client"); + origins.add("auto.queue.spring_jakarta.kafka.producer"); + origins.add("auto.queue.spring_jakarta.kafka.consumer"); + origins.add("auto.queue.kafka.producer"); + origins.add("auto.queue.kafka.consumer"); } if (SentryOpenTelemetryMode.AGENT == mode) { diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index 54630355557..fee707d31f3 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -345,6 +345,20 @@ class ExternalOptionsTest { } } + @Test + fun `creates options with enableQueueTracing set to true`() { + withPropertiesFile("enable-queue-tracing=true") { options -> + assertTrue(options.isEnableQueueTracing == true) + } + } + + @Test + fun `creates options with enableQueueTracing set to false`() { + withPropertiesFile("enable-queue-tracing=false") { options -> + assertTrue(options.isEnableQueueTracing == false) + } + } + @Test fun `creates options with cron defaults`() { withPropertiesFile( diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index e08d0ed8f72..75a24dd68df 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -708,6 +708,11 @@ class SentryOptionsTest { assertFalse(SentryOptions().isEnableCacheTracing) } + @Test + fun `when options are initialized, enableQueueTracing is set to false by default`() { + assertFalse(SentryOptions().isEnableQueueTracing) + } + @Test fun `when options are initialized, metrics is enabled by default`() { assertTrue(SentryOptions().metrics.isEnabled) @@ -1018,6 +1023,23 @@ class SentryOptionsTest { assertEquals("original", options.orgId) } + @Test + fun `merging options applies enableQueueTracing`() { + val externalOptions = ExternalOptions() + externalOptions.setEnableQueueTracing(true) + val options = SentryOptions() + options.merge(externalOptions) + assertTrue(options.isEnableQueueTracing) + } + + @Test + fun `merging options preserves enableQueueTracing default when not set`() { + val externalOptions = ExternalOptions() + val options = SentryOptions() + options.merge(externalOptions) + assertFalse(options.isEnableQueueTracing) + } + @Test fun `getEffectiveOrgId prefers explicit orgId over DSN`() { val options = SentryOptions() diff --git a/settings.gradle.kts b/settings.gradle.kts index 8d431d5fbdf..4b1c606bc64 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -58,6 +58,7 @@ include( "sentry-graphql-22", "sentry-graphql-core", "sentry-jdbc", + "sentry-kafka", "sentry-opentelemetry:sentry-opentelemetry-bootstrap", "sentry-opentelemetry:sentry-opentelemetry-core", "sentry-opentelemetry:sentry-opentelemetry-agentcustomization", diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 1250c6cbab9..784448715e9 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -42,6 +42,7 @@ import argparse import requests import threading +import socket from pathlib import Path from typing import Optional, List, Tuple from dataclasses import dataclass @@ -65,6 +66,32 @@ "SENTRY_ENABLE_CACHE_TRACING": "true" } +KAFKA_CONTAINER_NAME = "sentry-java-system-test-kafka" +KAFKA_BOOTSTRAP_SERVERS = "localhost:9092" +KAFKA_BROKER_REQUIRED_MODULES = { + "sentry-samples-console", + "sentry-samples-spring-boot", + "sentry-samples-spring-boot-opentelemetry", + "sentry-samples-spring-boot-opentelemetry-noagent", + "sentry-samples-spring-boot-jakarta", + "sentry-samples-spring-boot-jakarta-opentelemetry", + "sentry-samples-spring-boot-jakarta-opentelemetry-noagent", + "sentry-samples-spring-boot-4", + "sentry-samples-spring-boot-4-opentelemetry", + "sentry-samples-spring-boot-4-opentelemetry-noagent", +} +KAFKA_PROFILE_REQUIRED_MODULES = { + "sentry-samples-spring-boot", + "sentry-samples-spring-boot-opentelemetry", + "sentry-samples-spring-boot-opentelemetry-noagent", + "sentry-samples-spring-boot-jakarta", + "sentry-samples-spring-boot-jakarta-opentelemetry", + "sentry-samples-spring-boot-jakarta-opentelemetry-noagent", + "sentry-samples-spring-boot-4", + "sentry-samples-spring-boot-4-opentelemetry", + "sentry-samples-spring-boot-4-opentelemetry-noagent", +} + class ServerType(Enum): TOMCAT = 0 SPRING = 1 @@ -155,6 +182,7 @@ def __init__(self): self.mock_server = Server(name="Mock", pid_filepath="sentry-mock-server.pid") self.tomcat_server = Server(name="Tomcat", pid_filepath="tomcat-server.pid") self.spring_server = Server(name="Spring", pid_filepath="spring-server.pid") + self.kafka_started_by_runner = False # Load existing PIDs if available for server in (self.mock_server, self.tomcat_server, self.spring_server): @@ -196,7 +224,84 @@ def kill_process(self, pid: int, name: str) -> None: except (OSError, ProcessLookupError): print(f"Process {pid} was already dead") + def module_requires_kafka(self, sample_module: str) -> bool: + return sample_module in KAFKA_BROKER_REQUIRED_MODULES + def module_requires_kafka_profile(self, sample_module: str) -> bool: + return sample_module in KAFKA_PROFILE_REQUIRED_MODULES + + def wait_for_port(self, host: str, port: int, max_attempts: int = 20) -> bool: + for _ in range(max_attempts): + try: + with socket.create_connection((host, port), timeout=1): + return True + except OSError: + time.sleep(1) + return False + + def remove_kafka_broker_container(self) -> None: + subprocess.run( + ["docker", "rm", "-f", KAFKA_CONTAINER_NAME], + check=False, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + + def start_kafka_broker(self) -> None: + if self.wait_for_port("localhost", 9092, max_attempts=1): + print("Kafka broker already running on localhost:9092, reusing it.") + self.kafka_started_by_runner = False + return + + self.remove_kafka_broker_container() + + print("Starting Kafka broker (Redpanda) for system tests...") + run_result = subprocess.run( + [ + "docker", + "run", + "-d", + "--name", + KAFKA_CONTAINER_NAME, + "-p", + "9092:9092", + "docker.redpanda.com/redpandadata/redpanda:v24.1.9", + "redpanda", + "start", + "--overprovisioned", + "--smp", + "1", + "--memory", + "1G", + "--reserve-memory", + "0M", + "--node-id", + "0", + "--check=false", + "--kafka-addr", + "PLAINTEXT://0.0.0.0:9092", + "--advertise-kafka-addr", + "PLAINTEXT://localhost:9092", + ], + check=False, + capture_output=True, + text=True, + ) + + if run_result.returncode != 0: + raise RuntimeError(f"Failed to start Kafka container: {run_result.stderr}") + + if not self.wait_for_port("localhost", 9092, max_attempts=30): + raise RuntimeError("Kafka broker did not become ready on localhost:9092") + + self.kafka_started_by_runner = True + + def stop_kafka_broker(self) -> None: + if not self.kafka_started_by_runner: + return + + self.remove_kafka_broker_container() + self.kafka_started_by_runner = False def start_sentry_mock_server(self) -> None: """Start the Sentry mock server.""" @@ -347,6 +452,13 @@ def start_spring_server(self, sample_module: str, java_agent: str, java_agent_au env.update(SENTRY_ENVIRONMENT_VARIABLES) env["SENTRY_AUTO_INIT"] = java_agent_auto_init + if self.module_requires_kafka_profile(sample_module): + env["SPRING_PROFILES_ACTIVE"] = "kafka" + env["SENTRY_ENABLE_QUEUE_TRACING"] = "true" + print("Enabling Spring profile: kafka") + else: + env.pop("SPRING_PROFILES_ACTIVE", None) + # Build command jar_path = f"sentry-samples/{sample_module}/build/libs/{sample_module}-0.0.1-SNAPSHOT.jar" cmd = ["java"] @@ -564,6 +676,12 @@ def setup_test_infrastructure(self, sample_module: str, java_agent: str, java_agent_auto_init: str, build_before_run: str, server_type: Optional[ServerType]) -> int: """Set up test infrastructure. Returns 0 on success, error code on failure.""" + if self.module_requires_kafka(sample_module): + self.start_kafka_broker() + os.environ["SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS"] = KAFKA_BOOTSTRAP_SERVERS + else: + os.environ.pop("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS", None) + # Build if requested if build_before_run == "1": print("Building before test run") @@ -631,6 +749,8 @@ def run_single_test(self, sample_module: str, java_agent: str, elif server_type == ServerType.SPRING: self.stop_spring_server() self.stop_sentry_mock_server() + self.stop_kafka_broker() + os.environ.pop("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS", None) def run_all_tests(self) -> int: """Run all system tests.""" @@ -961,6 +1081,8 @@ def cleanup_on_exit(self, signum, frame): self.stop_spring_server() self.stop_sentry_mock_server() self.stop_tomcat_server() + self.stop_kafka_broker() + os.environ.pop("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS", None) sys.exit(1) def main(): @@ -1159,6 +1281,8 @@ def main(): runner.stop_spring_server() runner.stop_sentry_mock_server() runner.stop_tomcat_server() + runner.stop_kafka_broker() + os.environ.pop("SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS", None) if __name__ == "__main__": sys.exit(main()) From d446e68d100ab9363b233ae6b98698bb13782049 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 6 May 2026 18:40:08 +0200 Subject: [PATCH 136/391] chore(codeowners): Add Nelson and Adam (#5369) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4a3ed92029f..6e1f71a7677 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @adinauer @romtsn @markushi +* @adinauer @romtsn @markushi @runningcode @0xadam-brown From 7ce4e911688f63d921a37f085dba629a097d9680 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 6 May 2026 18:59:18 +0200 Subject: [PATCH 137/391] feat(replay): Capture SurfaceView content (experimental) (#5333) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(replay): Capture SurfaceView content (experimental) SurfaceView (used by Unity, video players, maps, and similar) renders to a separate Surface that is composited by SurfaceFlinger outside of the View hierarchy. PixelCopy.request(window, ...) only captures the Window surface, so SurfaceView regions appeared as transparent/black holes in Session Replay recordings. When the experimental option options.sessionReplay.isCaptureSurfaceViews is enabled, each visible SurfaceView is now captured separately via PixelCopy.request(surfaceView, ...) and composited onto the screenshot using PorterDuff.DST_OVER, so the SurfaceView content draws behind the Window content (which has transparent holes where the SurfaceViews are). Because SurfaceView redraws do not trigger ViewTreeObserver.OnDrawListener, the recorder bypasses the contentChanged guard when SurfaceViews are present, so subsequent frames are re-captured at the configured frame rate instead of reusing the last screenshot. The option defaults to false to preserve existing behavior. Co-Authored-By: Claude Opus 4.7 (1M context) * test(replay): Cover SurfaceView capture paths Add unit tests for the new SurfaceView capture support and extract a compositeSurfaceViewInto helper so the drawing contract can be verified with hand-built bitmaps (Robolectric's ShadowPixelCopy cannot produce meaningful SurfaceView pixels because there is no real GL producer). The tests cover: - ViewHierarchyNode.fromView returns SurfaceViewHierarchyNode vs. generic - View.traverse collects SurfaceView nodes when a list is supplied, not when it is null, and skips invisible SurfaceViews - PixelCopyStrategy leaves hasSurfaceViews false when the option is off - PixelCopyStrategy flags hasSurfaceViews true when the option is on - PixelCopyStrategy completes gracefully when a SurfaceView has no valid surface (the common Robolectric case) - compositeSurfaceViewInto fills transparent holes behind existing window content via DST_OVER, and respects both window offset and scale factors Also fixes a latent NPE in captureSurfaceViews when SurfaceHolder.surface is null (not just invalid) — happens before the surface is created. Co-Authored-By: Claude Opus 4.7 (1M context) * formatting * api dump * docs(changelog): Move SurfaceView entry to Unreleased Co-Authored-By: Claude Opus 4.7 (1M context) * feat(replay): Wire capture-surface-views option through ManifestMetadataReader Allow enabling the experimental SurfaceView capture in Session Replay via the manifest meta-data `io.sentry.session-replay.capture-surface-views`, so users relying on auto-init don't need to switch to manual SentryAndroid.init just to flip the flag. Co-Authored-By: Claude Opus 4.7 (1M context) * ref(replay): Inline captureSurfaceViewsEnabled local Co-Authored-By: Claude Opus 4.7 (1M context) * ref(replay): Address review comments - Drop the dedicated hasSurfaceViews flag and ScreenshotStrategy hook; PixelCopyStrategy now signals \"capture again next tick\" via a markContentChanged callback that re-arms the recorder's existing contentChanged gate. One source of truth instead of two booleans. - Inline the trivial submitMaskingAndCallback helper at its single call site. - Bail early in the SurfaceView PixelCopy callback if the strategy has been closed mid-flight, mirroring the Window-capture callback. - Document on SentryReplayOptions.captureSurfaceViews and in CHANGELOG that masking granularity is at the SurfaceView level only — content rendered inside a SurfaceView is opaque to the View masking system. - Simplify ViewsTest: build the test view tree inline instead of via a custom Activity subclass, idle the looper after setContentView. - Drop ViewHierarchyNodeTest — its type-dispatch coverage is implicit in ViewsTest, which only counts non-zero results when SurfaceView instances are correctly mapped to SurfaceViewHierarchyNode. Co-Authored-By: Claude Opus 4.7 (1M context) * tweaks * fix(replay): Detect window size changes on activities with configChanges Activities that declare android:configChanges="orientation|screenSize|..." (e.g. Unity, fullscreen video players) keep the same root view across rotations, so onRootViewsChanged never fires and determineWindowSize was never re-invoked. The recording bitmap stayed at the pre-rotation size, the rotated window content rendered into wrong-dim bitmaps, and SurfaceView captures composited at stale coordinates. Attach an OnLayoutChangeListener to each tracked root so a same-root resize triggers determineWindowSize. The existing size-comparison guard (both width and height must differ) keeps IME/adjustResize relayouts from causing spurious reconfigurations. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(replay): Avoid windowLocation race and bitmap leak in SurfaceView capture Address two issues flagged by review: 1. windowLocation race — root.getLocationOnScreen(windowLocation) ran on the main thread, but compositeSurfaceViewsAndMask read windowLocation[0]/[1] later from the executor thread. If a new capture cycle started before the compositor ran, the field was overwritten and SurfaceView pixels would composite at the wrong offset. Snapshot into locals (windowX/windowY) at capture time and pass them through, matching the existing svLocation → capturedX/capturedY pattern. 2. Bitmap leak when isClosed in SurfaceView callback — when the strategy closed mid-capture, the path recycled the in-flight svBitmap but skipped onCaptureComplete(), so remaining never reached zero and any sibling bitmaps already stored in captures[] leaked until GC. Now still drive the completion latch on the closed path, and have the compositor's early-return path recycle leftover captures. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(replay): Reconfig on single-dim resizes and recycle SurfaceView bitmap on throw Two review-bot findings: 1. determineWindowSize used && to compare new vs last-known dimensions, so single-dimension resizes (split-screen drag, partial multi-window adjustments, foldable transitions where only one dim shifts) were silently dropped — onWindowSizeChanged only fired when both width AND height differed. The new layout listener already detects single-dim changes with ||, but then delegated to a function that AND'd them away. Switch the existing checks to || so any size delta reconfigs the recorder, matching the listener's intent. 2. In captureSurfaceViews, if PixelCopy.request or getLocationOnScreen threw after svBitmap was allocated, the catch path logged the error but never recycled the bitmap, leaking it until GC. Track the bitmap in a nullable local that the catch block recycles, and clear it after PixelCopy.request returns successfully so ownership transfers to the async callback without double-recycling. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(replay): Ignore layout changes on non-latest root in WindowRecorder rootViews is a stack of windows (dialogs, popups, IME). The recorder binds to the topmost root, so a background activity resizing underneath a dialog must not reconfigure the recorder — we'd otherwise allocate a bitmap sized to the activity while still recording the dialog. The latest root's correct dimensions are already picked up via determineWindowSize in the onRootViewsChanged remove path when the overlaying window dismisses. Co-Authored-By: Claude Opus 4.7 (1M context) --------- Co-authored-by: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 7 + .../android/core/ManifestMetadataReader.java | 11 + .../core/ScreenshotEventProcessor.java | 2 +- .../core/ManifestMetadataReaderTest.kt | 25 ++ .../android/replay/ScreenshotRecorder.kt | 1 + .../sentry/android/replay/WindowRecorder.kt | 53 +++- .../replay/screenshot/PixelCopyStrategy.kt | 237 ++++++++++++++++-- .../io/sentry/android/replay/util/Views.kt | 10 +- .../replay/viewhierarchy/ViewHierarchyNode.kt | 48 ++++ .../screenshot/PixelCopyStrategyTest.kt | 172 +++++++++++++ .../sentry/android/replay/util/ViewsTest.kt | 76 ++++++ sentry/api/sentry.api | 2 + .../java/io/sentry/SentryReplayOptions.java | 34 +++ 13 files changed, 650 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 244d229b994..6b0cdd51337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ### Features +<<<<<<< rz/feat/replay-capture-surface-views +- Session Replay: experimental support for capturing `SurfaceView` content (e.g. Unity, video players, maps) ([#5333](https://github.com/getsentry/sentry-java/pull/5333)) + - To enable, set `options.sessionReplay.isCaptureSurfaceViews = true` + - Or via manifest: `` + - **Warning:** masking granularity is at the SurfaceView level only — the SDK cannot mask individual elements rendered inside the SurfaceView (e.g. native Unity UI, map labels, video frames). Only enable for SurfaceViews whose content is safe to record. +======= - Add `Sentry.feedback()` API for `show()` and `capture()` ([#5349](https://github.com/getsentry/sentry-java/pull/5349)) - `Sentry.showUserFeedbackDialog()` is deprecated in favor of `Sentry.feedback().show()` - `Sentry.captureFeedback()` is deprecated in favor of `Sentry.feedback().capture()` @@ -36,6 +42,7 @@ - Fix shake-to-report not triggering on some devices due to high acceleration threshold ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) - Fix feedback form retaining previous message when shown again via shake ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) - Avoid stack overflow when deserializing large flat JSON objects ([#5361](https://github.com/getsentry/sentry-java/pull/5361)) +>>>>>>> main ### Dependencies diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 6d90bb5ca8e..7dd6f1c1488 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -120,6 +120,8 @@ final class ManifestMetadataReader { static final String REPLAYS_DEBUG = "io.sentry.session-replay.debug"; static final String REPLAYS_SCREENSHOT_STRATEGY = "io.sentry.session-replay.screenshot-strategy"; + static final String REPLAYS_CAPTURE_SURFACE_VIEWS = + "io.sentry.session-replay.capture-surface-views"; static final String REPLAYS_NETWORK_DETAIL_ALLOW_URLS = "io.sentry.session-replay.network-detail-allow-urls"; @@ -547,6 +549,15 @@ static void applyMetadata( } } + options + .getSessionReplay() + .setCaptureSurfaceViews( + readBool( + metadata, + logger, + REPLAYS_CAPTURE_SURFACE_VIEWS, + options.getSessionReplay().isCaptureSurfaceViews())); + // Network Details Configuration if (options.getSessionReplay().getNetworkDetailAllowUrls().isEmpty()) { final @Nullable List allowUrls = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java index 86b13309354..bbef7846cd9 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java @@ -201,7 +201,7 @@ private boolean isMaskingEnabled() { final ViewHierarchyNode rootNode = ViewHierarchyNode.Companion.fromView(rootView, null, 0, options.getScreenshot()); - ViewsKt.traverse(rootView, rootNode, options.getScreenshot(), options.getLogger()); + ViewsKt.traverse(rootView, rootNode, options.getScreenshot(), options.getLogger(), null); return rootNode; } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, "Failed to build view hierarchy", e); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 81b73d5dea7..52cb085b1ee 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -2022,6 +2022,31 @@ class ManifestMetadataReaderTest { ) } + @Test + fun `applyMetadata reads capture-surface-views to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.REPLAYS_CAPTURE_SURFACE_VIEWS to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertTrue(fixture.options.sessionReplay.isCaptureSurfaceViews) + } + + @Test + fun `applyMetadata reads capture-surface-views and keeps default if not found`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertFalse(fixture.options.sessionReplay.isCaptureSurfaceViews) + } + @Test fun `applyMetadata reads anrProfilingSampleRate to options`() { // Arrange diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ScreenshotRecorder.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ScreenshotRecorder.kt index 8cc7bccede3..ce987c24ce8 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ScreenshotRecorder.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ScreenshotRecorder.kt @@ -47,6 +47,7 @@ internal class ScreenshotRecorder( options, config, debugOverlayDrawable, + markContentChanged = { contentChanged.set(true) }, ) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt index ead8e2645ab..19c61900889 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt @@ -17,6 +17,7 @@ import io.sentry.android.replay.util.hasSize import io.sentry.android.replay.util.removeOnPreDrawListenerSafe import io.sentry.util.AutoClosableReentrantLock import java.lang.ref.WeakReference +import java.util.WeakHashMap import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.atomic.AtomicBoolean @@ -33,6 +34,7 @@ internal class WindowRecorder( private val isRecording = AtomicBoolean(false) private val rootViews = ArrayList>() private var lastKnownWindowSize: Point = Point() + private val rootLayoutListeners = WeakHashMap() private val rootViewsLock = AutoClosableReentrantLock() private val capturerLock = AutoClosableReentrantLock() private val backgroundProcessingHandlerLock = AutoClosableReentrantLock() @@ -124,7 +126,9 @@ internal class WindowRecorder( rootViews.add(WeakReference(root)) capturer?.recorder?.bind(root) determineWindowSize(root) + attachLayoutListener(root) } else { + detachLayoutListener(root) capturer?.recorder?.unbind(root) rootViews.removeAll { it.get() == root } @@ -132,6 +136,7 @@ internal class WindowRecorder( if (newRoot != null && root != newRoot) { capturer?.recorder?.bind(newRoot) determineWindowSize(newRoot) + attachLayoutListener(newRoot) } else { Unit // synchronized block wants us to return something lol } @@ -139,9 +144,45 @@ internal class WindowRecorder( } } + /** + * Activities that handle their own configuration changes (e.g. Unity, video players via + * `android:configChanges="orientation|screenSize|..."`) keep the same root view across rotations, + * so [onRootViewsChanged] never fires and [determineWindowSize] would never re-detect the new + * dimensions. Watch the root for layout-time size changes to catch these cases. + */ + private fun attachLayoutListener(root: View) { + if (rootLayoutListeners.containsKey(root)) return + val listener = + View.OnLayoutChangeListener { + v, + left, + top, + right, + bottom, + oldLeft, + oldTop, + oldRight, + oldBottom -> + val width = right - left + val height = bottom - top + val oldWidth = oldRight - oldLeft + val oldHeight = oldBottom - oldTop + if (width == oldWidth && height == oldHeight) return@OnLayoutChangeListener + // ignore non-latest roots so a dialog stays sized for itself, not its background activity. + if (v != rootViews.lastOrNull()?.get()) return@OnLayoutChangeListener + determineWindowSize(v) + } + rootLayoutListeners[root] = listener + root.addOnLayoutChangeListener(listener) + } + + private fun detachLayoutListener(root: View) { + rootLayoutListeners.remove(root)?.let { root.removeOnLayoutChangeListener(it) } + } + fun determineWindowSize(root: View) { if (root.hasSize()) { - if (root.width != lastKnownWindowSize.x && root.height != lastKnownWindowSize.y) { + if (root.width != lastKnownWindowSize.x || root.height != lastKnownWindowSize.y) { lastKnownWindowSize.set(root.width, root.height) windowCallback.onWindowSizeChanged(root.width, root.height) } @@ -157,7 +198,7 @@ internal class WindowRecorder( } if (root.hasSize()) { root.removeOnPreDrawListenerSafe(this) - if (root.width != lastKnownWindowSize.x && root.height != lastKnownWindowSize.y) { + if (root.width != lastKnownWindowSize.x || root.height != lastKnownWindowSize.y) { lastKnownWindowSize.set(root.width, root.height) windowCallback.onWindowSizeChanged(root.width, root.height) } @@ -222,7 +263,13 @@ internal class WindowRecorder( override fun reset() { lastKnownWindowSize.set(0, 0) rootViewsLock.acquire().use { - rootViews.forEach { capturer?.recorder?.unbind(it.get()) } + rootViews.forEach { + val root = it.get() + if (root != null) { + detachLayoutListener(root) + capturer?.recorder?.unbind(root) + } + } rootViews.clear() } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt index ec3f36647c3..81dd7c5cee5 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt @@ -2,7 +2,13 @@ package io.sentry.android.replay.screenshot import android.annotation.SuppressLint import android.graphics.Bitmap +import android.graphics.Canvas import android.graphics.Matrix +import android.graphics.Paint +import android.graphics.PorterDuff +import android.graphics.PorterDuffXfermode +import android.graphics.Rect +import android.graphics.RectF import android.view.PixelCopy import android.view.View import io.sentry.SentryLevel.DEBUG @@ -19,6 +25,7 @@ import io.sentry.android.replay.util.ReplayRunnable import io.sentry.android.replay.util.traverse import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode import java.util.concurrent.atomic.AtomicBoolean +import java.util.concurrent.atomic.AtomicInteger import kotlin.LazyThreadSafetyMode.NONE @SuppressLint("UseKtx") @@ -28,6 +35,9 @@ internal class PixelCopyStrategy( private val options: SentryOptions, private val config: ScreenshotRecorderConfig, private val debugOverlayDrawable: DebugOverlayDrawable, + // Lets the strategy re-arm the recorder's contentChanged gate so frames keep being captured + // when SurfaceViews are present (their redraws don't trigger ViewTreeObserver.OnDrawListener). + private val markContentChanged: () -> Unit = {}, ) : ScreenshotStrategy { private val executor = executorProvider.getExecutor() @@ -40,6 +50,15 @@ internal class PixelCopyStrategy( private val maskRenderer = MaskRenderer() private val contentChanged = AtomicBoolean(false) private val isClosed = AtomicBoolean(false) + private val dstOverPaint by + lazy(NONE) { Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER) } } + private val screenshotCanvas by lazy(NONE) { Canvas(screenshot) } + private val tmpSrcRect = Rect() + private val tmpDstRect = RectF() + private val windowLocation = IntArray(2) + private val svLocation = IntArray(2) + + private class SurfaceViewCapture(val bitmap: Bitmap, val x: Int, val y: Int) @SuppressLint("NewApi") override fun capture(root: View) { @@ -81,31 +100,26 @@ internal class PixelCopyStrategy( // TODO: disableAllMasking here and dont traverse? val viewHierarchy = ViewHierarchyNode.fromView(root, null, 0, options.sessionReplay) - root.traverse(viewHierarchy, options.sessionReplay, options.logger) - - executor.submit( - ReplayRunnable("screenshot_recorder.mask") { - if (isClosed.get() || screenshot.isRecycled) { - options.logger.log(DEBUG, "PixelCopyStrategy is closed, skipping masking") - return@ReplayRunnable - } - - val debugMasks = maskRenderer.renderMasks(screenshot, viewHierarchy, prescaledMatrix) + val surfaceViewNodes = + if (options.sessionReplay.isCaptureSurfaceViews) { + mutableListOf() + } else { + null + } + root.traverse(viewHierarchy, options.sessionReplay, options.logger, surfaceViewNodes) - if (options.replayController.isDebugMaskingOverlayEnabled()) { - mainLooperHandler.post { - if (debugOverlayDrawable.callback == null) { - root.overlay.add(debugOverlayDrawable) - } - debugOverlayDrawable.updateMasks(debugMasks) - root.postInvalidate() - } + if (surfaceViewNodes.isNullOrEmpty()) { + executor.submit( + ReplayRunnable("screenshot_recorder.mask") { + applyMaskingAndNotify(root, viewHierarchy) } - screenshotRecorderCallback?.onScreenshotRecorded(screenshot) - lastCaptureSuccessful.set(true) - contentChanged.set(false) - } - ) + ) + } else { + // Re-arm the recorder's contentChanged gate; SurfaceView redraws don't trigger + // ViewTreeObserver.OnDrawListener, so we'd otherwise emit the same frame forever. + markContentChanged() + captureSurfaceViews(root, surfaceViewNodes, viewHierarchy) + } }, mainLooperHandler.handler, ) @@ -115,6 +129,148 @@ internal class PixelCopyStrategy( } } + private fun applyMaskingAndNotify(root: View, viewHierarchy: ViewHierarchyNode) { + if (isClosed.get() || screenshot.isRecycled) { + options.logger.log(DEBUG, "PixelCopyStrategy is closed, skipping masking") + return + } + + val debugMasks = maskRenderer.renderMasks(screenshot, viewHierarchy, prescaledMatrix) + + if (options.replayController.isDebugMaskingOverlayEnabled()) { + mainLooperHandler.post { + if (debugOverlayDrawable.callback == null) { + root.overlay.add(debugOverlayDrawable) + } + debugOverlayDrawable.updateMasks(debugMasks) + root.postInvalidate() + } + } + screenshotRecorderCallback?.onScreenshotRecorded(screenshot) + lastCaptureSuccessful.set(true) + contentChanged.set(false) + } + + @SuppressLint("NewApi") + private fun captureSurfaceViews( + root: View, + surfaceViewNodes: List, + viewHierarchy: ViewHierarchyNode, + ) { + // Snapshot the window location into locals so the executor-side compositor reads stable + // values even if a new capture cycle starts and overwrites the field. + root.getLocationOnScreen(windowLocation) + val windowX = windowLocation[0] + val windowY = windowLocation[1] + + val captures = arrayOfNulls(surfaceViewNodes.size) + val remaining = AtomicInteger(surfaceViewNodes.size) + + fun onCaptureComplete() { + if (remaining.decrementAndGet() == 0) { + compositeSurfaceViewsAndMask(root, captures, viewHierarchy, windowX, windowY) + } + } + + for ((index, node) in surfaceViewNodes.withIndex()) { + val surfaceView = node.surfaceViewRef.get() + // holder.surface can be null before the surface is created — guard against NPE. + val surface = surfaceView?.holder?.surface + if (surfaceView == null || surface == null || !surface.isValid) { + onCaptureComplete() + continue + } + + var svBitmap: Bitmap? = null + try { + svBitmap = + Bitmap.createBitmap(surfaceView.width, surfaceView.height, Bitmap.Config.ARGB_8888) + val bitmapToCapture = svBitmap + + surfaceView.getLocationOnScreen(svLocation) + val capturedX = svLocation[0] + val capturedY = svLocation[1] + + PixelCopy.request( + surfaceView, + bitmapToCapture, + { copyResult: Int -> + if (isClosed.get()) { + bitmapToCapture.recycle() + // still drive the completion latch so any prior captures get recycled by the + // composite step's early-return path. + onCaptureComplete() + return@request + } + if (copyResult == PixelCopy.SUCCESS) { + captures[index] = SurfaceViewCapture(bitmapToCapture, capturedX, capturedY) + } else { + bitmapToCapture.recycle() + options.logger.log(INFO, "Failed to capture SurfaceView: %d", copyResult) + } + onCaptureComplete() + }, + mainLooperHandler.handler, + ) + // Ownership transferred to the PixelCopy callback — clear local so catch doesn't + // double-recycle if the recycle paths above already ran. + svBitmap = null + } catch (e: Throwable) { + options.logger.log(WARNING, "Failed to capture SurfaceView", e) + svBitmap?.recycle() + onCaptureComplete() + } + } + } + + private fun compositeSurfaceViewsAndMask( + root: View, + captures: Array, + viewHierarchy: ViewHierarchyNode, + windowX: Int, + windowY: Int, + ) { + executor.submit( + ReplayRunnable("screenshot_recorder.composite") { + if (isClosed.get() || screenshot.isRecycled) { + options.logger.log(DEBUG, "PixelCopyStrategy is closed, skipping compositing") + recycleCaptures(captures) + return@ReplayRunnable + } + + for (capture in captures) { + if (capture == null) continue + if (capture.bitmap.isRecycled) continue + + compositeSurfaceViewInto( + screenshotCanvas, + dstOverPaint, + tmpSrcRect, + tmpDstRect, + capture.bitmap, + capture.x, + capture.y, + windowX, + windowY, + config.scaleFactorX, + config.scaleFactorY, + ) + capture.bitmap.recycle() + } + + applyMaskingAndNotify(root, viewHierarchy) + } + ) + } + + private fun recycleCaptures(captures: Array) { + for (capture in captures) { + if (capture != null && !capture.bitmap.isRecycled) { + capture.bitmap.recycle() + } + } + } + override fun onContentChanged() { contentChanged.set(true) } @@ -148,3 +304,38 @@ internal class PixelCopyStrategy( ) } } + +/** + * Composites [sourceBitmap] (a SurfaceView capture) onto [destCanvas] (wrapping the recording + * screenshot) using [destPaint] (expected to have DST_OVER xfermode), so the SurfaceView content + * draws _behind_ existing Window content — filling the transparent holes the Window PixelCopy + * leaves where SurfaceViews are. + * + * Extracted for testability — the compositing is pure drawing logic that can be driven with + * hand-built bitmaps, while the surrounding [PixelCopyStrategy.captureSurfaceViews] flow depends on + * a real SurfaceView producer that Robolectric cannot provide. + */ +internal fun compositeSurfaceViewInto( + destCanvas: Canvas, + destPaint: Paint, + tmpSrc: Rect, + tmpDst: RectF, + sourceBitmap: Bitmap, + sourceX: Int, + sourceY: Int, + windowX: Int, + windowY: Int, + scaleFactorX: Float, + scaleFactorY: Float, +) { + val left = (sourceX - windowX) * scaleFactorX + val top = (sourceY - windowY) * scaleFactorY + tmpSrc.set(0, 0, sourceBitmap.width, sourceBitmap.height) + tmpDst.set( + left, + top, + left + sourceBitmap.width * scaleFactorX, + top + sourceBitmap.height * scaleFactorY, + ) + destCanvas.drawBitmap(sourceBitmap, tmpSrc, tmpDst, destPaint) +} diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt index d0583cdaa6a..cacd2b1c217 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Views.kt @@ -38,6 +38,7 @@ internal fun View.traverse( parentNode: ViewHierarchyNode, options: SentryMaskingOptions, logger: ILogger, + surfaceViewNodes: MutableList? = null, ) { if (this !is ViewGroup) { return @@ -59,7 +60,14 @@ internal fun View.traverse( if (child != null) { val childNode = ViewHierarchyNode.fromView(child, parentNode, indexOfChild(child), options) childNodes.add(childNode) - child.traverse(childNode, options, logger) + if ( + surfaceViewNodes != null && + childNode is ViewHierarchyNode.SurfaceViewHierarchyNode && + childNode.isVisible + ) { + surfaceViewNodes.add(childNode) + } + child.traverse(childNode, options, logger, surfaceViewNodes) } } parentNode.children = childNodes diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt index f54fa79da10..e55ba659a8e 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ViewHierarchyNode.kt @@ -3,6 +3,7 @@ package io.sentry.android.replay.viewhierarchy import android.annotation.SuppressLint import android.annotation.TargetApi import android.graphics.Rect +import android.view.SurfaceView import android.view.View import android.view.ViewParent import android.widget.ImageView @@ -15,6 +16,7 @@ import io.sentry.android.replay.util.isMaskable import io.sentry.android.replay.util.isVisibleToUser import io.sentry.android.replay.util.toOpaque import io.sentry.android.replay.util.totalPaddingTopSafe +import java.lang.ref.WeakReference @SuppressLint("UseRequiresApi") @TargetApi(26) @@ -121,6 +123,34 @@ internal sealed class ViewHierarchyNode( visibleRect, ) + class SurfaceViewHierarchyNode( + val surfaceViewRef: WeakReference, + x: Float, + y: Float, + width: Int, + height: Int, + elevation: Float, + distance: Int, + parent: ViewHierarchyNode? = null, + shouldMask: Boolean = false, + isImportantForContentCapture: Boolean = false, + isVisible: Boolean = false, + visibleRect: Rect? = null, + ) : + ViewHierarchyNode( + x, + y, + width, + height, + elevation, + distance, + parent, + shouldMask, + isImportantForContentCapture, + isVisible, + visibleRect, + ) + /** * Basically replicating this: * https://developer.android.com/reference/android/view/View#isImportantForContentCapture() but @@ -379,6 +409,24 @@ internal sealed class ViewHierarchyNode( visibleRect = visibleRect, ) } + + is SurfaceView -> { + parent?.setImportantForCaptureToAncestors(true) + return SurfaceViewHierarchyNode( + surfaceViewRef = WeakReference(view), + x = view.x, + y = view.y, + width = view.width, + height = view.height, + elevation = (parent?.elevation ?: 0f) + view.elevation, + distance = distance, + parent = parent, + shouldMask = shouldMask, + isImportantForContentCapture = true, + isVisible = isVisible, + visibleRect = visibleRect, + ) + } } return GenericViewHierarchyNode( diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt index 29a3089e686..277ad941a14 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt @@ -1,9 +1,19 @@ package io.sentry.android.replay.screenshot import android.app.Activity +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Paint +import android.graphics.PorterDuff +import android.graphics.PorterDuffXfermode +import android.graphics.Rect +import android.graphics.RectF import android.os.Bundle import android.os.Handler import android.os.Looper +import android.view.SurfaceView +import android.widget.FrameLayout import android.widget.LinearLayout import android.widget.LinearLayout.LayoutParams import android.widget.TextView @@ -15,21 +25,27 @@ import io.sentry.android.replay.ScreenshotRecorderConfig import io.sentry.android.replay.util.DebugOverlayDrawable import io.sentry.android.replay.util.MainLooperHandler import java.util.concurrent.ScheduledExecutorService +import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicReference import kotlin.test.BeforeTest import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertTrue import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.doAnswer import org.mockito.kotlin.mock +import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.robolectric.Robolectric.buildActivity import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config +import org.robolectric.annotation.GraphicsMode import org.robolectric.shadows.ShadowPixelCopy @Config(shadows = [ShadowPixelCopy::class], sdk = [30]) +@GraphicsMode(GraphicsMode.Mode.NATIVE) @RunWith(AndroidJUnit4::class) class PixelCopyStrategyTest { @@ -38,6 +54,7 @@ class PixelCopyStrategyTest { val callback = mock() val debugOverlayDrawable = mock() val config = ScreenshotRecorderConfig(100, 100, 1f, 1f, 1, 1000) + val contentChangedMarked = AtomicBoolean(false) fun getSut(executor: ScheduledExecutorService = mock()): PixelCopyStrategy { return PixelCopyStrategy( @@ -52,8 +69,21 @@ class PixelCopyStrategyTest { options, config, debugOverlayDrawable, + markContentChanged = { contentChangedMarked.set(true) }, ) } + + /** Executor mock that runs submitted tasks synchronously on the calling thread. */ + fun inlineExecutor(): ScheduledExecutorService { + return mock { + doAnswer { + (it.arguments[0] as Runnable).run() + null // submit(Runnable) returns Future; returning Unit breaks the cast + } + .whenever(mock) + .submit(any()) + } + } } private val fixture = Fixture() @@ -101,6 +131,125 @@ class PixelCopyStrategyTest { if (failure.get() != null) throw failure.get() } + + @Test + fun `capture does not call markContentChanged when option is disabled`() { + val activity = buildActivity(ActivityWithSurfaceView::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + + // Default: isCaptureSurfaceViews = false + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + strategy.capture(activity.get().findViewById(android.R.id.content)) + shadowOf(Looper.getMainLooper()).idle() + + assertFalse(fixture.contentChangedMarked.get()) + assertTrue(strategy.lastCaptureSuccessful()) + verify(fixture.callback).onScreenshotRecorded(any()) + } + + @Test + fun `capture re-arms contentChanged when option is enabled and SurfaceView is present`() { + val activity = buildActivity(ActivityWithSurfaceView::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + + fixture.options.sessionReplay.isCaptureSurfaceViews = true + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + strategy.capture(activity.get().findViewById(android.R.id.content)) + shadowOf(Looper.getMainLooper()).idle() + + assertTrue(fixture.contentChangedMarked.get()) + } + + @Test + fun `capture completes when SurfaceView surface is not valid`() { + // In Robolectric the SurfaceView holder surface is not valid — this exercises the + // `surfaceView.holder.surface.isValid == false` branch: each SurfaceView skips its + // PixelCopy and onCaptureComplete still fires, eventually running the compositor and + // callback. + val activity = buildActivity(ActivityWithSurfaceView::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + fixture.options.sessionReplay.isCaptureSurfaceViews = true + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + strategy.capture(activity.get().findViewById(android.R.id.content)) + shadowOf(Looper.getMainLooper()).idle() + + assertTrue(strategy.lastCaptureSuccessful()) + verify(fixture.callback).onScreenshotRecorded(any()) + } + + @Test + fun `compositeSurfaceViewInto draws source behind existing destination with DST_OVER`() { + // Destination ("Window capture"): 100x100, opaque red in the top half, + // fully transparent in the bottom half (the "hole" where the SurfaceView sits). + val dest = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888) + val destCanvas = Canvas(dest) + destCanvas.drawColor(Color.RED) + val clearPaint = Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR) } + destCanvas.drawRect(0f, 50f, 100f, 100f, clearPaint) + + // Source ("SurfaceView capture"): 100x50, solid blue — matches the hole. + val source = Bitmap.createBitmap(100, 50, Bitmap.Config.ARGB_8888) + source.eraseColor(Color.BLUE) + + val dstOverPaint = Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER) } + compositeSurfaceViewInto( + destCanvas = destCanvas, + destPaint = dstOverPaint, + tmpSrc = Rect(), + tmpDst = RectF(), + sourceBitmap = source, + sourceX = 0, + sourceY = 50, + windowX = 0, + windowY = 0, + scaleFactorX = 1f, + scaleFactorY = 1f, + ) + + // Top region: still red (DST_OVER must not overwrite existing opaque pixels). + assertEquals(Color.RED, dest.getPixel(50, 10)) + assertEquals(Color.RED, dest.getPixel(50, 49)) + // Bottom region: now blue (source filled the transparent hole). + assertEquals(Color.BLUE, dest.getPixel(50, 50)) + assertEquals(Color.BLUE, dest.getPixel(99, 99)) + } + + @Test + fun `compositeSurfaceViewInto respects scale factors and window offset`() { + // Destination is 50x50 (scaled recording), fully transparent. + val dest = Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888) + val destCanvas = Canvas(dest) + + // Source is 40x40, solid green; its on-screen location is (20, 20). + val source = Bitmap.createBitmap(40, 40, Bitmap.Config.ARGB_8888) + source.eraseColor(Color.GREEN) + + val dstOverPaint = Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER) } + compositeSurfaceViewInto( + destCanvas = destCanvas, + destPaint = dstOverPaint, + tmpSrc = Rect(), + tmpDst = RectF(), + sourceBitmap = source, + sourceX = 20, + sourceY = 20, + windowX = 10, // window is at (10, 10) + windowY = 10, + scaleFactorX = 0.5f, // 0.5x scale → destination coords halve + scaleFactorY = 0.5f, + ) + + // Expected destination rect: ((20-10)*0.5, (20-10)*0.5) = (5, 5), size 40*0.5 = 20x20 + // → occupies pixels [5..25) × [5..25). Check inside, on the edge, and just outside. + assertEquals(Color.GREEN, dest.getPixel(5, 5)) + assertEquals(Color.GREEN, dest.getPixel(15, 15)) + assertEquals(Color.GREEN, dest.getPixel(24, 24)) + // Just outside the rect — still transparent. + assertEquals(0, dest.getPixel(4, 4)) + assertEquals(0, dest.getPixel(25, 25)) + } } private class SimpleActivity : Activity() { @@ -123,3 +272,26 @@ private class SimpleActivity : Activity() { setContentView(linearLayout) } } + +private class ActivityWithSurfaceView : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val root = + FrameLayout(this).apply { + setBackgroundColor(android.R.color.white) + layoutParams = + FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, + FrameLayout.LayoutParams.MATCH_PARENT, + ) + } + root.addView( + TextView(this).apply { + text = "Overlay" + layoutParams = FrameLayout.LayoutParams(200, 50) + } + ) + root.addView(SurfaceView(this).apply { layoutParams = FrameLayout.LayoutParams(200, 200) }) + setContentView(root) + } +} diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/util/ViewsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/ViewsTest.kt index 530c124af4f..2eaa8411cfe 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/util/ViewsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/util/ViewsTest.kt @@ -1,15 +1,36 @@ package io.sentry.android.replay.util +import android.app.Activity +import android.os.Looper +import android.view.SurfaceView import android.view.View +import android.widget.FrameLayout +import android.widget.FrameLayout.LayoutParams +import android.widget.TextView import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.NoOpLogger +import io.sentry.SentryReplayOptions +import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode +import kotlin.test.BeforeTest import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue import org.junit.runner.RunWith +import org.robolectric.Robolectric.buildActivity +import org.robolectric.Shadows.shadowOf @RunWith(AndroidJUnit4::class) class ViewsTest { + + @BeforeTest + fun setup() { + // Required so Robolectric reports the activity window as visible; otherwise + // View.isVisibleToUser() returns false and SurfaceView nodes are skipped. + System.setProperty("robolectric.areWindowsMarkedVisible", "true") + } + @Test fun `hasSize returns true for positive values`() { val view = View(ApplicationProvider.getApplicationContext()) @@ -33,4 +54,59 @@ class ViewsTest { view.bottom = -1 assertFalse(view.hasSize()) } + + @Test + fun `traverse collects visible SurfaceView nodes when a list is supplied`() { + val (root, _) = buildSurfaceViewHierarchy() + val rootNode = ViewHierarchyNode.fromView(root, null, 0, SentryReplayOptions(false, null)) + val collected = mutableListOf() + + root.traverse(rootNode, SentryReplayOptions(false, null), NoOpLogger.getInstance(), collected) + + assertEquals(2, collected.size) + } + + @Test + fun `traverse does not collect SurfaceView nodes when list parameter is null`() { + val (root, _) = buildSurfaceViewHierarchy() + val rootNode = ViewHierarchyNode.fromView(root, null, 0, SentryReplayOptions(false, null)) + + root.traverse(rootNode, SentryReplayOptions(false, null), NoOpLogger.getInstance(), null) + } + + @Test + fun `traverse skips invisible SurfaceViews`() { + val (root, surfaceViews) = buildSurfaceViewHierarchy() + surfaceViews.first().visibility = View.GONE + + val rootNode = ViewHierarchyNode.fromView(root, null, 0, SentryReplayOptions(false, null)) + val collected = mutableListOf() + + root.traverse(rootNode, SentryReplayOptions(false, null), NoOpLogger.getInstance(), collected) + + assertEquals(1, collected.size) + } + + /** + * Builds and attaches a small view tree: `FrameLayout(SurfaceView, TextView, FrameLayout( + * SurfaceView))`. Returns the root [FrameLayout] and the two [SurfaceView]s in tree order so + * tests can mutate visibility without re-walking the hierarchy. + */ + private fun buildSurfaceViewHierarchy(): Pair> { + val activity = buildActivity(Activity::class.java).setup().get() + val sv1 = SurfaceView(activity).apply { layoutParams = LayoutParams(100, 100) } + val sv2 = SurfaceView(activity).apply { layoutParams = LayoutParams(50, 50) } + val nested = FrameLayout(activity).apply { addView(sv2) } + val root = + FrameLayout(activity).apply { + layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) + addView(sv1) + addView(TextView(activity).apply { text = "label" }) + addView(nested) + } + activity.setContentView(root) + // Flush the layout/attach pass so isAttachedToWindow / visibility computations are accurate. + shadowOf(Looper.getMainLooper()).idle() + return root to listOf(sv1, sv2) + } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 13dfd6b9b39..a433abbb37c 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -4069,12 +4069,14 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun getSessionDuration ()J public fun getSessionSampleRate ()Ljava/lang/Double; public fun getSessionSegmentDuration ()J + public fun isCaptureSurfaceViews ()Z public fun isDebug ()Z public fun isNetworkCaptureBodies ()Z public fun isSessionReplayEnabled ()Z public fun isSessionReplayForErrorsEnabled ()Z public fun isTrackConfiguration ()Z public fun setBeforeErrorSampling (Lio/sentry/SentryReplayOptions$BeforeErrorSamplingCallback;)V + public fun setCaptureSurfaceViews (Z)V public fun setDebug (Z)V public fun setMaskAllImages (Z)V public fun setMaskAllText (Z)V diff --git a/sentry/src/main/java/io/sentry/SentryReplayOptions.java b/sentry/src/main/java/io/sentry/SentryReplayOptions.java index d4e0fd257cd..6eb4a58e1c2 100644 --- a/sentry/src/main/java/io/sentry/SentryReplayOptions.java +++ b/sentry/src/main/java/io/sentry/SentryReplayOptions.java @@ -146,6 +146,20 @@ public enum SentryReplayQuality { @ApiStatus.Experimental private @NotNull ScreenshotStrategyType screenshotStrategy = ScreenshotStrategyType.PIXEL_COPY; + /** + * Whether to capture SurfaceView content (e.g. Unity, video players, maps) during replay + * recording. When enabled, each SurfaceView in the view hierarchy will be captured separately via + * PixelCopy and composited onto the screenshot. Only applies when {@link #screenshotStrategy} is + * {@link ScreenshotStrategyType#PIXEL_COPY}. Default is disabled. + * + *

Warning: the SDK cannot mask individual elements rendered inside a SurfaceView (e.g. + * native Unity UI, map labels, video frames) — masking granularity is at the SurfaceView level + * only. If the SurfaceView is configured to be masked, the entire region is redacted; otherwise + * its full pixel content is sent in the replay. Only enable this for SurfaceViews whose content + * is safe to record. + */ + @ApiStatus.Experimental private boolean captureSurfaceViews = false; + /** * Capture request and response details for XHR and fetch requests that match the given URLs. * Default is empty (network details not collected). @@ -383,6 +397,26 @@ public void setScreenshotStrategy(final @NotNull ScreenshotStrategyType screensh this.screenshotStrategy = screenshotStrategy; } + /** + * Whether SurfaceView capture is enabled. See {@link #captureSurfaceViews}. + * + * @return true if SurfaceView capture is enabled + */ + @ApiStatus.Experimental + public boolean isCaptureSurfaceViews() { + return captureSurfaceViews; + } + + /** + * Enables or disables SurfaceView capture. See {@link #captureSurfaceViews}. + * + * @param captureSurfaceViews true to enable SurfaceView capture + */ + @ApiStatus.Experimental + public void setCaptureSurfaceViews(final boolean captureSurfaceViews) { + this.captureSurfaceViews = captureSurfaceViews; + } + /** * Gets the list of URLs for which network request and response details should be captured. * From 566492415f8cb9a2596b13798f4088f3d5b7f614 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Wed, 6 May 2026 22:12:40 +0200 Subject: [PATCH 138/391] Fix Changelog (#5381) Fix faultly changelog #skip-changelog --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0cdd51337..fba1451f4ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,10 @@ ### Features -<<<<<<< rz/feat/replay-capture-surface-views - Session Replay: experimental support for capturing `SurfaceView` content (e.g. Unity, video players, maps) ([#5333](https://github.com/getsentry/sentry-java/pull/5333)) - To enable, set `options.sessionReplay.isCaptureSurfaceViews = true` - Or via manifest: `` - **Warning:** masking granularity is at the SurfaceView level only — the SDK cannot mask individual elements rendered inside the SurfaceView (e.g. native Unity UI, map labels, video frames). Only enable for SurfaceViews whose content is safe to record. -======= - Add `Sentry.feedback()` API for `show()` and `capture()` ([#5349](https://github.com/getsentry/sentry-java/pull/5349)) - `Sentry.showUserFeedbackDialog()` is deprecated in favor of `Sentry.feedback().show()` - `Sentry.captureFeedback()` is deprecated in favor of `Sentry.feedback().capture()` @@ -42,7 +40,6 @@ - Fix shake-to-report not triggering on some devices due to high acceleration threshold ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) - Fix feedback form retaining previous message when shown again via shake ([#5366](https://github.com/getsentry/sentry-java/pull/5366)) - Avoid stack overflow when deserializing large flat JSON objects ([#5361](https://github.com/getsentry/sentry-java/pull/5361)) ->>>>>>> main ### Dependencies From 6219eb3d898ce527b1024eaa75e6a3ee5e985601 Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Wed, 6 May 2026 20:20:52 +0000 Subject: [PATCH 139/391] release: 8.41.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fba1451f4ae..681753db082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.41.0 ### Features diff --git a/gradle.properties b/gradle.properties index 38ad043eee8..81fdf72ff04 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.40.0 +versionName=8.41.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From eb95dedf76a910ecab60a3764126936bedf0d505 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 7 May 2026 09:18:41 +0200 Subject: [PATCH 140/391] Upload screenshot snapshots to Sentry (#5378) * feat(android-core): Upload screenshot snapshots to Sentry Replace local golden-image comparison in ScreenshotEventProcessorTest with Sentry Snapshots for visual diffing. Screenshots are now generated to build/test-snapshots/ and uploaded via sentry-cli in CI. - Remove local snapshot comparison logic and dropbox-differ dependency - Delete golden images from version control - Add sentry-cli install and upload steps to build.yml - Use PR head SHA checkout for correct base-vs-head diffing Co-Authored-By: Claude Opus 4.6 (1M context) * fix(ci): Use correct Sentry org and project for snapshot upload Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 13 ++++ gradle/libs.versions.toml | 2 +- sentry-android-core/build.gradle.kts | 2 +- .../core/ScreenshotEventProcessorTest.kt | 57 +----------------- .../screenshot_mask_all.png | Bin 2608 -> 0 bytes .../screenshot_mask_custom_view.png | Bin 14948 -> 0 bytes ...eenshot_mask_ellipsized_compose_masked.png | Bin 2917 -> 0 bytes ...nshot_mask_ellipsized_compose_unmasked.png | Bin 20367 -> 0 bytes ...screenshot_mask_ellipsized_view_masked.png | Bin 2331 -> 0 bytes ...reenshot_mask_ellipsized_view_unmasked.png | Bin 16750 -> 0 bytes .../screenshot_mask_images.png | Bin 9353 -> 0 bytes .../screenshot_mask_text.png | Bin 8366 -> 0 bytes .../screenshot_multiline_compose_masked.png | Bin 3272 -> 0 bytes .../screenshot_multiline_compose_unmasked.png | Bin 28628 -> 0 bytes .../screenshot_multiline_view_masked.png | Bin 2924 -> 0 bytes .../screenshot_multiline_view_unmasked.png | Bin 20865 -> 0 bytes .../screenshot_no_masking.png | Bin 14845 -> 0 bytes 17 files changed, 17 insertions(+), 57 deletions(-) delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_view_masked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_view_unmasked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_images.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_text.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_masked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_unmasked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_unmasked.png delete mode 100644 sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_no_masking.png diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 089913c9727..b16444183f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} submodules: 'recursive' - name: Setup Java Version @@ -44,6 +45,18 @@ jobs: - name: Run Tests with coverage and Lint run: make preMerge + - name: Install Sentry CLI + run: curl -sL https://sentry.io/get-cli/ | bash + + - name: Upload Snapshots to Sentry + run: | + sentry-cli build snapshots ./sentry-android-core/build/test-snapshots \ + --app-id sentry-android-core + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: sentry-sdks + SENTRY_PROJECT: sentry-android + - name: Upload coverage to Codecov uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@v4 with: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 50d415c212a..8b7cbee3700 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -247,4 +247,4 @@ msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } okio = { module = "com.squareup.okio:okio", version = "1.13.0" } roboelectric = { module = "org.robolectric:robolectric", version = "4.14" } -dropbox-differ = { module = "com.dropbox.differ:differ-jvm", version = "0.3.0" } + diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index ffd42c7d4d7..f61cec89265 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -108,7 +108,7 @@ dependencies { testImplementation(projects.sentryAndroidReplay) testImplementation(projects.sentryCompose) testImplementation(projects.sentryAndroidNdk) - testImplementation(libs.dropbox.differ) + testImplementation(libs.androidx.activity.compose) testImplementation(libs.androidx.compose.ui) testImplementation(libs.androidx.compose.foundation) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt index 300936153f7..b8e223f08e9 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt @@ -2,8 +2,6 @@ package io.sentry.android.core import android.app.Activity import android.content.Context -import android.graphics.Bitmap -import android.graphics.BitmapFactory import android.graphics.Canvas import android.graphics.Color import android.graphics.drawable.Drawable @@ -31,9 +29,6 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.dropbox.differ.Color as DifferColor -import com.dropbox.differ.Image -import com.dropbox.differ.SimpleImageComparator import io.sentry.Attachment import io.sentry.Hint import io.sentry.MainEventProcessor @@ -66,17 +61,8 @@ import org.robolectric.shadows.ShadowPixelCopy class ScreenshotEventProcessorTest { companion object { - /** - * Set to `true` to record/update golden images for snapshot tests. When `true`, screenshots - * will be saved to src/test/resources/snapshots/{testName}.png. Set back to `false` after - * recording to run comparison tests. - */ - private const val RECORD_SNAPSHOTS = false - private val SNAPSHOTS_DIR = - File("src/test/resources/snapshots/ScreenshotEventProcessorTest").also { - if (RECORD_SNAPSHOTS) it.mkdirs() - } + File("build/test-snapshots/ScreenshotEventProcessorTest").also { it.mkdirs() } } private class Fixture { @@ -507,17 +493,6 @@ class ScreenshotEventProcessorTest { private fun getEvent(): SentryEvent = SentryEvent(Throwable("Throwable")) - /** - * Helper method for snapshot testing. Processes an event and captures a screenshot, then either - * saves it as a golden image (when RECORD_SNAPSHOTS=true) or compares it against an existing - * golden image. - * - * @param testName The name used for the golden image file (without extension) - * @param attachScreenshot Whether to enable screenshot attachment - * @param isReplayAvailable Whether the replay module is available (enables masking) - * @param configureOptions Lambda to configure additional options before processing - * @return The captured screenshot bytes, or null if no screenshot was captured - */ private fun processEventForSnapshots( testName: String, attachScreenshot: Boolean = true, @@ -536,38 +511,10 @@ class ScreenshotEventProcessorTest { val screenshot = hint.screenshot ?: return null val bytes = screenshot.bytes ?: screenshot.byteProvider?.call() ?: return null - val snapshotFile = File(SNAPSHOTS_DIR, "$testName.png") - if (RECORD_SNAPSHOTS) { - snapshotFile.writeBytes(bytes) - println("Recorded snapshot: ${snapshotFile.absolutePath}") - } else if (snapshotFile.exists()) { - val expectedBitmap = BitmapFactory.decodeFile(snapshotFile.absolutePath) - val actualBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) - - val result = - SimpleImageComparator(maxDistance = 0.01f) - .compare(BitmapImage(expectedBitmap), BitmapImage(actualBitmap)) - assertEquals( - 0, - result.pixelDifferences, - "Screenshot does not match golden image: ${snapshotFile.absolutePath}. " + - "Pixel differences: ${result.pixelDifferences}", - ) - } + File(SNAPSHOTS_DIR, "$testName.png").writeBytes(bytes) return bytes } - - /** Adapter to wrap Android Bitmap for use with dropbox/differ library */ - private class BitmapImage(private val bitmap: Bitmap) : Image { - override val height: Int - get() = bitmap.height - - override val width: Int - get() = bitmap.width - - override fun getPixel(x: Int, y: Int): DifferColor = DifferColor(bitmap.getPixel(x, y)) - } } private class CustomView(context: Context) : View(context) { diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_all.png deleted file mode 100644 index aa1ec41ee06c2a1dbbd7292cf8629935c5c9b634..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2608 zcmeHJSx}Q#6#jqy6oLgwt%ig^g42%_faSY5~U;WG$hA4od`N69_5FfCW*9 zQ4mz>Sgi|$6h;yUBrFm{1gZ#xKnQ_}tOAiG34zc*ee*%9Qy+Zjow;-8+~v&qzVqF4 z@0tDH9_DMT)&Kxt?zxw7002Nb+tM^? zAMY@}n-ZPBz`h-|No&+F6f&zLe>K#m_+G6Hkf)wgi!qjvZA3;t1W3>zq7s36ypC?W z5BSCYtwxy#EpEip5?u`Pss#eULpg<0ALrX>QWlBZI1mA3SqRH(%oO55Xgw|D%jwEZ z#7w{sXZl+of$y2ry?zJXcCrWDse?GDYa(*7w&yo->6ZW_KOAQ@CNg!qp^5V)8 zETc&fqSA34y^0=EFnxD3i%ahj8%3azQH_Dsk4$br>c&&6A@dcc8)qr~OUn4mTqgiAJsuIQW!OWs4{-A!=r9Y%EvFpHS$~q|>tb=FNOfddZ4W z&CeU?Cfe>Pf`p=DItwe>IGM8HE!)oDXCHwMT?TorG&70Ko9Kjg=b9U)B}sJXupxLo z#(R=yI96E~{EX@#55Fy!V@w;E>&~-3NeA8gWY+d$Dq&spzJVB|?MvF-Jmqowm zn)aY+CLh{=_KoV~UiZ9n?_C-0`6|_2&$<_s}VR zUbM2hfIjvPK0j3)u2}*o-f4$dR99pkhXA zz-2OLX7C}7Jy`o-KHOsMTCqx{N?x4mgLl*P8s_qfTHb4wqmkty8`}d@z6f)@${SWs zbl=-L;v~kDQq!&Alh}%&hgQtI*todux4OoYOg3_y!sQL^f!KOWhoC%?zC>FdA3HKX zf1);39Rq`g(XdHmE@AXJ(7~!wX;dSB`r6mI&FL-~0)#QZ6cx3z3iVg8X8dmojgO~H zEGe3@anYKtKYZ@>29544Dw*>^#JqeC;PLo;l2`+~IO|lG_A1UFP`BO$0|quEuDk%4%S`U>}s6nCK|RjIh_$Wgq@L>cOLZyJrqvx=8wo3fBrf{F?w*o=Y4S5()w-vn(!@_Y=3I-InvzV?|^P8HQ4x3r#Haoky z;YLSCiOGP4SPIvO4frhRzu(S9B9WLld{B|bBJzoF-G1k*@WI#l<9drUROitCQ-H+y o6OZ)c;{M;;r>)EP&rjJZSjl6n5Eo>4_}2$`?(t^u+(R<|28Xc1xBvhE diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_custom_view.png deleted file mode 100644 index 217c73490cec235b4b9a07fb87fcc4c371a5f406..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14948 zcmeIZWmJ@J+wVVwfTRd0-GWGmbcld}l!6M1ltW5)gMt#$pmazGDqTY}1SLA|G{^CsQ!!y{P80)4}(BhA?nJC&%Dw%XS|bX zM&4gtdCt`P9&JvY&1&J15sl+IsEOf=-An$StO&iyl#r}t#dY%b&1$%%NQe0&swH!- z9!-R5e64m)3hn(8XGJnfj_+UXDg>Jx_kG6dQAdQsN2(-bGeNkcr~}ypS*?*DdIj1U zr%!5rp2DutDl5PKai1u^*1);TUh)k> zO*y6u`4nc$^Y47DnB(R(X=Z?*6E*uXl3_3`P0)ec(gD9ly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aHB z5N4mCU2r5mw6Ow!QaUha=QC+epPijWi;SNMi=}8|&#09wX7gnV`N^zafCl#n@3kAP&8Oha8{5uY9p-_KUu87g#6{KYw51)nH6O z$Nu`T_vv~;-O;SCY9nE?cEJfq?K%Jxz-9;?*A%Dy| zX5`5P_=@>aL&rV=lX^EEEH+o#e0uK+5VOMQzto4#{kld*eITu;$a?SLpqkP=!hbDD zt!?A#>+4%(>COUPEtk9k03gkPX@fXT+1D_YJBIMwz5BJX(GPxf6@nkEh^5{DuLOo( zp+&$Qn4zSGFgqzUY-M#7i&+AC*S}>2;Q1h1fM-g4etWCd8?lR22m_`GlrJnC5#ITR zkdJ}*qd}P|4zNGoz6BAxi(O?;PfrqKQ41)O<$Mu8Qc-?nYXD&`Y(3H@en=^Gv*HL6le9B6 zwmWV~Ddn-o76#-JVe~fdkEOazb{DsGV(=_c4@R*z=#&*59M*W{cJ06ZT+#p5ef|3n zGkHe}t2U5@ZU&c8ut<8 diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_masked.png deleted file mode 100644 index 53e5a236c3e86ca447dd8674c6d046302bd8cda1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2917 zcmeH}c~p~E7QnwOBmsp41ZAW``)|n-23i*zjyCV zw6ZXklsF;*0DvUroRJLxK*-?RheCie2&R<~{6J_n#s)wcS78<$z-a~)I~4dtpxhGx z-~gIpbk;63i$B8lJ7fxL8yBhB6pX7BrelhHO0)Iz`7O5K& z26iAx%D9{A7bXlb*gh=e$p$P=%igvG)Ou1X_oXr}PJQsQ*#7$WGhK2R8NhYD3hnhy zs&;}vD-hzj_E=ngQO2&4Bgg3u(Hu;HPonEBspHMhcP5ZSq<&hFjToa5f1q; zF8yJ$Pot&;YV#M+#0NhAv0yhG7atG<8b*lgqRPt3pAoRdtj;TfH`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wiByPbAg7Xx=5TpbhaIRdRCT9+S*yxB`Zcq9Berzm1~c-%A6Rw zRO(P%(S9vxm~t>Bb5CMfdHt9`xB*71t`1}exThhN+v7$b3>t(Et-PHds`00xA)k<^ zcVK3B#;#O)y-QvQ9Q~qlO#XK`QEi?B%RixBIW~iNNM66tajA*}R0S%1v}k*aR`?ej zV}R7%Q0}4ey}a|M=)FSpXQ2M4e(=NI=p${@|6R0=?vO>6;d>-!z*ZTcd~0D;X5bd{ EZ)r_j+5i9m diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_mask_ellipsized_compose_unmasked.png deleted file mode 100644 index efc2304c4f2db20dc4d7d5ee73a741da009a9001..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20367 zcmeIacRZH;-#>oRAPGfMA){esZzUljq);kCw(M0(k=Za(WJVIo-ZC%60>p}d7^7Zr&_+M;q? z@id7-=UHPX?-Em*Z*f%g0+B z{6Kb^iy_@tT8_&1X}%`K@p#QV#xW8%!`%+~|G!>jxr0K|xQ3cp#+CZs4gp(QhfocZ z-eMOvA5S{+-Mgb*AEpMWJBQNfZ{56k^ZNDc4SNb~K9;(Pl)idpWMVQ?-2UF`_=VtT z3A=6bl-&IMwz+8;&Joek5AV<)cz~bVoSddRGfpZqk9VYV3R_!ScdKVei@!T1?VN9n zcY2nS^FTED<;#fq#l)ovHN@~_gKpxPqCq(n5gJqTfHJFE&cUfg7W-Q{~G@ln>Tm2Pfbn9#mU~#)YlKp z%M<T4DJzZT!12utJg@wv*$x~2ZHB+*6z9ROh3nD6XU`2>sf;- zLXP_k4x0G*`zK%xRC3K*Sar{x`|>{V1l_$i*r0O#WjB7#jA}8w$1E}p4UMe4JVi@O?yq0JW?lJl z@%Y|t`Qseb-QBwkZv5V^6wDg9xOh#k{3eTheAcmryJNFo{P&O>b|&4m_DZL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3H$=!ut)|rjF?E^Q%Xf(PIi90XdwfmOJ9U~(3yH9b3kjVL|kyXR_3u>g?&7~bb zB9M9Ed_8mh_mP8Es|QRcg7l3s`)O9}M~5?qFg+q7qUx%413f()GZz>1Pnez6J8>|=2?sLGGunk*+&ceq6p=zhL*ucTnl+T%=$Y@L$#EE&~7n diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_masked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_masked.png deleted file mode 100644 index fb8f816218d0610b70c51cf01fc4a13ada281590..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3272 zcmeHKdpMN&7k}rnGn0%NR^t{k+H7jYxP+2x3Z+8Cij1LM6ru-}8D{8L;(W22k;i65TFE6?lA*CAg8=soB;Oo^>4rz_$enhZxnb@ zP@xO}P>ywTcJw}7FeYkQ{6RNub(dK+P$(rI4CY=X#t#ti8E?L`o^V<1Bpk(r@vp*2J@Djliz59W;l82os

81hjI$%-Uus@3pzxUy z=T3G2O8ApU40c)fhyejcbJx?Wax9#&Z7(qPo@Sa8k*-U?jtU_U7GX?}+gsy5)%!0@ za^ryGNw?MzgA97eNK~V?0WF@+&)d6Apn_#=^9RPDbki#*(oFUs^DCxsToxIPfoAeV>N>`F*dGWoVau6PVrVmHxI_i`V z8*BD@1c979{uoJVJ*(r-cy;ka+!~`KKDMlyd=e;Uv$-R!g;vWcw5kVvnU5fp`FF=; zuiJ_@cR`xVlRJr)L7=<)Y7@#AXWkqdJJv^_ zIhaQG*Zsgdrvt|t4v&j!Ik_iO0jQv_ru}eik3X7te4?Mn`mjunjxJA}ed_~$N3^Du z*|#Gfj14wj6t%T^f+7+Ur9SoB)9i7%{NbEgRCk!RyI2;*Kv-4<7}pBOo{3uG?$gNE zUYgy`V%h$m%15i};5bJTLwKZe)}dooWB9(N{PyhYvfdrEAO^l-ydnPuSu?80J|P%91N&J?^ZGgrgsx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_multiline_compose_unmasked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_compose_unmasked.png deleted file mode 100644 index dc4beee80a68507a82bce68ebd330f48314fabe5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28628 zcmdqJby!yG+AsQoNC-$NsRDu^h?JCyfOHBX2+|VL-HnnGA|ir-goHHGUD6<-bazO1 z$GOLxYpt{P`PO%?v-dgYpFOY3Yfh%XJH|7f=e~b+kGBd>B=9d$UP7Tz_)?OhiYOGC z5d7)K#)SWanX9k^|3b4>ln_ScbYA-dUtrh@ODSQ)KW^Ci0Vos=N=o#xl2hzTm9y%z zfxYu{aWo=AQNpXgKA9|c-_h;M@VfBCo<+A2Et&a9*%a$x+CXtXPL)SazoMvGqf)N& zh)thq%91^LU7$uCpO>Qf^)$RUZL);)-#tAyW>1JEZT9Zp$H^PYU1;4FvgsT)U9akF zqi`5+zl1{buG3Maxf?x#hUr~r#Hxy}&rVK?E8~TSS+DyN=RN!-3kw=2IbM+OEg?+r zmwDeYT6EZ1NI#({@cbHo5Yu?qeOLYe?1w(k*XHRp>rPa=M{%2ex-w7BFdHr}fJTeq zL+Iq8Q`|*jQWB*8AbpA%9p|Sv%H3Ike*4ws4+K{rSW6S(BFIB@6Y>)gp_r2a3<1i&KV2 zMoI{ah{TKu%D73{U^>nJq_}eR>eR|mfnwA>DolJzpV?V`dPc_jiHVxBG3T6v%qAbz z>Z7GQSz1+;Po6w!>FR3UoN2Z`J8}LP8ChRne__IX|N6MwcE`L!&rRb!7PFjO>zO9& ziQnOj@)i!B!JC}^1#Gq(by2xqUMNL%bs22h*@MlQhVk*Z;}uKKW2)Bnb~+!z4`E@y zR;ty8+bM}R{(Ou7(cFx+zcyC?E#4zzbLgvB5Ft5vz`N@Yg%cHM9zD9QUSc7prFA31 zoQ;hwOEnMuk?Wr5a({MMOiYmH`SHZTe$Dxq{>b<5>_4M8F5I|r<2DA zJgEx|yPB}5-MoJM5H=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ltgad8TFIZxFDM9>s{o(lRO~dQ1WE|? z^ZBx&VSGOa8;IUG1?DU4xG4|XdE!WcFLABF*Ztt#9R>t3czmyC)Z}UjH)JZwl6vs> z&>6*3`tcAk_0nv%;NymKuOpGtU^g{??#!d>=4U4B=lmNCAH5BhpXv%fAW*1B9d^K$ z1a!l2EHjW+iekD7t=>n?56B~_7!?&wInHDroPSU+Thuf0?LQE;iQqf)c__)n?~*R? zKv;-qVnL6Yq1_nDJQ$CQzD|mK!bVIl;WP)ylwi$qU~!;F;JTIt#Hav_?izTT38n%e z+ClKpTQL6;Z;4fW_O_;I+)CiY-N1Dc+_7Uhsyu=Q%SfsPR)sc5s5zCL1PetW)+oI5 z<+2gbk?>ygu<^A)+#Y1cFvzPUxP}{RDc(#u`cIO`hxZJC)7vN~7Tp0JfjlUG$S&dA zj8=dkPP9zIG@~5CdJ8Xg8`cnuZYjh9vUh@Al10P8{3D;IvR!w!nyVE z@p+rspR;4+F|2_Q)kwA4_2jsDbH+Y6`gdKMaYWvNB#B^D(URx~?b9235iUF<$~bav z{Z+WEck#doiCypwUtix#XJ6DpJq0avC7!956H(DHue>+?G0wn%r{?SQ*IGhyv@=%i z^Ad%sH{ZnEM);O*)~YO$+WB`Sr%$W_WH!BJ!@sHOdjHh%e~N!;3}n(7w63b2|M#iz vFaG|&Iz0aK$Ntx8`kxE(|8PO3q&A diff --git a/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png b/sentry-android-core/src/test/resources/snapshots/ScreenshotEventProcessorTest/screenshot_multiline_view_masked.png deleted file mode 100644 index 373752de30f95ef642b961822be5ddcdbdeb9cba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2924 zcmeHJc~nzZ9)5WV5Y}W6F%4T_1W^!BSu_fSUBqZaR0t5+oU)XovdSKi5u_|~T8ITR zU>OW3OIQSKSOQ3K#7KY;c7dV=jFcq^fwIhtwdb_VbWTtInm>BadFOZT@4b7!d%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son Osacky Date: Fri, 8 May 2026 14:18:33 +0200 Subject: [PATCH 141/391] chore: Add Dependabot (#5380) * chore(deps): Add Dependabot for Gradle plugins Co-Authored-By: Claude Opus 4.6 (1M context) * chore(deps): Exclude Spring Boot from Dependabot Co-Authored-By: Claude Opus 4.6 (1M context) * chore(deps): Add commit message prefix for Dependabot Co-Authored-By: Claude Opus 4.6 (1M context) * chore(deps): Set dependabot to weekly and add dependency grouping Switch both gradle and github-actions ecosystems from daily to weekly. Group related dependencies so they're updated together in single PRs (androidx, compose, kotlin, spring, opentelemetry, graphql, jackson, and all github-actions). Co-Authored-By: Claude Opus 4.6 (1M context) * fixup: Remove gradle dependency groups, keep only gh-actions group Co-Authored-By: Claude Opus 4.6 (1M context) * chore(deps): Add gradle dependency groups for androidx, compose, kotlin, jackson Co-Authored-By: Claude Opus 4.6 (1M context) * chore(deps): Set dependabot to daily and reorder compose group Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .github/dependabot.yml | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b88a67a7f0c..10325576354 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,43 @@ version: 2 +registries: + gradle-plugin-portal: + type: maven-repository + url: https://plugins.gradle.org/m2 + username: dummy # Required by dependabot + password: dummy # Required by dependabot updates: + - package-ecosystem: "gradle" + directory: "/" + registries: + - gradle-plugin-portal + schedule: + interval: "daily" + ignore: + - dependency-name: "org.springframework.boot*" + commit-message: + prefix: "chore(deps)" + groups: + compose: + patterns: + - "androidx.compose*" + - "org.jetbrains.compose*" + androidx: + patterns: + - "androidx.*" + kotlin: + patterns: + - "org.jetbrains.kotlin*" + - "org.jetbrains.kotlinx*" + jackson: + patterns: + - "com.fasterxml.jackson*" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: weekly + interval: "daily" + commit-message: + prefix: "chore(deps)" + groups: + github-actions: + patterns: + - "*" From ae06e700a1ace0e5063d0dced160f25f2757bedb Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 11 May 2026 09:15:05 +0200 Subject: [PATCH 142/391] fix(android): Declare test-snapshots as task output for cache compatibility (#5396) * fix(android): Declare test-snapshots as task output for cache compatibility The screenshot snapshot PNGs written by ScreenshotEventProcessorTest are not declared as outputs of testDebugUnitTest. When the task result comes from the Gradle remote cache, the test code never runs and the directory is never created, so sentry-cli finds an empty folder and uploads nothing. Declaring the directory as a task output ensures Gradle caches and restores the snapshots on cache hits. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code --------- Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Sentry Github Bot --- sentry-android-core/build.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index f61cec89265..abcca4f8833 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -70,6 +70,13 @@ tasks.withType().configureEach { } } +// Snapshot PNGs are written by ScreenshotEventProcessorTest at runtime but must be declared as +// outputs so Gradle's build cache restores them on cache hits (otherwise the CLI upload step +// finds an empty directory). +tasks + .matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" } + .configureEach { outputs.dir(layout.buildDirectory.dir("test-snapshots")) } + dependencies { api(projects.sentry) compileOnly(libs.jetbrains.annotations) From f829d5acb53476f24789dacba5cbfe4d0b2d0b7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 10:42:48 +0200 Subject: [PATCH 143/391] chore(deps): bump the github-actions group across 1 directory with 5 updates (#5395) Bumps the github-actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [phoenix-actions/test-reporting](https://github.com/phoenix-actions/test-reporting) | `15` | `16` | | [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) | `2.26.2` | `2.26.3` | | [github/codeql-action](https://github.com/github/codeql-action) | `4.35.2` | `4.35.4` | | [saucelabs/saucectl-run-action](https://github.com/saucelabs/saucectl-run-action) | `4.3.0` | `4.4.0` | | [getsentry/craft](https://github.com/getsentry/craft) | `2.26.2` | `2.26.3` | Updates `phoenix-actions/test-reporting` from 15 to 16 - [Release notes](https://github.com/phoenix-actions/test-reporting/releases) - [Changelog](https://github.com/phoenix-actions/test-reporting/blob/main/CHANGELOG.md) - [Commits](https://github.com/phoenix-actions/test-reporting/compare/f957cd93fc2d848d556fa0d03c57bc79127b6b5e...7317eea6e13c47348dd0bb318669485157c518d6) Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.2 to 2.26.3 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/3dc647fee3586e57c7c31eb900fdec7cbb44f23f...bae212ca7aec50bb716eafd387c80bcfb28da937) Updates `github/codeql-action` from 4.35.2 to 4.35.4 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/95e58e9a2cdfd71adc6e0353d5c52f41a045d225...68bde559dea0fdcac2102bfdf6230c5f70eb485e) Updates `saucelabs/saucectl-run-action` from 4.3.0 to 4.4.0 - [Release notes](https://github.com/saucelabs/saucectl-run-action/releases) - [Commits](https://github.com/saucelabs/saucectl-run-action/compare/39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8...bc81720eb01738d9c664b07fe42621bd0014283f) Updates `getsentry/craft` from 2.26.2 to 2.26.3 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/3dc647fee3586e57c7c31eb900fdec7cbb44f23f...bae212ca7aec50bb716eafd387c80bcfb28da937) --- updated-dependencies: - dependency-name: getsentry/craft dependency-version: 2.26.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action dependency-version: 4.35.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: phoenix-actions/test-reporting dependency-version: '16' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: saucelabs/saucectl-run-action dependency-version: 4.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 33ba8ae93e8..df0b0ebca3c 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -103,7 +103,7 @@ jobs: **/build/outputs/mapping/release/* - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit AGP ${{ matrix.agp }} - Integrations ${{ matrix.integrations }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b16444183f5..f5e89b2be40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,7 +73,7 @@ jobs: **/build/reports/* - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit Build diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index 64e68738b2e..4d5a78a4114 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@3dc647fee3586e57c7c31eb900fdec7cbb44f23f # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@bae212ca7aec50bb716eafd387c80bcfb28da937 # v2 secrets: inherit diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index acb0483b5ba..ae8d78d305e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # pin@v2 + uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # pin@v2 + uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v2 diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index b5457751809..2f5a63f747a 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -48,7 +48,7 @@ jobs: run: make assembleBenchmarks - name: Run All Tests in SauceLab - uses: saucelabs/saucectl-run-action@39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8 # pin@v3 + uses: saucelabs/saucectl-run-action@bc81720eb01738d9c664b07fe42621bd0014283f # pin@v3 if: github.event_name != 'pull_request' && env.SAUCE_USERNAME != null env: GITHUB_TOKEN: ${{ github.token }} @@ -58,7 +58,7 @@ jobs: config-file: .sauce/sentry-uitest-android-benchmark.yml - name: Run one test in SauceLab - uses: saucelabs/saucectl-run-action@39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8 # pin@v3 + uses: saucelabs/saucectl-run-action@bc81720eb01738d9c664b07fe42621bd0014283f # pin@v3 if: github.event_name == 'pull_request' && env.SAUCE_USERNAME != null env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index bbaaa88f53a..0549577f629 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -43,7 +43,7 @@ jobs: run: make assembleUiTests - name: Install SauceLabs CLI - uses: saucelabs/saucectl-run-action@39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8 # pin@v4.3.0 + uses: saucelabs/saucectl-run-action@bc81720eb01738d9c664b07fe42621bd0014283f # pin@v4.4.0 env: GITHUB_TOKEN: ${{ github.token }} with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66776935d9e..8464e8d0399 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@3dc647fee3586e57c7c31eb900fdec7cbb44f23f # v2 + uses: getsentry/craft@bae212ca7aec50bb716eafd387c80bcfb28da937 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index dfe742087d6..38aaacec27a 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -160,7 +160,7 @@ jobs: spring-server.txt - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit Spring Boot 2.x ${{ matrix.springboot-version }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 577f0144179..629535e282d 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -160,7 +160,7 @@ jobs: spring-server.txt - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit Spring Boot 3.x ${{ matrix.springboot-version }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 5246cf90cdd..bbd4f986d96 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -160,7 +160,7 @@ jobs: spring-server.txt - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit Spring Boot 4.x ${{ matrix.springboot-version }} diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 321d6ae5652..007fe575d14 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -162,7 +162,7 @@ jobs: spring-server.txt - name: Test Report - uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # pin@v15 + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 if: always() with: name: JUnit System Tests ${{ matrix.sample }} From d3b16ee7f4aaffbc53e65ad762c3194e7c6718a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 10:43:04 +0200 Subject: [PATCH 144/391] chore(deps): bump com.launchdarkly:launchdarkly-java-server-sdk (#5394) Bumps [com.launchdarkly:launchdarkly-java-server-sdk](https://github.com/launchdarkly/java-core) from 7.10.2 to 7.13.4. - [Release notes](https://github.com/launchdarkly/java-core/releases) - [Commits](https://github.com/launchdarkly/java-core/compare/launchdarkly-java-server-sdk-7.10.2...launchdarkly-java-server-sdk-7.13.4) --- updated-dependencies: - dependency-name: com.launchdarkly:launchdarkly-java-server-sdk dependency-version: 7.13.4 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8b7cbee3700..ab39c981b44 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -122,7 +122,7 @@ kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutine ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktorClient" } ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktorClient" } launchdarkly-android = { module = "com.launchdarkly:launchdarkly-android-client-sdk", version = "5.9.2" } -launchdarkly-server = { module = "com.launchdarkly:launchdarkly-java-server-sdk", version = "7.10.2" } +launchdarkly-server = { module = "com.launchdarkly:launchdarkly-java-server-sdk", version = "7.13.4" } log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j2" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j2" } leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.14" } From 48277cdf92e11f1b1956f117735957b4bdf7008b Mon Sep 17 00:00:00 2001 From: Stefan Jandl Date: Mon, 11 May 2026 11:28:44 +0200 Subject: [PATCH 145/391] feat: added `ANR_REPORT_HISTORICAL` to the `ManifestMetaDataReader` (#5387) --- CHANGELOG.md | 6 +++++ .../android/core/ManifestMetadataReader.java | 4 +++ .../core/ManifestMetadataReaderTest.kt | 25 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 681753db082..ceda85d8b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Features + +- Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) + ## 8.41.0 ### Features diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 7dd6f1c1488..b52634774d6 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -33,6 +33,7 @@ final class ManifestMetadataReader { static final String ANR_REPORT_DEBUG = "io.sentry.anr.report-debug"; static final String ANR_TIMEOUT_INTERVAL_MILLIS = "io.sentry.anr.timeout-interval-millis"; static final String ANR_ATTACH_THREAD_DUMPS = "io.sentry.anr.attach-thread-dumps"; + static final String ANR_REPORT_HISTORICAL = "io.sentry.anr.report-historical"; static final String TOMBSTONE_ENABLE = "io.sentry.tombstone.enable"; @@ -254,6 +255,9 @@ static void applyMetadata( options.setAttachAnrThreadDump( readBool(metadata, logger, ANR_ATTACH_THREAD_DUMPS, options.isAttachAnrThreadDump())); + options.setReportHistoricalAnrs( + readBool(metadata, logger, ANR_REPORT_HISTORICAL, options.isReportHistoricalAnrs())); + final @Nullable String dsn = readString(metadata, logger, DSN, options.getDsn()); final boolean enabled = readBool(metadata, logger, ENABLE_SENTRY, options.isEnabled()); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 52cb085b1ee..cedf5ca18bb 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -288,6 +288,31 @@ class ManifestMetadataReaderTest { assertEquals(false, fixture.options.isAttachAnrThreadDump) } + @Test + fun `applyMetadata reads anr report historical to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.ANR_REPORT_HISTORICAL to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(true, fixture.options.isReportHistoricalAnrs) + } + + @Test + fun `applyMetadata reads anr report historical to options and keeps default`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(false, fixture.options.isReportHistoricalAnrs) + } + @Test fun `applyMetadata reads activity breadcrumbs to options`() { // Arrange From f26c741ed9ebb9d0647921f474fcea33f92d743f Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 12 May 2026 10:04:34 +0200 Subject: [PATCH 146/391] chore: Remove dependabot grouping for gradle deps (#5406) Keep only the github-actions grouping. Individual PRs for gradle dependencies make it easier to review and merge them independently. Co-authored-by: Claude Opus 4.6 (1M context) --- .github/dependabot.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 10325576354..2824699563c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,21 +16,6 @@ updates: - dependency-name: "org.springframework.boot*" commit-message: prefix: "chore(deps)" - groups: - compose: - patterns: - - "androidx.compose*" - - "org.jetbrains.compose*" - androidx: - patterns: - - "androidx.*" - kotlin: - patterns: - - "org.jetbrains.kotlin*" - - "org.jetbrains.kotlinx*" - jackson: - patterns: - - "com.fasterxml.jackson*" - package-ecosystem: "github-actions" directory: "/" schedule: From e0bd00576b1905a3ec3b37b97861eddc35dd4529 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 08:34:43 +0000 Subject: [PATCH 147/391] chore(deps): bump urllib3 in the uv group across 1 directory (#5405) Bumps the uv group with 1 update in the / directory: [urllib3](https://github.com/urllib3/urllib3). Updates `urllib3` from 2.6.3 to 2.7.0 - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.6.3...2.7.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.7.0 dependency-type: direct:production dependency-group: uv ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ace4a3e0374..8bdd5f892df 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ certifi==2025.7.14 charset-normalizer==3.4.2 idna==3.10 requests==2.33.0 -urllib3==2.6.3 +urllib3==2.7.0 From 16da8b8f402c9c3fa5915c9093dbade965ec42c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 08:46:32 +0000 Subject: [PATCH 148/391] chore(deps): bump spotless from 7.0.4 to 8.4.0 (#5411) * chore(deps): bump spotless from 7.0.4 to 8.4.0 Bumps `spotless` from 7.0.4 to 8.4.0. Updates `com.diffplug.spotless:com.diffplug.spotless.gradle.plugin` from 7.0.4 to 8.4.0 Updates `com.diffplug.spotless` from 7.0.4 to 8.4.0 --- updated-dependencies: - dependency-name: com.diffplug.spotless:com.diffplug.spotless.gradle.plugin dependency-version: 8.4.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.diffplug.spotless dependency-version: 8.4.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Format code --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sentry Github Bot --- gradle/libs.versions.toml | 2 +- .../android/core/AnrV2IntegrationTest.kt | 92 +++++++++---------- .../sentry/android/core/SentryAndroidTest.kt | 58 ++++++------ .../debugmeta/AssetsDebugMetaLoaderTest.kt | 24 ++--- .../modules/AssetsModulesLoaderTest.kt | 16 ++-- .../distribution/UpdateResponseParserTest.kt | 30 +++--- .../uitest/android/critical/MainActivity.kt | 6 +- .../io/sentry/uitest/android/EnvelopeTests.kt | 8 +- .../viewhierarchy/ComposeViewHierarchyNode.kt | 22 ++--- .../replay/AnrWithReplayIntegrationTest.kt | 58 ++++++------ .../graphql22/SentryInstrumentationTest.kt | 14 +-- .../graphql/SentryInstrumentationTest.kt | 14 +-- .../src/main/kotlin/io/sentry/Assertions.kt | 8 +- .../io/sentry/JsonObjectDeserializerTest.kt | 52 +++++------ .../debugmeta/ResourcesDebugMetaLoaderTest.kt | 84 ++++++++--------- .../modules/ResourcesModulesLoaderTest.kt | 16 ++-- .../io/sentry/util/CollectionUtilsTest.kt | 12 +-- 17 files changed, 258 insertions(+), 258 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab39c981b44..4a17b2ac237 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,7 +37,7 @@ springboot4 = "4.0.0" targetSdk = "36" compileSdk = "36" minSdk = "21" -spotless = "7.0.4" +spotless = "8.4.0" gummyBears = "0.12.0" camerax = "1.4.0" openfeature = "1.18.2" diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt index abd27b51560..d9fd9c1889e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt @@ -56,29 +56,29 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { whenever(mock.traceInputStream) .thenReturn( """ - Subject: Input dispatching timed out (7985007 com.example.app/com.example.app.ui.MainActivity (server) is not responding. Waited 5000ms for FocusEvent(hasFocus=false)) - Here are no Binder-related exception messages available. - Pid(12233) have D state thread(tid:12236 name:Signal Catcher) + Subject: Input dispatching timed out (7985007 com.example.app/com.example.app.ui.MainActivity (server) is not responding. Waited 5000ms for FocusEvent(hasFocus=false)) + Here are no Binder-related exception messages available. + Pid(12233) have D state thread(tid:12236 name:Signal Catcher) - RssHwmKb: 823716 - RssKb: 548348 - RssAnonKb: 382156 - RssShmemKb: 13304 - VmSwapKb: 82484 + RssHwmKb: 823716 + RssKb: 548348 + RssAnonKb: 382156 + RssShmemKb: 13304 + VmSwapKb: 82484 - --- CriticalEventLog --- - capacity: 20 - timestamp_ms: 1731507490032 - window_ms: 300000 + --- CriticalEventLog --- + capacity: 20 + timestamp_ms: 1731507490032 + window_ms: 300000 - ----- dumping pid: 12233 at 313446151 - libdebuggerd_client: unexpected registration response: 0 + ----- dumping pid: 12233 at 313446151 + libdebuggerd_client: unexpected registration response: 0 - ----- Waiting Channels: pid 12233 at 2024-11-13 19:48:09.980104540+0530 ----- - Cmd line: com.example.app:mainProcess - """ + ----- Waiting Channels: pid 12233 at 2024-11-13 19:48:09.980104540+0530 ----- + Cmd line: com.example.app:mainProcess + """ .trimIndent() .byteInputStream() ) @@ -86,35 +86,35 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { whenever(mock.traceInputStream) .thenReturn( """ -"main" prio=5 tid=1 Blocked - | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 - | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 - | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 - | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB - | held mutexes= - at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) - - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 - at android.os.Handler.handleCallback(Handler.java:942) - at android.os.Handler.dispatchMessage(Handler.java:99) - at android.os.Looper.loopOnce(Looper.java:201) - at android.os.Looper.loop(Looper.java:288) - at android.app.ActivityThread.main(ActivityThread.java:7872) - at java.lang.reflect.Method.invoke(Native method) - at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) - at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) - -"perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) - | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 - | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 - | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 - | stack=0x7b20124000-0x7b20126000 stackSize=991KB - | held mutexes= - native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) - native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - (no managed stack frames) - """ + "main" prio=5 tid=1 Blocked + | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 + | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 + | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 + | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB + | held mutexes= + at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) + - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 + at android.os.Handler.handleCallback(Handler.java:942) + at android.os.Handler.dispatchMessage(Handler.java:99) + at android.os.Looper.loopOnce(Looper.java:201) + at android.os.Looper.loop(Looper.java:288) + at android.app.ActivityThread.main(ActivityThread.java:7872) + at java.lang.reflect.Method.invoke(Native method) + at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) + at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) + + "perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) + | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 + | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 + | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 + | stack=0x7b20124000-0x7b20126000 stackSize=991KB + | held mutexes= + native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) + native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + (no managed stack frames) + """ .trimIndent() .byteInputStream() ) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index 9c0f68c3f98..8524a1cc807 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -132,35 +132,35 @@ class SentryAndroidTest { whenever(mock.traceInputStream) .thenReturn( """ -"main" prio=5 tid=1 Blocked - | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 - | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 - | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 - | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB - | held mutexes= - at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) - - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 - at android.os.Handler.handleCallback(Handler.java:942) - at android.os.Handler.dispatchMessage(Handler.java:99) - at android.os.Looper.loopOnce(Looper.java:201) - at android.os.Looper.loop(Looper.java:288) - at android.app.ActivityThread.main(ActivityThread.java:7872) - at java.lang.reflect.Method.invoke(Native method) - at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) - at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) - -"perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) - | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 - | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 - | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 - | stack=0x7b20124000-0x7b20126000 stackSize=991KB - | held mutexes= - native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) - native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - (no managed stack frames) - """ + "main" prio=5 tid=1 Blocked + | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 + | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 + | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 + | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB + | held mutexes= + at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) + - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 + at android.os.Handler.handleCallback(Handler.java:942) + at android.os.Handler.dispatchMessage(Handler.java:99) + at android.os.Looper.loopOnce(Looper.java:201) + at android.os.Looper.loop(Looper.java:288) + at android.app.ActivityThread.main(ActivityThread.java:7872) + at java.lang.reflect.Method.invoke(Native method) + at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) + at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) + + "perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) + | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 + | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 + | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 + | stack=0x7b20124000-0x7b20126000 stackSize=991KB + | held mutexes= + native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) + native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + (no managed stack frames) + """ .trimIndent() .byteInputStream() ) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt index ba11c3c7966..76f13b63822 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt @@ -45,12 +45,12 @@ class AssetsDebugMetaLoaderTest { fixture.getSut( content = """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 + io.sentry.build-tool=maven + """ .trimIndent() ) @@ -68,12 +68,12 @@ class AssetsDebugMetaLoaderTest { fixture.getSut( content = """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 + io.sentry.build-tool=maven + """ .trimIndent() ) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt index 128087a315d..34d03b175d7 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt @@ -44,9 +44,9 @@ class AssetsModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3:okhttp:3.14.9 - com.squareup.okio:okio:1.17.2 - """ + com.squareup.okhttp3:okhttp:3.14.9 + com.squareup.okio:okio:1.17.2 + """ .trimIndent() ) @@ -62,9 +62,9 @@ class AssetsModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3:okhttp:3.14.9 - com.squareup.okio:okio:1.17.2 - """ + com.squareup.okhttp3:okhttp:3.14.9 + com.squareup.okio:okio:1.17.2 + """ .trimIndent() ) @@ -93,8 +93,8 @@ class AssetsModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3;3.14.9 - """ + com.squareup.okhttp3;3.14.9 + """ .trimIndent() ) diff --git a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt index 89013c430dd..3f1d083919c 100644 --- a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt +++ b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt @@ -37,7 +37,7 @@ class UpdateResponseParserTest { }, "current": null } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -68,7 +68,7 @@ class UpdateResponseParserTest { "created_date": "2023-09-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -90,7 +90,7 @@ class UpdateResponseParserTest { "created_date": "2023-09-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -146,7 +146,7 @@ class UpdateResponseParserTest { "build_version": "2.0.0" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -173,7 +173,7 @@ class UpdateResponseParserTest { "created_date": "" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -214,7 +214,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -240,7 +240,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -266,7 +266,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -292,7 +292,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -316,7 +316,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -345,7 +345,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -372,7 +372,7 @@ class UpdateResponseParserTest { "created_date": "2023-10-01T00:00:00Z" } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -397,7 +397,7 @@ class UpdateResponseParserTest { "install_groups": [] } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -422,7 +422,7 @@ class UpdateResponseParserTest { "install_groups": null } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) @@ -447,7 +447,7 @@ class UpdateResponseParserTest { "install_groups": ["beta-testers"] } } - """ + """ .trimIndent() val result = parser.parseResponse(200, responseBody) diff --git a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt index f6b81c869ef..46bfe7e44b7 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt @@ -69,9 +69,9 @@ class MainActivity : ComponentActivity() { val file = File(outboxPath, "corrupted.envelope") val corruptedEnvelopeContent = """ - {"event_id":"1990b5bc31904b7395fd07feb72daf1c","sdk":{"name":"sentry.java.android","version":"7.21.0"}} - {"type":"test","length":50} - """ + {"event_id":"1990b5bc31904b7395fd07feb72daf1c","sdk":{"name":"sentry.java.android","version":"7.21.0"}} + {"type":"test","length":50} + """ .trimIndent() file.writeText(corruptedEnvelopeContent) println("Wrote corrupted envelope to: ${file.absolutePath}") diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt index 30cdfefde25..ade47363296 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt @@ -267,10 +267,10 @@ class EnvelopeTests : BaseUiTest() { File(optionsRef!!.outboxPath, "14779dbf-b2f0-4c00-f4e5-4a287abc4267") .writeText( """ - {"dsn":"https://key@sentry.io/proj","event_id":"729ff878-5539-458d-f657-a1acf423a127","sent_at":"2025-04-02T10:02:04.732577Z"} - {"type":"transaction","length":1335} - {"event_id":"729ff878-5539-458d-f657-a1acf423a127","platform":"native","transaction":"little.teapot","start_timestamp":"2025-04-02T10:02:04.731697Z","spans":[{"op":"littlest.teapot","span_id":"00028ba394454124","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"b0dc1649a8ec4101","description":null,"start_timestamp":"2025-04-02T10:02:04.732127Z","timestamp":"2025-04-02T10:02:04.732133Z"},{"op":"littler.teapot","span_id":"b0dc1649a8ec4101","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"7ad2e40529af4650","description":null,"start_timestamp":"2025-04-02T10:02:04.732118Z","data":{"span_data_says":"hi!"},"timestamp":"2025-04-02T10:02:04.732137Z"}],"type":"transaction","timestamp":"2025-04-02T10:02:04.732142Z","level":"info","contexts":{"trace":{"trace_id":"7160e289fe4c4496f02c72bbc7edb392","span_id":"7ad2e40529af4650","op":"Short and stout here is my handle and here is my spout","status":"ok","data":{"url":"https://example.com"}},"os":{"build":"android14-4-00257-g7e35917775b8-ab9964412","name":"Linux","version":"6.1.23"}},"release":"1.0.0","dist":"dist","environment":"production","sdk":{"name":"io.sentry.ndk","version":"0.8.3","packages":[{"name":"github:getsentry/sentry-native","version":"0.8.3"}],"integrations":["inproc"]},"tags":{},"extra":{},"breadcrumbs":[]} - """ + {"dsn":"https://key@sentry.io/proj","event_id":"729ff878-5539-458d-f657-a1acf423a127","sent_at":"2025-04-02T10:02:04.732577Z"} + {"type":"transaction","length":1335} + {"event_id":"729ff878-5539-458d-f657-a1acf423a127","platform":"native","transaction":"little.teapot","start_timestamp":"2025-04-02T10:02:04.731697Z","spans":[{"op":"littlest.teapot","span_id":"00028ba394454124","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"b0dc1649a8ec4101","description":null,"start_timestamp":"2025-04-02T10:02:04.732127Z","timestamp":"2025-04-02T10:02:04.732133Z"},{"op":"littler.teapot","span_id":"b0dc1649a8ec4101","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"7ad2e40529af4650","description":null,"start_timestamp":"2025-04-02T10:02:04.732118Z","data":{"span_data_says":"hi!"},"timestamp":"2025-04-02T10:02:04.732137Z"}],"type":"transaction","timestamp":"2025-04-02T10:02:04.732142Z","level":"info","contexts":{"trace":{"trace_id":"7160e289fe4c4496f02c72bbc7edb392","span_id":"7ad2e40529af4650","op":"Short and stout here is my handle and here is my spout","status":"ok","data":{"url":"https://example.com"}},"os":{"build":"android14-4-00257-g7e35917775b8-ab9964412","name":"Linux","version":"6.1.23"}},"release":"1.0.0","dist":"dist","environment":"production","sdk":{"name":"io.sentry.ndk","version":"0.8.3","packages":[{"name":"github:getsentry/sentry-native","version":"0.8.3"}],"integrations":["inproc"]},"tags":{},"extra":{},"breadcrumbs":[]} + """ .trimIndent() ) diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index ec01d28d4fb..a0312b69cd0 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -137,12 +137,12 @@ internal object ComposeViewHierarchyNode { SentryLevel.ERROR, t, """ - Error retrieving semantics information from Compose tree. Most likely you're using - an unsupported version of androidx.compose.ui:ui. The supported - version range is 1.5.0 - 1.10.2. - If you're using a newer version, please open a github issue with the version - you're using, so we can add support for it. - """ + Error retrieving semantics information from Compose tree. Most likely you're using + an unsupported version of androidx.compose.ui:ui. The supported + version range is 1.5.0 - 1.10.2. + If you're using a newer version, please open a github issue with the version + you're using, so we can add support for it. + """ .trimIndent(), ) } @@ -284,11 +284,11 @@ internal object ComposeViewHierarchyNode { SentryLevel.ERROR, e, """ - Error traversing Compose tree. Most likely you're using an unsupported version of - androidx.compose.ui:ui. The minimum supported version is 1.5.0. If it's a newer - version, please open a github issue with the version you're using, so we can add - support for it. - """ + Error traversing Compose tree. Most likely you're using an unsupported version of + androidx.compose.ui:ui. The minimum supported version is 1.5.0. If it's a newer + version, please open a github issue with the version you're using, so we can add + support for it. + """ .trimIndent(), ) return false diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt index f3d03fd5bc5..1214c55c057 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt @@ -80,35 +80,35 @@ class AnrWithReplayIntegrationTest { whenever(mock.traceInputStream) .thenReturn( """ -"main" prio=5 tid=1 Blocked - | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 - | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 - | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 - | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB - | held mutexes= - at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) - - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 - at android.os.Handler.handleCallback(Handler.java:942) - at android.os.Handler.dispatchMessage(Handler.java:99) - at android.os.Looper.loopOnce(Looper.java:201) - at android.os.Looper.loop(Looper.java:288) - at android.app.ActivityThread.main(ActivityThread.java:7872) - at java.lang.reflect.Method.invoke(Native method) - at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) - at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) - -"perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) - | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 - | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 - | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 - | stack=0x7b20124000-0x7b20126000 stackSize=991KB - | held mutexes= - native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) - native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) - (no managed stack frames) - """ + "main" prio=5 tid=1 Blocked + | group="main" sCount=1 ucsCount=0 flags=1 obj=0x72a985e0 self=0xb400007cabc57380 + | sysTid=28941 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 + | state=S schedstat=( 324804784 183300334 997 ) utm=23 stm=8 core=3 HZ=100 + | stack=0x7ff93a9000-0x7ff93ab000 stackSize=8188KB + | held mutexes= + at io.sentry.samples.android.MainActivity${'$'}2.run(MainActivity.java:177) + - waiting to lock <0x0d3a2f0a> (a java.lang.Object) held by thread 5 + at android.os.Handler.handleCallback(Handler.java:942) + at android.os.Handler.dispatchMessage(Handler.java:99) + at android.os.Looper.loopOnce(Looper.java:201) + at android.os.Looper.loop(Looper.java:288) + at android.app.ActivityThread.main(ActivityThread.java:7872) + at java.lang.reflect.Method.invoke(Native method) + at com.android.internal.os.RuntimeInit${'$'}MethodAndArgsCaller.run(RuntimeInit.java:548) + at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) + + "perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) + | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xb400007cabc5ab20 + | sysTid=28959 nice=-20 cgrp=top-app sched=0/0 handle=0x7b2021bcb0 + | state=S schedstat=( 72750 1679167 1 ) utm=0 stm=0 core=3 HZ=100 + | stack=0x7b20124000-0x7b20126000 stackSize=991KB + | held mutexes= + native: #00 pc 00000000000a20f4 /apex/com.android.runtime/lib64/bionic/libc.so (read+4) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #01 pc 000000000001d840 /apex/com.android.art/lib64/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::${'$'}_34> >(void*)+260) (BuildId: 525cc92a7dc49130157aeb74f6870364) + native: #02 pc 00000000000b63b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + native: #03 pc 00000000000530b8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b) + (no managed stack frames) + """ .trimIndent() .byteInputStream() ) diff --git a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt index e61fb44a856..c684688299e 100644 --- a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt +++ b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt @@ -54,14 +54,14 @@ class SentryInstrumentationTest { activeSpan = SentryTracer(TransactionContext("name", "op"), scopes) val schema = """ - type Query { - shows: [Show] - } + type Query { + shows: [Show] + } - type Show { - id: Int - } - """ + type Show { + id: Int + } + """ .trimIndent() val graphQLSchema = diff --git a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt index 1e2e5c8f0f0..972b091a226 100644 --- a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt +++ b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt @@ -50,14 +50,14 @@ class SentryInstrumentationTest { activeSpan = SentryTracer(TransactionContext("name", "op"), scopes) val schema = """ - type Query { - shows: [Show] - } + type Query { + shows: [Show] + } - type Show { - id: Int - } - """ + type Show { + id: Int + } + """ .trimIndent() val graphQLSchema = diff --git a/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt b/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt index 8d621adb1a2..43b083d50e9 100644 --- a/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt +++ b/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt @@ -118,11 +118,11 @@ private inline fun check(noinline predicate: (T) -> Unit): T = if (arg == null) { error( """ - The argument passed to the predicate was null. + The argument passed to the predicate was null. -If you are trying to verify an argument to be null, use `isNull()`. -If you are using `check` as part of a stubbing, use `argThat` or `argForWhich` instead. - """ + If you are trying to verify an argument to be null, use `isNull()`. + If you are using `check` as part of a stubbing, use `argThat` or `argForWhich` instead. + """ .trimIndent() ) } diff --git a/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt b/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt index 3e60f4ff8a7..04e2aaceba0 100644 --- a/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt +++ b/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt @@ -162,12 +162,12 @@ class JsonObjectDeserializerTest { fun `deserialize json object object`() { val json = """ - { - "key": { - "key": "value" - } - } - """ + { + "key": { + "key": "value" + } + } + """ .trimIndent() val expected = mapOf("key" to mapOf("key" to "value")) @@ -179,26 +179,26 @@ class JsonObjectDeserializerTest { fun `deserialize json object object with nesting`() { val json = """ - { - "fixture-key": - { - "string": "fixture-string", - "int": 123, - "double": 123.321, - "boolean": true, - "array": - [ - "a", - "b", - "c" - ], - "object": - { - "key": "value" - } - } - } - """ + { + "fixture-key": + { + "string": "fixture-string", + "int": 123, + "double": 123.321, + "boolean": true, + "array": + [ + "a", + "b", + "c" + ], + "object": + { + "key": "value" + } + } + } + """ .trimIndent() val expected = diff --git a/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt b/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt index 0e776717436..59bc9012348 100644 --- a/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt +++ b/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt @@ -51,12 +51,12 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 + io.sentry.build-tool=maven + """ .trimIndent() ) ) @@ -76,12 +76,12 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 + io.sentry.build-tool=maven + """ .trimIndent() ) ) @@ -104,20 +104,20 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=7b1fae93-63fb-43ff-a70a-608dc5005970 - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=7b1fae93-63fb-43ff-a70a-608dc5005970 + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 + io.sentry.build-tool=maven + """ .trimIndent(), """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=37c90685-32a1-40db-9019-a2f0b05674cb - io.sentry.bundle-ids=13e16819-accf-48da-a82d-f6ec94af9948 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=37c90685-32a1-40db-9019-a2f0b05674cb + io.sentry.bundle-ids=13e16819-accf-48da-a82d-f6ec94af9948 + io.sentry.build-tool=maven + """ .trimIndent(), ) ) @@ -151,13 +151,13 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 - io.sentry.build-tool=maven - io.sentry.build-tool-version=1.0 - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 + io.sentry.build-tool=maven + io.sentry.build-tool-version=1.0 + """ .trimIndent() ) ) @@ -176,12 +176,12 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated by sentry-maven-plugin - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 - io.sentry.build-tool=maven - """ + #Generated by sentry-maven-plugin + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 + io.sentry.build-tool=maven + """ .trimIndent() ) ) @@ -200,11 +200,11 @@ class ResourcesDebugMetaLoaderTest { content = listOf( """ - #Generated manually - #Wed May 17 15:33:34 CEST 2023 - io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b - io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 - """ + #Generated manually + #Wed May 17 15:33:34 CEST 2023 + io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b + io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 + """ .trimIndent() ) ) diff --git a/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt b/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt index d9791fd7608..290fc0d0c0b 100644 --- a/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt +++ b/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt @@ -35,9 +35,9 @@ class ResourcesModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3:okhttp:3.14.9 - com.squareup.okio:okio:1.17.2 - """ + com.squareup.okhttp3:okhttp:3.14.9 + com.squareup.okio:okio:1.17.2 + """ .trimIndent() ) @@ -53,9 +53,9 @@ class ResourcesModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3:okhttp:3.14.9 - com.squareup.okio:okio:1.17.2 - """ + com.squareup.okhttp3:okhttp:3.14.9 + com.squareup.okio:okio:1.17.2 + """ .trimIndent() ) @@ -84,8 +84,8 @@ class ResourcesModulesLoaderTest { fixture.getSut( content = """ - com.squareup.okhttp3;3.14.9 - """ + com.squareup.okhttp3;3.14.9 + """ .trimIndent() ) diff --git a/sentry/src/test/java/io/sentry/util/CollectionUtilsTest.kt b/sentry/src/test/java/io/sentry/util/CollectionUtilsTest.kt index f5b358d9763..1b1ffc02493 100644 --- a/sentry/src/test/java/io/sentry/util/CollectionUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/CollectionUtilsTest.kt @@ -46,12 +46,12 @@ class CollectionUtilsTest { fun `concurrent hashmap creation ignores null values`() { val json = """ - { - "key1": "value1", - "key2": null, - "key3": "value3" - } - """ + { + "key1": "value1", + "key2": null, + "key3": "value3" + } + """ .trimIndent() val reader = JsonObjectReader(StringReader(json)) val deserializedMap = reader.nextObjectOrNull() as Map From 4ffeec8c0020ea4305a5bd1c1ebab575e130b579 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 08:47:44 +0000 Subject: [PATCH 149/391] chore(deps): bump androidx.constraintlayout:constraintlayout (#5416) Bumps androidx.constraintlayout:constraintlayout from 2.0.4 to 2.2.1. --- updated-dependencies: - dependency-name: androidx.constraintlayout:constraintlayout dependency-version: 2.2.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- .../test-app-plain/build.gradle.kts | 2 +- .../test-app-sentry/build.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4a17b2ac237..ae13fb664bd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -86,7 +86,7 @@ androidx-compose-material-icons-extended = { module = "androidx.compose.material androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidxCompose" } # Note: don't change without testing forwards compatibility androidx-compose-ui-replay = { module = "androidx.compose.ui:ui", version = "1.10.2" } -androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.1.3" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.2.1" } androidx-core = { module = "androidx.core:core", version = "1.3.2" } androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.7.0" } androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version = "1.3.5" } diff --git a/sentry-android-integration-tests/test-app-plain/build.gradle.kts b/sentry-android-integration-tests/test-app-plain/build.gradle.kts index 4d6655132c3..9778363ede8 100644 --- a/sentry-android-integration-tests/test-app-plain/build.gradle.kts +++ b/sentry-android-integration-tests/test-app-plain/build.gradle.kts @@ -45,7 +45,7 @@ android { dependencies { implementation("androidx.appcompat:appcompat:1.3.0") implementation("com.google.android.material:material:1.4.0") - implementation("androidx.constraintlayout:constraintlayout:2.0.4") + implementation("androidx.constraintlayout:constraintlayout:2.2.1") implementation("androidx.navigation:navigation-fragment:2.3.5") implementation("androidx.navigation:navigation-ui:2.3.5") } diff --git a/sentry-android-integration-tests/test-app-sentry/build.gradle.kts b/sentry-android-integration-tests/test-app-sentry/build.gradle.kts index cd340b9a4a6..db0cb4a46ab 100644 --- a/sentry-android-integration-tests/test-app-sentry/build.gradle.kts +++ b/sentry-android-integration-tests/test-app-sentry/build.gradle.kts @@ -45,7 +45,7 @@ android { dependencies { implementation("androidx.appcompat:appcompat:1.3.0") implementation("com.google.android.material:material:1.4.0") - implementation("androidx.constraintlayout:constraintlayout:2.0.4") + implementation("androidx.constraintlayout:constraintlayout:2.2.1") implementation("androidx.navigation:navigation-fragment:2.3.5") implementation("androidx.navigation:navigation-ui:2.3.5") implementation(projects.sentryAndroid) From 1f987ea15b2878502b59e75518b08577211f2cc7 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 12 May 2026 16:28:32 +0200 Subject: [PATCH 150/391] Remove testBuildType mechanism from UI test modules (#5388) * fix(build): Remove testBuildType mechanism from UI test modules The debug and release build types were configured identically in both uitest modules (same minification, proguard rules, signing). Disable the debug variant unconditionally, hardcode testBuildType to release, and combine the now-simplified Gradle invocations. Co-Authored-By: Claude Opus 4.6 * fix(build): Combine Gradle invocations in AGENTS.md Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .github/workflows/agp-matrix.yml | 2 +- AGENTS.md | 3 +-- Makefile | 6 ++---- .../build.gradle.kts | 18 ++++-------------- .../sentry-uitest-android/README.md | 6 ++---- .../sentry-uitest-android/build.gradle.kts | 13 ++++--------- 6 files changed, 14 insertions(+), 34 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index df0b0ebca3c..7ef34ea563e 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -90,7 +90,7 @@ jobs: disable-spellchecker: true emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disk-size: 4096M - script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -DtestBuildType=release -Denvironment=github --daemon + script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github --daemon - name: Upload test results if: always() diff --git a/AGENTS.md b/AGENTS.md index 42a8e651004..1784e4f950e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -75,8 +75,7 @@ make systemTest ### Android-Specific Commands ```bash # Assemble Android test APKs -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest -DtestBuildType=release +./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest # Run critical UI tests ./scripts/test-ui-critical.sh diff --git a/Makefile b/Makefile index 55f465a9663..c9eca8b8b7e 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,11 @@ api: # Assemble release and Android test apk of the uitest-android-benchmark module assembleBenchmarkTestRelease: - ./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease - ./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest -DtestBuildType=release + ./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest # Assemble release and Android test apk of the uitest-android module assembleUiTestRelease: - ./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease - ./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest -DtestBuildType=release + ./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest # Assemble release of the uitest-android-critical module assembleUiTestCriticalRelease: diff --git a/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts b/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts index 4b5993644ee..459c1653fa9 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts +++ b/sentry-android-integration-tests/sentry-uitest-android-benchmark/build.gradle.kts @@ -46,21 +46,9 @@ android { } } - testBuildType = System.getProperty("testBuildType", "debug") + testBuildType = "release" buildTypes { - getByName("debug") { - isMinifyEnabled = true - signingConfig = signingConfigs.getByName("debug") - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "benchmark-proguard-rules.pro", - ) - testProguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "benchmark-proguard-rules.pro", - ) - } getByName("release") { isMinifyEnabled = true isShrinkResources = true @@ -89,7 +77,9 @@ android { } androidComponents.beforeVariants { - it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType) + if (it.buildType == "debug") { + it.enable = false + } } } diff --git a/sentry-android-integration-tests/sentry-uitest-android/README.md b/sentry-android-integration-tests/sentry-uitest-android/README.md index c11397383d0..08389e0c16c 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/README.md +++ b/sentry-android-integration-tests/sentry-uitest-android/README.md @@ -14,14 +14,12 @@ You can run benchmark tests only with `./gradlew :sentry-android-integration-tes To run on saucelabs execute following commands (need also `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables): For Benchmarks: ``` -./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease -./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest -DtestBuildType=release +./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest saucectl run -c .sauce/sentry-uitest-android-benchmark.yml ``` For End 2 End: ``` -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease -./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest -DtestBuildType=release +./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest saucectl run -c .sauce/sentry-uitest-android-end2end.yml ``` diff --git a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts index a4d46405fb8..5258a33f92a 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts +++ b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts @@ -51,18 +51,11 @@ android { } } - testBuildType = System.getProperty("testBuildType", "debug") + testBuildType = "release" buildTypes { - getByName("debug") { - isMinifyEnabled = true - signingConfig = signingConfigs.getByName("debug") - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - testProguardFiles("proguard-rules.pro") - } getByName("release") { isMinifyEnabled = true - isShrinkResources = false proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") signingConfig = signingConfigs.getByName("debug") // to be able to run release mode testProguardFiles("proguard-rules.pro") @@ -82,7 +75,9 @@ android { } androidComponents.beforeVariants { - it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType) + if (it.buildType == "debug") { + it.enable = false + } } } From d8912da3e338a789eb940dc4e5ba54b97d7b6fde Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 12 May 2026 17:55:17 +0200 Subject: [PATCH 151/391] chore: Add missing binary types to .gitattributes (#5420) Mark *.bin, *.zip, *.jar, and *.gpg as binary to prevent line-ending conversions and diff noise. Co-authored-by: Claude Opus 4.6 --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitattributes b/.gitattributes index 92fa746b911..f444fd5957d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,10 @@ *.jpg binary *.pb binary *.gz binary +*.bin binary +*.zip binary +*.jar binary +*.gpg binary # These are explicitly windows files and should use crlf *.bat text eol=crlf From 271ed531ac58a295cca62ff1206e10cf015b58aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 09:33:10 +0200 Subject: [PATCH 152/391] chore: update scripts/update-gradle.sh to v9.5.1 (#5419) Co-authored-by: GitHub --- CHANGELOG.md | 6 +++++ gradle/wrapper/gradle-wrapper.jar | Bin 48966 -> 48462 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++- gradlew | 2 +- gradlew.bat | 31 ++++++++--------------- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceda85d8b99..bfb51947698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ - Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) +### Dependencies + +- Bump Gradle from v9.5.0 to v9.5.1 ([#5419](https://github.com/getsentry/sentry-java/pull/5419)) + - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v951) + - [diff](https://github.com/gradle/gradle/compare/v9.5.0...v9.5.1) + ## 8.41.0 ### Features diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d997cfc60f4cff0e7451d19d49a82fa986695d07..b1b8ef56b44f16b14dc800fa8103a6d89abb526f 100644 GIT binary patch delta 39760 zcmXVX<6|9e({vi+geNu|+iq;Lv2FW=CpH_~Zfx7O8#Gqq^zH9{-Y?fbaLvr_?9PsS zLe9KG);pnsnwo2xi7~sprey3}qgMu0B@znDa&>Nqe=c%xjWdlqpbrT}IPS~b>_I&% zA287HK|$@#zWWDsgCP2NFW9`+?JUNDy*MsmOutN-aJpvAEnMxz3)pei86*w_@iD*1 z=tZH8Q%z{l*zX;Nv3z+G&`QMeF0R6huq-N&9y?D4?S4vF1JI3W3l}F2QamCI_$4mz z{qyyQs6+NiBUSb8Pqg!J!+Xh*NXmmPdRL$trm+cBH#T2jQ(0-(f|f>yj$a@?K$R>QdLJo90QU}F(J zzWCPDO4K7t%Frz{75JB{KyoPgIM(049+s=sh_wSYs1( zeNPcVCM!L$@cL2j(4Nz~+{l3FQH;33g{>mX|0P%T5bFDwc|#AN^PJWcTl@Td{#B)j%DojhmcFSQk57S&@3V8y=r3UM3#7}g`5)7Js2J=0%)v7G5TbOQ~| zOXx^|cQTbWd#19gg5aeSg%CebRPLlL@3cvctTY~y6kynrE(@iFVNbKmHc>jz$=PVw+vi_x9E4M|G-+~9h@7R8~`*2 zEh=LMFcGA46bK14e%$P`$i>&@T9NRqMXsE=Dw`|55 zFQJCE-o*By?hZTgWDCwEXcMU@msdzws*D@V%uI}F3c42rB;ozI4>kEE47Xd4&>?s< zWk)m)zJ+Gq4%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B2*ojkBL4%$ z7_NKxGZ*DO_>XfnqVduXz+9etaGHnp9{k7F72y)X@&JtDLx2nj$7{U%-Sw}t;{ON7 zprMU&zs%nE|TU%t7_n2x9@E){jto@&HnT#x|P*?>!k1`80@p z-Us=q8qk7P5-3TF5X#@!@=(ndQsh|8`?RO67|`$*Y2d%XwE+OZ2Zh19|A5ym{J{T? z1W5k?>@@ff$O`-?a2%p3+z%joYXqbM{O_o04?A3BivXygbZvZ8|1MJk05~3~Jc8!8 z0uc;0bi(oea035#65roBd;kE$1NLX|-)3R{v%Cq)S5FJPpM8edS6hhfVFMq<-S?s; zi1Gf&{5#SL0MI?qoqTf-Dz~!$??=cGT{T6VowN@ip}c!2ubmnA&!7;Z%7&-{BR zH4k`S<^3}tLdhO+G4ni7voE{{b@T5pRN(*pSJp<{a2|Hzwgg)6Nd@@N-3S)|V0)mX e{Sg5G5zENPNVU~b5#<2@M#Os+0czL&{q{eZe&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,7 +65,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line @@ -73,21 +73,10 @@ goto fail @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% From 5dee26ba7ca9931bca62b730b210e01063e1c2d1 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 13 May 2026 13:54:17 +0200 Subject: [PATCH 153/391] chore(deps): Bump Robolectric from 4.14 to 4.15 (#5425) Co-authored-by: Claude --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ae13fb664bd..bf16f9b0edd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -246,5 +246,5 @@ mockito-inline = { module = "org.mockito:mockito-inline", version = "4.8.0" } msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } okio = { module = "com.squareup.okio:okio", version = "1.13.0" } -roboelectric = { module = "org.robolectric:robolectric", version = "4.14" } +roboelectric = { module = "org.robolectric:robolectric", version = "4.15" } From 9745881ec5ee89409a8a274966f7348403bcb501 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 09:09:58 +0200 Subject: [PATCH 154/391] chore: update scripts/update-sentry-native-ndk.sh to 0.14.1 (#5433) Co-authored-by: GitHub --- CHANGELOG.md | 3 +++ gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb51947698..edf15cf84e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ - Bump Gradle from v9.5.0 to v9.5.1 ([#5419](https://github.com/getsentry/sentry-java/pull/5419)) - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v951) - [diff](https://github.com/gradle/gradle/compare/v9.5.0...v9.5.1) +- Bump Native SDK from v0.14.0 to v0.14.1 ([#5433](https://github.com/getsentry/sentry-java/pull/5433)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0141) + - [diff](https://github.com/getsentry/sentry-native/compare/0.14.0...0.14.1) ## 8.41.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bf16f9b0edd..0d4850d288a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.0" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.1" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From d65ecce0b77cf13f8d12dcf36d099420c327b33f Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 15 May 2026 09:41:55 +0200 Subject: [PATCH 155/391] chore: Replace custom Gradle wrapper updater with Dependabot (#5421) Remove the custom `scripts/update-gradle.sh` script and its corresponding `gradle-wrapper` job in the `update-deps.yml` workflow. The existing Dependabot `gradle` package ecosystem already handles Gradle wrapper updates, making this custom machinery redundant. Co-authored-by: Claude Opus 4.6 --- .github/workflows/update-deps.yml | 10 ------- scripts/update-gradle.sh | 47 ------------------------------- 2 files changed, 57 deletions(-) delete mode 100755 scripts/update-gradle.sh diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index a8bb5f655a1..bfcf9ccfa85 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -23,13 +23,3 @@ jobs: path: scripts/update-sentry-native-ndk.sh name: Native SDK ssh-key: ${{ secrets.CI_DEPLOY_KEY }} - - gradle-wrapper: - runs-on: ubuntu-latest - steps: - - uses: getsentry/github-workflows/updater@26f565c05d0dd49f703d238706b775883037d76b # v3 - with: - path: scripts/update-gradle.sh - name: Gradle - pattern: '^v[0-9.]+$' # only match non-preview versions - ssh-key: ${{ secrets.CI_DEPLOY_KEY }} diff --git a/scripts/update-gradle.sh b/scripts/update-gradle.sh deleted file mode 100755 index c2bfe979224..00000000000 --- a/scripts/update-gradle.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -cd $(dirname "$0")/../ - -if [[ -n ${CI+x} ]]; then - export JAVA_HOME=$JAVA_HOME_17_X64 -fi - -case $1 in -get-version) - # `./gradlew` shows some info on the first run, breaking the parsing in the next step. - # Therefore, we run it once without checking any output. - ./gradlew --version >/dev/null - version="$(./gradlew --version | sed -E -n 's/.*Gradle +([0-9.]+).*/\1/p')" - - # Add trailing ".0" - gradlew outputs '7.1' instead of '7.1.0' - if [[ "$version" =~ ^[0-9]\.[0-9]$ ]]; then - version="$version.0" - fi - - echo "v$version" - ;; -get-repo) - echo "https://github.com/gradle/gradle.git" - ;; -set-version) - version=$2 - - # Remove leading "v" - if [[ "$version" == v* ]]; then - version="${version:1}" - fi - - echo "Setting gradle version to '$version'" - - # This sets version to gradle-wrapper.properties. - ./gradlew wrapper --gradle-version "$version" - - # Verify it works. - ./gradlew --version - ;; -*) - echo "Unknown argument $1" - exit 1 - ;; -esac From 8e739fbff43f310efdeb5bd5a66c98a4ccb308a3 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 15 May 2026 14:17:18 +0200 Subject: [PATCH 156/391] chore(deps): Bump Tomcat from 11.0.10 to 11.0.22 (#5440) Co-authored-by: Claude Opus 4.6 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0d4850d288a..47c74dde9c5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -213,8 +213,8 @@ gummy-bears-api21 = { module = "com.toasttab.android:gummy-bears-api-21", versio # tomcat libraries tomcat-catalina = { module = "org.apache.tomcat:tomcat-catalina", version = "9.0.108" } tomcat-embed-jasper = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version = "9.0.108" } -tomcat-catalina-jakarta = { module = "org.apache.tomcat:tomcat-catalina", version = "11.0.10" } -tomcat-embed-jasper-jakarta = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version = "11.0.10" } +tomcat-catalina-jakarta = { module = "org.apache.tomcat:tomcat-catalina", version = "11.0.22" } +tomcat-embed-jasper-jakarta = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version = "11.0.22" } # test libraries androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version = "1.9.5" } From 4c04bb8999d177ffba8c5d68476e2664a043c789 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 15 May 2026 15:55:12 +0200 Subject: [PATCH 157/391] chore(deps): Bump SAGP from 6.0.0-alpha.6 to 6.6.0 (#5427) * chore(deps): Bump SAGP from 6.0.0-alpha.6 to 6.6.0 Co-Authored-By: Claude Opus 4.6 * changelog --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 3 +++ gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edf15cf84e8..93d3888bd36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ - Bump Native SDK from v0.14.0 to v0.14.1 ([#5433](https://github.com/getsentry/sentry-java/pull/5433)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0141) - [diff](https://github.com/getsentry/sentry-native/compare/0.14.0...0.14.1) +- Bump SAGP (Sentry Android Gradle Plugin) from v6.0.0-alpha.6 to v6.6.0 ([#5427](https://github.com/getsentry/sentry-java/pull/5427)) + - [changelog](https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/CHANGELOG.md) + - [diff](https://github.com/getsentry/sentry-android-gradle-plugin/compare/6.0.0-alpha.6...6.6.0) ## 8.41.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 47c74dde9c5..7f37847604f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -66,7 +66,7 @@ springboot4 = { id = "org.springframework.boot", version.ref = "springboot4" } spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" } gretty = { id = "org.gretty", version = "4.0.0" } animalsniffer = { id = "ru.vyarus.animalsniffer", version = "2.0.1" } -sentry = { id = "io.sentry.android.gradle", version = "6.0.0-alpha.6"} +sentry = { id = "io.sentry.android.gradle", version = "6.6.0"} shadow = { id = "com.gradleup.shadow", version = "9.4.1" } [libraries] From f6cdbf09de34beb48f0daec2694ec8913751d89a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 09:52:35 +0200 Subject: [PATCH 158/391] chore: update scripts/update-sentry-native-ndk.sh to 0.14.2 (#5441) Co-authored-by: GitHub --- CHANGELOG.md | 6 +++--- gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d3888bd36..5632b6926b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,9 @@ - Bump Gradle from v9.5.0 to v9.5.1 ([#5419](https://github.com/getsentry/sentry-java/pull/5419)) - [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v951) - [diff](https://github.com/gradle/gradle/compare/v9.5.0...v9.5.1) -- Bump Native SDK from v0.14.0 to v0.14.1 ([#5433](https://github.com/getsentry/sentry-java/pull/5433)) - - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0141) - - [diff](https://github.com/getsentry/sentry-native/compare/0.14.0...0.14.1) +- Bump Native SDK from v0.14.0 to v0.14.2 ([#5433](https://github.com/getsentry/sentry-java/pull/5433), [#5441](https://github.com/getsentry/sentry-java/pull/5441)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0142) + - [diff](https://github.com/getsentry/sentry-native/compare/0.14.0...0.14.2) - Bump SAGP (Sentry Android Gradle Plugin) from v6.0.0-alpha.6 to v6.6.0 ([#5427](https://github.com/getsentry/sentry-java/pull/5427)) - [changelog](https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/CHANGELOG.md) - [diff](https://github.com/getsentry/sentry-android-gradle-plugin/compare/6.0.0-alpha.6...6.6.0) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7f37847604f..4e580db7498 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -151,7 +151,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.1" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.2" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 48cc9d8840f7adada488dfffc280a9d4e75ef68d Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 19 May 2026 14:00:26 +0200 Subject: [PATCH 159/391] meta(craft): Register missing SDK modules (#5399) --- .craft.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.craft.yml b/.craft.yml index cb52926ad56..cc4636cd32d 100644 --- a/.craft.yml +++ b/.craft.yml @@ -42,16 +42,20 @@ targets: maven:io.sentry:sentry-bom: maven:io.sentry:sentry-openfeign: maven:io.sentry:sentry-openfeature: + maven:io.sentry:sentry-launchdarkly-android: + maven:io.sentry:sentry-launchdarkly-server: maven:io.sentry:sentry-opentelemetry-agent: maven:io.sentry:sentry-opentelemetry-agentcustomization: maven:io.sentry:sentry-opentelemetry-agentless: maven:io.sentry:sentry-opentelemetry-agentless-spring: maven:io.sentry:sentry-opentelemetry-bootstrap: maven:io.sentry:sentry-opentelemetry-core: -# maven:io.sentry:sentry-opentelemetry-otlp: -# maven:io.sentry:sentry-opentelemetry-otlp-spring: + maven:io.sentry:sentry-opentelemetry-otlp: + maven:io.sentry:sentry-opentelemetry-otlp-spring: + maven:io.sentry:sentry-kafka: maven:io.sentry:sentry-apollo: maven:io.sentry:sentry-jdbc: + maven:io.sentry:sentry-jcache: maven:io.sentry:sentry-graphql: maven:io.sentry:sentry-graphql-22: maven:io.sentry:sentry-graphql-core: From 11f90db91673ad57a61458c7b8ce0b3d52646295 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 19 May 2026 14:23:13 +0200 Subject: [PATCH 160/391] feat(core): Add API to clear scope feature flags (#5426) * feat(core): Add API to clear scope feature flags Allow feature flags stored on a scope to be cleared without resetting other scope data. Scope.clear now also resets the feature flag buffer so stale flag evaluations do not carry over after clearing a scope. Fixes #5422 Co-Authored-By: Claude * changelog --------- Co-authored-by: Claude --- CHANGELOG.md | 1 + sentry/api/sentry.api | 8 ++++++++ .../src/main/java/io/sentry/CombinedScopeView.java | 5 +++++ sentry/src/main/java/io/sentry/IScope.java | 2 ++ sentry/src/main/java/io/sentry/NoOpScope.java | 3 +++ sentry/src/main/java/io/sentry/Scope.java | 6 ++++++ .../io/sentry/featureflags/FeatureFlagBuffer.java | 7 +++++++ .../io/sentry/featureflags/IFeatureFlagBuffer.java | 2 ++ .../sentry/featureflags/NoOpFeatureFlagBuffer.java | 3 +++ .../sentry/featureflags/SpanFeatureFlagBuffer.java | 7 +++++++ sentry/src/test/java/io/sentry/ScopeTest.kt | 14 ++++++++++++++ .../sentry/featureflags/FeatureFlagBufferTest.kt | 13 +++++++++++++ .../featureflags/SpanFeatureFlagBufferTest.kt | 12 ++++++++++++ 13 files changed, 83 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5632b6926b9..4241d6e4f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- Add API to clear feature flags from scopes ([#5426](https://github.com/getsentry/sentry-java/pull/5426)) - Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) ### Dependencies diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index a433abbb37c..e48c03ffb15 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -273,6 +273,7 @@ public final class io/sentry/CombinedScopeView : io/sentry/IScope { public fun clear ()V public fun clearAttachments ()V public fun clearBreadcrumbs ()V + public fun clearFeatureFlags ()V public fun clearSession ()V public fun clearTransaction ()V public fun clone ()Lio/sentry/IScope; @@ -901,6 +902,7 @@ public abstract interface class io/sentry/IScope { public abstract fun clear ()V public abstract fun clearAttachments ()V public abstract fun clearBreadcrumbs ()V + public abstract fun clearFeatureFlags ()V public abstract fun clearSession ()V public abstract fun clearTransaction ()V public abstract fun clone ()Lio/sentry/IScope; @@ -1715,6 +1717,7 @@ public final class io/sentry/NoOpScope : io/sentry/IScope { public fun clear ()V public fun clearAttachments ()V public fun clearBreadcrumbs ()V + public fun clearFeatureFlags ()V public fun clearSession ()V public fun clearTransaction ()V public fun clone ()Lio/sentry/IScope; @@ -2401,6 +2404,7 @@ public final class io/sentry/Scope : io/sentry/IScope { public fun clear ()V public fun clearAttachments ()V public fun clearBreadcrumbs ()V + public fun clearFeatureFlags ()V public fun clearSession ()V public fun clearTransaction ()V public fun clone ()Lio/sentry/IScope; @@ -5039,6 +5043,7 @@ public final class io/sentry/exception/SentryHttpClientException : java/lang/Exc public final class io/sentry/featureflags/FeatureFlagBuffer : io/sentry/featureflags/IFeatureFlagBuffer { public fun add (Ljava/lang/String;Ljava/lang/Boolean;)V + public fun clear ()V public fun clone ()Lio/sentry/featureflags/IFeatureFlagBuffer; public synthetic fun clone ()Ljava/lang/Object; public static fun create (Lio/sentry/SentryOptions;)Lio/sentry/featureflags/IFeatureFlagBuffer; @@ -5048,6 +5053,7 @@ public final class io/sentry/featureflags/FeatureFlagBuffer : io/sentry/featuref public abstract interface class io/sentry/featureflags/IFeatureFlagBuffer { public abstract fun add (Ljava/lang/String;Ljava/lang/Boolean;)V + public abstract fun clear ()V public abstract fun clone ()Lio/sentry/featureflags/IFeatureFlagBuffer; public abstract fun getFeatureFlags ()Lio/sentry/protocol/FeatureFlags; } @@ -5055,6 +5061,7 @@ public abstract interface class io/sentry/featureflags/IFeatureFlagBuffer { public final class io/sentry/featureflags/NoOpFeatureFlagBuffer : io/sentry/featureflags/IFeatureFlagBuffer { public fun ()V public fun add (Ljava/lang/String;Ljava/lang/Boolean;)V + public fun clear ()V public fun clone ()Lio/sentry/featureflags/IFeatureFlagBuffer; public synthetic fun clone ()Ljava/lang/Object; public fun getFeatureFlags ()Lio/sentry/protocol/FeatureFlags; @@ -5063,6 +5070,7 @@ public final class io/sentry/featureflags/NoOpFeatureFlagBuffer : io/sentry/feat public final class io/sentry/featureflags/SpanFeatureFlagBuffer : io/sentry/featureflags/IFeatureFlagBuffer { public fun add (Ljava/lang/String;Ljava/lang/Boolean;)V + public fun clear ()V public fun clone ()Lio/sentry/featureflags/IFeatureFlagBuffer; public synthetic fun clone ()Ljava/lang/Object; public static fun create ()Lio/sentry/featureflags/IFeatureFlagBuffer; diff --git a/sentry/src/main/java/io/sentry/CombinedScopeView.java b/sentry/src/main/java/io/sentry/CombinedScopeView.java index 0c61bdf9126..f21f8697fa4 100644 --- a/sentry/src/main/java/io/sentry/CombinedScopeView.java +++ b/sentry/src/main/java/io/sentry/CombinedScopeView.java @@ -549,6 +549,11 @@ public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean } } + @Override + public void clearFeatureFlags() { + getDefaultWriteScope().clearFeatureFlags(); + } + @Override public @Nullable FeatureFlags getFeatureFlags() { return getFeatureFlagBuffer().getFeatureFlags(); diff --git a/sentry/src/main/java/io/sentry/IScope.java b/sentry/src/main/java/io/sentry/IScope.java index ccab8dbdeb3..5b6c38bbcfb 100644 --- a/sentry/src/main/java/io/sentry/IScope.java +++ b/sentry/src/main/java/io/sentry/IScope.java @@ -465,6 +465,8 @@ void setSpanContext( void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result); + void clearFeatureFlags(); + @ApiStatus.Internal @Nullable FeatureFlags getFeatureFlags(); diff --git a/sentry/src/main/java/io/sentry/NoOpScope.java b/sentry/src/main/java/io/sentry/NoOpScope.java index 7693ab81deb..9d2f603c673 100644 --- a/sentry/src/main/java/io/sentry/NoOpScope.java +++ b/sentry/src/main/java/io/sentry/NoOpScope.java @@ -321,6 +321,9 @@ public void removeAttribute(@Nullable String key) {} @Override public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) {} + @Override + public void clearFeatureFlags() {} + @Override public @Nullable FeatureFlags getFeatureFlags() { return null; diff --git a/sentry/src/main/java/io/sentry/Scope.java b/sentry/src/main/java/io/sentry/Scope.java index fa44e90a194..9e8d3ee554e 100644 --- a/sentry/src/main/java/io/sentry/Scope.java +++ b/sentry/src/main/java/io/sentry/Scope.java @@ -574,6 +574,7 @@ public void clear() { eventProcessors.clear(); clearTransaction(); clearAttachments(); + clearFeatureFlags(); } /** @@ -1211,6 +1212,11 @@ public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean featureFlags.add(flag, result); } + @Override + public void clearFeatureFlags() { + featureFlags.clear(); + } + @Override public @Nullable FeatureFlags getFeatureFlags() { return featureFlags.getFeatureFlags(); diff --git a/sentry/src/main/java/io/sentry/featureflags/FeatureFlagBuffer.java b/sentry/src/main/java/io/sentry/featureflags/FeatureFlagBuffer.java index f38d0b6db52..fc696b5948f 100644 --- a/sentry/src/main/java/io/sentry/featureflags/FeatureFlagBuffer.java +++ b/sentry/src/main/java/io/sentry/featureflags/FeatureFlagBuffer.java @@ -69,6 +69,13 @@ public void add(final @Nullable String flag, final @Nullable Boolean result) { } } + @Override + public void clear() { + try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { + flags.clear(); + } + } + @Override public @Nullable FeatureFlags getFeatureFlags() { List featureFlags = new ArrayList<>(); diff --git a/sentry/src/main/java/io/sentry/featureflags/IFeatureFlagBuffer.java b/sentry/src/main/java/io/sentry/featureflags/IFeatureFlagBuffer.java index 7f12026a590..90a503cce49 100644 --- a/sentry/src/main/java/io/sentry/featureflags/IFeatureFlagBuffer.java +++ b/sentry/src/main/java/io/sentry/featureflags/IFeatureFlagBuffer.java @@ -9,6 +9,8 @@ public interface IFeatureFlagBuffer { void add(final @Nullable String flag, final @Nullable Boolean result); + void clear(); + @Nullable FeatureFlags getFeatureFlags(); diff --git a/sentry/src/main/java/io/sentry/featureflags/NoOpFeatureFlagBuffer.java b/sentry/src/main/java/io/sentry/featureflags/NoOpFeatureFlagBuffer.java index 3bfc8f8fd2a..e093531149a 100644 --- a/sentry/src/main/java/io/sentry/featureflags/NoOpFeatureFlagBuffer.java +++ b/sentry/src/main/java/io/sentry/featureflags/NoOpFeatureFlagBuffer.java @@ -16,6 +16,9 @@ public static NoOpFeatureFlagBuffer getInstance() { @Override public void add(final @Nullable String flag, final @Nullable Boolean result) {} + @Override + public void clear() {} + @Override public @Nullable FeatureFlags getFeatureFlags() { return null; diff --git a/sentry/src/main/java/io/sentry/featureflags/SpanFeatureFlagBuffer.java b/sentry/src/main/java/io/sentry/featureflags/SpanFeatureFlagBuffer.java index 2afa45d38d1..d31bc231d44 100644 --- a/sentry/src/main/java/io/sentry/featureflags/SpanFeatureFlagBuffer.java +++ b/sentry/src/main/java/io/sentry/featureflags/SpanFeatureFlagBuffer.java @@ -48,6 +48,13 @@ public void add(final @Nullable String flag, final @Nullable Boolean result) { } } + @Override + public void clear() { + try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { + flags = null; + } + } + @Override public @Nullable FeatureFlags getFeatureFlags() { try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { diff --git a/sentry/src/test/java/io/sentry/ScopeTest.kt b/sentry/src/test/java/io/sentry/ScopeTest.kt index 7093473a60b..4b0047fdc18 100644 --- a/sentry/src/test/java/io/sentry/ScopeTest.kt +++ b/sentry/src/test/java/io/sentry/ScopeTest.kt @@ -294,6 +294,7 @@ class ScopeTest { scope.setAttribute("some", "attribute") scope.addEventProcessor(eventProcessor()) scope.addAttachment(Attachment("path")) + scope.addFeatureFlag("flag", true) scope.clear() @@ -309,6 +310,7 @@ class ScopeTest { assertEquals(0, scope.extras.size) assertEquals(0, scope.eventProcessors.size) assertEquals(0, scope.attachments.size) + assertEquals(0, scope.featureFlags!!.values.size) } @Test @@ -1155,6 +1157,18 @@ class ScopeTest { assertEquals(0, flags.values.size) } + @Test + fun `feature flags can be cleared`() { + val scope = Scope(SentryOptions.empty()) + + scope.addFeatureFlag("flag1", true) + scope.clearFeatureFlags() + + val flags = scope.featureFlags + assertNotNull(flags) + assertEquals(0, flags.values.size) + } + @Test fun `setAttribute stores attribute on scope`() { val scope = Scope(SentryOptions()) diff --git a/sentry/src/test/java/io/sentry/featureflags/FeatureFlagBufferTest.kt b/sentry/src/test/java/io/sentry/featureflags/FeatureFlagBufferTest.kt index 471ba880eb4..8ec18ce02b8 100644 --- a/sentry/src/test/java/io/sentry/featureflags/FeatureFlagBufferTest.kt +++ b/sentry/src/test/java/io/sentry/featureflags/FeatureFlagBufferTest.kt @@ -33,6 +33,19 @@ class FeatureFlagBufferTest { assertFalse(featureFlagValues[1]!!.result) } + @Test + fun `clears values`() { + val buffer = FeatureFlagBuffer.create(SentryOptions().also { it.maxFeatureFlags = 2 }) + buffer.add("a", true) + buffer.add("b", false) + + buffer.clear() + + val featureFlags = buffer.featureFlags + assertNotNull(featureFlags) + assertEquals(0, featureFlags.values.size) + } + @Test fun `drops oldest entry when limit is reached`() { val buffer = FeatureFlagBuffer.create(SentryOptions().also { it.maxFeatureFlags = 2 }) diff --git a/sentry/src/test/java/io/sentry/featureflags/SpanFeatureFlagBufferTest.kt b/sentry/src/test/java/io/sentry/featureflags/SpanFeatureFlagBufferTest.kt index 07c3feaf5c9..c6c89d9f3ab 100644 --- a/sentry/src/test/java/io/sentry/featureflags/SpanFeatureFlagBufferTest.kt +++ b/sentry/src/test/java/io/sentry/featureflags/SpanFeatureFlagBufferTest.kt @@ -4,6 +4,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertNotNull +import kotlin.test.assertNull import kotlin.test.assertTrue class SpanFeatureFlagBufferTest { @@ -26,6 +27,17 @@ class SpanFeatureFlagBufferTest { assertFalse(featureFlagValues[1]!!.result) } + @Test + fun `clears values`() { + val buffer = SpanFeatureFlagBuffer.create() + buffer.add("a", true) + buffer.add("b", false) + + buffer.clear() + + assertNull(buffer.featureFlags) + } + @Test fun `rejects new entries when limit is reached`() { val buffer = SpanFeatureFlagBuffer.create() From 69508a17fe4442278632fb13fd7f658a94e6f008 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 20 May 2026 12:17:27 +0200 Subject: [PATCH 161/391] feat(tombstones): Add option to attach raw tombstone as protobuf (#5446) * feat(android): Add option to attach raw tombstone as protobuf Co-Authored-By: Claude Opus 4.6 (1M context) * changelog * changelog * ref(android): Rename attachTombstone to attachRawTombstone Co-Authored-By: Claude Opus 4.6 (1M context) * test(android): Add tests for raw tombstone attachment Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * fix(android): Close tombstone InputStream after reading bytes Co-Authored-By: Claude Opus 4.6 (1M context) * ref(android): Extract shared readBytes into NativeEventUtils Co-Authored-By: Claude Opus 4.6 (1M context) * fix(android): Fix JavaDoc and address review feedback Co-Authored-By: Claude Opus 4.6 (1M context) * ref(android): Only pre-buffer tombstone bytes when attach option is on Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 2 + .../api/sentry-android-core.api | 2 + .../sentry/android/core/AnrV2Integration.java | 18 +------ .../android/core/ManifestMetadataReader.java | 3 ++ .../android/core/SentryAndroidOptions.java | 14 +++++ .../android/core/TombstoneIntegration.java | 51 ++++++++++++------- .../core/internal/util/NativeEventUtils.java | 15 ++++++ .../core/ManifestMetadataReaderTest.kt | 25 +++++++++ .../android/core/TombstoneIntegrationTest.kt | 39 ++++++++++++++ sentry/api/sentry.api | 3 ++ .../src/main/java/io/sentry/Attachment.java | 10 ++++ sentry/src/main/java/io/sentry/Hint.java | 9 ++++ .../src/main/java/io/sentry/SentryClient.java | 5 ++ .../test/java/io/sentry/SentryClientTest.kt | 32 ++++++++++++ .../src/test/java/io/sentry/hints/HintTest.kt | 11 ++++ 15 files changed, 205 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4241d6e4f82..fca85f96435 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features +- Add option to attach raw tombstone protobuf on native crash events ([#5446](https://github.com/getsentry/sentry-java/pull/5446)) + - Enable via `options.isAttachRawTombstone = true` or manifest: `` - Add API to clear feature flags from scopes ([#5426](https://github.com/getsentry/sentry-java/pull/5426)) - Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 3d4512fc2b4..249549f8366 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -374,6 +374,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun isAnrProfilingEnabled ()Z public fun isAnrReportInDebug ()Z public fun isAttachAnrThreadDump ()Z + public fun isAttachRawTombstone ()Z public fun isAttachScreenshot ()Z public fun isAttachViewHierarchy ()Z public fun isCollectAdditionalContext ()Z @@ -401,6 +402,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun setAnrReportInDebug (Z)V public fun setAnrTimeoutIntervalMillis (J)V public fun setAttachAnrThreadDump (Z)V + public fun setAttachRawTombstone (Z)V public fun setAttachScreenshot (Z)V public fun setAttachViewHierarchy (Z)V public fun setBeforeScreenshotCaptureCallback (Lio/sentry/android/core/SentryAndroidOptions$BeforeCaptureCallback;)V diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java index af3a942c8cc..8d88285a356 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java @@ -18,6 +18,7 @@ import io.sentry.android.core.cache.AndroidEnvelopeCache; import io.sentry.android.core.internal.threaddump.Lines; import io.sentry.android.core.internal.threaddump.ThreadDumpParser; +import io.sentry.android.core.internal.util.NativeEventUtils; import io.sentry.hints.AbnormalExit; import io.sentry.hints.Backfillable; import io.sentry.hints.BlockingFlushHint; @@ -32,7 +33,6 @@ import io.sentry.util.Objects; import java.io.BufferedReader; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; @@ -194,7 +194,7 @@ public boolean shouldReportHistorical() { if (trace == null) { return new ParseResult(ParseResult.Type.NO_DUMP); } - dump = getDumpBytes(trace); + dump = NativeEventUtils.readBytes(trace); } catch (Throwable e) { options.getLogger().log(SentryLevel.WARNING, "Failed to read ANR thread dump", e); return new ParseResult(ParseResult.Type.NO_DUMP); @@ -223,20 +223,6 @@ public boolean shouldReportHistorical() { return new ParseResult(ParseResult.Type.ERROR, dump); } } - - private byte[] getDumpBytes(final @NotNull InputStream trace) throws IOException { - try (final ByteArrayOutputStream buffer = new ByteArrayOutputStream()) { - - int nRead; - final byte[] data = new byte[1024]; - - while ((nRead = trace.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); - } - - return buffer.toByteArray(); - } - } } @ApiStatus.Internal diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index b52634774d6..e16d4b312fc 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -36,6 +36,7 @@ final class ManifestMetadataReader { static final String ANR_REPORT_HISTORICAL = "io.sentry.anr.report-historical"; static final String TOMBSTONE_ENABLE = "io.sentry.tombstone.enable"; + static final String TOMBSTONE_ATTACH_RAW = "io.sentry.tombstone.attach-raw"; static final String AUTO_INIT = "io.sentry.auto-init"; static final String NDK_ENABLE = "io.sentry.ndk.enable"; @@ -226,6 +227,8 @@ static void applyMetadata( options.setAnrEnabled(readBool(metadata, logger, ANR_ENABLE, options.isAnrEnabled())); options.setTombstoneEnabled( readBool(metadata, logger, TOMBSTONE_ENABLE, options.isTombstoneEnabled())); + options.setAttachRawTombstone( + readBool(metadata, logger, TOMBSTONE_ATTACH_RAW, options.isAttachRawTombstone())); // use enableAutoSessionTracking as fallback options.setEnableAutoSessionTracking( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index 8fe702aad50..bb9ec17aabd 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -238,6 +238,12 @@ public interface BeforeCaptureCallback { */ private boolean attachAnrThreadDump = false; + /** + * Controls whether to attach the raw tombstone protobuf as an attachment. The tombstone is being + * attached from {@link ApplicationExitInfo#getTraceInputStream()}, if available. + */ + private boolean attachRawTombstone = false; + private boolean enablePerformanceV2 = true; private @Nullable SentryFrameMetricsCollector frameMetricsCollector; @@ -643,6 +649,14 @@ public void setAttachAnrThreadDump(final boolean attachAnrThreadDump) { this.attachAnrThreadDump = attachAnrThreadDump; } + public boolean isAttachRawTombstone() { + return attachRawTombstone; + } + + public void setAttachRawTombstone(final boolean attachRawTombstone) { + this.attachRawTombstone = attachRawTombstone; + } + /** * @return true if performance-v2 is enabled. See {@link #setEnablePerformanceV2(boolean)} for * more details. diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/TombstoneIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/TombstoneIntegration.java index f2b87742544..2663051f7e4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/TombstoneIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/TombstoneIntegration.java @@ -24,6 +24,7 @@ import io.sentry.android.core.cache.AndroidEnvelopeCache; import io.sentry.android.core.internal.tombstone.NativeExceptionMechanism; import io.sentry.android.core.internal.tombstone.TombstoneParser; +import io.sentry.android.core.internal.util.NativeEventUtils; import io.sentry.hints.Backfillable; import io.sentry.hints.BlockingFlushHint; import io.sentry.hints.NativeCrashExit; @@ -36,6 +37,7 @@ import io.sentry.transport.ICurrentDateProvider; import io.sentry.util.HintUtils; import io.sentry.util.Objects; +import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; @@ -150,26 +152,35 @@ public boolean shouldReportHistorical() { public @Nullable ApplicationExitInfoHistoryDispatcher.Report buildReport( final @NotNull ApplicationExitInfo exitInfo, final boolean enrich) { SentryEvent event; + @Nullable byte[] rawTombstone = null; try { - final InputStream tombstoneInputStream = exitInfo.getTraceInputStream(); - if (tombstoneInputStream == null) { - options - .getLogger() - .log( - SentryLevel.WARNING, - "No tombstone InputStream available for ApplicationExitInfo from %s", - DateTimeFormatter.ISO_INSTANT.format( - Instant.ofEpochMilli(exitInfo.getTimestamp()))); - return null; - } + final boolean attachRaw = options.isAttachRawTombstone(); + try (final InputStream tombstoneInputStream = exitInfo.getTraceInputStream()) { + if (tombstoneInputStream == null) { + options + .getLogger() + .log( + SentryLevel.WARNING, + "No tombstone InputStream available for ApplicationExitInfo from %s", + DateTimeFormatter.ISO_INSTANT.format( + Instant.ofEpochMilli(exitInfo.getTimestamp()))); + return null; + } - try (final TombstoneParser parser = - new TombstoneParser( - tombstoneInputStream, - this.options.getInAppIncludes(), - this.options.getInAppExcludes(), - this.context.getApplicationInfo().nativeLibraryDir)) { - event = parser.parse(); + if (attachRaw) { + rawTombstone = NativeEventUtils.readBytes(tombstoneInputStream); + } + + final InputStream parserInput = + attachRaw ? new ByteArrayInputStream(rawTombstone) : tombstoneInputStream; + try (final TombstoneParser parser = + new TombstoneParser( + parserInput, + this.options.getInAppIncludes(), + this.options.getInAppExcludes(), + this.context.getApplicationInfo().nativeLibraryDir)) { + event = parser.parse(); + } } } catch (Throwable e) { options @@ -190,6 +201,10 @@ public boolean shouldReportHistorical() { options.getFlushTimeoutMillis(), options.getLogger(), tombstoneTimestamp, enrich); final Hint hint = HintUtils.createWithTypeCheckHint(tombstoneHint); + if (rawTombstone != null) { + hint.setTombstone(Attachment.fromTombstone(rawTombstone)); + } + try { final @Nullable SentryEvent mergedEvent = mergeWithMatchingNativeEvents(tombstoneTimestamp, event, hint); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/NativeEventUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/NativeEventUtils.java index f8bd70cb6c3..c5e766b3c44 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/NativeEventUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/NativeEventUtils.java @@ -1,5 +1,8 @@ package io.sentry.android.core.internal.util; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.math.BigInteger; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; @@ -8,6 +11,18 @@ import org.jetbrains.annotations.Nullable; public class NativeEventUtils { + + public static byte[] readBytes(final @NotNull InputStream stream) throws IOException { + try (final ByteArrayOutputStream buffer = new ByteArrayOutputStream()) { + int nRead; + final byte[] data = new byte[1024]; + while ((nRead = stream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + return buffer.toByteArray(); + } + } + @Nullable public static String buildIdToDebugId(final @NotNull String buildId) { try { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index cedf5ca18bb..d8ac959601a 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -288,6 +288,31 @@ class ManifestMetadataReaderTest { assertEquals(false, fixture.options.isAttachAnrThreadDump) } + @Test + fun `applyMetadata reads tombstone attach raw to options`() { + // Arrange + val bundle = bundleOf(ManifestMetadataReader.TOMBSTONE_ATTACH_RAW to true) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(true, fixture.options.isAttachRawTombstone) + } + + @Test + fun `applyMetadata reads tombstone attach raw to options and keeps default`() { + // Arrange + val context = fixture.getContext() + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(false, fixture.options.isAttachRawTombstone) + } + @Test fun `applyMetadata reads anr report historical to options`() { // Arrange diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt index 3b27d69d087..9890d553dbc 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt @@ -96,6 +96,45 @@ class TombstoneIntegrationTest : ApplicationExitIntegrationTestBase + options.isAttachRawTombstone = true + } + + fixture.addAppExitInfo(timestamp = newTimestamp) + + integration.register(fixture.scopes, fixture.options) + + verify(fixture.scopes) + .captureEvent( + any(), + argThat { + val tombstone = this.tombstone + tombstone != null && + tombstone.filename == "tombstone.pb" && + tombstone.contentType == "application/x-protobuf" && + tombstone.bytes != null && + tombstone.bytes!!.isNotEmpty() + }, + ) + } + + @Test + fun `when attachRawTombstone is disabled, no tombstone is attached to hint`() { + val integration = + fixture.getSut(tmpDir, lastReportedTimestamp = oldTimestamp) { options -> + options.isAttachRawTombstone = false + } + + fixture.addAppExitInfo(timestamp = newTimestamp) + + integration.register(fixture.scopes, fixture.options) + + verify(fixture.scopes).captureEvent(any(), argThat { this.tombstone == null }) + } + @Test fun `when matching native event has attachments, they are added to the hint`() { val integration = diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index e48c03ffb15..6b8377de3a3 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -19,6 +19,7 @@ public final class io/sentry/Attachment { public static fun fromByteProvider (Ljava/util/concurrent/Callable;Ljava/lang/String;Ljava/lang/String;Z)Lio/sentry/Attachment; public static fun fromScreenshot ([B)Lio/sentry/Attachment; public static fun fromThreadDump ([B)Lio/sentry/Attachment; + public static fun fromTombstone ([B)Lio/sentry/Attachment; public static fun fromViewHierarchy (Lio/sentry/protocol/ViewHierarchy;)Lio/sentry/Attachment; public fun getAttachmentType ()Ljava/lang/String; public fun getByteProvider ()Ljava/util/concurrent/Callable; @@ -614,6 +615,7 @@ public final class io/sentry/Hint { public fun getReplayRecording ()Lio/sentry/ReplayRecording; public fun getScreenshot ()Lio/sentry/Attachment; public fun getThreadDump ()Lio/sentry/Attachment; + public fun getTombstone ()Lio/sentry/Attachment; public fun getViewHierarchy ()Lio/sentry/Attachment; public fun remove (Ljava/lang/String;)V public fun replaceAttachments (Ljava/util/List;)V @@ -621,6 +623,7 @@ public final class io/sentry/Hint { public fun setReplayRecording (Lio/sentry/ReplayRecording;)V public fun setScreenshot (Lio/sentry/Attachment;)V public fun setThreadDump (Lio/sentry/Attachment;)V + public fun setTombstone (Lio/sentry/Attachment;)V public fun setViewHierarchy (Lio/sentry/Attachment;)V public static fun withAttachment (Lio/sentry/Attachment;)Lio/sentry/Hint; public static fun withAttachments (Ljava/util/List;)Lio/sentry/Hint; diff --git a/sentry/src/main/java/io/sentry/Attachment.java b/sentry/src/main/java/io/sentry/Attachment.java index 439ad812b0c..3e4cb859e5e 100644 --- a/sentry/src/main/java/io/sentry/Attachment.java +++ b/sentry/src/main/java/io/sentry/Attachment.java @@ -396,4 +396,14 @@ boolean isAddToTransactions() { public static @NotNull Attachment fromThreadDump(final byte[] bytes) { return new Attachment(bytes, "thread-dump.txt", "text/plain", false); } + + /** + * Creates a new Tombstone Attachment + * + * @param bytes the array bytes + * @return the Attachment + */ + public static @NotNull Attachment fromTombstone(final byte[] bytes) { + return new Attachment(bytes, "tombstone.pb", "application/x-protobuf", false); + } } diff --git a/sentry/src/main/java/io/sentry/Hint.java b/sentry/src/main/java/io/sentry/Hint.java index d7949b3133b..1e09dca5541 100644 --- a/sentry/src/main/java/io/sentry/Hint.java +++ b/sentry/src/main/java/io/sentry/Hint.java @@ -32,6 +32,7 @@ public final class Hint { private @Nullable Attachment screenshot = null; private @Nullable Attachment viewHierarchy = null; private @Nullable Attachment threadDump = null; + private @Nullable Attachment tombstone = null; private @Nullable ReplayRecording replayRecording = null; public static @NotNull Hint withAttachment(@Nullable Attachment attachment) { @@ -147,6 +148,14 @@ public void setThreadDump(final @Nullable Attachment threadDump) { return threadDump; } + public void setTombstone(final @Nullable Attachment tombstone) { + this.tombstone = tombstone; + } + + public @Nullable Attachment getTombstone() { + return tombstone; + } + @Nullable public ReplayRecording getReplayRecording() { return replayRecording; diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index c99fcaeaa2f..6f328d0fd58 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -399,6 +399,11 @@ private boolean shouldSendSessionUpdateForDroppedEvent( attachments.add(threadDump); } + @Nullable final Attachment tombstone = hint.getTombstone(); + if (tombstone != null) { + attachments.add(tombstone); + } + return attachments; } diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index 11ff80fd573..663b1f9bdee 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -2124,6 +2124,37 @@ class SentryClientTest { .send(check { envelope -> assertEquals(1, envelope.items.count()) }, anyOrNull()) } + @Test + fun `tombstone is added to the envelope from the hint`() { + val sut = fixture.getSut() + val attachment = Attachment.fromTombstone(byteArrayOf()) + val hint = Hint().also { it.tombstone = attachment } + + sut.captureEvent(SentryEvent(), hint) + + verify(fixture.transport) + .send( + check { envelope -> + val tombstone = envelope.items.last() + assertNotNull(tombstone) { assertEquals(attachment.filename, tombstone.header.fileName) } + }, + anyOrNull(), + ) + } + + @Test + fun `tombstone is dropped from hint via before send`() { + fixture.sentryOptions.beforeSend = CustomBeforeSendCallback() + val sut = fixture.getSut() + val attachment = Attachment.fromTombstone(byteArrayOf()) + val hint = Hint().also { it.tombstone = attachment } + + sut.captureEvent(SentryEvent(), hint) + + verify(fixture.transport) + .send(check { envelope -> assertEquals(1, envelope.items.count()) }, anyOrNull()) + } + @Test fun `capturing an error updates session and sends event + session`() { val sut = fixture.getSut() @@ -3647,6 +3678,7 @@ class SentryClientTest { hint.screenshot = null hint.viewHierarchy = null hint.threadDump = null + hint.tombstone = null return event } } diff --git a/sentry/src/test/java/io/sentry/hints/HintTest.kt b/sentry/src/test/java/io/sentry/hints/HintTest.kt index 7be03e7dd67..7b0c695bfd4 100644 --- a/sentry/src/test/java/io/sentry/hints/HintTest.kt +++ b/sentry/src/test/java/io/sentry/hints/HintTest.kt @@ -210,6 +210,7 @@ class HintTest { hint.screenshot = newAttachment("2") hint.viewHierarchy = newAttachment("3") hint.threadDump = newAttachment("4") + hint.tombstone = newAttachment("5") hint.clear() @@ -219,6 +220,7 @@ class HintTest { assertNotNull(hint.screenshot) assertNotNull(hint.viewHierarchy) assertNotNull(hint.threadDump) + assertNotNull(hint.tombstone) } @Test @@ -248,6 +250,15 @@ class HintTest { assertNotNull(hint.threadDump) } + @Test + fun `can create hint with a tombstone`() { + val hint = Hint() + val attachment = newAttachment("tombstone") + hint.tombstone = attachment + + assertNotNull(hint.tombstone) + } + companion object { fun newAttachment(content: String) = Attachment(content.toByteArray(), "$content.txt") } From 01a40a9d2a67409223317b9e93d94d3fa8e3f6dd Mon Sep 17 00:00:00 2001 From: 0xadam-brown <281682121+0xadam-brown@users.noreply.github.com> Date: Wed, 20 May 2026 12:16:13 +0000 Subject: [PATCH 162/391] release: 8.42.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fca85f96435..3e869e9aac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.42.0 ### Features diff --git a/gradle.properties b/gradle.properties index 81fdf72ff04..a8f42329732 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.41.0 +versionName=8.42.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 184b99116b540d45687084b79e0d8d1d9b0483f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 15:35:33 +0200 Subject: [PATCH 163/391] chore(deps): bump idna in the uv group across 1 directory (#5451) Bumps the uv group with 1 update in the / directory: [idna](https://github.com/kjd/idna). Updates `idna` from 3.10 to 3.15 - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md) - [Commits](https://github.com/kjd/idna/compare/v3.10...v3.15) --- updated-dependencies: - dependency-name: idna dependency-version: '3.15' dependency-type: direct:production dependency-group: uv ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8bdd5f892df..c573fa72259 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ certifi==2025.7.14 charset-normalizer==3.4.2 -idna==3.10 +idna==3.15 requests==2.33.0 urllib3==2.7.0 From 9392427e0ff0657e38f47ec82342ef2e0fdc2d5a Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 21 May 2026 12:03:44 +0200 Subject: [PATCH 164/391] chore(ci): Skip Spring Boot tests when updating Android modules (#5453) * chore(ci): Skip Spring Boot matrix jobs on Android-only pull requests (JAVA-510) Prior to this commit, Android-only PRs were silently triggering 14 unrelated Spring Boot matrix jobs (up to 45 min each). This commit fixes that by adding missing PR filters for all Android directories, letting us skip Spring Boot CI entirely when nothing Spring-related changes. Note: Every push to main still runs the full matrix. --------- Co-authored-by: Cursor --- .github/workflows/spring-boot-2-matrix.yml | 6 ++++-- .github/workflows/spring-boot-3-matrix.yml | 6 ++++-- .github/workflows/spring-boot-4-matrix.yml | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 38aaacec27a..9a69765657c 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -4,9 +4,11 @@ on: push: branches: - main - paths-ignore: - - '**/sentry-android/**' pull_request: + paths-ignore: + - '*android*/**' + - 'sentry-compose/**' + - 'sentry-samples/sentry-samples-android/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 629535e282d..c6a83c597fb 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -4,9 +4,11 @@ on: push: branches: - main - paths-ignore: - - '**/sentry-android/**' pull_request: + paths-ignore: + - '*android*/**' + - 'sentry-compose/**' + - 'sentry-samples/sentry-samples-android/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index bbd4f986d96..93d314de2e3 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -4,9 +4,11 @@ on: push: branches: - main - paths-ignore: - - '**/sentry-android/**' pull_request: + paths-ignore: + - '*android*/**' + - 'sentry-compose/**' + - 'sentry-samples/sentry-samples-android/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 93590c466b71c92baddd217c6af595be6a897647 Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 21 May 2026 12:04:57 +0200 Subject: [PATCH 165/391] chore(ci): Skip backend system tests when updating Android modules (#5455) chore(ci): Stop backend system tests from running on Android-only PRs (JAVA-519) Prior to this commit, Android-only PRs were silently triggering 24 unrelated backend system test jobs (up to 10 min each). This update lets us skip those jobs when we don't need them. Note: Every push to main still runs the full matrix. --------- Co-authored-by: Cursor --- .github/workflows/system-tests-backend.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 007fe575d14..ea6a53a8750 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -5,6 +5,10 @@ on: branches: - main pull_request: + paths-ignore: + - '*android*/**' + - 'sentry-compose/**' + - 'sentry-samples/sentry-samples-android/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From c3ee041489d813b39609501374678f04b3e4677f Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 21 May 2026 12:52:12 +0200 Subject: [PATCH 166/391] chore(ai): Add check-code-attribution skill (JAVA-499) (#5449) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chore(ai): Add check-code-attribution skill (JAVA-499) Adds a check-code-attribution skill that validates license headers + THIRD_PARTY_NOTICES.md entries for code copied or adapted from third parties. Also verifies license compatiblity against Sentry's licensing policy. Focus is limited to the branch diff. Reports any issues found via PR comments (when run on CI) or to the terminal (when run locally). To run it in Claude Code: ``` /check-code-attribution ``` Runs on CI automatically via [Warden](https://warden.sentry.dev/). - Purely advisory / does not block merge. - Generates PR comments with code suggestions for all discovered issues. - Automatically manages removing stale comments as PRs are updated. Current Warden configs: ┌─────────────────┬─────────────────────────────┬───────────────────────────────────────────────────┐ │ Setting │ Value │ Effect │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ model │ anthropic/claude-sonnet-4-6 │ Model used for analysis │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ maxTurns │ 30 │ Max tool calls per chunk │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ skill │ check-code-attribution │ Per-file vendored code attribution check │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ failOn │ off │ Do not fail workflow if attribution issues found │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ reportOn │ medium │ Show findings at >= medium severity via PR comment│ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ requestChanges │ false │ Never post REQUEST_CHANGES comments on PRs │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ failCheck │ false │ No red X on workflow in GitHub UI if it fails │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ triggers │ pull_request + local │ Runs on PR open/sync and local warden invocations │ ├─────────────────┼─────────────────────────────┼───────────────────────────────────────────────────┤ │ reportOnSuccess │ false (default) │ No comment when everything is clean │ └─────────────────┴─────────────────────────────┴───────────────────────────────────────────────────┘ Going forward, we can consider blocking PRs once we've had a chance to vet behavior in the wild. --- .claude/skills/.gitignore | 2 + .../skills/check-code-attribution/SKILL.md | 244 +++++++++++ .../validation-tests/EXPECTED.json | 53 +++ .../validation-tests/README.md | 86 ++++ .../THIRD_PARTY_NOTICES.catalog.md | 130 ++++++ .../validation-tests/assert-scenarios.mjs | 401 ++++++++++++++++++ .../check-code-attribution-tests.sh | 246 +++++++++++ .../HeaderCompleteAndNoticePresent.java | 19 + .../HeaderCompleteButNoticeMissing.java | 17 + .../scenarios/HeaderFullyStripped.java | 7 + .../HeaderMissingButNoticePresent.java | 8 + .../HeaderMissingNonEssentialInfo.java | 12 + .../scenarios/HeaderPartiallyStripped.java | 10 + .../scenarios/NewLicenseType.java | 10 + .../THIRD_PARTY_NOTICES.mismatch-snippet.md | 37 ++ .gitignore | 3 + AGENTS.md | 2 + agents.toml | 4 + warden.toml | 101 +++++ 19 files changed, 1392 insertions(+) create mode 100644 .claude/skills/check-code-attribution/SKILL.md create mode 100644 .claude/skills/check-code-attribution/validation-tests/EXPECTED.json create mode 100644 .claude/skills/check-code-attribution/validation-tests/README.md create mode 100644 .claude/skills/check-code-attribution/validation-tests/THIRD_PARTY_NOTICES.catalog.md create mode 100755 .claude/skills/check-code-attribution/validation-tests/assert-scenarios.mjs create mode 100755 .claude/skills/check-code-attribution/validation-tests/check-code-attribution-tests.sh create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteAndNoticePresent.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteButNoticeMissing.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderFullyStripped.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingButNoticePresent.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingNonEssentialInfo.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/HeaderPartiallyStripped.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/NewLicenseType.java create mode 100644 .claude/skills/check-code-attribution/validation-tests/scenarios/THIRD_PARTY_NOTICES.mismatch-snippet.md create mode 100644 warden.toml diff --git a/.claude/skills/.gitignore b/.claude/skills/.gitignore index 229f4495ee3..2dd55eba801 100644 --- a/.claude/skills/.gitignore +++ b/.claude/skills/.gitignore @@ -8,3 +8,5 @@ !test/** !btrace-perfetto/ !btrace-perfetto/** +!check-code-attribution/ +!check-code-attribution/** diff --git a/.claude/skills/check-code-attribution/SKILL.md b/.claude/skills/check-code-attribution/SKILL.md new file mode 100644 index 00000000000..ee66327c260 --- /dev/null +++ b/.claude/skills/check-code-attribution/SKILL.md @@ -0,0 +1,244 @@ +--- +name: check-code-attribution +description: Per-file check of vendored code attribution in the current branch diff, including license headers, THIRD_PARTY_NOTICES.md entries, and compatibility with Sentry's licensing policy +allowed-tools: Bash Read Grep Glob +--- + +# Check Code Attribution + +You are reviewing changed files for third-party code attribution compliance in **sentry-java**, an MIT-licensed repository. + +## Local runs + +When running locally (not via Warden), review every file changed on this branch vs the base branch. Apply the same path exclusions as `ignorePaths` in `warden.toml`, then run Quick triage and the checks below on each file. For git commands to list changed files and Warden CLI setup, see `validation-tests/README.md`. `/check-code-attribution` in the IDE does not require Warden credentials. + +When running via Warden, the changed file is already provided — skip branch-wide discovery, but follow **Warden execution** below. + +## Warden execution + +Warden analyzes one changed file per run (whole-file mode). Complete every Quick triage step — the diff alone is not sufficient. + +**Mandatory on every run (do not skip):** + +1. Read the first 50 lines of the changed file. +2. Search `THIRD_PARTY_NOTICES.md` for the class name (filename without extension, e.g. `ANRWatchDog` for `ANRWatchDog.java`). On renames, also search for the old basename and read Scope sections (see Quick triage). +3. When you can compare against the base branch version, inspect the header at that revision (first 50 lines). + +**Do not dismiss findings because:** + +- A `THIRD_PARTY_NOTICES.md` entry exists — file headers are still required; NOTICES does not replace them. +- The diff only removes a header comment block — if removed `-` lines include a **required field** (see below) or vendoring language ("adapted from", etc.), attribution was stripped. Removing boilerplate alone is not stripping. +- The header says "Adapted from …" but omits copyright holder or license name — flag missing header fields. +- The file header has all four required fields — a missing THIRD_PARTY_NOTICES.md entry is independently required and is ⚠️ medium regardless of header completeness. + +For `THIRD_PARTY_NOTICES.md` runs: for every **removed** entry in the diff, confirm whether Scope files still exist with attribution headers. If they do, the entry must not be removed. + +## Quick triage + +Sentry's own files carry **no** copyright headers — any copyright/license line indicates third-party code. Every file that reaches this skill is in scope — do not skip files based on extension. + +If this file is `THIRD_PARTY_NOTICES.md`, go to the THIRD_PARTY_NOTICES section below. + +For all other files, perform these checks **before** deciding whether to proceed: + +1. **Read the file header** — inspect the first 50 lines. Look for vendored-code signals: `Copyright`, `Licensed under`, `SPDX-License-Identifier`, or vendoring language ("adapted from", "backported from", "based on", "copied from", "derived from", "inspired by", "ported from", "translated from", "vendored"). +2. **Check THIRD_PARTY_NOTICES.md** — search for the file name without extension (e.g. `ANRWatchDog` when reviewing `ANRWatchDog.java`). A match means this is a known vendored file. **Renames:** if the diff is a rename (`similarity index` / `rename from` in the diff, or a delete of one path and add of another with the same content), also search for the **old** basename and read **Scope** sections in matching entries — NOTICES may still reference the previous class or path name. + > **A complete NOTICES entry does NOT end the check.** It confirms the file is vendored and that the NOTICES requirement is satisfied. The file header is a separate, additional requirement — continue to header verification regardless of NOTICES completeness. +3. **Scan the diff** — check for vendored-code signals on both added (`+`) and **removed (`-`)** lines. Removed lines that drop a **required field** (copyright, license name, source URL, vendoring origin) ARE signals. Removed disclaimer/boilerplate lines alone are not. + +**A signal in ANY of these three sources means this is vendored code — proceed to the vendored source file section.** + +A file referenced in THIRD_PARTY_NOTICES.md is ALWAYS vendored, even if its current header has no attribution. + +**If none of the three sources have signals, report no findings and stop.** + +--- + +## If this file is `THIRD_PARTY_NOTICES.md` + +Validate the changed entries using the diff context: + +1. For each added or modified entry, verify it has all required fields: **Source URL**, **License name**, **Copyright**, **Scope** (file paths), and **full license text** in a fenced code block. +2. For each Scope path, verify the file(s) exist. +3. Flag new license types using the same license-tier table as for source files: weak copyleft (LGPL, MPL, EPL) → 🚨 **high**, strong copyleft (GPL) → 🚨 **high**, AGPL → 🚨 **high** (absolute ban, must be removed). Do not use low or medium for copyleft or AGPL. +4. Flag orphaned entries whose Scope files no longer exist. +5. For **removed** entries (lines prefixed with `-` in the diff), check whether the Scope files still exist and still have attribution headers. If they do, the entry must not be removed. +6. Check **copyright consistency** — the Copyright field must match the copyright line inside the embedded license text. Flag mismatches. + +--- + +## If this is a vendored file + +### 1. Check attribution header + +Check each of the following by reading the file header — not NOTICES. Each is an independent yes/no; a "no" is ⚠️ medium regardless of NOTICES completeness: + +- [ ] **Vendoring origin phrase** — explicit wording such as `Adapted from …`, `Based on …`, `Vendored from …`, or a library name. +- [ ] **Copyright line** — e.g. `Copyright (c) 2016 …`, `Copyright 2010 Square, Inc.` +- [ ] **License name** — e.g. `Licensed under the Apache License, Version 2.0`, `The MIT License` +- [ ] **Source URL** — e.g. `https://github.com/…` + +Exact wording and comment style may vary. **Do not flag** missing or changed content that is not one of these four fields. + +**Each field must be physically present in the file header. A complete `THIRD_PARTY_NOTICES.md` entry does not satisfy any required field — both are independently required. Check each of the four fields by reading the file header, not by reasoning from NOTICES.** + +**Not required in the file header** (full text belongs in `THIRD_PARTY_NOTICES.md`, not in every source file): + +- Full license boilerplate (MIT permission paragraph, Apache "Unless required by applicable law…" disclaimer, ASF contributor grant preamble) +- Wording differences vs the NOTICES embedded license text (e.g. shortened Apache header vs canonical ASF phrasing) +- Comment style (`//` vs `/* */`), line wrapping, or extra Sentry modification notes + +Compare the current header against the NOTICES entry **only for the four required fields** — e.g. if NOTICES says MIT by "Salomon BRYS" but the header has no copyright or license name, flag it. If both have copyright + license name but the header omits the Apache disclaimer while NOTICES still has the full text, **do not flag**. + +When comparing against the base branch version (local runs), use the header at that revision for additional context. + +Flag these issues: +- **Header stripped** — file is in NOTICES but current header has none of the four required fields +- **Header truncated** — one or more **required** fields were removed (e.g. copyright line or `Licensed under …` removed) while the file remains vendored +- **Header inconsistent** — a **required** field contradicts NOTICES (wrong copyright holder/year, wrong license name) — not boilerplate or phrasing differences +- **Diff removes required attribution** — removed `-` lines drop a required field or vendoring origin (`Adapted from`, etc.); removing disclaimer/boilerplate lines alone is **not** this + +**Do not report** (no finding — prefer silence): + +- Apache/MIT disclaimer or permission paragraphs removed but all four required fields remain +- Header reworded to a shorter permissive-license form with the same copyright holder and license name +- Header and NOTICES differ only in full license body text (wording or boilerplate, not missing required fields) + +These exceptions apply only when an entry already exists in NOTICES and only to header-vs-NOTICES wording differences. A **missing** NOTICES entry is ⚠️ medium per section 2 — never covered by these exceptions. + +### 2. Check THIRD_PARTY_NOTICES.md entry + +**Severity: always `medium`. Do not output `severity: "low"` for a missing entry even if the attribution header is complete.** + +`THIRD_PARTY_NOTICES.md` is a mandatory legal exhibit that Sentry ships with every SDK distribution. It must enumerate all vendored code regardless of what the source file header says. A missing entry is a distribution-level compliance failure, not a nit. A complete file header does not satisfy the NOTICES requirement — both are mandatory. + +From the NOTICES search in Quick triage: if no matching entry exists, output `severity: "medium"` and flag as ⚠️ Missing THIRD_PARTY_NOTICES.md entry. A valid entry needs: Source URL, License name, Copyright, Scope, full license text. + +### 3. Check license compatibility + +Classify the license per Sentry's Open Source Legal Policy (https://open.sentry.io/licensing/): + +| Tier | Examples | Finding | +|-----------------|-------------------------------------------------|---------------------------------------------| +| Permissive | MIT, BSD, Apache 2.0, ISC, CC0, Unlicense, Zlib | None — license is compatible | +| Weak copyleft | LGPL, MPL, EPL, CDDL | 🚨 **high** — requires review | +| Strong copyleft | GPL, QPL, Sleepycat, OSL | 🚨 **high** — requires legal review | +| AGPL | — | 🚨 **high** — absolute ban, must be removed | +| No license | — | 🚨 **high** — assume no permission | + +**Permissive licenses:** do not report a finding solely because the license is MIT/BSD/Apache/etc. Only flag missing or stripped **required** header fields, or missing/inconsistent `THIRD_PARTY_NOTICES.md` entry. Do not flag disclaimer/boilerplate-only diffs. Copyleft and unlicensed code still get 🚨 findings per the table. + +--- + +## If this is a deleted vendored file + +If the diff deletes a file and the removed lines contained attribution headers, check whether `THIRD_PARTY_NOTICES.md` still references it — the entry should be updated or removed. + +--- + +## Severity guide + +| Level | Use for | +|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **high** | 🚨 License violations: AGPL, copyleft, unlicensed, no-license code | +| **medium** | ⚠️ Missing **required** header fields, stripped required fields, missing/inconsistent NOTICES entries (even when header is complete), deleted/renamed vendored files needing NOTICES update | +| **low** | 👀 Cosmetic/style differences only (shortened license wording, comment style). **Never** use for a missing NOTICES entry or missing header field — those are always medium. | + +Warden relies on these severity levels when deciding whether to comment on PRs or require changes. Put the severity emoji **only on the finding title** (see Output) so reviewers can triage at a glance. + +## Output + +**No issues → empty response (say nothing).** + +Otherwise, report each finding ordered by severity (most severe first). + +### Emoji placement (required) + +Use the emoji from the severity guide (🚨, ⚠️, or 👀) — not the word `high`, `medium`, or `low`. + +| Field | Emoji? | Example | +|-------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------| +| **Title** | Yes — once, at the start | `⚠️ Copyright line stripped from vendored file header` | +| **Description** | **No** | `**io.sentry.cache.tape.FileObjectQueue** — The Copyright (C) 2010 Square, Inc. line was removed…` (see **Description subject** below) | +| **Verification** | **No** | Evidence steps only | +| **Suggested fix** | **No** | Fix text only | + +**Good (Warden PR comment):** + +``` +Title: ⚠️ Copyright line stripped from vendored file header +Description: **io.sentry.cache.tape.FileObjectQueue** — The `Copyright (C) 2010 Square, Inc.` line was removed from this vendored file's header. Please restore the copyright line. +``` + +**Bad — emoji in the description (never do this):** + +``` +Title: ⚠️ Copyright line stripped from vendored file header +Description: ⚠️ The `Copyright (C) 2010 Square, Inc.` line was removed… +``` + +**Bad — emoji before the class name:** + +``` +Title: ⚠️ Copyright line stripped from vendored file header +Description: ⚠️ **io.sentry.cache.tape.FileObjectQueue** — The copyright line was removed… +``` + +### Description subject (required) + +Every description **must** start with `**** —` (bold subject, space, em dash, space). Pick **one** subject by file type: + +| File type | Subject format | Example | +|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------| +| Java / Kotlin source (`.java`, `.kt`) with a top-level type | Fully qualified class name (FQCN) | `**io.sentry.CircularFifoQueue** —` | +| Java / Kotlin with no single clear type (multiple top-level types, unclear which changed) | FQCN of the primary type under review, or repo-relative path if none | `**sentry/src/.../Foo.kt** —` | +| `THIRD_PARTY_NOTICES.md` | `THIRD_PARTY_NOTICES.md — ` | `**THIRD_PARTY_NOTICES.md — Square — Seismic (Apache 2.0)** —` | +| Gradle / other scripts (e.g. `.kts`, `.gradle`) | Repo-relative path from repository root | `**build.gradle.kts** —` | + +- Prefer **FQCN** for `.java` / `.kt` vendored source (derive from `package` + primary public top-level class). Do not use file paths when a FQCN is clear. +- For license-tier / policy issues, include https://open.sentry.io/licensing/ in the description body. + +### Warden runs + +For each finding, set these fields exactly: + +| Field | Value | +|------------------|-------------------------------------------------------------------------------------------------------------------| +| **severity** | `high`, `medium`, or `low` — **never** put emoji here; Warden maps severity from this field, not from the title | +| **title** | ` ` — emoji allowed **only** here (imperative, no class name) | +| **description** | `**** — ` — **plain text only**; subject per **Description subject** above | +| **verification** | Optional evidence steps — plain text only | + +**Description rules (Warden):** + +- **Must** match `**** — …` using the table in **Description subject**. +- **Must not** contain 🚨, ⚠️, 👀, or the words `high`, `medium`, or `low` as severity labels. +- **Must not** repeat the title or paraphrase it with an emoji prefix. + +**Good (NOTICES entry removed while scope files remain):** + +``` +Title: ⚠️ NOTICES entry removed for vendored code still in tree +Description: **THIRD_PARTY_NOTICES.md — Square — Seismic (Apache 2.0)** — The Seismic entry was removed but `io.sentry.android.core.SentryShakeDetector` still has an attribution header. Restore the entry or remove attribution from the scope files. +``` + +**Before submitting findings:** For every finding, confirm `description` does not match `[🚨⚠️👀]` and matches `^\*\*.+\*\* — `. If it contains any emoji, rewrite the description without it. + +### Local / IDE runs + +Use this numbered format — same title vs description split as above: + +``` +1\. **** + **** — + +2\. **** + **** — +``` + +Rules: + +- Put the severity emoji **only** on the title line (`1\. ⚠️ **…**`), never on the description line. +- The description line uses `**** —` per **Description subject** and must not contain 🚨, ⚠️, or 👀. +- **Escape the period** after the number (`1\.` not `1.`) so markdown does not collapse entries into a tight list. +- Leave an empty line between each numbered finding. diff --git a/.claude/skills/check-code-attribution/validation-tests/EXPECTED.json b/.claude/skills/check-code-attribution/validation-tests/EXPECTED.json new file mode 100644 index 00000000000..a82637b84e2 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/EXPECTED.json @@ -0,0 +1,53 @@ +[ + { + "id": "header-complete-and-notice-present", + "file": "HeaderCompleteAndNoticePresent.java", + "expectFinding": false, + "notes": "Header matches catalog entry" + }, + { + "id": "header-complete-but-notice-missing", + "file": "HeaderCompleteButNoticeMissing.java", + "expectFinding": true, + "isolated": true, + "notes": "Full header; no catalog / root NOTICES entry. Isolated: prompt-cache priming in a concurrent batch suppresses the missing-NOTICES finding below medium." + }, + { + "id": "header-missing-but-notice-present", + "file": "HeaderMissingButNoticePresent.java", + "expectFinding": true, + "isolated": true, + "notes": "NOTICES entry claims file is vendored but file has no attribution header. Isolated: a complete NOTICES entry suppresses the missing-header finding in a concurrent batch." + }, + { + "id": "header-fully-stripped", + "file": "HeaderFullyStripped.java", + "expectFinding": true, + "notes": "Header has no required attribution fields" + }, + { + "id": "header-partially-stripped", + "file": "HeaderPartiallyStripped.java", + "expectFinding": true, + "notes": "Adapted from + URL only; no copyright or license name" + }, + { + "id": "header-missing-non-essential-info", + "file": "HeaderMissingNonEssentialInfo.java", + "expectFinding": false, + "notes": "All four required fields present; no license boilerplate — boilerplate is not required in the header" + }, + { + "id": "header-vs-notice-mismatch", + "file": "THIRD_PARTY_NOTICES.md", + "expectFinding": true, + "isolated": true, + "notes": "Copyright in metadata field does not match embedded license text. Isolated: mismatch finding needs an independent assertion free of interference from other NOTICES changes." + }, + { + "id": "new-license-type", + "file": "NewLicenseType.java", + "expectFinding": true, + "notes": "AGPL v3 license in file header — absolute ban, must be removed" + } +] diff --git a/.claude/skills/check-code-attribution/validation-tests/README.md b/.claude/skills/check-code-attribution/validation-tests/README.md new file mode 100644 index 00000000000..99fb42a6836 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/README.md @@ -0,0 +1,86 @@ +# Attribution skill validation tests + +Self-contained samples for validating `check-code-attribution` without touching production SDK sources. + + +## Run the tests + +```bash +./check-code-attribution-tests.sh +``` + +Requires Node.js and a Warden provider (see **Warden CLI** below). + +In practice, straight command line runs tend to be a bit flakier than asking Claude Code to run the tests for you. + +## Local development + +### Discovering changed files + +When running `/check-code-attribution` outside Warden, list files changed on the current branch vs the base branch, then apply the same exclusions as `ignorePaths` in `warden.toml`: + +```bash +MB=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main) +git diff --name-only "${MB}"..HEAD +``` + +### Warden CLI + +Warden does **not** use Cursor auth. Before running Warden locally, configure a provider (same model family as `warden.toml`, or override with `-m`): + +```bash +# Option A: Anthropic API key (matches CI model in warden.toml) +export WARDEN_ANTHROPIC_API_KEY=sk-ant-... # or: export ANTHROPIC_API_KEY=sk-ant-... + +# Option B: Pi OAuth / API key store (~/.pi/agent/auth.json) +npx pi # then run /login and pick Anthropic (or another provider) + +# Option C: Different provider for a one-off run +export WARDEN_OPENAI_API_KEY=sk-... +npx @sentry/warden origin/main..HEAD --skill check-code-attribution -m openai/gpt-5.5 -vv +``` + +```bash +npx @sentry/warden origin/main..HEAD --skill check-code-attribution -vv +``` + +## Layout + +- `EXPECTED.json` — scenario IDs and expected outcomes (single source of truth). +- `THIRD_PARTY_NOTICES.catalog.md` — NOTICES-style entries for validation class names. +- `scenarios/` — `.java` files and `THIRD_PARTY_NOTICES.mismatch-snippet.md` (copyright-mismatch fixture). +- `check-code-attribution-tests.sh` — runs Warden on a temp branch and asserts per-scenario pass/fail. +- `assert-scenarios.mjs` — validation driver (`list-isolated`, `routing-set`, `assert` subcommands); parses Warden JSONL and checks outcomes from `EXPECTED.json`. + +### assert-scenarios.mjs commands + +```bash +node assert-scenarios.mjs validate EXPECTED.json scenarios/ # pre-flight (no API); run automatically by the shell script +node assert-scenarios.mjs list-isolated EXPECTED.json # idfile per isolated scenario +node assert-scenarios.mjs list-main-java EXPECTED.json scenarios/ # .java files for the main Warden batch +node assert-scenarios.mjs routing-set routing.json # update id → Warden JSONL path +node assert-scenarios.mjs assert EXPECTED.json routing.json +``` + +Warden runs are limited to 300s. On macOS the script uses `gtimeout` (from `brew install coreutils`) when available, otherwise GNU `timeout`, otherwise `perl` with `alarm`. + +## Add a scenario + +1. Add `scenarios/.java`. +2. Add or omit a catalog entry in `THIRD_PARTY_NOTICES.catalog.md`. +3. Add an entry to `EXPECTED.json`. +4. **Isolation (if needed):** If the scenario relies on a finding that could be suppressed by Anthropic prompt-cache priming when analyzed alongside many other files (e.g. a missing-NOTICES entry, or a missing header on a file that has a complete NOTICES entry), add `"isolated": true` to its `EXPECTED.json` entry. The test script creates a dedicated worktree for each isolated scenario automatically — no changes to the script itself are needed. + +## Validation (maintainers) + +Test samples live under `validation-tests/` and are excluded from normal skill runs via `.claude/**` in `warden.toml`. + +```bash +.claude/skills/check-code-attribution/validation-tests/check-code-attribution-tests.sh +``` + +Expected outcomes are in `EXPECTED.json`. The script creates isolated git worktrees, runs Warden with `--report-on medium --json`, and asserts per-scenario pass/fail. Scenarios marked `"isolated": true` in `EXPECTED.json` each get their own worktree to avoid Anthropic prompt-cache priming that can suppress findings below medium in concurrent batches. Exit 0 = all pass. + +When manually reviewing a file under `scenarios/`, search `THIRD_PARTY_NOTICES.catalog.md` in addition to root `THIRD_PARTY_NOTICES.md` (Quick triage step 2 in `SKILL.md`). + +Non-Java fixtures required by the test script are listed in `REQUIRED_SCENARIO_FIXTURES` in `assert-scenarios.mjs`; pre-flight `validate` fails if any are missing. diff --git a/.claude/skills/check-code-attribution/validation-tests/THIRD_PARTY_NOTICES.catalog.md b/.claude/skills/check-code-attribution/validation-tests/THIRD_PARTY_NOTICES.catalog.md new file mode 100644 index 00000000000..478d0b06313 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/THIRD_PARTY_NOTICES.catalog.md @@ -0,0 +1,130 @@ +# Test THIRD_PARTY_NOTICES catalog (not shipped) + +Used only when validating `check-code-attribution` against `validation-tests/scenarios/**`. +Grep this file in addition to the repository root `THIRD_PARTY_NOTICES.md`. + +--- + +## Example — HeaderFullyStripped (MIT) + +**Source:** https://github.com/example/attribution-fixtures
+**License:** MIT License
+**Copyright:** Copyright (c) 2016 Example Author + +### Scope + +Attribution validation sample. The code resides in `io.sentry.skills.verification.HeaderFullyStripped` (`validation-tests/scenarios/HeaderFullyStripped.java`). + +``` +MIT License + +Copyright (c) 2016 Example Author + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` + +--- + +## Example — HeaderMissingButNoticePresent (Apache 2.0) + +**Source:** https://github.com/example/notices-without-header
+**License:** Apache License 2.0
+**Copyright:** Copyright 2023 Example Corp. + +### Scope + +Attribution validation sample. The code resides in `io.sentry.skills.verification.HeaderMissingButNoticePresent`. + +``` +Copyright 2023 Example Corp. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + +## Example — HeaderMissingNonEssentialInfo (MIT) + +**Source:** https://github.com/example/examplelib
+**License:** MIT License
+**Copyright:** Copyright 2020 Example Corp. + +### Scope + +Attribution validation sample. The code resides in `io.sentry.skills.verification.HeaderMissingNonEssentialInfo`. + +``` +MIT License + +Copyright (c) 2020 Example Corp. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` + +--- + +## Example — HeaderCompleteAndNoticePresent (Apache 2.0) + +**Source:** https://github.com/example/something
+**License:** Apache License 2.0
+**Copyright:** Copyright 2020 Example Authors + +### Scope + +Attribution validation sample. The code resides in `io.sentry.skills.verification.HeaderCompleteAndNoticePresent`. + +``` +Copyright 2020 Example Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` diff --git a/.claude/skills/check-code-attribution/validation-tests/assert-scenarios.mjs b/.claude/skills/check-code-attribution/validation-tests/assert-scenarios.mjs new file mode 100755 index 00000000000..3ff4cce9980 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/assert-scenarios.mjs @@ -0,0 +1,401 @@ +#!/usr/bin/env node +/** + * Validation driver for check-code-attribution scenario tests. + * + * Usage: + * node assert-scenarios.mjs validate + * node assert-scenarios.mjs list-isolated + * node assert-scenarios.mjs list-main-java + * node assert-scenarios.mjs routing-set + * node assert-scenarios.mjs assert + * + * routing.json maps scenario id to Warden JSONL output path, e.g. { "main": "/tmp/..." }. + * Non-isolated scenarios use the "main" entry when no dedicated id is present. + */ + +import fs from 'node:fs'; +import path from 'node:path'; +import { pathToFileURL } from 'node:url'; + +const ISOLATED_FILE_JAVA = /\.java$/i; +const ISOLATED_FILE_NOTICES = 'THIRD_PARTY_NOTICES.md'; + +/** Non-Java fixtures under scenarios/ that check-code-attribution-tests.sh requires. */ +const REQUIRED_SCENARIO_FIXTURES = [ + 'THIRD_PARTY_NOTICES.mismatch-snippet.md', +]; + +export function loadExpected(expectedPath) { + return JSON.parse(fs.readFileSync(expectedPath, 'utf8')); +} + +export function listIsolated(scenarios) { + return scenarios.filter((s) => s.isolated); +} + +/** Repo-relative path normalization for Warden JSONL matching. */ +export function normalizeRepoPath(filePath) { + if (!filePath) return filePath; + return filePath.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+/g, '/'); +} + +/** True when a Warden-reported path refers to the expected scenario file. */ +export function pathMatchesWardenFile(reportedPath, wardenFile) { + const reported = normalizeRepoPath(reportedPath); + const expected = normalizeRepoPath(wardenFile); + if (reported === expected) return true; + const base = expected.split('/').pop(); + return base != null && reported.endsWith(`/${base}`); +} + +export function findingCountForFile(fileMap, wardenFile) { + const expected = normalizeRepoPath(wardenFile); + if (fileMap[expected] != null) return fileMap[expected]; + for (const [key, count] of Object.entries(fileMap)) { + if (pathMatchesWardenFile(key, wardenFile)) return count; + } + return 0; +} + +export function findingsForFile(findings, wardenFile) { + return findings.filter( + (f) => f.location && pathMatchesWardenFile(f.location.path, wardenFile), + ); +} + +export function listMainBatchJava(scenarios, scenariosDir) { + const isolatedJava = new Set( + listIsolated(scenarios) + .map((s) => s.file) + .filter((file) => ISOLATED_FILE_JAVA.test(file)), + ); + return fs + .readdirSync(scenariosDir) + .filter((name) => name.endsWith('.java') && !isolatedJava.has(name)) + .sort(); +} + +/** + * @returns {string[]} validation error messages (empty = ok) + */ +export function validateExpected(scenarios, scenariosDir) { + const errors = []; + + if (!Array.isArray(scenarios)) { + return ['EXPECTED.json must be a JSON array']; + } + + const ids = new Set(); + const expectedJava = new Set(); + + for (const [index, s] of scenarios.entries()) { + const label = `entry ${index}`; + if (!s || typeof s !== 'object') { + errors.push(`${label}: must be an object`); + continue; + } + if (typeof s.id !== 'string' || !s.id) { + errors.push(`${label}: missing or empty "id"`); + } else { + if (ids.has(s.id)) errors.push(`duplicate id "${s.id}"`); + ids.add(s.id); + if (s.id === 'main') { + errors.push(`id "main" is reserved for routing.json`); + } + } + if (typeof s.file !== 'string' || !s.file) { + errors.push(`${label}: missing or empty "file"`); + } else if (ISOLATED_FILE_JAVA.test(s.file)) { + expectedJava.add(s.file); + const onDisk = path.join(scenariosDir, s.file); + if (!fs.existsSync(onDisk)) { + errors.push(`${s.id}: scenarios/${s.file} does not exist`); + } + } else if (s.file !== ISOLATED_FILE_NOTICES) { + errors.push( + `${s.id}: unsupported file "${s.file}" (use *.java or ${ISOLATED_FILE_NOTICES})`, + ); + } + if (typeof s.expectFinding !== 'boolean') { + errors.push(`${s.id ?? label}: "expectFinding" must be a boolean`); + } + if (s.isolated) { + if ( + !ISOLATED_FILE_JAVA.test(s.file) && + s.file !== ISOLATED_FILE_NOTICES + ) { + errors.push( + `${s.id}: isolated scenarios must use *.java or ${ISOLATED_FILE_NOTICES}`, + ); + } + } + } + + let diskEntries = []; + try { + diskEntries = fs.readdirSync(scenariosDir); + } catch (e) { + errors.push(`cannot read scenarios dir ${scenariosDir}: ${e.message}`); + return errors; + } + + const diskJava = diskEntries.filter((n) => n.endsWith('.java')); + for (const name of diskJava) { + if (!expectedJava.has(name)) { + errors.push(`scenarios/${name} has no matching entry in EXPECTED.json`); + } + } + + for (const name of REQUIRED_SCENARIO_FIXTURES) { + const onDisk = path.join(scenariosDir, name); + if (!fs.existsSync(onDisk)) { + errors.push(`scenarios/${name} is required but missing`); + } + } + + const diskNonJava = diskEntries.filter( + (n) => !n.endsWith('.java') && fs.statSync(path.join(scenariosDir, n)).isFile(), + ); + for (const name of diskNonJava) { + if (!REQUIRED_SCENARIO_FIXTURES.includes(name)) { + errors.push( + `scenarios/${name} is not listed in REQUIRED_SCENARIO_FIXTURES (update assert-scenarios.mjs)`, + ); + } + } + + if (listMainBatchJava(scenarios, scenariosDir).length === 0) { + errors.push('main Warden batch needs at least one non-isolated .java scenario'); + } + + return errors; +} + +export function parseWardenJsonl(jsonlPath) { + /** @type {Record} */ + const fileMap = {}; + const allFindings = []; + try { + const raw = fs.readFileSync(jsonlPath, 'utf8').trim(); + if (!raw) return { fileMap, findings: [] }; + const records = raw + .split('\n') + .filter((l) => l.trim()) + .map((l) => JSON.parse(l)); + for (const record of records) { + const file = record.chunk && record.chunk.file; + if (!file) continue; + const normalized = normalizeRepoPath(file); + const recordFindings = record.findings || []; + fileMap[normalized] = (fileMap[normalized] || 0) + recordFindings.length; + for (const f of recordFindings) { + allFindings.push({ + ...f, + location: f.location || { path: normalized, startLine: 1 }, + }); + } + } + } catch (e) { + console.error( + 'ERROR: Could not parse Warden output from ' + jsonlPath + ':', + e.message, + ); + process.exit(2); + } + return { fileMap, findings: allFindings }; +} + +export function routingSet(routingPath, id, jsonlPath) { + const routing = JSON.parse(fs.readFileSync(routingPath, 'utf8')); + routing[id] = jsonlPath; + fs.writeFileSync(routingPath, JSON.stringify(routing)); +} + +function wardenFileForScenario(destPkg, scenario) { + return scenario.file === ISOLATED_FILE_NOTICES + ? ISOLATED_FILE_NOTICES + : `${destPkg}/${scenario.file}`; +} + +function loadRouting(routingPath) { + /** @type {Record} */ + let routing; + try { + routing = JSON.parse(fs.readFileSync(routingPath, 'utf8')); + } catch (e) { + console.error(`ERROR: Could not read routing file ${routingPath}:`, e.message); + process.exit(2); + } + + if (typeof routing.main !== 'string' || !routing.main) { + console.error('ERROR: routing.json must include a non-empty "main" JSONL path.'); + process.exit(2); + } + return routing; +} + +function cmdValidate(expectedPath, scenariosDir) { + if (!expectedPath || !scenariosDir) { + console.error( + 'Usage: node assert-scenarios.mjs validate ', + ); + process.exit(2); + } + const errors = validateExpected(loadExpected(expectedPath), scenariosDir); + if (errors.length > 0) { + console.error('EXPECTED.json validation failed:'); + for (const err of errors) console.error(` - ${err}`); + process.exit(1); + } + console.log('EXPECTED.json OK'); +} + +function cmdListIsolated(expectedPath) { + for (const s of listIsolated(loadExpected(expectedPath))) { + process.stdout.write(`${s.id}\t${s.file}\n`); + } +} + +function cmdListMainJava(expectedPath, scenariosDir) { + if (!expectedPath || !scenariosDir) { + console.error( + 'Usage: node assert-scenarios.mjs list-main-java ', + ); + process.exit(2); + } + for (const name of listMainBatchJava(loadExpected(expectedPath), scenariosDir)) { + process.stdout.write(`${name}\n`); + } +} + +function cmdRoutingSet(routingPath, id, jsonlPath) { + if (!routingPath || !id || !jsonlPath) { + console.error( + 'Usage: node assert-scenarios.mjs routing-set ', + ); + process.exit(2); + } + routingSet(routingPath, id, jsonlPath); +} + +function cmdAssert(expectedPath, destPkg, routingPath) { + if (!expectedPath || !destPkg || !routingPath) { + console.error( + 'Usage: node assert-scenarios.mjs assert ', + ); + process.exit(2); + } + + const routing = loadRouting(routingPath); + const scenarios = loadExpected(expectedPath); + + /** @type {Record>} */ + const parsed = {}; + function getSource(id) { + const jsonlPath = routing[id] ?? routing.main; + if (!parsed[jsonlPath]) parsed[jsonlPath] = parseWardenJsonl(jsonlPath); + return parsed[jsonlPath]; + } + + const GREEN = '\x1b[32m'; + const RED = '\x1b[31m'; + const RESET = '\x1b[0m'; + + const failures = []; + let pass = 0; + + for (const s of scenarios) { + if (s.isolated && !routing[s.id]) { + console.error( + `ERROR: isolated scenario "${s.id}" has no routing entry (missing Warden run?)`, + ); + process.exit(2); + } + + const wardenFile = wardenFileForScenario(destPkg, s); + const source = getSource(s.id); + const count = findingCountForFile(source.fileMap, wardenFile); + const passed = s.expectFinding ? count > 0 : count === 0; + + if (passed) { + console.log(`${GREEN}PASS${RESET} ${s.id}`); + pass++; + } else { + const reason = s.expectFinding + ? 'expected finding (>= medium), got none' + : `expected no finding (>= medium), got ${count}`; + console.log(`${RED}FAIL${RESET} ${s.id} (${reason})`); + + failures.push({ + id: s.id, + findings: findingsForFile(source.findings, wardenFile), + }); + } + } + + const total = scenarios.length; + console.log(''); + console.log(`${total} scenarios: ${pass} passed, ${total - pass} failed`); + + if (failures.length > 0) { + console.log(''); + console.log('Warden output'); + console.log('══════════════════════'); + + for (const { id, findings } of failures) { + console.log(''); + console.log(id); + console.log('-'.repeat(id.length)); + if (findings.length === 0) { + console.log('(Warden produced no findings for this file)'); + } else { + for (const f of findings) { + console.log(f.title); + if (f.description) console.log(f.description); + if (f.verification) console.log('\nVerification: ' + f.verification); + console.log(''); + } + } + } + + process.exit(1); + } +} + +function usage() { + console.error(`Usage: + node assert-scenarios.mjs validate + node assert-scenarios.mjs list-isolated + node assert-scenarios.mjs list-main-java + node assert-scenarios.mjs routing-set + node assert-scenarios.mjs assert `); + process.exit(2); +} + +function main() { + const [, , cmd, ...args] = process.argv; + switch (cmd) { + case 'validate': + cmdValidate(args[0], args[1]); + break; + case 'list-isolated': + if (!args[0]) usage(); + cmdListIsolated(args[0]); + break; + case 'list-main-java': + cmdListMainJava(args[0], args[1]); + break; + case 'routing-set': + cmdRoutingSet(args[0], args[1], args[2]); + break; + case 'assert': + cmdAssert(args[0], args[1], args[2]); + break; + default: + usage(); + } +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + main(); +} diff --git a/.claude/skills/check-code-attribution/validation-tests/check-code-attribution-tests.sh b/.claude/skills/check-code-attribution/validation-tests/check-code-attribution-tests.sh new file mode 100755 index 00000000000..090acbe129b --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/check-code-attribution-tests.sh @@ -0,0 +1,246 @@ +#!/usr/bin/env bash +# check-code-attribution-tests.sh — Validate the check-code-attribution skill against synthetic scenarios. +# +# Usage: +# ./check-code-attribution-tests.sh [--help] +# +# What it does: +# 1. Validates EXPECTED.json and scenario fixtures (no API calls). +# 2. Creates an isolated git worktree on a temp branch from HEAD. +# 3. Creates a diff (non-isolated .java files, NOTICES catalog, mismatch snippet), +# commits, and runs Warden on the main batch. +# 4. Scenarios marked "isolated" in EXPECTED.json each get their own worktree and Warden +# run to avoid prompt-cache priming that can suppress findings in concurrent batches. +# 5. Asserts per-scenario pass/fail against EXPECTED.json (>= medium findings only). +# 6. Prints Warden's actual output for each failing scenario. +# 7. Cleans up all worktrees. +# +# Requires: +# - Node.js / npx +# - One of: WARDEN_ANTHROPIC_API_KEY, ANTHROPIC_API_KEY, or Pi OAuth config +# (see validation-tests/README.md "Warden CLI" section for setup options) + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)" +SCENARIOS_DIR="$SCRIPT_DIR/scenarios" +CATALOG="$SCRIPT_DIR/THIRD_PARTY_NOTICES.catalog.md" +EXPECTED_JSON="$SCRIPT_DIR/EXPECTED.json" +VALIDATION="$SCRIPT_DIR/assert-scenarios.mjs" +MISMATCH_SNIPPET="$SCENARIOS_DIR/THIRD_PARTY_NOTICES.mismatch-snippet.md" + +# Destination path inside the worktree — must not appear in warden.toml ignorePaths. +DEST_PACKAGE_PATH="sentry/src/test/java/io/sentry/skills/verification" + +# Warden wall-clock limit (seconds). +TIMEOUT_SEC=300 + +die() { echo "ERROR: $*" >&2; exit 1; } + +show_usage() { + cat <<'EOF' +Usage: check-code-attribution-tests.sh [--help] + +Validates the check-code-attribution skill against all scenarios in EXPECTED.json. +Runs Warden on a temporary branch and asserts per-scenario pass/fail (>= medium findings). + +Prerequisites: + - Node.js (npx) + - API key: WARDEN_ANTHROPIC_API_KEY or ANTHROPIC_API_KEY + (or Pi OAuth: npx pi && /login — see README.md "Warden CLI" section) + - Wall-clock limit: gtimeout (brew install coreutils), GNU timeout, or perl +EOF +} + +[[ "${1:-}" == "--help" || "${1:-}" == "-h" ]] && { show_usage; exit 0; } + +# --- prereq checks --- + +command -v node >/dev/null 2>&1 || die "node not found — install Node.js." +command -v npx >/dev/null 2>&1 || die "npx not found — install Node.js." +command -v git >/dev/null 2>&1 || die "git not found." + +# macOS: GNU timeout is `gtimeout` from coreutils; fall back to perl alarm. +TIMEOUT_CMD=() +if command -v gtimeout >/dev/null 2>&1; then + TIMEOUT_CMD=(gtimeout "$TIMEOUT_SEC") +elif command -v timeout >/dev/null 2>&1; then + TIMEOUT_CMD=(timeout "$TIMEOUT_SEC") +elif command -v perl >/dev/null 2>&1; then + TIMEOUT_CMD=(perl -e 'alarm shift; exec @ARGV' "$TIMEOUT_SEC") +else + die "Need gtimeout (brew install coreutils), GNU timeout, or perl for Warden wall-clock limit" +fi + +if [[ -z "${WARDEN_ANTHROPIC_API_KEY:-}" && -z "${ANTHROPIC_API_KEY:-}" ]]; then + if [[ ! -f "$HOME/.pi/agent/auth.json" ]]; then + die "No API key found. Set WARDEN_ANTHROPIC_API_KEY, ANTHROPIC_API_KEY, or run: npx pi && /login" + fi +fi + +node "$VALIDATION" validate "$EXPECTED_JSON" "$SCENARIOS_DIR" + +# --- cleanup tracking --- + +declare -a WORKTREES=() +declare -a BRANCHES=() +declare -a JSON_FILES=() + +cleanup() { + for wt in "${WORKTREES[@]+"${WORKTREES[@]}"}"; do + git -C "$REPO_ROOT" worktree remove --force "$wt" 2>/dev/null || true + done + for b in "${BRANCHES[@]+"${BRANCHES[@]}"}"; do + git -C "$REPO_ROOT" branch -D "$b" 2>/dev/null || true + done + (( ${#JSON_FILES[@]} )) && rm -f "${JSON_FILES[@]}" +} +trap cleanup EXIT + +# --- resolve base commit --- +# Branch from HEAD so the worktree includes the current skill definition. + +BASE=$(git -C "$REPO_ROOT" rev-parse HEAD || die "Cannot resolve HEAD.") +TS=$(date +%s) + +# --- helpers --- + +# Commits paths in a validation worktree with consistent author metadata. +# Usage: git_commit_in_worktree [path...] +git_commit_in_worktree() { + local worktree="$1" message="$2" + shift 2 + if (($# > 0)); then + git -C "$worktree" add "$@" + fi + git -C "$worktree" \ + -c user.email="ci@sentry.io" \ + -c user.name="Validation Test" \ + commit --quiet -m "$message" +} + +# Creates a git worktree from $BASE and commits the NOTICES catalog as the Warden +# analysis base — so only fixture changes appear in the diff Warden analyzes. +# Prints the catalog-commit SHA to stdout. +setup_catalog_base() { + local worktree="$1" branch="$2" + git -C "$REPO_ROOT" worktree add --quiet "$worktree" "$BASE" -b "$branch" + printf '\n' >> "$worktree/THIRD_PARTY_NOTICES.md" + sed "s|validation-tests/scenarios/|${DEST_PACKAGE_PATH}/|g" \ + "$CATALOG" >> "$worktree/THIRD_PARTY_NOTICES.md" + git_commit_in_worktree "$worktree" "test: apply NOTICES catalog [skip ci]" \ + THIRD_PARTY_NOTICES.md + git -C "$worktree" rev-parse HEAD +} + +# Appends the mismatch snippet to THIRD_PARTY_NOTICES.md, stripping the fixture's +# prose header so only the NOTICES entry itself lands in the file. +append_mismatch_snippet() { + local worktree="$1" + printf '\n' >> "$worktree/THIRD_PARTY_NOTICES.md" + sed '1,/^---$/d' "$MISMATCH_SNIPPET" >> "$worktree/THIRD_PARTY_NOTICES.md" +} + +# Runs Warden and writes JSON output to the given file. +run_warden() { + local base="$1" worktree="$2" json_out="$3" label="$4" + echo "Running Warden on ${base:0:7}..HEAD ($label)..." + : > "$json_out" + if ! "${TIMEOUT_CMD[@]}" npx @sentry/warden "${base}..HEAD" \ + --skill check-code-attribution \ + --fail-on off \ + --report-on medium \ + --json \ + -C "$worktree" \ + > "$json_out"; then + if [[ ! -s "$json_out" ]]; then + die "Warden failed for $label with no JSON output (check API key, network, and Warden logs)." + fi + die "Warden exited with an error for $label but left partial JSON in $json_out." + fi + [[ -s "$json_out" ]] || die "Warden succeeded but produced no JSON output for $label." +} + +# --- main worktree: non-isolated scenarios --- +# Isolated .java files are omitted here; they get dedicated worktrees below. + +echo "Creating worktrees from $(git -C "$REPO_ROOT" rev-parse --short "$BASE")..." +echo "" + +MAIN_WORKTREE=$(mktemp -d) +MAIN_BRANCH="validation-main-${TS}" +MAIN_JSON=$(mktemp) +ROUTING_JSON_FILE=$(mktemp) +echo '{}' > "$ROUTING_JSON_FILE" +WORKTREES+=("$MAIN_WORKTREE") +BRANCHES+=("$MAIN_BRANCH") +JSON_FILES+=("$MAIN_JSON" "$ROUTING_JSON_FILE") + +MAIN_BASE=$(setup_catalog_base "$MAIN_WORKTREE" "$MAIN_BRANCH") + +DEST_DIR="$MAIN_WORKTREE/$DEST_PACKAGE_PATH" +mkdir -p "$DEST_DIR" + +shopt -s nullglob +copied=0 +while IFS= read -r java_file; do + cp "$SCENARIOS_DIR/$java_file" "$DEST_DIR/" + copied=$((copied + 1)) +done < <(node "$VALIDATION" list-main-java "$EXPECTED_JSON" "$SCENARIOS_DIR") +echo "Copied ${copied} scenario files → $DEST_PACKAGE_PATH/ (non-isolated batch)" +append_mismatch_snippet "$MAIN_WORKTREE" +git_commit_in_worktree "$MAIN_WORKTREE" \ + "test: add check-code-attribution validation fixtures [skip ci]" \ + "$DEST_PACKAGE_PATH" THIRD_PARTY_NOTICES.md + +run_warden "$MAIN_BASE" "$MAIN_WORKTREE" "$MAIN_JSON" "main" +node "$VALIDATION" routing-set "$ROUTING_JSON_FILE" main "$MAIN_JSON" + +# --- isolated worktrees: one per scenario marked "isolated" in EXPECTED.json --- +# +# Scenarios where Anthropic prompt-cache priming can suppress findings in a concurrent +# batch get their own worktree and Warden run. EXPECTED.json is the single source of +# truth for which scenarios need isolation — add "isolated": true there, not here. +# Java isolates omit the mismatch snippet; the NOTICES mismatch scenario adds it alone. + +while IFS=$'\t' read -r id file; do + worktree=$(mktemp -d) + branch="validation-isolated-${TS}-${id//[^a-zA-Z0-9]/-}" + json=$(mktemp) + WORKTREES+=("$worktree") + BRANCHES+=("$branch") + JSON_FILES+=("$json") + + base=$(setup_catalog_base "$worktree" "$branch") + + commit_paths=() + if [[ "$file" == *.java ]]; then + dest_dir="$worktree/$DEST_PACKAGE_PATH" + mkdir -p "$dest_dir" + cp "$SCENARIOS_DIR/$file" "$dest_dir/" + commit_paths=("$DEST_PACKAGE_PATH") + elif [[ "$file" == "THIRD_PARTY_NOTICES.md" ]]; then + append_mismatch_snippet "$worktree" + commit_paths=(THIRD_PARTY_NOTICES.md) + else + die "Unsupported isolated scenario file: $file (id: $id)" + fi + + git_commit_in_worktree "$worktree" "test: isolated fixture for $id [skip ci]" \ + "${commit_paths[@]}" + + echo "" + run_warden "$base" "$worktree" "$json" "$id" + node "$VALIDATION" routing-set "$ROUTING_JSON_FILE" "$id" "$json" + +done < <(node "$VALIDATION" list-isolated "$EXPECTED_JSON") + +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + +# --- assert per-scenario --- +# +# ROUTING_JSON_FILE maps scenario id → Warden JSONL path; non-isolated scenarios use "main". + +node "$VALIDATION" assert "$EXPECTED_JSON" "$DEST_PACKAGE_PATH" "$ROUTING_JSON_FILE" diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteAndNoticePresent.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteAndNoticePresent.java new file mode 100644 index 00000000000..63727be1d5c --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteAndNoticePresent.java @@ -0,0 +1,19 @@ +/* + * Adapted from https://github.com/example/something + * + * Copyright 2020 Example Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ +package io.sentry.skills.verification; + +public final class HeaderCompleteAndNoticePresent { + + public int sum(int a, int b) { + return a + b; + } +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteButNoticeMissing.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteButNoticeMissing.java new file mode 100644 index 00000000000..081d1848300 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderCompleteButNoticeMissing.java @@ -0,0 +1,17 @@ +/* + * Adapted from https://github.com/example + * + * Copyright 2024 Example Authors + * + * Licensed under the MIT License + * + * https://github.com/example/something + */ +package io.sentry.skills.verification; + +public final class HeaderCompleteButNoticeMissing { + + public boolean ok() { + return true; + } +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderFullyStripped.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderFullyStripped.java new file mode 100644 index 00000000000..6973848c61e --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderFullyStripped.java @@ -0,0 +1,7 @@ +/* Attribution stripped — fixture for check-code-attribution validation only. */ +package io.sentry.skills.verification; + +public final class HeaderFullyStripped { + + public void run() {} +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingButNoticePresent.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingButNoticePresent.java new file mode 100644 index 00000000000..5c4953ea3ad --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingButNoticePresent.java @@ -0,0 +1,8 @@ +package io.sentry.skills.verification; + +public final class HeaderMissingButNoticePresent { + + public int compute(int x) { + return x * 2; + } +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingNonEssentialInfo.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingNonEssentialInfo.java new file mode 100644 index 00000000000..c524a2593a4 --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderMissingNonEssentialInfo.java @@ -0,0 +1,12 @@ +// Adapted from ExampleLib. +// Copyright 2020 Example Corp. +// Licensed under the MIT License. +// https://github.com/example/examplelib +package io.sentry.skills.verification; + +public final class HeaderMissingNonEssentialInfo { + + public int compute(int x) { + return x + 1; + } +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderPartiallyStripped.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderPartiallyStripped.java new file mode 100644 index 00000000000..0389934d94a --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/HeaderPartiallyStripped.java @@ -0,0 +1,10 @@ +// Adapted from Example RateLimiter. +// https://github.com/example +package io.sentry.skills.verification; + +public final class HeaderPartiallyStripped { + + public synchronized boolean tryAcquire() { + return true; + } +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/NewLicenseType.java b/.claude/skills/check-code-attribution/validation-tests/scenarios/NewLicenseType.java new file mode 100644 index 00000000000..e148f5a1a4f --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/NewLicenseType.java @@ -0,0 +1,10 @@ +// Adapted from ExampleLib. +// Copyright 2020 Example Corp. +// Licensed under the GNU Affero General Public License v3.0. +// https://github.com/example/agpl-lib +package io.sentry.skills.verification; + +public final class NewLicenseType { + + public void run() {} +} diff --git a/.claude/skills/check-code-attribution/validation-tests/scenarios/THIRD_PARTY_NOTICES.mismatch-snippet.md b/.claude/skills/check-code-attribution/validation-tests/scenarios/THIRD_PARTY_NOTICES.mismatch-snippet.md new file mode 100644 index 00000000000..5a9b87285df --- /dev/null +++ b/.claude/skills/check-code-attribution/validation-tests/scenarios/THIRD_PARTY_NOTICES.mismatch-snippet.md @@ -0,0 +1,37 @@ +# Snippet fixture — MismatchLib entry for the isolated mismatch worktree. +# header-vs-notice-mismatch: copyright in metadata field does not match embedded license text. + +--- + +## Example — MismatchLib (MIT) + +**Source:** https://github.com/example/mismatch
+**License:** MIT License
+**Copyright:** Copyright (c) 2020 Wrong Holder + +### Scope + +Validation sample only. The code resides in `io.sentry.skills.verification.MismatchLib`. + +``` +MIT License + +Copyright (c) 2016 Correct Holder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` diff --git a/.gitignore b/.gitignore index a7899736a86..f252087a5ab 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ spy.log # Auto-generated by dotagents — do not commit these files. agents.lock .agents/.gitignore + +# Warden local run logs +.warden/logs/ diff --git a/AGENTS.md b/AGENTS.md index 1784e4f950e..ff50727c662 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -154,6 +154,8 @@ When adapting code from third-party libraries: ``` 2. Add a full attribution entry to `THIRD_PARTY_NOTICES.md` following the existing format (Source, License, Copyright, Scope, full license text) +3. Run the `check-code-attribution` skill locally or wait for it to be auto-run against your PR to check for required fields and verify new licenses against [Sentry's Open Source Legal Policy](https://open.sentry.io/licensing/). + ### Getting PR Information Use `gh pr view` to get PR details from the current branch. This is needed when adding changelog entries, which require the PR number. diff --git a/agents.toml b/agents.toml index b4c9e091b70..d9770ee7df5 100644 --- a/agents.toml +++ b/agents.toml @@ -35,3 +35,7 @@ source = "path:.agents/skills/test" [[skills]] name = "btrace-perfetto" source = "path:.agents/skills/btrace-perfetto" + +[[skills]] +name = "check-code-attribution" +source = "path:.agents/skills/check-code-attribution" diff --git a/warden.toml b/warden.toml new file mode 100644 index 00000000000..3ce15f9a11f --- /dev/null +++ b/warden.toml @@ -0,0 +1,101 @@ +version = 1 + +[defaults] +model = "anthropic/claude-sonnet-4-6" + +# Warden's schema does not support per-skill verification config; this is the only +# placement available. Disabled for attribution policy checks: a second verifier +# pass often rejects valid header/NOTICES mismatches (e.g. "NOTICES still documents it"). +[defaults.verification] +enabled = false + +# Warden's schema does not support per-skill chunking config; these patterns apply +# globally but are tuned for check-code-attribution. Attribution checks need the full +# file header and a NOTICES cross-check — not isolated diff hunks. +[[defaults.chunking.filePatterns]] +pattern = "**/*.api" +mode = "skip" + +[[defaults.chunking.filePatterns]] +pattern = "**/gradlew" +mode = "skip" + +[[defaults.chunking.filePatterns]] +pattern = "**/gradlew.bat" +mode = "skip" + +[[defaults.chunking.filePatterns]] +pattern = "**/*.java" +mode = "whole-file" + +[[defaults.chunking.filePatterns]] +pattern = "**/*.kt" +mode = "whole-file" + +[[defaults.chunking.filePatterns]] +pattern = "**/*.kts" +mode = "whole-file" + +[[defaults.chunking.filePatterns]] +pattern = "THIRD_PARTY_NOTICES.md" +mode = "whole-file" + +# Coalesce hunks aggressively for any remaining per-hunk files +[defaults.chunking.coalesce] +enabled = true +maxGapLines = 100 +maxChunkSize = 16000 + +[[skills]] +name = "check-code-attribution" +maxTurns = 30 +# Phase 1: report only — Warden comments on PRs but does not block merges. +# Tighten to failOn = "medium" / requestChanges = true once the false-positive baseline is established. +failOn = "off" +reportOn = "medium" +ignorePaths = [ + # Infrastructure directories + ".agents/**", + ".claude/**", + ".cursor/**", + ".github/**", + ".gradle/**", + ".idea/**", + ".mvn/**", + "gradle/**", + # Generated files + "**/*.aidl", + "**/*.api", + "**/*.g.kt", + "**/*.interp", + "**/*.pb.java", + "**/*.tokens", + "**/build/**", + "**/databinding/*Binding.java", + "**/generated/**", + "**/gradlew", + "**/gradlew.bat", + "**/grpc/*Grpc.java", + "**/ksp/**", + "**/mvnw", + "**/mvnw.cmd", + # Binary files + "**/*.jar", + # Repo docs (attribution examples in prose, not vendored code) + "AGENTS.md", + "CHANGELOG.md", + "CLAUDE.md", + "**/README.md", + # Warden infrastructure + ".warden/**", + "warden.toml", +] + +[[skills.triggers]] +type = "pull_request" +actions = ["opened", "synchronize"] +requestChanges = false +failCheck = false + +[[skills.triggers]] +type = "local" From e4890419828e026a9274db932adfcc9f372f024b Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 22 May 2026 15:54:02 +0200 Subject: [PATCH 167/391] chore(build): Enable configuration cache parallel (#5461) Co-authored-by: Claude Opus 4.6 --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index a8f42329732..2eb795118a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,7 @@ org.gradle.caching=true org.gradle.parallel=true org.gradle.configureondemand=true org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled From 44472dad40ff9fcb705cf476fea94023bbbf66a4 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 22 May 2026 15:54:12 +0200 Subject: [PATCH 168/391] ref(build): Move apply() outside afterEvaluate (#5464) Co-authored-by: Claude Opus 4.6 --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6656e00e49a..8df6e48fe53 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -214,9 +214,9 @@ subprojects { } } - afterEvaluate { - apply() + apply() + afterEvaluate { configure { assignAarTypes() } From 9669c2d4e1fcf4aa0aa5b73df61d90026a3822b7 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Tue, 26 May 2026 14:59:55 +0200 Subject: [PATCH 169/391] feat(android): Parse memory and GC info from ANR thread dumps (#5428) --- CHANGELOG.md | 1 + .../sentry/android/core/AnrV2Integration.java | 16 +- .../internal/threaddump/ArtContextParser.java | 149 ++++++++ .../internal/threaddump/ThreadDumpParser.java | 10 + .../threaddump/ArtContextParserTest.kt | 130 +++++++ .../threaddump/ThreadDumpParserTest.kt | 31 ++ sentry/api/sentry.api | 55 +++ .../java/io/sentry/protocol/ArtContext.java | 331 ++++++++++++++++++ .../java/io/sentry/protocol/Contexts.java | 13 + .../protocol/ArtContextSerializationTest.kt | 72 ++++ .../java/io/sentry/protocol/ArtContextTest.kt | 54 +++ .../CombinedContextsViewSerializationTest.kt | 1 + .../protocol/ContextsSerializationTest.kt | 1 + .../src/test/resources/json/art_context.json | 13 + sentry/src/test/resources/json/contexts.json | 14 + 15 files changed, 888 insertions(+), 3 deletions(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ArtContextParser.java create mode 100644 sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ArtContextParserTest.kt create mode 100644 sentry/src/main/java/io/sentry/protocol/ArtContext.java create mode 100644 sentry/src/test/java/io/sentry/protocol/ArtContextSerializationTest.kt create mode 100644 sentry/src/test/java/io/sentry/protocol/ArtContextTest.kt create mode 100644 sentry/src/test/resources/json/art_context.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e869e9aac8..acc07254df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Enable via `options.isAttachRawTombstone = true` or manifest: `` - Add API to clear feature flags from scopes ([#5426](https://github.com/getsentry/sentry-java/pull/5426)) - Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) +- Parse ART memory and garbage collector info from ANR tombstones into ART context ([#5428](https://github.com/getsentry/sentry-java/pull/5428)) ### Dependencies diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java index 8d88285a356..285c3b77ade 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java @@ -22,6 +22,7 @@ import io.sentry.hints.AbnormalExit; import io.sentry.hints.Backfillable; import io.sentry.hints.BlockingFlushHint; +import io.sentry.protocol.ArtContext; import io.sentry.protocol.DebugImage; import io.sentry.protocol.DebugMeta; import io.sentry.protocol.Message; @@ -173,6 +174,9 @@ public boolean shouldReportHistorical() { debugMeta.setImages(result.debugImages); event.setDebugMeta(debugMeta); } + if (result.artContext != null) { + event.getContexts().setArt(result.artContext); + } } event.setLevel(SentryLevel.FATAL); event.setTimestamp(DateUtils.getDateTime(anrTimestamp)); @@ -209,6 +213,7 @@ public boolean shouldReportHistorical() { final @NotNull List threads = threadDumpParser.getThreads(); final @NotNull List debugImages = threadDumpParser.getDebugImages(); + final @Nullable ArtContext artContext = threadDumpParser.getArtContext(); if (threads.isEmpty()) { // if the list is empty this means the system failed to capture a proper thread dump of @@ -217,7 +222,7 @@ public boolean shouldReportHistorical() { // fall back to not reporting them return new ParseResult(ParseResult.Type.NO_DUMP); } - return new ParseResult(ParseResult.Type.DUMP, dump, threads, debugImages); + return new ParseResult(ParseResult.Type.DUMP, dump, threads, debugImages, artContext); } catch (Throwable e) { options.getLogger().log(SentryLevel.WARNING, "Failed to parse ANR thread dump", e); return new ParseResult(ParseResult.Type.ERROR, dump); @@ -286,15 +291,17 @@ enum Type { } final Type type; - final byte[] dump; + final @Nullable byte[] dump; final @Nullable List threads; final @Nullable List debugImages; + final @Nullable ArtContext artContext; ParseResult(final @NotNull Type type) { this.type = type; this.dump = null; this.threads = null; this.debugImages = null; + this.artContext = null; } ParseResult(final @NotNull Type type, final byte[] dump) { @@ -302,17 +309,20 @@ enum Type { this.dump = dump; this.threads = null; this.debugImages = null; + this.artContext = null; } ParseResult( final @NotNull Type type, final byte[] dump, final @Nullable List threads, - final @Nullable List debugImages) { + final @Nullable List debugImages, + final @Nullable ArtContext artContext) { this.type = type; this.dump = dump; this.threads = threads; this.debugImages = debugImages; + this.artContext = artContext; } } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ArtContextParser.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ArtContextParser.java new file mode 100644 index 00000000000..af5e2214aba --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ArtContextParser.java @@ -0,0 +1,149 @@ +package io.sentry.android.core.internal.threaddump; + +import io.sentry.protocol.ArtContext; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Parses ART runtime memory and GC metrics from ANR thread dump lines. + * + * @see
ART + * Heap::DumpGcCountRateHistogram + */ +final class ArtContextParser { + + private static final long KB = 1024; + private static final long MB = 1024 * KB; + private static final long GB = 1024 * MB; + + private static final String FREE_MEMORY_PREFIX = "Free memory "; + private static final String FREE_MEMORY_UNTIL_GC_PREFIX = "Free memory until GC "; + private static final String FREE_MEMORY_UNTIL_OOME_PREFIX = "Free memory until OOME "; + private static final String TOTAL_MEMORY_PREFIX = "Total memory "; + private static final String MAX_MEMORY_PREFIX = "Max memory "; + private static final String TOTAL_TIME_WAITING_FOR_GC_PREFIX = + "Total time waiting for GC to complete: "; + private static final String TOTAL_GC_COUNT_PREFIX = "Total GC count: "; + private static final String TOTAL_GC_TIME_PREFIX = "Total GC time: "; + private static final String TOTAL_BLOCKING_GC_COUNT_PREFIX = "Total blocking GC count: "; + private static final String TOTAL_BLOCKING_GC_TIME_PREFIX = "Total blocking GC time: "; + private static final String TOTAL_PRE_OOME_GC_COUNT_PREFIX = "Total pre-OOME GC count: "; + + private @Nullable ArtContext artContext; + + @Nullable + ArtContext getArtContext() { + return artContext; + } + + void parseLine(final @NotNull String text) { + if (text.startsWith(FREE_MEMORY_UNTIL_OOME_PREFIX)) { + getOrCreateArtContext() + .setFreeMemoryUntilOome( + parsePrettySize(text.substring(FREE_MEMORY_UNTIL_OOME_PREFIX.length()))); + } else if (text.startsWith(FREE_MEMORY_UNTIL_GC_PREFIX)) { + getOrCreateArtContext() + .setFreeMemoryUntilGc( + parsePrettySize(text.substring(FREE_MEMORY_UNTIL_GC_PREFIX.length()))); + } else if (text.startsWith(FREE_MEMORY_PREFIX)) { + getOrCreateArtContext() + .setFreeMemory(parsePrettySize(text.substring(FREE_MEMORY_PREFIX.length()))); + } else if (text.startsWith(TOTAL_MEMORY_PREFIX)) { + getOrCreateArtContext() + .setTotalMemory(parsePrettySize(text.substring(TOTAL_MEMORY_PREFIX.length()))); + } else if (text.startsWith(MAX_MEMORY_PREFIX)) { + getOrCreateArtContext() + .setMaxMemory(parsePrettySize(text.substring(MAX_MEMORY_PREFIX.length()))); + } else if (text.startsWith(TOTAL_TIME_WAITING_FOR_GC_PREFIX)) { + getOrCreateArtContext() + .setGcWaitingTime(parseTimeMs(text.substring(TOTAL_TIME_WAITING_FOR_GC_PREFIX.length()))); + } else if (text.startsWith(TOTAL_GC_TIME_PREFIX)) { + getOrCreateArtContext() + .setGcTotalTime(parseTimeMs(text.substring(TOTAL_GC_TIME_PREFIX.length()))); + } else if (text.startsWith(TOTAL_GC_COUNT_PREFIX)) { + getOrCreateArtContext() + .setGcTotalCount(parseLongOrNull(text.substring(TOTAL_GC_COUNT_PREFIX.length()))); + } else if (text.startsWith(TOTAL_BLOCKING_GC_TIME_PREFIX)) { + getOrCreateArtContext() + .setGcBlockingTime(parseTimeMs(text.substring(TOTAL_BLOCKING_GC_TIME_PREFIX.length()))); + } else if (text.startsWith(TOTAL_BLOCKING_GC_COUNT_PREFIX)) { + getOrCreateArtContext() + .setGcBlockingCount( + parseLongOrNull(text.substring(TOTAL_BLOCKING_GC_COUNT_PREFIX.length()))); + } else if (text.startsWith(TOTAL_PRE_OOME_GC_COUNT_PREFIX)) { + getOrCreateArtContext() + .setGcPreOomeCount( + parseLongOrNull(text.substring(TOTAL_PRE_OOME_GC_COUNT_PREFIX.length()))); + } + } + + private @NotNull ArtContext getOrCreateArtContext() { + if (artContext == null) { + artContext = new ArtContext(); + } + return artContext; + } + + /** + * Matches Android's PrettySize output: number followed by unit with no space, e.g. "3107KB". + * + *

Counterpart to + * https://cs.android.com/android/platform/superproject/+/android-latest-release:art/libartbase/base/utils.cc;l=232-251;drc=d0d3deb269b1e14de2ec2707815e38bc95de570c + */ + private @Nullable Long parsePrettySize(final @NotNull String sizeString) { + final String trimmed = sizeString.trim(); + try { + if (trimmed.endsWith("GB")) { + return Long.parseLong(trimmed.substring(0, trimmed.length() - 2)) * GB; + } else if (trimmed.endsWith("MB")) { + return Long.parseLong(trimmed.substring(0, trimmed.length() - 2)) * MB; + } else if (trimmed.endsWith("KB")) { + return Long.parseLong(trimmed.substring(0, trimmed.length() - 2)) * KB; + } else if (trimmed.endsWith("B")) { + return Long.parseLong(trimmed.substring(0, trimmed.length() - 1)); + } + } catch (NumberFormatException e) { + return null; + } + return null; + } + + /** + * Parses ART's PrettyDuration output and converts to milliseconds. Handles "s", "ms", "us", "ns" + * suffixes and the bare "0" special case. + * + * @see ART + * PrettyDuration / FormatDuration + */ + private static @Nullable Double parseTimeMs(final @NotNull String timeString) { + final String trimmed = timeString.trim(); + try { + if (trimmed.equals("0")) { + return 0.0; + } + // Double.parseDouble is locale-independent (always uses '.' as decimal separator), + // which matches the ART runtime output format. + if (trimmed.endsWith("ms")) { + return Double.parseDouble(trimmed.substring(0, trimmed.length() - 2)); + } else if (trimmed.endsWith("ns")) { + return Double.parseDouble(trimmed.substring(0, trimmed.length() - 2)) / 1_000_000.0; + } else if (trimmed.endsWith("us")) { + return Double.parseDouble(trimmed.substring(0, trimmed.length() - 2)) / 1_000.0; + } else if (trimmed.endsWith("s")) { + return Double.parseDouble(trimmed.substring(0, trimmed.length() - 1)) * 1_000.0; + } + } catch (NumberFormatException e) { + return null; + } + return null; + } + + private static @Nullable Long parseLongOrNull(final @NotNull String value) { + try { + return Long.parseLong(value.trim()); + } catch (NumberFormatException e) { + return null; + } + } +} diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ThreadDumpParser.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ThreadDumpParser.java index 5f70e39f8b8..f5ce8a745ce 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ThreadDumpParser.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/threaddump/ThreadDumpParser.java @@ -23,6 +23,7 @@ import io.sentry.SentryOptions; import io.sentry.SentryStackTraceFactory; import io.sentry.android.core.internal.util.NativeEventUtils; +import io.sentry.protocol.ArtContext; import io.sentry.protocol.DebugImage; import io.sentry.protocol.SentryStackFrame; import io.sentry.protocol.SentryStackTrace; @@ -109,6 +110,8 @@ public class ThreadDumpParser { private final @NotNull List threads; + private final @NotNull ArtContextParser artContextParser = new ArtContextParser(); + public ThreadDumpParser(final @NotNull SentryOptions options, final boolean isBackground) { this.options = options; this.isBackground = isBackground; @@ -127,6 +130,11 @@ public List getThreads() { return threads; } + @Nullable + public ArtContext getArtContext() { + return artContextParser.getArtContext(); + } + public void parse(final @NotNull Lines lines) { final Matcher beginManagedThreadRe = BEGIN_MANAGED_THREAD_RE.matcher(""); @@ -148,6 +156,8 @@ public void parse(final @NotNull Lines lines) { if (thread != null) { threads.add(thread); } + } else { + artContextParser.parseLine(text); } } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ArtContextParserTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ArtContextParserTest.kt new file mode 100644 index 00000000000..b468127660c --- /dev/null +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ArtContextParserTest.kt @@ -0,0 +1,130 @@ +package io.sentry.android.core.internal.threaddump + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class ArtContextParserTest { + + @Test + fun `parses pretty size bytes`() { + val parser = ArtContextParser() + parser.parseLine("Free memory 0B") + assertEquals(0L, parser.artContext!!.freeMemory) + + val parser2 = ArtContextParser() + parser2.parseLine("Free memory 512B") + assertEquals(512L, parser2.artContext!!.freeMemory) + } + + @Test + fun `parses pretty size kilobytes`() { + val parser = ArtContextParser() + parser.parseLine("Free memory 3107KB") + assertEquals(3107L * 1024, parser.artContext!!.freeMemory) + } + + @Test + fun `parses pretty size megabytes`() { + val parser = ArtContextParser() + parser.parseLine("Free memory until OOME 187MB") + assertEquals(187L * 1024 * 1024, parser.artContext!!.freeMemoryUntilOome) + } + + @Test + fun `parses pretty size gigabytes`() { + val parser = ArtContextParser() + parser.parseLine("Max memory 2GB") + assertEquals(2L * 1024 * 1024 * 1024, parser.artContext!!.maxMemory) + } + + @Test + fun `sets null for invalid pretty size`() { + val parser = ArtContextParser() + parser.parseLine("Free memory 100TB") + assertNull(parser.artContext!!.freeMemory) + } + + @Test + fun `parses time in milliseconds`() { + val parser = ArtContextParser() + parser.parseLine("Total GC time: 11.807ms") + assertEquals(11.807, parser.artContext!!.gcTotalTime) + } + + @Test + fun `parses time in seconds`() { + val parser = ArtContextParser() + parser.parseLine("Total GC time: 2.5s") + assertEquals(2500.0, parser.artContext!!.gcTotalTime) + } + + @Test + fun `parses time in microseconds`() { + val parser = ArtContextParser() + parser.parseLine("Total GC time: 500us") + assertEquals(0.5, parser.artContext!!.gcTotalTime) + } + + @Test + fun `parses time in nanoseconds`() { + val parser = ArtContextParser() + parser.parseLine("Total GC time: 1000000ns") + assertEquals(1.0, parser.artContext!!.gcTotalTime) + } + + @Test + fun `parses zero duration`() { + val parser = ArtContextParser() + parser.parseLine("Total GC time: 0") + assertEquals(0.0, parser.artContext!!.gcTotalTime) + } + + @Test + fun `parses all memory fields`() { + val parser = ArtContextParser() + parser.parseLine("Free memory 3107KB") + parser.parseLine("Free memory until GC 3107KB") + parser.parseLine("Free memory until OOME 187MB") + parser.parseLine("Total memory 7592KB") + parser.parseLine("Max memory 192MB") + + val info = parser.artContext + assertNotNull(info) + assertEquals(3107L * 1024, info.freeMemory) + assertEquals(3107L * 1024, info.freeMemoryUntilGc) + assertEquals(187L * 1024 * 1024, info.freeMemoryUntilOome) + assertEquals(7592L * 1024, info.totalMemory) + assertEquals(192L * 1024 * 1024, info.maxMemory) + } + + @Test + fun `parses all gc fields`() { + val parser = ArtContextParser() + parser.parseLine("Total time waiting for GC to complete: 8.054ms") + parser.parseLine("Total GC count: 1") + parser.parseLine("Total GC time: 11.807ms") + parser.parseLine("Total blocking GC count: 1") + parser.parseLine("Total blocking GC time: 11.873ms") + parser.parseLine("Total pre-OOME GC count: 0") + + val info = parser.artContext + assertNotNull(info) + assertEquals(8.054, info.gcWaitingTime) + assertEquals(1L, info.gcTotalCount) + assertEquals(11.807, info.gcTotalTime) + assertEquals(1L, info.gcBlockingCount) + assertEquals(11.873, info.gcBlockingTime) + assertEquals(0L, info.gcPreOomeCount) + } + + @Test + fun `ignores unrelated lines`() { + val parser = ArtContextParser() + parser.parseLine("some random line") + parser.parseLine("DALVIK THREADS (29):") + parser.parseLine("") + assertNull(parser.artContext) + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt index 604e2e84189..b7db35b63ce 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt @@ -160,6 +160,28 @@ class ThreadDumpParserTest { assertEquals("ba489d4985c0cf173209da67405662f9", image.codeId) } + @Test + fun `parses memory info from thread dump`() { + val lines = Lines.readLines(File("src/test/resources/thread_dump.txt")) + val parser = + ThreadDumpParser(SentryOptions().apply { addInAppInclude("io.sentry.samples") }, false) + parser.parse(lines) + + val artContext = parser.artContext + assertNotNull(artContext) + assertEquals(3107L * 1024, artContext.freeMemory) + assertEquals(3107L * 1024, artContext.freeMemoryUntilGc) + assertEquals(187L * 1024 * 1024, artContext.freeMemoryUntilOome) + assertEquals(7592L * 1024, artContext.totalMemory) + assertEquals(192L * 1024 * 1024, artContext.maxMemory) + assertEquals(1L, artContext.gcTotalCount) + assertEquals(11.807, artContext.gcTotalTime) + assertEquals(1L, artContext.gcBlockingCount) + assertEquals(11.873, artContext.gcBlockingTime) + assertEquals(0L, artContext.gcPreOomeCount) + assertEquals(8.054, artContext.gcWaitingTime) + } + @Test fun `thread dump garbage`() { val lines = Lines.readLines(File("src/test/resources/thread_dump_bad_data.txt")) @@ -168,4 +190,13 @@ class ThreadDumpParserTest { parser.parse(lines) assertTrue(parser.threads.isEmpty()) } + + @Test + fun `garbage thread dump has no memory info`() { + val lines = Lines.readLines(File("src/test/resources/thread_dump_bad_data.txt")) + val parser = + ThreadDumpParser(SentryOptions().apply { addInAppInclude("io.sentry.samples") }, false) + parser.parse(lines) + assertNull(parser.artContext) + } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 6b8377de3a3..d2fd5f75dbc 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -5657,6 +5657,59 @@ public final class io/sentry/protocol/App$JsonKeys { public fun ()V } +public final class io/sentry/protocol/ArtContext : io/sentry/JsonSerializable, io/sentry/JsonUnknown { + public static final field TYPE Ljava/lang/String; + public fun ()V + public fun equals (Ljava/lang/Object;)Z + public fun getFreeMemory ()Ljava/lang/Long; + public fun getFreeMemoryUntilGc ()Ljava/lang/Long; + public fun getFreeMemoryUntilOome ()Ljava/lang/Long; + public fun getGcBlockingCount ()Ljava/lang/Long; + public fun getGcBlockingTime ()Ljava/lang/Double; + public fun getGcPreOomeCount ()Ljava/lang/Long; + public fun getGcTotalCount ()Ljava/lang/Long; + public fun getGcTotalTime ()Ljava/lang/Double; + public fun getGcWaitingTime ()Ljava/lang/Double; + public fun getMaxMemory ()Ljava/lang/Long; + public fun getTotalMemory ()Ljava/lang/Long; + public fun getUnknown ()Ljava/util/Map; + public fun hashCode ()I + public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V + public fun setFreeMemory (Ljava/lang/Long;)V + public fun setFreeMemoryUntilGc (Ljava/lang/Long;)V + public fun setFreeMemoryUntilOome (Ljava/lang/Long;)V + public fun setGcBlockingCount (Ljava/lang/Long;)V + public fun setGcBlockingTime (Ljava/lang/Double;)V + public fun setGcPreOomeCount (Ljava/lang/Long;)V + public fun setGcTotalCount (Ljava/lang/Long;)V + public fun setGcTotalTime (Ljava/lang/Double;)V + public fun setGcWaitingTime (Ljava/lang/Double;)V + public fun setMaxMemory (Ljava/lang/Long;)V + public fun setTotalMemory (Ljava/lang/Long;)V + public fun setUnknown (Ljava/util/Map;)V +} + +public final class io/sentry/protocol/ArtContext$Deserializer : io/sentry/JsonDeserializer { + public fun ()V + public fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Lio/sentry/protocol/ArtContext; + public synthetic fun deserialize (Lio/sentry/ObjectReader;Lio/sentry/ILogger;)Ljava/lang/Object; +} + +public final class io/sentry/protocol/ArtContext$JsonKeys { + public static final field FREE_MEMORY Ljava/lang/String; + public static final field FREE_MEMORY_UNTIL_GC Ljava/lang/String; + public static final field FREE_MEMORY_UNTIL_OOME Ljava/lang/String; + public static final field GC_BLOCKING_COUNT Ljava/lang/String; + public static final field GC_BLOCKING_TIME Ljava/lang/String; + public static final field GC_PRE_OOME_COUNT Ljava/lang/String; + public static final field GC_TOTAL_COUNT Ljava/lang/String; + public static final field GC_TOTAL_TIME Ljava/lang/String; + public static final field GC_WAITING_TIME Ljava/lang/String; + public static final field MAX_MEMORY Ljava/lang/String; + public static final field TOTAL_MEMORY Ljava/lang/String; + public fun ()V +} + public final class io/sentry/protocol/Browser : io/sentry/JsonSerializable, io/sentry/JsonUnknown { public static final field TYPE Ljava/lang/String; public fun ()V @@ -5693,6 +5746,7 @@ public class io/sentry/protocol/Contexts : io/sentry/JsonSerializable { public fun equals (Ljava/lang/Object;)Z public fun get (Ljava/lang/Object;)Ljava/lang/Object; public fun getApp ()Lio/sentry/protocol/App; + public fun getArt ()Lio/sentry/protocol/ArtContext; public fun getBrowser ()Lio/sentry/protocol/Browser; public fun getDevice ()Lio/sentry/protocol/Device; public fun getFeatureFlags ()Lio/sentry/protocol/FeatureFlags; @@ -5715,6 +5769,7 @@ public class io/sentry/protocol/Contexts : io/sentry/JsonSerializable { public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;)V public fun set (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; public fun setApp (Lio/sentry/protocol/App;)V + public fun setArt (Lio/sentry/protocol/ArtContext;)V public fun setBrowser (Lio/sentry/protocol/Browser;)V public fun setDevice (Lio/sentry/protocol/Device;)V public fun setFeatureFlags (Lio/sentry/protocol/FeatureFlags;)V diff --git a/sentry/src/main/java/io/sentry/protocol/ArtContext.java b/sentry/src/main/java/io/sentry/protocol/ArtContext.java new file mode 100644 index 00000000000..c840f48af91 --- /dev/null +++ b/sentry/src/main/java/io/sentry/protocol/ArtContext.java @@ -0,0 +1,331 @@ +package io.sentry.protocol; + +import io.sentry.ILogger; +import io.sentry.JsonDeserializer; +import io.sentry.JsonSerializable; +import io.sentry.JsonUnknown; +import io.sentry.ObjectReader; +import io.sentry.ObjectWriter; +import io.sentry.util.CollectionUtils; +import io.sentry.util.Objects; +import io.sentry.vendor.gson.stream.JsonToken; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Context containing ART (Android Runtime) specific information. This is only relevant for Android + * and may be null on other platforms. + */ +public final class ArtContext implements JsonUnknown, JsonSerializable { + public static final String TYPE = "art"; + + private @Nullable Long gcTotalCount; + private @Nullable Double gcTotalTime; + private @Nullable Long gcBlockingCount; + private @Nullable Double gcBlockingTime; + private @Nullable Long gcPreOomeCount; + private @Nullable Double gcWaitingTime; + private @Nullable Long freeMemory; + private @Nullable Long freeMemoryUntilGc; + private @Nullable Long freeMemoryUntilOome; + private @Nullable Long totalMemory; + private @Nullable Long maxMemory; + + @SuppressWarnings("unused") + private @Nullable Map unknown; + + public ArtContext() {} + + ArtContext(final @NotNull ArtContext other) { + this.gcTotalCount = other.gcTotalCount; + this.gcTotalTime = other.gcTotalTime; + this.gcBlockingCount = other.gcBlockingCount; + this.gcBlockingTime = other.gcBlockingTime; + this.gcPreOomeCount = other.gcPreOomeCount; + this.gcWaitingTime = other.gcWaitingTime; + this.freeMemory = other.freeMemory; + this.freeMemoryUntilGc = other.freeMemoryUntilGc; + this.freeMemoryUntilOome = other.freeMemoryUntilOome; + this.totalMemory = other.totalMemory; + this.maxMemory = other.maxMemory; + this.unknown = CollectionUtils.newConcurrentHashMap(other.unknown); + } + + /** Total number of GC collections since process start. */ + public @Nullable Long getGcTotalCount() { + return gcTotalCount; + } + + /** Total number of GC collections since process start. */ + public void setGcTotalCount(final @Nullable Long gcTotalCount) { + this.gcTotalCount = gcTotalCount; + } + + /** Total time spent in GC since process start, in milliseconds. */ + public @Nullable Double getGcTotalTime() { + return gcTotalTime; + } + + /** Total time spent in GC since process start, in milliseconds. */ + public void setGcTotalTime(final @Nullable Double gcTotalTime) { + this.gcTotalTime = gcTotalTime; + } + + /** Total number of blocking (stop-the-world) GC collections since process start. */ + public @Nullable Long getGcBlockingCount() { + return gcBlockingCount; + } + + /** Total number of blocking (stop-the-world) GC collections since process start. */ + public void setGcBlockingCount(final @Nullable Long gcBlockingCount) { + this.gcBlockingCount = gcBlockingCount; + } + + /** Total time spent in blocking (stop-the-world) GC since process start, in milliseconds. */ + public @Nullable Double getGcBlockingTime() { + return gcBlockingTime; + } + + /** Total time spent in blocking (stop-the-world) GC since process start, in milliseconds. */ + public void setGcBlockingTime(final @Nullable Double gcBlockingTime) { + this.gcBlockingTime = gcBlockingTime; + } + + /** Total number of GC collections triggered to prevent an OutOfMemoryError. */ + public @Nullable Long getGcPreOomeCount() { + return gcPreOomeCount; + } + + /** Total number of GC collections triggered to prevent an OutOfMemoryError. */ + public void setGcPreOomeCount(final @Nullable Long gcPreOomeCount) { + this.gcPreOomeCount = gcPreOomeCount; + } + + /** Total time threads spent waiting for GC to complete, in milliseconds. */ + public @Nullable Double getGcWaitingTime() { + return gcWaitingTime; + } + + /** Total time threads spent waiting for GC to complete, in milliseconds. */ + public void setGcWaitingTime(final @Nullable Double gcWaitingTime) { + this.gcWaitingTime = gcWaitingTime; + } + + /** Free memory available in the managed heap, in bytes. */ + public @Nullable Long getFreeMemory() { + return freeMemory; + } + + /** Free memory available in the managed heap, in bytes. */ + public void setFreeMemory(final @Nullable Long freeMemory) { + this.freeMemory = freeMemory; + } + + /** Free memory available until the next GC is triggered, in bytes. */ + public @Nullable Long getFreeMemoryUntilGc() { + return freeMemoryUntilGc; + } + + /** Free memory available until the next GC is triggered, in bytes. */ + public void setFreeMemoryUntilGc(final @Nullable Long freeMemoryUntilGc) { + this.freeMemoryUntilGc = freeMemoryUntilGc; + } + + /** Free memory available until an OutOfMemoryError is thrown, in bytes. */ + public @Nullable Long getFreeMemoryUntilOome() { + return freeMemoryUntilOome; + } + + /** Free memory available until an OutOfMemoryError is thrown, in bytes. */ + public void setFreeMemoryUntilOome(final @Nullable Long freeMemoryUntilOome) { + this.freeMemoryUntilOome = freeMemoryUntilOome; + } + + /** Total memory currently allocated for the managed heap, in bytes. */ + public @Nullable Long getTotalMemory() { + return totalMemory; + } + + /** Total memory currently allocated for the managed heap, in bytes. */ + public void setTotalMemory(final @Nullable Long totalMemory) { + this.totalMemory = totalMemory; + } + + /** Maximum memory the managed heap is allowed to grow to, in bytes. */ + public @Nullable Long getMaxMemory() { + return maxMemory; + } + + /** Maximum memory the managed heap is allowed to grow to, in bytes. */ + public void setMaxMemory(final @Nullable Long maxMemory) { + this.maxMemory = maxMemory; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ArtContext that = (ArtContext) o; + return Objects.equals(gcTotalCount, that.gcTotalCount) + && Objects.equals(gcTotalTime, that.gcTotalTime) + && Objects.equals(gcBlockingCount, that.gcBlockingCount) + && Objects.equals(gcBlockingTime, that.gcBlockingTime) + && Objects.equals(gcPreOomeCount, that.gcPreOomeCount) + && Objects.equals(gcWaitingTime, that.gcWaitingTime) + && Objects.equals(freeMemory, that.freeMemory) + && Objects.equals(freeMemoryUntilGc, that.freeMemoryUntilGc) + && Objects.equals(freeMemoryUntilOome, that.freeMemoryUntilOome) + && Objects.equals(totalMemory, that.totalMemory) + && Objects.equals(maxMemory, that.maxMemory); + } + + @Override + public int hashCode() { + return Objects.hash( + gcTotalCount, + gcTotalTime, + gcBlockingCount, + gcBlockingTime, + gcPreOomeCount, + gcWaitingTime, + freeMemory, + freeMemoryUntilGc, + freeMemoryUntilOome, + totalMemory, + maxMemory); + } + + // region JsonSerializable + + public static final class JsonKeys { + public static final String GC_TOTAL_COUNT = "gc.total_count"; + public static final String GC_TOTAL_TIME = "gc.total_time"; + public static final String GC_BLOCKING_COUNT = "gc.blocking_count"; + public static final String GC_BLOCKING_TIME = "gc.blocking_time"; + public static final String GC_PRE_OOME_COUNT = "gc.pre_oome_count"; + public static final String GC_WAITING_TIME = "gc.waiting_time"; + public static final String FREE_MEMORY = "memory.free"; + public static final String FREE_MEMORY_UNTIL_GC = "memory.free_until_gc"; + public static final String FREE_MEMORY_UNTIL_OOME = "memory.free_until_oome"; + public static final String TOTAL_MEMORY = "memory.total"; + public static final String MAX_MEMORY = "memory.max"; + } + + @Override + public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger logger) + throws IOException { + writer.beginObject(); + if (gcTotalCount != null) { + writer.name(JsonKeys.GC_TOTAL_COUNT).value(gcTotalCount); + } + if (gcTotalTime != null) { + writer.name(JsonKeys.GC_TOTAL_TIME).value(gcTotalTime); + } + if (gcBlockingCount != null) { + writer.name(JsonKeys.GC_BLOCKING_COUNT).value(gcBlockingCount); + } + if (gcBlockingTime != null) { + writer.name(JsonKeys.GC_BLOCKING_TIME).value(gcBlockingTime); + } + if (gcPreOomeCount != null) { + writer.name(JsonKeys.GC_PRE_OOME_COUNT).value(gcPreOomeCount); + } + if (gcWaitingTime != null) { + writer.name(JsonKeys.GC_WAITING_TIME).value(gcWaitingTime); + } + if (freeMemory != null) { + writer.name(JsonKeys.FREE_MEMORY).value(freeMemory); + } + if (freeMemoryUntilGc != null) { + writer.name(JsonKeys.FREE_MEMORY_UNTIL_GC).value(freeMemoryUntilGc); + } + if (freeMemoryUntilOome != null) { + writer.name(JsonKeys.FREE_MEMORY_UNTIL_OOME).value(freeMemoryUntilOome); + } + if (totalMemory != null) { + writer.name(JsonKeys.TOTAL_MEMORY).value(totalMemory); + } + if (maxMemory != null) { + writer.name(JsonKeys.MAX_MEMORY).value(maxMemory); + } + if (unknown != null) { + for (String key : unknown.keySet()) { + Object value = unknown.get(key); + writer.name(key); + writer.value(logger, value); + } + } + writer.endObject(); + } + + @Nullable + @Override + public Map getUnknown() { + return unknown; + } + + @Override + public void setUnknown(@Nullable Map unknown) { + this.unknown = unknown; + } + + public static final class Deserializer implements JsonDeserializer { + @Override + public @NotNull ArtContext deserialize(@NotNull ObjectReader reader, @NotNull ILogger logger) + throws Exception { + reader.beginObject(); + ArtContext artContext = new ArtContext(); + Map unknown = null; + while (reader.peek() == JsonToken.NAME) { + final String nextName = reader.nextName(); + switch (nextName) { + case JsonKeys.GC_TOTAL_COUNT: + artContext.gcTotalCount = reader.nextLongOrNull(); + break; + case JsonKeys.GC_TOTAL_TIME: + artContext.gcTotalTime = reader.nextDoubleOrNull(); + break; + case JsonKeys.GC_BLOCKING_COUNT: + artContext.gcBlockingCount = reader.nextLongOrNull(); + break; + case JsonKeys.GC_BLOCKING_TIME: + artContext.gcBlockingTime = reader.nextDoubleOrNull(); + break; + case JsonKeys.GC_PRE_OOME_COUNT: + artContext.gcPreOomeCount = reader.nextLongOrNull(); + break; + case JsonKeys.GC_WAITING_TIME: + artContext.gcWaitingTime = reader.nextDoubleOrNull(); + break; + case JsonKeys.FREE_MEMORY: + artContext.freeMemory = reader.nextLongOrNull(); + break; + case JsonKeys.FREE_MEMORY_UNTIL_GC: + artContext.freeMemoryUntilGc = reader.nextLongOrNull(); + break; + case JsonKeys.FREE_MEMORY_UNTIL_OOME: + artContext.freeMemoryUntilOome = reader.nextLongOrNull(); + break; + case JsonKeys.TOTAL_MEMORY: + artContext.totalMemory = reader.nextLongOrNull(); + break; + case JsonKeys.MAX_MEMORY: + artContext.maxMemory = reader.nextLongOrNull(); + break; + default: + if (unknown == null) { + unknown = new ConcurrentHashMap<>(); + } + reader.nextUnknown(logger, unknown, nextName); + break; + } + } + artContext.setUnknown(unknown); + reader.endObject(); + return artContext; + } + } +} diff --git a/sentry/src/main/java/io/sentry/protocol/Contexts.java b/sentry/src/main/java/io/sentry/protocol/Contexts.java index 553f4ddbd30..fd1e9b83eb6 100644 --- a/sentry/src/main/java/io/sentry/protocol/Contexts.java +++ b/sentry/src/main/java/io/sentry/protocol/Contexts.java @@ -64,6 +64,8 @@ public Contexts(final @NotNull Contexts contexts) { this.setResponse(new Response((Response) value)); } else if (Spring.TYPE.equals(entry.getKey()) && value instanceof Spring) { this.setSpring(new Spring((Spring) value)); + } else if (ArtContext.TYPE.equals(entry.getKey()) && value instanceof ArtContext) { + this.setArt(new ArtContext((ArtContext) value)); } else { this.put(entry.getKey(), value); } @@ -181,6 +183,14 @@ public void setSpring(final @NotNull Spring spring) { this.put(Spring.TYPE, spring); } + public @Nullable ArtContext getArt() { + return toContextType(ArtContext.TYPE, ArtContext.class); + } + + public void setArt(final @NotNull ArtContext art) { + this.put(ArtContext.TYPE, art); + } + public @Nullable FeatureFlags getFeatureFlags() { return toContextType(FeatureFlags.TYPE, FeatureFlags.class); } @@ -347,6 +357,9 @@ public static final class Deserializer implements JsonDeserializer { case Spring.TYPE: contexts.setSpring(new Spring.Deserializer().deserialize(reader, logger)); break; + case ArtContext.TYPE: + contexts.setArt(new ArtContext.Deserializer().deserialize(reader, logger)); + break; case FeatureFlags.TYPE: contexts.setFeatureFlags(new FeatureFlags.Deserializer().deserialize(reader, logger)); break; diff --git a/sentry/src/test/java/io/sentry/protocol/ArtContextSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/ArtContextSerializationTest.kt new file mode 100644 index 00000000000..9825194cd13 --- /dev/null +++ b/sentry/src/test/java/io/sentry/protocol/ArtContextSerializationTest.kt @@ -0,0 +1,72 @@ +package io.sentry.protocol + +import io.sentry.ILogger +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import org.junit.Test +import org.mockito.kotlin.mock + +class ArtContextSerializationTest { + class Fixture { + val logger = mock() + + fun getSut() = + ArtContext().apply { + gcTotalCount = 1L + gcTotalTime = 11.807 + gcBlockingCount = 1L + gcBlockingTime = 11.873 + gcPreOomeCount = 0L + gcWaitingTime = 8.054 + freeMemory = 3181568L + freeMemoryUntilGc = 3181568L + freeMemoryUntilOome = 196083712L + totalMemory = 7774208L + maxMemory = 201326592L + } + } + + private val fixture = Fixture() + + @Test + fun serialize() { + val expected = SerializationUtils.sanitizedFile("json/art_context.json") + val actual = SerializationUtils.serializeToString(fixture.getSut(), fixture.logger) + + assertEquals(expected, actual) + } + + @Test + fun deserialize() { + val expectedJson = SerializationUtils.sanitizedFile("json/art_context.json") + val actual = + SerializationUtils.deserializeJson( + expectedJson, + ArtContext.Deserializer(), + fixture.logger, + ) + val actualJson = SerializationUtils.serializeToString(actual, fixture.logger) + + assertEquals(expectedJson, actualJson) + } + + @Test + fun `deserialize preserves unknown fields`() { + val jsonWithUnknown = + SerializationUtils.sanitizedFile("json/art_context.json") + .removeSuffix("}") + .plus(",\"new_field\":\"test_value\"}") + val actual = + SerializationUtils.deserializeJson( + jsonWithUnknown, + ArtContext.Deserializer(), + fixture.logger, + ) + + assertNotNull(actual.unknown) + assertEquals("test_value", actual.unknown!!["new_field"]) + + val actualJson = SerializationUtils.serializeToString(actual, fixture.logger) + assertEquals(jsonWithUnknown, actualJson) + } +} diff --git a/sentry/src/test/java/io/sentry/protocol/ArtContextTest.kt b/sentry/src/test/java/io/sentry/protocol/ArtContextTest.kt new file mode 100644 index 00000000000..275123e494e --- /dev/null +++ b/sentry/src/test/java/io/sentry/protocol/ArtContextTest.kt @@ -0,0 +1,54 @@ +package io.sentry.protocol + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNotSame + +class ArtContextTest { + @Test + fun `copying art context wont have the same references`() { + val artContext = ArtContext() + val unknown = mapOf(Pair("unknown", "unknown")) + artContext.setUnknown(unknown) + + val clone = ArtContext(artContext) + + assertNotNull(clone) + assertNotSame(artContext, clone) + assertNotSame(artContext.unknown, clone.unknown) + } + + @Test + fun `copying art context will have the same values`() { + val artContext = ArtContext() + artContext.gcTotalCount = 10L + artContext.gcTotalTime = 11.807 + artContext.gcBlockingCount = 2L + artContext.gcBlockingTime = 5.123 + artContext.gcPreOomeCount = 1L + artContext.gcWaitingTime = 8.054 + artContext.freeMemory = 3181568L + artContext.freeMemoryUntilGc = 3181568L + artContext.freeMemoryUntilOome = 196083712L + artContext.totalMemory = 7774208L + artContext.maxMemory = 201326592L + val unknown = mapOf(Pair("unknown", "unknown")) + artContext.setUnknown(unknown) + + val clone = ArtContext(artContext) + + assertEquals(10L, clone.gcTotalCount) + assertEquals(11.807, clone.gcTotalTime) + assertEquals(2L, clone.gcBlockingCount) + assertEquals(5.123, clone.gcBlockingTime) + assertEquals(1L, clone.gcPreOomeCount) + assertEquals(8.054, clone.gcWaitingTime) + assertEquals(3181568L, clone.freeMemory) + assertEquals(3181568L, clone.freeMemoryUntilGc) + assertEquals(196083712L, clone.freeMemoryUntilOome) + assertEquals(7774208L, clone.totalMemory) + assertEquals(201326592L, clone.maxMemory) + assertNotNull(clone.unknown) { assertEquals("unknown", it["unknown"]) } + } +} diff --git a/sentry/src/test/java/io/sentry/protocol/CombinedContextsViewSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/CombinedContextsViewSerializationTest.kt index d7fd3cf9f7f..33db7a2e29d 100644 --- a/sentry/src/test/java/io/sentry/protocol/CombinedContextsViewSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/CombinedContextsViewSerializationTest.kt @@ -22,6 +22,7 @@ class CombinedContextsViewSerializationTest { val combined = CombinedContextsView(global, isolation, current, ScopeType.ISOLATION) current.setApp(AppSerializationTest.Fixture().getSut()) + current.setArt(ArtContextSerializationTest.Fixture().getSut()) current.setBrowser(BrowserSerializationTest.Fixture().getSut()) current.setFeedback(FeedbackTest.Fixture().getSut()) current.setTrace(SpanContextSerializationTest.Fixture().getSut()) diff --git a/sentry/src/test/java/io/sentry/protocol/ContextsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/ContextsSerializationTest.kt index 1a5e252a76d..8e17de9c686 100644 --- a/sentry/src/test/java/io/sentry/protocol/ContextsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/ContextsSerializationTest.kt @@ -25,6 +25,7 @@ class ContextsSerializationTest { setResponse(ResponseSerializationTest.Fixture().getSut()) setTrace(SpanContextSerializationTest.Fixture().getSut()) setSpring(SpringSerializationTest.Fixture().getSut()) + setArt(ArtContextSerializationTest.Fixture().getSut()) setFeatureFlags(FeatureFlagsSerializationTest.Fixture().getSut()) } } diff --git a/sentry/src/test/resources/json/art_context.json b/sentry/src/test/resources/json/art_context.json new file mode 100644 index 00000000000..f15596574f5 --- /dev/null +++ b/sentry/src/test/resources/json/art_context.json @@ -0,0 +1,13 @@ +{ + "gc.total_count": 1, + "gc.total_time": 11.807, + "gc.blocking_count": 1, + "gc.blocking_time": 11.873, + "gc.pre_oome_count": 0, + "gc.waiting_time": 8.054, + "memory.free": 3181568, + "memory.free_until_gc": 3181568, + "memory.free_until_oome": 196083712, + "memory.total": 7774208, + "memory.max": 201326592 +} diff --git a/sentry/src/test/resources/json/contexts.json b/sentry/src/test/resources/json/contexts.json index 7f4c0c16bc2..0670c8a6e84 100644 --- a/sentry/src/test/resources/json/contexts.json +++ b/sentry/src/test/resources/json/contexts.json @@ -17,6 +17,20 @@ "view_names": ["MainActivity", "SidebarActivity"], "start_type": "cold" }, + "art": + { + "gc.total_count": 1, + "gc.total_time": 11.807, + "gc.blocking_count": 1, + "gc.blocking_time": 11.873, + "gc.pre_oome_count": 0, + "gc.waiting_time": 8.054, + "memory.free": 3181568, + "memory.free_until_gc": 3181568, + "memory.free_until_oome": 196083712, + "memory.total": 7774208, + "memory.max": 201326592 + }, "browser": { "name": "e1c723db-7408-4043-baa7-f4e96234e5dc", From 58e0436e7aa2f8c4d817a0846c5b448b7144aa04 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 26 May 2026 16:20:20 +0200 Subject: [PATCH 170/391] chore(build): Remove IDEA-316081 toolchain workaround (#5465) The Gradle taskGraph workaround for the IntelliJ IDEA toolchain bug (IDEA-316081) is no longer needed. Co-authored-by: Claude Opus 4.6 --- build.gradle.kts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8df6e48fe53..d5b5dfc5d05 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -262,14 +262,6 @@ tasks.register("buildForCodeQL") { } } -// Workaround for https://youtrack.jetbrains.com/issue/IDEA-316081/Gradle-8-toolchain-error-Toolchain-from-executable-property-does-not-match-toolchain-from-javaLauncher-property-when-different -gradle.taskGraph.whenReady { - val task = this.allTasks.find { it.name.endsWith(".main()") } as? JavaExec - task?.let { - it.setExecutable(it.javaLauncher.get().executablePath.asFile.absolutePath) - } -} - /* * Adapted from https://github.com/androidx/androidx/blob/c799cba927a71f01ea6b421a8f83c181682633fb/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt#L524-L549 * From 14c1d7e752c73c4a62a540ff3db3ce73c126669f Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 26 May 2026 18:31:54 +0200 Subject: [PATCH 171/391] feat(replay): Add ReplayFrameObserver for snapshot testing (#5386) * feat(replay): Add beforeStoreFrame callback (JAVA-504) Add an experimental callback that fires right before a replay frame is stored to disk. The callback receives the masked bitmap (via Hint), timestamp, and current screen name. This enables snapshot testing of replay masking without needing to decode stored video segments. Includes a Kotlin extension for ergonomic usage: options.sessionReplay.beforeStoreFrame { bitmap, ts, screen -> ... } Co-Authored-By: Claude Opus 4.6 (1M context) * feat(replay): Add replay snapshot UI test with Sauce Labs collection (JAVA-504) Add ReplaySnapshotTest that uses the beforeStoreFrame callback to capture masked replay frames during a Compose UI test. Frames are written to the Downloads/sauce_labs_custom_screenshots/ directory, which is the standard path Sauce Labs collects screenshots from. CI changes: - Add *.png to Sauce Labs artifact match patterns - Upload collected replay snapshots via sentry-cli build snapshots Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Use Java API in snapshot test to avoid extension dep (JAVA-504) The Kotlin extension `beforeStoreFrame` comes from `sentry-android-replay` which may not resolve in the UI test module. Use the Java callback API directly instead. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Skip snapshot test on GH emulators and add changelog (JAVA-504) GH Actions emulators don't support screenshot capture for replay, so the ReplaySnapshotTest needs the same assumeThat guard used by ReplayTest. Also adds a changelog entry for the beforeStoreFrame callback. Co-Authored-By: Claude Opus 4.6 (1M context) * Apply suggestion from @markushi Co-authored-by: Markus Hintersteiner * refactor(replay): Replace beforeStoreFrame with ReplaySnapshotObserver (JAVA-504) Move the frame observer API from the core sentry module to sentry-android-replay so it can use Bitmap directly instead of the Hint indirection. The new ReplaySnapshotObserver fun interface lives in the replay module and is set on ReplayIntegration. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Mark ReplaySnapshotObserver as experimental and use Set in test (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Add @ApiStatus.Experimental to ReplaySnapshotObserver (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Make snapshotObserver public for cross-module access (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Exclude ReplaySnapshotTest when integrations disabled (JAVA-504) Move ReplaySnapshotTest to a conditional androidTestReplay source set so it's only compiled when APPLY_SENTRY_INTEGRATIONS is true. The test imports replay classes that aren't on the classpath otherwise. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Copy bitmap before passing to ReplaySnapshotObserver (JAVA-504) Consumers of the observer API receive a copy of the bitmap instead of the replay system's shared instance. This eliminates race conditions and crashes when consumers store or use the bitmap asynchronously. Co-Authored-By: Claude Opus 4.6 (1M context) * refactor(replay): Move ReplaySnapshotObserver to SentryReplayOptions with Hint API (JAVA-504) Move ReplaySnapshotObserver from the replay module to SentryReplayOptions in the core module and change the callback signature to use Hint instead of Bitmap. The bitmap is now accessible via TypeCheckHint.REPLAY_FRAME_BITMAP. This allows configuring the observer during Sentry.init{} alongside other replay options, removing the need to cast replayController to ReplayIntegration. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(replay): Remove unnecessary jetbrains-annotations dependency (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) * refactor(replay): Rename ReplaySnapshotObserver to ReplayFrameObserver (JAVA-504) Rename the interface to ReplayFrameObserver and the callback method to onMaskedFrameCaptured to clarify that frames have masking applied. Also update the changelog with a usage snippet. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * fix(replay): Call onMaskedFrameCaptured in File-based onScreenshotRecorded (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) * fix(changelog): Move replay entry to Unreleased section (JAVA-504) Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Markus Hintersteiner Co-authored-by: Sentry Github Bot --- .github/workflows/integration-tests-ui.yml | 22 ++++ .sauce/sentry-uitest-android-ui.yml | 1 + CHANGELOG.md | 23 ++++ .../sentry-uitest-android/build.gradle.kts | 4 + .../uitest/android/ReplaySnapshotTest.kt | 71 ++++++++++++ .../android/replay/ReplayIntegration.kt | 38 ++++++- .../android/replay/ReplayIntegrationTest.kt | 103 ++++++++++++++++++ sentry/api/sentry.api | 7 ++ .../java/io/sentry/SentryReplayOptions.java | 48 ++++++++ .../main/java/io/sentry/TypeCheckHint.java | 3 + 10 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 0549577f629..5206a173362 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -73,6 +73,28 @@ jobs: if: env.SAUCE_USERNAME != null + - name: Install Sentry CLI + if: ${{ !cancelled() && env.SAUCE_USERNAME != null }} + run: curl -sL https://sentry.io/get-cli/ | bash + + - name: Upload Replay Snapshots to Sentry + if: ${{ !cancelled() && env.SAUCE_USERNAME != null }} + run: | + shopt -s globstar nullglob + pngs=(artifacts/**/*.png) + if [ ${#pngs[@]} -gt 0 ]; then + mkdir -p replay-snapshots + cp "${pngs[@]}" replay-snapshots/ + sentry-cli build snapshots ./replay-snapshots \ + --app-id sentry-android-replay + else + echo "No replay snapshot files found, skipping upload" + fi + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: sentry-sdks + SENTRY_PROJECT: sentry-android + - name: Upload test results to Codecov if: ${{ !cancelled() }} uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 diff --git a/.sauce/sentry-uitest-android-ui.yml b/.sauce/sentry-uitest-android-ui.yml index 8d84f865c95..a00ee10614b 100644 --- a/.sauce/sentry-uitest-android-ui.yml +++ b/.sauce/sentry-uitest-android-ui.yml @@ -32,4 +32,5 @@ artifacts: when: always match: - junit.xml + - "*.png" directory: ./artifacts/ diff --git a/CHANGELOG.md b/CHANGELOG.md index acc07254df0..3c432e62410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## Unreleased + +### Features + +- Session Replay: Add `ReplayFrameObserver` for observing captured replay frames ([#5386](https://github.com/getsentry/sentry-java/pull/5386)) + + ```kotlin + SentryAndroid.init(context) { options -> + options.sessionReplay.frameObserver = + SentryReplayOptions.ReplayFrameObserver { hint, frameTimestamp, screenName -> + val bitmap = hint.getAs(TypeCheckHint.REPLAY_FRAME_BITMAP, Bitmap::class.java) + if (bitmap != null) { + try { + // Process the masked replay frame + myAnalyzer.processFrame(bitmap, frameTimestamp, screenName) + } finally { + bitmap.recycle() + } + } + } + } + ``` + ## 8.42.0 ### Features diff --git a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts index 5258a33f92a..1d725b0b595 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts +++ b/sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts @@ -83,6 +83,10 @@ android { val applySentryIntegrations = System.getenv("APPLY_SENTRY_INTEGRATIONS")?.toBoolean() ?: true +if (applySentryIntegrations) { + android.sourceSets["androidTest"].java.srcDirs("src/androidTestReplay/java") +} + dependencies { implementation( kotlin(Config.kotlinStdLib, org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION) diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt new file mode 100644 index 00000000000..1d82a3f8bc0 --- /dev/null +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt @@ -0,0 +1,71 @@ +package io.sentry.uitest.android + +import android.graphics.Bitmap +import android.os.Environment +import androidx.lifecycle.Lifecycle +import androidx.test.core.app.launchActivity +import io.sentry.SentryReplayOptions +import io.sentry.TypeCheckHint +import java.io.File +import java.util.concurrent.CopyOnWriteArraySet +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import kotlin.test.Test +import kotlin.test.assertTrue +import org.hamcrest.CoreMatchers.`is` +import org.junit.Assume.assumeThat +import org.junit.Before + +class ReplaySnapshotTest : BaseUiTest() { + + @Before + fun setup() { + // GH Actions emulators don't support capturing screenshots for replay + @Suppress("KotlinConstantConditions") + assumeThat(BuildConfig.ENVIRONMENT != "github", `is`(true)) + } + + @Test + fun captureComposeReplayFrameSnapshots() { + val snapshotsDir = + File( + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), + "sauce_labs_custom_screenshots", + ) + .apply { + deleteRecursively() + mkdirs() + } + val frameReceived = CountDownLatch(1) + val capturedScreens = CopyOnWriteArraySet() + + val activityScenario = launchActivity() + activityScenario.moveToState(Lifecycle.State.RESUMED) + + initSentry { + it.sessionReplay.sessionSampleRate = 1.0 + it.sessionReplay.frameObserver = + SentryReplayOptions.ReplayFrameObserver { hint, frameTimestamp, screenName -> + val bitmap = + hint.getAs(TypeCheckHint.REPLAY_FRAME_BITMAP, Bitmap::class.java) + ?: return@ReplayFrameObserver + val name = screenName ?: "unknown" + if (capturedScreens.add(name)) { + val file = File(snapshotsDir, "${name}_$frameTimestamp.png") + file.outputStream().use { out -> bitmap.compress(Bitmap.CompressFormat.PNG, 100, out) } + } + bitmap.recycle() + frameReceived.countDown() + } + } + + assertTrue(frameReceived.await(10, TimeUnit.SECONDS), "Expected at least one replay frame") + assertTrue(capturedScreens.isNotEmpty(), "Expected at least one screen captured") + + val files = snapshotsDir.listFiles()?.filter { it.extension == "png" } ?: emptyList() + assertTrue(files.isNotEmpty(), "Expected snapshot PNG files on disk") + assertTrue(files.all { it.length() > 0 }, "Snapshot files should not be empty") + + activityScenario.moveToState(Lifecycle.State.DESTROYED) + } +} diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt index d25827e3c7d..07e91d76486 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt @@ -2,11 +2,13 @@ package io.sentry.android.replay import android.content.Context import android.graphics.Bitmap +import android.graphics.BitmapFactory import android.os.Build import android.view.MotionEvent import io.sentry.Breadcrumb import io.sentry.DataCategory.All import io.sentry.DataCategory.Replay +import io.sentry.Hint import io.sentry.IConnectionStatusProvider.ConnectionStatus import io.sentry.IConnectionStatusProvider.ConnectionStatus.DISCONNECTED import io.sentry.IConnectionStatusProvider.IConnectionStatusObserver @@ -17,8 +19,10 @@ import io.sentry.ReplayBreadcrumbConverter import io.sentry.ReplayController import io.sentry.SentryIntegrationPackageStorage import io.sentry.SentryLevel.DEBUG +import io.sentry.SentryLevel.ERROR import io.sentry.SentryLevel.INFO import io.sentry.SentryOptions +import io.sentry.TypeCheckHint import io.sentry.android.replay.ReplayState.CLOSED import io.sentry.android.replay.ReplayState.PAUSED import io.sentry.android.replay.ReplayState.RESUMED @@ -308,13 +312,45 @@ public class ReplayIntegration( var screen: String? = null scopes?.configureScope { screen = it.screen?.substringAfterLast('.') } captureStrategy?.onScreenshotRecorded(bitmap) { frameTimeStamp -> + val observer = options.sessionReplay.frameObserver + if (observer != null) { + val copy = bitmap.copy(bitmap.config!!, false) + if (copy != null) { + try { + val hint = Hint() + hint.set(TypeCheckHint.REPLAY_FRAME_BITMAP, copy) + observer.onMaskedFrameCaptured(hint, frameTimeStamp, screen) + } catch (e: Throwable) { + options.logger.log(ERROR, "Error in ReplayFrameObserver", e) + copy.recycle() + } + } + } addFrame(bitmap, frameTimeStamp, screen) } checkCanRecord() } override fun onScreenshotRecorded(screenshot: File, frameTimestamp: Long) { - captureStrategy?.onScreenshotRecorded { _ -> addFrame(screenshot, frameTimestamp) } + var screen: String? = null + scopes?.configureScope { screen = it.screen?.substringAfterLast('.') } + captureStrategy?.onScreenshotRecorded { _ -> + val observer = options.sessionReplay.frameObserver + if (observer != null) { + val bitmap = BitmapFactory.decodeFile(screenshot.absolutePath) + if (bitmap != null) { + try { + val hint = Hint() + hint.set(TypeCheckHint.REPLAY_FRAME_BITMAP, bitmap) + observer.onMaskedFrameCaptured(hint, frameTimestamp, screen) + } catch (e: Throwable) { + options.logger.log(ERROR, "Error in ReplayFrameObserver", e) + bitmap.recycle() + } + } + } + addFrame(screenshot, frameTimestamp, screen) + } checkCanRecord() } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt index 7c86a0ad010..4183fad10ed 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt @@ -18,6 +18,8 @@ import io.sentry.SentryEvent import io.sentry.SentryIntegrationPackageStorage import io.sentry.SentryOptions import io.sentry.SentryReplayEvent.ReplayType +import io.sentry.SentryReplayOptions +import io.sentry.TypeCheckHint import io.sentry.android.replay.ReplayCache.Companion.ONGOING_SEGMENT import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_BIT_RATE import io.sentry.android.replay.ReplayCache.Companion.SEGMENT_KEY_FRAME_RATE @@ -63,6 +65,7 @@ import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.argThat import org.mockito.kotlin.check import org.mockito.kotlin.doAnswer +import org.mockito.kotlin.doReturn import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never @@ -969,6 +972,106 @@ class ReplayIntegrationTest { assertFalse(replay.isDebugMaskingOverlayEnabled) } + @Test + fun `snapshot observer is invoked with bitmap and metadata`() { + var callbackInvoked = false + var receivedTimestamp = 0L + var receivedScreen: String? = null + var receivedBitmap: Bitmap? = null + + val captureStrategy = + mock { + doAnswer { + ((it.arguments[1] as ReplayCache.(frameTimestamp: Long) -> Unit)).invoke( + fixture.replayCache, + 1720693523997, + ) + } + .whenever(mock) + .onScreenshotRecorded(anyOrNull(), any()) + } + val replay = fixture.getSut(context, replayCaptureStrategyProvider = { captureStrategy }) + + fixture.scopes.configureScope { it.screen = "MainActivity" } + replay.register(fixture.scopes, fixture.options) + replay.start() + + fixture.options.sessionReplay.frameObserver = + SentryReplayOptions.ReplayFrameObserver { hint, frameTimestamp, screenName -> + callbackInvoked = true + receivedTimestamp = frameTimestamp + receivedScreen = screenName + receivedBitmap = hint.getAs(TypeCheckHint.REPLAY_FRAME_BITMAP, Bitmap::class.java) + } + + val copyBitmap = mock() + val sourceBitmap = + mock { + on { config } doReturn ARGB_8888 + on { copy(any(), any()) } doReturn copyBitmap + } + replay.onScreenshotRecorded(sourceBitmap) + + assertTrue(callbackInvoked) + assertEquals(1720693523997, receivedTimestamp) + assertEquals("MainActivity", receivedScreen) + assertEquals(copyBitmap, receivedBitmap) + } + + @Test + fun `snapshot observer exception does not prevent frame storage`() { + val captureStrategy = + mock { + doAnswer { + ((it.arguments[1] as ReplayCache.(frameTimestamp: Long) -> Unit)).invoke( + fixture.replayCache, + 1720693523997, + ) + } + .whenever(mock) + .onScreenshotRecorded(anyOrNull(), any()) + } + val replay = fixture.getSut(context, replayCaptureStrategyProvider = { captureStrategy }) + + replay.register(fixture.scopes, fixture.options) + replay.start() + + fixture.options.sessionReplay.frameObserver = + SentryReplayOptions.ReplayFrameObserver { _, _, _ -> throw RuntimeException("test") } + + val sourceBitmap = + mock { + on { config } doReturn ARGB_8888 + on { copy(any(), any()) } doReturn mock() + } + replay.onScreenshotRecorded(sourceBitmap) + + verify(fixture.replayCache).addFrame(any(), any(), anyOrNull()) + } + + @Test + fun `snapshot observer is not invoked when null`() { + val captureStrategy = + mock { + doAnswer { + ((it.arguments[1] as ReplayCache.(frameTimestamp: Long) -> Unit)).invoke( + fixture.replayCache, + 1720693523997, + ) + } + .whenever(mock) + .onScreenshotRecorded(anyOrNull(), any()) + } + val replay = fixture.getSut(context, replayCaptureStrategyProvider = { captureStrategy }) + + replay.register(fixture.scopes, fixture.options) + replay.start() + + replay.onScreenshotRecorded(mock()) + + verify(fixture.replayCache).addFrame(any(), any(), anyOrNull()) + } + private fun getSessionCaptureStrategy(options: SentryOptions): SessionCaptureStrategy = SessionCaptureStrategy( options, diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index d2fd5f75dbc..cb03d8fe708 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -4063,6 +4063,7 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun addUnmaskViewClass (Ljava/lang/String;)V public fun getBeforeErrorSampling ()Lio/sentry/SentryReplayOptions$BeforeErrorSamplingCallback; public fun getErrorReplayDuration ()J + public fun getFrameObserver ()Lio/sentry/SentryReplayOptions$ReplayFrameObserver; public fun getFrameRate ()I public fun getNetworkDetailAllowUrls ()Ljava/util/List; public fun getNetworkDetailDenyUrls ()Ljava/util/List; @@ -4085,6 +4086,7 @@ public final class io/sentry/SentryReplayOptions : io/sentry/SentryMaskingOption public fun setBeforeErrorSampling (Lio/sentry/SentryReplayOptions$BeforeErrorSamplingCallback;)V public fun setCaptureSurfaceViews (Z)V public fun setDebug (Z)V + public fun setFrameObserver (Lio/sentry/SentryReplayOptions$ReplayFrameObserver;)V public fun setMaskAllImages (Z)V public fun setMaskAllText (Z)V public fun setNetworkCaptureBodies (Z)V @@ -4105,6 +4107,10 @@ public abstract interface class io/sentry/SentryReplayOptions$BeforeErrorSamplin public abstract fun execute (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Z } +public abstract interface class io/sentry/SentryReplayOptions$ReplayFrameObserver { + public abstract fun onMaskedFrameCaptured (Lio/sentry/Hint;JLjava/lang/String;)V +} + public final class io/sentry/SentryReplayOptions$SentryReplayQuality : java/lang/Enum { public static final field HIGH Lio/sentry/SentryReplayOptions$SentryReplayQuality; public static final field LOW Lio/sentry/SentryReplayOptions$SentryReplayQuality; @@ -4651,6 +4657,7 @@ public final class io/sentry/TypeCheckHint { public static final field OKHTTP_RESPONSE Ljava/lang/String; public static final field OPEN_FEIGN_REQUEST Ljava/lang/String; public static final field OPEN_FEIGN_RESPONSE Ljava/lang/String; + public static final field REPLAY_FRAME_BITMAP Ljava/lang/String; public static final field SENTRY_DART_SDK_NAME Ljava/lang/String; public static final field SENTRY_DOTNET_SDK_NAME Ljava/lang/String; public static final field SENTRY_EVENT_DROP_REASON Ljava/lang/String; diff --git a/sentry/src/main/java/io/sentry/SentryReplayOptions.java b/sentry/src/main/java/io/sentry/SentryReplayOptions.java index 6eb4a58e1c2..d1da6510cdb 100644 --- a/sentry/src/main/java/io/sentry/SentryReplayOptions.java +++ b/sentry/src/main/java/io/sentry/SentryReplayOptions.java @@ -36,6 +36,30 @@ public interface BeforeErrorSamplingCallback { boolean execute(@NotNull SentryEvent event, @NotNull Hint hint); } + /** + * Observer that is notified when a masked replay frame is captured. The frame bitmap (with + * masking already applied) is passed via a {@link Hint} using the key {@link + * TypeCheckHint#REPLAY_FRAME_BITMAP}. + * + *

On Android, retrieve the bitmap with: {@code hint.getAs(TypeCheckHint.REPLAY_FRAME_BITMAP, + * Bitmap.class)}. + * + *

The callback runs on a background thread (replay executor). The bitmap is a copy owned by + * the caller. Call {@code Bitmap.recycle()} when done to free native memory. + */ + @ApiStatus.Experimental + public interface ReplayFrameObserver { + /** + * Called when a masked replay frame is captured. + * + * @param hint contains the frame bitmap under {@link TypeCheckHint#REPLAY_FRAME_BITMAP} + * @param frameTimestamp the timestamp (in milliseconds since epoch) when the frame was captured + * @param screenName the current screen name, or {@code null} if unknown + */ + void onMaskedFrameCaptured( + @NotNull Hint hint, long frameTimestamp, @Nullable String screenName); + } + private static final String CUSTOM_MASKING_INTEGRATION_NAME = "ReplayCustomMasking"; private volatile boolean customMaskingTracked = false; @@ -211,6 +235,8 @@ public enum SentryReplayQuality { */ private @Nullable BeforeErrorSamplingCallback beforeErrorSampling; + @ApiStatus.Experimental private @Nullable ReplayFrameObserver frameObserver; + public SentryReplayOptions(final boolean empty, final @Nullable SdkVersion sdkVersion) { if (!empty) { // Add default mask classes directly without setting usingCustomMasking flag @@ -550,4 +576,26 @@ public void setBeforeErrorSampling( final @Nullable BeforeErrorSamplingCallback beforeErrorSampling) { this.beforeErrorSampling = beforeErrorSampling; } + + /** + * Gets the observer that is notified when a masked replay frame is captured. + * + * @return the observer, or {@code null} if not set + */ + @ApiStatus.Experimental + public @Nullable ReplayFrameObserver getFrameObserver() { + return frameObserver; + } + + /** + * Sets the observer that is notified when a masked replay frame is captured. The frame bitmap + * (with masking already applied) is passed via a {@link Hint} using the key {@link + * TypeCheckHint#REPLAY_FRAME_BITMAP}. + * + * @param frameObserver the observer, or {@code null} to clear + */ + @ApiStatus.Experimental + public void setFrameObserver(final @Nullable ReplayFrameObserver frameObserver) { + this.frameObserver = frameObserver; + } } diff --git a/sentry/src/main/java/io/sentry/TypeCheckHint.java b/sentry/src/main/java/io/sentry/TypeCheckHint.java index 189050570b4..b3b061e847c 100644 --- a/sentry/src/main/java/io/sentry/TypeCheckHint.java +++ b/sentry/src/main/java/io/sentry/TypeCheckHint.java @@ -140,4 +140,7 @@ public final class TypeCheckHint { /** Used for Ktor Request breadcrumbs. */ public static final String KTOR_CLIENT_REQUEST = "ktorClient:request"; + + /** Used for Session Replay frame bitmaps in the ReplayFrameObserver callback. */ + public static final String REPLAY_FRAME_BITMAP = "replay:frameBitmap"; } From b8ed47ac7f5486701a89e834a24d8e661ffbbec6 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 27 May 2026 17:26:10 +0200 Subject: [PATCH 172/391] chore(build): Apply Develocity build scans plugin (#5469) * chore(build): Apply Develocity build scans plugin Adds the com.gradle.develocity plugin to settings.gradle.kts to publish a build scan on every Gradle invocation. This enables build performance insights and debugging via scans.gradle.com. Co-Authored-By: Claude Opus 4.6 * ref(build): Remove redundant publishingOnlyIf Publishing on every build is the default behavior once the terms of use are accepted. Co-Authored-By: Claude Opus 4.6 * chore(build): Apply common custom user data plugin Adds the com.gradle.common-custom-user-data-gradle-plugin to capture additional build metadata (Git, CI environment) in Develocity build scans. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- settings.gradle.kts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index 4b1c606bc64..c435c382b79 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,6 +7,18 @@ pluginManagement { } } +plugins { + id("com.gradle.develocity") version "4.4.2" + id("com.gradle.common-custom-user-data-gradle-plugin") version "2.6.0" +} + +develocity { + buildScan { + termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use") + termsOfUseAgree.set("yes") + } +} + dependencyResolutionManagement { repositories { google() From a911f6daa9921a54b98a0b5f84e2b3c3d41a5c80 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 27 May 2026 17:28:02 +0200 Subject: [PATCH 173/391] fix(changelog): Move ART memory entry to unreleased (#5470) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c432e62410..684d2b68969 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ } } ``` +- Parse ART memory and garbage collector info from ANR tombstones into ART context ([#5428](https://github.com/getsentry/sentry-java/pull/5428)) ## 8.42.0 @@ -31,7 +32,6 @@ - Enable via `options.isAttachRawTombstone = true` or manifest: `` - Add API to clear feature flags from scopes ([#5426](https://github.com/getsentry/sentry-java/pull/5426)) - Add support to configure reporting historical ANRs via `AndroidManifest.xml` using the `io.sentry.anr.report-historical` attribute ([#5387](https://github.com/getsentry/sentry-java/pull/5387)) -- Parse ART memory and garbage collector info from ANR tombstones into ART context ([#5428](https://github.com/getsentry/sentry-java/pull/5428)) ### Dependencies From c1702e5dd181f26299ae9251266b039a336e936e Mon Sep 17 00:00:00 2001 From: runningcode <332597+runningcode@users.noreply.github.com> Date: Wed, 27 May 2026 15:29:25 +0000 Subject: [PATCH 174/391] release: 8.43.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 684d2b68969..c21a8cce7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.43.0 ### Features diff --git a/gradle.properties b/gradle.properties index 2eb795118a0..9739db8a573 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.42.0 +versionName=8.43.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From e5cd1c6063fb69b258319747582f627478860336 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 28 May 2026 10:10:46 +0200 Subject: [PATCH 175/391] ci: Fix Spring Boot matrix version updates (#5372) * ci: Fix Spring Boot matrix version updates Match the TOML version catalog format when overriding Spring Boot versions in matrix jobs. Preserve whitespace around the assignment and replace the quoted version value so the CI jobs actually test the requested matrix version. Co-Authored-By: Claude * ci: Limit Spring Boot matrix to supported versions The matrix jobs now actually update the version catalog. Remove Spring Boot versions that the current sample setup cannot build with the repository's Spring GraphQL integrations and Gradle version. Co-Authored-By: Claude * ci(spring): Restore Spring Boot matrix coverage Expand the Spring Boot 2 and 3 CI matrices to cover supported minor versions. Exclude GraphQL from Spring Boot 2 versions before 2.7 because the starter is unavailable there. Keep the Spring Boot 3 Gradle plugin pinned to a Gradle-compatible version while importing the tested Spring Boot BOM in samples, so the matrix exercises the intended runtime dependencies. Co-Authored-By: Claude * fix(spring): Avoid deprecated Reactor scheduler in sample Remove the explicit elastic scheduler from the Spring Boot WebFlux sample. Mono.delay already schedules the delayed work, and using Schedulers.elastic triggers deprecation warnings that fail CI under -Werror. Co-Authored-By: Claude * fix(spring): Exclude Kafka from old Boot 2 matrix Spring Kafka sample support depends on newer Spring Boot 2 dependency management. Exclude Kafka sources, profile startup, and system tests when the matrix runs Boot 2 versions before 2.7. Keep the system test classpath aligned with the SDK test helpers by importing the OkHttp and Jackson BOMs after the tested Spring Boot BOMs. Co-Authored-By: Claude * fix(spring): Support older Reactor WebFlux APIs Spring Boot 2.1 and 2.2 use Reactor versions without Mono.doFirst or Schedulers.onScheduleHook. Avoid those calls in the Boot 2 WebFlux integration so old matrix jobs can start and serve requests. Co-Authored-By: Claude * ci(spring): Skip OTel no-agent sample on old Boot 2 Spring Boot 2.1 and 2.2 cannot parse newer OpenTelemetry auto-configuration classes during startup. Keep the matrix coverage for supported samples and skip the no-agent OTel sample for those versions. Co-Authored-By: Claude * ci(spring): Drop old Boot 2 matrix versions Remove Spring Boot 2.1 and 2.2 from the matrix instead of carrying WebFlux compatibility changes for their older Reactor and Spring APIs. Restore the WebFlux filter implementation now that those versions are no longer tested. Co-Authored-By: Claude * fix(spring): Restore WebFlux schedule hook registration Revert the compatibility guard for Reactor versions that are no longer covered by the Spring Boot matrix. Co-Authored-By: Claude * fix(spring): Support older Spring GraphQL options API Use the erased Consumer signature in the batch loader registry wrapper so the code compiles with both Spring GraphQL 1.2/1.3 and 1.4. Let the Spring Boot 3 Gradle plugin follow the tested matrix version instead of pinning it separately. Co-Authored-By: Claude * build: Remove redundant test source set config Gradle already includes src/test/java in the test source set by default. Remove explicit duplicate source set configuration from the Spring modules and samples touched by this PR. Co-Authored-By: Claude * style: Import Kotlin JVM target in Gradle scripts Use the JvmTarget import in Spring Gradle scripts touched by this PR instead of repeating the fully qualified class name. Co-Authored-By: Claude * ci: Fail when Spring Boot version update misses Use a replacement command that exits non-zero when the expected Spring Boot version entry is not found. This prevents matrix jobs from silently running against the wrong dependency version. Co-Authored-By: Claude --------- Co-authored-by: Claude --- .github/workflows/spring-boot-2-matrix.yml | 11 +++- .github/workflows/spring-boot-3-matrix.yml | 7 +- .github/workflows/spring-boot-4-matrix.yml | 5 +- gradle/libs.versions.toml | 1 + .../build.gradle.kts | 16 +++-- .../build.gradle.kts | 15 +++-- .../build.gradle.kts | 15 +++-- .../build.gradle.kts | 65 ++++++++++++++----- .../build.gradle.kts | 63 ++++++++++++++---- .../build.gradle.kts | 11 +++- .../build.gradle.kts | 41 ++++++++++-- .../boot/DistributedTracingController.java | 15 +++-- .../samples/spring/boot/PersonService.java | 2 - .../build.gradle.kts | 61 +++++++++++++---- .../build.gradle.kts | 12 ++-- .../sentry-samples-spring/build.gradle.kts | 6 +- sentry-spring-boot/build.gradle.kts | 7 +- .../spring/boot/SentryAutoConfiguration.java | 14 ++-- .../boot/SentrySpringVersionChecker.java | 3 +- .../graphql/SentryBatchLoaderRegistry.java | 4 +- sentry-spring/build.gradle.kts | 7 +- test/system-test-runner.py | 7 +- 22 files changed, 272 insertions(+), 116 deletions(-) diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 9a69765657c..48ed0a69665 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - springboot-version: [ '2.1.0', '2.2.5', '2.4.13', '2.5.15', '2.6.15', '2.7.0', '2.7.18' ] + springboot-version: [ '2.4.13', '2.5.15', '2.6.15', '2.7.0', '2.7.18' ] name: Spring Boot ${{ matrix.springboot-version }} env: @@ -64,8 +64,13 @@ jobs: - name: Update Spring Boot 2.x version run: | - sed -i 's/^springboot2=.*/springboot2=${{ matrix.springboot-version }}/' gradle/libs.versions.toml - echo "Updated Spring Boot 2.x version to ${{ matrix.springboot-version }}" + springboot_version="${{ matrix.springboot-version }}" + if [[ ! "$springboot_version" =~ ^2\.7\. ]]; then + echo "ORG_GRADLE_PROJECT_excludeGraphql=true" >> "$GITHUB_ENV" + echo "ORG_GRADLE_PROJECT_excludeKafka=true" >> "$GITHUB_ENV" + fi + perl -0pi -e 'BEGIN { $v = shift } s/^springboot2[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot2 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml + echo "Updated Spring Boot 2.x version to $springboot_version" - name: Exclude android modules from build run: | diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index c6a83c597fb..0e00608efe2 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - springboot-version: [ '3.0.0', '3.2.12', '3.3.13', '3.4.13', '3.5.13' ] + springboot-version: [ '3.2.12', '3.3.13', '3.4.13', '3.5.13' ] name: Spring Boot ${{ matrix.springboot-version }} env: @@ -64,8 +64,9 @@ jobs: - name: Update Spring Boot 3.x version run: | - sed -i 's/^springboot3=.*/springboot3=${{ matrix.springboot-version }}/' gradle/libs.versions.toml - echo "Updated Spring Boot 3.x version to ${{ matrix.springboot-version }}" + springboot_version="${{ matrix.springboot-version }}" + perl -0pi -e 'BEGIN { $v = shift } s/^springboot3[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot3 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml + echo "Updated Spring Boot 3.x version to $springboot_version" - name: Exclude android modules from build run: | diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 93d314de2e3..c6ae6195f59 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -64,8 +64,9 @@ jobs: - name: Update Spring Boot 4.x version run: | - sed -i 's/^springboot4=.*/springboot4=${{ matrix.springboot-version }}/' gradle/libs.versions.toml - echo "Updated Spring Boot 4.x version to ${{ matrix.springboot-version }}" + springboot_version="${{ matrix.springboot-version }}" + perl -0pi -e 'BEGIN { $v = shift } s/^springboot4[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot4 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml + echo "Updated Spring Boot 4.x version to $springboot_version" - name: Exclude android modules from build run: | diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4e580db7498..12e24536d7e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -160,6 +160,7 @@ slf4j2-api = { module = "org.slf4j:slf4j-api", version = "2.0.5" } spotlessLib = { module = "com.diffplug.spotless:com.diffplug.spotless.gradle.plugin", version.ref = "spotless"} springboot2-bom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "springboot2" } springboot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot2" } +spring-graphql = { module = "org.springframework.graphql:spring-graphql", version = "1.0.6" } springboot-starter-graphql = { module = "org.springframework.boot:spring-boot-starter-graphql", version.ref = "springboot2" } springboot-starter-quartz = { module = "org.springframework.boot:spring-boot-starter-quartz", version.ref = "springboot2" } springboot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springboot2" } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index ed0af32b031..7966e621ebd 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -18,6 +19,13 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +dependencyManagement { + imports { + mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") + mavenBom(libs.otel.instrumentation.bom.get().toString()) + } +} + // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" @@ -27,10 +35,10 @@ configure { } tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 } } @@ -79,10 +87,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -dependencyManagement { imports { mavenBom(libs.otel.instrumentation.bom.get().toString()) } } - -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index d3d66c469b7..3c7e00ae552 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.springframework.boot.gradle.tasks.run.BootRun @@ -19,6 +20,12 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +dependencyManagement { + imports { + mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") + } +} + // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" @@ -27,14 +34,12 @@ configure { targetCompatibility = JavaVersion.VERSION_17 } -tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 -} +tasks.withType().configureEach { compilerOptions.jvmTarget = JvmTarget.JVM_17 } tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 } } @@ -83,8 +88,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.register("bootRunWithAgent").configure { group = "application" diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index ae3ef70ad70..d5e4caa595d 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -18,6 +19,12 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +dependencyManagement { + imports { + mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") + } +} + // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" @@ -26,14 +33,12 @@ configure { targetCompatibility = JavaVersion.VERSION_17 } -tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 -} +tasks.withType().configureEach { compilerOptions.jvmTarget = JvmTarget.JVM_17 } tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 } } @@ -85,8 +90,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index f1665f513d1..0b8c5a181e7 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -15,25 +16,35 @@ group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_11 repositories { mavenCentral() } -configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 +fun springBoot2SupportsOptionalIntegrations(): Boolean { + val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") + val parts = version.split(".").map { it.toIntOrNull() ?: 0 } + val major = parts.getOrElse(0) { 0 } + val minor = parts.getOrElse(1) { 0 } + return major > 2 || (major == 2 && minor >= 7) } -tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 +val includeGraphql = + !project.hasProperty("excludeGraphql") && springBoot2SupportsOptionalIntegrations() +val includeKafka = !project.hasProperty("excludeKafka") && springBoot2SupportsOptionalIntegrations() + +configure { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } +tasks.withType().configureEach { compilerOptions.jvmTarget = JvmTarget.JVM_11 } + tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_11 } } @@ -43,7 +54,9 @@ dependencies { implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) - implementation(libs.springboot.starter.graphql) + if (includeGraphql) { + implementation(libs.springboot.starter.graphql) + } implementation(libs.springboot.starter.jdbc) implementation(libs.springboot.starter.quartz) implementation(libs.springboot.starter.security) @@ -55,14 +68,17 @@ dependencies { implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) implementation(projects.sentrySpringBootStarter) implementation(projects.sentryLogback) - implementation(projects.sentryGraphql) + if (includeGraphql) { + implementation(projects.sentryGraphql) + } implementation(projects.sentryQuartz) implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentlessSpring) implementation(projects.sentryAsyncProfiler) - // kafka - implementation(libs.spring.kafka2) - implementation(projects.sentryKafka) + if (includeKafka) { + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) + } // database query tracing implementation(projects.sentryJdbc) @@ -103,7 +119,18 @@ tasks.jar { tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } +configure { + main { + if (!includeGraphql) { + java.exclude("**/graphql/**") + resources.exclude("graphql/**") + } + if (!includeKafka) { + java.exclude("**/queues/kafka/**") + resources.exclude("application-kafka.properties") + } + } +} tasks.register("systemTest").configure { group = "verification" @@ -121,7 +148,15 @@ tasks.register("systemTest").configure { minHeapSize = "128m" maxHeapSize = "1g" - filter { includeTestsMatching("io.sentry.systemtest*") } + filter { + includeTestsMatching("io.sentry.systemtest*") + if (!includeGraphql) { + excludeTestsMatching("io.sentry.systemtest.Graphql*") + } + if (!includeKafka) { + excludeTestsMatching("io.sentry.systemtest.Kafka*") + } + } } tasks.named("test").configure { diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index 7c84875ca07..b78f1f01881 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -15,22 +16,34 @@ group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_11 repositories { mavenCentral() } +fun springBoot2SupportsOptionalIntegrations(): Boolean { + val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") + val parts = version.split(".").map { it.toIntOrNull() ?: 0 } + val major = parts.getOrElse(0) { 0 } + val minor = parts.getOrElse(1) { 0 } + return major > 2 || (major == 2 && minor >= 7) +} + +val includeGraphql = + !project.hasProperty("excludeGraphql") && springBoot2SupportsOptionalIntegrations() +val includeKafka = !project.hasProperty("excludeKafka") && springBoot2SupportsOptionalIntegrations() + configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_11 kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_11 } } @@ -39,7 +52,9 @@ dependencies { implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) - implementation(libs.springboot.starter.graphql) + if (includeGraphql) { + implementation(libs.springboot.starter.graphql) + } implementation(libs.springboot.starter.jdbc) implementation(libs.springboot.starter.quartz) implementation(libs.springboot.starter.security) @@ -51,14 +66,17 @@ dependencies { implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) implementation(projects.sentrySpringBootStarter) implementation(projects.sentryLogback) - implementation(projects.sentryGraphql) + if (includeGraphql) { + implementation(projects.sentryGraphql) + } implementation(projects.sentryQuartz) implementation(projects.sentryAsyncProfiler) implementation(libs.otel) - // kafka - implementation(libs.spring.kafka2) - implementation(projects.sentryKafka) + if (includeKafka) { + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) + } // database query tracing implementation(projects.sentryJdbc) @@ -99,7 +117,18 @@ tasks.jar { tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } +configure { + main { + if (!includeGraphql) { + java.exclude("**/graphql/**") + resources.exclude("graphql/**") + } + if (!includeKafka) { + java.exclude("**/queues/kafka/**") + resources.exclude("application-kafka.properties") + } + } +} tasks.register("bootRunWithAgent").configure { group = "application" @@ -141,7 +170,15 @@ tasks.register("systemTest").configure { minHeapSize = "128m" maxHeapSize = "1g" - filter { includeTestsMatching("io.sentry.systemtest*") } + filter { + includeTestsMatching("io.sentry.systemtest*") + if (!includeGraphql) { + excludeTestsMatching("io.sentry.systemtest.Graphql*") + } + if (!includeKafka) { + excludeTestsMatching("io.sentry.systemtest.Kafka*") + } + } } tasks.named("test").configure { diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts index d5b04543576..8b2079ddd9c 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -18,6 +19,12 @@ java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() } +dependencyManagement { + imports { + mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") + } +} + // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" @@ -50,12 +57,10 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts index b10b30737d8..2127dbfd79f 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -15,22 +16,36 @@ group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_11 repositories { mavenCentral() } +fun springBoot2SupportsGraphql(): Boolean { + val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") + val parts = version.split(".").map { it.toIntOrNull() ?: 0 } + val major = parts.getOrElse(0) { 0 } + val minor = parts.getOrElse(1) { 0 } + return major > 2 || (major == 2 && minor >= 7) +} + +val includeGraphql = !project.hasProperty("excludeGraphql") && springBoot2SupportsGraphql() + dependencies { implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter.actuator) - implementation(libs.springboot.starter.graphql) + if (includeGraphql) { + implementation(libs.springboot.starter.graphql) + } implementation(libs.springboot.starter.webflux) implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) implementation(projects.sentrySpringBootStarter) implementation(projects.sentryLogback) - implementation(projects.sentryGraphql) + if (includeGraphql) { + implementation(projects.sentryGraphql) + } implementation(projects.sentryAsyncProfiler) testImplementation(kotlin(Config.kotlinStdLib)) @@ -68,12 +83,19 @@ tasks.jar { tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } +configure { + main { + if (!includeGraphql) { + java.exclude("**/graphql/**") + resources.exclude("graphql/**") + } + } +} tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_11 } } @@ -93,7 +115,12 @@ tasks.register("systemTest").configure { minHeapSize = "128m" maxHeapSize = "1g" - filter { includeTestsMatching("io.sentry.systemtest*") } + filter { + includeTestsMatching("io.sentry.systemtest*") + if (!includeGraphql) { + excludeTestsMatching("io.sentry.systemtest.Graphql*") + } + } } tasks.named("test").configure { diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/DistributedTracingController.java b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/DistributedTracingController.java index cd69d854006..4bd6bb77bfb 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/DistributedTracingController.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/DistributedTracingController.java @@ -1,6 +1,7 @@ package io.sentry.samples.spring.boot; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; @@ -17,6 +18,10 @@ @RequestMapping("/tracing/") public class DistributedTracingController { private static final Logger LOGGER = LoggerFactory.getLogger(DistributedTracingController.class); + private static final String BASIC_AUTH = + "Basic " + + Base64.getEncoder().encodeToString("user:password".getBytes(StandardCharsets.UTF_8)); + private final WebClient webClient; public DistributedTracingController(WebClient webClient) { @@ -28,9 +33,7 @@ Mono person(@PathVariable Long id) { return webClient .get() .uri("http://localhost:8080/person/{id}", id) - .header( - HttpHeaders.AUTHORIZATION, - "Basic " + HttpHeaders.encodeBasicAuth("user", "password", Charset.defaultCharset())) + .header(HttpHeaders.AUTHORIZATION, BASIC_AUTH) .retrieve() .bodyToMono(Person.class) .map(response -> response); @@ -41,9 +44,7 @@ Mono create(@RequestBody Person person) { return webClient .post() .uri("http://localhost:8080/person/") - .header( - HttpHeaders.AUTHORIZATION, - "Basic " + HttpHeaders.encodeBasicAuth("user", "password", Charset.defaultCharset())) + .header(HttpHeaders.AUTHORIZATION, BASIC_AUTH) .body(Mono.just(person), Person.class) .retrieve() .bodyToMono(Person.class) diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonService.java b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonService.java index ed7422d9d0b..4a9ae98a447 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonService.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/java/io/sentry/samples/spring/boot/PersonService.java @@ -4,14 +4,12 @@ import java.time.Duration; import org.springframework.stereotype.Service; import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; @Service public class PersonService { Mono create(Person person) { return Mono.delay(Duration.ofMillis(100)) - .publishOn(Schedulers.boundedElastic()) .doOnNext(__ -> Sentry.captureMessage("Creating person")) .map(__ -> person); } diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index cc535c725e1..0a2a6f2da57 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -15,21 +16,33 @@ group = "io.sentry.sample.spring-boot" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_11 -java.targetCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_11 repositories { mavenCentral() } +fun springBoot2SupportsOptionalIntegrations(): Boolean { + val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") + val parts = version.split(".").map { it.toIntOrNull() ?: 0 } + val major = parts.getOrElse(0) { 0 } + val minor = parts.getOrElse(1) { 0 } + return major > 2 || (major == 2 && minor >= 7) +} + +val includeGraphql = + !project.hasProperty("excludeGraphql") && springBoot2SupportsOptionalIntegrations() +val includeKafka = !project.hasProperty("excludeKafka") && springBoot2SupportsOptionalIntegrations() + configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_11 } } @@ -38,7 +51,9 @@ dependencies { implementation(libs.springboot.starter) implementation(libs.springboot.starter.actuator) implementation(libs.springboot.starter.aop) - implementation(libs.springboot.starter.graphql) + if (includeGraphql) { + implementation(libs.springboot.starter.graphql) + } implementation(libs.springboot.starter.jdbc) implementation(libs.springboot.starter.quartz) implementation(libs.springboot.starter.security) @@ -48,15 +63,18 @@ dependencies { implementation(libs.springboot.starter.websocket) implementation(libs.caffeine) - // kafka - implementation(libs.spring.kafka2) - implementation(projects.sentryKafka) + if (includeKafka) { + implementation(libs.spring.kafka2) + implementation(projects.sentryKafka) + } implementation(Config.Libs.aspectj) implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) implementation(projects.sentrySpringBootStarter) implementation(projects.sentryLogback) - implementation(projects.sentryGraphql) + if (includeGraphql) { + implementation(projects.sentryGraphql) + } implementation(projects.sentryQuartz) implementation(projects.sentryAsyncProfiler) @@ -102,7 +120,18 @@ tasks.jar { tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } +configure { + main { + if (!includeGraphql) { + java.exclude("**/graphql/**") + resources.exclude("graphql/**") + } + if (!includeKafka) { + java.exclude("**/queues/kafka/**") + resources.exclude("application-kafka.properties") + } + } +} tasks.register("systemTest").configure { group = "verification" @@ -120,7 +149,15 @@ tasks.register("systemTest").configure { minHeapSize = "128m" maxHeapSize = "1g" - filter { includeTestsMatching("io.sentry.systemtest*") } + filter { + includeTestsMatching("io.sentry.systemtest*") + if (!includeGraphql) { + excludeTestsMatching("io.sentry.systemtest.Graphql*") + } + if (!includeKafka) { + excludeTestsMatching("io.sentry.systemtest.Kafka*") + } + } } tasks.named("test").configure { diff --git a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts index 319431e71d2..3dec793e5c9 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts @@ -1,9 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { application - alias(libs.plugins.springboot3) apply false alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -31,8 +30,9 @@ extra["kotlin-coroutines.version"] = "1.9.0" dependencyManagement { imports { - mavenBom(SpringBootPlugin.BOM_COORDINATES) + mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") mavenBom(libs.kotlin.bom.get().toString()) + mavenBom(libs.jackson.bom.get().toString()) } } @@ -57,7 +57,7 @@ dependencies { testImplementation(projects.sentrySystemTestSupport) testImplementation(libs.kotlin.test.junit) - testImplementation(libs.springboot.starter.test) { + testImplementation(libs.springboot3.starter.test) { exclude(group = "org.junit.vintage", module = "junit-vintage-engine") } } @@ -65,12 +65,10 @@ dependencies { tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + compilerOptions.jvmTarget = JvmTarget.JVM_17 } } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring/build.gradle.kts b/sentry-samples/sentry-samples-spring/build.gradle.kts index 446baf3a696..02e7f632450 100644 --- a/sentry-samples/sentry-samples-spring/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -33,6 +34,7 @@ dependencyManagement { mavenBom(libs.springboot2.bom.get().toString()) mavenBom(libs.kotlin.bom.get().toString()) mavenBom(libs.jackson.bom.get().toString()) + mavenBom(libs.okhttp.bom.get().toString()) } } @@ -64,12 +66,10 @@ dependencies { tasks.withType().configureEach { kotlin { compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict") - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 + compilerOptions.jvmTarget = JvmTarget.JVM_1_8 } } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-spring-boot/build.gradle.kts b/sentry-spring-boot/build.gradle.kts index 74f5d7c87bb..e54112ae54c 100644 --- a/sentry-spring-boot/build.gradle.kts +++ b/sentry-spring-boot/build.gradle.kts @@ -1,4 +1,5 @@ import net.ltgt.gradle.errorprone.errorprone +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -12,7 +13,7 @@ plugins { } tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 + compilerOptions.jvmTarget = JvmTarget.JVM_1_8 compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } @@ -35,7 +36,7 @@ dependencies { compileOnly(libs.servlet.api) compileOnly(libs.springboot.starter) compileOnly(libs.springboot.starter.aop) - compileOnly(libs.springboot.starter.graphql) + compileOnly(libs.spring.graphql) compileOnly(libs.springboot.starter.quartz) compileOnly(libs.springboot.starter.security) compileOnly(libs.spring.kafka2) @@ -84,8 +85,6 @@ dependencies { testImplementation(projects.sentryAsyncProfiler) } -configure { test { java.srcDir("src/test/java") } } - jacoco { toolVersion = libs.versions.jacoco.get() } tasks.jacocoTestReport { diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java index c7d5a892e9f..f89f5c5bb31 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java @@ -1,7 +1,6 @@ package io.sentry.spring.boot; import com.jakewharton.nopen.annotation.Open; -import graphql.GraphQLError; import io.sentry.EventProcessor; import io.sentry.IScopes; import io.sentry.ISpanFactory; @@ -12,7 +11,6 @@ import io.sentry.Sentry; import io.sentry.SentryIntegrationPackageStorage; import io.sentry.SentryOptions; -import io.sentry.graphql.SentryGraphqlExceptionHandler; import io.sentry.protocol.SdkVersion; import io.sentry.quartz.SentryJobListener; import io.sentry.spring.ContextTagsEventProcessor; @@ -75,7 +73,6 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; -import org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter; import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.client.RestTemplate; @@ -203,11 +200,12 @@ static class ContextTagsEventProcessorConfiguration { @Configuration(proxyBeanMethods = false) @Import(SentryGraphqlAutoConfiguration.class) @Open - @ConditionalOnClass({ - SentryGraphqlExceptionHandler.class, - DataFetcherExceptionResolverAdapter.class, - GraphQLError.class - }) + @ConditionalOnClass( + name = { + "io.sentry.graphql.SentryGraphqlExceptionHandler", + "org.springframework.graphql.execution.DataFetcherExceptionResolverAdapter", + "graphql.GraphQLError" + }) static class GraphqlConfiguration {} @Configuration(proxyBeanMethods = false) diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentrySpringVersionChecker.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentrySpringVersionChecker.java index 1cbcb4f090c..2da1a3dd8d9 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentrySpringVersionChecker.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentrySpringVersionChecker.java @@ -14,7 +14,8 @@ final class SentrySpringVersionChecker @Override public void onApplicationEvent(ApplicationContextInitializedEvent event) { - if (!SpringBootVersion.getVersion().startsWith("2")) { + String springBootVersion = SpringBootVersion.getVersion(); + if (springBootVersion != null && !springBootVersion.startsWith("2")) { logger.warn("############################### WARNING ###############################"); logger.warn("## ##"); logger.warn("## !Incompatible Spring Boot Version detected! ##"); diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java index a75aa281349..4e7c3665aae 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java @@ -75,8 +75,8 @@ public BatchLoaderRegistry.RegistrationSpec withName(String name) { } @Override - public BatchLoaderRegistry.RegistrationSpec withOptions( - Consumer optionsConsumer) { + @SuppressWarnings({"rawtypes", "unchecked"}) + public BatchLoaderRegistry.RegistrationSpec withOptions(Consumer optionsConsumer) { return delegate.withOptions(optionsConsumer); } diff --git a/sentry-spring/build.gradle.kts b/sentry-spring/build.gradle.kts index c4c75cb5f07..64380f7e7f4 100644 --- a/sentry-spring/build.gradle.kts +++ b/sentry-spring/build.gradle.kts @@ -1,4 +1,5 @@ import net.ltgt.gradle.errorprone.errorprone +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -12,7 +13,7 @@ plugins { } tasks.withType().configureEach { - compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 + compilerOptions.jvmTarget = JvmTarget.JVM_1_8 compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 compilerOptions.apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 } @@ -34,7 +35,7 @@ dependencies { compileOnly(libs.otel) compileOnly(libs.servlet.api) compileOnly(libs.slf4j.api) - compileOnly(libs.springboot.starter.graphql) + compileOnly(libs.spring.graphql) compileOnly(libs.springboot.starter.quartz) compileOnly(libs.spring.kafka2) compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization) @@ -63,8 +64,6 @@ dependencies { testImplementation(libs.springboot.starter.webflux) } -configure { test { java.srcDir("src/test/java") } } - jacoco { toolVersion = libs.versions.jacoco.get() } tasks.jacocoTestReport { diff --git a/test/system-test-runner.py b/test/system-test-runner.py index 784448715e9..7dd7530c8bd 100644 --- a/test/system-test-runner.py +++ b/test/system-test-runner.py @@ -224,11 +224,14 @@ def kill_process(self, pid: int, name: str) -> None: except (OSError, ProcessLookupError): print(f"Process {pid} was already dead") + def exclude_kafka(self) -> bool: + return os.environ.get("ORG_GRADLE_PROJECT_excludeKafka") == "true" + def module_requires_kafka(self, sample_module: str) -> bool: - return sample_module in KAFKA_BROKER_REQUIRED_MODULES + return not self.exclude_kafka() and sample_module in KAFKA_BROKER_REQUIRED_MODULES def module_requires_kafka_profile(self, sample_module: str) -> bool: - return sample_module in KAFKA_PROFILE_REQUIRED_MODULES + return not self.exclude_kafka() and sample_module in KAFKA_PROFILE_REQUIRED_MODULES def wait_for_port(self, host: str, port: int, max_attempts: int = 20) -> bool: for _ in range(max_attempts): From ca6b6d88192958c95ad9494d044c45dcc460c8e2 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 28 May 2026 10:11:26 +0200 Subject: [PATCH 176/391] fix(skill): Detect stacked PR context from branch (#5223) * fix(skill): Detect stacked PR context from branch Update the create-java-pr skill to infer standalone vs stacked PR mode\nfrom git branch and existing PR relationships.\n\nWhen running on main/master, default to standalone PR mode and only\nenter stack mode when explicitly requested by the user.\n\nCo-Authored-By: Claude * fix(create-java-pr): Detect collection branches with downstream PRs Check for downstream PRs even when the current branch already has a PR targeting main/master. This prevents collection branches in a stacked PR flow from being misclassified as standalone PR context. Co-Authored-By: Claude * fix(create-java-pr): Map stack base detection to defined PR type When downstream PRs are found for a branch, classify the result as an existing stack flow instead of an undefined "stack base context". Clarify that the next PR in an existing stack can target either the previous stack PR branch or the collection branch, so all detection outcomes map to actionable PR types. Co-Authored-By: Claude * fix(skills): Add missing standalone PR fallback for fresh feature branches The decision tree in create-java-pr Step 0 had a gap: when a non-main branch has no existing PR and no downstream PRs target it, no outcome was specified. This is the most common case (fresh feature branch). Add explicit fallback to standalone PR context, matching the behavior of the parallel branch where a PR exists with base main and no downstream PRs. Co-Authored-By: Claude --------- Co-authored-by: Claude --- .claude/skills/create-java-pr/SKILL.md | 45 ++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.claude/skills/create-java-pr/SKILL.md b/.claude/skills/create-java-pr/SKILL.md index 6d5bb34edb3..e2a9b9bc785 100644 --- a/.claude/skills/create-java-pr/SKILL.md +++ b/.claude/skills/create-java-pr/SKILL.md @@ -9,15 +9,48 @@ Prepare local changes and create a pull request for the sentry-java repo. **Required reading:** Before proceeding, read `.cursor/rules/pr.mdc` for the full PR and stacked PR workflow details. That file is the source of truth for PR conventions, stack comment format, branch naming, and merge strategy. -## Step 0: Determine PR Type +## Step 0: Determine PR Type From Git Branch Context -Ask the user (or infer from context) whether this is: +Infer PR type from the current branch before asking the user. -- **Standalone PR** — a regular PR targeting `main`. Follow Steps 1–6 as written. -- **First PR of a new stack** — ask for a topic name (e.g. "Global Attributes"). Create a collection branch from `main`, then branch the first PR off it. The first PR targets the collection branch. -- **Next PR in an existing stack** — identify the previous stack branch and topic. This PR targets the previous stack branch. +1. Get current branch: -If the user mentions "stack", "stacked PR", or provides a topic name with a number (e.g. `[Topic 2]`), treat it as a stacked PR. See `.cursor/rules/pr.mdc` § "Stacked PRs" for full details. +```bash +git branch --show-current +``` + +2. Apply these rules: + +- **If branch is `main` or `master`**: default to a **standalone PR**. + - Do **not** assume stack mode from `main`. + - Only use stack mode if the user explicitly asks for a stacked PR. +- **If branch is not `main`/`master`**: + - Check whether that branch already has a PR and what its base is: + ```bash + gh pr list --head "$(git branch --show-current)" --json number,baseRefName,title --jq '.[0]' + ``` + - If that branch PR exists and `baseRefName` is **not** `main`/`master`, treat the work as a **stacked PR context**. + - If that branch PR exists and `baseRefName` **is** `main`/`master`, also check whether other PRs target the current branch: + ```bash + gh pr list --base "$(git branch --show-current)" --json number,headRefName,title + ``` + - If there are downstream PRs, treat this as **next PR in an existing stack** with the current branch as the stack base (collection branch). + - If there are no downstream PRs, treat it as **standalone PR context**. + - If no PR exists for the current branch, check whether other PRs target it: + ```bash + gh pr list --base "$(git branch --show-current)" --json number,headRefName,title + ``` + - If there are downstream PRs, treat this as **next PR in an existing stack** with the current branch as the stack base (collection branch). + - If there are no downstream PRs either, treat it as **standalone PR context** (fresh feature branch). + +3. If signals are mixed or ambiguous, ask one focused question to confirm. + +PR types: +- **Standalone PR** — regular PR targeting `main`. +- **First PR of a new stack** — create collection branch from `main`, then first PR off it. +- **Next PR in an existing stack** — target the current stack base branch (usually the previous stack PR branch, or the collection branch if creating the first follow-up PR from the collection branch). + +If the user explicitly says "stack", "stacked PR", or provides numbered stack titles (e.g. `[Topic 2]`), honor that even if branch heuristics are inconclusive. ## Step 1: Ensure Feature Branch From 9404243e2540f4ae8b6d734afb446c64bb976076 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 29 May 2026 08:33:54 +0200 Subject: [PATCH 177/391] chore(ci): Update gradle/actions from v5.0.2 to v6.1.0 (#5471) * chore(ci): Update gradle/actions from v5.0.2 to v6.1.0 Remove stale workaround comments for gradle/actions#21 (now closed). Co-Authored-By: Claude Opus 4.6 * Restore workaround comments Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/generate-javadocs.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 2 +- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release-build.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 7ef34ea563e..f3ad7240438 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -39,7 +39,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5e89b2be40..6817ce53337 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ae8d78d305e..34bf6241fd6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 1d1493bb7bf..23dd0134203 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 - name: Set up Java uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index c338400f958..4109c2a2947 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -19,7 +19,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index b50d42f7d1d..090a6360745 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -20,7 +20,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 - name: Generate Aggregate Javadocs run: | diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 2f5a63f747a..bbe8c709587 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -38,7 +38,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} @@ -88,7 +88,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 1fd6c5c2c09..6d0aefab386 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -36,7 +36,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 4d6c952a161..85731127f36 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -36,7 +36,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 5206a173362..fbb8018da06 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -33,7 +33,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 3ba2d299e54..3fb0b162750 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -26,7 +26,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 - name: Build artifacts run: make publish diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 48ed0a69665..91154a2c7b3 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -58,7 +58,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 0e00608efe2..f0b3fbe279b 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -58,7 +58,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index c6ae6195f59..68bdd38f2ec 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -58,7 +58,7 @@ jobs: key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index ea6a53a8750..fc66f6744b5 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -118,7 +118,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c + uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} From 4e3e79da82431a9fd3081a829281371c79709f19 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 29 May 2026 16:37:03 +0200 Subject: [PATCH 178/391] fix(replay): Associate trace IDs with replay segments (#5473) * fix(replay): Populate trace_ids in replay events for trace search When a transaction is captured while replay is recording, the trace ID is now registered with the replay controller and included in the next replay segment. This enables searching for replays by trace ID in the Sentry UI. Fixes #5346 Slack thread: https://sentry.slack.com/archives/CP4UUUF1S/p1779889727948439?thread_ts=1777385469.860819&cid=CP4UUUF1S https://claude.ai/code/session_012wjHQtsEPzcrxSMCufxrDY * docs: Add changelog entry for trace_ids fix https://claude.ai/code/session_012wjHQtsEPzcrxSMCufxrDY * Format code * api dump --------- Co-authored-by: Claude Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 6 ++ .../api/sentry-android-replay.api | 1 + .../android/replay/ReplayIntegration.kt | 7 ++ .../replay/capture/BaseCaptureStrategy.kt | 29 ++++++- .../android/replay/capture/CaptureStrategy.kt | 6 ++ .../android/replay/ReplayIntegrationTest.kt | 32 ++++++++ .../capture/SessionCaptureStrategyTest.kt | 79 +++++++++++++++++++ sentry/api/sentry.api | 2 + .../java/io/sentry/NoOpReplayController.java | 3 + .../main/java/io/sentry/ReplayController.java | 8 ++ .../src/main/java/io/sentry/SentryClient.java | 7 ++ .../test/java/io/sentry/SentryClientTest.kt | 17 ++++ 12 files changed, 195 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c21a8cce7d7..1bbbede5794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Session Replay: Populate `trace_ids` in replay events to enable searching replays by trace ID ([#5473](https://github.com/getsentry/sentry-java/pull/5473)) + ## 8.43.0 ### Features diff --git a/sentry-android-replay/api/sentry-android-replay.api b/sentry-android-replay/api/sentry-android-replay.api index aeabe9c05c1..12fe214176d 100644 --- a/sentry-android-replay/api/sentry-android-replay.api +++ b/sentry-android-replay/api/sentry-android-replay.api @@ -76,6 +76,7 @@ public final class io/sentry/android/replay/ReplayIntegration : io/sentry/IConne public fun onWindowSizeChanged (II)V public fun pause ()V public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V + public fun registerTraceId (Lio/sentry/protocol/SentryId;)V public fun resume ()V public fun setBreadcrumbConverter (Lio/sentry/ReplayBreadcrumbConverter;)V public fun start ()V diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt index 07e91d76486..116ab45af06 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt @@ -280,6 +280,13 @@ public class ReplayIntegration( override fun isDebugMaskingOverlayEnabled(): Boolean = debugMaskingEnabled + override fun registerTraceId(traceId: SentryId) { + if (!isEnabled.get() || !isRecording()) { + return + } + captureStrategy?.registerTraceId(traceId) + } + private fun pauseInternal() { lifecycleLock.acquire().use { if (!isEnabled.get() || !lifecycle.isAllowed(PAUSED)) { diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt index 2277f6c33a1..dab98ec4e24 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt @@ -54,6 +54,8 @@ internal abstract class BaseCaptureStrategy( ) : CaptureStrategy { internal companion object { private const val TAG = "CaptureStrategy" + // https://github.com/getsentry/sentry-javascript/blob/30eb68fff5077211c30c61ba74625e66ab514870/packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts#L41 + private const val MAX_TRACE_IDS = 100 } private val persistingExecutor: ScheduledExecutorService by lazy { @@ -96,6 +98,8 @@ internal abstract class BaseCaptureStrategy( override var replayType by persistableAtomic(propertyName = SEGMENT_KEY_REPLAY_TYPE) protected val currentEvents: Deque = ConcurrentLinkedDeque() + private val traceIdsLock = Any() + private val currentTraceIds: MutableList = mutableListOf() override fun start(segmentId: Int, replayId: SentryId, replayType: ReplayType?) { cache = replayCacheProvider?.invoke(replayId) ?: ReplayCache(options, replayId) @@ -135,8 +139,14 @@ internal abstract class BaseCaptureStrategy( screenAtStart: String? = this.screenAtStart, breadcrumbs: List? = null, events: Deque = this.currentEvents, - ): ReplaySegment = - createSegment( + ): ReplaySegment { + val traceIds = + synchronized(traceIdsLock) { + val ids = currentTraceIds.toList() + currentTraceIds.clear() + ids + } + return createSegment( scopes, options, duration, @@ -152,7 +162,9 @@ internal abstract class BaseCaptureStrategy( screenAtStart, breadcrumbs, events, + traceIds, ) + } override fun onConfigurationChanged(recorderConfig: ScreenshotRecorderConfig) { this.recorderConfig = recorderConfig @@ -167,6 +179,19 @@ internal abstract class BaseCaptureStrategy( } } + override fun registerTraceId(traceId: SentryId) { + if (traceId != SentryId.EMPTY_ID) { + synchronized(traceIdsLock) { + if (currentTraceIds.size < MAX_TRACE_IDS) { + val id = traceId.toString() + if (!currentTraceIds.contains(id)) { + currentTraceIds.add(id) + } + } + } + } + } + private class ReplayPersistingExecutorServiceThreadFactory : ThreadFactory { private var cnt = 0 diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt index 8e078161c15..6dc391a15ec 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt @@ -53,6 +53,8 @@ internal interface CaptureStrategy { fun convert(): CaptureStrategy + fun registerTraceId(traceId: SentryId) + companion object { private fun Breadcrumb?.isNetworkAvailable(): Boolean = this != null && @@ -84,6 +86,7 @@ internal interface CaptureStrategy { screenAtStart: String?, breadcrumbs: List?, events: Deque, + traceIds: List = emptyList(), ): ReplaySegment { val generatedVideo = cache?.createVideoOf( @@ -122,6 +125,7 @@ internal interface CaptureStrategy { screenAtStart, replayBreadcrumbs, events, + traceIds, ) } @@ -141,6 +145,7 @@ internal interface CaptureStrategy { screenAtStart: String?, breadcrumbs: List, events: Deque, + traceIds: List, ): ReplaySegment { val endTimestamp = DateUtils.getDateTime(segmentTimestamp.time + videoDuration) val replay = @@ -152,6 +157,7 @@ internal interface CaptureStrategy { this.replayStartTimestamp = segmentTimestamp this.replayType = replayType this.videoFile = video + this.traceIds = traceIds } val recordingPayload = mutableListOf() diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt index 4183fad10ed..3df0c9f005f 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt @@ -1072,6 +1072,38 @@ class ReplayIntegrationTest { verify(fixture.replayCache).addFrame(any(), any(), anyOrNull()) } + @Test + fun `registerTraceId does nothing when replay is not started`() { + val replay = fixture.getSut(context) + + replay.register(fixture.scopes, fixture.options) + // Don't call start() + + // Should not throw + replay.registerTraceId(SentryId()) + } + + @Test + fun `registerTraceId forwards to capture strategy when recording`() { + var traceIdRegistered: SentryId? = null + val captureStrategy = + mock { + on { currentReplayId }.thenReturn(SentryId()) + doAnswer { traceIdRegistered = it.arguments[0] as SentryId } + .whenever(mock) + .registerTraceId(any()) + } + val replay = fixture.getSut(context, replayCaptureStrategyProvider = { captureStrategy }) + + replay.register(fixture.scopes, fixture.options) + replay.start() + + val traceId = SentryId() + replay.registerTraceId(traceId) + + assertEquals(traceId, traceIdRegistered) + } + private fun getSessionCaptureStrategy(options: SentryOptions): SessionCaptureStrategy = SessionCaptureStrategy( options, diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt index 9982c6623b2..b5a00bc624b 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt @@ -475,4 +475,83 @@ class SessionCaptureStrategyTest { }, ) } + + @Test + fun `registerTraceId includes trace IDs in next segment`() { + val now = + System.currentTimeMillis() + (fixture.options.sessionReplay.sessionSegmentDuration * 5) + val strategy = fixture.getSut(dateProvider = { now }) + strategy.start() + strategy.onConfigurationChanged(fixture.recorderConfig) + + val traceId1 = SentryId() + val traceId2 = SentryId() + strategy.registerTraceId(traceId1) + strategy.registerTraceId(traceId2) + + strategy.onScreenshotRecorded(mock()) {} + + verify(fixture.scopes) + .captureReplay( + argThat { event -> + event is SentryReplayEvent && + event.traceIds?.size == 2 && + event.traceIds!!.contains(traceId1.toString()) && + event.traceIds!!.contains(traceId2.toString()) + }, + any(), + ) + } + + @Test + fun `registerTraceId clears trace IDs after segment is created`() { + val now = + System.currentTimeMillis() + (fixture.options.sessionReplay.sessionSegmentDuration * 5) + val strategy = fixture.getSut(dateProvider = { now }) + strategy.start() + strategy.onConfigurationChanged(fixture.recorderConfig) + + val traceId = SentryId() + strategy.registerTraceId(traceId) + + strategy.onScreenshotRecorded(mock()) {} + + verify(fixture.scopes) + .captureReplay( + argThat { event -> + event is SentryReplayEvent && event.traceIds?.contains(traceId.toString()) == true + }, + any(), + ) + + // trigger another segment, trace IDs should be cleared + strategy.onScreenshotRecorded(mock()) {} + + verify(fixture.scopes) + .captureReplay( + argThat { event -> + event is SentryReplayEvent && event.segmentId == 1 && event.traceIds.isNullOrEmpty() + }, + any(), + ) + } + + @Test + fun `registerTraceId ignores empty trace ID`() { + val now = + System.currentTimeMillis() + (fixture.options.sessionReplay.sessionSegmentDuration * 5) + val strategy = fixture.getSut(dateProvider = { now }) + strategy.start() + strategy.onConfigurationChanged(fixture.recorderConfig) + + strategy.registerTraceId(SentryId.EMPTY_ID) + + strategy.onScreenshotRecorded(mock()) {} + + verify(fixture.scopes) + .captureReplay( + argThat { event -> event is SentryReplayEvent && event.traceIds.isNullOrEmpty() }, + any(), + ) + } } diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index cb03d8fe708..4757be4894a 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -1703,6 +1703,7 @@ public final class io/sentry/NoOpReplayController : io/sentry/ReplayController { public fun isDebugMaskingOverlayEnabled ()Z public fun isRecording ()Z public fun pause ()V + public fun registerTraceId (Lio/sentry/protocol/SentryId;)V public fun resume ()V public fun setBreadcrumbConverter (Lio/sentry/ReplayBreadcrumbConverter;)V public fun start ()V @@ -2344,6 +2345,7 @@ public abstract interface class io/sentry/ReplayController : io/sentry/IReplayAp public abstract fun isDebugMaskingOverlayEnabled ()Z public abstract fun isRecording ()Z public abstract fun pause ()V + public abstract fun registerTraceId (Lio/sentry/protocol/SentryId;)V public abstract fun resume ()V public abstract fun setBreadcrumbConverter (Lio/sentry/ReplayBreadcrumbConverter;)V public abstract fun start ()V diff --git a/sentry/src/main/java/io/sentry/NoOpReplayController.java b/sentry/src/main/java/io/sentry/NoOpReplayController.java index fec95b5d66d..2f6de9740d2 100644 --- a/sentry/src/main/java/io/sentry/NoOpReplayController.java +++ b/sentry/src/main/java/io/sentry/NoOpReplayController.java @@ -57,4 +57,7 @@ public void enableDebugMaskingOverlay() {} @Override public void disableDebugMaskingOverlay() {} + + @Override + public void registerTraceId(@NotNull SentryId traceId) {} } diff --git a/sentry/src/main/java/io/sentry/ReplayController.java b/sentry/src/main/java/io/sentry/ReplayController.java index dd40bfc9732..f4baba40c9d 100644 --- a/sentry/src/main/java/io/sentry/ReplayController.java +++ b/sentry/src/main/java/io/sentry/ReplayController.java @@ -28,4 +28,12 @@ public interface ReplayController extends IReplayApi { ReplayBreadcrumbConverter getBreadcrumbConverter(); boolean isDebugMaskingOverlayEnabled(); + + /** + * Registers a trace ID to be associated with the current replay. This is called when a + * transaction is captured while replay is recording, to enable searching for replays by trace ID. + * + * @param traceId the trace ID to associate with the current replay + */ + void registerTraceId(@NotNull SentryId traceId); } diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 6f328d0fd58..5ac81c44936 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -1043,6 +1043,13 @@ public void captureSession(final @NotNull Session session, final @Nullable Hint sentryId = SentryId.EMPTY_ID; } + if (!sentryId.equals(SentryId.EMPTY_ID)) { + final @Nullable SpanContext trace = transaction.getContexts().getTrace(); + if (trace != null) { + options.getReplayController().registerTraceId(trace.getTraceId()); + } + } + return sentryId; } diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index 663b1f9bdee..d5b2f0f82a0 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -1958,6 +1958,23 @@ class SentryClientTest { assertEquals("abc", transaction.platform) } + @Test + fun `captureTransaction registers trace ID with replay controller`() { + var registeredTraceId: SentryId? = null + fixture.sentryOptions.setReplayController( + object : ReplayController by NoOpReplayController.getInstance() { + override fun registerTraceId(traceId: SentryId) { + registeredTraceId = traceId + } + } + ) + val sut = fixture.getSut() + val sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) + val transaction = SentryTransaction(sentryTracer) + sut.captureTransaction(transaction, sentryTracer.traceContext()) + assertEquals(sentryTracer.spanContext.traceId, registeredTraceId) + } + @Test fun `when exception type is ignored, capturing event does not send it`() { fixture.sentryOptions.addIgnoredExceptionForType(IllegalStateException::class.java) From b0aa73ebff17166a1a13d27e88b2dcdc13adf68c Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 2 Jun 2026 23:43:24 +0200 Subject: [PATCH 179/391] fix(replay): Keep replay recording during animations (#5489) * fix(android): Keep replay capturing during animations Skip only the first unstable PixelCopy capture, then continue emitting frames while the screen keeps invalidating. This prevents animated screens from freezing Session Replay visuals while preserving the existing debounce for one-off redraws. Fixes GH-5404 Co-Authored-By: Codex * test(android): Add replay animation sample screens Add separate Android sample screens for Lottie, Compose canvas, and classic View animations so replay capture behavior can be tested manually. Keep the sample app on the Canvas replay screenshot strategy while exercising these animations. Refs GH-5404 Co-Authored-By: Codex * changelog * fix(android): Make replay animation sample colors API-safe Use ContextCompat.getColor in ReplayAnimationsActivity so release lint passes with the sample app minSdk. Refs GH-5489 Co-Authored-By: Codex * docs(android): Explain unstable replay captures Document why PixelCopyStrategy caps skipped unstable captures so continuous animations keep producing replay frames. Refs GH-5489 Co-Authored-By: Codex --------- Co-authored-by: Codex --- CHANGELOG.md | 1 + gradle/libs.versions.toml | 2 +- .../replay/screenshot/PixelCopyStrategy.kt | 63 +++- .../screenshot/PixelCopyStrategyTest.kt | 114 +++++++ .../sentry-samples-android/build.gradle.kts | 1 + .../src/main/AndroidManifest.xml | 4 + .../io/sentry/samples/android/MainActivity.kt | 12 + .../android/ReplayAnimationsActivity.kt | 302 ++++++++++++++++++ .../src/main/res/raw/replay_lottie_pulse.json | 181 +++++++++++ 9 files changed, 669 insertions(+), 11 deletions(-) create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/res/raw/replay_lottie_pulse.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bbbede5794..71bf01b7bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Session Replay: Fix replay recording freezing on screens with continuous animations ([#5489](https://github.com/getsentry/sentry-java/pull/5489)) - Session Replay: Populate `trace_ids` in replay events to enable searching replays by trace ID ([#5473](https://github.com/getsentry/sentry-java/pull/5473)) ## 8.43.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 12e24536d7e..7ee39d75ede 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -126,6 +126,7 @@ launchdarkly-server = { module = "com.launchdarkly:launchdarkly-java-server-sdk" log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j2" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j2" } leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.14" } +lottie-compose = { module = "com.airbnb.android:lottie-compose", version = "6.7.1" } logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } nopen-annotations = { module = "com.jakewharton.nopen:nopen-annotations", version.ref = "nopen" } nopen-checker = { module = "com.jakewharton.nopen:nopen-checker", version.ref = "nopen" } @@ -248,4 +249,3 @@ msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } okio = { module = "com.squareup.okio:okio", version = "1.13.0" } roboelectric = { module = "org.robolectric:robolectric", version = "4.15" } - diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt index 81dd7c5cee5..4b9618df6ec 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt @@ -40,6 +40,14 @@ internal class PixelCopyStrategy( private val markContentChanged: () -> Unit = {}, ) : ScreenshotStrategy { + private companion object { + /** + * An unstable capture means the view hierarchy changed while PixelCopy was in flight. Cap + * skipped unstable captures so continuous animations don't stop replay recording. + */ + const val MAX_UNSTABLE_CAPTURES_TO_SKIP = 1 + } + private val executor = executorProvider.getExecutor() private val mainLooperHandler = executorProvider.getMainLooperHandler() private val screenshot = @@ -49,6 +57,7 @@ internal class PixelCopyStrategy( private val lastCaptureSuccessful = AtomicBoolean(false) private val maskRenderer = MaskRenderer() private val contentChanged = AtomicBoolean(false) + private val unstableCaptures = AtomicInteger(0) private val isClosed = AtomicBoolean(false) private val dstOverPaint by lazy(NONE) { Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER) } } @@ -86,15 +95,13 @@ internal class PixelCopyStrategy( if (copyResult != PixelCopy.SUCCESS) { options.logger.log(INFO, "Failed to capture replay recording: %d", copyResult) + unstableCaptures.set(0) lastCaptureSuccessful.set(false) return@request } - // TODO: handle animations with heuristics (e.g. if we fall under this condition 2 times - // in a row, we should capture) - if (contentChanged.get()) { - options.logger.log(INFO, "Failed to determine view hierarchy, not capturing") - lastCaptureSuccessful.set(false) + val changedDuringCapture = contentChanged.get() + if (changedDuringCapture && shouldSkipUnstableCapture()) { return@request } @@ -111,25 +118,48 @@ internal class PixelCopyStrategy( if (surfaceViewNodes.isNullOrEmpty()) { executor.submit( ReplayRunnable("screenshot_recorder.mask") { - applyMaskingAndNotify(root, viewHierarchy) + applyMaskingAndNotify( + root, + viewHierarchy, + resetUnstableCaptures = !changedDuringCapture, + ) } ) } else { // Re-arm the recorder's contentChanged gate; SurfaceView redraws don't trigger // ViewTreeObserver.OnDrawListener, so we'd otherwise emit the same frame forever. markContentChanged() - captureSurfaceViews(root, surfaceViewNodes, viewHierarchy) + captureSurfaceViews( + root, + surfaceViewNodes, + viewHierarchy, + resetUnstableCaptures = !changedDuringCapture, + ) } }, mainLooperHandler.handler, ) } catch (e: Throwable) { options.logger.log(WARNING, "Failed to capture replay recording", e) + unstableCaptures.set(0) lastCaptureSuccessful.set(false) } } - private fun applyMaskingAndNotify(root: View, viewHierarchy: ViewHierarchyNode) { + private fun shouldSkipUnstableCapture(): Boolean { + if (unstableCaptures.incrementAndGet() <= MAX_UNSTABLE_CAPTURES_TO_SKIP) { + options.logger.log(INFO, "Failed to determine view hierarchy, not capturing") + lastCaptureSuccessful.set(false) + return true + } + return false + } + + private fun applyMaskingAndNotify( + root: View, + viewHierarchy: ViewHierarchyNode, + resetUnstableCaptures: Boolean, + ) { if (isClosed.get() || screenshot.isRecycled) { options.logger.log(DEBUG, "PixelCopyStrategy is closed, skipping masking") return @@ -149,6 +179,9 @@ internal class PixelCopyStrategy( screenshotRecorderCallback?.onScreenshotRecorded(screenshot) lastCaptureSuccessful.set(true) contentChanged.set(false) + if (resetUnstableCaptures) { + unstableCaptures.set(0) + } } @SuppressLint("NewApi") @@ -156,6 +189,7 @@ internal class PixelCopyStrategy( root: View, surfaceViewNodes: List, viewHierarchy: ViewHierarchyNode, + resetUnstableCaptures: Boolean, ) { // Snapshot the window location into locals so the executor-side compositor reads stable // values even if a new capture cycle starts and overwrites the field. @@ -168,7 +202,14 @@ internal class PixelCopyStrategy( fun onCaptureComplete() { if (remaining.decrementAndGet() == 0) { - compositeSurfaceViewsAndMask(root, captures, viewHierarchy, windowX, windowY) + compositeSurfaceViewsAndMask( + root, + captures, + viewHierarchy, + windowX, + windowY, + resetUnstableCaptures, + ) } } @@ -229,6 +270,7 @@ internal class PixelCopyStrategy( viewHierarchy: ViewHierarchyNode, windowX: Int, windowY: Int, + resetUnstableCaptures: Boolean, ) { executor.submit( ReplayRunnable("screenshot_recorder.composite") { @@ -258,7 +300,7 @@ internal class PixelCopyStrategy( capture.bitmap.recycle() } - applyMaskingAndNotify(root, viewHierarchy) + applyMaskingAndNotify(root, viewHierarchy, resetUnstableCaptures) } ) } @@ -287,6 +329,7 @@ internal class PixelCopyStrategy( override fun close() { isClosed.set(true) + unstableCaptures.set(0) executor.submit( ReplayRunnable( "PixelCopyStrategy.close", diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt index 277ad941a14..779cf7d4311 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt @@ -12,7 +12,10 @@ import android.graphics.RectF import android.os.Bundle import android.os.Handler import android.os.Looper +import android.view.PixelCopy import android.view.SurfaceView +import android.view.View +import android.view.Window import android.widget.FrameLayout import android.widget.LinearLayout import android.widget.LinearLayout.LayoutParams @@ -36,12 +39,16 @@ import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.doAnswer import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.times import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.robolectric.Robolectric.buildActivity import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.annotation.GraphicsMode +import org.robolectric.annotation.Implementation +import org.robolectric.annotation.Implements import org.robolectric.shadows.ShadowPixelCopy @Config(shadows = [ShadowPixelCopy::class], sdk = [30]) @@ -92,6 +99,7 @@ class PixelCopyStrategyTest { fun setup() { System.setProperty("robolectric.areWindowsMarkedVisible", "true") System.setProperty("robolectric.pixelCopyRenderMode", "hardware") + DeferredWindowPixelCopyShadow.reset() } @Test @@ -132,6 +140,68 @@ class PixelCopyStrategyTest { if (failure.get() != null) throw failure.get() } + @Test + @Config(shadows = [DeferredWindowPixelCopyShadow::class]) + fun `capture skips the first unstable PixelCopy result`() { + val activity = buildActivity(SimpleActivity::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + val root = activity.get().findViewById(android.R.id.content) + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + captureUnstableFrame(strategy, root) + + assertFalse(strategy.lastCaptureSuccessful()) + verify(fixture.callback, never()).onScreenshotRecorded(any()) + } + + @Test + @Config(shadows = [DeferredWindowPixelCopyShadow::class]) + fun `capture emits the second consecutive unstable PixelCopy result`() { + val activity = buildActivity(SimpleActivity::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + val root = activity.get().findViewById(android.R.id.content) + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + captureUnstableFrame(strategy, root) + captureUnstableFrame(strategy, root) + + assertTrue(strategy.lastCaptureSuccessful()) + verify(fixture.callback).onScreenshotRecorded(any()) + } + + @Test + @Config(shadows = [DeferredWindowPixelCopyShadow::class]) + fun `capture keeps emitting after entering continuous instability mode`() { + val activity = buildActivity(SimpleActivity::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + val root = activity.get().findViewById(android.R.id.content) + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + captureUnstableFrame(strategy, root) + captureUnstableFrame(strategy, root) + captureUnstableFrame(strategy, root) + + assertTrue(strategy.lastCaptureSuccessful()) + verify(fixture.callback, times(2)).onScreenshotRecorded(any()) + } + + @Test + @Config(shadows = [DeferredWindowPixelCopyShadow::class]) + fun `stable capture resets the unstable PixelCopy counter`() { + val activity = buildActivity(SimpleActivity::class.java).setup() + shadowOf(Looper.getMainLooper()).idle() + val root = activity.get().findViewById(android.R.id.content) + + val strategy = fixture.getSut(executor = fixture.inlineExecutor()) + captureUnstableFrame(strategy, root) + captureUnstableFrame(strategy, root) + captureStableFrame(strategy, root) + captureUnstableFrame(strategy, root) + + assertFalse(strategy.lastCaptureSuccessful()) + verify(fixture.callback, times(2)).onScreenshotRecorded(any()) + } + @Test fun `capture does not call markContentChanged when option is disabled`() { val activity = buildActivity(ActivityWithSurfaceView::class.java).setup() @@ -250,6 +320,50 @@ class PixelCopyStrategyTest { assertEquals(0, dest.getPixel(4, 4)) assertEquals(0, dest.getPixel(25, 25)) } + + private fun captureUnstableFrame(strategy: PixelCopyStrategy, root: View) { + strategy.capture(root) + strategy.onContentChanged() + DeferredWindowPixelCopyShadow.flush() + shadowOf(Looper.getMainLooper()).idle() + } + + private fun captureStableFrame(strategy: PixelCopyStrategy, root: View) { + strategy.capture(root) + DeferredWindowPixelCopyShadow.flush() + shadowOf(Looper.getMainLooper()).idle() + } +} + +@Implements(PixelCopy::class) +class DeferredWindowPixelCopyShadow { + companion object { + private val pendingCallbacks = mutableListOf<() -> Unit>() + + fun reset() { + pendingCallbacks.clear() + } + + fun flush() { + val callbacks = pendingCallbacks.toList() + pendingCallbacks.clear() + callbacks.forEach { it.invoke() } + } + + @JvmStatic + @Implementation + @Suppress("UNUSED_PARAMETER") + fun request( + _source: Window, + _dest: Bitmap, + listener: PixelCopy.OnPixelCopyFinishedListener, + listenerThread: Handler, + ) { + pendingCallbacks.add { + listenerThread.post { listener.onPixelCopyFinished(PixelCopy.SUCCESS) } + } + } + } } private class SimpleActivity : Activity() { diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index bb2c3954ca6..ed8cea25661 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -150,6 +150,7 @@ dependencies { implementation(libs.androidx.browser) implementation(libs.coil.compose) implementation(libs.kotlinx.coroutines.android) + implementation(libs.lottie.compose) implementation(libs.retrofit) implementation(libs.retrofit.gson) implementation(libs.sentry.native.ndk) diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 26f526124b4..e5b5ed2250b 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -64,6 +64,10 @@ android:name=".PermissionsActivity" android:exported="false" /> + + diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt index e000b54e4cc..86f1aace82e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt @@ -498,6 +498,18 @@ fun SessionReplayScreen() { } } } + item { + SentryTraced("open_replay_animations") { + OutlinedButton( + onClick = { + activity.startActivity(Intent(activity, ReplayAnimationsActivity::class.java)) + }, + modifier = Modifier, + ) { + Text("Open Animations", maxLines = 2, overflow = TextOverflow.Ellipsis) + } + } + } item { SentryTraced("show_dialog") { OutlinedButton(onClick = { showDialog = true }, modifier = Modifier) { diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt new file mode 100644 index 00000000000..0fe6cda581f --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt @@ -0,0 +1,302 @@ +package io.sentry.samples.android + +import android.animation.Animator +import android.animation.ObjectAnimator +import android.animation.ValueAnimator +import android.content.Context +import android.graphics.Color as AndroidColor +import android.graphics.drawable.GradientDrawable +import android.os.Bundle +import android.view.Gravity +import android.view.View +import android.view.animation.LinearInterpolator +import android.widget.FrameLayout +import androidx.activity.ComponentActivity +import androidx.activity.compose.BackHandler +import androidx.activity.compose.setContent +import androidx.compose.animation.core.LinearEasing +import androidx.compose.animation.core.RepeatMode +import androidx.compose.animation.core.animateFloat +import androidx.compose.animation.core.infiniteRepeatable +import androidx.compose.animation.core.rememberInfiniteTransition +import androidx.compose.animation.core.tween +import androidx.compose.foundation.Canvas +import androidx.compose.foundation.background +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Button +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.drawscope.Stroke +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView +import androidx.core.content.ContextCompat +import com.airbnb.lottie.compose.LottieAnimation +import com.airbnb.lottie.compose.LottieCompositionSpec +import com.airbnb.lottie.compose.LottieConstants +import com.airbnb.lottie.compose.animateLottieCompositionAsState +import com.airbnb.lottie.compose.rememberLottieComposition +import kotlin.math.PI +import kotlin.math.cos +import kotlin.math.min +import kotlin.math.roundToInt +import kotlin.math.sin + +class ReplayAnimationsActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + val primaryColor = Color(ContextCompat.getColor(this, R.color.colorPrimary)) + val accentColor = Color(ContextCompat.getColor(this, R.color.colorAccent)) + val colorScheme = + if (isSystemInDarkTheme()) + darkColorScheme(primary = primaryColor, secondary = accentColor, tertiary = primaryColor) + else + lightColorScheme(primary = primaryColor, secondary = accentColor, tertiary = primaryColor) + + MaterialTheme(colorScheme = colorScheme) { ReplayAnimationsScreen(onClose = { finish() }) } + } + } +} + +@Composable +private fun ReplayAnimationsScreen(onClose: () -> Unit) { + var selectedSample by remember { mutableStateOf(null) } + + BackHandler(enabled = selectedSample != null) { selectedSample = null } + + selectedSample?.let { sample -> + ReplayAnimationDetailScreen(sample = sample, onBack = { selectedSample = null }) + return + } + + Column( + modifier = + Modifier.fillMaxSize() + .verticalScroll(rememberScrollState()) + .padding(horizontal = 16.dp, vertical = 20.dp), + verticalArrangement = Arrangement.spacedBy(16.dp), + ) { + Button(onClick = onClose, modifier = Modifier.align(Alignment.End)) { Text("Close") } + Text( + text = "Replay animations", + style = MaterialTheme.typography.headlineSmall, + fontWeight = FontWeight.SemiBold, + ) + ReplayAnimationSample.entries.forEach { sample -> + Button(onClick = { selectedSample = sample }, modifier = Modifier.fillMaxWidth()) { + Text(sample.title) + } + } + } +} + +@Composable +private fun ReplayAnimationDetailScreen(sample: ReplayAnimationSample, onBack: () -> Unit) { + Column( + modifier = + Modifier.fillMaxSize() + .verticalScroll(rememberScrollState()) + .padding(horizontal = 16.dp, vertical = 20.dp), + verticalArrangement = Arrangement.spacedBy(16.dp), + ) { + Button(onClick = onBack, modifier = Modifier.align(Alignment.End)) { Text("Back") } + Text( + text = sample.title, + style = MaterialTheme.typography.headlineSmall, + fontWeight = FontWeight.SemiBold, + ) + Surface( + modifier = Modifier.fillMaxWidth().height(420.dp), + shape = RoundedCornerShape(8.dp), + tonalElevation = 2.dp, + color = MaterialTheme.colorScheme.surfaceVariant, + ) { + Box(modifier = Modifier.fillMaxSize().padding(16.dp), contentAlignment = Alignment.Center) { + when (sample) { + ReplayAnimationSample.LOTTIE -> LottieReplayAnimation() + ReplayAnimationSample.COMPOSE_CANVAS -> ComposeCanvasAnimation() + ReplayAnimationSample.ANDROID_VIEWS -> + AndroidView( + factory = { context -> ClassicAnimationLayout(context) }, + modifier = Modifier.fillMaxWidth().height(360.dp), + ) + } + } + } + } +} + +private enum class ReplayAnimationSample(val title: String) { + LOTTIE("Lottie"), + COMPOSE_CANVAS("Compose canvas"), + ANDROID_VIEWS("Android views"), +} + +@Composable +private fun LottieReplayAnimation() { + val composition by + rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.replay_lottie_pulse)) + val progress by + animateLottieCompositionAsState( + composition = composition, + iterations = LottieConstants.IterateForever, + ) + + LottieAnimation( + composition = composition, + progress = { progress }, + modifier = Modifier.fillMaxSize(), + ) +} + +@Composable +private fun ComposeCanvasAnimation() { + val transition = rememberInfiniteTransition() + val angle by + transition.animateFloat( + initialValue = 0f, + targetValue = 360f, + animationSpec = + infiniteRepeatable( + animation = tween(1600, easing = LinearEasing), + repeatMode = RepeatMode.Restart, + ), + ) + val pulse by + transition.animateFloat( + initialValue = 0.25f, + targetValue = 1f, + animationSpec = + infiniteRepeatable( + animation = tween(900, easing = LinearEasing), + repeatMode = RepeatMode.Reverse, + ), + ) + + Canvas( + modifier = + Modifier.fillMaxWidth().height(160.dp).background(Color(0xFF101820), RoundedCornerShape(8.dp)) + ) { + val center = Offset(size.width / 2f, size.height / 2f) + val orbitRadius = min(size.width, size.height) * 0.32f + val ballRadius = min(size.width, size.height) * 0.1f + val radians = angle / 180f * PI.toFloat() + + drawCircle( + color = Color(0xFF8BE9FD), + radius = orbitRadius * pulse, + center = center, + style = Stroke(width = 5.dp.toPx()), + alpha = 0.55f, + ) + drawCircle( + color = Color(0xFFFF6B6B), + radius = ballRadius, + center = Offset(center.x + cos(radians) * orbitRadius, center.y + sin(radians) * orbitRadius), + ) + drawCircle( + color = Color(0xFFFFD166), + radius = ballRadius * 0.75f, + center = + Offset( + center.x + cos(radians + PI.toFloat()) * orbitRadius, + center.y + sin(radians + PI.toFloat()) * orbitRadius, + ), + ) + } +} + +private class ClassicAnimationLayout(context: Context) : FrameLayout(context) { + private val movingDot = + View(context).apply { background = ovalDrawable(AndroidColor.rgb(255, 107, 107)) } + private val rotatingSquare = + View(context).apply { background = roundedRectDrawable(AndroidColor.rgb(139, 233, 253), dp(8)) } + private val scalingBar = + View(context).apply { background = roundedRectDrawable(AndroidColor.rgb(255, 209, 102), dp(6)) } + private val animators: List + + init { + setBackgroundColor(AndroidColor.rgb(16, 24, 32)) + clipChildren = false + clipToPadding = false + + addView(scalingBar, LayoutParams(dp(180), dp(18), Gravity.CENTER).apply { topMargin = dp(116) }) + addView(rotatingSquare, LayoutParams(dp(64), dp(64), Gravity.CENTER)) + addView(movingDot, LayoutParams(dp(48), dp(48), Gravity.CENTER)) + + animators = + listOf( + ObjectAnimator.ofFloat(movingDot, View.TRANSLATION_X, -dp(92).toFloat(), dp(92).toFloat()) + .repeatable(durationMillis = 900, mode = ValueAnimator.REVERSE), + ObjectAnimator.ofFloat(movingDot, View.TRANSLATION_Y, -dp(28).toFloat(), dp(28).toFloat()) + .repeatable(durationMillis = 650, mode = ValueAnimator.REVERSE), + ObjectAnimator.ofFloat(rotatingSquare, View.ROTATION, 0f, 360f) + .repeatable(durationMillis = 1200), + ObjectAnimator.ofFloat(scalingBar, View.SCALE_X, 0.25f, 1f) + .repeatable(durationMillis = 800, mode = ValueAnimator.REVERSE), + ) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + animators.forEach { animator -> + if (!animator.isStarted) { + animator.start() + } + } + } + + override fun onDetachedFromWindow() { + animators.forEach { it.cancel() } + super.onDetachedFromWindow() + } + + private fun ObjectAnimator.repeatable( + durationMillis: Long, + mode: Int = ValueAnimator.RESTART, + ): ObjectAnimator = apply { + duration = durationMillis + interpolator = LinearInterpolator() + repeatCount = ValueAnimator.INFINITE + repeatMode = mode + } + + private fun dp(value: Int): Int = (value * resources.displayMetrics.density).roundToInt() + + private fun ovalDrawable(color: Int): GradientDrawable = + GradientDrawable().apply { + shape = GradientDrawable.OVAL + setColor(color) + } + + private fun roundedRectDrawable(color: Int, radius: Int): GradientDrawable = + GradientDrawable().apply { + shape = GradientDrawable.RECTANGLE + cornerRadius = radius.toFloat() + setColor(color) + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/res/raw/replay_lottie_pulse.json b/sentry-samples/sentry-samples-android/src/main/res/raw/replay_lottie_pulse.json new file mode 100644 index 00000000000..e09afc9c5e5 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/res/raw/replay_lottie_pulse.json @@ -0,0 +1,181 @@ +{ + "v": "5.7.4", + "fr": 60, + "ip": 0, + "op": 120, + "w": 256, + "h": 256, + "nm": "Replay pulse", + "ddd": 0, + "assets": [], + "layers": [ + { + "ddd": 0, + "ind": 1, + "ty": 4, + "nm": "Rotating ring", + "sr": 1, + "ks": { + "o": { "a": 0, "k": 100 }, + "r": { + "a": 1, + "k": [ + { + "t": 0, + "s": [0], + "e": [360], + "i": { "x": [0.667], "y": [1] }, + "o": { "x": [0.333], "y": [0] } + }, + { "t": 120, "s": [360] } + ] + }, + "p": { "a": 0, "k": [128, 128, 0] }, + "a": { "a": 0, "k": [0, 0, 0] }, + "s": { "a": 0, "k": [100, 100, 100] } + }, + "ao": 0, + "shapes": [ + { + "ty": "gr", + "it": [ + { + "ty": "el", + "p": { "a": 0, "k": [0, 0] }, + "s": { "a": 0, "k": [132, 132] }, + "nm": "Ring path" + }, + { + "ty": "tm", + "s": { "a": 0, "k": 18 }, + "e": { "a": 0, "k": 86 }, + "o": { "a": 0, "k": 0 }, + "m": 1, + "nm": "Trim ring" + }, + { + "ty": "st", + "c": { "a": 0, "k": [0.545, 0.914, 0.992, 1] }, + "o": { "a": 0, "k": 100 }, + "w": { "a": 0, "k": 16 }, + "lc": 2, + "lj": 2, + "nm": "Ring stroke" + }, + { + "ty": "tr", + "p": { "a": 0, "k": [0, 0] }, + "a": { "a": 0, "k": [0, 0] }, + "s": { "a": 0, "k": [100, 100] }, + "r": { "a": 0, "k": 0 }, + "o": { "a": 0, "k": 100 }, + "sk": { "a": 0, "k": 0 }, + "sa": { "a": 0, "k": 0 }, + "nm": "Ring transform" + } + ], + "nm": "Ring", + "np": 4, + "cix": 2, + "bm": 0 + } + ], + "ip": 0, + "op": 120, + "st": 0, + "bm": 0 + }, + { + "ddd": 0, + "ind": 2, + "ty": 4, + "nm": "Pulse", + "sr": 1, + "ks": { + "o": { + "a": 1, + "k": [ + { + "t": 0, + "s": [35], + "e": [95], + "i": { "x": [0.667], "y": [1] }, + "o": { "x": [0.333], "y": [0] } + }, + { + "t": 60, + "s": [95], + "e": [35], + "i": { "x": [0.667], "y": [1] }, + "o": { "x": [0.333], "y": [0] } + }, + { "t": 120, "s": [35] } + ] + }, + "r": { "a": 0, "k": 0 }, + "p": { "a": 0, "k": [128, 128, 0] }, + "a": { "a": 0, "k": [0, 0, 0] }, + "s": { + "a": 1, + "k": [ + { + "t": 0, + "s": [70, 70, 100], + "e": [115, 115, 100], + "i": { "x": [0.667], "y": [1] }, + "o": { "x": [0.333], "y": [0] } + }, + { + "t": 60, + "s": [115, 115, 100], + "e": [70, 70, 100], + "i": { "x": [0.667], "y": [1] }, + "o": { "x": [0.333], "y": [0] } + }, + { "t": 120, "s": [70, 70, 100] } + ] + } + }, + "ao": 0, + "shapes": [ + { + "ty": "gr", + "it": [ + { + "ty": "el", + "p": { "a": 0, "k": [0, 0] }, + "s": { "a": 0, "k": [96, 96] }, + "nm": "Pulse path" + }, + { + "ty": "fl", + "c": { "a": 0, "k": [1, 0.82, 0.4, 1] }, + "o": { "a": 0, "k": 100 }, + "r": 1, + "nm": "Pulse fill" + }, + { + "ty": "tr", + "p": { "a": 0, "k": [0, 0] }, + "a": { "a": 0, "k": [0, 0] }, + "s": { "a": 0, "k": [100, 100] }, + "r": { "a": 0, "k": 0 }, + "o": { "a": 0, "k": 100 }, + "sk": { "a": 0, "k": 0 }, + "sa": { "a": 0, "k": 0 }, + "nm": "Pulse transform" + } + ], + "nm": "Pulse", + "np": 3, + "cix": 2, + "bm": 0 + } + ], + "ip": 0, + "op": 120, + "st": 0, + "bm": 0 + } + ] +} From caa40f2853580011b123daf1c4485914716519b2 Mon Sep 17 00:00:00 2001 From: romtsn <4999776+romtsn@users.noreply.github.com> Date: Wed, 3 Jun 2026 20:48:54 +0000 Subject: [PATCH 180/391] release: 8.43.1 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71bf01b7bf0..d6a3b55b403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.43.1 ### Fixes diff --git a/gradle.properties b/gradle.properties index 9739db8a573..eee4b292bff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.43.0 +versionName=8.43.1 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From d128fe99a5714c92b776f221d8e2778c9cf562a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:40:47 +0200 Subject: [PATCH 181/391] chore(deps): bump the github-actions group across 1 directory with 7 updates (#5494) Bumps the github-actions group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `6.0.2` | `6.0.3` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `6.0.0` | `6.0.1` | | [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) | `2.26.3` | `2.26.6` | | [github/codeql-action](https://github.com/github/codeql-action) | `4.35.4` | `4.36.1` | | [getsentry/github-workflows](https://github.com/getsentry/github-workflows) | `3.3.0` | `3.4.0` | | [actions/create-github-app-token](https://github.com/actions/create-github-app-token) | `3.1.1` | `3.2.0` | | [getsentry/craft](https://github.com/getsentry/craft) | `2.26.3` | `2.26.6` | Updates `actions/checkout` from 6.0.2 to 6.0.3 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...df4cb1c069e1874edd31b4311f1884172cec0e10) Updates `codecov/codecov-action` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/57e3a136b779b570ffcdbf80b3bdc90e7fab3de2...e79a6962e0d4c0c17b229090214935d2e33f8354) Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.3 to 2.26.6 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/bae212ca7aec50bb716eafd387c80bcfb28da937...3e6a0f477702864bb5854384b390a0db3325428e) Updates `github/codeql-action` from 4.35.4 to 4.36.1 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/68bde559dea0fdcac2102bfdf6230c5f70eb485e...87557b9c84dde89fdd9b10e88954ac2f4248e463) Updates `getsentry/github-workflows` from 3.3.0 to 3.4.0 - [Release notes](https://github.com/getsentry/github-workflows/releases) - [Commits](https://github.com/getsentry/github-workflows/compare/3.3.0...3.4.0) Updates `actions/create-github-app-token` from 3.1.1 to 3.2.0 - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/create-github-app-token/compare/1b10c78c7865c340bc4f6099eb2f838309f1e8c3...bcd2ba49218906704ab6c1aa796996da409d3eb1) Updates `getsentry/craft` from 2.26.3 to 2.26.6 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/bae212ca7aec50bb716eafd387c80bcfb28da937...3e6a0f477702864bb5854384b390a0db3325428e) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: codecov/codecov-action dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action dependency-version: 4.36.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: getsentry/github-workflows dependency-version: 3.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: actions/create-github-app-token dependency-version: 3.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: getsentry/craft dependency-version: 2.26.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 4 ++-- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/changes-in-high-risk-code.yml | 2 +- .github/workflows/check-tombstone-proto-schema.yml | 2 +- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/danger.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/generate-javadocs.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 4 ++-- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release-build.yml | 2 +- .github/workflows/release.yml | 6 +++--- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- .github/workflows/update-deps.yml | 2 +- .github/workflows/validate-pr.yml | 2 +- 22 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index f3ad7240438..aebcbf87d5e 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6817ce53337..2d9e2a3ba38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} submodules: 'recursive' @@ -58,7 +58,7 @@ jobs: SENTRY_PROJECT: sentry-android - name: Upload coverage to Codecov - uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@v4 + uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # pin@v4 with: name: sentry-java fail_ci_if_error: false diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index 4d5a78a4114..23daafa1a05 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@bae212ca7aec50bb716eafd387c80bcfb28da937 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@3e6a0f477702864bb5854384b390a0db3325428e # v2 secrets: inherit diff --git a/.github/workflows/changes-in-high-risk-code.yml b/.github/workflows/changes-in-high-risk-code.yml index 4ecc23619a4..028b4217ef2 100644 --- a/.github/workflows/changes-in-high-risk-code.yml +++ b/.github/workflows/changes-in-high-risk-code.yml @@ -16,7 +16,7 @@ jobs: high_risk_code: ${{ steps.changes.outputs.high_risk_code }} high_risk_code_files: ${{ steps.changes.outputs.high_risk_code_files }} steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Get changed files id: changes uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 diff --git a/.github/workflows/check-tombstone-proto-schema.yml b/.github/workflows/check-tombstone-proto-schema.yml index f4dd5f2f957..535b2170fae 100644 --- a/.github/workflows/check-tombstone-proto-schema.yml +++ b/.github/workflows/check-tombstone-proto-schema.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Check for newer Tombstone proto schema run: ./scripts/check-tombstone-proto-schema.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 34bf6241fd6..1276f2bd715 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v2 + uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v2 + uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463 # pin@v2 diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 77fe824701a..e40b4563b00 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -8,4 +8,4 @@ jobs: danger: runs-on: ubuntu-latest steps: - - uses: getsentry/github-workflows/danger@26f565c05d0dd49f703d238706b775883037d76b # v3 + - uses: getsentry/github-workflows/danger@607fed74f812e69201531a5185b6c3c57caa4e89 # v3 diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 23dd0134203..01ee3db1584 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -20,7 +20,7 @@ jobs: java-version: '17' - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 # TODO: remove this when upstream is fixed - name: Disable Gradle configuration cache (see https://github.com/fossas/fossa-cli/issues/872) diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 4109c2a2947..28cb78df4e3 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index 090a6360745..af0b44ddadd 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index bbe8c709587..65cfcf242fc 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' @@ -77,7 +77,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 6d0aefab386..19598699165 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Setup Java Version uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 85731127f36..8973148cadd 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Set up Java 17 uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 @@ -77,7 +77,7 @@ jobs: arch: x86_64 steps: - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Enable KVM run: | diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index fbb8018da06..4af564cd2c3 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 3fb0b162750..16cfe4531a0 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8464e8d0399..88cac7c6754 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,18 +23,18 @@ jobs: steps: - name: Get auth token id: token - uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 with: app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: token: ${{ steps.token.outputs.token }} # Needs to be set, otherwise git describe --tags will fail with: No names found, cannot describe anything fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@bae212ca7aec50bb716eafd387c80bcfb28da937 # v2 + uses: getsentry/craft@3e6a0f477702864bb5854384b390a0db3325428e # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 91154a2c7b3..bbcb3cfc0bc 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index f0b3fbe279b..781d8a876f9 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 68bdd38f2ec..bc1b1686692 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index fc66f6744b5..b1884cd4a7a 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -98,7 +98,7 @@ jobs: agent: "false" agent-auto-init: "true" steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: submodules: 'recursive' diff --git a/.github/workflows/update-deps.yml b/.github/workflows/update-deps.yml index bfcf9ccfa85..5b8d3d11628 100644 --- a/.github/workflows/update-deps.yml +++ b/.github/workflows/update-deps.yml @@ -18,7 +18,7 @@ jobs: native: runs-on: ubuntu-latest steps: - - uses: getsentry/github-workflows/updater@26f565c05d0dd49f703d238706b775883037d76b # v3 + - uses: getsentry/github-workflows/updater@607fed74f812e69201531a5185b6c3c57caa4e89 # v3 with: path: scripts/update-sentry-native-ndk.sh name: Native SDK diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 10fe894067a..313a4611145 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: getsentry/github-workflows/validate-pr@71588ddf95134f804e82c5970a8098588e2eaecd + - uses: getsentry/github-workflows/validate-pr@26f565c05d0dd49f703d238706b775883037d76b with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} From 65aff4f61d87bda0ca21a6093854008c39377946 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 4 Jun 2026 16:44:03 +0200 Subject: [PATCH 182/391] ci: Update getsentry/github-workflows to 3.4.0 for validate-pr (#5496) The validate-pr action was pinned to 3.3.0 while the other workflows in this repo already use 3.4.0. Pin it to the same SHA and add the matching version comment. Co-authored-by: Claude Opus 4.8 (1M context) --- .github/workflows/validate-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 313a4611145..ca5108943de 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -10,7 +10,7 @@ jobs: permissions: pull-requests: write steps: - - uses: getsentry/github-workflows/validate-pr@26f565c05d0dd49f703d238706b775883037d76b + - uses: getsentry/github-workflows/validate-pr@607fed74f812e69201531a5185b6c3c57caa4e89 # v3 with: app-id: ${{ vars.SDK_MAINTAINER_BOT_APP_ID }} private-key: ${{ secrets.SDK_MAINTAINER_BOT_PRIVATE_KEY }} From b93642593067222cc2b5a8ab4f9a63a38cde8ae3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 10:04:18 +0200 Subject: [PATCH 183/391] chore(deps): bump the github-actions group with 3 updates (#5498) Bumps the github-actions group with 3 updates: [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft), [github/codeql-action](https://github.com/github/codeql-action) and [getsentry/craft](https://github.com/getsentry/craft). Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.6 to 2.26.8 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/3e6a0f477702864bb5854384b390a0db3325428e...4468eb9e399655a61c770534dacc03139d98aa18) Updates `github/codeql-action` from 4.36.1 to 4.36.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/87557b9c84dde89fdd9b10e88954ac2f4248e463...8aad20d150bbac5944a9f9d289da16a4b0d87c1e) Updates `getsentry/craft` from 2.26.6 to 2.26.8 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/3e6a0f477702864bb5854384b390a0db3325428e...4468eb9e399655a61c770534dacc03139d98aa18) --- updated-dependencies: - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: github/codeql-action dependency-version: 4.36.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft dependency-version: 2.26.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/release.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index 23daafa1a05..612cc5b52f3 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@3e6a0f477702864bb5854384b390a0db3325428e # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@4468eb9e399655a61c770534dacc03139d98aa18 # v2 secrets: inherit diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1276f2bd715..6aa197d6625 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: Initialize CodeQL - uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # pin@v2 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # pin@v2 with: languages: 'java' @@ -45,4 +45,4 @@ jobs: ./gradlew buildForCodeQL --no-build-cache - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@87557b9c84dde89fdd9b10e88954ac2f4248e463 # pin@v2 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # pin@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88cac7c6754..a6964cec4ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@3e6a0f477702864bb5854384b390a0db3325428e # v2 + uses: getsentry/craft@4468eb9e399655a61c770534dacc03139d98aa18 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From abcd8895429bce96de12618799bf303bb34d2312 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 8 Jun 2026 17:37:59 +0200 Subject: [PATCH 184/391] fix(replay): Fix Compose masking on obfuscated/minified builds (#5503) * try to run replay tests on gh emulators * Format code * feat(replay): fail fast on swallowed Compose masking errors in CI Add an internal SentryReplayDebug.failFast switch (gated on the io.sentry.replay.compose.fail-fast system property) that re-throws the exceptions ComposeViewHierarchyNode normally swallows in fromComposeNode and fromView. Enabled in the sentry-samples-android app and the on-device ReplayTest/ReplaySnapshotTest so our release/obfuscated builds running on real devices in CI crash instead of silently degrading masking. Defaults off, so customers are unaffected. Also add consumer proguard keep rules for the LayoutNode internals (getChildren/getOuterCoordinator/getCollapsedSemantics) that are looked up via reflection on Compose < 1.10, so R8 doesn't strip or rename them. Also guard the on-device tests against GitHub-hosted emulators, which can't capture screenshots reliably. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Sentry Github Bot Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 6 +++++ .../io/sentry/uitest/android/ReplayTest.kt | 3 +++ .../uitest/android/ReplaySnapshotTest.kt | 3 +++ sentry-android-replay/proguard-rules.pro | 6 +++++ .../android/replay/util/SentryReplayDebug.kt | 26 +++++++++++++++++++ .../viewhierarchy/ComposeViewHierarchyNode.kt | 12 +++++++++ .../sentry/samples/android/MyApplication.java | 5 ++++ 7 files changed, 61 insertions(+) create mode 100644 sentry-android-replay/src/main/java/io/sentry/android/replay/util/SentryReplayDebug.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index d6a3b55b403..06c0b8bab55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Session Replay: Fix Compose view masking not working on obfuscated/minified builds ([#5503](https://github.com/getsentry/sentry-java/pull/5503)) + ## 8.43.1 ### Fixes diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt index 5ea12ddbbc8..3827561e37c 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt @@ -21,6 +21,9 @@ class ReplayTest : BaseUiTest() { // we can't run on GH actions emulator, because they don't allow capturing screenshots properly @Suppress("KotlinConstantConditions") assumeThat(BuildConfig.ENVIRONMENT != "github", `is`(true)) + // crash on swallowed Compose masking errors (e.g. broken obfuscated internals) so regressions + // fail this on-device test instead of silently under-masking (see SentryReplayDebug) + System.setProperty("io.sentry.replay.compose.fail-fast", "true") } @Test diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt index 1d82a3f8bc0..6d45b2d1f9c 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTestReplay/java/io/sentry/uitest/android/ReplaySnapshotTest.kt @@ -23,6 +23,9 @@ class ReplaySnapshotTest : BaseUiTest() { // GH Actions emulators don't support capturing screenshots for replay @Suppress("KotlinConstantConditions") assumeThat(BuildConfig.ENVIRONMENT != "github", `is`(true)) + // crash on swallowed Compose masking errors (e.g. broken obfuscated internals) so regressions + // fail this on-device test instead of silently under-masking (see SentryReplayDebug) + System.setProperty("io.sentry.replay.compose.fail-fast", "true") } @Test diff --git a/sentry-android-replay/proguard-rules.pro b/sentry-android-replay/proguard-rules.pro index 42e3cb30a42..6ce45c1ef5d 100644 --- a/sentry-android-replay/proguard-rules.pro +++ b/sentry-android-replay/proguard-rules.pro @@ -29,3 +29,9 @@ # Rules to detect a PreviewView view to later mask it -dontwarn androidx.camera.view.PreviewView -keepnames class androidx.camera.view.PreviewView +# Rules to walk the Compose Node tree. +-keep class androidx.compose.ui.node.LayoutNode { + *** getChildren*(...); + *** getOuterCoordinator*(...); + *** getCollapsedSemantics*(...); +} \ No newline at end of file diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/SentryReplayDebug.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/SentryReplayDebug.kt new file mode 100644 index 00000000000..966428f84c2 --- /dev/null +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/SentryReplayDebug.kt @@ -0,0 +1,26 @@ +package io.sentry.android.replay.util + +/** + * Internal, undocumented escape hatch used to make Session Replay fail fast instead of silently + * degrading masking when an exception is swallowed (e.g. unsupported/obfuscated Compose internals). + * + * It is intended to be enabled only in our own sample/UI-test apps that run on real devices in CI + * (which are release/obfuscated builds, so [io.sentry.android.replay.BuildConfig.DEBUG] can't be + * used), so that regressions surface as crashes rather than under-masked replays. Customers should + * never set this. + * + * Enable via: + * ``` + * System.setProperty("io.sentry.replay.compose.fail-fast", "true") + * ``` + */ +internal object SentryReplayDebug { + private const val FAIL_FAST_PROPERTY = "io.sentry.replay.compose.fail-fast" + + /** + * Read live (not cached) so it's only evaluated on the error path and unit tests can toggle it + * between cases. + */ + val failFast: Boolean + get() = "true".equals(System.getProperty(FAIL_FAST_PROPERTY), ignoreCase = true) +} diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index a0312b69cd0..2b6bc3fc08e 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -22,6 +22,7 @@ import io.sentry.SentryLevel import io.sentry.SentryMaskingOptions import io.sentry.android.replay.SentryReplayModifiers import io.sentry.android.replay.util.ComposeTextLayout +import io.sentry.android.replay.util.SentryReplayDebug import io.sentry.android.replay.util.boundsInWindow import io.sentry.android.replay.util.findPainter import io.sentry.android.replay.util.findTextColor @@ -147,6 +148,12 @@ internal object ComposeViewHierarchyNode { ) } + // fail fast in our own sample/UI-test apps (see SentryReplayDebug), so regressions surface + // as crashes instead of silently degrading masking + if (SentryReplayDebug.failFast) { + throw t + } + // If we're unable to retrieve the semantics configuration // we should play safe and mask the whole node. return GenericViewHierarchyNode( @@ -291,6 +298,11 @@ internal object ComposeViewHierarchyNode { """ .trimIndent(), ) + // fail fast in our own sample/UI-test apps (see SentryReplayDebug), so regressions surface + // as crashes instead of silently skipping the whole Compose subtree (i.e. not masking it) + if (SentryReplayDebug.failFast) { + throw e + } return false } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java index 572c4cdba72..f074901f4f0 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java @@ -9,6 +9,11 @@ public class MyApplication extends Application { @Override public void onCreate() { + // Make Session Replay fail fast instead of silently degrading masking when an exception is + // swallowed (e.g. unsupported/obfuscated Compose internals). This way regressions surface as + // crashes in our release/obfuscated builds that run on real devices in CI. Only meant for our + // own sample/UI-test apps, customers should never set this. + System.setProperty("io.sentry.replay.compose.fail-fast", "true"); Sentry.startProfiler(); strictMode(); super.onCreate(); From 8c7718c4199deb7d801a643ba768d97f499ec156 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Mon, 8 Jun 2026 17:51:12 +0200 Subject: [PATCH 185/391] fix(replay): Fix VerifyError in Compose masking under DexGuard/R8 obfuscation (#5507) * fix(replay): Fix VerifyError in Compose masking under DexGuard/R8 obfuscation ComposeViewHierarchyNode.boundsInWindow returned an android.graphics.Rect while the surrounding code carried it as androidx.compose.ui.geometry.Rect, mixing the two Rect types in the same method. Under aggressive obfuscation (DexGuard 9.13.2 / R8 full mode) this could be rejected at class load with a VerifyError, crashing Replay when traversing the Compose tree. Make boundsInWindow return androidx.compose.ui.geometry.Rect throughout and add a Rect.toRect() extension to convert to android.graphics.Rect only at the boundary where the view-hierarchy node needs it. Fixes #5497 Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * fix(replay): Round Compose mask bounds outward to avoid zero-area masks isVisible/shouldMask are derived from the sub-pixel float bounds, but the android.graphics.Rect stored on the node (and drawn by MaskRenderer) used truncating toInt(). A sub-pixel node could be marked visible+maskable yet store a zero-width/height rect, so the mask wasn't drawn and sensitive content leaked. Round outward (floor min, ceil max) so a non-empty float rect always yields a non-empty integer rect, biasing toward over-masking. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../io/sentry/android/replay/util/Nodes.kt | 21 ++++++++++-- .../viewhierarchy/ComposeViewHierarchyNode.kt | 33 ++++++++++--------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c0b8bab55..d80037414db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Session Replay: Fix `VerifyError` in Compose masking under DexGuard/R8 obfuscation ([#5507](https://github.com/getsentry/sentry-java/pull/5507)) - Session Replay: Fix Compose view masking not working on obfuscated/minified builds ([#5503](https://github.com/getsentry/sentry-java/pull/5503)) ## 8.43.1 diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt index 2882b2113b8..028f681d96b 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt @@ -2,8 +2,8 @@ package io.sentry.android.replay.util -import android.graphics.Rect import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorProducer import androidx.compose.ui.graphics.painter.Painter @@ -11,6 +11,8 @@ import androidx.compose.ui.layout.LayoutCoordinates import androidx.compose.ui.layout.findRootCoordinates import androidx.compose.ui.node.LayoutNode import androidx.compose.ui.text.TextLayoutResult +import kotlin.math.ceil +import kotlin.math.floor import kotlin.math.roundToInt internal class ComposeTextLayout(internal val layout: TextLayoutResult) : TextLayout { @@ -176,7 +178,7 @@ internal fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates val boundsBottom = bounds.bottom.fastCoerceIn(0f, rootHeight) if (boundsLeft == boundsRight || boundsTop == boundsBottom) { - return Rect() + return Rect(0.0f, 0.0f, 0.0f, 0.0f) } val topLeft = root.localToWindow(Offset(boundsLeft, boundsTop)) @@ -200,5 +202,18 @@ internal fun LayoutCoordinates.boundsInWindow(rootCoordinates: LayoutCoordinates val top = fastMinOf(topLeftY, topRightY, bottomLeftY, bottomRightY) val bottom = fastMaxOf(topLeftY, topRightY, bottomLeftY, bottomRightY) - return Rect(left.toInt(), top.toInt(), right.toInt(), bottom.toInt()) + return Rect(left, top, right, bottom) +} + +internal fun Rect.toRect(): android.graphics.Rect { + // Round outward (floor min edges, ceil max edges) so that a sub-pixel but non-empty Rect doesn't + // collapse to a zero-width/height android.graphics.Rect. Otherwise a node could be marked visible + // and maskable based on the float bounds, while the integer rect the MaskRenderer draws has zero + // area, leaving sensitive content unmasked. Rounding outward also biases toward over-masking. + return android.graphics.Rect( + floor(left).toInt(), + floor(top).toInt(), + ceil(right).toInt(), + ceil(bottom).toInt(), + ) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt index 2b6bc3fc08e..2e40144e2de 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/viewhierarchy/ComposeViewHierarchyNode.kt @@ -28,6 +28,7 @@ import io.sentry.android.replay.util.findPainter import io.sentry.android.replay.util.findTextColor import io.sentry.android.replay.util.isMaskable import io.sentry.android.replay.util.toOpaque +import io.sentry.android.replay.util.toRect import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHierarchyNode import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode @@ -157,8 +158,8 @@ internal object ComposeViewHierarchyNode { // If we're unable to retrieve the semantics configuration // we should play safe and mask the whole node. return GenericViewHierarchyNode( - x = visibleRect.left.toFloat(), - y = visibleRect.top.toFloat(), + x = visibleRect.left, + y = visibleRect.top, width = node.width, height = node.height, elevation = (parent?.elevation ?: 0f), @@ -168,17 +169,17 @@ internal object ComposeViewHierarchyNode { isImportantForContentCapture = false, // will be set by children isVisible = !SentryLayoutNodeHelper.isTransparent(node) && - visibleRect.height() > 0 && - visibleRect.width() > 0, - visibleRect = visibleRect, + visibleRect.height > 0 && + visibleRect.width > 0, + visibleRect = visibleRect.toRect(), ) } val isVisible = !SentryLayoutNodeHelper.isTransparent(node) && (semantics == null || !semantics.contains(SemanticsProperties.InvisibleToUser)) && - visibleRect.height() > 0 && - visibleRect.width() > 0 + visibleRect.height > 0 && + visibleRect.width > 0 val isEditable = semantics?.contains(SemanticsActions.SetText) == true || semantics?.contains(SemanticsProperties.EditableText) == true @@ -213,8 +214,8 @@ internal object ComposeViewHierarchyNode { null }, dominantColor = textColor?.toArgb()?.toOpaque(), - x = visibleRect.left.toFloat(), - y = visibleRect.top.toFloat(), + x = visibleRect.left, + y = visibleRect.top, width = node.width, height = node.height, elevation = (parent?.elevation ?: 0f), @@ -223,7 +224,7 @@ internal object ComposeViewHierarchyNode { shouldMask = shouldMask, isImportantForContentCapture = true, isVisible = isVisible, - visibleRect = visibleRect, + visibleRect = visibleRect.toRect(), ) } else -> { @@ -233,8 +234,8 @@ internal object ComposeViewHierarchyNode { parent?.setImportantForCaptureToAncestors(true) ImageViewHierarchyNode( - x = visibleRect.left.toFloat(), - y = visibleRect.top.toFloat(), + x = visibleRect.left, + y = visibleRect.top, width = node.width, height = node.height, elevation = (parent?.elevation ?: 0f), @@ -243,7 +244,7 @@ internal object ComposeViewHierarchyNode { isVisible = isVisible, isImportantForContentCapture = true, shouldMask = shouldMask && painter.isMaskable(), - visibleRect = visibleRect, + visibleRect = visibleRect.toRect(), ) } else { val shouldMask = isVisible && semantics.shouldMask(isImage = false, options) @@ -252,8 +253,8 @@ internal object ComposeViewHierarchyNode { // TODO: traverse the ViewHierarchyNode here again. For now we can recommend // TODO: using custom modifiers to obscure the entire node if it's sensitive GenericViewHierarchyNode( - x = visibleRect.left.toFloat(), - y = visibleRect.top.toFloat(), + x = visibleRect.left, + y = visibleRect.top, width = node.width, height = node.height, elevation = (parent?.elevation ?: 0f), @@ -262,7 +263,7 @@ internal object ComposeViewHierarchyNode { shouldMask = shouldMask, isImportantForContentCapture = false, // will be set by children isVisible = isVisible, - visibleRect = visibleRect, + visibleRect = visibleRect.toRect(), ) } } From 80199f8effacbd46531006e0c25645ef0c24d518 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 9 Jun 2026 09:13:40 +0200 Subject: [PATCH 186/391] docs(ai): Refresh AGENTS.md module list and fix coding.mdc command (#5517) * docs(ai): Refresh AGENTS.md module list and fix coding.mdc command The Module Architecture section omitted several product areas that now exist as modules and already have dedicated .cursor/rules: Session Replay, Feature Flags, Queues (Kafka), and JVM continuous profiling. Add them alongside the other previously-unlisted modules, and add a pointer to the repository's task-specific skills. Also fix a typo in coding.mdc where the per-file test command used ./gradle instead of ./gradlew. Co-Authored-By: Claude Opus 4.8 (1M context) * docs(ai): Note moving changelog entries to Unreleased on rebase A rebase onto main can land a branch after a release was cut, leaving a new changelog entry under an already-released version heading. Document that the entry should be moved back into an Unreleased section at the top of CHANGELOG.md. Co-Authored-By: Claude Opus 4.8 (1M context) * docs(ai): Add changelog rebase note to AGENTS.md AGENTS.md is the always-loaded entrypoint, so the rebase reminder reaches agents more reliably here than in an on-demand .cursor rule. Keep the detailed workflow in pr.mdc and point to it from here. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- .cursor/rules/coding.mdc | 4 ++-- .cursor/rules/pr.mdc | 2 ++ AGENTS.md | 23 +++++++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.cursor/rules/coding.mdc b/.cursor/rules/coding.mdc index e7af7273f15..4e6fd2538a3 100644 --- a/.cursor/rules/coding.mdc +++ b/.cursor/rules/coding.mdc @@ -24,13 +24,13 @@ sentry-java is the Java and Android SDK for Sentry. This repository contains the ./gradlew check # Run unit tests for a specific file -./gradle '::testDebugUnitTest' --tests="**" --info +./gradlew '::testDebugUnitTest' --tests="**" --info ``` ## Contributing Guidelines 1. Follow existing code style and language -2. Do not modify the API files (e.g. sentry.api) manually, instead run `./gradlew apiDump` to regenerate them +2. Do not modify the API files (e.g. sentry.api) manually, instead run `./gradlew apiDump` to regenerate them 3. Write comprehensive tests 4. New features should always be opt-in by default, extend `SentryOptions` or similar Option classes with getters and setters to enable/disable a new feature 5. Consider backwards compatibility diff --git a/.cursor/rules/pr.mdc b/.cursor/rules/pr.mdc index e15c0a0a563..3a37ecc15f8 100644 --- a/.cursor/rules/pr.mdc +++ b/.cursor/rules/pr.mdc @@ -93,6 +93,8 @@ Entry format: - ([#](https://github.com/getsentry/sentry-java/pull/)) ``` +**When rebasing:** A rebase onto `main` can land your branch after a release was cut, where the `## Unreleased` heading your entry lived under has since been renamed to that version number. If that happens, move your new entry into an `## Unreleased` section at the top of `CHANGELOG.md` (create the section if it no longer exists) so it is not left under an already-released version. + Commit changelog separately: ```bash diff --git a/AGENTS.md b/AGENTS.md index ff50727c662..8d0cccabbc7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -92,6 +92,14 @@ make systemTest 6. **Format and regenerate**: Once done, format code and regenerate .api files: `./gradlew spotlessApply apiDump` 7. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command +## Repository Skills + +This repo ships task-specific skills (declared in `agents.toml`, sources under `.agents/skills`). Prefer them over performing the steps manually: +- **`create-java-pr`**: Branch, format, `apiDump`, commit, push, open PR, and add the changelog entry (automates the PR workflow above) +- **`test`**: Run unit or system tests for a module or a specific class +- **`check-code-attribution`**: Verify third-party code attribution on the current branch (see Third-Party Code Attribution below) +- **`btrace-perfetto`**: Capture and compare Perfetto traces for Android performance work + ## Module Architecture The repository is organized into multiple modules: @@ -100,15 +108,22 @@ The repository is organized into multiple modules: - **`sentry`** - Core Java SDK implementation - **`sentry-android-core`** - Core Android SDK implementation - **`sentry-android`** - High-level Android SDK +- **`sentry-android-ndk`** - Native (NDK) crash handling ### Integration Modules - **Spring Framework**: `sentry-spring*`, `sentry-spring-boot*` -- **Logging**: `sentry-logback`, `sentry-log4j2`, `sentry-jul` -- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-apache-http-client-5` +- **Logging**: `sentry-logback`, `sentry-log4j2`, `sentry-jul`, `sentry-android-timber` +- **Web**: `sentry-servlet*`, `sentry-okhttp`, `sentry-openfeign`, `sentry-apache-http-client-5` - **GraphQL**: `sentry-graphql*`, `sentry-apollo*` - **Android UI**: `sentry-android-fragment`, `sentry-android-navigation`, `sentry-compose` +- **Session Replay**: `sentry-android-replay` +- **Database**: `sentry-jdbc`, `sentry-android-sqlite`, `sentry-jcache` - **Reactive**: `sentry-reactor`, `sentry-ktor-client` +- **Feature Flags**: `sentry-launchdarkly-android`, `sentry-launchdarkly-server`, `sentry-openfeature` +- **Queues**: `sentry-kafka` +- **Profiling**: `sentry-async-profiler` (JVM continuous profiling) - **Monitoring**: `sentry-opentelemetry*`, `sentry-quartz` +- **Other**: `sentry-spotlight`, `sentry-kotlin-extensions`, `sentry-android-distribution` ### Utility Modules - **`sentry-test-support`** - Shared test utilities @@ -171,6 +186,10 @@ gh pr view --json number -q '.number' gh pr view --json url -q '.url' ``` +### Changelog + +User-facing changes get an entry under the `## Unreleased` section of `CHANGELOG.md`. When rebasing onto `main`, a release may have renamed the `## Unreleased` heading your entry was under to a version number — if so, move your entry back into an `## Unreleased` section at the top of the file (create it if it no longer exists). See `.cursor/rules/pr.mdc` for the full changelog and PR workflow. + ## Useful Resources - Main SDK documentation: https://develop.sentry.dev/sdk/overview/ From 105d667ed4ed37d897fe8e9199de23357896e550 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 9 Jun 2026 09:42:26 +0200 Subject: [PATCH 187/391] fix(license): Attribute vendored AndroidX Compose UI code in Session Replay (#5516) sentry-android-replay's Nodes.kt vendors code from AndroidX Compose UI (Apache 2.0, The Android Open Source Project) without attribution: - boundsInWindow is a faster copy of LayoutCoordinates.boundsInWindow - fastMinOf/fastMaxOf/fastCoerceIn/fastCoerceAtLeast/fastCoerceAtMost are copied from androidx.compose.ui.util.MathHelpers Add the required source-file attribution header and a THIRD_PARTY_NOTICES.md entry covering both source files. Co-authored-by: Claude Opus 4.8 (1M context) --- THIRD_PARTY_NOTICES.md | 29 +++++++++++++++++++ .../io/sentry/android/replay/util/Nodes.kt | 22 ++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 5a48d567fac..c1fa7e8f65b 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -315,6 +315,35 @@ limitations under the License. --- +## Android Open Source Project — Jetpack Compose UI (Apache 2.0) + +**Source:** https://github.com/androidx/androidx/blob/fc7df0dd68466ac3bb16b1c79b7a73dd0bfdd4c1/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt#L187
+**Source:** https://github.com/androidx/androidx/blob/androidx-main/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/MathHelpers.kt
+**License:** Apache License 2.0
+**Copyright:** Copyright (C) 2019, 2020 The Android Open Source Project + +### Scope + +The Sentry Android Replay SDK includes code adapted from Jetpack Compose UI, used to compute Compose node bounds while traversing the view hierarchy for masking. The code resides in `io.sentry.android.replay.util.Nodes`: the `boundsInWindow` extension function (a faster copy of `LayoutCoordinates.boundsInWindow`) and the `fastMinOf`, `fastMaxOf`, `fastCoerceIn`, `fastCoerceAtLeast`, and `fastCoerceAtMost` numeric helpers (copied from `androidx.compose.ui.util.MathHelpers`). + +``` +Copyright (C) 2019, 2020 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +--- + ## OpenTelemetry (Apache 2.0) **Source:** https://github.com/open-telemetry/opentelemetry-java (Commit: 0aacc55d1e3f5cc6dbb4f8fa26bcb657b01a7bc9)
diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt index 028f681d96b..704260cf311 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/Nodes.kt @@ -1,3 +1,25 @@ +/* + * Portions of this file are adapted from AndroidX Compose UI: + * - the `boundsInWindow` extension is a faster copy of `LayoutCoordinates.boundsInWindow` + * - the `fastMinOf`, `fastMaxOf`, `fastCoerceIn`, `fastCoerceAtLeast` and `fastCoerceAtMost` + * helpers are copied from `androidx.compose.ui.util.MathHelpers` + * + * Adapted from: + * https://github.com/androidx/androidx/blob/fc7df0dd68466ac3bb16b1c79b7a73dd0bfdd4c1/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutCoordinates.kt + * https://github.com/androidx/androidx/blob/androidx-main/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/MathHelpers.kt + * + * Copyright (C) 2019, 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // to access internal vals and classes package io.sentry.android.replay.util From 29f120b097b4bd6c870491f5dc35caf7b37a7609 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 9 Jun 2026 10:22:41 +0200 Subject: [PATCH 188/391] perf: Replace java.net.URI with custom string parsing in Dsn (#5448) * perf: Replace java.net.URI with custom string parsing in Dsn The Dsn constructor used `new URI(dsnString).normalize()` to parse the DSN string, which is known to be slow on Android. Since `retrieveParsedDsn()` is called on the main thread during `Sentry.init()` via `preInitConfigurations()`, this directly impacts app startup time. Replace the URI-based parsing with manual indexOf/substring operations. The only remaining URI construction is from pre-parsed components (`new URI(scheme, null, host, port, path, null, null)`), which is significantly cheaper since the JDK doesn't need to re-parse a string. Co-Authored-By: Claude Opus 4.6 * test: Add tests for custom DSN string parsing Cover edge cases specific to the manual indexOf/substring parser: null input, missing scheme separator, no slash after host, multiple path segments, port with path, multiple double slashes, query string with port, empty secret key, and a realistic Sentry DSN with org id. Co-Authored-By: Claude Opus 4.6 * changelog: Add entry for custom DSN parser Co-Authored-By: Claude Opus 4.6 * fix(dsn): Strip URI fragments and support IPv6 hosts Harden the custom DSN parser and convert its tests to Google Truth. - Strip URI fragments (#...) alongside query strings so they no longer leak into the project id and corrupt the constructed Sentry URI. - Detect bracketed IPv6 literal hosts when locating the port separator, restoring behavior that java.net.URI handled. - Narrow the parse error handling from catch (Throwable) to the expected exceptions, which stops swallowing Error and removes the doubled exception message. - Extract the parsing steps into focused private helpers. - Convert DsnTest to Google Truth assertions. - Move the changelog entry to the Unreleased section, since 8.43.0 and 8.43.1 have already been released. Co-Authored-By: Claude Opus 4.8 * test(dsn): Assert exception messages via Truth hasMessageThat Follow Truth's recommended pattern for exception testing: catch with assertFailsWith, then assert on the caught throwable with assertThat(ex).hasMessageThat(). Also assert the message in the previously bare throw-only cases so they can no longer pass on an unrelated exception. Co-Authored-By: Claude Opus 4.8 * fix(dsn): Give a clear error message for a malformed port Parse the port in a dedicated helper that reports the offending value ("Invalid DSN: Invalid port 'abc'.") instead of leaking the raw NumberFormatException text. Narrow the catch to URISyntaxException now that the port is the only parseInt, and add a test. Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 4 + gradle/libs.versions.toml | 1 + sentry/build.gradle.kts | 1 + sentry/src/main/java/io/sentry/Dsn.java | 161 ++++++++++++------- sentry/src/test/java/io/sentry/DsnTest.kt | 182 +++++++++++++++++----- 5 files changed, 255 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d80037414db..be4a5f7628d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Improvements + +- Improve SDK init performance by replacing `java.net.URI` with custom string parsing for DSN ([#5448](https://github.com/getsentry/sentry-java/pull/5448)) + ### Fixes - Session Replay: Fix `VerifyError` in Compose masking under DexGuard/R8 obfuscation ([#5507](https://github.com/getsentry/sentry-java/pull/5507)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7ee39d75ede..e653069e2b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -238,6 +238,7 @@ camerax-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "ca camerax-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "camerax" } camerax-view = { module = "androidx.camera:camera-view", version.ref = "camerax" } +google-truth = { module = "com.google.truth:truth", version = "1.4.5" } hsqldb = { module = "org.hsqldb:hsqldb", version = "2.6.1" } javafaker = { module = "com.github.javafaker:javafaker", version = "1.0.2" } kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } diff --git a/sentry/build.gradle.kts b/sentry/build.gradle.kts index 25e700995b4..4c237803a51 100644 --- a/sentry/build.gradle.kts +++ b/sentry/build.gradle.kts @@ -25,6 +25,7 @@ dependencies { // tests testImplementation(kotlin(Config.kotlinStdLib)) testImplementation(libs.awaitility.kotlin) + testImplementation(libs.google.truth) testImplementation(libs.javafaker) testImplementation(libs.kotlin.test.junit) testImplementation(libs.mockito.kotlin) diff --git a/sentry/src/main/java/io/sentry/Dsn.java b/sentry/src/main/java/io/sentry/Dsn.java index 0d21499b5fc..15aea2a064c 100644 --- a/sentry/src/main/java/io/sentry/Dsn.java +++ b/sentry/src/main/java/io/sentry/Dsn.java @@ -2,6 +2,7 @@ import io.sentry.util.Objects; import java.net.URI; +import java.net.URISyntaxException; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jetbrains.annotations.NotNull; @@ -17,98 +18,148 @@ final class Dsn { private final @NotNull URI sentryUri; private final @Nullable String orgId; - /* - / The project ID which the authenticated user is bound to. - */ + /** The project ID which the authenticated user is bound to. */ public @NotNull String getProjectId() { return projectId; } - /* - / An optional path of which Sentry is hosted - */ + /** An optional path of which Sentry is hosted. */ public @Nullable String getPath() { return path; } - /* - / The optional secret key to authenticate the SDK. - */ + /** The optional secret key to authenticate the SDK. */ public @Nullable String getSecretKey() { return secretKey; } - /* - / The required public key to authenticate the SDK. - */ + /** The required public key to authenticate the SDK. */ public @NotNull String getPublicKey() { return publicKey; } - /* - / The URI used to communicate with Sentry - */ + /** The org ID extracted from the host, or {@code null} when the host has no org prefix. */ + public @Nullable String getOrgId() { + return orgId; + } + + /** The URI used to communicate with Sentry. */ @NotNull URI getSentryUri() { return sentryUri; } + // Avoids java.net.URI for DSN parsing, which is slow on Android. Dsn(@Nullable String dsn) throws IllegalArgumentException { + final String dsnString = Objects.requireNonNull(dsn, "The DSN is required.").trim(); + if (dsnString.isEmpty()) { + throw new IllegalArgumentException("The DSN is empty."); + } + try { - final String dsnString = Objects.requireNonNull(dsn, "The DSN is required.").trim(); - if (dsnString.isEmpty()) { - throw new IllegalArgumentException("The DSN is empty."); + final int schemeEnd = dsnString.indexOf("://"); + if (schemeEnd < 0) { + throw new IllegalArgumentException("Invalid DSN: Missing scheme."); } - final URI uri = new URI(dsnString).normalize(); - final String scheme = uri.getScheme(); - if (!("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme))) { - throw new IllegalArgumentException("Invalid DSN scheme: " + scheme); + final String scheme = dsnString.substring(0, schemeEnd); + if (!"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme)) { + throw new IllegalArgumentException("Invalid DSN: Invalid scheme '" + scheme + "'."); } - String userInfo = uri.getUserInfo(); - if (userInfo == null || userInfo.isEmpty()) { + final int authStart = schemeEnd + 3; + final int atIndex = dsnString.indexOf('@', authStart); + if (atIndex < 0) { throw new IllegalArgumentException("Invalid DSN: No public key provided."); } - String[] keys = userInfo.split(":", -1); - publicKey = keys[0]; - if (publicKey == null || publicKey.isEmpty()) { + final String userInfo = dsnString.substring(authStart, atIndex); + final int colonIndex = userInfo.indexOf(':'); + publicKey = colonIndex < 0 ? userInfo : userInfo.substring(0, colonIndex); + secretKey = colonIndex < 0 ? null : userInfo.substring(colonIndex + 1); + if (publicKey.isEmpty()) { throw new IllegalArgumentException("Invalid DSN: No public key provided."); } - secretKey = keys.length > 1 ? keys[1] : null; - String uriPath = uri.getPath(); - if (uriPath.endsWith("/")) { - uriPath = uriPath.substring(0, uriPath.length() - 1); - } - int projectIdStart = uriPath.lastIndexOf("/") + 1; - String path = uriPath.substring(0, projectIdStart); - if (!path.endsWith("/")) { - path += "/"; + + final String hostAndPath = stripQueryAndFragment(dsnString, atIndex + 1); + final int firstSlash = hostAndPath.indexOf('/'); + if (firstSlash < 0) { + throw new IllegalArgumentException("Invalid DSN: A Project Id is required."); } - this.path = path; - projectId = uriPath.substring(projectIdStart); + + final String hostPort = hostAndPath.substring(0, firstSlash); + final int portColon = portSeparatorIndex(hostPort); + final String host = portColon < 0 ? hostPort : hostPort.substring(0, portColon); + final int port = portColon < 0 ? -1 : parsePort(hostPort.substring(portColon + 1)); + + final String rawPath = stripTrailingSlash(collapseSlashes(hostAndPath.substring(firstSlash))); + final int projectIdStart = rawPath.lastIndexOf('/') + 1; + path = ensureTrailingSlash(rawPath.substring(0, projectIdStart)); + projectId = rawPath.substring(projectIdStart); if (projectId.isEmpty()) { throw new IllegalArgumentException("Invalid DSN: A Project Id is required."); } - sentryUri = - new URI( - scheme, null, uri.getHost(), uri.getPort(), path + "api/" + projectId, null, null); - - // Extract org ID from host (e.g., "o123.ingest.sentry.io" -> "123") - String extractedOrgId = null; - final String host = uri.getHost(); - if (host != null) { - final Matcher matcher = ORG_ID_PATTERN.matcher(host); - if (matcher.find()) { - extractedOrgId = matcher.group(1); - } + + sentryUri = new URI(scheme, null, host, port, path + "api/" + projectId, null, null); + orgId = extractOrgId(host); + } catch (URISyntaxException e) { + throw new IllegalArgumentException("Invalid DSN: " + e.getMessage(), e); + } + } + + private static int parsePort(final @NotNull String portString) { + try { + return Integer.parseInt(portString); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Invalid DSN: Invalid port '" + portString + "'.", e); + } + } + + // Drops the query string and/or fragment, whichever appears first, from the host onwards. + private static @NotNull String stripQueryAndFragment( + final @NotNull String dsn, final int fromIndex) { + int cut = dsn.indexOf('?', fromIndex); + final int fragment = dsn.indexOf('#', fromIndex); + if (fragment >= 0 && (cut < 0 || fragment < cut)) { + cut = fragment; + } + return cut < 0 ? dsn.substring(fromIndex) : dsn.substring(fromIndex, cut); + } + + // IPv6 literals are bracketed and contain colons, so the port separator follows the ']'. + private static int portSeparatorIndex(final @NotNull String hostPort) { + return hostPort.startsWith("[") + ? hostPort.indexOf(':', hostPort.indexOf(']')) + : hostPort.indexOf(':'); + } + + // Collapses runs of slashes into a single slash, like URI.normalize(). + private static @NotNull String collapseSlashes(final @NotNull String path) { + if (!path.contains("//")) { + return path; + } + final StringBuilder sb = new StringBuilder(path.length()); + char previous = 0; + for (int i = 0; i < path.length(); i++) { + final char c = path.charAt(i); + if (c == '/' && previous == '/') { + continue; } - orgId = extractedOrgId; - } catch (Throwable e) { - throw new IllegalArgumentException(e); + sb.append(c); + previous = c; } + return sb.toString(); } - public @Nullable String getOrgId() { - return orgId; + private static @NotNull String stripTrailingSlash(final @NotNull String path) { + return path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + } + + private static @NotNull String ensureTrailingSlash(final @NotNull String path) { + return path.endsWith("/") ? path : path + "/"; + } + + // Extracts the org ID from a host such as "o123.ingest.sentry.io" -> "123". + private static @Nullable String extractOrgId(final @NotNull String host) { + final Matcher matcher = ORG_ID_PATTERN.matcher(host); + return matcher.find() ? matcher.group(1) : null; } } diff --git a/sentry/src/test/java/io/sentry/DsnTest.kt b/sentry/src/test/java/io/sentry/DsnTest.kt index 7e2982073f1..f8195d16af6 100644 --- a/sentry/src/test/java/io/sentry/DsnTest.kt +++ b/sentry/src/test/java/io/sentry/DsnTest.kt @@ -1,21 +1,20 @@ package io.sentry +import com.google.common.truth.Truth.assertThat import java.lang.IllegalArgumentException import kotlin.test.Test -import kotlin.test.assertEquals import kotlin.test.assertFailsWith -import kotlin.test.assertNull class DsnTest { @Test fun `dsn parsed with path, sets all properties`() { val dsn = Dsn("https://publicKey:secretKey@host/path/id") - assertEquals("https://host/path/api/id", dsn.sentryUri.toURL().toString()) - assertEquals("publicKey", dsn.publicKey) - assertEquals("secretKey", dsn.secretKey) - assertEquals("/path/", dsn.path) - assertEquals("id", dsn.projectId) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/path/api/id") + assertThat(dsn.publicKey).isEqualTo("publicKey") + assertThat(dsn.secretKey).isEqualTo("secretKey") + assertThat(dsn.path).isEqualTo("/path/") + assertThat(dsn.projectId).isEqualTo("id") } @Test @@ -23,94 +22,90 @@ class DsnTest { // query strings were once a feature, but no more val dsn = Dsn("https://publicKey:secretKey@host/path/id?sample.rate=0.1") - assertEquals("https://host/path/api/id", dsn.sentryUri.toURL().toString()) - assertEquals("publicKey", dsn.publicKey) - assertEquals("secretKey", dsn.secretKey) - assertEquals("/path/", dsn.path) - assertEquals("id", dsn.projectId) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/path/api/id") + assertThat(dsn.publicKey).isEqualTo("publicKey") + assertThat(dsn.secretKey).isEqualTo("secretKey") + assertThat(dsn.path).isEqualTo("/path/") + assertThat(dsn.projectId).isEqualTo("id") } @Test fun `dsn parsed without path`() { val dsn = Dsn("https://key@host/id") - assertEquals("https://host/api/id", dsn.sentryUri.toURL().toString()) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/api/id") } @Test fun `dsn parsed with port number`() { val dsn = Dsn("http://key@host:69/id") - assertEquals("http://host:69/api/id", dsn.sentryUri.toURL().toString()) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("http://host:69/api/id") } @Test fun `dsn parsed with trailing slash`() { val dsn = Dsn("http://key@host/id/") - assertEquals("http://host/api/id", dsn.sentryUri.toURL().toString()) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("http://host/api/id") } @Test fun `dsn parsed with no delimiter for key`() { val dsn = Dsn("https://publicKey@host/id") - assertEquals("publicKey", dsn.publicKey) - assertNull(dsn.secretKey) + assertThat(dsn.publicKey).isEqualTo("publicKey") + assertThat(dsn.secretKey).isNull() } @Test fun `when no project id exists, throws exception`() { val ex = assertFailsWith { Dsn("http://key@host/") } - assertEquals( - "java.lang.IllegalArgumentException: Invalid DSN: A Project Id is required.", - ex.message, - ) + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: A Project Id is required.") } @Test fun `when no key exists, throws exception`() { val ex = assertFailsWith { Dsn("http://host/id") } - assertEquals( - "java.lang.IllegalArgumentException: Invalid DSN: No public key provided.", - ex.message, - ) + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: No public key provided.") } @Test fun `when only passing secret key, throws exception`() { val ex = assertFailsWith { Dsn("https://:secret@host/path/id") } - assertEquals( - "java.lang.IllegalArgumentException: Invalid DSN: No public key provided.", - ex.message, - ) + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: No public key provided.") } @Test fun `dsn is normalized`() { val dsn = Dsn("http://key@host//id") - assertEquals("http://host/api/id", dsn.sentryUri.toURL().toString()) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("http://host/api/id") } @Test fun `dsn parsed with leading and trailing whitespace`() { val dsn = Dsn(" https://key@host/id ") - assertEquals("https://host/api/id", dsn.sentryUri.toURL().toString()) + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/api/id") } @Test fun `when dsn is empty, throws exception`() { val ex = assertFailsWith { Dsn("") } - assertEquals("java.lang.IllegalArgumentException: The DSN is empty.", ex.message) + assertThat(ex).hasMessageThat().isEqualTo("The DSN is empty.") } @Test fun `when dsn is only whitespace, throws exception`() { val ex = assertFailsWith { Dsn(" ") } - assertEquals("java.lang.IllegalArgumentException: The DSN is empty.", ex.message) + assertThat(ex).hasMessageThat().isEqualTo("The DSN is empty.") } @Test fun `non http protocols are not accepted`() { - assertFailsWith { Dsn("ftp://publicKey:secretKey@host/path/id") } - assertFailsWith { Dsn("jar://publicKey:secretKey@host/path/id") } + val ftp = + assertFailsWith { Dsn("ftp://publicKey:secretKey@host/path/id") } + assertThat(ftp).hasMessageThat().isEqualTo("Invalid DSN: Invalid scheme 'ftp'.") + + val jar = + assertFailsWith { Dsn("jar://publicKey:secretKey@host/path/id") } + assertThat(jar).hasMessageThat().isEqualTo("Invalid DSN: Invalid scheme 'jar'.") } @Test @@ -125,24 +120,133 @@ class DsnTest { @Test fun `extracts org id from host`() { val dsn = Dsn("https://key@o123.ingest.sentry.io/456") - assertEquals("123", dsn.orgId) + assertThat(dsn.orgId).isEqualTo("123") } @Test fun `extracts single digit org id from host`() { val dsn = Dsn("https://key@o1.ingest.us.sentry.io/456") - assertEquals("1", dsn.orgId) + assertThat(dsn.orgId).isEqualTo("1") } @Test fun `returns null org id when host has no org prefix`() { val dsn = Dsn("https://key@sentry.io/456") - assertNull(dsn.orgId) + assertThat(dsn.orgId).isNull() } @Test fun `returns null org id for non-standard host`() { val dsn = Dsn("http://key@localhost:9000/456") - assertNull(dsn.orgId) + assertThat(dsn.orgId).isNull() + } + + @Test + fun `when dsn is null, throws exception`() { + val ex = assertFailsWith { Dsn(null) } + assertThat(ex).hasMessageThat().isEqualTo("The DSN is required.") + } + + @Test + fun `when dsn has no scheme separator, throws exception`() { + val ex = assertFailsWith { Dsn("httpspublicKey@host/id") } + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: Missing scheme.") + } + + @Test + fun `when dsn has no slash after host, throws exception`() { + val ex = assertFailsWith { Dsn("https://key@host") } + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: A Project Id is required.") + } + + @Test + fun `when port is not a number, throws exception`() { + val ex = assertFailsWith { Dsn("http://key@host:abc/1") } + assertThat(ex).hasMessageThat().isEqualTo("Invalid DSN: Invalid port 'abc'.") + } + + @Test + fun `dsn parsed with multiple path segments`() { + val dsn = Dsn("https://key@host/path/to/sentry/id") + + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/path/to/sentry/api/id") + assertThat(dsn.publicKey).isEqualTo("key") + assertThat(dsn.path).isEqualTo("/path/to/sentry/") + assertThat(dsn.projectId).isEqualTo("id") + } + + @Test + fun `dsn parsed with port and path`() { + val dsn = Dsn("http://key:secret@host:8080/path/id") + + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("http://host:8080/path/api/id") + assertThat(dsn.publicKey).isEqualTo("key") + assertThat(dsn.secretKey).isEqualTo("secret") + assertThat(dsn.path).isEqualTo("/path/") + assertThat(dsn.projectId).isEqualTo("id") + } + + @Test + fun `dsn with multiple double slashes in path is normalized`() { + val dsn = Dsn("http://key@host//path//id") + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("http://host/path/api/id") + } + + @Test + fun `dsn with query string and port`() { + val dsn = Dsn("https://key@host:443/id?foo=bar&baz=1") + + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host:443/api/id") + assertThat(dsn.projectId).isEqualTo("id") + } + + @Test + fun `dsn with fragment is stripped from project id`() { + val dsn = Dsn("https://key@host/123#frag") + + assertThat(dsn.projectId).isEqualTo("123") + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/api/123") + } + + @Test + fun `dsn with both query string and fragment is stripped from project id`() { + val dsn = Dsn("https://key@host/123?foo=bar#frag") + + assertThat(dsn.projectId).isEqualTo("123") + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://host/api/123") + } + + @Test + fun `dsn with ipv6 host and port`() { + val dsn = Dsn("https://key@[2001:db8::1]:9000/1") + + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://[2001:db8::1]:9000/api/1") + assertThat(dsn.projectId).isEqualTo("1") + } + + @Test + fun `dsn with ipv6 host and no port`() { + val dsn = Dsn("https://key@[::1]/1") + + assertThat(dsn.sentryUri.toURL().toString()).isEqualTo("https://[::1]/api/1") + assertThat(dsn.projectId).isEqualTo("1") + } + + @Test + fun `dsn with empty secret key after colon`() { + val dsn = Dsn("https://publicKey:@host/id") + + assertThat(dsn.publicKey).isEqualTo("publicKey") + assertThat(dsn.secretKey).isEqualTo("") + } + + @Test + fun `dsn with numeric project id`() { + val dsn = Dsn("https://key@o123.ingest.sentry.io/1234567") + + assertThat(dsn.projectId).isEqualTo("1234567") + assertThat(dsn.orgId).isEqualTo("123") + assertThat(dsn.sentryUri.toURL().toString()) + .isEqualTo("https://o123.ingest.sentry.io/api/1234567") } } From 887fd58186a83c5a1120c69813ba5eb7f1c097da Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 9 Jun 2026 11:25:49 +0200 Subject: [PATCH 189/391] ci(spring-matrix): Replace sed hacks with targeted Gradle builds (#5397) * ci(spring-matrix): Replace sed hacks with targeted Gradle builds Remove the sed-based Android module exclusion from settings.gradle.kts and build.gradle.kts in the Spring Boot matrix workflows. This is unnecessary because `org.gradle.configureondemand=true` ensures Gradle only configures projects needed for the requested tasks. Replace the broad `./gradlew assemble --parallel` with a single targeted Gradle invocation that builds only the specific artifacts needed (shadowJar/bootJar/war + OTel agent). Remove redundant `--build "true"` from test runner invocations since artifacts are already built. Co-Authored-By: Claude Opus 4.6 * ci(spring-matrix): Include testClasses in initial build Add testClasses tasks to the single Gradle invocation so test sources are pre-compiled. The subsequent systemTest Gradle calls then only execute tests without needing to compile anything. Co-Authored-By: Claude Opus 4.6 * ci(spring-matrix): Remove redundant --parallel flag Already set in gradle.properties. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 --- .github/workflows/spring-boot-2-matrix.yml | 64 +++++++--------------- .github/workflows/spring-boot-3-matrix.yml | 64 +++++++--------------- .github/workflows/spring-boot-4-matrix.yml | 64 +++++++--------------- 3 files changed, 57 insertions(+), 135 deletions(-) diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index bbcb3cfc0bc..32eeef2442d 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -72,88 +72,62 @@ jobs: perl -0pi -e 'BEGIN { $v = shift } s/^springboot2[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot2 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml echo "Updated Spring Boot 2.x version to $springboot_version" - - name: Exclude android modules from build + - name: Build sample artifacts run: | - sed -i \ - -e '/.*"sentry-android-ndk",/d' \ - -e '/.*"sentry-android",/d' \ - -e '/.*"sentry-compose",/d' \ - -e '/.*"sentry-android-core",/d' \ - -e '/.*"sentry-android-fragment",/d' \ - -e '/.*"sentry-android-navigation",/d' \ - -e '/.*"sentry-android-sqlite",/d' \ - -e '/.*"sentry-android-timber",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-critical",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-sentry",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-size",/d' \ - -e '/.*"sentry-samples:sentry-samples-android",/d' \ - -e '/.*"sentry-android-replay",/d' \ - settings.gradle.kts - - - name: Exclude android modules from ignore list - run: | - sed -i \ - -e '/.*"sentry-uitest-android",/d' \ - -e '/.*"sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-uitest-android-critical",/d' \ - -e '/.*"test-app-sentry",/d' \ - -e '/.*"test-app-size",/d' \ - -e '/.*"sentry-samples-android",/d' \ - build.gradle.kts - - - name: Build SDK - run: | - ./gradlew assemble --parallel + ./gradlew \ + :sentry-samples:sentry-samples-spring-boot:shadowJar \ + :sentry-samples:sentry-samples-spring-boot:testClasses \ + :sentry-samples:sentry-samples-spring-boot-webflux:shadowJar \ + :sentry-samples:sentry-samples-spring-boot-webflux:testClasses \ + :sentry-samples:sentry-samples-spring-boot-opentelemetry:shadowJar \ + :sentry-samples:sentry-samples-spring-boot-opentelemetry:testClasses \ + :sentry-samples:sentry-samples-spring-boot-opentelemetry-noagent:shadowJar \ + :sentry-samples:sentry-samples-spring-boot-opentelemetry-noagent:testClasses \ + :sentry-samples:sentry-samples-spring:war \ + :sentry-samples:sentry-samples-spring:testClasses \ + :sentry-opentelemetry:sentry-opentelemetry-agent:assemble - name: Test sentry-samples-spring-boot run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-webflux run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-webflux" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-opentelemetry agent init true run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-opentelemetry" \ --agent true \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-opentelemetry agent init false run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-opentelemetry" \ --agent true \ - --auto-init "false" \ - --build "true" + --auto-init "false" - name: Test sentry-samples-spring-boot-opentelemetry-noagent run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-opentelemetry-noagent" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Upload test results if: always() diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 781d8a876f9..8614e2ca69d 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -68,88 +68,62 @@ jobs: perl -0pi -e 'BEGIN { $v = shift } s/^springboot3[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot3 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml echo "Updated Spring Boot 3.x version to $springboot_version" - - name: Exclude android modules from build + - name: Build sample artifacts run: | - sed -i \ - -e '/.*"sentry-android-ndk",/d' \ - -e '/.*"sentry-android",/d' \ - -e '/.*"sentry-compose",/d' \ - -e '/.*"sentry-android-core",/d' \ - -e '/.*"sentry-android-fragment",/d' \ - -e '/.*"sentry-android-navigation",/d' \ - -e '/.*"sentry-android-sqlite",/d' \ - -e '/.*"sentry-android-timber",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-critical",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-sentry",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-size",/d' \ - -e '/.*"sentry-samples:sentry-samples-android",/d' \ - -e '/.*"sentry-android-replay",/d' \ - settings.gradle.kts - - - name: Exclude android modules from ignore list - run: | - sed -i \ - -e '/.*"sentry-uitest-android",/d' \ - -e '/.*"sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-uitest-android-critical",/d' \ - -e '/.*"test-app-sentry",/d' \ - -e '/.*"test-app-size",/d' \ - -e '/.*"sentry-samples-android",/d' \ - build.gradle.kts - - - name: Build SDK - run: | - ./gradlew assemble --parallel + ./gradlew \ + :sentry-samples:sentry-samples-spring-boot-jakarta:bootJar \ + :sentry-samples:sentry-samples-spring-boot-jakarta:testClasses \ + :sentry-samples:sentry-samples-spring-boot-webflux-jakarta:bootJar \ + :sentry-samples:sentry-samples-spring-boot-webflux-jakarta:testClasses \ + :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:bootJar \ + :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:testClasses \ + :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry-noagent:bootJar \ + :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry-noagent:testClasses \ + :sentry-samples:sentry-samples-spring-jakarta:war \ + :sentry-samples:sentry-samples-spring-jakarta:testClasses \ + :sentry-opentelemetry:sentry-opentelemetry-agent:assemble - name: Test sentry-samples-spring-boot-jakarta run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-jakarta" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-webflux-jakarta run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-webflux-jakarta" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-jakarta-opentelemetry agent init true run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-jakarta-opentelemetry" \ --agent true \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-boot-jakarta-opentelemetry agent init false run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-jakarta-opentelemetry" \ --agent true \ - --auto-init "false" \ - --build "true" + --auto-init "false" - name: Test sentry-samples-spring-boot-jakarta-opentelemetry-noagent run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-jakarta-opentelemetry-noagent" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Test sentry-samples-spring-jakarta run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-jakarta" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Upload test results if: always() diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index bc1b1686692..e82b120ec24 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -68,88 +68,62 @@ jobs: perl -0pi -e 'BEGIN { $v = shift } s/^springboot4[[:space:]]*=[[:space:]]*"\K[^"]*/$v/m or die "::error::springboot4 version entry not found in gradle/libs.versions.toml\n"' "$springboot_version" gradle/libs.versions.toml echo "Updated Spring Boot 4.x version to $springboot_version" - - name: Exclude android modules from build + - name: Build sample artifacts run: | - sed -i \ - -e '/.*"sentry-android-ndk",/d' \ - -e '/.*"sentry-android",/d' \ - -e '/.*"sentry-compose",/d' \ - -e '/.*"sentry-android-core",/d' \ - -e '/.*"sentry-android-fragment",/d' \ - -e '/.*"sentry-android-navigation",/d' \ - -e '/.*"sentry-android-sqlite",/d' \ - -e '/.*"sentry-android-timber",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android",/d' \ - -e '/.*"sentry-android-integration-tests:sentry-uitest-android-critical",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-sentry",/d' \ - -e '/.*"sentry-android-integration-tests:test-app-size",/d' \ - -e '/.*"sentry-samples:sentry-samples-android",/d' \ - -e '/.*"sentry-android-replay",/d' \ - settings.gradle.kts - - - name: Exclude android modules from ignore list - run: | - sed -i \ - -e '/.*"sentry-uitest-android",/d' \ - -e '/.*"sentry-uitest-android-benchmark",/d' \ - -e '/.*"sentry-uitest-android-critical",/d' \ - -e '/.*"test-app-sentry",/d' \ - -e '/.*"test-app-size",/d' \ - -e '/.*"sentry-samples-android",/d' \ - build.gradle.kts - - - name: Build SDK - run: | - ./gradlew assemble --parallel + ./gradlew \ + :sentry-samples:sentry-samples-spring-boot-4:bootJar \ + :sentry-samples:sentry-samples-spring-boot-4:testClasses \ + :sentry-samples:sentry-samples-spring-boot-4-webflux:bootJar \ + :sentry-samples:sentry-samples-spring-boot-4-webflux:testClasses \ + :sentry-samples:sentry-samples-spring-boot-4-opentelemetry:bootJar \ + :sentry-samples:sentry-samples-spring-boot-4-opentelemetry:testClasses \ + :sentry-samples:sentry-samples-spring-boot-4-opentelemetry-noagent:bootJar \ + :sentry-samples:sentry-samples-spring-boot-4-opentelemetry-noagent:testClasses \ + :sentry-samples:sentry-samples-spring-7:war \ + :sentry-samples:sentry-samples-spring-7:testClasses \ + :sentry-opentelemetry:sentry-opentelemetry-agent:assemble - name: Run sentry-samples-spring-boot-4 run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-4" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Run sentry-samples-spring-boot-4-webflux run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-4-webflux" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Run sentry-samples-spring-boot-4-opentelemetry agent init true run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-4-opentelemetry" \ --agent true \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Run sentry-samples-spring-boot-4-opentelemetry agent init false run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-4-opentelemetry" \ --agent true \ - --auto-init "false" \ - --build "true" + --auto-init "false" - name: Run sentry-samples-spring-boot-4-opentelemetry-noagent run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-boot-4-opentelemetry-noagent" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Run sentry-samples-spring-7 run: | python3 test/system-test-runner.py test \ --module "sentry-samples-spring-7" \ --agent false \ - --auto-init "true" \ - --build "true" + --auto-init "true" - name: Upload test results if: always() From 0456f5cda95b2b91962216f24628a5ecfbebd594 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:06:41 +0200 Subject: [PATCH 190/391] chore(deps): bump the github-actions group across 1 directory with 3 updates (#5519) Bumps the github-actions group with 3 updates in the / directory: [codecov/codecov-action](https://github.com/codecov/codecov-action), [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) and [getsentry/craft](https://github.com/getsentry/craft). Updates `codecov/codecov-action` from 6.0.1 to 7.0.0 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/e79a6962e0d4c0c17b229090214935d2e33f8354...fb8b3582c8e4def4969c97caa2f19720cb33a72f) Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.8 to 2.26.9 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/4468eb9e399655a61c770534dacc03139d98aa18...6143e76379c342e247687c4ab5c83d8b900cc273) Updates `getsentry/craft` from 2.26.8 to 2.26.9 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/4468eb9e399655a61c770534dacc03139d98aa18...6143e76379c342e247687c4ab5c83d8b900cc273) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft dependency-version: 2.26.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d9e2a3ba38..bb1f45dd60d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: SENTRY_PROJECT: sentry-android - name: Upload coverage to Codecov - uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # pin@v4 + uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # pin@v4 with: name: sentry-java fail_ci_if_error: false diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index 612cc5b52f3..ad0c577b29f 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@4468eb9e399655a61c770534dacc03139d98aa18 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@6143e76379c342e247687c4ab5c83d8b900cc273 # v2 secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6964cec4ba..36732d3874d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@4468eb9e399655a61c770534dacc03139d98aa18 # v2 + uses: getsentry/craft@6143e76379c342e247687c4ab5c83d8b900cc273 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From 3594cd9accff22d8fc383bafc87965ec3b2f8d83 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 10 Jun 2026 14:25:15 +0200 Subject: [PATCH 191/391] ref(core): Reduce unnecessary boxing and redundant null checks (JAVA-554) (#5520) * ref(core): Use static compare and drop redundant null checks Replace boxed Long.valueOf(...).compareTo(...) with Long.compare(...), which avoids the unnecessary boxing. Also remove the redundant != null checks that precede an instanceof, since instanceof already returns false for null. Co-Authored-By: Claude Opus 4.8 * ref(core): Remove unnecessary boxing (JAVA-554) Replace Integer.valueOf/Double.valueOf boxing with primitives or the appropriate parse method. String.format takes the primitives directly, the double conversions only need a cast, and the version check parses straight to a primitive double via Double.parseDouble. Co-Authored-By: Claude Opus 4.8 * changelog * ref(core): Drop redundant StringBuilder in hashing helper (JAVA-554) Return the hex string directly instead of wrapping it in a StringBuilder only to immediately call toString(). Co-Authored-By: Claude Opus 4.8 * ref(core): Use StandardCharsets.UTF_8 and tidy comments (JAVA-554) Replace Charset.forName("UTF-8") with the StandardCharsets constant, which avoids the lookup and cannot throw a checked exception. Also collapse the leftover hashing comments into one. Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.8 --- CHANGELOG.md | 1 + sentry/src/main/java/io/sentry/CircularFifoQueue.java | 3 +-- sentry/src/main/java/io/sentry/DateUtils.java | 4 ++-- .../src/main/java/io/sentry/ScopesStorageFactory.java | 2 +- sentry/src/main/java/io/sentry/SentryDate.java | 2 +- sentry/src/main/java/io/sentry/SentryNanotimeDate.java | 6 +++--- sentry/src/main/java/io/sentry/SpanFactoryFactory.java | 2 +- .../eventprocessor/EventProcessorAndOrder.java | 2 +- sentry/src/main/java/io/sentry/protocol/Contexts.java | 2 +- .../src/main/java/io/sentry/util/LifecycleHelper.java | 2 +- sentry/src/main/java/io/sentry/util/Platform.java | 2 +- sentry/src/main/java/io/sentry/util/StringUtils.java | 10 ++++------ 12 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be4a5f7628d..6a813a8e7b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Improvements - Improve SDK init performance by replacing `java.net.URI` with custom string parsing for DSN ([#5448](https://github.com/getsentry/sentry-java/pull/5448)) +- Remove unnecessary boxing to improve performance ([#5520](https://github.com/getsentry/sentry-java/pull/5520)) ### Fixes diff --git a/sentry/src/main/java/io/sentry/CircularFifoQueue.java b/sentry/src/main/java/io/sentry/CircularFifoQueue.java index 8fa72e39d56..4c6a123d512 100644 --- a/sentry/src/main/java/io/sentry/CircularFifoQueue.java +++ b/sentry/src/main/java/io/sentry/CircularFifoQueue.java @@ -258,8 +258,7 @@ public boolean add(final @NotNull E element) { if (index < 0 || index >= sz) { throw new NoSuchElementException( String.format( - "The specified index (%1$d) is outside the available range [0, %2$d)", - Integer.valueOf(index), Integer.valueOf(sz))); + "The specified index (%1$d) is outside the available range [0, %2$d)", index, sz)); } final int idx = (start + index) % maxElements; diff --git a/sentry/src/main/java/io/sentry/DateUtils.java b/sentry/src/main/java/io/sentry/DateUtils.java index 31a8dcd76ea..f7c46844edc 100644 --- a/sentry/src/main/java/io/sentry/DateUtils.java +++ b/sentry/src/main/java/io/sentry/DateUtils.java @@ -115,7 +115,7 @@ public static double nanosToMillis(final double nanos) { * @return date rounded down to milliseconds */ public static Date nanosToDate(final long nanos) { - final Double millis = nanosToMillis(Double.valueOf(nanos)); + final Double millis = nanosToMillis((double) nanos); return getDateTime(millis.longValue()); } @@ -137,7 +137,7 @@ public static Date nanosToDate(final long nanos) { * @return seconds */ public static double nanosToSeconds(final long nanos) { - return Double.valueOf(nanos) / (1000.0 * 1000.0 * 1000.0); + return (double) nanos / (1000.0 * 1000.0 * 1000.0); } /** diff --git a/sentry/src/main/java/io/sentry/ScopesStorageFactory.java b/sentry/src/main/java/io/sentry/ScopesStorageFactory.java index 89fa6389072..37c0acf2314 100644 --- a/sentry/src/main/java/io/sentry/ScopesStorageFactory.java +++ b/sentry/src/main/java/io/sentry/ScopesStorageFactory.java @@ -29,7 +29,7 @@ public final class ScopesStorageFactory { try { final @Nullable Object otelScopesStorage = otelScopesStorageClazz.getDeclaredConstructor().newInstance(); - if (otelScopesStorage != null && otelScopesStorage instanceof IScopesStorage) { + if (otelScopesStorage instanceof IScopesStorage) { return (IScopesStorage) otelScopesStorage; } } catch (InstantiationException e) { diff --git a/sentry/src/main/java/io/sentry/SentryDate.java b/sentry/src/main/java/io/sentry/SentryDate.java index d2620ab3024..03ea596b07a 100644 --- a/sentry/src/main/java/io/sentry/SentryDate.java +++ b/sentry/src/main/java/io/sentry/SentryDate.java @@ -47,6 +47,6 @@ public final boolean isAfter(final @NotNull SentryDate otherDate) { @Override public int compareTo(@NotNull SentryDate otherDate) { - return Long.valueOf(nanoTimestamp()).compareTo(otherDate.nanoTimestamp()); + return Long.compare(nanoTimestamp(), otherDate.nanoTimestamp()); } } diff --git a/sentry/src/main/java/io/sentry/SentryNanotimeDate.java b/sentry/src/main/java/io/sentry/SentryNanotimeDate.java index 2993eeed6c6..98c46ad5325 100644 --- a/sentry/src/main/java/io/sentry/SentryNanotimeDate.java +++ b/sentry/src/main/java/io/sentry/SentryNanotimeDate.java @@ -46,7 +46,7 @@ public long nanoTimestamp() { @Override public long laterDateNanosTimestampByDiff(final @Nullable SentryDate otherDate) { - if (otherDate != null && otherDate instanceof SentryNanotimeDate) { + if (otherDate instanceof SentryNanotimeDate) { final @NotNull SentryNanotimeDate otherNanoDate = (SentryNanotimeDate) otherDate; if (compareTo(otherDate) < 0) { return nanotimeDiff(this, otherNanoDate); @@ -66,9 +66,9 @@ public int compareTo(@NotNull SentryDate otherDate) { final long thisDateMillis = date.getTime(); final long otherDateMillis = otherNanoDate.date.getTime(); if (thisDateMillis == otherDateMillis) { - return Long.valueOf(nanos).compareTo(otherNanoDate.nanos); + return Long.compare(nanos, otherNanoDate.nanos); } else { - return Long.valueOf(thisDateMillis).compareTo(otherDateMillis); + return Long.compare(thisDateMillis, otherDateMillis); } } else { return super.compareTo(otherDate); diff --git a/sentry/src/main/java/io/sentry/SpanFactoryFactory.java b/sentry/src/main/java/io/sentry/SpanFactoryFactory.java index 7dbb9f1f588..f0e3fcbb3c7 100644 --- a/sentry/src/main/java/io/sentry/SpanFactoryFactory.java +++ b/sentry/src/main/java/io/sentry/SpanFactoryFactory.java @@ -21,7 +21,7 @@ public final class SpanFactoryFactory { try { final @Nullable Object otelSpanFactory = otelSpanFactoryClazz.getDeclaredConstructor().newInstance(); - if (otelSpanFactory != null && otelSpanFactory instanceof ISpanFactory) { + if (otelSpanFactory instanceof ISpanFactory) { return (ISpanFactory) otelSpanFactory; } } catch (InstantiationException e) { diff --git a/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java b/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java index 1f504f25557..1ca5f70df8f 100644 --- a/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java +++ b/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java @@ -29,6 +29,6 @@ public EventProcessorAndOrder( @Override public int compareTo(@NotNull EventProcessorAndOrder o) { - return order.compareTo(o.order); + return Long.compare(order, o.order); } } diff --git a/sentry/src/main/java/io/sentry/protocol/Contexts.java b/sentry/src/main/java/io/sentry/protocol/Contexts.java index fd1e9b83eb6..35168e5bcc2 100644 --- a/sentry/src/main/java/io/sentry/protocol/Contexts.java +++ b/sentry/src/main/java/io/sentry/protocol/Contexts.java @@ -282,7 +282,7 @@ public void putAll(final @Nullable Contexts contexts) { @Override public boolean equals(final @Nullable Object obj) { - if (obj != null && obj instanceof Contexts) { + if (obj instanceof Contexts) { final @NotNull Contexts otherContexts = (Contexts) obj; return internalStorage.equals(otherContexts.internalStorage); } diff --git a/sentry/src/main/java/io/sentry/util/LifecycleHelper.java b/sentry/src/main/java/io/sentry/util/LifecycleHelper.java index 4a029f620cc..fc6e9e74120 100644 --- a/sentry/src/main/java/io/sentry/util/LifecycleHelper.java +++ b/sentry/src/main/java/io/sentry/util/LifecycleHelper.java @@ -7,7 +7,7 @@ public final class LifecycleHelper { public static void close(final @Nullable Object tokenObject) { - if (tokenObject != null && tokenObject instanceof ISentryLifecycleToken) { + if (tokenObject instanceof ISentryLifecycleToken) { final @NotNull ISentryLifecycleToken token = (ISentryLifecycleToken) tokenObject; token.close(); } diff --git a/sentry/src/main/java/io/sentry/util/Platform.java b/sentry/src/main/java/io/sentry/util/Platform.java index b08b6e584fb..cc924fb2815 100644 --- a/sentry/src/main/java/io/sentry/util/Platform.java +++ b/sentry/src/main/java/io/sentry/util/Platform.java @@ -23,7 +23,7 @@ public final class Platform { try { final @Nullable String javaStringVersion = System.getProperty("java.specification.version"); if (javaStringVersion != null) { - final @NotNull double javaVersion = Double.valueOf(javaStringVersion); + final @NotNull double javaVersion = Double.parseDouble(javaStringVersion); isJavaNinePlus = javaVersion >= 9.0; } else { isJavaNinePlus = false; diff --git a/sentry/src/main/java/io/sentry/util/StringUtils.java b/sentry/src/main/java/io/sentry/util/StringUtils.java index 66e3a95ddb7..02d7d4636a4 100644 --- a/sentry/src/main/java/io/sentry/util/StringUtils.java +++ b/sentry/src/main/java/io/sentry/util/StringUtils.java @@ -4,6 +4,7 @@ import io.sentry.SentryLevel; import java.math.BigInteger; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.CharacterIterator; @@ -18,7 +19,7 @@ @ApiStatus.Internal public final class StringUtils { - private static final Charset UTF_8 = Charset.forName("UTF-8"); + private static final Charset UTF_8 = StandardCharsets.UTF_8; public static final String PROPER_NIL_UUID = "00000000-0000-0000-0000-000000000000"; private static final String CORRUPTED_NIL_UUID = "0000-0000"; @@ -142,11 +143,8 @@ private StringUtils() {} // Convert byte array into signum representation final BigInteger no = new BigInteger(1, messageDigest); - // Convert message digest into hex value - final StringBuilder stringBuilder = new StringBuilder(no.toString(16)); - - // return the HashText - return stringBuilder.toString(); + // Convert message digest into hex value and return the HashText + return no.toString(16); } // For specifying wrong message digest algorithms From b88ded98ebe81fc24dde6129f8d397da9b1dcf61 Mon Sep 17 00:00:00 2001 From: markushi <1411808+markushi@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:38:25 +0000 Subject: [PATCH 192/391] release: 8.43.2 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a813a8e7b6..1f7529b728f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.43.2 ### Improvements diff --git a/gradle.properties b/gradle.properties index eee4b292bff..35641a00053 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.43.1 +versionName=8.43.2 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From a28ff1255339a733196c2151b2b56742aae1211e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 09:23:15 +0200 Subject: [PATCH 193/391] chore(deps): bump the github-actions group with 2 updates (#5526) Bumps the github-actions group with 2 updates: [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) and [getsentry/craft](https://github.com/getsentry/craft). Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.9 to 2.26.10 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/6143e76379c342e247687c4ab5c83d8b900cc273...acdb88019720182caf57293360d7cdc8db9e75ac) Updates `getsentry/craft` from 2.26.9 to 2.26.10 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/6143e76379c342e247687c4ab5c83d8b900cc273...acdb88019720182caf57293360d7cdc8db9e75ac) --- updated-dependencies: - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft dependency-version: 2.26.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index ad0c577b29f..d814ca72002 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@6143e76379c342e247687c4ab5c83d8b900cc273 # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@acdb88019720182caf57293360d7cdc8db9e75ac # v2 secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36732d3874d..eddeaa24cd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@6143e76379c342e247687c4ab5c83d8b900cc273 # v2 + uses: getsentry/craft@acdb88019720182caf57293360d7cdc8db9e75ac # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: From 8330a1be3553835c8c54fa993396afea48b0ef98 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 11 Jun 2026 09:33:11 +0200 Subject: [PATCH 194/391] ref(core): Avoid boxing in DateUtils.nanosToDate (#5523) * ref(core): Avoid boxing in DateUtils.nanosToDate nanosToMillis already returns a primitive double, but the result was stored in a boxed Double and then unboxed again via longValue(). Keep the value primitive to drop the redundant allocation and unboxing on this conversion, which runs whenever a SentryDate is turned into a java.util.Date. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 6 ++++++ sentry/src/main/java/io/sentry/DateUtils.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f7529b728f..ba25b7d588a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Improvements + +- Reduce unboxing in `DateUtils.nanosToDate` ([#5523](https://github.com/getsentry/sentry-java/pull/5523)) + ## 8.43.2 ### Improvements diff --git a/sentry/src/main/java/io/sentry/DateUtils.java b/sentry/src/main/java/io/sentry/DateUtils.java index f7c46844edc..5e55512ae70 100644 --- a/sentry/src/main/java/io/sentry/DateUtils.java +++ b/sentry/src/main/java/io/sentry/DateUtils.java @@ -115,8 +115,8 @@ public static double nanosToMillis(final double nanos) { * @return date rounded down to milliseconds */ public static Date nanosToDate(final long nanos) { - final Double millis = nanosToMillis((double) nanos); - return getDateTime(millis.longValue()); + final double millis = nanosToMillis((double) nanos); + return getDateTime((long) millis); } public static @Nullable Date toUtilDate(final @Nullable SentryDate sentryDate) { From b988b37098f9350428c60c0d5ad8f8b11b872b84 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 11 Jun 2026 14:30:33 +0200 Subject: [PATCH 195/391] perf(core): Use fixed-delay scheduling for performance collector (JAVA-555) (#5524) * perf(core): Use fixed-delay scheduling for performance collector Switch the transaction collection timer from scheduleAtFixedRate to schedule. Fixed-rate scheduling fires rapid catch-up executions after a delay or GC pause, which the old code guarded against with a 10ms skip check. Fixed-delay scheduling spaces each collection 100ms after the previous one finishes, so the catch-up bursts cannot happen and the guard, its timestamp field, and the stale comment are no longer needed. Co-Authored-By: Claude Opus 4.8 * changelog * test(core): Verify schedule instead of scheduleAtFixedRate The performance collector now uses fixed-delay scheduling, so the timer verifications assert schedule(...) rather than scheduleAtFixedRate(...). Co-Authored-By: Claude Opus 4.8 * changelog --------- Co-authored-by: Claude Opus 4.8 --- CHANGELOG.md | 4 ++++ .../DefaultCompositePerformanceCollector.java | 11 +---------- .../DefaultCompositePerformanceCollectorTest.kt | 16 ++++++++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba25b7d588a..407eb12d201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Reduce unboxing in `DateUtils.nanosToDate` ([#5523](https://github.com/getsentry/sentry-java/pull/5523)) +### Fixes + +- Fix performance collector scheduling many tasks in a row ([#5524](https://github.com/getsentry/sentry-java/pull/5524)) + ## 8.43.2 ### Improvements diff --git a/sentry/src/main/java/io/sentry/DefaultCompositePerformanceCollector.java b/sentry/src/main/java/io/sentry/DefaultCompositePerformanceCollector.java index 1861381a853..4736ab8fac5 100644 --- a/sentry/src/main/java/io/sentry/DefaultCompositePerformanceCollector.java +++ b/sentry/src/main/java/io/sentry/DefaultCompositePerformanceCollector.java @@ -27,7 +27,6 @@ public final class DefaultCompositePerformanceCollector implements CompositePerf private final @NotNull SentryOptions options; private final @NotNull AtomicBoolean isStarted = new AtomicBoolean(false); - private long lastCollectionTimestamp = 0; public DefaultCompositePerformanceCollector(final @NotNull SentryOptions options) { this.options = Objects.requireNonNull(options, "The options object is required."); @@ -112,16 +111,8 @@ public void run() { new TimerTask() { @Override public void run() { - long now = System.currentTimeMillis(); - // The timer is scheduled to run every 100ms on average. In case it takes longer, - // subsequent tasks are executed more quickly. If two tasks are scheduled to run in - // less than 10ms, the measurement that we collect is not meaningful, so we skip it - if (now - lastCollectionTimestamp <= 10) { - return; - } timedOutTransactions.clear(); - lastCollectionTimestamp = now; final @NotNull PerformanceCollectionData tempData = new PerformanceCollectionData(options.getDateProvider().now().nanoTimestamp()); @@ -147,7 +138,7 @@ public void run() { } } }; - timer.scheduleAtFixedRate( + timer.schedule( timerTask, TRANSACTION_COLLECTION_INTERVAL_MILLIS, TRANSACTION_COLLECTION_INTERVAL_MILLIS); diff --git a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt index 46c304358df..ceec3571ebd 100644 --- a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt +++ b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt @@ -86,7 +86,7 @@ class DefaultCompositePerformanceCollectorTest { val collector = fixture.getSut(null, null) assertTrue(fixture.options.performanceCollectors.isEmpty()) collector.start(fixture.transaction1) - verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any(), any()) + verify(fixture.mockTimer, never())!!.schedule(any(), any(), any()) } @Test @@ -104,14 +104,14 @@ class DefaultCompositePerformanceCollectorTest { fun `when start, timer is scheduled every 100 milliseconds`() { val collector = fixture.getSut() collector.start(fixture.transaction1) - verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer)!!.schedule(any(), any(), eq(100)) } @Test fun `when start with a string, timer is scheduled every 100 milliseconds`() { val collector = fixture.getSut() collector.start(fixture.id1) - verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer)!!.schedule(any(), any(), eq(100)) } @Test @@ -119,7 +119,7 @@ class DefaultCompositePerformanceCollectorTest { val collector = fixture.getSut() collector.start(fixture.transaction1) collector.stop(fixture.transaction1) - verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer)!!.schedule(any(), any(), eq(100)) verify(fixture.mockTimer)!!.cancel() } @@ -128,7 +128,7 @@ class DefaultCompositePerformanceCollectorTest { val collector = fixture.getSut() collector.start(fixture.id1) collector.stop(fixture.id1) - verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer)!!.schedule(any(), any(), eq(100)) verify(fixture.mockTimer)!!.cancel() } @@ -136,7 +136,7 @@ class DefaultCompositePerformanceCollectorTest { fun `stopping a not collected transaction return null`() { val collector = fixture.getSut() val data = collector.stop(fixture.transaction1) - verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer, never())!!.schedule(any(), any(), eq(100)) verify(fixture.mockTimer, never())!!.cancel() assertNull(data) } @@ -145,7 +145,7 @@ class DefaultCompositePerformanceCollectorTest { fun `stopping a not collected id return null`() { val collector = fixture.getSut() val data = collector.stop(fixture.id1) - verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer, never())!!.schedule(any(), any(), eq(100)) verify(fixture.mockTimer, never())!!.cancel() assertNull(data) } @@ -316,7 +316,7 @@ class DefaultCompositePerformanceCollectorTest { collector.close() // Timer was canceled - verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any(), eq(100)) + verify(fixture.mockTimer)!!.schedule(any(), any(), eq(100)) verify(fixture.mockTimer)!!.cancel() // Data was cleared From 46b442bde01e6922493733151c6bb41106764cff Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 11 Jun 2026 16:49:14 +0200 Subject: [PATCH 196/391] ref(core): Use primitive long for EventProcessorAndOrder.order (#5527) * ref(core): Use primitive long for EventProcessorAndOrder.order Avoid boxing by storing the order as a primitive long instead of a boxed Long. The constructor already normalizes a null order to System.nanoTime(), so the field never needs to represent null. Co-Authored-By: Claude Opus 4.8 * changelog * changelog --------- Co-authored-by: Claude Opus 4.8 --- CHANGELOG.md | 2 +- .../sentry/internal/eventprocessor/EventProcessorAndOrder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 407eb12d201..9b42d4bd09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Improvements -- Reduce unboxing in `DateUtils.nanosToDate` ([#5523](https://github.com/getsentry/sentry-java/pull/5523)) +- Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527)) ### Fixes diff --git a/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java b/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java index 1ca5f70df8f..38ff7802f58 100644 --- a/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java +++ b/sentry/src/main/java/io/sentry/internal/eventprocessor/EventProcessorAndOrder.java @@ -7,7 +7,7 @@ public final class EventProcessorAndOrder implements Comparable { private final @NotNull EventProcessor eventProcessor; - private final @NotNull Long order; + private final long order; public EventProcessorAndOrder( final @NotNull EventProcessor eventProcessor, final @Nullable Long order) { From 85fd8b11a0c380fa02410ab8ac09a87d38a16e62 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Fri, 12 Jun 2026 14:42:12 +0200 Subject: [PATCH 197/391] feat(android): Add standalone app start tracing (#5342) * feat: Add standalone app start transaction (happy path) Introduce experimental `enableStandaloneAppStartTracing` option that creates a separate app start transaction instead of attaching app start as a child span of the first activity transaction. This is the happy path only (foreground importance, activity launch, first frame drawn as end time). The standalone transaction shares the same trace ID as the activity transaction but is not bound to the scope. App start measurements and child spans (process init, content providers, application.onCreate) are attached to the standalone transaction instead of the activity transaction. Includes foreground importance check branching to prepare for the non-activity launch path (next PR). Co-Authored-By: Claude Opus 4.6 (1M context) * feat: Add non-activity app start path with end time resolution When the app starts without launching an activity (service, broadcast receiver, content provider), create a standalone app start transaction with the end time determined by priority: 1. onApplicationPostCreate (Gradle plugin bytecode instrumentation) 2. ApplicationStartInfo timestamps (API 35+) 3. firstIdle - main thread idle handler (pre-API 35 fallback) The non-activity app start transaction stores its trace ID so that if an activity is later launched, the activity transaction reuses the same trace ID to keep both in the same trace. Adds OnNoActivityStartedListener callback from AppStartMetrics to ActivityLifecycleIntegration, triggered by checkCreateTimeOnMain() when no activity was created after Application.onCreate(). Co-Authored-By: Claude Opus 4.6 (1M context) * feat: Support non-activity app start tracing without bytecode instrumentation When an app is launched via broadcast receiver, service, or content provider (no activity), detect this via Handler.post() and create a standalone app start transaction. Resolves app start end time with priority: Gradle plugin > ApplicationStartInfo (API 35+) > process init time. Also attaches child spans (process init, content providers, Application.onCreate) to standalone transactions. Co-Authored-By: Claude Opus 4.6 (1M context) * refactor: Consolidate non-activity app start time-span resolution Extract the "try appStartSpan, fall back to sdkInitTimeSpan" logic used for standalone (non-activity) app start transactions into a new AppStartMetrics.getAppStartTimeSpanDirect() helper, removing the duplicated inline fallback in ActivityLifecycleIntegration and the private helper in PerformanceAndroidEventProcessor. Also cache the API 35+ ApplicationStartInfo on registerLifecycleCallbacks so onAppStartSpansSent no longer re-queries ActivityManager, and simplify the non-activity detection path to always use the main-thread IdleHandler. Regenerates the sentry-android-core API to include method additions missed in prior commits on this branch (standalone-app-start options, trace id accessors, OnNoActivityStartedListener). Co-Authored-By: Claude Opus 4.7 (1M context) * chore(samples): Register TestBroadcastReceiver in manifest Wires up the TestBroadcastReceiver added earlier so the sample app can trigger a non-activity cold start via `adb shell am broadcast`. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(app-start): resolve standalone tracing misclassification and duplicate emission Two pre-merge fixes for the standalone app-start tracing path introduced on this branch (issue #5046): - AppStartMetrics.checkCreateTimeOnMain() now defaults appStartType to COLD when UNKNOWN with no active activities. On API < 35 (where ApplicationStartInfo is unavailable) non-activity cold starts were stuck at UNKNOWN, which both misclassified the standalone transaction as App Start Warm and caused PerformanceAndroidEventProcessor.attachAppStartSpans to early-return (dropping process.load / application.load / contentprovider.load phase spans). - ActivityLifecycleIntegration.onActivityPreCreated() now skips emitting a second standalone App Start transaction when the non-activity path has already reported the process's app start (detected via the stashed appStartTraceId). Previously a broadcast followed by an activity launch produced two standalone transactions (a spurious App Start Warm in addition to the broadcast's App Start Cold), violating one-per-process semantics. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(android): refine standalone app start tracing * chore: Update generated files * style(core): Apply spotless formatting * changelog * fix(android): Use stable app start transaction name Rename the standalone app-start transaction to a single App Start name so cold and warm starts group consistently while preserving the app.start op. Co-authored-by: Cursor * feat(android): Add standalone app start tracing Co-authored-by: Cursor * fix(android): Handle non-activity app starts below API 24 Co-authored-by: Cursor * fix(android): Guard app start timestamp clock base Co-authored-by: Cursor * ref(android): Remove app start reason plumbing Co-authored-by: Cursor * ref(android): Clarify no-activity app start handling Rename the private app start helper to reflect that it conditionally handles non-activity starts. Keep comments and tests focused on behavior. Co-Authored-By: Claude Co-authored-by: Cursor * docs(android): Clarify non-activity app start fallback Explain why unresolved non-activity starts default to cold when Activity signals or ApplicationStartInfo classification are unavailable. Co-Authored-By: Claude Co-authored-by: Cursor * fix(android): Preserve legacy no-activity app start guard Only run the no-activity startup check for unresolved app starts or when standalone app start tracing registered a listener. This keeps API 35 ApplicationStartInfo classifications from triggering legacy side effects. Co-Authored-By: Claude Co-authored-by: Cursor * test(android): Opt into standalone no-activity API 35 tests Register a no-op no-activity listener for API 35 end-time resolution tests so they exercise the standalone path under the restored legacy guard. Co-Authored-By: Claude Co-authored-by: Cursor * fix(android): Schedule no-activity idle check when standalone listener is set on API 35+ On API 35+, ApplicationStartInfo resolves appStartType before the standalone app start listener is installed, causing the idle handler condition to be false and skipping the no-activity detection entirely. Register the idle handler from setOnNoActivityStartedListener when the type is already resolved, ensuring onNoActivityStarted() fires for standalone app start tracing on API 35+ devices. Co-authored-by: Cursor * ref(android): Remove dead foregroundImportance check in standalone app start path The foregroundImportance guard was always true at that point because appStartTime is only set to non-null inside the foregroundImportance branch. Remove the redundant check and the misleading else comment that described an unreachable code path. Co-authored-by: Cursor * fix(android): Prevent duplicate standalone app start measurements Require the app-start pending flag even when standalone app-start transactions bypass foreground checks. Preserve completed non-activity app-start timings so fallback resolution does not overwrite stopped spans. Co-authored-by: Cursor * ref(android): Remove unused app start application context Drop dead AppStartMetrics state that was assigned during lifecycle callback registration but never read. Co-authored-by: Cursor * ref(android): Rename getAppStartTimeSpanDirect to getAppStartTimeSpanForStandalone Co-authored-by: Cursor * fix(android): Do not set TTID/TTFD contributing flags on standalone app start spans Co-authored-by: Cursor * fix(android): Add volatile to noActivityStartedListener for cross-thread visibility The field is written by setOnNoActivityStartedListener (called during Sentry.init(), potentially on a background thread) and read on the main thread in handleNoActivityStartIfNeededOnMain. Without volatile, the JMM permits the main thread to see a stale null, silently skipping the listener and preventing standalone app-start transaction creation. Co-authored-by: Cursor * fix(android): Clear stale app start sampling decision in non-activity start path onNoActivityStarted() did not clear the appStartSamplingDecision, which could leak to the first ui.load transaction when an activity eventually starts after a non-activity process launch. Co-authored-by: Cursor * fix: Format adb test commands in TestBroadcastReceiver JavaDoc Co-authored-by: Cursor * ref(android): Rename headless app start handling Use headless terminology for app starts that do not reach an Activity and schedule the headless check from lifecycle callback registration. This removes listener setter side effects while preserving standalone app-start behavior. Co-Authored-By: Claude Co-authored-by: Cursor * fix(android): Align foreground app start measurements Use the foreground app start fallback for foreground standalone app start transactions so measurements match the transaction timestamp. Keep the headless-only span source limited to true headless starts. Co-authored-by: Cursor * fix(android): Gate headless app start end time Resolve the headless app start end timestamp only when standalone headless tracing is active. This avoids stopping legacy app start spans before a later foreground Activity can finish them. Co-authored-by: Cursor * test(android): Update API 35 headless app start expectation Make the ApplicationStartInfo headless test install the listener that now gates headless end-time resolution, matching the standalone path. Co-authored-by: Cursor * Fix headless app-start idle scheduling * ref(android): Clarify headless app start state names Rename private headless app start flags to distinguish the pending main-thread check from the one-shot listener invocation guard. No behavior change. Co-Authored-By: Claude Co-authored-by: Cursor * ref(android): Use app.start origin for headless app start transaction Set the standalone headless app start transaction origin to `auto.app.start` instead of `auto.ui.activity`, which was semantically incorrect for non-activity (broadcast/service/content provider) starts. Also simplify the API 35+ ApplicationStartInfo onCreate timestamp resolution by using the reported nanos directly as the uptime base. Co-authored-by: Cursor * ref(android): refine standalone app start trace continuation Drop the redundant trace-id sharing TransactionContext constructor; the ui.load now shares the app.start trace solely through continueTrace. Don't connect a headless app.start and a following activity's ui.load into the same trace when they are more than 1 minute apart, since such a large gap means they no longer belong to the same launch. Co-authored-by: Cursor * fix(android): align headless app start tests with uptime-based onCreate timestamp ApplicationStartInfo's START_TIMESTAMP_APPLICATION_ONCREATE is captured via SystemClock.uptimeNanos(), the same base as TimeSpan, so no clock re-anchoring is needed. Add the missing headless test setup (foreground-importance stubbing) and fix the API 35 timestamp test to use uptime semantics. Co-authored-by: Cursor * test(android): add standalone app start E2E harness Wire the Android sample app for manual standalone app-start validation and add a reusable harness plus notes for the scenarios verified locally. Trim redundant comments around app-start trace continuation while keeping the non-obvious sampling and parentage details. Co-Authored-By: Claude Co-authored-by: Cursor * chore(android): remove standalone app start report Co-authored-by: Cursor * test(android): clarify app start transaction shapes Co-authored-by: Cursor * chore(android): remove standalone app start harness Co-authored-by: Cursor * fix(android): Preserve app start activity counter Keep the foreground headless guard from faking an observed activity so late standalone app start init still lets the first real activity classify startup and reset warm-start state correctly. Co-authored-by: Cursor * fix(android): Finish app start after activity spans Keep standalone app-start transactions open until activity lifecycle spans are attached so early app-start completion does not drop activity spans. Co-Authored-By: Cursor * feat(samples): enable standalone app start tracing and add headless-start broadcast receiver Co-authored-by: Cursor * fix(changelog): resolve merge conflict and keep standalone app start entry under Unreleased Co-authored-by: Cursor * docs(options): Clarify standalone app start javadoc per review - Use plain quotes for the "App Start" transaction name instead of {@code} - Clarify that the API 35 gate refers to the device's runtime OS version Co-Authored-By: Claude Fable 5 * fix(android): Clarify ApplicationStartInfo onCreate timestamp marks onCreate start START_TIMESTAMP_APPLICATION_ONCREATE is captured right before Application.onCreate is invoked (ActivityThread.handleBindApplication), so it is the onCreate start, not its end. Rename locals, fix comments and javadoc accordingly, and drop the applicationOnCreate.setStoppedAt branch which could have recorded a zero-length application.load span. Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: Cursor --- CHANGELOG.md | 8 + .../api/sentry-android-core.api | 17 + .../core/ActivityLifecycleIntegration.java | 293 +++++++-- .../android/core/ManifestMetadataReader.java | 10 + .../PerformanceAndroidEventProcessor.java | 56 +- .../android/core/SentryAndroidOptions.java | 49 ++ .../core/performance/AppStartMetrics.java | 209 ++++++- .../core/ActivityLifecycleIntegrationTest.kt | 554 +++++++++++++++++- .../core/ManifestMetadataReaderTest.kt | 30 + .../PerformanceAndroidEventProcessorTest.kt | 183 +++++- .../android/core/SentryAndroidOptionsTest.kt | 6 + .../core/SentryShadowActivityManager.kt | 13 + .../android/core/SentryShadowProcess.kt | 16 +- .../core/performance/AppStartMetricsTest.kt | 195 +++++- .../performance/AppStartMetricsTestApi35.kt | 130 ++++ .../src/main/AndroidManifest.xml | 13 + .../android/TestBroadcastReceiver.java | 26 + 17 files changed, 1695 insertions(+), 113 deletions(-) create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TestBroadcastReceiver.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b42d4bd09d..cd876f3c57d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +### Features + +- Add `enableStandaloneAppStartTracing` option to send app start as a standalone transaction instead of attaching it as a child span of the first activity transaction ([#5342](https://github.com/getsentry/sentry-java/pull/5342)) + - Disabled by default; opt in via `options.isEnableStandaloneAppStartTracing = true` or manifest meta-data `io.sentry.standalone-app-start-tracing.enable` + - Emits a transaction named `App Start` with op `app.start`, carrying the existing app start measurements and phase spans (`process.load`, `contentprovider.load`, `application.load`, activity lifecycle spans) as direct children of the root + - The standalone transaction shares the same `traceId` as the first `ui.load` activity transaction so they remain linked in the trace view + - Also covers non-activity starts (broadcast receivers, services, content providers) + ### Improvements - Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527)) diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 249549f8366..0500ba44990 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -392,6 +392,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun isEnablePerformanceV2 ()Z public fun isEnableRootCheck ()Z public fun isEnableScopeSync ()Z + public fun isEnableStandaloneAppStartTracing ()Z public fun isEnableSystemEventBreadcrumbs ()Z public fun isEnableSystemEventBreadcrumbsExtras ()Z public fun isReportHistoricalAnrs ()Z @@ -423,6 +424,7 @@ public final class io/sentry/android/core/SentryAndroidOptions : io/sentry/Sentr public fun setEnablePerformanceV2 (Z)V public fun setEnableRootCheck (Z)V public fun setEnableScopeSync (Z)V + public fun setEnableStandaloneAppStartTracing (Z)V public fun setEnableSystemEventBreadcrumbs (Z)V public fun setEnableSystemEventBreadcrumbsExtras (Z)V public fun setFrameMetricsCollector (Lio/sentry/android/core/internal/util/SentryFrameMetricsCollector;)V @@ -740,11 +742,16 @@ public class io/sentry/android/core/performance/AppStartMetrics : io/sentry/andr public fun clear ()V public fun createProcessInitSpan ()Lio/sentry/android/core/performance/TimeSpan; public fun getActivityLifecycleTimeSpans ()Ljava/util/List; + public fun getAppStartBaggageHeader ()Ljava/lang/String; public fun getAppStartContinuousProfiler ()Lio/sentry/IContinuousProfiler; + public fun getAppStartEndTime ()Lio/sentry/SentryDate; public fun getAppStartProfiler ()Lio/sentry/ITransactionProfiler; public fun getAppStartSamplingDecision ()Lio/sentry/TracesSamplingDecision; + public fun getAppStartSentryTraceHeader ()Ljava/lang/String; public fun getAppStartTimeSpan ()Lio/sentry/android/core/performance/TimeSpan; + public fun getAppStartTimeSpanForHeadless ()Lio/sentry/android/core/performance/TimeSpan; public fun getAppStartTimeSpanWithFallback (Lio/sentry/android/core/SentryAndroidOptions;)Lio/sentry/android/core/performance/TimeSpan; + public fun getAppStartTraceId ()Lio/sentry/protocol/SentryId; public fun getAppStartType ()Lio/sentry/android/core/performance/AppStartMetrics$AppStartType; public fun getApplicationOnCreateTimeSpan ()Lio/sentry/android/core/performance/TimeSpan; public fun getClassLoadedUptimeMs ()J @@ -765,12 +772,18 @@ public class io/sentry/android/core/performance/AppStartMetrics : io/sentry/andr public static fun onContentProviderPostCreate (Landroid/content/ContentProvider;)V public fun registerLifecycleCallbacks (Landroid/app/Application;)V public fun setAppLaunchedInForeground (Z)V + public fun setAppStartBaggageHeader (Ljava/lang/String;)V public fun setAppStartContinuousProfiler (Lio/sentry/IContinuousProfiler;)V + public fun setAppStartEndTime (Lio/sentry/SentryDate;)V public fun setAppStartProfiler (Lio/sentry/ITransactionProfiler;)V public fun setAppStartSamplingDecision (Lio/sentry/TracesSamplingDecision;)V + public fun setAppStartSentryTraceHeader (Ljava/lang/String;)V + public fun setAppStartTraceId (Lio/sentry/protocol/SentryId;)V public fun setAppStartType (Lio/sentry/android/core/performance/AppStartMetrics$AppStartType;)V public fun setClassLoadedUptimeMs (J)V + public fun setHeadlessAppStartListener (Lio/sentry/android/core/performance/AppStartMetrics$HeadlessAppStartListener;)V public fun shouldSendStartMeasurements ()Z + public fun shouldSendStartMeasurements (Z)Z } public final class io/sentry/android/core/performance/AppStartMetrics$AppStartType : java/lang/Enum { @@ -781,6 +794,10 @@ public final class io/sentry/android/core/performance/AppStartMetrics$AppStartTy public static fun values ()[Lio/sentry/android/core/performance/AppStartMetrics$AppStartType; } +public abstract interface class io/sentry/android/core/performance/AppStartMetrics$HeadlessAppStartListener { + public abstract fun onHeadlessAppStart ()V +} + public class io/sentry/android/core/performance/TimeSpan : java/lang/Comparable { public fun ()V public fun compareTo (Lio/sentry/android/core/performance/TimeSpan;)I diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java index 9d748e5a27a..19cee7fcce5 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java @@ -9,6 +9,8 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import io.sentry.Baggage; +import io.sentry.BaggageHeader; import io.sentry.FullyDisplayedReporter; import io.sentry.IScope; import io.sentry.IScopes; @@ -18,6 +20,7 @@ import io.sentry.Instrumenter; import io.sentry.Integration; import io.sentry.NoOpTransaction; +import io.sentry.PropagationContext; import io.sentry.SentryDate; import io.sentry.SentryLevel; import io.sentry.SentryNanotimeDate; @@ -33,6 +36,7 @@ import io.sentry.android.core.performance.AppStartMetrics; import io.sentry.android.core.performance.TimeSpan; import io.sentry.protocol.MeasurementValue; +import io.sentry.protocol.SentryId; import io.sentry.protocol.TransactionNameSource; import io.sentry.util.AutoClosableReentrantLock; import io.sentry.util.Objects; @@ -40,6 +44,7 @@ import java.io.Closeable; import java.io.IOException; import java.lang.ref.WeakReference; +import java.util.Collections; import java.util.Date; import java.util.Map; import java.util.WeakHashMap; @@ -55,12 +60,19 @@ public final class ActivityLifecycleIntegration implements Integration, Closeable, Application.ActivityLifecycleCallbacks { static final String UI_LOAD_OP = "ui.load"; + static final String STANDALONE_APP_START_OP = "app.start"; + private static final String STANDALONE_APP_START_NAME = "App Start"; static final String APP_START_WARM = "app.start.warm"; static final String APP_START_COLD = "app.start.cold"; static final String TTID_OP = "ui.load.initial_display"; static final String TTFD_OP = "ui.load.full_display"; static final long TTFD_TIMEOUT_MILLIS = 25000; + // If a headless app start and the following activity's ui.load are more than this far apart, they + // are treated as unrelated and not connected into the same trace. + static final long APP_START_TO_UI_LOAD_CONTINUATION_MAX_GAP_NANOS = TimeUnit.MINUTES.toNanos(1); private static final String TRACE_ORIGIN = "auto.ui.activity"; + static final String APP_START_SCREEN_DATA = "app.vitals.start.screen"; + static final String APP_START_TRACE_ORIGIN = "auto.app.start"; private final @NotNull Application application; private final @NotNull BuildInfoProvider buildInfoProvider; @@ -77,6 +89,7 @@ public final class ActivityLifecycleIntegration private @Nullable FullyDisplayedReporter fullyDisplayedReporter = null; private @Nullable ISpan appStartSpan; + private @Nullable ITransaction appStartTransaction; private final @NotNull WeakHashMap ttidSpanMap = new WeakHashMap<>(); private final @NotNull WeakHashMap ttfdSpanMap = new WeakHashMap<>(); private final @NotNull WeakHashMap activitySpanHelpers = @@ -124,6 +137,11 @@ public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions timeToFullDisplaySpanEnabled = this.options.isEnableTimeToFullDisplayTracing(); application.registerActivityLifecycleCallbacks(this); + + if (performanceEnabled && this.options.isEnableStandaloneAppStartTracing()) { + AppStartMetrics.getInstance().setHeadlessAppStartListener(this::onHeadlessAppStart); + } + this.options.getLogger().log(SentryLevel.DEBUG, "ActivityLifecycleIntegration installed."); addIntegrationToSdkVersion("ActivityLifecycle"); } @@ -135,6 +153,7 @@ private boolean isPerformanceEnabled(final @NotNull SentryAndroidOptions options @Override public void close() throws IOException { application.unregisterActivityLifecycleCallbacks(this); + AppStartMetrics.getInstance().setHeadlessAppStartListener(null); if (options != null) { options.getLogger().log(SentryLevel.DEBUG, "ActivityLifecycleIntegration removed."); @@ -239,33 +258,93 @@ private void startTracing(final @NotNull Activity activity) { transactionOptions.setAppStartTransaction(appStartSamplingDecision != null); setSpanOrigin(transactionOptions); - // we can only bind to the scope if there's no running transaction - ITransaction transaction = - scopes.startTransaction( - new TransactionContext( - activityName, - TransactionNameSource.COMPONENT, - UI_LOAD_OP, - appStartSamplingDecision), - transactionOptions); + final @Nullable SentryId storedAppStartTraceId = + AppStartMetrics.getInstance().getAppStartTraceId(); + final boolean isFollowingHeadlessAppStart = (storedAppStartTraceId != null); + + final boolean isAppStart = + !(firstActivityCreated || appStartTime == null || coldStart == null); + // Foreground starts create app.start first; ui.load then shares its trace. + final boolean createStandaloneAppStart = + isAppStart + && options.isEnableStandaloneAppStartTracing() + && !isFollowingHeadlessAppStart; + + if (createStandaloneAppStart) { + final TransactionOptions appStartTransactionOptions = new TransactionOptions(); + appStartTransactionOptions.setBindToScope(false); + appStartTransactionOptions.setStartTimestamp(appStartTime); + appStartTransactionOptions.setAppStartTransaction(appStartSamplingDecision != null); + appStartTransactionOptions.setOrigin(APP_START_TRACE_ORIGIN); + + appStartTransaction = + scopes.startTransaction( + new TransactionContext( + STANDALONE_APP_START_NAME, + TransactionNameSource.COMPONENT, + STANDALONE_APP_START_OP, + appStartSamplingDecision), + appStartTransactionOptions); + appStartTransaction.setData(APP_START_SCREEN_DATA, activityName); + } + + // Continue either the foreground app.start above or an earlier headless app.start. + final @Nullable String continueSentryTrace; + final @Nullable String continueBaggage; + if (createStandaloneAppStart) { + continueSentryTrace = appStartTransaction.toSentryTrace().getValue(); + final @Nullable BaggageHeader baggageHeader = appStartTransaction.toBaggageHeader(null); + continueBaggage = baggageHeader == null ? null : baggageHeader.getValue(); + } else if (isFollowingHeadlessAppStart + && isWithinAppStartContinuationWindow(ttidStartTime)) { + continueSentryTrace = AppStartMetrics.getInstance().getAppStartSentryTraceHeader(); + continueBaggage = AppStartMetrics.getInstance().getAppStartBaggageHeader(); + } else { + continueSentryTrace = null; + continueBaggage = null; + } + + final @Nullable TransactionContext continuedContext = + continueSentryTrace == null + ? null + : continueUiLoadTrace(continueSentryTrace, continueBaggage, activityName); + + final ITransaction transaction; + if (continuedContext != null) { + transaction = scopes.startTransaction(continuedContext, transactionOptions); + } else { + transaction = + scopes.startTransaction( + new TransactionContext( + activityName, + TransactionNameSource.COMPONENT, + UI_LOAD_OP, + appStartSamplingDecision), + transactionOptions); + } + + if (isFollowingHeadlessAppStart) { + // Consume the stored headless app-start trace so it isn't reused by another activity. + AppStartMetrics.getInstance().setAppStartTraceId(null); + AppStartMetrics.getInstance().setAppStartSentryTraceHeader(null); + AppStartMetrics.getInstance().setAppStartBaggageHeader(null); + } final SpanOptions spanOptions = new SpanOptions(); setSpanOrigin(spanOptions); - // in case appStartTime isn't available, we don't create a span for it. - if (!(firstActivityCreated || appStartTime == null || coldStart == null)) { - // start specific span for app start - appStartSpan = - transaction.startChild( - getAppStartOp(coldStart), - getAppStartDesc(coldStart), - appStartTime, - Instrumenter.SENTRY, - spanOptions); - - // in case there's already an end time (e.g. due to deferred SDK init) - // we can finish the app-start span - finishAppStartSpan(); + if (isAppStart) { + if (!createStandaloneAppStart && !options.isEnableStandaloneAppStartTracing()) { + appStartSpan = + transaction.startChild( + getAppStartOp(coldStart), + getAppStartDesc(coldStart), + appStartTime, + Instrumenter.SENTRY, + spanOptions); + + finishAppStartSpan(); + } } final @NotNull ISpan ttidSpan = transaction.startChild( @@ -316,6 +395,61 @@ private void setSpanOrigin(final @NotNull SpanOptions spanOptions) { spanOptions.setOrigin(TRACE_ORIGIN); } + /** + * Whether the ui.load starting at {@code uiLoadStartTime} is close enough in time to the headless + * app start to belong to the same trace. If they are more than {@link + * #APP_START_TO_UI_LOAD_CONTINUATION_MAX_GAP_NANOS} apart, they are treated as unrelated. When + * the headless end time is unknown, we keep the previous behaviour and continue the trace. + */ + private boolean isWithinAppStartContinuationWindow(final @NotNull SentryDate uiLoadStartTime) { + final @Nullable SentryDate appStartEndTime = AppStartMetrics.getInstance().getAppStartEndTime(); + if (appStartEndTime == null) { + return true; + } + return uiLoadStartTime.diff(appStartEndTime) <= APP_START_TO_UI_LOAD_CONTINUATION_MAX_GAP_NANOS; + } + + /** + * Builds a {@link TransactionContext} for the ui.load transaction that shares the standalone + * app.start trace (same traceId and sampleRand) while staying a sibling (no parentSpanId), rather + * than a child. The continued baggage keeps sampling decisions on the same sampleRand. Returns + * null if the trace cannot be continued, so callers can fall back. + */ + private @Nullable TransactionContext continueUiLoadTrace( + final @NotNull String sentryTrace, + final @Nullable String baggage, + final @NotNull String activityName) { + if (options == null || !options.isTracingEnabled()) { + return null; + } + final @NotNull PropagationContext propagationContext = + PropagationContext.fromHeaders( + options.getLogger(), + sentryTrace, + baggage == null ? null : Collections.singletonList(baggage), + options); + final @Nullable Boolean parentSampled = propagationContext.isSampled(); + final @NotNull Baggage continuedBaggage = propagationContext.getBaggage(); + final @Nullable TracesSamplingDecision parentSamplingDecision = + parentSampled == null + ? null + : new TracesSamplingDecision( + parentSampled, + continuedBaggage.getSampleRate(), + propagationContext.getSampleRand()); + final @NotNull TransactionContext context = + new TransactionContext( + propagationContext.getTraceId(), + propagationContext.getSpanId(), + null, + parentSamplingDecision, + continuedBaggage); + context.setName(activityName); + context.setTransactionNameSource(TransactionNameSource.COMPONENT); + context.setOperation(UI_LOAD_OP); + return context; + } + @VisibleForTesting void applyScope(final @NotNull IScope scope, final @NotNull ITransaction transaction) { scope.withTransaction( @@ -440,8 +574,7 @@ public void onActivityPostCreated( final @NotNull Activity activity, final @Nullable Bundle savedInstanceState) { final ActivityLifecycleSpanHelper helper = activitySpanHelpers.get(activity); if (helper != null) { - helper.createAndStopOnCreateSpan( - appStartSpan != null ? appStartSpan : activitiesWithOngoingTransactions.get(activity)); + helper.createAndStopOnCreateSpan(getAppStartParent(activity)); } } @@ -479,11 +612,11 @@ public void onActivityStarted(final @NotNull Activity activity) { public void onActivityPostStarted(final @NotNull Activity activity) { final ActivityLifecycleSpanHelper helper = activitySpanHelpers.get(activity); if (helper != null) { - helper.createAndStopOnStartSpan( - appStartSpan != null ? appStartSpan : activitiesWithOngoingTransactions.get(activity)); + helper.createAndStopOnStartSpan(getAppStartParent(activity)); // Needed to handle hybrid SDKs helper.saveSpanToAppStartMetrics(); } + finishAppStartSpan(); } @Override @@ -559,6 +692,9 @@ public void onActivityDestroyed(final @NotNull Activity activity) { // in case the appStartSpan isn't completed yet, we finish it as cancelled to avoid // memory leak finishSpan(appStartSpan, SpanStatus.CANCELLED); + if (appStartTransaction != null && !appStartTransaction.isFinished()) { + appStartTransaction.finish(SpanStatus.CANCELLED); + } // we finish the ttidSpan as cancelled in case it isn't completed yet final ISpan ttidSpan = ttidSpanMap.get(activity); @@ -575,6 +711,7 @@ public void onActivityDestroyed(final @NotNull Activity activity) { // set it to null in case its been just finished as cancelled appStartSpan = null; + appStartTransaction = null; ttidSpanMap.remove(activity); ttfdSpanMap.remove(activity); } @@ -637,22 +774,23 @@ private void onFirstFrameDrawn(final @Nullable ISpan ttfdSpan, final @Nullable I final @NotNull AppStartMetrics appStartMetrics = AppStartMetrics.getInstance(); final @NotNull TimeSpan appStartTimeSpan = appStartMetrics.getAppStartTimeSpan(); final @NotNull TimeSpan sdkInitTimeSpan = appStartMetrics.getSdkInitTimeSpan(); + final @Nullable SentryDate firstFrameEndDate = + options != null ? options.getDateProvider().now() : null; // and we need to set the end time of the app start here, after the first frame is drawn. if (appStartTimeSpan.hasStarted() && appStartTimeSpan.hasNotStopped()) { - appStartTimeSpan.stop(); + stopTimeSpanAtDate(appStartTimeSpan, firstFrameEndDate); } if (sdkInitTimeSpan.hasStarted() && sdkInitTimeSpan.hasNotStopped()) { - sdkInitTimeSpan.stop(); + stopTimeSpanAtDate(sdkInitTimeSpan, firstFrameEndDate); } - finishAppStartSpan(); + finishAppStartSpan(firstFrameEndDate); // Sentry.reportFullyDisplayed can be run in any thread, so we have to ensure synchronization // with first frame drawn try (final @NotNull ISentryLifecycleToken ignored = fullyDisplayedLock.acquire()) { - if (options != null && ttidSpan != null) { - final SentryDate endDate = options.getDateProvider().now(); - final long durationNanos = endDate.diff(ttidSpan.getStartDate()); + if (options != null && ttidSpan != null && firstFrameEndDate != null) { + final long durationNanos = firstFrameEndDate.diff(ttidSpan.getStartDate()); final long durationMillis = TimeUnit.NANOSECONDS.toMillis(durationNanos); ttidSpan.setMeasurement( MeasurementValue.KEY_TIME_TO_INITIAL_DISPLAY, durationMillis, MILLISECOND); @@ -664,10 +802,10 @@ private void onFirstFrameDrawn(final @Nullable ISpan ttfdSpan, final @Nullable I MeasurementValue.KEY_TIME_TO_FULL_DISPLAY, durationMillis, MILLISECOND); ttfdSpan.setMeasurement( MeasurementValue.KEY_TIME_TO_FULL_DISPLAY, durationMillis, MILLISECOND); - finishSpan(ttfdSpan, endDate); + finishSpan(ttfdSpan, firstFrameEndDate); } - finishSpan(ttidSpan, endDate); + finishSpan(ttidSpan, firstFrameEndDate); } else { finishSpan(ttidSpan); if (fullyDisplayedCalled) { @@ -677,6 +815,17 @@ private void onFirstFrameDrawn(final @Nullable ISpan ttfdSpan, final @Nullable I } } + private void stopTimeSpanAtDate( + final @NotNull TimeSpan timeSpan, final @Nullable SentryDate endDate) { + final @Nullable SentryDate startDate = timeSpan.getStartTimestamp(); + if (endDate != null && startDate != null) { + final long durationMillis = TimeUnit.NANOSECONDS.toMillis(endDate.diff(startDate)); + timeSpan.setStoppedAt(timeSpan.getStartUptimeMs() + durationMillis); + } else { + timeSpan.stop(); + } + } + private void onFullFrameDrawn(final @NotNull ISpan ttidSpan, final @NotNull ISpan ttfdSpan) { cancelTtfdAutoClose(); // Sentry.reportFullyDisplayed can be run in any thread, so we have to ensure synchronization @@ -779,6 +928,16 @@ WeakHashMap getTtfdSpanMap() { } } + private @Nullable ISpan getAppStartParent(final @NotNull Activity activity) { + if (appStartTransaction != null) { + return appStartTransaction; + } + if (appStartSpan != null) { + return appStartSpan; + } + return activitiesWithOngoingTransactions.get(activity); + } + private @NotNull String getAppStartOp(final boolean coldStart) { if (coldStart) { return APP_START_COLD; @@ -788,12 +947,70 @@ WeakHashMap getTtfdSpanMap() { } private void finishAppStartSpan() { + finishAppStartSpan(null); + } + + private void finishAppStartSpan(final @Nullable SentryDate endDate) { final @Nullable SentryDate appStartEndTime = - AppStartMetrics.getInstance() - .getAppStartTimeSpanWithFallback(options) - .getProjectedStopTimestamp(); + endDate != null + ? endDate + : AppStartMetrics.getInstance() + .getAppStartTimeSpanWithFallback(options) + .getProjectedStopTimestamp(); if (performanceEnabled && appStartEndTime != null) { finishSpan(appStartSpan, appStartEndTime); + if (appStartTransaction != null && !appStartTransaction.isFinished()) { + appStartTransaction.finish(SpanStatus.OK, appStartEndTime); + } } } + + private void onHeadlessAppStart() { + if (scopes == null || options == null || !performanceEnabled) { + return; + } + + final @NotNull AppStartMetrics metrics = AppStartMetrics.getInstance(); + // Profilers are stopped for headless starts; clear the decision so it doesn't + // leak to a later ui.load transaction if an activity eventually opens. + metrics.setAppStartSamplingDecision(null); + + // For headless starts, appLaunchedInForeground is false, so we can't use + // getAppStartTimeSpanWithFallback (which gates on foreground). + final @NotNull TimeSpan appStartTimeSpan = metrics.getAppStartTimeSpanForHeadless(); + + if (!appStartTimeSpan.hasStarted() || !appStartTimeSpan.hasStopped()) { + return; + } + + final @Nullable SentryDate startTime = appStartTimeSpan.getStartTimestamp(); + final @Nullable SentryDate endTime = appStartTimeSpan.getProjectedStopTimestamp(); + if (startTime == null || endTime == null) { + return; + } + + final TransactionOptions txnOptions = new TransactionOptions(); + txnOptions.setBindToScope(false); + txnOptions.setStartTimestamp(startTime); + txnOptions.setOrigin(APP_START_TRACE_ORIGIN); + + final @NotNull TransactionContext txnContext = + new TransactionContext( + STANDALONE_APP_START_NAME, + TransactionNameSource.COMPONENT, + STANDALONE_APP_START_OP, + null); + + final @NotNull ITransaction transaction = scopes.startTransaction(txnContext, txnOptions); + metrics.setAppStartTraceId(transaction.getSpanContext().getTraceId()); + // Persist trace headers so a later ui.load can share traceId and sampleRand. + metrics.setAppStartSentryTraceHeader(transaction.toSentryTrace().getValue()); + final @Nullable BaggageHeader baggageHeader = transaction.toBaggageHeader(null); + metrics.setAppStartBaggageHeader(baggageHeader == null ? null : baggageHeader.getValue()); + // Persist the end time so a later activity can decide whether its ui.load is close enough in + // time to continue this trace. + metrics.setAppStartEndTime(endTime); + + transaction.finish(SpanStatus.OK, endTime); + } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index e16d4b312fc..c34ee0dbfa9 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -108,6 +108,9 @@ final class ManifestMetadataReader { static final String ENABLE_PERFORMANCE_V2 = "io.sentry.performance-v2.enable"; + static final String ENABLE_STANDALONE_APP_START_TRACING = + "io.sentry.standalone-app-start-tracing.enable"; + static final String ENABLE_APP_START_PROFILING = "io.sentry.profiling.enable-app-start"; static final String ENABLE_SCOPE_PERSISTENCE = "io.sentry.enable-scope-persistence"; @@ -502,6 +505,13 @@ static void applyMetadata( options.setEnablePerformanceV2( readBool(metadata, logger, ENABLE_PERFORMANCE_V2, options.isEnablePerformanceV2())); + options.setEnableStandaloneAppStartTracing( + readBool( + metadata, + logger, + ENABLE_STANDALONE_APP_START_TRACING, + options.isEnableStandaloneAppStartTracing())); + options.setEnableAppStartProfiling( readBool( metadata, logger, ENABLE_APP_START_PROFILING, options.isEnableAppStartProfiling())); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/PerformanceAndroidEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/PerformanceAndroidEventProcessor.java index f7b51cce620..0b50b5080f4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/PerformanceAndroidEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/PerformanceAndroidEventProcessor.java @@ -1,7 +1,9 @@ package io.sentry.android.core; import static io.sentry.android.core.ActivityLifecycleIntegration.APP_START_COLD; +import static io.sentry.android.core.ActivityLifecycleIntegration.APP_START_SCREEN_DATA; import static io.sentry.android.core.ActivityLifecycleIntegration.APP_START_WARM; +import static io.sentry.android.core.ActivityLifecycleIntegration.STANDALONE_APP_START_OP; import static io.sentry.android.core.ActivityLifecycleIntegration.UI_LOAD_OP; import io.sentry.EventProcessor; @@ -84,9 +86,21 @@ public SentryEvent process(@NotNull SentryEvent event, @NotNull Hint hint) { // the app start measurement is only sent once and only if the transaction has // the app.start span, which is automatically created by the SDK. if (hasAppStartSpan(transaction)) { - if (appStartMetrics.shouldSendStartMeasurements()) { + // For headless starts, appLaunchedInForeground is false, so only headless standalone app + // start transactions bypass the foreground check, not the duplicate-send guard. + final @Nullable SpanContext traceContext = transaction.getContexts().getTrace(); + final boolean isStandaloneAppStartTxn = + traceContext != null && STANDALONE_APP_START_OP.equals(traceContext.getOperation()); + final boolean isHeadlessStandaloneAppStartTxn = + traceContext != null + && isStandaloneAppStartTxn + && !traceContext.getData().containsKey(APP_START_SCREEN_DATA); + + if (appStartMetrics.shouldSendStartMeasurements(isHeadlessStandaloneAppStartTxn)) { final @NotNull TimeSpan appStartTimeSpan = - appStartMetrics.getAppStartTimeSpanWithFallback(options); + isHeadlessStandaloneAppStartTxn + ? appStartMetrics.getAppStartTimeSpanForHeadless() + : appStartMetrics.getAppStartTimeSpanWithFallback(options); final long appStartUpDurationMs = appStartTimeSpan.getDurationMs(); // if appStartUpDurationMs is 0, metrics are not ready to be sent @@ -216,9 +230,7 @@ private boolean hasAppStartSpan(final @NotNull SentryTransaction txn) { } final @Nullable SpanContext context = txn.getContexts().getTrace(); - return context != null - && (context.getOperation().equals(APP_START_COLD) - || context.getOperation().equals(APP_START_WARM)); + return context != null && context.getOperation().equals(STANDALONE_APP_START_OP); } private void attachAppStartSpans( @@ -245,6 +257,16 @@ private void attachAppStartSpans( } } + // For standalone app start transactions, the transaction root IS the app start span + if (parentSpanId == null) { + final @NotNull String txnOp = traceContext.getOperation(); + if (STANDALONE_APP_START_OP.equals(txnOp)) { + parentSpanId = traceContext.getSpanId(); + } + } + + final boolean isStandalone = STANDALONE_APP_START_OP.equals(traceContext.getOperation()); + // Process init final @NotNull TimeSpan processInitTimeSpan = appStartMetrics.createProcessInitSpan(); if (processInitTimeSpan.hasStarted() @@ -252,7 +274,11 @@ private void attachAppStartSpans( txn.getSpans() .add( timeSpanToSentrySpan( - processInitTimeSpan, parentSpanId, traceId, APP_METRICS_PROCESS_INIT_OP)); + processInitTimeSpan, + parentSpanId, + traceId, + APP_METRICS_PROCESS_INIT_OP, + isStandalone)); } // Content Providers @@ -263,7 +289,11 @@ private void attachAppStartSpans( txn.getSpans() .add( timeSpanToSentrySpan( - contentProvider, parentSpanId, traceId, APP_METRICS_CONTENT_PROVIDER_OP)); + contentProvider, + parentSpanId, + traceId, + APP_METRICS_CONTENT_PROVIDER_OP, + isStandalone)); } } @@ -272,7 +302,8 @@ private void attachAppStartSpans( if (appOnCreate.hasStopped()) { txn.getSpans() .add( - timeSpanToSentrySpan(appOnCreate, parentSpanId, traceId, APP_METRICS_APPLICATION_OP)); + timeSpanToSentrySpan( + appOnCreate, parentSpanId, traceId, APP_METRICS_APPLICATION_OP, isStandalone)); } } @@ -281,14 +312,17 @@ private static SentrySpan timeSpanToSentrySpan( final @NotNull TimeSpan span, final @Nullable SpanId parentSpanId, final @NotNull SentryId traceId, - final @NotNull String operation) { + final @NotNull String operation, + final boolean isStandaloneAppStart) { final Map defaultSpanData = new HashMap<>(2); defaultSpanData.put(SpanDataConvention.THREAD_ID, AndroidThreadChecker.mainThreadSystemId); defaultSpanData.put(SpanDataConvention.THREAD_NAME, "main"); - defaultSpanData.put(SpanDataConvention.CONTRIBUTES_TTID, true); - defaultSpanData.put(SpanDataConvention.CONTRIBUTES_TTFD, true); + if (!isStandaloneAppStart) { + defaultSpanData.put(SpanDataConvention.CONTRIBUTES_TTID, true); + defaultSpanData.put(SpanDataConvention.CONTRIBUTES_TTFD, true); + } return new SentrySpan( span.getStartTimestampSecs(), diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java index bb9ec17aabd..ed07c4edaaf 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptions.java @@ -246,6 +246,8 @@ public interface BeforeCaptureCallback { private boolean enablePerformanceV2 = true; + private boolean enableStandaloneAppStartTracing = false; + private @Nullable SentryFrameMetricsCollector frameMetricsCollector; private boolean enableTombstone = false; @@ -677,6 +679,53 @@ public void setEnablePerformanceV2(final boolean enablePerformanceV2) { this.enablePerformanceV2 = enablePerformanceV2; } + /** + * @return true if standalone app start tracing is enabled. See {@link + * #setEnableStandaloneAppStartTracing(boolean)} for more details. + */ + @ApiStatus.Experimental + public boolean isEnableStandaloneAppStartTracing() { + return enableStandaloneAppStartTracing; + } + + /** + * Enables or disables standalone app start tracing. + * + *

When enabled, app start is sent as its own transaction instead of an {@code app.start.*} + * child span on the first Activity transaction. + * + *

The SDK reports app start through these paths: + * + *

    + *
  • With an Activity: the SDK sends an "App Start" transaction with operation {@code + * app.start}, plus a separate {@code ui.load} transaction for the Activity. Both + * transactions share the same trace ID. + *
  • Headless app start: for launches started by something like a broadcast receiver, service, + * or content provider without an Activity, the SDK sends only the standalone app-start + * transaction. + *
      + *
    • On devices running Android 15 (API level 35) or newer, the SDK can use {@code + * ApplicationStartInfo} to classify cold versus warm starts and anchor the end time + * at the {@code Application.onCreate} start. + *
    • On devices running older Android versions, headless launches are treated as cold + * once {@code Application.onCreate} finishes without an Activity. The end time falls + * back to the best SDK/plugin timing available. + *
    • With {@code Application.onCreate} instrumentation, the SDK can add an {@code + * application.load} phase span and use the exact {@code Application.onCreate} end + * time. Without that instrumentation, the standalone transaction is still sent, but + * it may only include the {@code process.load} phase span. + *
    + *
  • If an Activity opens after a headless start, its {@code ui.load} transaction reuses the + * app-start trace ID. + *
+ * + * @param enableStandaloneAppStartTracing true if enabled or false otherwise + */ + @ApiStatus.Experimental + public void setEnableStandaloneAppStartTracing(final boolean enableStandaloneAppStartTracing) { + this.enableStandaloneAppStartTracing = enableStandaloneAppStartTracing; + } + @ApiStatus.Internal public @Nullable SentryFrameMetricsCollector getFrameMetricsCollector() { return frameMetricsCollector; diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java index 746805fcfdc..d8cb0827ba4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java @@ -10,7 +10,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.os.MessageQueue; import android.os.SystemClock; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -19,12 +18,14 @@ import io.sentry.ISentryLifecycleToken; import io.sentry.ITransactionProfiler; import io.sentry.NoOpLogger; +import io.sentry.SentryDate; import io.sentry.TracesSamplingDecision; import io.sentry.android.core.BuildInfoProvider; import io.sentry.android.core.ContextUtils; import io.sentry.android.core.CurrentActivityHolder; import io.sentry.android.core.SentryAndroidOptions; import io.sentry.android.core.internal.util.FirstDrawDoneListener; +import io.sentry.protocol.SentryId; import io.sentry.util.AutoClosableReentrantLock; import io.sentry.util.LazyEvaluator; import java.util.ArrayList; @@ -49,6 +50,10 @@ */ @ApiStatus.Internal public class AppStartMetrics extends ActivityLifecycleCallbacksAdapter { + public interface HeadlessAppStartListener { + void onHeadlessAppStart(); + } + public enum AppStartType { UNKNOWN, COLD, @@ -84,6 +89,15 @@ public enum AppStartType { private boolean shouldSendStartMeasurements = true; private final AtomicInteger activeActivitiesCounter = new AtomicInteger(); private final AtomicBoolean firstDrawDone = new AtomicBoolean(false); + private final AtomicBoolean headlessAppStartCheckPending = new AtomicBoolean(false); + private final AtomicBoolean headlessAppStartListenerInvoked = new AtomicBoolean(false); + private volatile @Nullable HeadlessAppStartListener headlessAppStartListener; + // Captures a headless app.start so a later ui.load can share its trace. + private @Nullable SentryId appStartTraceId; + private @Nullable String appStartSentryTraceHeader; + private @Nullable String appStartBaggageHeader; + private @Nullable SentryDate appStartEndTime; + private @Nullable ApplicationStartInfo cachedStartInfo; public static @NotNull AppStartMetrics getInstance() { if (instance == null) { @@ -161,6 +175,48 @@ public void setAppLaunchedInForeground(final boolean appLaunchedInForeground) { this.appLaunchedInForeground.setValue(appLaunchedInForeground); } + public void setHeadlessAppStartListener(final @Nullable HeadlessAppStartListener listener) { + this.headlessAppStartListener = listener; + if (listener != null + && isCallbackRegistered + && activeActivitiesCounter.get() == 0 + && !firstDrawDone.get()) { + scheduleHeadlessAppStartCheckOnMain(); + } + } + + public @Nullable SentryId getAppStartTraceId() { + return appStartTraceId; + } + + public void setAppStartTraceId(final @Nullable SentryId traceId) { + this.appStartTraceId = traceId; + } + + public @Nullable String getAppStartSentryTraceHeader() { + return appStartSentryTraceHeader; + } + + public void setAppStartSentryTraceHeader(final @Nullable String appStartSentryTraceHeader) { + this.appStartSentryTraceHeader = appStartSentryTraceHeader; + } + + public @Nullable String getAppStartBaggageHeader() { + return appStartBaggageHeader; + } + + public void setAppStartBaggageHeader(final @Nullable String appStartBaggageHeader) { + this.appStartBaggageHeader = appStartBaggageHeader; + } + + public @Nullable SentryDate getAppStartEndTime() { + return appStartEndTime; + } + + public void setAppStartEndTime(final @Nullable SentryDate appStartEndTime) { + this.appStartEndTime = appStartEndTime; + } + /** * Provides all collected content provider onCreate time spans * @@ -188,14 +244,30 @@ public void onAppStartSpansSent() { activityLifecycles.clear(); } + public boolean shouldSendStartMeasurements(final boolean ignoreForegroundCheck) { + return shouldSendStartMeasurements + && (ignoreForegroundCheck || appLaunchedInForeground.getValue()); + } + public boolean shouldSendStartMeasurements() { - return shouldSendStartMeasurements && appLaunchedInForeground.getValue(); + return shouldSendStartMeasurements(false); } public long getClassLoadedUptimeMs() { return CLASS_LOADED_UPTIME_MS; } + /** + * Returns a valid app start time span, bypassing the foreground check. Tries appStartSpan first, + * falls back to sdkInitTimeSpan. Used for headless starts where appLaunchedInForeground is false. + */ + public @NotNull TimeSpan getAppStartTimeSpanForHeadless() { + if (appStartSpan.hasStarted() && appStartSpan.hasStopped()) { + return appStartSpan; + } + return sdkInitTimeSpan; + } + /** * @return the app start time span if it was started and perf-2 is enabled, falls back to the sdk * init time span otherwise @@ -258,6 +330,14 @@ public void clear() { firstDrawDone.set(false); activeActivitiesCounter.set(0); firstIdle = -1; + headlessAppStartCheckPending.set(false); + headlessAppStartListenerInvoked.set(false); + headlessAppStartListener = null; + appStartTraceId = null; + appStartSentryTraceHeader = null; + appStartBaggageHeader = null; + appStartEndTime = null; + cachedStartInfo = null; } public @Nullable ITransactionProfiler getAppStartProfiler() { @@ -346,6 +426,7 @@ public void registerLifecycleCallbacks(final @NotNull Application application) { activityManager.getHistoricalProcessStartReasons(1); if (!historicalProcessStartReasons.isEmpty()) { final @NotNull ApplicationStartInfo info = historicalProcessStartReasons.get(0); + cachedStartInfo = info; if (info.getStartupState() == ApplicationStartInfo.STARTUP_STATE_STARTED) { if (info.getStartType() == ApplicationStartInfo.START_TYPE_COLD) { appStartType = AppStartType.COLD; @@ -357,41 +438,61 @@ public void registerLifecycleCallbacks(final @NotNull Application application) { } } - if (appStartType == AppStartType.UNKNOWN && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (appStartType == AppStartType.UNKNOWN || headlessAppStartListener != null) { + scheduleHeadlessAppStartCheckOnMain(); + } + } + + private void scheduleHeadlessAppStartCheckOnMain() { + if (!headlessAppStartCheckPending.compareAndSet(false, true)) { + return; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Looper.getMainLooper() .getQueue() .addIdleHandler( - new MessageQueue.IdleHandler() { - @Override - public boolean queueIdle() { - firstIdle = SystemClock.uptimeMillis(); - checkCreateTimeOnMain(); - return false; - } + () -> { + firstIdle = SystemClock.uptimeMillis(); + headlessAppStartCheckPending.set(false); + handleHeadlessAppStartIfNeededOnMain(); + return false; }); - } else if (appStartType == AppStartType.UNKNOWN) { - // We post on the main thread a task to post a check on the main thread. On Pixel devices - // (possibly others) the first task posted on the main thread is called before the - // Activity.onCreate callback. This is a workaround for that, so that the Activity.onCreate - // callback is called before the application one. + } else { final Handler handler = new Handler(Looper.getMainLooper()); handler.post( - new Runnable() { - @Override - public void run() { - // not technically correct, but close enough for pre-M - firstIdle = SystemClock.uptimeMillis(); - handler.post(() -> checkCreateTimeOnMain()); - } + () -> { + firstIdle = SystemClock.uptimeMillis(); + handler.post( + () -> { + headlessAppStartCheckPending.set(false); + handleHeadlessAppStartIfNeededOnMain(); + }); }); } } - private void checkCreateTimeOnMain() { - // if no activity has ever been created, app was launched in background + /** + * Checks whether startup reached an Activity after the main looper had a chance to create one. If + * not, handles the headless app start path. Must be called on the main thread. + */ + private void handleHeadlessAppStartIfNeededOnMain() { if (activeActivitiesCounter.get() == 0) { + // SDK init happened after Application.onCreate (e.g. deferred/late init inside an Activity): + // we missed the Activity's onActivityCreated, but a foreground process means it was a real + // launch, not a headless start. Gated on the listener so only the standalone-app-start path + // (which is what could emit a headless transaction) is affected. + if (headlessAppStartListener != null && ContextUtils.isForegroundImportance()) { + return; + } + appLaunchedInForeground.setValue(false); + // Headless starts have no Activity signal for the pre-API 35 warm/cold heuristic. + // If ApplicationStartInfo did not resolve the type, classify the process start as cold. + if (appStartType == AppStartType.UNKNOWN) { + appStartType = AppStartType.COLD; + } + // we stop the app start profilers, as they are useless and likely to timeout if (appStartProfiler != null && appStartProfiler.isRunning()) { appStartProfiler.close(); @@ -401,6 +502,56 @@ private void checkCreateTimeOnMain() { appStartContinuousProfiler.close(true); appStartContinuousProfiler = null; } + + final @Nullable HeadlessAppStartListener listener = headlessAppStartListener; + if (listener != null && headlessAppStartListenerInvoked.compareAndSet(false, true)) { + resolveHeadlessAppStartEndTime(); + listener.onHeadlessAppStart(); + } + } + } + + private void resolveHeadlessAppStartEndTime() { + // Priority 1: Gradle plugin instrumented onApplicationPostCreate + if (applicationOnCreate.hasStopped()) { + final long stopUptimeMs = + applicationOnCreate.getStartUptimeMs() + applicationOnCreate.getDurationMs(); + stopHeadlessAppStartAt(stopUptimeMs); + return; + } + + // Priority 2: API 35+ ApplicationStartInfo (cached from registerLifecycleCallbacks) + if (cachedStartInfo != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { + try { + final @NotNull Map timestamps = cachedStartInfo.getStartupTimestamps(); + final @Nullable Long onCreateStartNanos = + timestamps.get(ApplicationStartInfo.START_TIMESTAMP_APPLICATION_ONCREATE); + if (onCreateStartNanos != null) { + // The framework captures this timestamp with SystemClock.uptimeNanos() right *before* + // invoking Application.onCreate (see ActivityThread.handleBindApplication), so it marks + // the onCreate start, not its end. Without plugin instrumentation there is no onCreate + // end signal, so this is the best available lower bound for the app start end time. + // Same clock base as TimeSpan, so it can be used directly without re-anchoring. + final long onCreateStartUptimeMs = TimeUnit.NANOSECONDS.toMillis(onCreateStartNanos); + stopHeadlessAppStartAt(onCreateStartUptimeMs); + return; + } + } catch (Throwable ignored) { + // Best effort: never let optional startup timestamp enrichment break app startup. + } + } + + // Priority 3: Process init end time (CLASS_LOADED_UPTIME_MS) + stopHeadlessAppStartAt(CLASS_LOADED_UPTIME_MS); + } + + private void stopHeadlessAppStartAt(final long stopUptimeMs) { + if (appStartSpan.hasStarted()) { + if (appStartSpan.hasNotStopped()) { + appStartSpan.setStoppedAt(stopUptimeMs); + } + } else if (sdkInitTimeSpan.hasStarted() && sdkInitTimeSpan.hasNotStopped()) { + sdkInitTimeSpan.setStoppedAt(stopUptimeMs); } } @@ -413,7 +564,9 @@ public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle saved if (activeActivitiesCounter.incrementAndGet() == 1 && !firstDrawDone.get()) { final long nowUptimeMs = SystemClock.uptimeMillis(); - // If the app (process) was launched more than 1 minute ago, consider it a warm start + // If the app (process) was launched more than 1 minute ago, consider it a warm start. + // NOTE: meaningless in standalone app start mode, where a headless start is already its own + // standalone transaction and therefore cannot be re-classified as warm. final long durationSinceAppStartMillis = nowUptimeMs - appStartSpan.getStartUptimeMs(); if (!appLaunchedInForeground.getValue() || durationSinceAppStartMillis > TimeUnit.MINUTES.toMillis(1)) { @@ -472,7 +625,11 @@ public void onActivityStopped(@NonNull Activity activity) { public void onActivityDestroyed(@NonNull Activity activity) { CurrentActivityHolder.getInstance().clearActivity(activity); - final int remainingActivities = activeActivitiesCounter.decrementAndGet(); + int remainingActivities = activeActivitiesCounter.decrementAndGet(); + if (remainingActivities < 0) { + activeActivitiesCounter.set(0); + remainingActivities = 0; + } // if the app is moving into background // as the next onActivityCreated will treat it as a new warm app start if (remainingActivities == 0 && !activity.isChangingConfigurations()) { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt index 9e94d7b9905..f2ffb4b4b96 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt @@ -7,6 +7,7 @@ import android.app.Application import android.content.Context import android.os.Build import android.os.Bundle +import android.os.Handler import android.os.Looper import android.view.View import android.view.ViewTreeObserver @@ -22,17 +23,21 @@ import io.sentry.Sentry import io.sentry.SentryDate import io.sentry.SentryDateProvider import io.sentry.SentryNanotimeDate +import io.sentry.SentryTraceHeader import io.sentry.SentryTracer import io.sentry.Span +import io.sentry.SpanId import io.sentry.SpanStatus import io.sentry.SpanStatus.OK import io.sentry.TraceContext +import io.sentry.TracesSamplingDecision import io.sentry.TransactionContext import io.sentry.TransactionFinishedCallback import io.sentry.TransactionOptions import io.sentry.android.core.performance.AppStartMetrics import io.sentry.android.core.performance.AppStartMetrics.AppStartType import io.sentry.protocol.MeasurementValue +import io.sentry.protocol.SentryId import io.sentry.protocol.TransactionNameSource import io.sentry.test.DeferredExecutorService import io.sentry.test.getProperty @@ -52,6 +57,7 @@ import kotlin.test.assertSame import kotlin.test.assertTrue import org.junit.runner.RunWith import org.mockito.ArgumentCaptor +import org.mockito.Mockito.mockStatic import org.mockito.kotlin.any import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.argumentCaptor @@ -64,6 +70,7 @@ import org.mockito.kotlin.times import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.robolectric.Shadows.shadowOf +import org.robolectric.annotation.Config import org.robolectric.shadow.api.Shadow import org.robolectric.shadows.ShadowActivityManager @@ -83,6 +90,9 @@ class ActivityLifecycleIntegrationTest { // start it var transaction: SentryTracer = mock() val buildInfo = mock() + val createdTransactions = mutableListOf() + val capturedContexts = mutableListOf() + val capturedOptions = mutableListOf() fun getSut( apiVersion: Int = Build.VERSION_CODES.Q, @@ -102,8 +112,13 @@ class ActivityLifecycleIntegrationTest { val contextCaptor = argumentCaptor() whenever(scopes.startTransaction(contextCaptor.capture(), optionCaptor.capture())) .thenAnswer { - val t = SentryTracer(contextCaptor.lastValue, scopes, optionCaptor.lastValue) + val context = contextCaptor.lastValue + val options = optionCaptor.lastValue + val t = SentryTracer(context, scopes, options) transaction = t + createdTransactions.add(t) + capturedContexts.add(context) + capturedOptions.add(options) return@thenAnswer t } whenever(buildInfo.sdkInfoVersion).thenReturn(apiVersion) @@ -225,6 +240,192 @@ class ActivityLifecycleIntegrationTest { ) } + @Test + fun `Standalone app start transaction op is app start`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + + setAppStartTime() + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + verify(fixture.scopes, times(2)).startTransaction(any(), any()) + + val contexts = fixture.capturedContexts + val appStartContext = + contexts.single { it.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP } + assertEquals("App Start", appStartContext.name) + assertEquals(TransactionNameSource.COMPONENT, appStartContext.transactionNameSource) + val appStartTransaction = + fixture.createdTransactions.single { + it.spanContext.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP + } + assertEquals("Activity", appStartTransaction.getData("app.vitals.start.screen")) + assertTrue(contexts.any { it.operation == ActivityLifecycleIntegration.UI_LOAD_OP }) + assertFalse( + contexts.any { + it.operation == ActivityLifecycleIntegration.APP_START_COLD || + it.operation == ActivityLifecycleIntegration.APP_START_WARM + } + ) + } + + @Test + fun `HeadlessAppStartListener is registered when standalone flag is on and performance enabled`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart(appStartType = AppStartType.UNKNOWN) + + driveHeadlessAppStart() + + assertEquals(1, fixture.capturedContexts.size) + assertEquals( + ActivityLifecycleIntegration.STANDALONE_APP_START_OP, + fixture.capturedContexts.single().operation, + ) + assertEquals("App Start", fixture.capturedContexts.single().name) + } + + @Test + fun `HeadlessAppStartListener is not registered when standalone flag is off`() { + val sut = fixture.getSut { it.tracesSampleRate = 1.0 } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart() + + driveHeadlessAppStart() + + verify(fixture.scopes, never()).startTransaction(any(), any()) + } + + @Test + fun `HeadlessAppStartListener is not registered when performance is disabled`() { + val sut = fixture.getSut { it.isEnableStandaloneAppStartTracing = true } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart() + + driveHeadlessAppStart() + + verify(fixture.scopes, never()).startTransaction(any(), any()) + } + + @Test + fun `close clears HeadlessAppStartListener`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + sut.close() + prepareHeadlessAppStart() + + driveHeadlessAppStart() + + verify(fixture.scopes, never()).startTransaction(any(), any()) + } + + @Test + fun `onHeadlessAppStart creates standalone App Start transaction and stashes trace id`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart(appStartType = AppStartType.COLD) + + driveHeadlessAppStart() + + assertEquals(1, fixture.capturedContexts.size) + val context = fixture.capturedContexts.single() + val options = fixture.capturedOptions.single() + val transaction = fixture.createdTransactions.single() + assertEquals(ActivityLifecycleIntegration.STANDALONE_APP_START_OP, context.operation) + assertEquals("App Start", context.name) + assertEquals(TransactionNameSource.COMPONENT, context.transactionNameSource) + assertEquals("auto.app.start", options.origin) + assertFalse(options.isBindToScope) + assertEquals(DateUtils.millisToNanos(100), options.startTimestamp!!.nanoTimestamp()) + assertEquals( + transaction.spanContext.traceId, + AppStartMetrics.getInstance().getAppStartTraceId(), + ) + assertTrue(transaction.isFinished) + assertEquals(SpanStatus.OK, transaction.status) + } + + @Test + @Config(sdk = [Build.VERSION_CODES.M]) + fun `onHeadlessAppStart creates standalone App Start transaction on API 23`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessSdkInitAppStart() + + driveHeadlessAppStart() + + assertEquals(1, fixture.capturedContexts.size) + val context = fixture.capturedContexts.single() + val options = fixture.capturedOptions.single() + val transaction = fixture.createdTransactions.single() + assertEquals(ActivityLifecycleIntegration.STANDALONE_APP_START_OP, context.operation) + assertEquals("App Start", context.name) + assertEquals(DateUtils.millisToNanos(100), options.startTimestamp!!.nanoTimestamp()) + assertEquals( + transaction.spanContext.traceId, + AppStartMetrics.getInstance().getAppStartTraceId(), + ) + assertTrue(transaction.isFinished) + assertEquals(SpanStatus.OK, transaction.status) + } + + @Test + fun `onHeadlessAppStart creates standalone App Start transaction when appStartType is WARM`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart(appStartType = AppStartType.WARM) + + driveHeadlessAppStart() + + assertEquals(1, fixture.capturedContexts.size) + val context = fixture.capturedContexts.single() + assertEquals(ActivityLifecycleIntegration.STANDALONE_APP_START_OP, context.operation) + assertEquals("App Start", context.name) + assertEquals(TransactionNameSource.COMPONENT, context.transactionNameSource) + } + + @Test + fun `onHeadlessAppStart does nothing when appStartTimeSpan is incomplete`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + AppStartMetrics.getInstance().appStartTimeSpan.reset() + AppStartMetrics.getInstance().sdkInitTimeSpan.reset() + + driveHeadlessAppStart() + + verify(fixture.scopes, never()).startTransaction(any(), any()) + } + @Test fun `Activity transaction uses custom deadline timeout when autoTransactionDeadlineTimeoutMillis is set to positive value`() { val sut = fixture.getSut() @@ -528,6 +729,28 @@ class ActivityLifecycleIntegrationTest { assertTrue(span.isFinished) } + @Test + fun `When Activity is destroyed, sets standalone appStartTransaction status to cancelled and finish it`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + + setAppStartTime() + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + sut.onActivityDestroyed(activity) + + val appStartTransaction = + fixture.createdTransactions[ + transactionIndexForOperation(ActivityLifecycleIntegration.STANDALONE_APP_START_OP)] + assertEquals(SpanStatus.CANCELLED, appStartTransaction.status) + assertTrue(appStartTransaction.isFinished) + } + @Test fun `When Activity is destroyed, sets appStartSpan to null`() { val sut = fixture.getSut() @@ -882,6 +1105,282 @@ class ActivityLifecycleIntegrationTest { assertNull(appStartSpan) } + @Test + fun `launcher activity emits ui load and standalone App Start sharing trace id`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + val firstFrameDate = SentryNanotimeDate(Date(1499), 0) + fixture.options.dateProvider = SentryDateProvider { firstFrameDate } + setAppStartTime(SentryNanotimeDate(Date(1), 0)) + + val activity = mock() + sut.onActivityPreCreated(activity, fixture.bundle) + sut.onActivityCreated(activity, fixture.bundle) + + assertEquals(2, fixture.capturedContexts.size) + val uiLoadIndex = transactionIndexForOperation(ActivityLifecycleIntegration.UI_LOAD_OP) + val appStartIndex = + transactionIndexForOperation(ActivityLifecycleIntegration.STANDALONE_APP_START_OP) + val uiLoadTransaction = fixture.createdTransactions[uiLoadIndex] + val appStartTransaction = fixture.createdTransactions[appStartIndex] + + assertEquals(uiLoadTransaction.spanContext.traceId, appStartTransaction.spanContext.traceId) + assertEquals("auto.app.start", fixture.capturedOptions[appStartIndex].origin) + assertEquals("auto.ui.activity", fixture.capturedOptions[uiLoadIndex].origin) + assertFalse(fixture.capturedOptions[appStartIndex].isBindToScope) + assertFalse( + uiLoadTransaction.children.any { + it.operation == ActivityLifecycleIntegration.APP_START_COLD || + it.operation == ActivityLifecycleIntegration.APP_START_WARM + } + ) + + sut.onActivityPostCreated(activity, fixture.bundle) + sut.onActivityPreStarted(activity) + sut.onActivityStarted(activity) + sut.onActivityPostStarted(activity) + + assertTrue(appStartTransaction.children.any { it.operation == "activity.load" }) + + sut.onActivityResumed(activity) + runFirstDraw(fixture.createView()) + + val ttidSpan = + uiLoadTransaction.children.single { it.operation == ActivityLifecycleIntegration.TTID_OP } + assertTrue(ttidSpan.isFinished) + assertTrue(appStartTransaction.isFinished) + assertEquals(ttidSpan.finishDate, appStartTransaction.finishDate) + assertEquals( + ttidSpan.measurements[MeasurementValue.KEY_TIME_TO_INITIAL_DISPLAY]!!.value, + AppStartMetrics.getInstance().appStartTimeSpan.durationMs, + ) + } + + @Test + fun `launcher activity attaches lifecycle spans before finishing stopped standalone App Start`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + val appStartEndDate = SentryNanotimeDate(Date(499), 0) + setAppStartTime(SentryNanotimeDate(Date(1), 0), appStartEndDate) + + val activity = mock() + sut.onActivityPreCreated(activity, fixture.bundle) + sut.onActivityCreated(activity, fixture.bundle) + + val appStartIndex = + transactionIndexForOperation(ActivityLifecycleIntegration.STANDALONE_APP_START_OP) + val appStartTransaction = fixture.createdTransactions[appStartIndex] + assertFalse(appStartTransaction.isFinished) + + sut.onActivityPostCreated(activity, fixture.bundle) + sut.onActivityPreStarted(activity) + sut.onActivityStarted(activity) + sut.onActivityPostStarted(activity) + + val activityLoadSpans = appStartTransaction.children.filter { it.operation == "activity.load" } + assertEquals(2, activityLoadSpans.size) + assertTrue(activityLoadSpans.all { it.isFinished }) + assertTrue(appStartTransaction.isFinished) + assertEquals(appStartEndDate.nanoTimestamp(), appStartTransaction.finishDate!!.nanoTimestamp()) + } + + @Test + fun `activity following a headless start reuses trace id and does not emit second standalone`() { + val storedTraceId = SentryId() + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + AppStartMetrics.getInstance().setAppStartTraceId(storedTraceId) + // headless start always stores the trace header alongside the trace id; the ui.load txn + // continues that trace via continueTrace, sharing the trace id. + AppStartMetrics.getInstance().appStartSentryTraceHeader = + SentryTraceHeader(storedTraceId, SpanId(), true).value + sut.register(fixture.scopes, fixture.options) + setAppStartTime() + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + assertEquals(1, fixture.capturedContexts.size) + val context = fixture.capturedContexts.single() + assertEquals(ActivityLifecycleIntegration.UI_LOAD_OP, context.operation) + assertEquals(storedTraceId, context.traceId) + assertNull(AppStartMetrics.getInstance().getAppStartTraceId()) + } + + @Test + fun `activity within a minute of the headless start continues the same trace`() { + val storedTraceId = SentryId() + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + AppStartMetrics.getInstance().setAppStartTraceId(storedTraceId) + AppStartMetrics.getInstance().appStartSentryTraceHeader = + SentryTraceHeader(storedTraceId, SpanId(), true).value + // headless start ended right before the activity opens + AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(Date(0), 0) + sut.register(fixture.scopes, fixture.options) + setAppStartTime(date = SentryNanotimeDate(Date(1), 0)) + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + val context = fixture.capturedContexts.single() + assertEquals(ActivityLifecycleIntegration.UI_LOAD_OP, context.operation) + assertEquals(storedTraceId, context.traceId) + } + + @Test + fun `activity more than a minute after the headless start starts a fresh trace`() { + val storedTraceId = SentryId() + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + AppStartMetrics.getInstance().setAppStartTraceId(storedTraceId) + AppStartMetrics.getInstance().appStartSentryTraceHeader = + SentryTraceHeader(storedTraceId, SpanId(), true).value + // headless start ended at epoch, but the activity opens more than a minute later + AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(Date(0), 0) + sut.register(fixture.scopes, fixture.options) + setAppStartTime(date = SentryNanotimeDate(Date(TimeUnit.MINUTES.toMillis(2)), 0)) + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + val context = fixture.capturedContexts.single() + assertEquals(ActivityLifecycleIntegration.UI_LOAD_OP, context.operation) + // too far apart: the ui.load gets its own fresh trace, not the stored one + assertNotEquals(storedTraceId, context.traceId) + // stored continuation state is still consumed so nothing reuses it + assertNull(AppStartMetrics.getInstance().getAppStartTraceId()) + } + + @Test + fun `onHeadlessAppStart stores sentry-trace and baggage headers for continuation`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart(appStartType = AppStartType.COLD) + + driveHeadlessAppStart() + + val transaction = fixture.createdTransactions.single() + val metrics = AppStartMetrics.getInstance() + val sentryTraceHeader = metrics.appStartSentryTraceHeader + val baggageHeader = metrics.appStartBaggageHeader + assertNotNull(sentryTraceHeader) + assertNotNull(baggageHeader) + // sentry-trace carries the standalone app.start trace id so a later ui.load txn can continue it + assertTrue(sentryTraceHeader.startsWith(transaction.spanContext.traceId.toString())) + } + + @Test + fun `launcher activity shares standalone App Start trace and sampleRand as a sibling`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + setAppStartTime() + // the app-start sampling decision carries the sampleRand the whole trace should share + AppStartMetrics.getInstance() + .setAppStartSamplingDecision(TracesSamplingDecision(true, 1.0, 0.42)) + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + assertEquals(2, fixture.capturedContexts.size) + val appStartIndex = + transactionIndexForOperation(ActivityLifecycleIntegration.STANDALONE_APP_START_OP) + val uiLoadIndex = transactionIndexForOperation(ActivityLifecycleIntegration.UI_LOAD_OP) + // app.start is created first so it roots the trace; ui.load shares it + assertTrue(appStartIndex < uiLoadIndex) + + val appStartContext = fixture.capturedContexts[appStartIndex] + val uiLoadContext = fixture.capturedContexts[uiLoadIndex] + assertEquals(appStartContext.traceId, uiLoadContext.traceId) + // both share the same sampleRand + assertEquals(0.42, appStartContext.baggage?.sampleRand) + assertEquals(0.42, uiLoadContext.baggage?.sampleRand) + // siblings, not parent/child: ui.load has no parent span id + assertNull(uiLoadContext.parentSpanId) + } + + @Test + fun `activity following a headless start shares stored trace and sampleRand as a sibling and clears headers`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + + // 1) a headless start emits the standalone app.start and stores its trace headers + prepareHeadlessAppStart(appStartType = AppStartType.COLD) + driveHeadlessAppStart() + val appStartTransaction = fixture.createdTransactions.single() + + // 2) an activity opens and shares the stored trace instead of emitting a second standalone + setAppStartTime() + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + val uiLoadContext = + fixture.capturedContexts.last { it.operation == ActivityLifecycleIntegration.UI_LOAD_OP } + assertFalse( + fixture.capturedContexts.drop(1).any { + it.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP + } + ) + assertEquals(appStartTransaction.spanContext.traceId, uiLoadContext.traceId) + // siblings, not parent/child: ui.load has no parent span id + assertNull(uiLoadContext.parentSpanId) + + // stored continuation state is consumed + assertNull(AppStartMetrics.getInstance().getAppStartTraceId()) + assertNull(AppStartMetrics.getInstance().appStartSentryTraceHeader) + assertNull(AppStartMetrics.getInstance().appStartBaggageHeader) + } + + @Test + fun `standalone flag off launcher activity emits single ui load with nested app start cold child`() { + val sut = fixture.getSut { it.tracesSampleRate = 1.0 } + sut.register(fixture.scopes, fixture.options) + setAppStartTime() + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + assertEquals(1, fixture.capturedContexts.size) + assertEquals( + ActivityLifecycleIntegration.UI_LOAD_OP, + fixture.capturedContexts.single().operation, + ) + assertTrue( + fixture.createdTransactions.single().children.any { + it.operation == ActivityLifecycleIntegration.APP_START_COLD + } + ) + } + @Test fun `When SentryPerformanceProvider is disabled, app start time span is still created`() { val sut = fixture.getSut(importance = RunningAppProcessInfo.IMPORTANCE_FOREGROUND) @@ -1737,6 +2236,59 @@ class ActivityLifecycleIntegrationTest { shadowOf(Looper.getMainLooper()).idle() } + private fun driveHeadlessAppStart() { + // A headless start (broadcast/service) runs in a non-foreground-importance process. The + // foreground guard in AppStartMetrics suppresses the headless path for foreground processes + // (deferred init inside an Activity), so headless scenarios must simulate background + // importance. + mockStatic(ContextUtils::class.java).use { contextUtils -> + contextUtils.`when` { ContextUtils.isForegroundImportance() }.thenReturn(false) + AppStartMetrics.getInstance().registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + } + } + + private fun waitForMainLooperIdle() { + Handler(Looper.getMainLooper()).post {} + shadowOf(Looper.getMainLooper()).idle() + } + + private fun prepareHeadlessAppStart( + appStartType: AppStartType = AppStartType.COLD, + startUptimeMs: Long = 100, + endUptimeMs: Long = 200, + ) { + AppStartMetrics.getInstance().apply { + this.appStartType = appStartType + setClassLoadedUptimeMs(endUptimeMs) + appStartTimeSpan.apply { + setStartedAt(startUptimeMs) + setStartUnixTimeMs(startUptimeMs) + } + sdkInitTimeSpan.apply { + setStartedAt(startUptimeMs) + setStartUnixTimeMs(startUptimeMs) + } + } + } + + private fun prepareHeadlessSdkInitAppStart(startUptimeMs: Long = 100, endUptimeMs: Long = 200) { + AppStartMetrics.getInstance().apply { + appStartTimeSpan.reset() + sdkInitTimeSpan.apply { + setStartedAt(startUptimeMs) + setStartUnixTimeMs(startUptimeMs) + } + setClassLoadedUptimeMs(endUptimeMs) + } + } + + private fun transactionIndexForOperation(operation: String): Int { + val index = fixture.capturedContexts.indexOfFirst { it.operation == operation } + assertTrue(index >= 0) + return index + } + private fun setAppStartTime( date: SentryDate = SentryNanotimeDate(Date(1), 0), stopDate: SentryDate? = null, diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index d8ac959601a..3b12e6489a7 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -1492,6 +1492,36 @@ class ManifestMetadataReaderTest { assertTrue(fixture.options.isEnablePerformanceV2) } + @Test + fun `applyMetadata reads standalone app start tracing flag to options`() { + val bundle = bundleOf(ManifestMetadataReader.ENABLE_STANDALONE_APP_START_TRACING to true) + val context = fixture.getContext(metaData = bundle) + + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + assertTrue(fixture.options.isEnableStandaloneAppStartTracing) + } + + @Test + fun `applyMetadata reads standalone app start tracing false to options`() { + fixture.options.isEnableStandaloneAppStartTracing = true + val bundle = bundleOf(ManifestMetadataReader.ENABLE_STANDALONE_APP_START_TRACING to false) + val context = fixture.getContext(metaData = bundle) + + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + assertFalse(fixture.options.isEnableStandaloneAppStartTracing) + } + + @Test + fun `applyMetadata reads standalone app start tracing flag to options and keeps default if not found`() { + val context = fixture.getContext() + + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + assertFalse(fixture.options.isEnableStandaloneAppStartTracing) + } + @Test fun `applyMetadata reads startupProfiling flag to options`() { // Arrange diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt index e2fed5bb003..173b4e3d999 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt @@ -13,7 +13,9 @@ import io.sentry.SpanStatus import io.sentry.TracesSamplingDecision import io.sentry.TransactionContext import io.sentry.android.core.ActivityLifecycleIntegration.APP_START_COLD +import io.sentry.android.core.ActivityLifecycleIntegration.APP_START_SCREEN_DATA import io.sentry.android.core.ActivityLifecycleIntegration.APP_START_WARM +import io.sentry.android.core.ActivityLifecycleIntegration.STANDALONE_APP_START_OP import io.sentry.android.core.ActivityLifecycleIntegration.UI_LOAD_OP import io.sentry.android.core.performance.ActivityLifecycleTimeSpan import io.sentry.android.core.performance.AppStartMetrics @@ -87,7 +89,7 @@ class PerformanceAndroidEventProcessorTest { fun `add cold start measurement`() { val sut = fixture.getSut() - var tr = getTransaction(AppStartType.COLD) + var tr = createUiLoadTransactionWithAppStartChildSpan() setAppStart(fixture.options) tr = sut.process(tr, Hint()) @@ -95,11 +97,106 @@ class PerformanceAndroidEventProcessorTest { assertTrue(tr.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) } + @Test + fun `add cold start measurement for standalone app start transaction launched from background`() { + val sut = fixture.getSut() + + var tr = createStandaloneAppStartTransaction() + setStandaloneColdAppStartMetrics() + + tr = sut.process(tr, Hint()) + + assertTrue(tr.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) + } + + @Test + fun `standalone app start with instrumented application onCreate attaches process and application spans`() { + val sut = fixture.getSut(enablePerformanceV2 = true) + setStandaloneColdAppStartMetrics(withApplicationOnCreate = true) + + var tr = createStandaloneAppStartTransaction() + val rootSpanId = tr.contexts.trace!!.spanId + + tr = sut.process(tr, Hint()) + + assertTrue(tr.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) + assertEquals(listOf("process.load", "application.load"), tr.spans.map { it.op }) + assertTrue(tr.spans.all { it.parentSpanId == rootSpanId }) + } + + @Test + fun `standalone app start without instrumented application onCreate attaches only process span`() { + val sut = fixture.getSut(enablePerformanceV2 = true) + setStandaloneColdAppStartMetrics(withApplicationOnCreate = false) + + var tr = createStandaloneAppStartTransaction() + val rootSpanId = tr.contexts.trace!!.spanId + + tr = sut.process(tr, Hint()) + + assertTrue(tr.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) + assertEquals(listOf("process.load"), tr.spans.map { it.op }) + assertEquals(rootSpanId, tr.spans.single().parentSpanId) + } + + @Test + fun `standalone app start uses the transaction root span id as parent`() { + val sut = fixture.getSut(enablePerformanceV2 = true) + setStandaloneColdAppStartMetrics() + + var tr = createStandaloneAppStartTransaction() + val rootSpanId = tr.contexts.trace!!.spanId + + tr = sut.process(tr, Hint()) + + val processLoadSpan = tr.spans.first { it.op == "process.load" } + assertEquals(rootSpanId, processLoadSpan.parentSpanId) + } + + @Test + fun `standalone app start spans do not carry TTID or TTFD contributing flags`() { + val sut = fixture.getSut(enablePerformanceV2 = true) + setStandaloneColdAppStartMetrics(withApplicationOnCreate = true) + + var tr = createStandaloneAppStartTransaction() + + tr = sut.process(tr, Hint()) + + assertTrue(tr.spans.isNotEmpty()) + for (span in tr.spans) { + assertNull(span.data?.get(SpanDataConvention.CONTRIBUTES_TTID)) + assertNull(span.data?.get(SpanDataConvention.CONTRIBUTES_TTFD)) + } + } + + @Test + fun `foreground standalone app start measurement uses foreground fallback time span`() { + val sut = fixture.getSut(enablePerformanceV2 = false) + AppStartMetrics.getInstance().apply { + appStartType = AppStartType.COLD + isAppLaunchedInForeground = true + appStartTimeSpan.apply { + setStartedAt(1) + setStoppedAt(101) + } + sdkInitTimeSpan.apply { + setStartedAt(10) + setStoppedAt(30) + } + } + + var tr = createStandaloneAppStartTransaction(appStartScreen = "MainActivity") + + tr = sut.process(tr, Hint()) + + assertEquals(20f, tr.measurements[MeasurementValue.KEY_APP_START_COLD]?.value) + } + @Test fun `add cold start measurement for performance-v2`() { val sut = fixture.getSut(enablePerformanceV2 = true) - var tr = getTransaction(AppStartType.COLD) + var tr = createUiLoadTransactionWithAppStartChildSpan() setAppStart(fixture.options) tr = sut.process(tr, Hint()) @@ -111,7 +208,7 @@ class PerformanceAndroidEventProcessorTest { fun `add warm start measurement`() { val sut = fixture.getSut() - var tr = getTransaction(AppStartType.WARM) + var tr = createUiLoadTransactionWithAppStartChildSpan(coldStart = false) setAppStart(fixture.options, false) tr = sut.process(tr, Hint()) @@ -123,7 +220,7 @@ class PerformanceAndroidEventProcessorTest { fun `set app cold start unit measurement`() { val sut = fixture.getSut() - var tr = getTransaction(AppStartType.COLD) + var tr = createUiLoadTransactionWithAppStartChildSpan() setAppStart(fixture.options) tr = sut.process(tr, Hint()) @@ -136,23 +233,40 @@ class PerformanceAndroidEventProcessorTest { fun `do not add app start metric twice`() { val sut = fixture.getSut() - var tr1 = getTransaction(AppStartType.COLD) + var tr1 = createUiLoadTransactionWithAppStartChildSpan() setAppStart(fixture.options, false) tr1 = sut.process(tr1, Hint()) - var tr2 = getTransaction(AppStartType.UNKNOWN) + var tr2 = createUiLoadTransaction() tr2 = sut.process(tr2, Hint()) assertTrue(tr1.measurements.containsKey(MeasurementValue.KEY_APP_START_WARM)) assertTrue(tr2.measurements.isEmpty()) } + @Test + fun `do not add standalone app start metric twice`() { + val sut = fixture.getSut() + + setStandaloneColdAppStartMetrics() + + var tr1 = createStandaloneAppStartTransaction() + tr1 = sut.process(tr1, Hint()) + + var tr2 = createStandaloneAppStartTransaction() + tr2 = sut.process(tr2, Hint()) + + assertTrue(tr1.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) + assertFalse(tr2.measurements.containsKey(MeasurementValue.KEY_APP_START_COLD)) + assertFalse(tr2.measurements.containsKey(MeasurementValue.KEY_APP_START_WARM)) + } + @Test fun `do not add app start metric if its not ready`() { val sut = fixture.getSut() - var tr = getTransaction(AppStartType.UNKNOWN) + var tr = createUiLoadTransactionWithAppStartChildSpan() tr = sut.process(tr, Hint()) @@ -163,7 +277,7 @@ class PerformanceAndroidEventProcessorTest { fun `do not add app start metric if performance is disabled`() { val sut = fixture.getSut(tracesSampleRate = null) - var tr = getTransaction(AppStartType.COLD) + var tr = createUiLoadTransactionWithAppStartChildSpan() tr = sut.process(tr, Hint()) @@ -174,7 +288,7 @@ class PerformanceAndroidEventProcessorTest { fun `do not add app start metric if no app_start span`() { val sut = fixture.getSut(tracesSampleRate = null) - var tr = getTransaction(AppStartType.UNKNOWN) + var tr = createUiLoadTransaction() tr = sut.process(tr, Hint()) @@ -184,7 +298,7 @@ class PerformanceAndroidEventProcessorTest { @Test fun `do not add slow and frozen frames if not auto transaction`() { val sut = fixture.getSut() - var tr = getTransaction(AppStartType.UNKNOWN) + var tr = createTransaction("custom.op") tr = sut.process(tr, Hint()) @@ -194,7 +308,7 @@ class PerformanceAndroidEventProcessorTest { @Test fun `do not add slow and frozen frames if tracing is disabled`() { val sut = fixture.getSut(null) - var tr = getTransaction(AppStartType.UNKNOWN) + var tr = createUiLoadTransaction() tr = sut.process(tr, Hint()) @@ -464,10 +578,10 @@ class PerformanceAndroidEventProcessorTest { val appStartSpan = createAppStartSpan(tr.contexts.trace!!.traceId) tr.spans.add(appStartSpan) - assertTrue(appStartMetrics.shouldSendStartMeasurements()) + assertTrue(appStartMetrics.shouldSendStartMeasurements(false)) // then the app start metrics should be attached tr = sut.process(tr, Hint()) - assertFalse(appStartMetrics.shouldSendStartMeasurements()) + assertFalse(appStartMetrics.shouldSendStartMeasurements(false)) assertTrue(tr.spans.any { "application.load" == it.op }) @@ -867,13 +981,44 @@ class PerformanceAndroidEventProcessorTest { } } - private fun getTransaction(type: AppStartType): SentryTransaction { - val op = - when (type) { - AppStartType.COLD -> "app.start.cold" - AppStartType.WARM -> "app.start.warm" - AppStartType.UNKNOWN -> "ui.load" + private fun setStandaloneColdAppStartMetrics(withApplicationOnCreate: Boolean = false) { + AppStartMetrics.getInstance().apply { + appStartType = AppStartType.COLD + isAppLaunchedInForeground = false + classLoadedUptimeMs = 50 + appStartTimeSpan.apply { + setStartedAt(1) + setStoppedAt(100) + } + if (withApplicationOnCreate) { + applicationOnCreateTimeSpan.apply { + setStartedAt(10) + description = "com.example.App.onCreate" + setStoppedAt(42) + } } + } + } + + private fun createUiLoadTransactionWithAppStartChildSpan( + coldStart: Boolean = true + ): SentryTransaction = + createUiLoadTransaction().also { txn -> + txn.spans.add(createAppStartSpan(txn.contexts.trace!!.traceId, coldStart)) + } + + private fun createUiLoadTransaction(): SentryTransaction = createTransaction(UI_LOAD_OP) + + private fun createStandaloneAppStartTransaction( + appStartScreen: String? = null + ): SentryTransaction = + createTransaction(STANDALONE_APP_START_OP).also { txn -> + if (appStartScreen != null) { + txn.contexts.trace!!.setData(APP_START_SCREEN_DATA, appStartScreen) + } + } + + private fun createTransaction(op: String): SentryTransaction { val txn = SentryTransaction(fixture.tracer) txn.contexts.setTrace(SpanContext(op, TracesSamplingDecision(false))) return txn diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt index 819928dcdc4..0eec9502702 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt @@ -156,6 +156,12 @@ class SentryAndroidOptionsTest { assertFalse(sentryOptions.isEnablePerformanceV2) } + @Test + fun `standalone app start tracing is disabled by default`() { + val sentryOptions = SentryAndroidOptions() + assertFalse(sentryOptions.isEnableStandaloneAppStartTracing) + } + fun `when options is initialized, enableScopeSync is enabled by default`() { assertTrue(SentryAndroidOptions().isEnableScopeSync) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt index e7079bd46d0..a959c5dd865 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt @@ -1,6 +1,7 @@ package io.sentry.android.core import android.app.ActivityManager +import android.app.ActivityManager.RunningAppProcessInfo import android.app.ApplicationStartInfo import android.os.Build import org.robolectric.annotation.Implementation @@ -10,13 +11,25 @@ import org.robolectric.annotation.Implements class SentryShadowActivityManager { companion object { private var historicalProcessStartReasons: List = emptyList() + private var importance: Int = RunningAppProcessInfo.IMPORTANCE_FOREGROUND fun setHistoricalProcessStartReasons(startReasons: List) { historicalProcessStartReasons = startReasons } + fun setImportance(importance: Int) { + this.importance = importance + } + fun reset() { historicalProcessStartReasons = emptyList() + importance = RunningAppProcessInfo.IMPORTANCE_FOREGROUND + } + + @Implementation + @JvmStatic + fun getMyMemoryState(outState: RunningAppProcessInfo) { + outState.importance = importance } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowProcess.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowProcess.kt index c3ff6653673..e36388fb185 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowProcess.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowProcess.kt @@ -6,15 +6,25 @@ import org.robolectric.annotation.Implements @Implements(android.os.Process::class) class SentryShadowProcess { companion object { - private var startupTimeMillis: Long = 0 + private var startUptimeMillis: Long = 0 + private var startElapsedRealtime: Long = 0 fun setStartUptimeMillis(value: Long) { - startupTimeMillis = value + startUptimeMillis = value } + fun setStartElapsedRealtime(value: Long) { + startElapsedRealtime = value + } + + @Suppress("unused") + @Implementation + @JvmStatic + fun getStartUptimeMillis(): Long = startUptimeMillis + @Suppress("unused") @Implementation @JvmStatic - fun getStartUptimeMillis(): Long = startupTimeMillis + fun getStartElapsedRealtime(): Long = startElapsedRealtime } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt index c15ea3c37d0..ab0013a8c75 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt @@ -13,11 +13,14 @@ import io.sentry.DateUtils import io.sentry.IContinuousProfiler import io.sentry.ITransactionProfiler import io.sentry.SentryNanotimeDate +import io.sentry.android.core.ContextUtils import io.sentry.android.core.CurrentActivityHolder import io.sentry.android.core.SentryAndroidOptions import io.sentry.android.core.SentryShadowProcess +import io.sentry.protocol.SentryId import java.util.Date import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -27,6 +30,7 @@ import kotlin.test.assertSame import kotlin.test.assertTrue import org.junit.Before import org.junit.runner.RunWith +import org.mockito.Mockito.mockStatic import org.mockito.kotlin.any import org.mockito.kotlin.eq import org.mockito.kotlin.mock @@ -44,6 +48,7 @@ class AppStartMetricsTest { fun setup() { AppStartMetrics.getInstance().clear() SentryShadowProcess.setStartUptimeMillis(42) + AppStartMetrics.getInstance().setClassLoadedUptimeMs(42) AppStartMetrics.getInstance().isAppLaunchedInForeground = true } @@ -65,6 +70,7 @@ class AppStartMetricsTest { metrics.appStartProfiler = mock() metrics.appStartContinuousProfiler = mock() metrics.appStartSamplingDecision = mock() + metrics.setAppStartTraceId(SentryId()) metrics.clear() @@ -78,6 +84,7 @@ class AppStartMetricsTest { assertNull(metrics.appStartProfiler) assertNull(metrics.appStartContinuousProfiler) assertNull(metrics.appStartSamplingDecision) + assertNull(metrics.getAppStartTraceId()) } @Test @@ -167,10 +174,10 @@ class AppStartMetricsTest { // when the looper runs waitForMainLooperIdle() - // but no activity creation happened + // but a headless start happened // then the app wasn't launched in foreground and nothing should be sent assertFalse(metrics.isAppLaunchedInForeground) - assertFalse(metrics.shouldSendStartMeasurements()) + assertFalse(metrics.shouldSendStartMeasurements(false)) val now = TimeUnit.MINUTES.toMillis(2) + 1234567 SystemClock.setCurrentTimeMillis(now) @@ -180,7 +187,7 @@ class AppStartMetricsTest { // then it should restart the timespan assertTrue(metrics.isAppLaunchedInForeground) - assertTrue(metrics.shouldSendStartMeasurements()) + assertTrue(metrics.shouldSendStartMeasurements(false)) assertTrue(metrics.appStartTimeSpan.hasStarted()) assertEquals(now, metrics.appStartTimeSpan.startUptimeMs) assertFalse(metrics.applicationOnCreateTimeSpan.hasStarted()) @@ -194,7 +201,7 @@ class AppStartMetricsTest { metrics.sdkInitTimeSpan.start() metrics.registerLifecycleCallbacks(mock()) - // when the handler callback is executed and no activity was launched + // when the handler callback is executed and the start is headless waitForMainLooperIdle() // isAppLaunchedInForeground should be false @@ -208,11 +215,170 @@ class AppStartMetricsTest { assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) } + @Test + fun `headless app start defaults UNKNOWN appStartType to COLD`() { + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.COLD, metrics.appStartType) + assertFalse(metrics.isAppLaunchedInForeground) + } + + @Test + fun `headless app start does not overwrite existing appStartType`() { + val metrics = AppStartMetrics.getInstance() + metrics.appStartType = AppStartMetrics.AppStartType.WARM + metrics.appStartTimeSpan.setStartedAt(100) + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) + } + + @Test + fun `headless app start fires HeadlessAppStartListener`() = headlessProcess { + val listenerCalls = AtomicInteger() + + AppStartMetrics.getInstance().setHeadlessAppStartListener { listenerCalls.incrementAndGet() } + AppStartMetrics.getInstance().registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(1, listenerCalls.get()) + } + + @Test + fun `foreground process does not fire HeadlessAppStartListener`() { + // Deferred/late SDK init inside an already-running Activity: we missed onActivityCreated, but + // the process is foreground (Robolectric default importance), so this is a real launch, not a + // headless start. The listener must not fire and the headless reclassification must not run. + val listenerCalls = AtomicInteger() + val metrics = AppStartMetrics.getInstance() + + metrics.setHeadlessAppStartListener { listenerCalls.incrementAndGet() } + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(0, listenerCalls.get()) + assertEquals(AppStartMetrics.AppStartType.UNKNOWN, metrics.appStartType) + + SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100) + val activity = mock() + whenever(activity.isChangingConfigurations).thenReturn(false) + metrics.onActivityCreated(activity, null) + + assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) + + metrics.onActivityDestroyed(activity) + SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100) + metrics.onActivityCreated(mock(), null) + + assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) + } + + @Test + fun `activity start prevents HeadlessAppStartListener`() { + val listenerCalls = AtomicInteger() + val metrics = AppStartMetrics.getInstance() + + metrics.setHeadlessAppStartListener { listenerCalls.incrementAndGet() } + metrics.onActivityCreated(mock(), null) + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(0, listenerCalls.get()) + } + + @Test + fun `resolveHeadlessAppStartEndTime uses applicationOnCreate stop when Gradle plugin instrumented`() = + headlessProcess { + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + metrics.setHeadlessAppStartListener {} + metrics.applicationOnCreateTimeSpan.apply { + setStartedAt(120) + setStoppedAt(200) + } + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(100, metrics.appStartTimeSpan.durationMs) + } + + @Test + fun `resolveHeadlessAppStartEndTime falls back to CLASS_LOADED_UPTIME_MS when no plugin and no ApplicationStartInfo`() = + headlessProcess { + val metrics = AppStartMetrics.getInstance() + metrics.setClassLoadedUptimeMs(200) + metrics.appStartTimeSpan.setStartedAt(100) + metrics.setHeadlessAppStartListener {} + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(100, metrics.appStartTimeSpan.durationMs) + } + + @Test + fun `resolveHeadlessAppStartEndTime does not overwrite stopped appStartTimeSpan`() { + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.apply { + setStartedAt(100) + setStoppedAt(150) + } + metrics.setHeadlessAppStartListener {} + metrics.applicationOnCreateTimeSpan.apply { + setStartedAt(120) + setStoppedAt(200) + } + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertEquals(50, metrics.appStartTimeSpan.durationMs) + } + + @Test + fun `headless app start without listener does not stop sdkInitTimeSpan`() { + val metrics = AppStartMetrics.getInstance() + metrics.sdkInitTimeSpan.setStartedAt(100) + + metrics.registerLifecycleCallbacks(mock()) + waitForMainLooperIdle() + + assertTrue(metrics.sdkInitTimeSpan.hasNotStopped()) + } + + @Test + fun `getAppStartTimeSpanForHeadless falls back to sdkInitTimeSpan when appStartSpan has not stopped`() { + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + metrics.sdkInitTimeSpan.apply { + setStartedAt(120) + setStoppedAt(180) + } + + assertSame(metrics.sdkInitTimeSpan, metrics.getAppStartTimeSpanForHeadless()) + } + private fun waitForMainLooperIdle() { Handler(Looper.getMainLooper()).post {} Shadows.shadowOf(Looper.getMainLooper()).idle() } + // Simulates a real headless start (broadcast/service), i.e. a non-foreground-importance process. + // The Robolectric default importance in this test class is IMPORTANCE_FOREGROUND, so headless + // scenarios must opt into a background importance explicitly. + private fun headlessProcess(block: () -> T): T = + mockStatic(ContextUtils::class.java).use { contextUtils -> + contextUtils.`when` { ContextUtils.isForegroundImportance() }.thenReturn(false) + block() + } + @Test fun `if app start span is at most 1 minute, appStartTimeSpanWithFallback returns the app start span`() { val appStartTimeSpan = AppStartMetrics.getInstance().appStartTimeSpan @@ -331,12 +497,12 @@ class AppStartMetricsTest { } @Test - fun `registerApplicationForegroundCheck set foreground state to false if no activity is running`() { + fun `registerApplicationForegroundCheck set foreground state to false for headless start`() { val application = mock() AppStartMetrics.getInstance().isAppLaunchedInForeground = true AppStartMetrics.getInstance().registerLifecycleCallbacks(application) assertTrue(AppStartMetrics.getInstance().isAppLaunchedInForeground) - // Main thread performs the check and sets the flag to false if no activity was created + // Main thread performs the check and sets the flag to false if the start is headless waitForMainLooperIdle() assertFalse(AppStartMetrics.getInstance().isAppLaunchedInForeground) } @@ -369,11 +535,11 @@ class AppStartMetricsTest { val appStartMetrics = AppStartMetrics.getInstance() appStartMetrics.addActivityLifecycleTimeSpans(mock()) appStartMetrics.contentProviderOnCreateTimeSpans.add(mock()) - assertTrue(appStartMetrics.shouldSendStartMeasurements()) + assertTrue(appStartMetrics.shouldSendStartMeasurements(false)) appStartMetrics.onAppStartSpansSent() assertTrue(appStartMetrics.activityLifecycleTimeSpans.isEmpty()) assertTrue(appStartMetrics.contentProviderOnCreateTimeSpans.isEmpty()) - assertFalse(appStartMetrics.shouldSendStartMeasurements()) + assertFalse(appStartMetrics.shouldSendStartMeasurements(false)) } @Test @@ -387,18 +553,18 @@ class AppStartMetricsTest { // then the app start type should be cold and measurements should be sent assertEquals(AppStartMetrics.AppStartType.COLD, appStartMetrics.appStartType) - assertTrue(appStartMetrics.shouldSendStartMeasurements()) + assertTrue(appStartMetrics.shouldSendStartMeasurements(false)) // when the activity gets destroyed appStartMetrics.onAppStartSpansSent() - assertFalse(appStartMetrics.shouldSendStartMeasurements()) + assertFalse(appStartMetrics.shouldSendStartMeasurements(false)) appStartMetrics.onActivityDestroyed(activity0) // then it should reset sending the measurements for the next warm activity appStartMetrics.onActivityCreated(mock(), mock()) assertEquals(AppStartMetrics.AppStartType.WARM, appStartMetrics.appStartType) - assertTrue(appStartMetrics.shouldSendStartMeasurements()) + assertTrue(appStartMetrics.shouldSendStartMeasurements(false)) } @Test @@ -585,7 +751,6 @@ class AppStartMetricsTest { waitForMainLooperIdle() SystemClock.setCurrentTimeMillis(SystemClock.uptimeMillis() + 100) - metrics.isAppLaunchedInForeground = true metrics.onActivityCreated(mock(), null) assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) @@ -791,7 +956,7 @@ class AppStartMetricsTest { whenever(firstActivity.isChangingConfigurations).thenReturn(false) metrics.onActivityCreated(firstActivity, null) assertEquals(AppStartMetrics.AppStartType.COLD, metrics.appStartType) - assertTrue(metrics.shouldSendStartMeasurements()) + assertTrue(metrics.shouldSendStartMeasurements(false)) metrics.onAppStartSpansSent() waitForMainLooperIdle() @@ -804,7 +969,7 @@ class AppStartMetricsTest { metrics.onActivityCreated(secondActivity, null) assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) assertTrue(metrics.isAppLaunchedInForeground) - assertTrue(metrics.shouldSendStartMeasurements()) + assertTrue(metrics.shouldSendStartMeasurements(false)) metrics.onAppStartSpansSent() // Third activity - should still be warm @@ -812,7 +977,7 @@ class AppStartMetricsTest { metrics.onActivityCreated(mock(), null) assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) assertTrue(metrics.isAppLaunchedInForeground) - assertFalse(metrics.shouldSendStartMeasurements()) + assertFalse(metrics.shouldSendStartMeasurements(false)) } @Test diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt index d3738943a2c..30686852156 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt @@ -1,18 +1,25 @@ package io.sentry.android.core.performance +import android.app.ActivityManager.RunningAppProcessInfo import android.app.Application import android.app.ApplicationStartInfo import android.os.Build +import android.os.Handler +import android.os.Looper import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.android.core.SentryShadowActivityManager import io.sentry.android.core.SentryShadowProcess +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFalse import org.junit.Before import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.whenever +import org.robolectric.Shadows import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) @@ -25,7 +32,9 @@ class AppStartMetricsTestApi35 { fun setup() { AppStartMetrics.getInstance().clear() SentryShadowProcess.setStartUptimeMillis(42) + SentryShadowProcess.setStartElapsedRealtime(42) SentryShadowActivityManager.reset() + AppStartMetrics.getInstance().setClassLoadedUptimeMs(42) AppStartMetrics.getInstance().isAppLaunchedInForeground = true } @@ -42,6 +51,22 @@ class AppStartMetricsTestApi35 { assertEquals(AppStartMetrics.AppStartType.COLD, AppStartMetrics.getInstance().appStartType) } + @Test + fun `known ApplicationStartInfo type without listener does not schedule headless check`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + val metrics = AppStartMetrics.getInstance() + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.COLD, metrics.appStartType) + assertEquals(-1, metrics.firstIdle) + } + @Test fun `detects warm start using ApplicationStartInfo on API 35`() { val mockStartInfo = mock() @@ -81,4 +106,109 @@ class AppStartMetricsTestApi35 { assertEquals(AppStartMetrics.AppStartType.UNKNOWN, metrics.appStartType) } + + @Test + fun `headless app start keeps COLD appStartType from ApplicationStartInfo`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + whenever(mockStartInfo.startupTimestamps).thenReturn(emptyMap()) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + SentryShadowActivityManager.setImportance(RunningAppProcessInfo.IMPORTANCE_CACHED) + val listenerCalls = AtomicInteger() + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + metrics.setHeadlessAppStartListener { listenerCalls.incrementAndGet() } + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.COLD, metrics.appStartType) + assertFalse(metrics.isAppLaunchedInForeground) + assertEquals(1, listenerCalls.get()) + } + + @Test + fun `known ApplicationStartInfo type with listener handles headless app start`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_WARM) + whenever(mockStartInfo.startupTimestamps).thenReturn(emptyMap()) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + SentryShadowActivityManager.setImportance(RunningAppProcessInfo.IMPORTANCE_CACHED) + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + metrics.setClassLoadedUptimeMs(200) + metrics.setHeadlessAppStartListener {} + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.WARM, metrics.appStartType) + assertFalse(metrics.isAppLaunchedInForeground) + assertEquals(100, metrics.appStartTimeSpan.durationMs) + } + + @Test + fun `resolveHeadlessAppStartEndTime uses ApplicationStartInfo onCreate uptime timestamp`() { + val appStartUptimeMs = 100L + // START_TIMESTAMP_APPLICATION_ONCREATE is captured with SystemClock.uptimeNanos() (the same + // base as TimeSpan) right before Application.onCreate is invoked, so it is used directly as + // an uptime value marking the onCreate start, without any clock re-anchoring. + val onCreateStartUptimeMs = 350L + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + whenever(mockStartInfo.startupTimestamps) + .thenReturn( + mapOf( + ApplicationStartInfo.START_TIMESTAMP_APPLICATION_ONCREATE to + TimeUnit.MILLISECONDS.toNanos(onCreateStartUptimeMs) + ) + ) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + SentryShadowActivityManager.setImportance(RunningAppProcessInfo.IMPORTANCE_CACHED) + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(appStartUptimeMs) + metrics.setHeadlessAppStartListener {} + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + waitForMainLooperIdle() + + assertEquals(250, metrics.appStartTimeSpan.durationMs) + assertFalse(metrics.applicationOnCreateTimeSpan.hasStarted()) + } + + @Test + fun `listener fires when set after registerLifecycleCallbacks resolves type on API 35`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + whenever(mockStartInfo.startupTimestamps).thenReturn(emptyMap()) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + SentryShadowActivityManager.setImportance(RunningAppProcessInfo.IMPORTANCE_CACHED) + + val listenerCalls = AtomicInteger() + val metrics = AppStartMetrics.getInstance() + metrics.appStartTimeSpan.setStartedAt(100) + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + + // Listener set AFTER registerLifecycleCallbacks — mirrors production ordering + metrics.setHeadlessAppStartListener { listenerCalls.incrementAndGet() } + waitForMainLooperIdle() + + assertEquals(AppStartMetrics.AppStartType.COLD, metrics.appStartType) + assertFalse(metrics.isAppLaunchedInForeground) + assertEquals(1, listenerCalls.get()) + } + + private fun waitForMainLooperIdle() { + Handler(Looper.getMainLooper()).post {} + Shadows.shadowOf(Looper.getMainLooper()).idle() + } } diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index e5b5ed2250b..14c8b595fd3 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -37,6 +37,15 @@ android:exported="true" android:foregroundServiceType="remoteMessaging" /> + + + + + + + + diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TestBroadcastReceiver.java b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TestBroadcastReceiver.java new file mode 100644 index 00000000000..10b4fd4d94e --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TestBroadcastReceiver.java @@ -0,0 +1,26 @@ +package io.sentry.samples.android; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +/** + * A manifest-declared broadcast receiver for testing standalone app starts. + * + *

Test with: + * + *

{@code
+ * adb shell am force-stop io.sentry.samples.android && \
+ * adb shell am broadcast -a io.sentry.samples.android.TEST_BROADCAST \
+ *   -n io.sentry.samples.android/.TestBroadcastReceiver
+ * }
+ */ +public class TestBroadcastReceiver extends BroadcastReceiver { + private static final String TAG = "SentryAppStart"; + + @Override + public void onReceive(Context context, Intent intent) { + Log.d(TAG, "TestBroadcastReceiver.onReceive() called - no activity will launch"); + } +} From 26ddd89873d8d1bd9b1e0147fe177fd4178b1f1e Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Mon, 15 Jun 2026 11:10:07 +0200 Subject: [PATCH 198/391] Upgrade to asyncProfiler 4.4 (#5418) --- CHANGELOG.md | 4 ++++ gradle/libs.versions.toml | 2 +- .../JfrAsyncProfilerToSentryProfileConverter.java | 9 +-------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd876f3c57d..648533ec18f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ - Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527)) +### Dependencies + +- Upgrade to asyncProfiler 4.4 ([#5418](https://github.com/getsentry/sentry-java/pull/5418)) + ### Fixes - Fix performance collector scheduling many tasks in a row ([#5524](https://github.com/getsentry/sentry-java/pull/5524)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e653069e2b3..f6edafdc17f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ androidxLifecycle = "2.2.0" androidxNavigation = "2.4.2" androidxTestCore = "1.7.0" androidxCompose = "1.6.3" -asyncProfiler = "4.2" +asyncProfiler = "4.4" composeCompiler = "1.5.14" coroutines = "1.6.1" espresso = "3.7.0" diff --git a/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java b/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java index b7b5662a8e5..718fae422f7 100644 --- a/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java +++ b/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java @@ -26,7 +26,6 @@ @ApiStatus.Internal public final class JfrAsyncProfilerToSentryProfileConverter extends JfrConverter { - private static final double NANOS_PER_SECOND = 1_000_000_000.0; private static final long UNKNOWN_THREAD_ID = -1; private final @NotNull SentryProfile sentryProfile = new SentryProfile(); @@ -83,7 +82,6 @@ private class ProfileEventVisitor implements EventCollector.Visitor { private final @NotNull SentryStackTraceFactory stackTraceFactory; private final @NotNull JfrReader jfr; private final @NotNull Arguments args; - private final double ticksPerNanosecond; public ProfileEventVisitor( @NotNull SentryProfile sentryProfile, @@ -94,7 +92,6 @@ public ProfileEventVisitor( this.stackTraceFactory = stackTraceFactory; this.jfr = jfr; this.args = args; - ticksPerNanosecond = jfr.ticksPerSec / NANOS_PER_SECOND; } @Override @@ -150,11 +147,7 @@ private void processSampleWithStack(Event event, long threadId, StackTrace stack } private double calculateTimestamp(Event event) { - long nanosFromStart = (long) ((event.time - jfr.chunkStartTicks) / ticksPerNanosecond); - - long timeNs = jfr.chunkStartNanos + nanosFromStart; - - return DateUtils.nanosToSeconds(timeNs); + return DateUtils.nanosToSeconds(jfr.eventTimeToNanos(event.time)); } private int addStackTrace(StackTrace stackTrace) { From 77e5b0a977f40709f429b7507b8b97fc46bcbdc4 Mon Sep 17 00:00:00 2001 From: arb Date: Mon, 15 Jun 2026 11:17:04 +0200 Subject: [PATCH 199/391] chore(samples-android): Add optional SAGP build mode (#5538) Adds an optional useSagp flag to Android sample app builds that, when true, applies the Sentry Android Gradle Plugin. (Defaults to false, which matches existing build behavior.) ``` ./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp=true ``` See the Android sample app README for more details. --- .../sentry-samples-android/README.md | 57 +++++++++++++++++++ .../sentry-samples-android/build.gradle.kts | 32 +++++++++++ 2 files changed, 89 insertions(+) create mode 100644 sentry-samples/sentry-samples-android/README.md diff --git a/sentry-samples/sentry-samples-android/README.md b/sentry-samples/sentry-samples-android/README.md new file mode 100644 index 00000000000..c7c7ad0d89c --- /dev/null +++ b/sentry-samples/sentry-samples-android/README.md @@ -0,0 +1,57 @@ +# Sentry Sample Android App + +Sample application demonstrating how to use the Sentry Android SDK, including core functionality (error reporting, tracing, session replay, +profiling) and integrations (Compose, OkHttp, etc.). + +## How to run it? + +Install the app on your device or emulator: + +``` +./gradlew :sentry-samples:sentry-samples-android:installDebug +``` + +or simply open the project in Android Studio and run the `sentry-samples-android` configuration. + +You can also apply the [Sentry Android Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) (SAGP) when building (not applied by default): + +``` +./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp=true +``` + +In Android Studio, add `useSagp=true` to `gradle.properties` or pass it as a Gradle project property. + +## Build modes + +### With or without SAGP + +The sample app can be built with or without the SAGP. + +| Gradle Property | Required | Purpose | +|-----------------|--------------------------|----------------------------------------------------------------------------------------------------------------| +| `useSagp` | No (defaults to `false`) | When `true`, apply SAGP when building the sample app. When false or absent, build the sample app without SAGP. | + +You can configure SAGP properties via the lambda passed to `extensions.configure("sentry")` in the sample app's +`build.gradle.kts` file. + +### Builds against your local sentry-java branch + +Regardless of `useSagp`, the sample always depends on sentry-java modules from this monorepo (e.g., `projects.sentryAndroid`). SAGP's SDK +auto-installation is disabled, so the sample never pulls a separate SDK version from Maven. Local SDK changes in your branch are picked up +directly. + +## Viewing SDK output + +### Locally + +Debug builds enable SDK debug logging, so captured envelopes are printed to logcat (tag `Sentry`): + +``` +adb logcat -s Sentry +``` + +### On Sentry UI + +By default, SDK output produced by the sample app appears under the [sentry-sdk test project](https://sentry-sdks.sentry.io/issues/?project=5428559). +To redirect them to your own project, replace the test DSN (i.e., the `io.sentry.dsn` `meta-data` value in `src/main/AndroidManifest.xml` +with your own. diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index ed8cea25661..44d930975ec 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -1,5 +1,7 @@ import com.android.build.api.artifact.SingleArtifact import com.android.build.api.variant.impl.VariantImpl +import io.sentry.android.gradle.extensions.InstrumentationFeature +import io.sentry.android.gradle.extensions.SentryPluginExtension import org.apache.tools.ant.taskdefs.condition.Os import org.gradle.internal.extensions.stdlib.capitalized @@ -7,6 +9,36 @@ plugins { id("com.android.application") alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) + alias(libs.plugins.sentry) apply false +} + +val useSagp = + providers.gradleProperty("useSagp").map { it.equals("true", ignoreCase = true) }.orElse(false) + +if (useSagp.get()) { + apply(plugin = "io.sentry.android.gradle") +} + +plugins.withId("io.sentry.android.gradle") { + // Extension configs match non-SAGP builds. Update locally to test your feature. + extensions.configure("sentry") { + autoInstallation.enabled.set(false) + includeProguardMapping.set(false) + includeDependenciesReport.set(false) + telemetry.set(false) + tracingInstrumentation { + features.set( + setOf( + InstrumentationFeature.COMPOSE, + InstrumentationFeature.DATABASE, + InstrumentationFeature.FILE_IO, + InstrumentationFeature.OKHTTP, + ) + ) + logcat.enabled.set(false) + appStart.enabled.set(false) + } + } } android { From aab75f770bf249460a877aeacdca4902d0ad8929 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Mon, 15 Jun 2026 12:18:09 +0200 Subject: [PATCH 200/391] fix(samples): allow leak canary for non-debug builds, so the sample app doesn't crash when using AS profiler (#5545) --- .../sentry-samples-android/src/main/res/values/bools.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sentry-samples/sentry-samples-android/src/main/res/values/bools.xml diff --git a/sentry-samples/sentry-samples-android/src/main/res/values/bools.xml b/sentry-samples/sentry-samples-android/src/main/res/values/bools.xml new file mode 100644 index 00000000000..de1623ff077 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + true + From 9d2f4e3096958e67c6acc73926f7fde9e1bf2925 Mon Sep 17 00:00:00 2001 From: arb Date: Mon, 15 Jun 2026 21:51:29 +0200 Subject: [PATCH 201/391] chore(samples-android): Support mavenLocal for builds that apply the SAGP (#5539) chore(samples-android): Support mavenLocal for builds that apply the SAGP Adds wiring that lets us prefer mavenLocal SAGP artifacts, when present, for Android sample app builds that set -PuseSagp=true. If no local artifact is found, we fall back to libs.versions.toml. --- gradle/libs.versions.toml | 3 +- .../sentry-samples-android/README.md | 33 ++++++++++++++----- .../sentry-samples-android/build.gradle.kts | 5 +-- settings.gradle.kts | 15 +++++++-- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f6edafdc17f..e7fcababd6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,6 +29,7 @@ otelInstrumentationAlpha = "2.26.0-alpha" otelSemanticConventions = "1.40.0" otelSemanticConventionsAlpha = "1.40.0-alpha" retrofit = "2.9.0" +sagp = "6.10.0" slf4j = "1.7.30" springboot2 = "2.7.18" springboot3 = "3.5.0" @@ -66,7 +67,7 @@ springboot4 = { id = "org.springframework.boot", version.ref = "springboot4" } spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" } gretty = { id = "org.gretty", version = "4.0.0" } animalsniffer = { id = "ru.vyarus.animalsniffer", version = "2.0.1" } -sentry = { id = "io.sentry.android.gradle", version = "6.6.0"} +sentry = { id = "io.sentry.android.gradle", version.ref = "sagp"} shadow = { id = "com.gradleup.shadow", version = "9.4.1" } [libraries] diff --git a/sentry-samples/sentry-samples-android/README.md b/sentry-samples/sentry-samples-android/README.md index c7c7ad0d89c..f5c8caf8685 100644 --- a/sentry-samples/sentry-samples-android/README.md +++ b/sentry-samples/sentry-samples-android/README.md @@ -16,10 +16,10 @@ or simply open the project in Android Studio and run the `sentry-samples-android You can also apply the [Sentry Android Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) (SAGP) when building (not applied by default): ``` -./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp=true +./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp ``` -In Android Studio, add `useSagp=true` to `gradle.properties` or pass it as a Gradle project property. +In Android Studio, add `useSagp=` (empty value) to `gradle.properties`, or pass `-PuseSagp` as a Gradle project property. ## Build modes @@ -27,18 +27,33 @@ In Android Studio, add `useSagp=true` to `gradle.properties` or pass it as a Gra The sample app can be built with or without the SAGP. -| Gradle Property | Required | Purpose | -|-----------------|--------------------------|----------------------------------------------------------------------------------------------------------------| -| `useSagp` | No (defaults to `false`) | When `true`, apply SAGP when building the sample app. When false or absent, build the sample app without SAGP. | +| Gradle Property | Required | Purpose | +|-----------------|----------|-------------------------------------------------------------------------------------------------| +| `useSagp` | No | When present, apply SAGP when building the sample app. Omit the property to build without SAGP. | You can configure SAGP properties via the lambda passed to `extensions.configure("sentry")` in the sample app's `build.gradle.kts` file. -### Builds against your local sentry-java branch +### Testing an unpublished SAGP build -Regardless of `useSagp`, the sample always depends on sentry-java modules from this monorepo (e.g., `projects.sentryAndroid`). SAGP's SDK -auto-installation is disabled, so the sample never pulls a separate SDK version from Maven. Local SDK changes in your branch are picked up -directly. +`-PuseSagp` builds check `mavenLocal()` first when resolving SAGP. To test a local SAGP branch: + +1. In your `sentry-android-gradle-plugin` checkout, temporarily set a unique local version in `plugin-build/gradle.properties` (e.g. + `6.10.0-LOCAL`) and publish to Maven Local: + +``` +./gradlew -p plugin-build publishToMavenLocal +``` + +Re-run `publishToMavenLocal` after each SAGP change. + +2. Temporarily bump the `sagp` pin in `gradle/libs.versions.toml` to match that version. + +Then build from sentry-java: + +``` +./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp +``` ## Viewing SDK output diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 44d930975ec..e19c02700fb 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -12,10 +12,7 @@ plugins { alias(libs.plugins.sentry) apply false } -val useSagp = - providers.gradleProperty("useSagp").map { it.equals("true", ignoreCase = true) }.orElse(false) - -if (useSagp.get()) { +if (providers.gradleProperty("useSagp").isPresent) { apply(plugin = "io.sentry.android.gradle") } diff --git a/settings.gradle.kts b/settings.gradle.kts index c435c382b79..51dd84abb4f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,10 +1,19 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() + repositories { + // Prefer local SAGP artifact if one exists; otherwise fall back to libs.versions.toml. + if (providers.gradleProperty("useSagp").isPresent) { + mavenLocal { + content { + includeGroup("io.sentry") + includeGroup("io.sentry.android.gradle") + } + } } + mavenCentral() + gradlePluginPortal() + } } plugins { From 3eb7173bf3fbd040000b90276e47f41aed8b05db Mon Sep 17 00:00:00 2001 From: arb Date: Tue, 16 Jun 2026 08:09:41 +0200 Subject: [PATCH 202/391] feat(android-sqlite): Add SentrySQLiteDriver (JAVA-275) (#5466) feat(android-sqlite): Add SentrySQLiteDriver (JAVA-275) Introduces support for AndroidX's SQLiteDriver via a new SentrySQLiteDriver wrapper. SentrySQLiteDriver automatically creates spans for each SQL statement it executes. Its data scheme closely tracks that of SentrySupportSQLiteOpenHelper, which it's designed to replace. (Span duration is an important exception; see the SentrySQLiteStatement KDoc for more details.) A key motivation behind Google's use of SQLiteDriver with Room 2.7+ was Kotlin Multiplatform support. We're careful to keep the SentrySQLiteDriver KMP-compatible as well, should we one day want to lift it into sentry-kotlin-multiplatform. --- Co-authored-by: Angus Holder <7407345+angusholder@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- sentry-android-sqlite/README.md | 21 ++ .../android/sqlite/SQLiteSpanManager.kt | 43 +-- .../main/java/io/sentry/sqlite/DbMetadata.kt | 49 +++ .../sqlite/SQLiteSpanInstrumentation.kt | 99 ++++++ .../sentry/sqlite/SentrySQLiteConnection.kt | 15 + .../io/sentry/sqlite/SentrySQLiteDriver.kt | 79 +++++ .../io/sentry/sqlite/SentrySQLiteStatement.kt | 80 +++++ .../src/test/AndroidManifest.xml | 13 + .../java/io/sentry/sqlite/DbMetadataTest.kt | 87 ++++++ .../sqlite/SQLiteSpanInstrumentationTest.kt | 193 ++++++++++++ .../sqlite/SentrySQLiteConnectionTest.kt | 63 ++++ .../sentry/sqlite/SentrySQLiteDriverTest.kt | 145 +++++++++ .../sqlite/SentrySQLiteStatementTest.kt | 291 ++++++++++++++++++ 14 files changed, 1144 insertions(+), 36 deletions(-) create mode 100644 sentry-android-sqlite/README.md create mode 100644 sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt create mode 100644 sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt create mode 100644 sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt create mode 100644 sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt create mode 100644 sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt create mode 100644 sentry-android-sqlite/src/test/AndroidManifest.xml create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e7fcababd6c..1ebcb8e0e38 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -95,7 +95,7 @@ androidx-lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-commo androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "androidxLifecycle" } androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "androidxNavigation" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigation" } -androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.5.2" } +androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.6.2" } androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" } androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" } async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" } diff --git a/sentry-android-sqlite/README.md b/sentry-android-sqlite/README.md new file mode 100644 index 00000000000..7bf9edf3474 --- /dev/null +++ b/sentry-android-sqlite/README.md @@ -0,0 +1,21 @@ +# sentry-android-sqlite + +SQLite instrumentation for AndroidX APIs. + +Two instrumentation paths are supported: + +- **`androidx.sqlite.SQLiteDriver`**: Used by Room 2.7+ and 3.0+. +- **`androidx.sqlite.db.SupportSQLiteOpenHelper`**: Used by SQLDelight and legacy (pre-2.7) Room. Applied automatically by the Sentry Android Gradle Plugin. + +To avoid duplicate spans, only one path should be used per database file. Most Room and SQLDelight APIs enforce that division. The exception is Room's `SupportSQLiteDriver`: either the `SupportSQLiteOpenHelper` it consumes should be wrapped or the support driver itself, but never both. + +## Package layout + +The module is organized as two separate packages: + +- **`io.sentry.android.sqlite`**: Android-specific code. Depends on `android.database.*` and/or on `androidx.sqlite.db.*`. +- **`io.sentry.sqlite`**: No Android-specific code. Depends only on multiplatform `androidx.sqlite.*`. + +The split anticipates future Kotlin Multiplatform support. The `androidx.sqlite.*` interfaces are defined in KMP's `commonMain` source set and are used by Room in non-JVM environments. Classes in `io.sentry.sqlite` are written against those portable interfaces and are intended to lift cleanly into a KMP `commonMain` source set if/when the `sentry` core gains multiplatform targets. + +Note that the module artifact itself (`sentry-android-sqlite`) is currently an Android-only AAR regardless of package layout. diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt index 1bdeb7d369c..3495d3a71f0 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt @@ -3,21 +3,17 @@ package io.sentry.android.sqlite import android.database.CrossProcessCursor import android.database.SQLException import io.sentry.IScopes -import io.sentry.ISpan -import io.sentry.Instrumenter import io.sentry.ScopesAdapter import io.sentry.SentryIntegrationPackageStorage -import io.sentry.SentryStackTraceFactory -import io.sentry.SpanDataConvention import io.sentry.SpanStatus - -private const val TRACE_ORIGIN = "auto.db.sqlite" +import io.sentry.sqlite.SQLiteSpanInstrumentation internal class SQLiteSpanManager( private val scopes: IScopes = ScopesAdapter.getInstance(), - private val databaseName: String? = null, + databaseName: String? = null, ) { - private val stackTraceFactory = SentryStackTraceFactory(scopes.options) + + private val spans = SQLiteSpanInstrumentation.fromDatabaseName(databaseName, scopes) init { SentryIntegrationPackageStorage.getInstance().addIntegration("SQLite") @@ -33,8 +29,8 @@ internal class SQLiteSpanManager( @Suppress("TooGenericExceptionCaught", "UNCHECKED_CAST") @Throws(SQLException::class) fun performSql(sql: String, operation: () -> T): T { - val startTimestamp = scopes.getOptions().dateProvider.now() - var span: ISpan? = null + val startTimestamp = spans.startTimestamp() + return try { val result = operation() /* @@ -45,34 +41,11 @@ internal class SQLiteSpanManager( if (result is CrossProcessCursor) { return SentryCrossProcessCursor(result, this, sql) as T } - span = scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY) - span?.spanContext?.origin = TRACE_ORIGIN - span?.status = SpanStatus.OK + spans.recordSpan(sql, startTimestamp, SpanStatus.OK) result } catch (e: Throwable) { - span = scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY) - span?.spanContext?.origin = TRACE_ORIGIN - span?.status = SpanStatus.INTERNAL_ERROR - span?.throwable = e + spans.recordSpan(sql, startTimestamp, SpanStatus.INTERNAL_ERROR, e) throw e - } finally { - span?.apply { - val isMainThread: Boolean = scopes.options.threadChecker.isMainThread - setData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY, isMainThread) - if (isMainThread) { - setData(SpanDataConvention.CALL_STACK_KEY, stackTraceFactory.inAppCallStack) - } - // if db name is null, then it's an in-memory database as per - // https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt;l=38-42 - if (databaseName != null) { - setData(SpanDataConvention.DB_SYSTEM_KEY, "sqlite") - setData(SpanDataConvention.DB_NAME_KEY, databaseName) - } else { - setData(SpanDataConvention.DB_SYSTEM_KEY, "in-memory") - } - - finish() - } } } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt new file mode 100644 index 00000000000..aa3c186b6d9 --- /dev/null +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt @@ -0,0 +1,49 @@ +package io.sentry.sqlite + +/** [DB_SYSTEM_KEY][io.sentry.SpanDataConvention.DB_SYSTEM_KEY] value for in-memory databases. */ +internal const val DB_SYSTEM_IN_MEMORY = "in-memory" + +/** [DB_SYSTEM_KEY][io.sentry.SpanDataConvention.DB_SYSTEM_KEY] value for SQLite databases. */ +internal const val DB_SYSTEM_SQLITE = "sqlite" + +/** + * Sentinel file name that [SQLiteDriver.open][androidx.sqlite.SQLiteDriver.open] interprets as an + * in-memory database (see docs + * [here](https://developer.android.com/reference/androidx/sqlite/driver/AndroidSQLiteDriver)). + */ +private const val IN_MEMORY_DB_FILENAME = ":memory:" + +/** Path separators matching [File.separatorChar][java.io.File.separatorChar]. */ +private val FILE_NAME_PATH_SEPARATORS = charArrayOf('/', '\\') + +internal data class DbMetadata(val name: String?, val system: String) + +/** + * Returns metadata based on the [fileName] argument passed to + * [SQLiteDriver.open][androidx.sqlite.SQLiteDriver.open]. + */ +internal fun dbMetadataFromFileName(fileName: String): DbMetadata { + if (fileName == IN_MEMORY_DB_FILENAME) { + return DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY) + } + + val trimmed = fileName.trimEnd { it in FILE_NAME_PATH_SEPARATORS } + if (trimmed.isEmpty()) { + return DbMetadata(name = null, system = DB_SYSTEM_SQLITE) + } + + val index = trimmed.lastIndexOfAny(FILE_NAME_PATH_SEPARATORS) + val basename = if (index >= 0) trimmed.substring(index + 1) else trimmed + return DbMetadata(name = basename.ifEmpty { null }, system = DB_SYSTEM_SQLITE) +} + +/** + * Returns metadata based on + * [SupportSQLiteOpenHelper.databaseName][androidx.sqlite.db.SupportSQLiteOpenHelper.databaseName]. + */ +internal fun dbMetadataFromDatabaseName(databaseName: String?): DbMetadata = + if (databaseName == null) { + DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY) + } else { + DbMetadata(name = databaseName, system = DB_SYSTEM_SQLITE) + } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt new file mode 100644 index 00000000000..4c925198bd5 --- /dev/null +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt @@ -0,0 +1,99 @@ +package io.sentry.sqlite + +import io.sentry.IScopes +import io.sentry.Instrumenter +import io.sentry.ScopesAdapter +import io.sentry.SentryDate +import io.sentry.SentryLongDate +import io.sentry.SentryStackTraceFactory +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus + +private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite" + +/** Shared span instrumentation for SQLite. */ +internal class SQLiteSpanInstrumentation( + private val scopes: IScopes, + private val dbMetadata: DbMetadata, +) { + + private val stackTraceFactory = SentryStackTraceFactory(scopes.options) + + /** + * Returns a start timestamp for a `db.sql.query` span. + * + * Exposed so callers can capture a wall-clock start before accumulating database time. + * Internalizing the start time in [recordSpan] would shift spans to end-of-work on the trace + * timeline, which is less desirable. + */ + fun startTimestamp(): SentryDate = scopes.options.dateProvider.now() + + /** Records a `db.sql.query` span from [startTimestamp] to the moment of invocation. */ + fun recordSpan( + sql: String, + startTimestamp: SentryDate, + status: SpanStatus, + throwable: Throwable? = null, + ) { + recordSpan(sql, startTimestamp, endTimestamp = null, status, throwable) + } + + /** Records a `db.sql.query` span from [startTimestamp] to [startTimestamp] + [durationNanos]. */ + fun recordSpan( + sql: String, + startTimestamp: SentryDate, + durationNanos: Long, + status: SpanStatus, + throwable: Throwable? = null, + ) { + val endTimestamp = SentryLongDate(startTimestamp.nanoTimestamp() + durationNanos) + recordSpan(sql, startTimestamp, endTimestamp, status, throwable) + } + + private fun recordSpan( + sql: String, + startTimestamp: SentryDate, + endTimestamp: SentryDate?, + status: SpanStatus, + throwable: Throwable?, + ) { + scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY)?.apply { + spanContext.origin = SQLITE_TRACE_ORIGIN + throwable?.let { this.throwable = it } + + val isMainThread = scopes.options.threadChecker.isMainThread + setData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY, isMainThread) + + if (isMainThread) { + setData(SpanDataConvention.CALL_STACK_KEY, stackTraceFactory.inAppCallStack) + } + + dbMetadata.name?.let { setData(SpanDataConvention.DB_NAME_KEY, it) } + setData(SpanDataConvention.DB_SYSTEM_KEY, dbMetadata.system) + finish(status, endTimestamp) + } + } + + companion object { + + /** + * Returns [SQLiteSpanInstrumentation] based on the [fileName] argument passed to + * [SQLiteDriver.open][androidx.sqlite.SQLiteDriver.open]. + */ + fun fromFileName( + fileName: String, + scopes: IScopes = ScopesAdapter.getInstance(), + ): SQLiteSpanInstrumentation = + SQLiteSpanInstrumentation(scopes, dbMetadataFromFileName(fileName)) + + /** + * Returns [SQLiteSpanInstrumentation] based on + * [SupportSQLiteOpenHelper.databaseName][androidx.sqlite.db.SupportSQLiteOpenHelper.databaseName]. + */ + fun fromDatabaseName( + databaseName: String?, + scopes: IScopes = ScopesAdapter.getInstance(), + ): SQLiteSpanInstrumentation = + SQLiteSpanInstrumentation(scopes, dbMetadataFromDatabaseName(databaseName)) + } +} diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt new file mode 100644 index 00000000000..45ee9a39b27 --- /dev/null +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt @@ -0,0 +1,15 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteStatement + +internal class SentrySQLiteConnection( + private val delegate: SQLiteConnection, + private val spans: SQLiteSpanInstrumentation, +) : SQLiteConnection by delegate { + + override fun prepare(sql: String): SQLiteStatement { + val statement = delegate.prepare(sql) + return statement as? SentrySQLiteStatement ?: SentrySQLiteStatement(statement, spans, sql) + } +} diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt new file mode 100644 index 00000000000..9a619c418a5 --- /dev/null +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt @@ -0,0 +1,79 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteDriver +import io.sentry.ScopesAdapter +import io.sentry.SentryIntegrationPackageStorage +import io.sentry.SentryLevel + +/** + * Wraps a [SQLiteDriver] and automatically adds spans for each SQL statement it executes. + * + * Example usage: + * ``` + * val driver = SentrySQLiteDriver.create(AndroidSQLiteDriver()) + * ``` + * + * If you use Room: + * ``` + * val database = Room.databaseBuilder(context, MyDatabase::class.java, "dbName") + * .setDriver(SentrySQLiteDriver.create(AndroidSQLiteDriver())) + * .build() + * ``` + * + * **Warning:** Do not use [SentrySQLiteDriver] together with + * [SentrySupportSQLiteOpenHelper][io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper] on the + * same database file. Both wrappers instrument at different layers and combining them will produce + * duplicate spans. + * + * @param delegate The [SQLiteDriver] instance to delegate calls to. + */ +internal class SentrySQLiteDriver private constructor(private val delegate: SQLiteDriver) : + SQLiteDriver { + + init { + SentryIntegrationPackageStorage.getInstance().addIntegration("SQLiteDriver") + } + + override val hasConnectionPool: Boolean + get() = + try { + delegate.hasConnectionPool + } catch (_: LinkageError) { + // Delegates on androidx.sqlite < 2.6.0 won't have a hasConnectionPool property. + false + } + + @Suppress("TooGenericExceptionCaught") + override fun open(fileName: String): SQLiteConnection { + val connection = delegate.open(fileName) + + return try { + val spans = SQLiteSpanInstrumentation.fromFileName(fileName) + // create() ensures delegate is unwrapped, so we don't need to protect against double-wrapping + // the connection. + SentrySQLiteConnection(connection, spans) + } catch (t: Throwable) { + ScopesAdapter.getInstance() + .options + .logger + .log( + SentryLevel.ERROR, + "Failed to instrument SQLite connection; returning uninstrumented connection.", + t, + ) + connection + } + } + + companion object { + + /** + * Wraps the provided delegate in a [SentrySQLiteDriver]. Returns the delegate as-is if already + * wrapped. + */ + @JvmStatic + fun create(delegate: SQLiteDriver): SQLiteDriver = + delegate as? SentrySQLiteDriver ?: SentrySQLiteDriver(delegate) + } +} diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt new file mode 100644 index 00000000000..41df37444b5 --- /dev/null +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt @@ -0,0 +1,80 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteStatement +import io.sentry.SentryDate +import io.sentry.SpanStatus + +/** + * Wraps a [SQLiteStatement] and records a single Sentry span covering all [step] calls for the + * statement's lifetime (until [step] iteration is complete or the statement is [reset] or + * [closed][close]). + * + * Span duration is restricted to accumulated database time, i.e., each [step] call is individually + * timed and the durations are summed. Time the application spends between steps (e.g., processing + * rows, sleeping, or doing I/O) is intentionally excluded. + * + * Not thread-safe: assumes sequential access within each SQL statement (normal SQLite usage). + */ +internal class SentrySQLiteStatement( + private val delegate: SQLiteStatement, + private val spans: SQLiteSpanInstrumentation, + private val sql: String, + private val nanoTimeProvider: () -> Long = { System.nanoTime() }, +) : SQLiteStatement by delegate { + + private var firstStepTimestamp: SentryDate? = null + private var accumulatedDbNanos: Long = 0L + private var stepsComplete = false + private var closed = false + + @Suppress("TooGenericExceptionCaught") + override fun step(): Boolean { + if (stepsComplete || closed) { + return delegate.step() + } + + val beforeNanos = nanoTimeProvider() + return try { + if (firstStepTimestamp == null) { + firstStepTimestamp = spans.startTimestamp() + } + + stepsComplete = !delegate.step() + accumulatedDbNanos += nanoTimeProvider() - beforeNanos + if (stepsComplete) { + recordSpan(SpanStatus.OK) + } + !stepsComplete + } catch (e: Throwable) { + accumulatedDbNanos += nanoTimeProvider() - beforeNanos + recordSpan(SpanStatus.INTERNAL_ERROR, e) + throw e + } + } + + override fun reset() { + if (closed) { + return delegate.reset() + } + + try { + recordSpan(SpanStatus.OK) + } finally { + delegate.reset() + stepsComplete = false + } + } + + override fun close() { + closed = true + delegate.use { recordSpan(SpanStatus.OK) } + } + + private fun recordSpan(status: SpanStatus, throwable: Throwable? = null) { + val start = firstStepTimestamp ?: return + val duration = accumulatedDbNanos + firstStepTimestamp = null + accumulatedDbNanos = 0L + spans.recordSpan(sql, start, duration, status, throwable) + } +} diff --git a/sentry-android-sqlite/src/test/AndroidManifest.xml b/sentry-android-sqlite/src/test/AndroidManifest.xml new file mode 100644 index 00000000000..967265a1f16 --- /dev/null +++ b/sentry-android-sqlite/src/test/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt new file mode 100644 index 00000000000..227b9d9558c --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt @@ -0,0 +1,87 @@ +package io.sentry.sqlite + +import kotlin.test.Test +import kotlin.test.assertEquals + +class DbMetadataTest { + + @Test + fun `dbMetadataFromFileName returns in-memory system with no db name for in-memory sentinel`() { + assertEquals( + DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY), + dbMetadataFromFileName(":memory:"), + ) + } + + @Test + fun `dbMetadataFromDatabaseName returns in-memory system with no db name when databaseName is null`() { + assertEquals( + DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY), + dbMetadataFromDatabaseName(null), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and db name for unix path`() { + assertEquals( + DbMetadata(name = "tracks.db", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("/data/data/com.example/databases/tracks.db"), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and db name when fileName has no separator`() { + assertEquals( + DbMetadata(name = "tracks", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("tracks"), + ) + assertEquals( + DbMetadata(name = "tracks.db", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("tracks.db"), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and db name for relative path with forward slashes`() { + assertEquals( + DbMetadata(name = "myapp.db", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("databases/myapp.db"), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and db name for windows-style path`() { + assertEquals( + DbMetadata(name = "myapp.db", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("C:\\Users\\app\\databases\\myapp.db"), + ) + } + + @Test + fun `dbMetadataFromFileName uses last separator when both slash types are present`() { + assertEquals( + DbMetadata(name = "db.sqlite", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("/data\\mixed/path\\db.sqlite"), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and db name when fileName ends with separator`() { + assertEquals( + DbMetadata(name = "databases", system = DB_SYSTEM_SQLITE), + dbMetadataFromFileName("/data/data/com.example/databases/"), + ) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and unknown db name when fileName contains only separators`() { + assertEquals(DbMetadata(name = null, system = DB_SYSTEM_SQLITE), dbMetadataFromFileName("/")) + assertEquals(DbMetadata(name = null, system = DB_SYSTEM_SQLITE), dbMetadataFromFileName("///")) + assertEquals(DbMetadata(name = null, system = DB_SYSTEM_SQLITE), dbMetadataFromFileName("\\\\")) + } + + @Test + fun `dbMetadataFromFileName returns sqlite system and unknown db name for empty fileName`() { + assertEquals(DbMetadata(name = null, system = DB_SYSTEM_SQLITE), dbMetadataFromFileName("")) + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt new file mode 100644 index 00000000000..ead123a190b --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt @@ -0,0 +1,193 @@ +package io.sentry.sqlite + +import io.sentry.IScopes +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import io.sentry.util.thread.IThreadChecker +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever + +class SQLiteSpanInstrumentationTest { + + private class Fixture { + + val scopes = mock() + lateinit var sentryTracer: SentryTracer + lateinit var options: SentryOptions + + fun getSut( + isTransactionActive: Boolean = true, + fileName: String = ":memory:", + ): SQLiteSpanInstrumentation { + options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(scopes.options).thenReturn(options) + sentryTracer = SentryTracer(TransactionContext("name", "op"), scopes) + if (isTransactionActive) { + whenever(scopes.span).thenReturn(sentryTracer) + } + return SQLiteSpanInstrumentation.fromFileName(fileName, scopes) + } + } + + private val fixture = Fixture() + + @Test + fun `recordSpan records a span if a transaction is active`() { + val sut = fixture.getSut(isTransactionActive = true) + sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + assertEquals(1, fixture.sentryTracer.children.size) + } + + @Test + fun `recordSpan does not record a span if no transaction is active`() { + val sut = fixture.getSut(isTransactionActive = false) + val start = sut.startTimestamp() + sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + assertEquals(0, fixture.sentryTracer.children.size) + } + + @Test + fun `recordSpan creates a span with correct properties`() { + val sut = fixture.getSut() + val start = sut.startTimestamp() + sut.recordSpan("SELECT * FROM users", start, 1_000_000, SpanStatus.OK) + + val span = fixture.sentryTracer.children.firstOrNull() + assertNotNull(span) + assertEquals("db.sql.query", span.operation) + assertEquals("SELECT * FROM users", span.description) + assertEquals("auto.db.sqlite", span.spanContext.origin) + assertEquals(SpanStatus.OK, span.status) + assertTrue(span.isFinished) + } + + @Test + fun `recordSpan sets finishDate equal to startDate + durationNanos`() { + val sut = fixture.getSut() + val start = sut.startTimestamp() + val durationNanos = 42_000_000L + + sut.recordSpan("SELECT 1", start, durationNanos, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertEquals(start, span.startDate) + assertEquals(span.startDate.nanoTimestamp() + durationNanos, span.finishDate!!.nanoTimestamp()) + } + + @Test + fun `recordSpan attaches throwable when provided`() { + val sut = fixture.getSut() + val start = sut.startTimestamp() + val exception = RuntimeException("disk I/O error") + + sut.recordSpan("INSERT INTO t VALUES(1)", start, 500_000, SpanStatus.INTERNAL_ERROR, exception) + + val span = fixture.sentryTracer.children.first() + assertEquals(SpanStatus.INTERNAL_ERROR, span.status) + assertEquals(exception, span.throwable) + } + + @Test + fun `recordSpan sets db system and db name when fileName is not the in-memory sentinel`() { + val sut = fixture.getSut(fileName = "/data/data/com.example/databases/tracks.db") + val start = sut.startTimestamp() + sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) + assertEquals("tracks.db", span.data[SpanDataConvention.DB_NAME_KEY]) + } + + @Test + fun `recordSpan sets db system only when fileName is the in-memory sentinel`() { + val sut = fixture.getSut(fileName = ":memory:") + val start = sut.startTimestamp() + sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertEquals("in-memory", span.data[SpanDataConvention.DB_SYSTEM_KEY]) + assertNull(span.data[SpanDataConvention.DB_NAME_KEY]) + } + + @Test + fun `recordSpan sets blocked_main_thread to true and attaches call stack on main thread`() { + val sut = fixture.getSut() + fixture.options.threadChecker = mock() + whenever(fixture.options.threadChecker.isMainThread).thenReturn(true) + whenever(fixture.options.threadChecker.currentThreadName).thenReturn("main") + + sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertTrue(span.getData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY) as Boolean) + assertNotNull(span.getData(SpanDataConvention.CALL_STACK_KEY)) + } + + @Test + fun `recordSpan sets blocked_main_thread to false and does not attach a call stack on background thread`() { + val sut = fixture.getSut() + fixture.options.threadChecker = mock() + whenever(fixture.options.threadChecker.isMainThread).thenReturn(false) + whenever(fixture.options.threadChecker.currentThreadName).thenReturn("worker") + + sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertFalse(span.getData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY) as Boolean) + assertNull(span.getData(SpanDataConvention.CALL_STACK_KEY)) + } + + @Test + fun `recordSpan without a duration finishes the span at the time of invocation`() { + val sut = fixture.getSut() + val start = sut.startTimestamp() + + sut.recordSpan("SELECT 1", start, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertTrue(span.isFinished) + assertEquals(SpanStatus.OK, span.status) + // Unlike the duration overload, no synthetic end timestamp is supplied; the span finishes at + // "now", i.e. at or after its start. + assertTrue(span.finishDate!!.nanoTimestamp() >= start.nanoTimestamp()) + } + + @Test + fun `fromFileName sets db name from fileName`() { + val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(fixture.scopes.options).thenReturn(options) + fixture.sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) + whenever(fixture.scopes.span).thenReturn(fixture.sentryTracer) + + val sut = SQLiteSpanInstrumentation.fromFileName("tracks.db", fixture.scopes) + sut.recordSpan("SELECT 1", sut.startTimestamp(), SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) + assertEquals("tracks.db", span.data[SpanDataConvention.DB_NAME_KEY]) + } + + @Test + fun `fromDatabaseName sets db name from databaseName`() { + val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(fixture.scopes.options).thenReturn(options) + fixture.sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) + whenever(fixture.scopes.span).thenReturn(fixture.sentryTracer) + + val sut = SQLiteSpanInstrumentation.fromDatabaseName("tracks.db", fixture.scopes) + sut.recordSpan("SELECT 1", sut.startTimestamp(), SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) + assertEquals("tracks.db", span.data[SpanDataConvention.DB_NAME_KEY]) + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt new file mode 100644 index 00000000000..b405d054f03 --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt @@ -0,0 +1,63 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteStatement +import io.sentry.IScopes +import io.sentry.SentryOptions +import kotlin.test.Test +import kotlin.test.assertIs +import kotlin.test.assertSame +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentrySQLiteConnectionTest { + + private class Fixture { + + val scopes = mock() + val mockConnection = mock() + val mockStatement = mock() + lateinit var options: SentryOptions + + fun getSut(): SentrySQLiteConnection { + options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(scopes.options).thenReturn(options) + whenever(mockConnection.prepare("SELECT 1")).thenReturn(mockStatement) + val spans = SQLiteSpanInstrumentation.fromFileName("test.db", scopes) + return SentrySQLiteConnection(mockConnection, spans) + } + } + + private val fixture = Fixture() + + @Test + fun `prepare returns a SentrySQLiteStatement`() { + val sut = fixture.getSut() + val statement = sut.prepare("SELECT 1") + assertIs(statement) + } + + @Test + fun `prepare with already-wrapped statement returns same instance without re-wrapping`() { + val sut = fixture.getSut() + val spans = SQLiteSpanInstrumentation.fromFileName("test.db", fixture.scopes) + val alreadyInstrumented = SentrySQLiteStatement(fixture.mockStatement, spans, "SELECT 1") + whenever(fixture.mockConnection.prepare("SELECT 1")).thenReturn(alreadyInstrumented) + + val statement = sut.prepare("SELECT 1") + + assertSame(alreadyInstrumented, statement) + } + + @Test + fun `all calls are propagated to the delegate`() { + val sut = fixture.getSut() + + sut.prepare("SELECT 1") + verify(fixture.mockConnection).prepare("SELECT 1") + + sut.close() + verify(fixture.mockConnection).close() + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt new file mode 100644 index 00000000000..9b2345a975f --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt @@ -0,0 +1,145 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteDriver +import androidx.sqlite.SQLiteStatement +import io.sentry.IScopes +import io.sentry.Sentry +import io.sentry.SentryIntegrationPackageStorage +import io.sentry.SentryOptions +import io.sentry.SentryTracer +import io.sentry.SpanDataConvention +import io.sentry.TransactionContext +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertIs +import kotlin.test.assertNotNull +import kotlin.test.assertSame +import kotlin.test.assertTrue +import org.junit.Before +import org.mockito.Mockito +import org.mockito.kotlin.mock +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentrySQLiteDriverTest { + + private class Fixture { + + val mockDriver = mock() + val mockConnection = mock() + + fun getSut(fileName: String): SentrySQLiteDriver { + whenever(mockDriver.open(fileName)).thenReturn(mockConnection) + return SentrySQLiteDriver.create(mockDriver) as SentrySQLiteDriver + } + } + + private val fixture = Fixture() + + @Before + fun setup() { + SentryIntegrationPackageStorage.getInstance().clearStorage() + } + + @Test + fun `create registers SQLiteDriver integration`() { + assertFalse(SentryIntegrationPackageStorage.getInstance().integrations.contains("SQLiteDriver")) + SentrySQLiteDriver.create(fixture.mockDriver) + assertTrue(SentryIntegrationPackageStorage.getInstance().integrations.contains("SQLiteDriver")) + } + + @Test + fun `create with non-wrapped driver returns SentrySQLiteDriver`() { + val result = SentrySQLiteDriver.create(fixture.mockDriver) + assertIs(result) + } + + @Test + fun `create with already-wrapped driver returns same instance without re-wrapping`() { + val wrapped = SentrySQLiteDriver.create(fixture.mockDriver) + val doubleWrapped = SentrySQLiteDriver.create(wrapped) + assertSame(wrapped, doubleWrapped) + } + + @Test + fun `hasConnectionPool forwards delegate value when supported`() { + whenever(fixture.mockDriver.hasConnectionPool).thenReturn(true) + val sut = SentrySQLiteDriver.create(fixture.mockDriver) as SentrySQLiteDriver + assertTrue(sut.hasConnectionPool) + } + + @Test + fun `hasConnectionPool returns false when delegate throws LinkageError`() { + whenever(fixture.mockDriver.hasConnectionPool).thenThrow(AbstractMethodError()) + val sut = SentrySQLiteDriver.create(fixture.mockDriver) as SentrySQLiteDriver + assertFalse(sut.hasConnectionPool) + } + + @Test + fun `hasConnectionPool does not catch non-LinkageErrors`() { + whenever(fixture.mockDriver.hasConnectionPool).thenThrow(IllegalStateException()) + val sut = SentrySQLiteDriver.create(fixture.mockDriver) as SentrySQLiteDriver + assertFailsWith { sut.hasConnectionPool } + } + + @Test + fun `open returns SentrySQLiteConnection wrapping delegate if wrapping succeeds`() { + val driver = fixture.getSut("myapp.db") + val connection = driver.open("myapp.db") + assertIs(connection) + } + + @Test + fun `open returns the unwrapped delegate if wrapping fails`() { + val brokenScopes = mock() + val validOptions = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(brokenScopes.options) + .thenThrow(RuntimeException("Sentry options unavailable")) + .thenReturn(validOptions) + + Mockito.mockStatic(Sentry::class.java).use { mockedSentry -> + mockedSentry.`when` { Sentry.getCurrentScopes() }.thenReturn(brokenScopes) + + val driver = fixture.getSut("myapp.db") + val result = driver.open("myapp.db") + + assertSame(fixture.mockConnection, result) + verify(fixture.mockDriver).open("myapp.db") + } + } + + // Smoke test ensuring all layers are properly wired up. + @Test + fun `full stack produces a span with correct metadata`() { + val scopes = mock() + val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + whenever(scopes.options).thenReturn(options) + val tracer = SentryTracer(TransactionContext("name", "op"), scopes) + whenever(scopes.span).thenReturn(tracer) + + val mockStatement = mock() + whenever(fixture.mockConnection.prepare("SELECT * FROM users")).thenReturn(mockStatement) + whenever(mockStatement.step()).thenReturn(true, false) + + Mockito.mockStatic(Sentry::class.java).use { mockedSentry -> + mockedSentry.`when` { Sentry.getCurrentScopes() }.thenReturn(scopes) + + val driver = fixture.getSut("/data/data/com.example/databases/myapp.db") + val connection = driver.open("/data/data/com.example/databases/myapp.db") + val statement = connection.prepare("SELECT * FROM users") + + assertIs(connection) + assertIs(statement) + + statement.step() + statement.step() + + val span = tracer.children.firstOrNull() + assertNotNull(span) + assertEquals("myapp.db", span.data[SpanDataConvention.DB_NAME_KEY]) + } + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt new file mode 100644 index 00000000000..6691910e358 --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt @@ -0,0 +1,291 @@ +package io.sentry.sqlite + +import androidx.sqlite.SQLiteStatement +import io.sentry.SentryLongDate +import io.sentry.SpanStatus +import java.util.concurrent.atomic.AtomicLong +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import org.mockito.kotlin.any +import org.mockito.kotlin.anyOrNull +import org.mockito.kotlin.argumentCaptor +import org.mockito.kotlin.eq +import org.mockito.kotlin.mock +import org.mockito.kotlin.times +import org.mockito.kotlin.verify +import org.mockito.kotlin.whenever + +class SentrySQLiteStatementTest { + + private class Fixture { + val mockStatement = mock() + val mockSpans = mock() + val startDate = SentryLongDate(1_000_000_000_000L) + val fakeClock = AtomicLong(0L) + + fun getSut(sql: String): SentrySQLiteStatement { + whenever(mockSpans.startTimestamp()).thenReturn(startDate) + return SentrySQLiteStatement(mockStatement, mockSpans, sql, fakeClock::getAndIncrement) + } + } + + private val fixture = Fixture() + + @Test + fun `step calls recordSpan once after iteration completes`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()).thenReturn(true, true, false) + sut.step() + sut.step() + verifyNeverCalledRecordSpan() + sut.step() + verify(fixture.mockSpans) + .recordSpan( + eq("SELECT * FROM users"), + eq(fixture.startDate), + any(), + eq(SpanStatus.OK), + anyOrNull(), + ) + } + + @Test + fun `step that throws an exception calls recordSpan with INTERNAL_ERROR and exception`() { + val sut = fixture.getSut("BAD SQL") + val exception = RuntimeException("db error") + whenever(fixture.mockStatement.step()).thenThrow(exception) + + assertFailsWith { sut.step() } + + verify(fixture.mockSpans) + .recordSpan( + eq("BAD SQL"), + eq(fixture.startDate), + any(), + eq(SpanStatus.INTERNAL_ERROR), + eq(exception), + ) + } + + @Test + fun `step after exception calls recordSpan once new iteration cycle completes`() { + val sut = fixture.getSut("SELECT 1") + whenever(fixture.mockStatement.step()) + .thenThrow(RuntimeException("first failure")) + .thenReturn(false) + + assertFailsWith { sut.step() } + verifyCalledRecordSpan(times = 1) + + sut.step() + verifyCalledRecordSpan(times = 2) + } + + @Test + fun `step after step iteration completes does not call recordSpan again`() { + val sut = fixture.getSut("SELECT 1") + whenever(fixture.mockStatement.step()).thenReturn(true, false, false) + + sut.step() + sut.step() + verifyCalledRecordSpan(times = 1) + + sut.step() + + verifyCalledRecordSpan(times = 1) + verify(fixture.mockStatement, times(3)).step() + } + + @Test + fun `reset calls recordSpan if step iteration is in progress`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()).thenReturn(true) + sut.step() + sut.step() + verifyNeverCalledRecordSpan() + + sut.reset() + + verifyCalledRecordSpan() + } + + @Test + fun `reset does not call recordSpan if step iteration has not started`() { + val sut = fixture.getSut("SELECT 1") + sut.reset() + verifyNeverCalledRecordSpan() + } + + @Test + fun `reset does not call recordSpan if step iteration has completed`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()).thenReturn(true, false) + sut.step() + sut.step() + verifyCalledRecordSpan(times = 1) + + sut.reset() + + verifyCalledRecordSpan(times = 1) + } + + @Test + fun `step after reset calls recordSpan when new iteration cycle completes`() { + val sut = fixture.getSut("SELECT 1") + sut.step() + verifyCalledRecordSpan(times = 1) + + sut.reset() + sut.step() + + verifyCalledRecordSpan(times = 2) + } + + @Test + fun `close calls recordSpan if step iteration is in progress`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()).thenReturn(true) + sut.step() + sut.step() + verifyNeverCalledRecordSpan() + + sut.close() + + verifyCalledRecordSpan() + } + + @Test + fun `close does not call recordSpan if step iteration has not started`() { + val sut = fixture.getSut("SELECT 1") + sut.close() + verifyNeverCalledRecordSpan() + } + + @Test + fun `close does not call recordSpan if step iteration has completed`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()).thenReturn(true, false) + sut.step() + sut.step() + verifyCalledRecordSpan(times = 1) + + sut.close() + + verifyCalledRecordSpan(times = 1) + } + + @Test + fun `step after close does not call recordSpan`() { + val sut = fixture.getSut("SELECT 1") + sut.step() + verifyCalledRecordSpan(times = 1) + + sut.close() + sut.step() + + verifyCalledRecordSpan(times = 1) + } + + @Test + fun `reset after close does not call recordSpan`() { + val sut = fixture.getSut("SELECT 1") + whenever(fixture.mockStatement.step()).thenReturn(true) + sut.step() + sut.close() + verifyCalledRecordSpan(times = 1) + + sut.reset() + + verifyCalledRecordSpan(times = 1) + } + + @Test + fun `recorded duration captures step time but excludes time between steps`() { + val sut = fixture.getSut("SELECT * FROM users") + whenever(fixture.mockStatement.step()) + .thenAnswer { + fixture.fakeClock.addAndGet(10) + true + } + .thenAnswer { + fixture.fakeClock.addAndGet(20) + true + } + .thenAnswer { + fixture.fakeClock.addAndGet(30) + false + } + + sut.step() + // Simulate work done between steps. + fixture.fakeClock.addAndGet(1_000_000) + sut.step() + fixture.fakeClock.addAndGet(2_000_000) + sut.step() + + val durationCaptor = argumentCaptor() + verify(fixture.mockSpans).recordSpan(any(), any(), durationCaptor.capture(), any(), anyOrNull()) + // Each step contributes its internal time (10 + 20 + 30) plus one unit from + // fakeClock::getAndIncrement between before/after reads, so total is 63. + assertEquals(63L, durationCaptor.firstValue) + } + + @Test + fun `all calls are propagated to the delegate`() { + val sut = fixture.getSut("SELECT 1") + + sut.bindBlob(0, byteArrayOf()) + verify(fixture.mockStatement).bindBlob(0, byteArrayOf()) + + sut.bindDouble(0, 1.0) + verify(fixture.mockStatement).bindDouble(0, 1.0) + + sut.bindLong(0, 1L) + verify(fixture.mockStatement).bindLong(0, 1L) + + sut.bindText(0, "text") + verify(fixture.mockStatement).bindText(0, "text") + + sut.bindNull(0) + verify(fixture.mockStatement).bindNull(0) + + sut.getDouble(0) + verify(fixture.mockStatement).getDouble(0) + + sut.getLong(0) + verify(fixture.mockStatement).getLong(0) + + sut.getText(0) + verify(fixture.mockStatement).getText(0) + + sut.isNull(0) + verify(fixture.mockStatement).isNull(0) + + sut.getColumnCount() + verify(fixture.mockStatement).getColumnCount() + + sut.getColumnName(0) + verify(fixture.mockStatement).getColumnName(0) + + sut.step() + verify(fixture.mockStatement).step() + + sut.reset() + verify(fixture.mockStatement).reset() + + sut.clearBindings() + verify(fixture.mockStatement).clearBindings() + + sut.close() + verify(fixture.mockStatement).close() + } + + private fun verifyNeverCalledRecordSpan() { + verifyCalledRecordSpan(times = 0) + } + + private fun verifyCalledRecordSpan(times: Int = 1) { + verify(fixture.mockSpans, times(times)).recordSpan(any(), any(), any(), any(), anyOrNull()) + } +} From 773a0df13db7654c534b8775902021af234fa3d5 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 16 Jun 2026 09:31:06 +0200 Subject: [PATCH 203/391] ci: Remove Codecov and code coverage tooling (JAVA-560) (#5547) * ci: Remove Codecov and code coverage tooling (JAVA-560) Remove the Codecov service integration (codecov.yml, the README badge, and the upload steps across all CI workflows) along with the JaCoCo and Kover coverage tooling that only existed to feed it: the plugins, report and verification tasks across all modules, the version catalog entries, the Config.kt coverage threshold, and the createCoverageReports Makefile target. No SDK code or public API is affected. Co-Authored-By: Claude Opus 4.8 (1M context) * test(sentry): Restore java.lang open after jacoco removal (JAVA-560) SentryTest reflectively rewrites a class's name to fake the Android environment, which requires --add-opens java.base/java.lang=ALL-UNNAMED. The jacoco test agent was implicitly providing this open; now that jacoco is removed, declare it explicitly so the sentry unit tests keep passing. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- .github/workflows/agp-matrix.yml | 7 ---- .github/workflows/build.yml | 9 +--- .github/workflows/integration-tests-ui.yml | 7 ---- .github/workflows/spring-boot-2-matrix.yml | 7 ---- .github/workflows/spring-boot-3-matrix.yml | 7 ---- .github/workflows/spring-boot-4-matrix.yml | 7 ---- AGENTS.md | 4 -- Makefile | 13 ++---- README.md | 1 - build.gradle.kts | 42 ------------------- buildSrc/src/main/java/Config.kt | 7 ---- codecov.yml | 23 ---------- gradle/libs.versions.toml | 3 -- sentry-android-core/build.gradle.kts | 2 - sentry-android-fragment/build.gradle.kts | 2 - sentry-android-navigation/build.gradle.kts | 2 - sentry-android-ndk/build.gradle.kts | 2 - sentry-android-replay/build.gradle.kts | 2 - sentry-android-sqlite/build.gradle.kts | 2 - sentry-android-timber/build.gradle.kts | 2 - sentry-apache-http-client-5/build.gradle.kts | 20 --------- sentry-apollo-3/build.gradle.kts | 21 +--------- sentry-apollo-4/build.gradle.kts | 21 +--------- sentry-apollo/build.gradle.kts | 21 +--------- sentry-async-profiler/build.gradle.kts | 20 --------- sentry-compose/build.gradle.kts | 1 - sentry-graphql-22/build.gradle.kts | 20 --------- sentry-graphql-core/build.gradle.kts | 20 --------- sentry-graphql/build.gradle.kts | 20 --------- sentry-jcache/build.gradle.kts | 20 --------- sentry-jdbc/build.gradle.kts | 20 --------- sentry-jul/build.gradle.kts | 17 -------- sentry-kafka/build.gradle.kts | 20 --------- sentry-kotlin-extensions/build.gradle.kts | 21 +--------- sentry-ktor-client/build.gradle.kts | 21 +--------- sentry-launchdarkly-android/build.gradle.kts | 2 - sentry-launchdarkly-server/build.gradle.kts | 20 --------- sentry-log4j2/build.gradle.kts | 20 --------- sentry-logback/build.gradle.kts | 20 --------- sentry-okhttp/build.gradle.kts | 21 +--------- sentry-openfeature/build.gradle.kts | 20 --------- sentry-openfeign/build.gradle.kts | 20 --------- .../build.gradle.kts | 20 --------- .../build.gradle.kts | 20 --------- .../build.gradle.kts | 20 --------- .../build.gradle.kts | 20 --------- sentry-quartz/build.gradle.kts | 20 --------- sentry-reactor/build.gradle.kts | 20 --------- sentry-servlet-jakarta/build.gradle.kts | 20 --------- sentry-servlet/build.gradle.kts | 20 --------- sentry-spotlight/build.gradle.kts | 21 +--------- sentry-spring-7/build.gradle.kts | 20 --------- sentry-spring-boot-4-starter/build.gradle.kts | 20 --------- sentry-spring-boot-4/build.gradle.kts | 20 --------- sentry-spring-boot-jakarta/build.gradle.kts | 20 --------- .../build.gradle.kts | 20 --------- sentry-spring-boot-starter/build.gradle.kts | 20 --------- sentry-spring-boot/build.gradle.kts | 20 --------- sentry-spring-jakarta/build.gradle.kts | 20 --------- sentry-spring/build.gradle.kts | 20 --------- sentry-system-test-support/build.gradle.kts | 1 - sentry-test-support/build.gradle.kts | 1 - sentry/build.gradle.kts | 28 ++++--------- 63 files changed, 20 insertions(+), 928 deletions(-) delete mode 100644 codecov.yml diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index aebcbf87d5e..cc9c153f252 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -112,10 +112,3 @@ jobs: reporter: java-junit output-to: step-summary fail-on-error: false - - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: build/outputs/androidTest-results/**/*.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb1f45dd60d..9a8a7e6138d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - - name: Run Tests with coverage and Lint + - name: Run Tests and Lint run: make preMerge - name: Install Sentry CLI @@ -57,13 +57,6 @@ jobs: SENTRY_ORG: sentry-sdks SENTRY_PROJECT: sentry-android - - name: Upload coverage to Codecov - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # pin@v4 - with: - name: sentry-java - fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload test results if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 4af564cd2c3..102951a6d40 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -94,10 +94,3 @@ jobs: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_ORG: sentry-sdks SENTRY_PROJECT: sentry-android - - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./artifacts/*.xml diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 32eeef2442d..b9eb217d578 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -150,10 +150,3 @@ jobs: reporter: java-junit output-to: step-summary fail-on-error: false - - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: '**/build/test-results/**/*.xml' diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 8614e2ca69d..82f379c141c 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -146,10 +146,3 @@ jobs: reporter: java-junit output-to: step-summary fail-on-error: false - - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: '**/build/test-results/**/*.xml' diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index e82b120ec24..d2ec6c096bf 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -146,10 +146,3 @@ jobs: reporter: java-junit output-to: step-summary fail-on-error: false - - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: '**/build/test-results/**/*.xml' diff --git a/AGENTS.md b/AGENTS.md index 8d0cccabbc7..a05d9386607 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,9 +37,6 @@ The project uses **Gradle** with Kotlin DSL. Key build files: # Build entire project ./gradlew build -# Create coverage reports -./gradlew jacocoTestReport koverXmlReportRelease - # Generate documentation ./gradlew aggregateJavadocs ``` @@ -149,7 +146,6 @@ The repository is organized into multiple modules: - Write comprehensive unit tests for new features - Android modules require both unit tests and instrumented tests where applicable - System tests validate end-to-end functionality with sample applications -- Coverage reports are generated for both JaCoCo (Java/Android) and Kover (KMP modules) ### Contributing Guidelines 1. Follow existing code style and language diff --git a/Makefile b/Makefile index c9eca8b8b7e..3967ff856ad 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleUiTestRelease assembleUiTestCriticalRelease createCoverageReports runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish +.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish -all: stop clean javadocs compile createCoverageReports +all: stop clean javadocs compile assembleBenchmarks: assembleBenchmarkTestRelease assembleUiTests: assembleUiTestRelease -preMerge: check createCoverageReports +preMerge: check publish: clean dryRelease # deep clean @@ -51,13 +51,6 @@ assembleUiTestCriticalRelease: runUiTestCritical: ./scripts/test-ui-critical.sh -# Create coverage reports -# - Jacoco for Java & Android modules -# - Kover for KMP modules e.g sentry-compose -createCoverageReports: - ./gradlew jacocoTestReport - ./gradlew koverXmlReportRelease - # Create the Python virtual environment for system tests, and install the necessary dependencies setupPython: @test -d .venv || python3 -m venv .venv diff --git a/README.md b/README.md index 9aaf7aca4d8..0aab8a4e75d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he Sentry SDK for Java and Android =========== [![GH Workflow](https://img.shields.io/github/actions/workflow/status/getsentry/sentry-java/build.yml?branch=main)](https://github.com/getsentry/sentry-java/actions) -[![codecov](https://codecov.io/gh/getsentry/sentry-java/branch/main/graph/badge.svg)](https://codecov.io/gh/getsentry/sentry-java) [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry&style=social)](https://x.com/intent/follow?screen_name=sentry) [![Discord Chat](https://img.shields.io/discord/621778831602221064?logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/PXa5Apfe7K) diff --git a/build.gradle.kts b/build.gradle.kts index d5b5dfc5d05..93c82cd8c9a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,19 +3,15 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.MavenPublishBaseExtension import groovy.util.Node import io.gitlab.arturbosch.detekt.extensions.DetektExtension -import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { `java-library` alias(libs.plugins.spotless) apply false - jacoco alias(libs.plugins.detekt) `maven-publish` alias(libs.plugins.binary.compatibility.validator) - alias(libs.plugins.jacoco.android) apply false - alias(libs.plugins.kover) apply false alias(libs.plugins.vanniktech.maven.publish) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.multiplatform) apply false @@ -121,44 +117,6 @@ allprojects { subprojects { apply { plugin("io.sentry.spotless") } - val jacocoAndroidModules = listOf( - "sentry-android-core", - "sentry-android-fragment", - "sentry-android-navigation", - "sentry-android-ndk", - "sentry-android-sqlite", - "sentry-android-replay", - "sentry-android-timber" - ) - if (jacocoAndroidModules.contains(name)) { - afterEvaluate { - jacoco { - toolVersion = "0.8.10" - } - - tasks.withType().configureEach { - configure { - isIncludeNoLocationClasses = true - excludes = listOf("jdk.internal.*") - } - } - } - } - - val koverKmpModules = listOf("sentry-compose") - if (koverKmpModules.contains(name)) { - afterEvaluate { - configure { - androidReports("release") { - xml { - // Change the report file name so the Codecov Github action can find it - setReportFile(project.layout.buildDirectory.file("reports/kover/report.xml").get().asFile) - } - } - } - } - } - plugins.withId(Config.QualityPlugins.detektPlugin) { configure { buildUponDefaultConfig = true diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 3410d9601d3..f0e2e9baf86 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -1,6 +1,4 @@ -import java.math.BigDecimal - object Config { val AGP = System.getenv("VERSION_AGP") ?: "8.13.1" val kotlinStdLib = "stdlib-jdk8" @@ -37,11 +35,6 @@ object Config { } object QualityPlugins { - object Jacoco { - // TODO [POTEL] add tests and restore - val minimumCoverage = BigDecimal.valueOf(0.1) - } - // this can be removed when we upgrade to Gradle 8, which allows us to use a getter for the plugin ID val detektPlugin = "io.gitlab.arturbosch.detekt" } diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 3a53b1f7b3f..00000000000 --- a/codecov.yml +++ /dev/null @@ -1,23 +0,0 @@ -comment: no -codecov: - require_ci_to_pass: no - max_report_age: off - -coverage: - status: - project: - default: - target: 78% - threshold: 4% - patch: off - range: 78...100 - precision: 3 - round: down - -ignore: - - "**/src/test/*" - - "sentry-android-integration-tests/*" - - "sentry-system-test-support/*" - - "sentry-test-support/*" - - "sentry-samples/*" - - "sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/vendor/asyncprofiler/**" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ebcb8e0e38..a305275a118 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,6 @@ composeCompiler = "1.5.14" coroutines = "1.6.1" espresso = "3.7.0" feign = "11.6" -jacoco = "0.8.7" jackson = "2.18.3" jetbrainsCompose = "1.6.11" kotlin = "2.2.0" @@ -59,8 +58,6 @@ errorprone = { id = "net.ltgt.errorprone", version = "3.0.1" } gradle-versions = { id = "com.github.ben-manes.versions", version = "0.42.0" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.8" } -jacoco-android = { id = "com.mxalbert.gradle.jacoco-android", version = "0.2.0" } -kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } springboot3 = { id = "org.springframework.boot", version.ref = "springboot3" } springboot4 = { id = "org.springframework.boot", version.ref = "springboot4" } diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index abcca4f8833..f7440b19494 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -5,8 +5,6 @@ plugins { id("com.android.library") alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } diff --git a/sentry-android-fragment/build.gradle.kts b/sentry-android-fragment/build.gradle.kts index 7a4178b0652..1bd182d618c 100644 --- a/sentry-android-fragment/build.gradle.kts +++ b/sentry-android-fragment/build.gradle.kts @@ -3,8 +3,6 @@ import io.gitlab.arturbosch.detekt.Detekt plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) } diff --git a/sentry-android-navigation/build.gradle.kts b/sentry-android-navigation/build.gradle.kts index 7f5d1017ec3..eaa204b3860 100644 --- a/sentry-android-navigation/build.gradle.kts +++ b/sentry-android-navigation/build.gradle.kts @@ -3,8 +3,6 @@ import io.gitlab.arturbosch.detekt.Detekt plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) } diff --git a/sentry-android-ndk/build.gradle.kts b/sentry-android-ndk/build.gradle.kts index 413fd3a7b77..c2d0a33d823 100644 --- a/sentry-android-ndk/build.gradle.kts +++ b/sentry-android-ndk/build.gradle.kts @@ -3,8 +3,6 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) } diff --git a/sentry-android-replay/build.gradle.kts b/sentry-android-replay/build.gradle.kts index 60d38c0ae0a..8d0f63797aa 100644 --- a/sentry-android-replay/build.gradle.kts +++ b/sentry-android-replay/build.gradle.kts @@ -5,8 +5,6 @@ plugins { id("com.android.library") alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) // TODO: enable it later // alias(libs.plugins.detekt) diff --git a/sentry-android-sqlite/build.gradle.kts b/sentry-android-sqlite/build.gradle.kts index 07fa7ad343f..dd28252665e 100644 --- a/sentry-android-sqlite/build.gradle.kts +++ b/sentry-android-sqlite/build.gradle.kts @@ -3,8 +3,6 @@ import io.gitlab.arturbosch.detekt.Detekt plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) } diff --git a/sentry-android-timber/build.gradle.kts b/sentry-android-timber/build.gradle.kts index 16083b43f1b..d8f8431bef1 100644 --- a/sentry-android-timber/build.gradle.kts +++ b/sentry-android-timber/build.gradle.kts @@ -3,8 +3,6 @@ import io.gitlab.arturbosch.detekt.Detekt plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) } diff --git a/sentry-apache-http-client-5/build.gradle.kts b/sentry-apache-http-client-5/build.gradle.kts index 4c9aba6e31b..df93fbe8823 100644 --- a/sentry-apache-http-client-5/build.gradle.kts +++ b/sentry-apache-http-client-5/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -36,25 +35,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-apollo-3/build.gradle.kts b/sentry-apollo-3/build.gradle.kts index 8819e0993d4..1eb71bc217a 100644 --- a/sentry-apollo-3/build.gradle.kts +++ b/sentry-apollo-3/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -45,25 +44,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { options.errorprone { diff --git a/sentry-apollo-4/build.gradle.kts b/sentry-apollo-4/build.gradle.kts index 85ea2c3b52b..144297ddb9d 100644 --- a/sentry-apollo-4/build.gradle.kts +++ b/sentry-apollo-4/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -52,25 +51,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { options.errorprone { diff --git a/sentry-apollo/build.gradle.kts b/sentry-apollo/build.gradle.kts index 909d52aa127..c115e6b8fe3 100644 --- a/sentry-apollo/build.gradle.kts +++ b/sentry-apollo/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -46,25 +45,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { options.errorprone { diff --git a/sentry-async-profiler/build.gradle.kts b/sentry-async-profiler/build.gradle.kts index 5af2f0bef45..ef000b465a1 100644 --- a/sentry-async-profiler/build.gradle.kts +++ b/sentry-async-profiler/build.gradle.kts @@ -4,7 +4,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `java-library` kotlin("jvm") - jacoco id("io.sentry.javadoc") alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) @@ -39,25 +38,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-compose/build.gradle.kts b/sentry-compose/build.gradle.kts index 3385d0328e2..c45a431b1b3 100644 --- a/sentry-compose/build.gradle.kts +++ b/sentry-compose/build.gradle.kts @@ -7,7 +7,6 @@ plugins { alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.kotlin.compose) id("com.android.library") - alias(libs.plugins.kover) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) alias(libs.plugins.dokka) diff --git a/sentry-graphql-22/build.gradle.kts b/sentry-graphql-22/build.gradle.kts index a8256ca8a27..c36ca09856d 100644 --- a/sentry-graphql-22/build.gradle.kts +++ b/sentry-graphql-22/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -44,25 +43,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-graphql-core/build.gradle.kts b/sentry-graphql-core/build.gradle.kts index cb8c9f49493..d625c31dea6 100644 --- a/sentry-graphql-core/build.gradle.kts +++ b/sentry-graphql-core/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -43,25 +42,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-graphql/build.gradle.kts b/sentry-graphql/build.gradle.kts index 46bef6e4b9d..68efbc7389e 100644 --- a/sentry-graphql/build.gradle.kts +++ b/sentry-graphql/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -44,25 +43,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jcache/build.gradle.kts b/sentry-jcache/build.gradle.kts index a9393a7d905..2c476dbd007 100644 --- a/sentry-jcache/build.gradle.kts +++ b/sentry-jcache/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -39,25 +38,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jdbc/build.gradle.kts b/sentry-jdbc/build.gradle.kts index 0415fd8ccff..8a7808530b1 100644 --- a/sentry-jdbc/build.gradle.kts +++ b/sentry-jdbc/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -37,25 +36,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jul/build.gradle.kts b/sentry-jul/build.gradle.kts index 13bee6418d6..b59a1481d19 100644 --- a/sentry-jul/build.gradle.kts +++ b/sentry-jul/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -36,23 +35,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } test { // used to test io.sentry.jul.SentryHandler systemProperty( diff --git a/sentry-kafka/build.gradle.kts b/sentry-kafka/build.gradle.kts index ee3ba0d4a60..603014f9af9 100644 --- a/sentry-kafka/build.gradle.kts +++ b/sentry-kafka/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -36,25 +35,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-kotlin-extensions/build.gradle.kts b/sentry-kotlin-extensions/build.gradle.kts index 55aca007130..5092976de32 100644 --- a/sentry-kotlin-extensions/build.gradle.kts +++ b/sentry-kotlin-extensions/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.detekt) @@ -40,25 +39,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { // Target version of the generated JVM bytecode. It is used for type resolution. diff --git a/sentry-ktor-client/build.gradle.kts b/sentry-ktor-client/build.gradle.kts index 2965e81ebd3..745acaa11fb 100644 --- a/sentry-ktor-client/build.gradle.kts +++ b/sentry-ktor-client/build.gradle.kts @@ -4,7 +4,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `java-library` alias(libs.plugins.kotlin.jvm) - jacoco id("io.sentry.javadoc") alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) @@ -47,25 +46,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } buildConfig { useJavaOutput() diff --git a/sentry-launchdarkly-android/build.gradle.kts b/sentry-launchdarkly-android/build.gradle.kts index bf59c256ed1..427ec473676 100644 --- a/sentry-launchdarkly-android/build.gradle.kts +++ b/sentry-launchdarkly-android/build.gradle.kts @@ -1,8 +1,6 @@ plugins { id("com.android.library") alias(libs.plugins.kotlin.android) - jacoco - alias(libs.plugins.jacoco.android) alias(libs.plugins.gradle.versions) } diff --git a/sentry-launchdarkly-server/build.gradle.kts b/sentry-launchdarkly-server/build.gradle.kts index ee273fa5a9c..207400676a0 100644 --- a/sentry-launchdarkly-server/build.gradle.kts +++ b/sentry-launchdarkly-server/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -40,25 +39,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-log4j2/build.gradle.kts b/sentry-log4j2/build.gradle.kts index 68ebd90b1e8..7d406076e2f 100644 --- a/sentry-log4j2/build.gradle.kts +++ b/sentry-log4j2/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -38,25 +37,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.log4j2") diff --git a/sentry-logback/build.gradle.kts b/sentry-logback/build.gradle.kts index 385209e8c49..d2084e95467 100644 --- a/sentry-logback/build.gradle.kts +++ b/sentry-logback/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -35,25 +34,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.logback") diff --git a/sentry-okhttp/build.gradle.kts b/sentry-okhttp/build.gradle.kts index f7178cf1dfe..ea831f174cc 100644 --- a/sentry-okhttp/build.gradle.kts +++ b/sentry-okhttp/build.gradle.kts @@ -4,7 +4,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `java-library` alias(libs.plugins.kotlin.jvm) - jacoco id("io.sentry.javadoc") alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) @@ -46,25 +45,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } buildConfig { useJavaOutput() diff --git a/sentry-openfeature/build.gradle.kts b/sentry-openfeature/build.gradle.kts index 632d16b55cf..5847f48e7b5 100644 --- a/sentry-openfeature/build.gradle.kts +++ b/sentry-openfeature/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -40,25 +39,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-openfeign/build.gradle.kts b/sentry-openfeign/build.gradle.kts index 40119987f72..e9e3a2b18de 100644 --- a/sentry-openfeign/build.gradle.kts +++ b/sentry-openfeign/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -37,25 +36,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts index b4a84300efd..ed6605f8da4 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -43,25 +42,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts index 64db4096bb9..503c92c95f0 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -38,25 +37,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts index 2ab3d4988d5..5b3b9d97ff4 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -48,25 +47,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts index f039b3c95ef..21e75c0ed7d 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -44,25 +43,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-quartz/build.gradle.kts b/sentry-quartz/build.gradle.kts index f81254f110f..69c0e72ee07 100644 --- a/sentry-quartz/build.gradle.kts +++ b/sentry-quartz/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -38,25 +37,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-reactor/build.gradle.kts b/sentry-reactor/build.gradle.kts index 9e8b6e74be9..4d389b0a334 100644 --- a/sentry-reactor/build.gradle.kts +++ b/sentry-reactor/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -46,25 +45,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.reactor") diff --git a/sentry-servlet-jakarta/build.gradle.kts b/sentry-servlet-jakarta/build.gradle.kts index ec079b6d65f..728e147dc9b 100644 --- a/sentry-servlet-jakarta/build.gradle.kts +++ b/sentry-servlet-jakarta/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -38,25 +37,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-servlet/build.gradle.kts b/sentry-servlet/build.gradle.kts index ceaa160695a..142a1cd2f20 100644 --- a/sentry-servlet/build.gradle.kts +++ b/sentry-servlet/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -39,25 +38,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spotlight/build.gradle.kts b/sentry-spotlight/build.gradle.kts index dbab6237b12..b034c8267db 100644 --- a/sentry-spotlight/build.gradle.kts +++ b/sentry-spotlight/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.animalsniffer) @@ -38,25 +37,7 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } -} +tasks { check { dependsOn(animalsnifferMain) } } buildConfig { useJavaOutput() diff --git a/sentry-spring-7/build.gradle.kts b/sentry-spring-7/build.gradle.kts index ae8269e7825..ec90aedcbeb 100644 --- a/sentry-spring-7/build.gradle.kts +++ b/sentry-spring-7/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -85,25 +84,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring7") diff --git a/sentry-spring-boot-4-starter/build.gradle.kts b/sentry-spring-boot-4-starter/build.gradle.kts index 2c8eab0ba66..c0f655e965f 100644 --- a/sentry-spring-boot-4-starter/build.gradle.kts +++ b/sentry-spring-boot-4-starter/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.springboot4) apply false @@ -41,25 +40,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-boot-4/build.gradle.kts b/sentry-spring-boot-4/build.gradle.kts index 3b0b3be8630..43e105ad8db 100644 --- a/sentry-spring-boot-4/build.gradle.kts +++ b/sentry-spring-boot-4/build.gradle.kts @@ -5,7 +5,6 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { `java-library` id("io.sentry.javadoc") - jacoco alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) alias(libs.plugins.errorprone) @@ -111,25 +110,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring.boot4") diff --git a/sentry-spring-boot-jakarta/build.gradle.kts b/sentry-spring-boot-jakarta/build.gradle.kts index 36b7dad3cc6..edd2d605916 100644 --- a/sentry-spring-boot-jakarta/build.gradle.kts +++ b/sentry-spring-boot-jakarta/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -103,25 +102,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring.boot.jakarta") diff --git a/sentry-spring-boot-starter-jakarta/build.gradle.kts b/sentry-spring-boot-starter-jakarta/build.gradle.kts index 60ac812b013..d7d10b73b8c 100644 --- a/sentry-spring-boot-starter-jakarta/build.gradle.kts +++ b/sentry-spring-boot-starter-jakarta/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.springboot3) apply false @@ -41,25 +40,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-boot-starter/build.gradle.kts b/sentry-spring-boot-starter/build.gradle.kts index 6b5bcdf5752..3ef4ac59379 100644 --- a/sentry-spring-boot-starter/build.gradle.kts +++ b/sentry-spring-boot-starter/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } @@ -33,25 +32,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-boot/build.gradle.kts b/sentry-spring-boot/build.gradle.kts index e54112ae54c..3ed6199fbc5 100644 --- a/sentry-spring-boot/build.gradle.kts +++ b/sentry-spring-boot/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -85,25 +84,6 @@ dependencies { testImplementation(projects.sentryAsyncProfiler) } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring.boot") diff --git a/sentry-spring-jakarta/build.gradle.kts b/sentry-spring-jakarta/build.gradle.kts index cbf2e5346b5..b4a61129df7 100644 --- a/sentry-spring-jakarta/build.gradle.kts +++ b/sentry-spring-jakarta/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -80,25 +79,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring.jakarta") diff --git a/sentry-spring/build.gradle.kts b/sentry-spring/build.gradle.kts index 64380f7e7f4..fced2220f02 100644 --- a/sentry-spring/build.gradle.kts +++ b/sentry-spring/build.gradle.kts @@ -6,7 +6,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -64,25 +63,6 @@ dependencies { testImplementation(libs.springboot.starter.webflux) } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - -tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - } -} - buildConfig { useJavaOutput() packageName("io.sentry.spring") diff --git a/sentry-system-test-support/build.gradle.kts b/sentry-system-test-support/build.gradle.kts index b8e4a283c87..4d4c7d5bb6e 100644 --- a/sentry-system-test-support/build.gradle.kts +++ b/sentry-system-test-support/build.gradle.kts @@ -2,7 +2,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) id("com.apollographql.apollo") version "4.1.1" diff --git a/sentry-test-support/build.gradle.kts b/sentry-test-support/build.gradle.kts index 29b2083a0a9..f108915d463 100644 --- a/sentry-test-support/build.gradle.kts +++ b/sentry-test-support/build.gradle.kts @@ -2,7 +2,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) } diff --git a/sentry/build.gradle.kts b/sentry/build.gradle.kts index 4c237803a51..a2ecd281296 100644 --- a/sentry/build.gradle.kts +++ b/sentry/build.gradle.kts @@ -5,7 +5,6 @@ plugins { `java-library` id("io.sentry.javadoc") alias(libs.plugins.kotlin.jvm) - jacoco alias(libs.plugins.errorprone) alias(libs.plugins.gradle.versions) alias(libs.plugins.buildconfig) @@ -40,15 +39,6 @@ dependencies { configure { test { java.srcDir("src/test/java") } } -jacoco { toolVersion = libs.versions.jacoco.get() } - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - html.required.set(false) - } -} - animalsniffer { ignore = listOf( @@ -63,16 +53,16 @@ tasks.animalsnifferMain { } tasks { - jacocoTestCoverageVerification { - violationRules { rule { limit { minimum = Config.QualityPlugins.Jacoco.minimumCoverage } } } - } - check { - dependsOn(jacocoTestCoverageVerification) - dependsOn(jacocoTestReport) - dependsOn(animalsnifferMain) - } + check { dependsOn(animalsnifferMain) } test { - jvmArgs("--add-opens", "java.base/java.util.concurrent=ALL-UNNAMED") + // java.lang open is needed by tests that reflectively rewrite Class names; it was previously + // provided implicitly by the jacoco test agent, which has been removed. + jvmArgs( + "--add-opens", + "java.base/java.util.concurrent=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + ) environment["SENTRY_TEST_PROPERTY"] = "\"some-value\"" environment["SENTRY_TEST_MAP_KEY1"] = "\"value1\"" environment["SENTRY_TEST_MAP_KEY2"] = "value2" From f36e6e37ec1517fa6e3c06ab79abc6775e2ef1bf Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 16 Jun 2026 13:40:05 +0200 Subject: [PATCH 204/391] fix(android): Stop duplicating attachments on native events (JAVA-559) (#5548) * fix(android): Stop duplicating attachments on native events (JAVA-559) Scope attachments are synced to the native SDK, so native events already carry them as envelope items in the outbox. When re-ingesting those cached envelopes, SentryClient re-applied the scope attachments on top, sending each attachment twice. Skip re-applying scope attachments for cached envelopes. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../src/main/java/io/sentry/SentryClient.java | 4 +++- .../test/java/io/sentry/SentryClientTest.kt | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 648533ec18f..93cd3765da8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Fixes +- Fix attachments being duplicated on native events that carry scope attachments ([#5548](https://github.com/getsentry/sentry-java/pull/5548)) - Fix performance collector scheduling many tasks in a row ([#5524](https://github.com/getsentry/sentry-java/pull/5524)) ## 8.43.2 diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 5ac81c44936..78225f05d19 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -112,7 +112,9 @@ private boolean shouldApplyScopeData(final @NotNull CheckIn event, final @NotNul hint = new Hint(); } - if (shouldApplyScopeData(event, hint)) { + // Cached envelopes (e.g. native crashes from the outbox) already carry their attachments as + // envelope items. Re-applying scope attachments here would duplicate them. + if (shouldApplyScopeData(event, hint) && !HintUtils.hasType(hint, Cached.class)) { addScopeAttachmentsToHint(scope, hint); } diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index d5b2f0f82a0..ab6fd2075a3 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -870,6 +870,25 @@ class SentryClientTest { assertEquals(scope.level, event.level) } + @Test + fun `when hint is Cached, scope attachments are not added to avoid duplication`() { + val sut = fixture.getSut() + + val event = createEvent() + val scope = createScopeWithAttachments() + + val hints = HintUtils.createWithTypeCheckHint(CustomCachedApplyScopeDataHint()) + sut.captureEvent(event, scope, hints) + + verify(fixture.transport) + .send( + check { actual -> + assertEquals(0, actual.items.count { it.header.type == SentryItemType.Attachment }) + }, + anyOrNull(), + ) + } + @Test fun `when transport factory is NoOp, it should initialize it`() { fixture.sentryOptions.setTransportFactory(NoOpTransportFactory.getInstance()) From 6dff1c9970ad612ac431980c08abb138218465e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 11:52:26 +0000 Subject: [PATCH 205/391] chore: update scripts/update-sentry-native-ndk.sh to 0.15.0 (#5528) Co-authored-by: GitHub --- CHANGELOG.md | 3 +++ gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93cd3765da8..71c8d990122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ ### Dependencies - Upgrade to asyncProfiler 4.4 ([#5418](https://github.com/getsentry/sentry-java/pull/5418)) +- Bump Native SDK from v0.14.2 to v0.15.0 ([#5528](https://github.com/getsentry/sentry-java/pull/5528)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0150) + - [diff](https://github.com/getsentry/sentry-native/compare/0.14.2...0.15.0) ### Fixes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a305275a118..c16a87ad9b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -150,7 +150,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.14.2" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.15.0" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From e52b4e44a1eb195adcd0fbe2761d33e708ac5d49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jun 2026 09:49:21 +0200 Subject: [PATCH 206/391] chore(deps): bump actions/setup-java in the github-actions group (#5554) Bumps the github-actions group with 1 update: [actions/setup-java](https://github.com/actions/setup-java). Updates `actions/setup-java` from 5.2.0 to 5.3.0 - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/be666c2fcd27ec809703dec50e508c2fdc7f6654...ad2b38190b15e4d6bdf0c97fb4fca8412226d287) --- updated-dependencies: - dependency-name: actions/setup-java dependency-version: 5.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/generate-javadocs.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 2 +- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release-build.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index cc9c153f252..40f8509fee4 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -33,7 +33,7 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a8a7e6138d..375e94e7499 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6aa197d6625..e24b7c96c14 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,7 +25,7 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 01ee3db1584..e5e4530933b 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -14,7 +14,7 @@ jobs: uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 28cb78df4e3..ec427af3564 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -13,7 +13,7 @@ jobs: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index af0b44ddadd..2e82024077a 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -14,7 +14,7 @@ jobs: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 65cfcf242fc..4d323f0394a 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -32,7 +32,7 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' @@ -82,7 +82,7 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 19598699165..e2fa42ddc16 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Setup Java Version - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: "temurin" java-version: "17" diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 8973148cadd..18809c060e1 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 - name: Set up Java 17 - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 102951a6d40..f7b95a26d12 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -27,7 +27,7 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 16cfe4531a0..9fecaf32b5e 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -20,7 +20,7 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index b9eb217d578..7628a0bbba0 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -45,7 +45,7 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 82f379c141c..40670eaf258 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -45,7 +45,7 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index d2ec6c096bf..128051ed03e 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -45,7 +45,7 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index b1884cd4a7a..62a1b7665c0 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -112,7 +112,7 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 with: distribution: 'temurin' java-version: '17' From ba010111864967003758a5e4d750dfe04f995c18 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 17 Jun 2026 13:17:06 +0200 Subject: [PATCH 207/391] perf: Avoid boxing in doubleToBigDecimal timestamp serialization (#5551) * perf: Avoid boxing in doubleToBigDecimal timestamp serialization Change DateUtils.doubleToBigDecimal to take a primitive double instead of a boxed Double, and route the four duplicated private copies (ProfileChunk, ProfileMeasurementValue, SentrySample, SentrySpan) through it. Callers that hold a primitive double timestamp no longer autobox on every serialization, and the duplicated helpers are consolidated into one. Behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 2 +- sentry/api/sentry.api | 2 +- sentry/src/main/java/io/sentry/DateUtils.java | 2 +- sentry/src/main/java/io/sentry/ProfileChunk.java | 8 ++------ .../profilemeasurements/ProfileMeasurementValue.java | 8 ++------ sentry/src/main/java/io/sentry/protocol/SentrySpan.java | 8 ++------ .../java/io/sentry/protocol/profiling/SentrySample.java | 8 ++------ 7 files changed, 11 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c8d990122..5dbcde58f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ ### Improvements -- Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527)) +- Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527), [#5551](https://github.com/getsentry/sentry-java/pull/5551)) ### Dependencies diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 4757be4894a..22f9366f738 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -384,7 +384,7 @@ public final class io/sentry/DataCategory : java/lang/Enum { public final class io/sentry/DateUtils { public static fun dateToNanos (Ljava/util/Date;)J public static fun dateToSeconds (Ljava/util/Date;)D - public static fun doubleToBigDecimal (Ljava/lang/Double;)Ljava/math/BigDecimal; + public static fun doubleToBigDecimal (D)Ljava/math/BigDecimal; public static fun getCurrentDateTime ()Ljava/util/Date; public static fun getDateTime (J)Ljava/util/Date; public static fun getDateTime (Ljava/lang/String;)Ljava/util/Date; diff --git a/sentry/src/main/java/io/sentry/DateUtils.java b/sentry/src/main/java/io/sentry/DateUtils.java index 5e55512ae70..b86bddeaad8 100644 --- a/sentry/src/main/java/io/sentry/DateUtils.java +++ b/sentry/src/main/java/io/sentry/DateUtils.java @@ -166,7 +166,7 @@ public static long secondsToNanos(final @NotNull long seconds) { return seconds * (1000L * 1000L * 1000L); } - public static @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) { + public static @NotNull BigDecimal doubleToBigDecimal(final double value) { return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN); } } diff --git a/sentry/src/main/java/io/sentry/ProfileChunk.java b/sentry/src/main/java/io/sentry/ProfileChunk.java index a6145ca8e9a..1d159030c1d 100644 --- a/sentry/src/main/java/io/sentry/ProfileChunk.java +++ b/sentry/src/main/java/io/sentry/ProfileChunk.java @@ -1,5 +1,7 @@ package io.sentry; +import static io.sentry.DateUtils.doubleToBigDecimal; + import io.sentry.profilemeasurements.ProfileMeasurement; import io.sentry.protocol.DebugMeta; import io.sentry.protocol.SdkVersion; @@ -8,8 +10,6 @@ import io.sentry.vendor.gson.stream.JsonToken; import java.io.File; import java.io.IOException; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -264,10 +264,6 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger writer.endObject(); } - private @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) { - return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN); - } - @Nullable @Override public Map getUnknown() { diff --git a/sentry/src/main/java/io/sentry/profilemeasurements/ProfileMeasurementValue.java b/sentry/src/main/java/io/sentry/profilemeasurements/ProfileMeasurementValue.java index 2f9ba5e1312..d27114c66ef 100644 --- a/sentry/src/main/java/io/sentry/profilemeasurements/ProfileMeasurementValue.java +++ b/sentry/src/main/java/io/sentry/profilemeasurements/ProfileMeasurementValue.java @@ -1,5 +1,7 @@ package io.sentry.profilemeasurements; +import static io.sentry.DateUtils.doubleToBigDecimal; + import io.sentry.DateUtils; import io.sentry.ILogger; import io.sentry.JsonDeserializer; @@ -10,8 +12,6 @@ import io.sentry.util.Objects; import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.Date; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -92,10 +92,6 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger writer.endObject(); } - private @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) { - return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN); - } - @Nullable @Override public Map getUnknown() { diff --git a/sentry/src/main/java/io/sentry/protocol/SentrySpan.java b/sentry/src/main/java/io/sentry/protocol/SentrySpan.java index 6274c8b00d7..58930ec1a87 100644 --- a/sentry/src/main/java/io/sentry/protocol/SentrySpan.java +++ b/sentry/src/main/java/io/sentry/protocol/SentrySpan.java @@ -1,5 +1,7 @@ package io.sentry.protocol; +import static io.sentry.DateUtils.doubleToBigDecimal; + import io.sentry.DateUtils; import io.sentry.ILogger; import io.sentry.JsonDeserializer; @@ -16,8 +18,6 @@ import io.sentry.util.Objects; import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -230,10 +230,6 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger writer.endObject(); } - private @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) { - return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN); - } - @Nullable @Override public Map getUnknown() { diff --git a/sentry/src/main/java/io/sentry/protocol/profiling/SentrySample.java b/sentry/src/main/java/io/sentry/protocol/profiling/SentrySample.java index 8f1c95641d5..af9053742d3 100644 --- a/sentry/src/main/java/io/sentry/protocol/profiling/SentrySample.java +++ b/sentry/src/main/java/io/sentry/protocol/profiling/SentrySample.java @@ -1,5 +1,7 @@ package io.sentry.protocol.profiling; +import static io.sentry.DateUtils.doubleToBigDecimal; + import io.sentry.ILogger; import io.sentry.JsonDeserializer; import io.sentry.JsonSerializable; @@ -8,8 +10,6 @@ import io.sentry.ObjectWriter; import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.HashMap; import java.util.Map; import org.jetbrains.annotations.ApiStatus; @@ -78,10 +78,6 @@ public void serialize(@NotNull ObjectWriter writer, @NotNull ILogger logger) thr writer.endObject(); } - private @NotNull BigDecimal doubleToBigDecimal(final @NotNull Double value) { - return BigDecimal.valueOf(value).setScale(6, RoundingMode.DOWN); - } - @Nullable @Override public Map getUnknown() { From 06b0d8089c88819b4be74dd8eeff4aba34e9877b Mon Sep 17 00:00:00 2001 From: arb Date: Wed, 17 Jun 2026 14:39:28 +0200 Subject: [PATCH 208/391] chore(android-sqlite): Repair start times of spans generated by SentrySQLiteDriver (#5543) chore(android-sqlite): Repair start times of spans generated by SentrySQLiteDriver (JAVA-275) Repairs the nanoTimetamp of the SentryNanotimeDates used as start times for the spans generated by SentrySQLiteDriver. Without those repairs, all spans within a given wall clock millisecond are displayed by Sentry UI as starting at that same millisecond and are re-ordered arbitrarily. Often that's quite confusing as actual BEGIN -> EXECUTE STATEMENT -> END sequences can appear as EXECUTE STATEMENT -> END -> BEGIN (etc.). For more details, see the discussion [here](https://github.com/getsentry/sentry-java/pull/5504#issuecomment-4679631245). --- .../android/sqlite/SQLiteSpanManager.kt | 43 +++++-- .../main/java/io/sentry/sqlite/DbMetadata.kt | 11 -- .../sqlite/SQLiteSpanInstrumentation.kt | 101 ++++++++++------ .../io/sentry/sqlite/SentrySQLiteStatement.kt | 13 +- .../ComputeNanoStartTimestampForChildTest.kt | 100 ++++++++++++++++ .../java/io/sentry/sqlite/DbMetadataTest.kt | 8 -- .../sqlite/SQLiteSpanInstrumentationTest.kt | 112 +++++++++++------- .../sqlite/SentrySQLiteStatementTest.kt | 9 +- 8 files changed, 279 insertions(+), 118 deletions(-) create mode 100644 sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt index 3495d3a71f0..1bdeb7d369c 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt @@ -3,17 +3,21 @@ package io.sentry.android.sqlite import android.database.CrossProcessCursor import android.database.SQLException import io.sentry.IScopes +import io.sentry.ISpan +import io.sentry.Instrumenter import io.sentry.ScopesAdapter import io.sentry.SentryIntegrationPackageStorage +import io.sentry.SentryStackTraceFactory +import io.sentry.SpanDataConvention import io.sentry.SpanStatus -import io.sentry.sqlite.SQLiteSpanInstrumentation + +private const val TRACE_ORIGIN = "auto.db.sqlite" internal class SQLiteSpanManager( private val scopes: IScopes = ScopesAdapter.getInstance(), - databaseName: String? = null, + private val databaseName: String? = null, ) { - - private val spans = SQLiteSpanInstrumentation.fromDatabaseName(databaseName, scopes) + private val stackTraceFactory = SentryStackTraceFactory(scopes.options) init { SentryIntegrationPackageStorage.getInstance().addIntegration("SQLite") @@ -29,8 +33,8 @@ internal class SQLiteSpanManager( @Suppress("TooGenericExceptionCaught", "UNCHECKED_CAST") @Throws(SQLException::class) fun performSql(sql: String, operation: () -> T): T { - val startTimestamp = spans.startTimestamp() - + val startTimestamp = scopes.getOptions().dateProvider.now() + var span: ISpan? = null return try { val result = operation() /* @@ -41,11 +45,34 @@ internal class SQLiteSpanManager( if (result is CrossProcessCursor) { return SentryCrossProcessCursor(result, this, sql) as T } - spans.recordSpan(sql, startTimestamp, SpanStatus.OK) + span = scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY) + span?.spanContext?.origin = TRACE_ORIGIN + span?.status = SpanStatus.OK result } catch (e: Throwable) { - spans.recordSpan(sql, startTimestamp, SpanStatus.INTERNAL_ERROR, e) + span = scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY) + span?.spanContext?.origin = TRACE_ORIGIN + span?.status = SpanStatus.INTERNAL_ERROR + span?.throwable = e throw e + } finally { + span?.apply { + val isMainThread: Boolean = scopes.options.threadChecker.isMainThread + setData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY, isMainThread) + if (isMainThread) { + setData(SpanDataConvention.CALL_STACK_KEY, stackTraceFactory.inAppCallStack) + } + // if db name is null, then it's an in-memory database as per + // https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt;l=38-42 + if (databaseName != null) { + setData(SpanDataConvention.DB_SYSTEM_KEY, "sqlite") + setData(SpanDataConvention.DB_NAME_KEY, databaseName) + } else { + setData(SpanDataConvention.DB_SYSTEM_KEY, "in-memory") + } + + finish() + } } } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt index aa3c186b6d9..598dc524ed1 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DbMetadata.kt @@ -36,14 +36,3 @@ internal fun dbMetadataFromFileName(fileName: String): DbMetadata { val basename = if (index >= 0) trimmed.substring(index + 1) else trimmed return DbMetadata(name = basename.ifEmpty { null }, system = DB_SYSTEM_SQLITE) } - -/** - * Returns metadata based on - * [SupportSQLiteOpenHelper.databaseName][androidx.sqlite.db.SupportSQLiteOpenHelper.databaseName]. - */ -internal fun dbMetadataFromDatabaseName(databaseName: String?): DbMetadata = - if (databaseName == null) { - DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY) - } else { - DbMetadata(name = databaseName, system = DB_SYSTEM_SQLITE) - } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt index 4c925198bd5..5099f38f691 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt @@ -1,17 +1,26 @@ package io.sentry.sqlite import io.sentry.IScopes +import io.sentry.ISpan import io.sentry.Instrumenter import io.sentry.ScopesAdapter import io.sentry.SentryDate import io.sentry.SentryLongDate +import io.sentry.SentryNanotimeDate import io.sentry.SentryStackTraceFactory import io.sentry.SpanDataConvention import io.sentry.SpanStatus +import java.util.Date private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite" -/** Shared span instrumentation for SQLite. */ +/** + * Sentinel for extracting a [SentryNanotimeDate]'s underlying [System.nanoTime] value via + * [SentryDate.diff]. + */ +private val EMPTY_NANO_TIME = SentryNanotimeDate(Date(0), 0L) + +/** Span instrumentation for [SentrySQLiteDriver]. */ internal class SQLiteSpanInstrumentation( private val scopes: IScopes, private val dbMetadata: DbMetadata, @@ -20,44 +29,32 @@ internal class SQLiteSpanInstrumentation( private val stackTraceFactory = SentryStackTraceFactory(scopes.options) /** - * Returns a start timestamp for a `db.sql.query` span. + * Returns a timestamp in nanoseconds for use with [recordSpan]. Timestamp is ns-precise if the + * active parent span uses a [SentryNanotimeDate] (the ordinary case); otherwise it's ms-precise. * - * Exposed so callers can capture a wall-clock start before accumulating database time. - * Internalizing the start time in [recordSpan] would shift spans to end-of-work on the trace - * timeline, which is less desirable. + * Note: Internalizing the start time in [recordSpan] would shift spans to end-of-work on the + * trace timeline, which is less desirable; callers capture the start before doing database work + * and pass it back to [recordSpan]. */ - fun startTimestamp(): SentryDate = scopes.options.dateProvider.now() - - /** Records a `db.sql.query` span from [startTimestamp] to the moment of invocation. */ - fun recordSpan( - sql: String, - startTimestamp: SentryDate, - status: SpanStatus, - throwable: Throwable? = null, - ) { - recordSpan(sql, startTimestamp, endTimestamp = null, status, throwable) - } + fun startTimestamp(): Long = + // Try to retain nanosecond precision + avoid SentryDate allocation... + scopes.span?.computeNanoStartTimestampForChild() + // ...otherwise fall back to millisecond precision + allocate. + ?: scopes.options.dateProvider.now().nanoTimestamp() - /** Records a `db.sql.query` span from [startTimestamp] to [startTimestamp] + [durationNanos]. */ + /** Records a `db.sql.query` span. */ fun recordSpan( sql: String, - startTimestamp: SentryDate, + startTimestampNanos: Long, durationNanos: Long, status: SpanStatus, throwable: Throwable? = null, ) { - val endTimestamp = SentryLongDate(startTimestamp.nanoTimestamp() + durationNanos) - recordSpan(sql, startTimestamp, endTimestamp, status, throwable) - } + val parent = scopes.span ?: return + val startTimestamp = SentryLongDate(startTimestampNanos) + val endTimestamp = SentryLongDate(startTimestampNanos + durationNanos) - private fun recordSpan( - sql: String, - startTimestamp: SentryDate, - endTimestamp: SentryDate?, - status: SpanStatus, - throwable: Throwable?, - ) { - scopes.span?.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY)?.apply { + parent.startChild("db.sql.query", sql, startTimestamp, Instrumenter.SENTRY).apply { spanContext.origin = SQLITE_TRACE_ORIGIN throwable?.let { this.throwable = it } @@ -85,15 +82,43 @@ internal class SQLiteSpanInstrumentation( scopes: IScopes = ScopesAdapter.getInstance(), ): SQLiteSpanInstrumentation = SQLiteSpanInstrumentation(scopes, dbMetadataFromFileName(fileName)) + } +} - /** - * Returns [SQLiteSpanInstrumentation] based on - * [SupportSQLiteOpenHelper.databaseName][androidx.sqlite.db.SupportSQLiteOpenHelper.databaseName]. - */ - fun fromDatabaseName( - databaseName: String?, - scopes: IScopes = ScopesAdapter.getInstance(), - ): SQLiteSpanInstrumentation = - SQLiteSpanInstrumentation(scopes, dbMetadataFromDatabaseName(databaseName)) +/** + * Computes a start timestamp with nanosecond precision for the child of the receiver span. Returns + * null if nanosecond precision isn't possible. + * + * Lets us improve the display of spans in the Sentry UI. If timestamps are only ms-precise, the + * Sentry UI will left-align and arbitrarily reorder spans that share the same wall clock ms: + * ``` + * (Relative start times out of order) + * ↓ + * Parent span ├█████████████┤ + * END TRANSACTION ├███┤ 0.33 ms + * BEGIN IMMEDIATE TRANSACTION ├████┤ 0.02 ms + * INSERT INTO `my_db` … ├██┤ 0.30 ms + * ↑ + * (All spans share the same ms baseline + * even though their execution was staggered) + * ``` + * + * Nanosecond precision ensures proper ordering and lets the spans stagger: + * ``` + * Parent span ├█████████████┤ + * BEGIN IMMEDIATE TRANSACTION ├████┤ 0.02 ms + * INSERT INTO `my_db` … ├██┤ 0.30 ms + * END TRANSACTION ├███┤ 0.33 ms + * ``` + */ +internal fun ISpan.computeNanoStartTimestampForChild(): Long? { + if (startDate !is SentryNanotimeDate) { + return null } + + val parentWallClockNanos = startDate.nanoTimestamp() + val parentMonotonicNanos = startDate.diff(EMPTY_NANO_TIME) + val elapsedSinceParentStart = System.nanoTime() - parentMonotonicNanos + // Return the child's absolute start time. + return parentWallClockNanos + elapsedSinceParentStart } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt index 41df37444b5..a739a396bcb 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt @@ -1,7 +1,6 @@ package io.sentry.sqlite import androidx.sqlite.SQLiteStatement -import io.sentry.SentryDate import io.sentry.SpanStatus /** @@ -22,7 +21,7 @@ internal class SentrySQLiteStatement( private val nanoTimeProvider: () -> Long = { System.nanoTime() }, ) : SQLiteStatement by delegate { - private var firstStepTimestamp: SentryDate? = null + private var firstStepTimestampNanos: Long? = null private var accumulatedDbNanos: Long = 0L private var stepsComplete = false private var closed = false @@ -35,8 +34,8 @@ internal class SentrySQLiteStatement( val beforeNanos = nanoTimeProvider() return try { - if (firstStepTimestamp == null) { - firstStepTimestamp = spans.startTimestamp() + if (firstStepTimestampNanos == null) { + firstStepTimestampNanos = spans.startTimestamp() } stepsComplete = !delegate.step() @@ -71,10 +70,10 @@ internal class SentrySQLiteStatement( } private fun recordSpan(status: SpanStatus, throwable: Throwable? = null) { - val start = firstStepTimestamp ?: return + val startNanos = firstStepTimestampNanos ?: return val duration = accumulatedDbNanos - firstStepTimestamp = null + firstStepTimestampNanos = null accumulatedDbNanos = 0L - spans.recordSpan(sql, start, duration, status, throwable) + spans.recordSpan(sql, startNanos, duration, status, throwable) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt new file mode 100644 index 00000000000..92a98b6e56d --- /dev/null +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt @@ -0,0 +1,100 @@ +package io.sentry.sqlite + +import io.sentry.DateUtils +import io.sentry.ISpan +import io.sentry.SentryLongDate +import io.sentry.SentryNanotimeDate +import java.util.Date +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertTrue +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever + +class ComputeNanoStartTimestampForChildTest { + + @Test + fun `returns parent wall clock plus elapsed monotonic time since parent started`() { + val wallClockMillis = 1_000_000L + val elapsedNanos = 500_000L + val parentMonotonicNanos = System.nanoTime() - elapsedNanos + val span = spanWithNanotimeStart(wallClockMillis, parentMonotonicNanos) + + val timestamp = span.computeNanoStartTimestampForChild()!! + + val elapsedSinceParentStart = timestamp - DateUtils.millisToNanos(wallClockMillis) + assertTrue(elapsedSinceParentStart >= elapsedNanos) + assertTrue(elapsedSinceParentStart < elapsedNanos + TEST_SLACK_NANOS) + } + + @Test + fun `same millisecond wall clocks with different monotonic offsets produce distinct ordered timestamps`() { + val wallClockMillis = 1_000_000L + val wallClockNanos = DateUtils.millisToNanos(wallClockMillis) + val earlierParentMonotonicNanos = System.nanoTime() - 200_000L + val laterParentMonotonicNanos = System.nanoTime() - 800_000L + val earlierSpan = spanWithNanotimeStart(wallClockMillis, earlierParentMonotonicNanos) + val laterSpan = spanWithNanotimeStart(wallClockMillis, laterParentMonotonicNanos) + + assertEquals( + earlierSpan.startDate.nanoTimestamp(), + laterSpan.startDate.nanoTimestamp(), + "Raw parent timestamps share the same ms-quantized value", + ) + + val earlier = earlierSpan.computeNanoStartTimestampForChild()!! + val later = laterSpan.computeNanoStartTimestampForChild()!! + + assertTrue(earlier > wallClockNanos) + assertTrue(later > wallClockNanos) + assertTrue(earlier < later) + assertTrue(later - earlier >= 500_000L) + } + + @Test + fun `returns parent wall clock when no monotonic time has elapsed since parent started`() { + val wallClockMillis = 1_000_000L + val parentMonotonicNanos = System.nanoTime() + val span = spanWithNanotimeStart(wallClockMillis, parentMonotonicNanos) + + val elapsedSinceParentStart = + span.computeNanoStartTimestampForChild()!! - DateUtils.millisToNanos(wallClockMillis) + assertTrue(elapsedSinceParentStart >= 0L) + assertTrue(elapsedSinceParentStart < TEST_SLACK_NANOS) + } + + @Test + fun `works when parent wall clock differs from millisecond baseline`() { + val wallClockMillis = 1_000_001L + val elapsedNanos = 1_500_000L + val parentMonotonicNanos = System.nanoTime() - elapsedNanos + val span = spanWithNanotimeStart(wallClockMillis, parentMonotonicNanos) + + val elapsedSinceParentStart = + span.computeNanoStartTimestampForChild()!! - DateUtils.millisToNanos(wallClockMillis) + assertTrue(elapsedSinceParentStart >= elapsedNanos) + assertTrue(elapsedSinceParentStart < elapsedNanos + TEST_SLACK_NANOS) + } + + @Test + fun `returns null when start date is not SentryNanotimeDate`() { + val span = mock() + whenever(span.startDate).thenReturn(SentryLongDate(DateUtils.millisToNanos(1_000_000L))) + + assertNull(span.computeNanoStartTimestampForChild()) + } + + private fun spanWithNanotimeStart(wallClockMillis: Long, parentMonotonicNanos: Long): ISpan { + val startDate = SentryNanotimeDate(Date(wallClockMillis), parentMonotonicNanos) + val span = mock() + whenever(span.startDate).thenReturn(startDate) + return span + } + + companion object { + + // Upper bound for monotonic drift while the test body runs. + private const val TEST_SLACK_NANOS = 50_000_000L + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt index 227b9d9558c..09d80793ed2 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DbMetadataTest.kt @@ -13,14 +13,6 @@ class DbMetadataTest { ) } - @Test - fun `dbMetadataFromDatabaseName returns in-memory system with no db name when databaseName is null`() { - assertEquals( - DbMetadata(name = null, system = DB_SYSTEM_IN_MEMORY), - dbMetadataFromDatabaseName(null), - ) - } - @Test fun `dbMetadataFromFileName returns sqlite system and db name for unix path`() { assertEquals( diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt index ead123a190b..a38be242ec5 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt @@ -1,15 +1,21 @@ package io.sentry.sqlite import io.sentry.IScopes +import io.sentry.ISpan +import io.sentry.SentryDateProvider +import io.sentry.SentryLongDate +import io.sentry.SentryNanotimeDate import io.sentry.SentryOptions import io.sentry.SentryTracer import io.sentry.SpanDataConvention import io.sentry.SpanStatus import io.sentry.TransactionContext import io.sentry.util.thread.IThreadChecker +import java.util.Date import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertIs import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue @@ -40,6 +46,63 @@ class SQLiteSpanInstrumentationTest { private val fixture = Fixture() + @Test + fun `startTimestamp is ns-precise and skips date provider when parent uses SentryNanotimeDate`() { + // Only the parent date is queued. If startTimestamp() were to call dateProvider.now(), + // the queue would underflow and the test would fail loudly — this is what verifies the + // optimization is in effect. + val parentDate = SentryNanotimeDate(Date(1_000_000L), 100_000_000L) + val sut = setUpWithNanotimeDates(parentDate) + + val start = sut.startTimestamp() + + val durationNanos = 42_000_000L + sut.recordSpan("SELECT 1", start, durationNanos, SpanStatus.OK) + + val span = fixture.sentryTracer.children.first() + + // startTimestamp returns an already-ns-precise value, anchored to the parent's wall clock and + // offset by elapsed System.nanoTime(). The exact ns-math is unit-tested in + // ChildStartTimestampOrNullTest; here we verify the integration shape. + assertIs(span.startDate) + assertEquals(start, span.startDate.nanoTimestamp()) + assertEquals(start + durationNanos, span.finishDate!!.nanoTimestamp()) + } + + @Test + fun `startTimestamp falls back to date provider when parent does not use SentryNanotimeDate`() { + val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L) + val parentSpan = mock() + whenever(parentSpan.startDate).thenReturn(SentryLongDate(1_000_000_000_000_000L)) + val options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + dateProvider = SentryDateProvider { providerDate } + } + whenever(fixture.scopes.options).thenReturn(options) + whenever(fixture.scopes.span).thenReturn(parentSpan) + + val sut = SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) + + assertEquals(providerDate.nanoTimestamp(), sut.startTimestamp()) + } + + @Test + fun `startTimestamp falls back to date provider when no transaction is active`() { + val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L) + val options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + dateProvider = SentryDateProvider { providerDate } + } + whenever(fixture.scopes.options).thenReturn(options) + whenever(fixture.scopes.span).thenReturn(null) + + val sut = SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) + + assertEquals(providerDate.nanoTimestamp(), sut.startTimestamp()) + } + @Test fun `recordSpan records a span if a transaction is active`() { val sut = fixture.getSut(isTransactionActive = true) @@ -79,7 +142,6 @@ class SQLiteSpanInstrumentationTest { sut.recordSpan("SELECT 1", start, durationNanos, SpanStatus.OK) val span = fixture.sentryTracer.children.first() - assertEquals(start, span.startDate) assertEquals(span.startDate.nanoTimestamp() + durationNanos, span.finishDate!!.nanoTimestamp()) } @@ -146,48 +208,16 @@ class SQLiteSpanInstrumentationTest { assertNull(span.getData(SpanDataConvention.CALL_STACK_KEY)) } - @Test - fun `recordSpan without a duration finishes the span at the time of invocation`() { - val sut = fixture.getSut() - val start = sut.startTimestamp() - - sut.recordSpan("SELECT 1", start, SpanStatus.OK) - - val span = fixture.sentryTracer.children.first() - assertTrue(span.isFinished) - assertEquals(SpanStatus.OK, span.status) - // Unlike the duration overload, no synthetic end timestamp is supplied; the span finishes at - // "now", i.e. at or after its start. - assertTrue(span.finishDate!!.nanoTimestamp() >= start.nanoTimestamp()) - } - - @Test - fun `fromFileName sets db name from fileName`() { - val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } - whenever(fixture.scopes.options).thenReturn(options) - fixture.sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) - whenever(fixture.scopes.span).thenReturn(fixture.sentryTracer) - - val sut = SQLiteSpanInstrumentation.fromFileName("tracks.db", fixture.scopes) - sut.recordSpan("SELECT 1", sut.startTimestamp(), SpanStatus.OK) - - val span = fixture.sentryTracer.children.first() - assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) - assertEquals("tracks.db", span.data[SpanDataConvention.DB_NAME_KEY]) - } - - @Test - fun `fromDatabaseName sets db name from databaseName`() { - val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } + private fun setUpWithNanotimeDates(vararg dates: SentryNanotimeDate): SQLiteSpanInstrumentation { + val dateQueue = ArrayDeque(dates.toList()) + val options = + SentryOptions().apply { + dsn = "https://key@sentry.io/proj" + dateProvider = SentryDateProvider { dateQueue.removeFirst() } + } whenever(fixture.scopes.options).thenReturn(options) fixture.sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) whenever(fixture.scopes.span).thenReturn(fixture.sentryTracer) - - val sut = SQLiteSpanInstrumentation.fromDatabaseName("tracks.db", fixture.scopes) - sut.recordSpan("SELECT 1", sut.startTimestamp(), SpanStatus.OK) - - val span = fixture.sentryTracer.children.first() - assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) - assertEquals("tracks.db", span.data[SpanDataConvention.DB_NAME_KEY]) + return SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt index 6691910e358..ce2c3f00cd5 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt @@ -1,7 +1,6 @@ package io.sentry.sqlite import androidx.sqlite.SQLiteStatement -import io.sentry.SentryLongDate import io.sentry.SpanStatus import java.util.concurrent.atomic.AtomicLong import kotlin.test.Test @@ -21,11 +20,11 @@ class SentrySQLiteStatementTest { private class Fixture { val mockStatement = mock() val mockSpans = mock() - val startDate = SentryLongDate(1_000_000_000_000L) + val startTimestampNanos = 1_000_000_000_000L val fakeClock = AtomicLong(0L) fun getSut(sql: String): SentrySQLiteStatement { - whenever(mockSpans.startTimestamp()).thenReturn(startDate) + whenever(mockSpans.startTimestamp()).thenReturn(startTimestampNanos) return SentrySQLiteStatement(mockStatement, mockSpans, sql, fakeClock::getAndIncrement) } } @@ -43,7 +42,7 @@ class SentrySQLiteStatementTest { verify(fixture.mockSpans) .recordSpan( eq("SELECT * FROM users"), - eq(fixture.startDate), + eq(fixture.startTimestampNanos), any(), eq(SpanStatus.OK), anyOrNull(), @@ -61,7 +60,7 @@ class SentrySQLiteStatementTest { verify(fixture.mockSpans) .recordSpan( eq("BAD SQL"), - eq(fixture.startDate), + eq(fixture.startTimestampNanos), any(), eq(SpanStatus.INTERNAL_ERROR), eq(exception), From 3a7603a26335e1f1aafb78c75b4f1079819b25b3 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 17 Jun 2026 15:45:35 +0200 Subject: [PATCH 209/391] perf(android): Replace Date with unix timestamp in SentryNanotimeDate (JAVA-533) (#5550) * perf(android): Replace Date with unix timestamp in SentryNanotimeDate (JAVA-533) SentryNanotimeDate stored a java.util.Date but only ever read its epoch millis. Storing the millis directly avoids a Calendar allocation on every timestamp, which on Android backs every span/transaction timestamp. The default constructor now uses System.currentTimeMillis() instead of DateUtils.getCurrentDateTime() (Calendar with UTC). This is behavior- preserving: the UTC TimeZone only affects calendar field access, not the epoch-millis value the class used. BREAKING: the public SentryNanotimeDate(Date, long) constructor is replaced by SentryNanotimeDate(long unixDate, long nanos). Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * ref(android): Mark SentryNanotimeDate as @ApiStatus.Internal SentryNanotimeDate is the legacy Date+nanoTime precision workaround and is not intended for direct use by consumers. Marking it @ApiStatus.Internal signals this and means the constructor change in this PR is not a public API break per the repo's API policy. Co-Authored-By: Claude Opus 4.8 (1M context) * refactor(sentry): Rename unixDate field to unixDateMillis Name the long field for its unit so it is clear it holds the unix timestamp in milliseconds since the epoch. Co-Authored-By: Claude Opus 4.8 (1M context) * docs(changelog): Reword SentryNanotimeDate entry Co-Authored-By: Claude Opus 4.8 (1M context) * feat(sentry): Restore deprecated SentryNanotimeDate Date constructor (JAVA-533) The previous change replaced the (Date, long) constructor with a (long, long) constructor, which was a breaking API change. Add the Date constructor back, delegating to the millis-based one, and mark it deprecated to steer callers toward the new constructor. Co-Authored-By: Claude Opus 4.8 (1M context) * fix(sentry): Suppress InlineMeSuggester on deprecated constructor (JAVA-533) Error Prone flagged the deprecated (Date, long) constructor as inlineable, failing the build. Suppress the suggestion to match the existing convention in Sentry.java, keeping the constructor available for backwards compatibility. Co-Authored-By: Claude Opus 4.8 (1M context) * fix(sentry): Suppress JavaUtilDate on deprecated constructor (JAVA-533) Error Prone's JavaUtilDate check flagged date.getTime() in the deprecated constructor, failing the build. Suppress it, matching the existing suppression used elsewhere in this class. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 2 + .../core/ActivityLifecycleIntegration.java | 5 +- .../core/SpanFrameMetricsCollector.java | 3 +- .../core/ActivityLifecycleIntegrationTest.kt | 67 +++++++++---------- .../core/NetworkBreadcrumbsIntegrationTest.kt | 6 +- .../core/SpanFrameMetricsCollectorTest.kt | 15 +++-- .../ActivityLifecycleSpanHelperTest.kt | 9 ++- .../core/performance/AppStartMetricsTest.kt | 3 +- .../apache/ApacheHttpClientTransportTest.kt | 4 +- sentry/api/sentry.api | 2 +- sentry/src/main/java/io/sentry/DateUtils.java | 11 --- .../java/io/sentry/SentryNanotimeDate.java | 29 +++++--- ...efaultCompositePerformanceCollectorTest.kt | 21 ++---- .../java/io/sentry/SentryNanotimeDateTest.kt | 29 ++++---- .../test/java/io/sentry/SentryTracerTest.kt | 5 +- .../transport/AsyncHttpTransportTest.kt | 4 +- 16 files changed, 99 insertions(+), 116 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dbcde58f10..0de5fc72452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ ### Improvements - Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527), [#5551](https://github.com/getsentry/sentry-java/pull/5551)) +- Replace `Date` with a unix timestamp in `SentryNanotimeDate` to improve performance ([#5550](https://github.com/getsentry/sentry-java/pull/5550)) + - `SentryNanotimeDate` is now marked `@ApiStatus.Internal`. A new `(long unixDateMillis, long nanos)` constructor was added, where `unixDateMillis` is milliseconds since the epoch. The existing `(Date, long)` constructor is retained but deprecated. ### Dependencies diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java index 19cee7fcce5..8a891926341 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java @@ -45,7 +45,6 @@ import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Collections; -import java.util.Date; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.Future; @@ -94,7 +93,7 @@ public final class ActivityLifecycleIntegration private final @NotNull WeakHashMap ttfdSpanMap = new WeakHashMap<>(); private final @NotNull WeakHashMap activitySpanHelpers = new WeakHashMap<>(); - private @NotNull SentryDate lastPausedTime = new SentryNanotimeDate(new Date(0), 0); + private @NotNull SentryDate lastPausedTime = new SentryNanotimeDate(0, 0); private @Nullable Future ttfdAutoCloseFuture = null; // WeakHashMap isn't thread safe but ActivityLifecycleCallbacks is only called from the @@ -729,7 +728,7 @@ public void onActivityDestroyed(final @NotNull Activity activity) { private void clear() { firstActivityCreated = false; - lastPausedTime = new SentryNanotimeDate(new Date(0), 0); + lastPausedTime = new SentryNanotimeDate(0, 0); activitySpanHelpers.clear(); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java b/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java index a83454d29b7..074a4a6ea51 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java @@ -13,7 +13,6 @@ import io.sentry.android.core.internal.util.SentryFrameMetricsCollector; import io.sentry.protocol.MeasurementValue; import io.sentry.util.AutoClosableReentrantLock; -import java.util.Date; import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; @@ -33,7 +32,7 @@ public class SpanFrameMetricsCollector // grow indefinitely in case of a long running span private static final int MAX_FRAMES_COUNT = 3600; private static final long ONE_SECOND_NANOS = TimeUnit.SECONDS.toNanos(1); - private static final SentryNanotimeDate EMPTY_NANO_TIME = new SentryNanotimeDate(new Date(0), 0); + private static final SentryNanotimeDate EMPTY_NANO_TIME = new SentryNanotimeDate(0, 0); private final boolean enabled; protected final @NotNull AutoClosableReentrantLock lock = new AutoClosableReentrantLock(); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt index f2ffb4b4b96..19f43432bef 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt @@ -41,7 +41,6 @@ import io.sentry.protocol.SentryId import io.sentry.protocol.TransactionNameSource import io.sentry.test.DeferredExecutorService import io.sentry.test.getProperty -import java.util.Date import java.util.concurrent.Future import java.util.concurrent.TimeUnit import kotlin.test.AfterTest @@ -936,7 +935,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) sut.setFirstActivityCreated(false) - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime(date) fixture.options.dateProvider = SentryDateProvider { date } @@ -961,7 +960,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) sut.setFirstActivityCreated(false) - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime(date) val activity = mock() @@ -984,8 +983,8 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) sut.setFirstActivityCreated(false) - val date = SentryNanotimeDate(Date(1), 0) - val date2 = SentryNanotimeDate(Date(2), 2) + val date = SentryNanotimeDate(1, 0) + val date2 = SentryNanotimeDate(2, 2) setAppStartTime(date) val activity = mock() @@ -1011,7 +1010,7 @@ class ActivityLifecycleIntegrationTest { val sut = fixture.getSut { it.tracesSampleRate = 1.0 } sut.register(fixture.scopes, fixture.options) sut.setFirstActivityCreated(true) - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime(date) val activity = mock() @@ -1030,8 +1029,8 @@ class ActivityLifecycleIntegrationTest { sut.setFirstActivityCreated(false) // usually set by SentryPerformanceProvider - val date = SentryNanotimeDate(Date(1), 0) - val date2 = SentryNanotimeDate(Date(2), 2) + val date = SentryNanotimeDate(1, 0) + val date2 = SentryNanotimeDate(2, 2) val activity = mock() // Activity onCreate date will be used @@ -1056,7 +1055,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) // usually set by SentryPerformanceProvider - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime(date) val activity = mock() @@ -1080,7 +1079,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) // usually set by SentryPerformanceProvider - val startDate = SentryNanotimeDate(Date(1), 0) + val startDate = SentryNanotimeDate(1, 0) setAppStartTime(startDate) val appStartMetrics = AppStartMetrics.getInstance() appStartMetrics.appStartType = AppStartType.WARM @@ -1113,9 +1112,9 @@ class ActivityLifecycleIntegrationTest { it.isEnableStandaloneAppStartTracing = true } sut.register(fixture.scopes, fixture.options) - val firstFrameDate = SentryNanotimeDate(Date(1499), 0) + val firstFrameDate = SentryNanotimeDate(1499, 0) fixture.options.dateProvider = SentryDateProvider { firstFrameDate } - setAppStartTime(SentryNanotimeDate(Date(1), 0)) + setAppStartTime(SentryNanotimeDate(1, 0)) val activity = mock() sut.onActivityPreCreated(activity, fixture.bundle) @@ -1168,8 +1167,8 @@ class ActivityLifecycleIntegrationTest { it.isEnableStandaloneAppStartTracing = true } sut.register(fixture.scopes, fixture.options) - val appStartEndDate = SentryNanotimeDate(Date(499), 0) - setAppStartTime(SentryNanotimeDate(Date(1), 0), appStartEndDate) + val appStartEndDate = SentryNanotimeDate(499, 0) + setAppStartTime(SentryNanotimeDate(1, 0), appStartEndDate) val activity = mock() sut.onActivityPreCreated(activity, fixture.bundle) @@ -1230,9 +1229,9 @@ class ActivityLifecycleIntegrationTest { AppStartMetrics.getInstance().appStartSentryTraceHeader = SentryTraceHeader(storedTraceId, SpanId(), true).value // headless start ended right before the activity opens - AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(Date(0), 0) + AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(0, 0) sut.register(fixture.scopes, fixture.options) - setAppStartTime(date = SentryNanotimeDate(Date(1), 0)) + setAppStartTime(date = SentryNanotimeDate(1, 0)) val activity = mock() sut.onActivityCreated(activity, fixture.bundle) @@ -1254,9 +1253,9 @@ class ActivityLifecycleIntegrationTest { AppStartMetrics.getInstance().appStartSentryTraceHeader = SentryTraceHeader(storedTraceId, SpanId(), true).value // headless start ended at epoch, but the activity opens more than a minute later - AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(Date(0), 0) + AppStartMetrics.getInstance().appStartEndTime = SentryNanotimeDate(0, 0) sut.register(fixture.scopes, fixture.options) - setAppStartTime(date = SentryNanotimeDate(Date(TimeUnit.MINUTES.toMillis(2)), 0)) + setAppStartTime(date = SentryNanotimeDate(TimeUnit.MINUTES.toMillis(2), 0)) val activity = mock() sut.onActivityCreated(activity, fixture.bundle) @@ -1389,7 +1388,7 @@ class ActivityLifecycleIntegrationTest { // usually done by SentryPerformanceProvider, if disabled it's done by // SentryAndroid.init - val startDate = SentryNanotimeDate(Date(1), 0) + val startDate = SentryNanotimeDate(1, 0) setAppStartTime(startDate) AppStartMetrics.getInstance().appStartType = AppStartType.WARM @@ -1415,7 +1414,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) // usually done by SentryPerformanceProvider - val startDate = SentryNanotimeDate(Date(1), 0) + val startDate = SentryNanotimeDate(1, 0) setAppStartTime(startDate) AppStartMetrics.getInstance().appStartType = AppStartType.WARM AppStartMetrics.getInstance().sdkInitTimeSpan.setStoppedAt(1234) @@ -1439,7 +1438,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) // usually done by SentryPerformanceProvider - val startDate = SentryNanotimeDate(Date(1), 0) + val startDate = SentryNanotimeDate(1, 0) setAppStartTime(startDate) AppStartMetrics.getInstance().appStartType = AppStartType.WARM @@ -1474,7 +1473,7 @@ class ActivityLifecycleIntegrationTest { sut.register(fixture.scopes, fixture.options) sut.setFirstActivityCreated(true) - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime() val activity = mock() @@ -1988,14 +1987,14 @@ class ActivityLifecycleIntegrationTest { @Test fun `When sentry is initialized mid activity lifecycle, last paused time should be used in favor of app start time`() { val sut = fixture.getSut(importance = RunningAppProcessInfo.IMPORTANCE_FOREGROUND) - val now = SentryNanotimeDate(Date(1234), 456) + val now = SentryNanotimeDate(1234, 456) fixture.options.tracesSampleRate = 1.0 fixture.options.dateProvider = SentryDateProvider { now } sut.register(fixture.scopes, fixture.options) // usually done by SentryPerformanceProvider - val startDate = SentryNanotimeDate(Date(5678), 910) + val startDate = SentryNanotimeDate(5678, 910) setAppStartTime(startDate) AppStartMetrics.getInstance().appStartType = AppStartType.COLD @@ -2019,7 +2018,7 @@ class ActivityLifecycleIntegrationTest { fixture.options.tracesSampleRate = 1.0 sut.register(fixture.scopes, fixture.options) - val date = SentryNanotimeDate(Date(1), 0) + val date = SentryNanotimeDate(1, 0) setAppStartTime(date) assertTrue(sut.activitySpanHelpers.isEmpty()) @@ -2036,8 +2035,8 @@ class ActivityLifecycleIntegrationTest { fun `Creates activity lifecycle spans`() { val sut = fixture.getSut() fixture.options.tracesSampleRate = 1.0 - val appStartDate = SentryNanotimeDate(Date(1), 0) - val startDate = SentryNanotimeDate(Date(2), 0) + val appStartDate = SentryNanotimeDate(1, 0) + val startDate = SentryNanotimeDate(2, 0) val appStartMetrics = AppStartMetrics.getInstance() val activity = mock() fixture.options.dateProvider = SentryDateProvider { startDate } @@ -2076,7 +2075,7 @@ class ActivityLifecycleIntegrationTest { fun `Creates activity lifecycle spans even when no app start span is available`() { val sut = fixture.getSut() fixture.options.tracesSampleRate = 1.0 - val startDate = SentryNanotimeDate(Date(2), 0) + val startDate = SentryNanotimeDate(2, 0) val appStartMetrics = AppStartMetrics.getInstance() val activity = mock() fixture.options.dateProvider = SentryDateProvider { startDate } @@ -2134,8 +2133,8 @@ class ActivityLifecycleIntegrationTest { fun `Creates activity lifecycle spans on API lower than 29`() { val sut = fixture.getSut(apiVersion = Build.VERSION_CODES.P) fixture.options.tracesSampleRate = 1.0 - val appStartDate = SentryNanotimeDate(Date(1), 0) - val startDate = SentryNanotimeDate(Date(2), 0) + val appStartDate = SentryNanotimeDate(1, 0) + val startDate = SentryNanotimeDate(2, 0) val appStartMetrics = AppStartMetrics.getInstance() val activity = mock() fixture.options.dateProvider = SentryDateProvider { startDate } @@ -2187,8 +2186,8 @@ class ActivityLifecycleIntegrationTest { fun `Does not add activity lifecycle spans when firstActivityCreated is true`() { val sut = fixture.getSut() fixture.options.tracesSampleRate = 1.0 - val appStartDate = SentryNanotimeDate(Date(1), 0) - val startDate = SentryNanotimeDate(Date(2), 0) + val appStartDate = SentryNanotimeDate(1, 0) + val startDate = SentryNanotimeDate(2, 0) val appStartMetrics = AppStartMetrics.getInstance() val activity = mock() fixture.options.dateProvider = SentryDateProvider { startDate } @@ -2209,7 +2208,7 @@ class ActivityLifecycleIntegrationTest { fun `When firstActivityCreated is false and app start span has stopped, restart app start to current date`() { val sut = fixture.getSut() fixture.options.tracesSampleRate = 1.0 - val appStartDate = SentryNanotimeDate(Date(1), 0) + val appStartDate = SentryNanotimeDate(1, 0) val appStartMetrics = AppStartMetrics.getInstance() val activity = mock() setAppStartTime(appStartDate) @@ -2290,7 +2289,7 @@ class ActivityLifecycleIntegrationTest { } private fun setAppStartTime( - date: SentryDate = SentryNanotimeDate(Date(1), 0), + date: SentryDate = SentryNanotimeDate(1, 0), stopDate: SentryDate? = null, ) { // set by SentryPerformanceProvider so forcing it here diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt index 4f6ba7fc5f0..711f5f7fe0b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt @@ -5,7 +5,6 @@ import android.net.Network import android.net.NetworkCapabilities import android.os.Build import io.sentry.Breadcrumb -import io.sentry.DateUtils import io.sentry.IScopes import io.sentry.ISentryExecutorService import io.sentry.SentryDateProvider @@ -54,8 +53,9 @@ class NetworkBreadcrumbsIntegrationTest { executorService = executor isEnableNetworkEventBreadcrumbs = enableNetworkEventBreadcrumbs dateProvider = SentryDateProvider { - val nowNanos = TimeUnit.MILLISECONDS.toNanos(nowMs ?: System.currentTimeMillis()) - SentryNanotimeDate(DateUtils.nanosToDate(nowNanos), nowNanos) + val nowMillis = nowMs ?: System.currentTimeMillis() + val nowNanos = TimeUnit.MILLISECONDS.toNanos(nowMillis) + SentryNanotimeDate(nowMillis, nowNanos) } } return NetworkBreadcrumbsIntegration(context, buildInfo) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt index e5d7349d37c..2b6f19a8d31 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt @@ -8,7 +8,6 @@ import io.sentry.SentryNanotimeDate import io.sentry.SpanContext import io.sentry.android.core.internal.util.SentryFrameMetricsCollector import io.sentry.protocol.MeasurementValue -import java.util.Date import java.util.UUID import java.util.concurrent.TimeUnit import kotlin.test.Test @@ -50,11 +49,12 @@ class SpanFrameMetricsCollectorTest { val span = mock() val spanContext = SpanContext("op.fake") whenever(span.spanContext).thenReturn(spanContext) - whenever(span.startDate).thenReturn(SentryNanotimeDate(Date(), startTimeStampNanos)) + whenever(span.startDate) + .thenReturn(SentryNanotimeDate(System.currentTimeMillis(), startTimeStampNanos)) whenever(span.finishDate) .thenReturn( if (endTimeStampNanos != null) { - SentryNanotimeDate(Date(), endTimeStampNanos) + SentryNanotimeDate(System.currentTimeMillis(), endTimeStampNanos) } else { null } @@ -69,11 +69,12 @@ class SpanFrameMetricsCollectorTest { val span = mock() val spanContext = SpanContext("op.fake") whenever(span.spanContext).thenReturn(spanContext) - whenever(span.startDate).thenReturn(SentryNanotimeDate(Date(), startTimeStampNanos)) + whenever(span.startDate) + .thenReturn(SentryNanotimeDate(System.currentTimeMillis(), startTimeStampNanos)) whenever(span.finishDate) .thenReturn( if (endTimeStampNanos != null) { - SentryNanotimeDate(Date(), endTimeStampNanos) + SentryNanotimeDate(System.currentTimeMillis(), endTimeStampNanos) } else { null } @@ -438,8 +439,8 @@ class SpanFrameMetricsCollectorTest { @Test fun `SentryNanoDate diff does nano precision`() { // having this in here, as SpanFrameMetricsCollector relies on this behavior - val a = SentryNanotimeDate(Date(1234), 567) - val b = SentryNanotimeDate(Date(1234), 0) + val a = SentryNanotimeDate(1234, 567) + val b = SentryNanotimeDate(1234, 0) assertEquals(567, a.diff(b)) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt index 710fc835acd..ef048978795 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/ActivityLifecycleSpanHelperTest.kt @@ -12,7 +12,6 @@ import io.sentry.SpanDataConvention import io.sentry.SpanOptions import io.sentry.TracesSamplingDecision import io.sentry.TransactionContext -import java.util.Date import java.util.concurrent.TimeUnit import kotlin.test.BeforeTest import kotlin.test.Test @@ -31,8 +30,8 @@ class ActivityLifecycleSpanHelperTest { val appStartSpan: ISpan val scopes = mock() val options = SentryOptions() - val date = SentryNanotimeDate(Date(1), 1000000) - val endDate = SentryNanotimeDate(Date(3), 3000000) + val date = SentryNanotimeDate(1, 1000000) + val endDate = SentryNanotimeDate(3, 3000000) init { whenever(scopes.options).thenReturn(options) @@ -59,7 +58,7 @@ class ActivityLifecycleSpanHelperTest { @Test fun `createAndStopOnCreateSpan creates and finishes onCreate span`() { val helper = fixture.getSut() - val date = SentryNanotimeDate(Date(1), 1) + val date = SentryNanotimeDate(1, 1) helper.setOnCreateStartTimestamp(date) helper.createAndStopOnCreateSpan(fixture.appStartSpan) @@ -99,7 +98,7 @@ class ActivityLifecycleSpanHelperTest { @Test fun `createAndStopOnStartSpan creates and finishes onStart span`() { val helper = fixture.getSut() - val date = SentryNanotimeDate(Date(1), 1) + val date = SentryNanotimeDate(1, 1) helper.setOnStartStartTimestamp(date) helper.createAndStopOnStartSpan(fixture.appStartSpan) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt index ab0013a8c75..2737785349f 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt @@ -18,7 +18,6 @@ import io.sentry.android.core.CurrentActivityHolder import io.sentry.android.core.SentryAndroidOptions import io.sentry.android.core.SentryShadowProcess import io.sentry.protocol.SentryId -import java.util.Date import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger import kotlin.test.Test @@ -639,7 +638,7 @@ class AppStartMetricsTest { @Test fun `createProcessInitSpan creates a span`() { val appStartMetrics = AppStartMetrics.getInstance() - val startDate = SentryNanotimeDate(Date(1), 1000000) + val startDate = SentryNanotimeDate(1, 1000000) appStartMetrics.classLoadedUptimeMs = 10 val startMillis = DateUtils.nanosToMillis(startDate.nanoTimestamp().toDouble()).toLong() appStartMetrics.appStartTimeSpan.setStartedAt(1) diff --git a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportTest.kt b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportTest.kt index 639dd4e0513..9f5c9b910ad 100644 --- a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportTest.kt +++ b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportTest.kt @@ -213,7 +213,7 @@ class ApacheHttpClientTransportTest { val now = Date(9001) val sut = fixture.getSut() fixture.options.dateProvider = mock() - whenever(fixture.options.dateProvider.now()).thenReturn(SentryNanotimeDate(now, 0)) + whenever(fixture.options.dateProvider.now()).thenReturn(SentryNanotimeDate(now.time, 0)) val envelope = SentryEnvelope.from(fixture.options.serializer, SentryEvent(), null) sut.send(envelope) @@ -226,7 +226,7 @@ class ApacheHttpClientTransportTest { val now = Date(9001) val sut = fixture.getSut() fixture.options.dateProvider = mock() - whenever(fixture.options.dateProvider.now()).thenReturn(SentryNanotimeDate(now, 0)) + whenever(fixture.options.dateProvider.now()).thenReturn(SentryNanotimeDate(now.time, 0)) val envelope = SentryEnvelope.from(fixture.options.serializer, SentryEvent(), null) sut.send(envelope, Hint()) diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 22f9366f738..e9083350349 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -382,7 +382,6 @@ public final class io/sentry/DataCategory : java/lang/Enum { } public final class io/sentry/DateUtils { - public static fun dateToNanos (Ljava/util/Date;)J public static fun dateToSeconds (Ljava/util/Date;)D public static fun doubleToBigDecimal (D)Ljava/math/BigDecimal; public static fun getCurrentDateTime ()Ljava/util/Date; @@ -3558,6 +3557,7 @@ public final class io/sentry/SentryMetricsEvents$JsonKeys { public final class io/sentry/SentryNanotimeDate : io/sentry/SentryDate { public fun ()V + public fun (JJ)V public fun (Ljava/util/Date;J)V public fun compareTo (Lio/sentry/SentryDate;)I public synthetic fun compareTo (Ljava/lang/Object;)I diff --git a/sentry/src/main/java/io/sentry/DateUtils.java b/sentry/src/main/java/io/sentry/DateUtils.java index b86bddeaad8..e407391c394 100644 --- a/sentry/src/main/java/io/sentry/DateUtils.java +++ b/sentry/src/main/java/io/sentry/DateUtils.java @@ -151,17 +151,6 @@ public static double dateToSeconds(final @NotNull Date date) { return millisToSeconds(date.getTime()); } - /** - * Convert {@link Date} to nanoseconds represented as {@link Long}. - * - * @param date - date - * @return nanoseconds - */ - @SuppressWarnings("JavaUtilDate") - public static long dateToNanos(final @NotNull Date date) { - return millisToNanos(date.getTime()); - } - public static long secondsToNanos(final @NotNull long seconds) { return seconds * (1000L * 1000L * 1000L); } diff --git a/sentry/src/main/java/io/sentry/SentryNanotimeDate.java b/sentry/src/main/java/io/sentry/SentryNanotimeDate.java index 98c46ad5325..f3abf3518f7 100644 --- a/sentry/src/main/java/io/sentry/SentryNanotimeDate.java +++ b/sentry/src/main/java/io/sentry/SentryNanotimeDate.java @@ -1,32 +1,43 @@ package io.sentry; import java.util.Date; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** - * Uses {@link Date} in combination with System.nanoTime(). + * Uses a unix timestamp (milliseconds since the epoch) in combination with System.nanoTime(). * - *

A single date only offers millisecond precision but diff can be calculated with up to + *

The unix timestamp only offers millisecond precision but diff can be calculated with up to * nanosecond precision. This increased precision can also be used to calculate a new end date for a * transaction where start date is sent with ms precision and end date is added to it with ns * precision leading to an end timestamp with ns precision that can be used to gain ns precision * transaction durations. * *

This is a workaround for older versions of Java (before 9) and Android API (lower than 26) - * that allows for higher precision than {@link Date} alone would. + * that allows for higher precision than a millisecond timestamp alone would. */ +@ApiStatus.Internal public final class SentryNanotimeDate extends SentryDate { - private final @NotNull Date date; + private final long unixDateMillis; private final long nanos; public SentryNanotimeDate() { - this(DateUtils.getCurrentDateTime(), System.nanoTime()); + this(System.currentTimeMillis(), System.nanoTime()); } + /** + * @deprecated use {@link SentryNanotimeDate#SentryNanotimeDate(long, long)} instead. + */ + @Deprecated + @SuppressWarnings({"InlineMeSuggester", "JavaUtilDate"}) public SentryNanotimeDate(final @NotNull Date date, final long nanos) { - this.date = date; + this(date.getTime(), nanos); + } + + public SentryNanotimeDate(final long unixDateMillis, final long nanos) { + this.unixDateMillis = unixDateMillis; this.nanos = nanos; } @@ -41,7 +52,7 @@ public long diff(final @NotNull SentryDate otherDate) { @Override public long nanoTimestamp() { - return DateUtils.dateToNanos(date); + return DateUtils.millisToNanos(unixDateMillis); } @Override @@ -63,8 +74,8 @@ public long laterDateNanosTimestampByDiff(final @Nullable SentryDate otherDate) public int compareTo(@NotNull SentryDate otherDate) { if (otherDate instanceof SentryNanotimeDate) { final @NotNull SentryNanotimeDate otherNanoDate = (SentryNanotimeDate) otherDate; - final long thisDateMillis = date.getTime(); - final long otherDateMillis = otherNanoDate.date.getTime(); + final long thisDateMillis = unixDateMillis; + final long otherDateMillis = otherNanoDate.unixDateMillis; if (thisDateMillis == otherDateMillis) { return Long.compare(nanos, otherNanoDate.nanos); } else { diff --git a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt index ceec3571ebd..f8e3a8f9f98 100644 --- a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt +++ b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt @@ -4,7 +4,6 @@ import io.sentry.test.getCtor import io.sentry.test.getProperty import io.sentry.test.injectForField import io.sentry.util.thread.ThreadChecker -import java.util.Date import java.util.Timer import java.util.concurrent.TimeUnit import kotlin.test.Test @@ -188,14 +187,8 @@ class DefaultCompositePerformanceCollectorTest { val mockCollector = mock() val dates = listOf( - SentryNanotimeDate( - Date().apply { time = TimeUnit.SECONDS.toMillis(100) }, - TimeUnit.SECONDS.toNanos(100), - ), - SentryNanotimeDate( - Date().apply { time = TimeUnit.SECONDS.toMillis(131) }, - TimeUnit.SECONDS.toNanos(131), - ), + SentryNanotimeDate(TimeUnit.SECONDS.toMillis(100), TimeUnit.SECONDS.toNanos(100)), + SentryNanotimeDate(TimeUnit.SECONDS.toMillis(131), TimeUnit.SECONDS.toNanos(131)), ) whenever(mockDateProvider.now()).thenReturn(dates[0], dates[0], dates[0], dates[1]) val collector = @@ -226,14 +219,8 @@ class DefaultCompositePerformanceCollectorTest { val mockDateProvider = mock() val dates = listOf( - SentryNanotimeDate( - Date().apply { time = TimeUnit.SECONDS.toMillis(100) }, - TimeUnit.SECONDS.toNanos(100), - ), - SentryNanotimeDate( - Date().apply { time = TimeUnit.SECONDS.toMillis(130) }, - TimeUnit.SECONDS.toNanos(130), - ), + SentryNanotimeDate(TimeUnit.SECONDS.toMillis(100), TimeUnit.SECONDS.toNanos(100)), + SentryNanotimeDate(TimeUnit.SECONDS.toMillis(130), TimeUnit.SECONDS.toNanos(130)), ) whenever(mockDateProvider.now()).thenReturn(dates[0], dates[0], dates[0], dates[1]) val collector = fixture.getSut { it.dateProvider = mockDateProvider } diff --git a/sentry/src/test/java/io/sentry/SentryNanotimeDateTest.kt b/sentry/src/test/java/io/sentry/SentryNanotimeDateTest.kt index 86464bcedba..3f7a5dca8b6 100644 --- a/sentry/src/test/java/io/sentry/SentryNanotimeDateTest.kt +++ b/sentry/src/test/java/io/sentry/SentryNanotimeDateTest.kt @@ -1,20 +1,19 @@ package io.sentry -import java.util.Date import kotlin.test.Test import kotlin.test.assertEquals class SentryNanotimeDateTest { @Test fun `doubleValue only offers ms precision`() { - val date = SentryNanotimeDate(Date(1672742031123), 123456789) + val date = SentryNanotimeDate(1672742031123, 123456789) assertEquals(1672742031123000000L, date.nanoTimestamp()) } @Test fun `laterDateNanosByDiff offers ns precision`() { - val startDate = SentryNanotimeDate(Date(1672742031123), 456788) - val finishDate = SentryNanotimeDate(Date(1672742031123), 456789) + val startDate = SentryNanotimeDate(1672742031123, 456788) + val finishDate = SentryNanotimeDate(1672742031123, 456789) val dateInSeconds = startDate.laterDateNanosTimestampByDiff(finishDate) assertEquals(1672742031123000001L, dateInSeconds) } @@ -26,7 +25,7 @@ class SentryNanotimeDateTest { */ @Test fun `laterDateNanosByDiff with SentryLongDate gives ms precision`() { - val startDate = SentryNanotimeDate(Date(1672742031123), 456789) + val startDate = SentryNanotimeDate(1672742031123, 456789) val finishDate = SentryLongDate(61633553039) val dateInSeconds = startDate.laterDateNanosTimestampByDiff(finishDate) assertEquals(1672742031123000000L, dateInSeconds) @@ -36,36 +35,36 @@ class SentryNanotimeDateTest { @Test fun `compareTo() with equal dates returns 0`() { - val date1 = SentryNanotimeDate(Date(1672742031123), 456789) - val date2 = SentryNanotimeDate(Date(1672742031123), 456789) + val date1 = SentryNanotimeDate(1672742031123, 456789) + val date2 = SentryNanotimeDate(1672742031123, 456789) assertEquals(0, date1.compareTo(date2)) } @Test fun `compareTo() returns -1 for earlier ns`() { - val date1 = SentryNanotimeDate(Date(1672742031123), 456788) - val date2 = SentryNanotimeDate(Date(1672742031123), 456789) + val date1 = SentryNanotimeDate(1672742031123, 456788) + val date2 = SentryNanotimeDate(1672742031123, 456789) assertEquals(-1, date1.compareTo(date2)) } @Test fun `compareTo() returns 1 for later ns`() { - val date1 = SentryNanotimeDate(Date(1672742031123), 456789) - val date2 = SentryNanotimeDate(Date(1672742031123), 456788) + val date1 = SentryNanotimeDate(1672742031123, 456789) + val date2 = SentryNanotimeDate(1672742031123, 456788) assertEquals(1, date1.compareTo(date2)) } @Test fun `compareTo() returns -1 for earlier date`() { - val date1 = SentryNanotimeDate(Date(1672742030123), 456789) - val date2 = SentryNanotimeDate(Date(1672742031123), 456789) + val date1 = SentryNanotimeDate(1672742030123, 456789) + val date2 = SentryNanotimeDate(1672742031123, 456789) assertEquals(-1, date1.compareTo(date2)) } @Test fun `compareTo() returns 1 for later date`() { - val date1 = SentryNanotimeDate(Date(1672742031123), 456789) - val date2 = SentryNanotimeDate(Date(1672742030123), 456789) + val date1 = SentryNanotimeDate(1672742031123, 456789) + val date2 = SentryNanotimeDate(1672742030123, 456789) assertEquals(1, date1.compareTo(date2)) } } diff --git a/sentry/src/test/java/io/sentry/SentryTracerTest.kt b/sentry/src/test/java/io/sentry/SentryTracerTest.kt index 1ccbcf2f318..3b808dd2220 100644 --- a/sentry/src/test/java/io/sentry/SentryTracerTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTracerTest.kt @@ -8,7 +8,6 @@ import io.sentry.test.getProperty import io.sentry.util.thread.IThreadChecker import java.time.LocalDateTime import java.time.ZoneOffset -import java.util.Date import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -184,7 +183,7 @@ class SentryTracerTest { val tracer = fixture.getSut() val date = SentryNanotimeDate( - Date.from(LocalDateTime.of(2022, 12, 24, 23, 59, 58, 0).toInstant(ZoneOffset.UTC)), + LocalDateTime.of(2022, 12, 24, 23, 59, 58, 0).toInstant(ZoneOffset.UTC).toEpochMilli(), 0, ) tracer.finish(SpanStatus.ABORTED, date) @@ -643,7 +642,7 @@ class SentryTracerTest { @Test fun `when startTimestamp is given, use it as startTimestamp`() { - val date = SentryNanotimeDate(Date(0), 0) + val date = SentryNanotimeDate(0, 0) val transaction = fixture.getSut(startTimestamp = date) assertSame(date, transaction.startDate) diff --git a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt index 70092ffa7ba..6f711cfedbf 100644 --- a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt +++ b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt @@ -367,7 +367,7 @@ class AsyncHttpTransportTest { // given val now = Date(9001) fixture.sentryOptions.dateProvider = mock() - whenever(fixture.sentryOptions.dateProvider.now()).thenReturn(SentryNanotimeDate(now, 0)) + whenever(fixture.sentryOptions.dateProvider.now()).thenReturn(SentryNanotimeDate(now.time, 0)) val envelope = SentryEnvelope.from(fixture.sentryOptions.serializer, createSession(), null) whenever(fixture.transportGate.isConnected).thenReturn(true) @@ -387,7 +387,7 @@ class AsyncHttpTransportTest { // given val now = Date(9001) fixture.sentryOptions.dateProvider = mock() - whenever(fixture.sentryOptions.dateProvider.now()).thenReturn(SentryNanotimeDate(now, 0)) + whenever(fixture.sentryOptions.dateProvider.now()).thenReturn(SentryNanotimeDate(now.time, 0)) val envelope = SentryEnvelope.from(fixture.sentryOptions.serializer, createSession(), null) whenever(fixture.transportGate.isConnected).thenReturn(true) From f944a75eb71cc82131a624d4fd91edeaa42bab7b Mon Sep 17 00:00:00 2001 From: runningcode <332597+runningcode@users.noreply.github.com> Date: Wed, 17 Jun 2026 13:53:20 +0000 Subject: [PATCH 210/391] release: 8.44.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0de5fc72452..4cf56d17cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.44.0 ### Features diff --git a/gradle.properties b/gradle.properties index 35641a00053..19127ac9832 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.43.2 +versionName=8.44.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 5dc86e8f233e15687c3a51ce4d05226196638f14 Mon Sep 17 00:00:00 2001 From: arb Date: Wed, 17 Jun 2026 17:05:40 +0200 Subject: [PATCH 211/391] chore(android-sqlite): Remove calls to deprecated SentryNanotimeDate constructor (#5562) --- .../java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt | 3 +-- .../sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt | 3 +-- .../java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt index 5099f38f691..f0998dfdc23 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt @@ -10,7 +10,6 @@ import io.sentry.SentryNanotimeDate import io.sentry.SentryStackTraceFactory import io.sentry.SpanDataConvention import io.sentry.SpanStatus -import java.util.Date private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite" @@ -18,7 +17,7 @@ private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite" * Sentinel for extracting a [SentryNanotimeDate]'s underlying [System.nanoTime] value via * [SentryDate.diff]. */ -private val EMPTY_NANO_TIME = SentryNanotimeDate(Date(0), 0L) +private val EMPTY_NANO_TIME = SentryNanotimeDate(0, 0L) /** Span instrumentation for [SentrySQLiteDriver]. */ internal class SQLiteSpanInstrumentation( diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt index 92a98b6e56d..13ae1389b77 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/ComputeNanoStartTimestampForChildTest.kt @@ -4,7 +4,6 @@ import io.sentry.DateUtils import io.sentry.ISpan import io.sentry.SentryLongDate import io.sentry.SentryNanotimeDate -import java.util.Date import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @@ -86,7 +85,7 @@ class ComputeNanoStartTimestampForChildTest { } private fun spanWithNanotimeStart(wallClockMillis: Long, parentMonotonicNanos: Long): ISpan { - val startDate = SentryNanotimeDate(Date(wallClockMillis), parentMonotonicNanos) + val startDate = SentryNanotimeDate(wallClockMillis, parentMonotonicNanos) val span = mock() whenever(span.startDate).thenReturn(startDate) return span diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt index a38be242ec5..74bd1c7f882 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt @@ -11,7 +11,6 @@ import io.sentry.SpanDataConvention import io.sentry.SpanStatus import io.sentry.TransactionContext import io.sentry.util.thread.IThreadChecker -import java.util.Date import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -51,7 +50,7 @@ class SQLiteSpanInstrumentationTest { // Only the parent date is queued. If startTimestamp() were to call dateProvider.now(), // the queue would underflow and the test would fail loudly — this is what verifies the // optimization is in effect. - val parentDate = SentryNanotimeDate(Date(1_000_000L), 100_000_000L) + val parentDate = SentryNanotimeDate(1_000_000L, 100_000_000L) val sut = setUpWithNanotimeDates(parentDate) val start = sut.startTimestamp() @@ -71,7 +70,7 @@ class SQLiteSpanInstrumentationTest { @Test fun `startTimestamp falls back to date provider when parent does not use SentryNanotimeDate`() { - val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L) + val providerDate = SentryNanotimeDate(2_000_000L, 200_000_000L) val parentSpan = mock() whenever(parentSpan.startDate).thenReturn(SentryLongDate(1_000_000_000_000_000L)) val options = @@ -89,7 +88,7 @@ class SQLiteSpanInstrumentationTest { @Test fun `startTimestamp falls back to date provider when no transaction is active`() { - val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L) + val providerDate = SentryNanotimeDate(2_000_000L, 200_000_000L) val options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" From 10a0bc2fdb190596413bf6d105438474c6663445 Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 18 Jun 2026 11:04:24 +0200 Subject: [PATCH 212/391] feat(android-sqlite): Make SentrySQLiteDriver experimental (JAVA-275) (#5563) Makes SentrySQLiteDriver public + experimental during development. In particular, lets us access the driver via the Sentry Android sample app. --- CHANGELOG.md | 8 ++++++++ sentry-android-sqlite/api/sentry-android-sqlite.api | 12 ++++++++++++ sentry-android-sqlite/build.gradle.kts | 5 +++++ .../main/java/io/sentry/sqlite/SentrySQLiteDriver.kt | 10 +++++++--- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cf56d17cee..8428f033b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +### Features + +- Add experimental `SentrySQLiteDriver` to `sentry-android-sqlite` for instrumenting `androidx.sqlite.SQLiteDriver` ([#5563](https://github.com/getsentry/sentry-java/pull/5563)) + - To use it, pass `SQLiteDriver` to `SentrySQLiteDriver.create(...)` + - Requires `androidx.sqlite:sqlite` (2.5.0+) on runtime classpath (typically provided by Room or SQLDelight) + ## 8.44.0 ### Features diff --git a/sentry-android-sqlite/api/sentry-android-sqlite.api b/sentry-android-sqlite/api/sentry-android-sqlite.api index c8780f1338d..7b9f633b46a 100644 --- a/sentry-android-sqlite/api/sentry-android-sqlite.api +++ b/sentry-android-sqlite/api/sentry-android-sqlite.api @@ -21,3 +21,15 @@ public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Compan public final fun create (Landroidx/sqlite/db/SupportSQLiteOpenHelper;)Landroidx/sqlite/db/SupportSQLiteOpenHelper; } +public final class io/sentry/sqlite/SentrySQLiteDriver : androidx/sqlite/SQLiteDriver { + public static final field Companion Lio/sentry/sqlite/SentrySQLiteDriver$Companion; + public synthetic fun (Landroidx/sqlite/SQLiteDriver;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public static final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver; + public fun hasConnectionPool ()Z + public fun open (Ljava/lang/String;)Landroidx/sqlite/SQLiteConnection; +} + +public final class io/sentry/sqlite/SentrySQLiteDriver$Companion { + public final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver; +} + diff --git a/sentry-android-sqlite/build.gradle.kts b/sentry-android-sqlite/build.gradle.kts index dd28252665e..6e0275b29b8 100644 --- a/sentry-android-sqlite/build.gradle.kts +++ b/sentry-android-sqlite/build.gradle.kts @@ -47,6 +47,10 @@ android { buildFeatures { buildConfig = true } + // Needed b/c Kotlin 1.4.x would otherwise pull in an older version without the annotations we + // want. + configurations.all { resolutionStrategy.force(libs.jetbrains.annotations.get()) } + androidComponents.beforeVariants { it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType) } @@ -65,6 +69,7 @@ dependencies { api(projects.sentry) compileOnly(libs.androidx.sqlite) + compileOnly(libs.jetbrains.annotations) implementation(kotlin(Config.kotlinStdLib, Config.kotlinStdLibVersionAndroid)) diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt index 9a619c418a5..e869778b811 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt @@ -5,6 +5,7 @@ import androidx.sqlite.SQLiteDriver import io.sentry.ScopesAdapter import io.sentry.SentryIntegrationPackageStorage import io.sentry.SentryLevel +import org.jetbrains.annotations.ApiStatus /** * Wraps a [SQLiteDriver] and automatically adds spans for each SQL statement it executes. @@ -28,13 +29,16 @@ import io.sentry.SentryLevel * * @param delegate The [SQLiteDriver] instance to delegate calls to. */ -internal class SentrySQLiteDriver private constructor(private val delegate: SQLiteDriver) : +@ApiStatus.Experimental +public class SentrySQLiteDriver private constructor(private val delegate: SQLiteDriver) : SQLiteDriver { init { SentryIntegrationPackageStorage.getInstance().addIntegration("SQLiteDriver") } + @Suppress("INAPPLICABLE_JVM_NAME") + @get:JvmName("hasConnectionPool") override val hasConnectionPool: Boolean get() = try { @@ -66,14 +70,14 @@ internal class SentrySQLiteDriver private constructor(private val delegate: SQLi } } - companion object { + public companion object { /** * Wraps the provided delegate in a [SentrySQLiteDriver]. Returns the delegate as-is if already * wrapped. */ @JvmStatic - fun create(delegate: SQLiteDriver): SQLiteDriver = + public fun create(delegate: SQLiteDriver): SQLiteDriver = delegate as? SentrySQLiteDriver ?: SentrySQLiteDriver(delegate) } } From f6192aacb057496dd89e4fdb72ed2741e50e03ee Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 18 Jun 2026 11:38:27 +0200 Subject: [PATCH 213/391] chore(android-sqlite): Add SQLite samples to sentry-samples-android (#5504) Adds our SQLite integrations to sentry-android-samples (`SentrySQLiteDriver` and `SentrySupportOpenSQLiteHelper`). The entry point is `SQLiteActivity`. Example SQL statements are identical across integrations so we can observe similarities / differences in how they handle spans. Users can exercise the integrations directly or via Room or SQLDelight. --- gradle/libs.versions.toml | 31 +- .../sentry-samples-android/README.md | 2 +- .../sentry-samples-android/build.gradle.kts | 42 +- .../src/main/AndroidManifest.xml | 8 + .../io/sentry/samples/android/MainActivity.kt | 14 + .../sentry/samples/android/MyApplication.java | 3 + .../samples/android/sqlite/DisplayInfo.kt | 106 +++ .../sentry/samples/android/sqlite/Room2Dao.kt | 42 ++ .../sentry/samples/android/sqlite/Room3Dao.kt | 42 ++ .../samples/android/sqlite/SQLiteActivity.kt | 621 ++++++++++++++++++ .../samples/android/sqlite/SampleDatabases.kt | 222 +++++++ .../io/sentry/samples/android/sqlite/Song.sq | 17 + .../samples/android/sqlite/SqlStatements.kt | 226 +++++++ .../samples/android/sqlite/UiLoadActivity.kt | 69 ++ .../samples/android/sqlite/UiLoadScreen.kt | 110 ++++ 15 files changed, 1542 insertions(+), 13 deletions(-) create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/DisplayInfo.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Room2Dao.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Room3Dao.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Song.sq create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c16a87ad9b6..91a7669194f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,15 +5,18 @@ androidxNavigation = "2.4.2" androidxTestCore = "1.7.0" androidxCompose = "1.6.3" asyncProfiler = "4.4" +camerax = "1.4.0" composeCompiler = "1.5.14" coroutines = "1.6.1" espresso = "3.7.0" feign = "11.6" +gummyBears = "0.12.0" jackson = "2.18.3" jetbrainsCompose = "1.6.11" kotlin = "2.2.0" kotlinSpring7 = "2.2.0" kotlin-compatible-version = "1.9" +ksp = "2.3.9" ktorClient = "3.0.0" logback = "1.2.9" log4j2 = "2.20.0" @@ -21,6 +24,7 @@ nopen = "1.0.1" # see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility # see https://developer.android.com/jetpack/androidx/releases/compose-kotlin okhttp = "4.9.2" +openfeature = "1.18.2" otel = "1.60.1" otelInstrumentation = "2.26.0" otelInstrumentationAlpha = "2.26.0-alpha" @@ -28,19 +32,22 @@ otelInstrumentationAlpha = "2.26.0-alpha" otelSemanticConventions = "1.40.0" otelSemanticConventionsAlpha = "1.40.0-alpha" retrofit = "2.9.0" +room2 = "2.8.4" +room3 = "3.0.0-alpha06" sagp = "6.10.0" +sqlite = "2.6.2" +sqliteAlpha = "2.7.0-alpha06" # Required by Room3 3.0.0-alpha* slf4j = "1.7.30" +spotless = "8.4.0" springboot2 = "2.7.18" springboot3 = "3.5.0" springboot4 = "4.0.0" +sqldelight = "2.3.2" + # Android targetSdk = "36" compileSdk = "36" minSdk = "21" -spotless = "8.4.0" -gummyBears = "0.12.0" -camerax = "1.4.0" -openfeature = "1.18.2" [plugins] kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } @@ -50,6 +57,7 @@ kotlin-jvm-spring7 = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinSpr kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } buildconfig = { id = "com.github.gmazzo.buildconfig", version = "5.6.5" } dokka = { id = "org.jetbrains.dokka", version = "2.0.0" } dokka-javadoc = { id = "org.jetbrains.dokka-javadoc", version = "2.0.0" } @@ -62,6 +70,7 @@ vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.3 springboot3 = { id = "org.springframework.boot", version.ref = "springboot3" } springboot4 = { id = "org.springframework.boot", version.ref = "springboot4" } spring-dependency-management = { id = "io.spring.dependency-management", version = "1.1.7" } +sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } gretty = { id = "org.gretty", version = "4.0.0" } animalsniffer = { id = "ru.vyarus.animalsniffer", version = "2.0.1" } sentry = { id = "io.sentry.android.gradle", version.ref = "sagp"} @@ -92,7 +101,14 @@ androidx-lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-commo androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "androidxLifecycle" } androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "androidxNavigation" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigation" } -androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.6.2" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room2" } +androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room2" } +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room2" } +androidx-room3-compiler = { module = "androidx.room3:room3-compiler", version.ref = "room3" } +androidx-room3-runtime = { module = "androidx.room3:room3-runtime", version.ref = "room3" } +androidx-sqlite = { module = "androidx.sqlite:sqlite", version.ref = "sqlite" } +androidx-sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqliteAlpha" } +androidx-sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqliteAlpha" } androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" } androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" } async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" } @@ -205,6 +221,7 @@ springboot4-starter-jdbc = { module = "org.springframework.boot:spring-boot-star springboot4-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot4" } springboot4-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot4" } springboot4-starter-kafka = { module = "org.springframework.boot:spring-boot-starter-kafka", version.ref = "springboot4" } +sqldelight-android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" } timber = { module = "com.jakewharton.timber:timber", version = "4.7.1" } # Animalsniffer signature @@ -248,3 +265,7 @@ msgpack = { module = "org.msgpack:msgpack-core", version = "0.9.8" } okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } okio = { module = "com.squareup.okio:okio", version = "1.13.0" } roboelectric = { module = "org.robolectric:robolectric", version = "4.15" } + +[bundles] +androidx-room2 = ["androidx-room-runtime", "androidx-room-ktx"] +androidx-sqlite-drivers = ["androidx-sqlite-bundled", "androidx-sqlite-framework"] diff --git a/sentry-samples/sentry-samples-android/README.md b/sentry-samples/sentry-samples-android/README.md index f5c8caf8685..99d0edcd1c3 100644 --- a/sentry-samples/sentry-samples-android/README.md +++ b/sentry-samples/sentry-samples-android/README.md @@ -1,7 +1,7 @@ # Sentry Sample Android App Sample application demonstrating how to use the Sentry Android SDK, including core functionality (error reporting, tracing, session replay, -profiling) and integrations (Compose, OkHttp, etc.). +profiling) and integrations (Compose, OkHttp, SQLite, etc.). ## How to run it? diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index e19c02700fb..74e3c3a57b8 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -9,7 +9,9 @@ plugins { id("com.android.application") alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) + alias(libs.plugins.ksp) alias(libs.plugins.sentry) apply false + alias(libs.plugins.sqldelight) } if (providers.gradleProperty("useSagp").isPresent) { @@ -26,9 +28,9 @@ plugins.withId("io.sentry.android.gradle") { tracingInstrumentation { features.set( setOf( + // FILE_IO is disabled for non-SAGP builds. InstrumentationFeature.COMPOSE, InstrumentationFeature.DATABASE, - InstrumentationFeature.FILE_IO, InstrumentationFeature.OKHTTP, ) ) @@ -44,7 +46,8 @@ android { defaultConfig { applicationId = "io.sentry.samples.android" - minSdk = libs.versions.minSdk.get().toInt() + // androidx.sqlite 2.6+ require minSdk 23; the Sentry SDK still supports 21. + minSdk = 23 targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 2 versionName = project.version.toString() @@ -119,7 +122,13 @@ android { } } - kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 } + // Java 11 b/c androidx.room3 requires it. + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 } androidComponents.beforeVariants { it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType) @@ -145,6 +154,17 @@ android { @Suppress("UnstableApiUsage") packagingOptions { jniLibs { useLegacyPackaging = true } } } +sqldelight { + databases { + create("SampleSQLDelightDatabase") { + packageName.set("io.sentry.samples.android.sqlite") + // Keep .sq files next to the hand-written Kotlin (src/main/java/.../sqlite) instead of the + // default src/main/sqldelight source root. + srcDirs("src/main/java") + } + } +} + dependencies { implementation( kotlin(Config.kotlinStdLib, org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION) @@ -152,6 +172,7 @@ dependencies { implementation(projects.sentryAndroid) implementation(projects.sentryAndroidFragment) + implementation(projects.sentryAndroidSqlite) implementation(projects.sentryAndroidTimber) implementation(projects.sentryCompose) implementation(projects.sentryKotlinExtensions) @@ -177,17 +198,24 @@ dependencies { implementation(libs.androidx.navigation.compose) implementation(libs.androidx.recyclerview) implementation(libs.androidx.browser) + implementation(libs.androidx.room3.runtime) + implementation(libs.bundles.androidx.room2) + implementation(libs.bundles.androidx.sqlite.drivers) + implementation(libs.camerax.camera2) + implementation(libs.camerax.core) + implementation(libs.camerax.lifecycle) + implementation(libs.camerax.view) implementation(libs.coil.compose) implementation(libs.kotlinx.coroutines.android) implementation(libs.lottie.compose) implementation(libs.retrofit) implementation(libs.retrofit.gson) implementation(libs.sentry.native.ndk) + implementation(libs.sqldelight.android.driver) implementation(libs.timber) - implementation(libs.camerax.core) - implementation(libs.camerax.camera2) - implementation(libs.camerax.lifecycle) - implementation(libs.camerax.view) + + ksp(libs.androidx.room.compiler) + ksp(libs.androidx.room3.compiler) debugImplementation(projects.sentryAndroidDistribution) debugImplementation(libs.leakcanary) diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 14c8b595fd3..1150dd5ef2e 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -101,6 +101,14 @@ android:name=".TriggerHttpRequestActivity" android:exported="false" /> + + + + ) + + @Query("SELECT * FROM song") suspend fun getAll(): List + + @Query("SELECT count(*) FROM song") suspend fun count(): Int + + /** + * No-op write (matches no rows) used at warm-up to open Room's writer connection up front. A read + * like [count] only opens a reader, so without this the first INSERT would (noisily) open and + * bootstrap the writer connection inside a demo transaction. + */ + @Query("DELETE FROM song WHERE id < 0") suspend fun primeWriter() +} + +@Database(entities = [SongEntity::class], version = 1, exportSchema = false) +abstract class SampleRoom2Database : RoomDatabase() { + + abstract fun songDao(): SongDao +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Room3Dao.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Room3Dao.kt new file mode 100644 index 00000000000..145e12d3897 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Room3Dao.kt @@ -0,0 +1,42 @@ +package io.sentry.samples.android.sqlite + +import androidx.room3.Dao +import androidx.room3.Database +import androidx.room3.Entity +import androidx.room3.Insert +import androidx.room3.PrimaryKey +import androidx.room3.Query +import androidx.room3.RoomDatabase + +@Entity(tableName = "song") +data class SongEntity3( + @PrimaryKey(autoGenerate = true) val id: Long = 0, + val title: String, + val artist: String, +) + +@Dao +interface SongDao3 { + + @Insert suspend fun insert(song: SongEntity3) + + /** Batch insert: Room runs all rows in a single transaction, reusing one compiled statement. */ + @Insert suspend fun insertAll(songs: List) + + @Query("SELECT * FROM song") suspend fun getAll(): List + + @Query("SELECT count(*) FROM song") suspend fun count(): Int + + /** + * No-op write (matches no rows) used at warm-up to open Room's writer connection up front. A read + * like [count] only opens a reader, so without this the first INSERT would (noisily) open and + * bootstrap the writer connection inside a demo transaction. + */ + @Query("DELETE FROM song WHERE id < 0") suspend fun primeWriter() +} + +@Database(entities = [SongEntity3::class], version = 1, exportSchema = false) +abstract class SampleRoom3Database : RoomDatabase() { + + abstract fun songDao(): SongDao3 +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt new file mode 100644 index 00000000000..1ff6828a757 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt @@ -0,0 +1,621 @@ +package io.sentry.samples.android.sqlite + +import android.os.Bundle +import android.widget.Toast +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.animation.core.Animatable +import androidx.compose.animation.core.keyframes +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.clickable +import androidx.compose.foundation.combinedClickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.OutlinedTextFieldDefaults +import androidx.compose.material3.PlainTooltip +import androidx.compose.material3.Surface +import androidx.compose.material3.Switch +import androidx.compose.material3.SwitchColors +import androidx.compose.material3.SwitchDefaults +import androidx.compose.material3.Text +import androidx.compose.material3.TooltipBox +import androidx.compose.material3.TooltipDefaults +import androidx.compose.material3.rememberTooltipState +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.scale +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.lerp +import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.lifecycle.lifecycleScope +import io.sentry.Sentry +import io.sentry.SpanId +import io.sentry.SpanStatus +import io.sentry.TransactionContext +import io.sentry.TransactionOptions +import io.sentry.protocol.SentryId +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +private val SentryPink = Color(0xFFC85B9C) +private val SentryPurple = Color(0xFF7B52FB) +private val SentryRed = Color(0xFFF55459) + +/** Intro text, surfaced via the "?" tooltip next to the "Run it" header. */ +private const val INSTRUCTIONS = + "Tap a button to execute a SQL statement in its own transaction; long press to run it in a ui.load transaction." + +/** Start state of the "SQL run" box. */ +private const val SQL_DETAIL_HINT = "Tap a button above to see the SQL it runs…" + +private val TOGGLE_SECTION_GAP = 24.dp + +private val CONTROL_SECTION_GAP = TOGGLE_SECTION_GAP * 2 + +private val SECTION_HEADER_HEIGHT = 28.dp + +/** Which sentry-android-sqlite integration the demo buttons currently target. */ +private enum class Integration(val color: Color, val apiName: String) { + DRIVER(SentryPurple, "SQLiteDriver"), + OPEN_HELPER(SentryPink, "SupportSQLiteOpenHelper"), +} + +/** + * How one demo button behaves for a given integration: which [SqlStatements] work it runs ([demo]), + * the name/op of the manual transaction a tap wraps it in, and the SQL summary shown in the detail + * panel ([displayInfo]). + */ +private class DemoVariant( + val demo: SqlDemo, + val transactionName: String, + val op: String, + val displayInfo: DisplayInfo, +) + +/** + * A single demo button in the list. [driver] / [openHelper] hold the variant for each integration; + * a null variant means the row doesn't apply to that integration and renders dimmed, explaining why + * on click (Room 3 is driver-only; SQLDelight is open-helper-only). + */ +private class DemoRow(val label: String, val driver: DemoVariant?, val openHelper: DemoVariant?) + +// The demo buttons, top to bottom, paired with each integration's variant. Pure data — the actual +// SQL lives in SqlStatements, dispatched by id. +private val DEMO_ROWS = + listOf( + DemoRow( + label = "Direct (no library)", + driver = + DemoVariant( + demo = SqlDemo.DRIVER_DIRECT, + transactionName = "SentrySQLiteDriver — Direct", + op = "db.sql.driver-direct", + displayInfo = DRIVER_DIRECT, + ), + openHelper = + DemoVariant( + demo = SqlDemo.OPENHELPER_DIRECT, + transactionName = "SentrySupportSQLiteOpenHelper — Direct", + op = "db.sql.openhelper-direct", + displayInfo = OPENHELPER_DIRECT, + ), + ), + DemoRow( + label = "Room 2", + driver = + DemoVariant( + demo = SqlDemo.DRIVER_ROOM2, + transactionName = "SentrySQLiteDriver — Room 2", + op = "db.sql.driver-room2", + displayInfo = DRIVER_ROOM2, + ), + openHelper = + DemoVariant( + demo = SqlDemo.OPENHELPER_ROOM, + transactionName = "SentrySupportSQLiteOpenHelper — Room", + op = "db.sql.openhelper-room", + displayInfo = OPENHELPER_ROOM, + ), + ), + DemoRow( + label = "Room 3", + driver = + DemoVariant( + demo = SqlDemo.DRIVER_ROOM3, + transactionName = "SentrySQLiteDriver — Room 3", + op = "db.sql.driver-room3", + displayInfo = DRIVER_ROOM3, + ), + openHelper = null, // Room 3 only runs on the SQLiteDriver path. + ), + DemoRow( + label = "SQLDelight", + driver = null, // SQLDelight's AndroidSqliteDriver is built on SupportSQLiteOpenHelper. + openHelper = + DemoVariant( + demo = SqlDemo.OPENHELPER_SQLDELIGHT, + transactionName = "SentrySupportSQLiteOpenHelper — SQLDelight", + op = "db.sql.openhelper-sqldelight", + displayInfo = OPENHELPER_SQLDELIGHT, + ), + ), + ) + +/** + * Activity that lets us exercise our two `sentry-android-sqlite` integrations + * ([SentrySQLiteDriver][io.sentry.sqlite.SentrySQLiteDriver] and + * [SentrySupportSQLiteOpenHelper][io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper]), both + * directly and via Room or SQLDelight. + * + * Example SQL statements are deliberately identical across integrations so we can identify + * similarities and differences in their transaction / span support. + */ +class SQLiteActivity : ComponentActivity() { + + private var latestResult by mutableStateOf("") + private var sqlDetail by mutableStateOf(SQL_DETAIL_HINT) + private var heavyWork by mutableStateOf(false) + + /** + * When enabled, every per-button transaction in one screen visit continues [screenTraceHeader], + * so they all share a trace ("session"-like). When disabled (the default), each tap is the root + * of its own trace, which renders as a standalone waterfall scaled to that one transaction — + * easier to read how time is allocated among its spans. + */ + private var shareScreenTrace by mutableStateOf(false) + + /** Which integration the demo buttons target. Switching it disables the rows that don't apply. */ + private var integration by mutableStateOf(Integration.DRIVER) + + /** Incremented on each tap that runs SQL. Used to retrigger the detail box's outline shimmer. */ + private var runTick by mutableStateOf(0) + + /** True while a demo or reset is running SQL on a background thread. */ + private var dbOperationInFlight by mutableStateOf(false) + + /** True for the duration of a reset; disables the reset button immediately (no debounce). */ + private var resetInProgress by mutableStateOf(false) + + /** + * The shared trace used when [shareScreenTrace] is enabled: one trace per visit to this screen. + * onResume() generates a fresh one each time the screen is (re)entered. + */ + private var screenTraceHeader = newScreenTrace() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + MaterialTheme { + Surface { + Column( + modifier = + Modifier.fillMaxWidth() + .statusBarsPadding() + .padding(16.dp) + .verticalScroll(rememberScrollState()), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + val screenHeightDp = LocalConfiguration.current.screenHeightDp + // A small gap below the screen title that grows with screen height and collapses to 0 + // on short screens, so the title isn't crowded against "Configure it" on tall devices. + val titleGap = + (((((screenHeightDp / 4) - 48) / 3).coerceAtLeast(0).dp + TOGGLE_SECTION_GAP) / 2 - + SECTION_HEADER_HEIGHT) + .coerceAtLeast(0.dp) + + // Pulse the "Under the hood" outline in the integration color whenever a tap runs SQL. + val shimmer = remember { Animatable(0f) } + LaunchedEffect(runTick) { + if (runTick == 0) return@LaunchedEffect + shimmer.animateTo( + targetValue = 0f, + animationSpec = + keyframes { + durationMillis = 900 + 0f at 0 + 1f at 200 + 0.4f at 450 + 1f at 650 + 0f at 900 + }, + ) + } + + val detailOutline = + lerp(MaterialTheme.colorScheme.outline, integration.color, shimmer.value) + + Text(text = "SQLite Instrumentation", style = MaterialTheme.typography.headlineSmall) + + Spacer(Modifier.height(titleGap)) + + SectionHeader("Configure it") + + val openHelper = integration == Integration.OPEN_HELPER + val integrationSwitchColors = + SwitchDefaults.colors( + checkedTrackColor = SentryPink, + checkedBorderColor = SentryPink, + uncheckedTrackColor = SentryPurple, + uncheckedBorderColor = SentryPurple, + uncheckedThumbColor = Color.White, + ) + val controlSwitchColors = + SwitchDefaults.colors( + checkedTrackColor = Color.Black, + checkedBorderColor = Color.Black, + ) + ToggleRow( + label = if (openHelper) "SentrySupportSQLiteOpenHelper" else "SentrySQLiteDriver", + checked = openHelper, + labelColor = if (openHelper) SentryPink else SentryPurple, + switchColors = integrationSwitchColors, + ) { + integration = if (it) Integration.OPEN_HELPER else Integration.DRIVER + // Switching integration starts a fresh comparison: clear the detail box and result. + sqlDetail = SQL_DETAIL_HINT + latestResult = "" + } + ToggleRow( + label = if (heavyWork) "Heavy app-level work" else "No app-level work", + checked = heavyWork, + switchColors = controlSwitchColors, + ) { + heavyWork = it + } + ToggleRow( + label = + if (shareScreenTrace) "Single trace for all button clicks" + else "Separate trace per button click", + checked = shareScreenTrace, + switchColors = controlSwitchColors, + ) { + shareScreenTrace = it + } + + SectionHeader("Run it", topPadding = CONTROL_SECTION_GAP) { HelpTooltip() } + + // One consolidated list of demo buttons. Each row dispatches to the selected + // integration's variant; a row that doesn't apply explains why via a toast (see + // [DemoRowButton]). + DEMO_ROWS.forEach { row -> + val variant = if (integration == Integration.DRIVER) row.driver else row.openHelper + DemoRowButton( + label = row.label, + color = integration.color, + variant = variant, + disabledReason = "${row.label} doesn't use the ${integration.apiName}", + ) + } + + ResetButton( + dbOperationInFlight = dbOperationInFlight, + resetInProgress = resetInProgress, + ) + + // Same [CONTROL_SECTION_GAP] above as the other sections, separating the controls from + // the detail output. + SectionHeader("Under the hood", topPadding = CONTROL_SECTION_GAP) + // The latest run result (row counts, errors). Hidden until the first run. + if (latestResult.isNotEmpty()) { + Text( + text = latestResult, + style = MaterialTheme.typography.bodyMedium, + color = if (latestResult.contains("failed")) SentryRed else Color.Unspecified, + ) + } + DetailField("SQL run", sqlDetail, borderColor = detailOutline) + } + } + } + } + } + + override fun onResume() { + super.onResume() + // Start a new trace each time the user (re)enters the screen, so each visit is its own session. + screenTraceHeader = newScreenTrace() + } + + /** Run the variant's SQL statement inside a manual, scope-bound transaction. */ + private fun onTap(variant: DemoVariant) { + if (dbOperationInFlight) return + + sqlDetail = if (heavyWork) variant.displayInfo.sqlHeavy else variant.displayInfo.sql + runTick++ // shimmer the detail box outline in the integration color + + lifecycleScope.launch { + dbOperationInFlight = true + try { + latestResult = + withContext(Dispatchers.IO) { + runInTransaction(variant.transactionName, variant.op) { + SqlStatements.execute(applicationContext, variant.demo, heavyWork) + } + } + } finally { + dbOperationInFlight = false + } + } + } + + /** + * Run the variant's SQL statement in [UiLoadActivity] with no manual transaction, so its auto + * `ui.load` transaction owns the spans. + */ + private fun onLongPress(variant: DemoVariant) { + if (dbOperationInFlight) return + + sqlDetail = if (heavyWork) variant.displayInfo.sqlHeavy else variant.displayInfo.sql + latestResult = "Opened the auto-load screen — its ui.load transaction owns the db spans." + startActivity(UiLoadActivity.intent(this, variant.demo, heavyWork)) + } + + /** + * A compact, left-justified labeled switch. [labelColor] defaults to [Color.Unspecified] so the + * label inherits the default text color; the integration toggle passes its pink/purple instead. + */ + @androidx.compose.runtime.Composable + private fun ToggleRow( + label: String, + checked: Boolean, + modifier: Modifier = Modifier, + labelColor: Color = Color.Unspecified, + switchColors: SwitchColors = SwitchDefaults.colors(), + onCheckedChange: (Boolean) -> Unit, + ) { + // Constrain the row height: a Switch otherwise reserves ~48dp, leaving a large gap between the + // toggles. 32dp keeps them about one line of text apart. + Row(modifier = modifier.height(32.dp), verticalAlignment = Alignment.CenterVertically) { + Switch( + checked = checked, + onCheckedChange = onCheckedChange, + colors = switchColors, + modifier = Modifier.scale(0.75f), + ) + Text( + label, + style = MaterialTheme.typography.bodySmall, + color = labelColor, + modifier = Modifier.padding(start = 4.dp), + ) + } + } + + @androidx.compose.runtime.Composable + private fun SectionHeader( + title: String, + topPadding: Dp = 8.dp, + trailing: (@androidx.compose.runtime.Composable () -> Unit)? = null, + ) { + Column(modifier = Modifier.fillMaxWidth().padding(top = topPadding)) { + Row(verticalAlignment = Alignment.CenterVertically) { + Text(text = title, style = MaterialTheme.typography.titleMedium) + trailing?.invoke() + } + HorizontalDivider(thickness = 1.dp, modifier = Modifier.padding(top = 4.dp)) + } + } + + /** + * A circled "?" next to the "Run it" header. Tapping it briefly shows the [INSTRUCTIONS] in a + * tooltip that auto-dismisses after a few seconds. + */ + @OptIn(ExperimentalMaterial3Api::class) + @androidx.compose.runtime.Composable + private fun HelpTooltip() { + val tooltipState = rememberTooltipState(isPersistent = true) + val scope = rememberCoroutineScope() + LaunchedEffect(tooltipState.isVisible) { + if (tooltipState.isVisible) { + delay(4000) + tooltipState.dismiss() + } + } + TooltipBox( + positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(), + tooltip = { PlainTooltip { Text(INSTRUCTIONS) } }, + state = tooltipState, + ) { + Icon( + imageVector = Icons.Outlined.HelpOutline, + contentDescription = "What do the buttons do?", + tint = Color.Gray, + modifier = + Modifier.padding(start = 8.dp).size(20.dp).clickable { + scope.launch { tooltipState.show() } + }, + ) + } + } + + /** + * A filled button that runs [variant] on tap (manual transaction) or long-press (ui.load). It's a + * [Surface] rather than a [Button] because Material3's Button has no long-press hook; the + * [combinedClickable] modifier gives us both. + * + * A null [variant] means the row doesn't apply to the selected integration: the button renders + * dimmed and, when clicked, explains why via a toast ([disabledReason]) instead of running. + */ + @OptIn(ExperimentalFoundationApi::class) + @androidx.compose.runtime.Composable + private fun DemoRowButton( + label: String, + color: Color, + variant: DemoVariant?, + disabledReason: String, + ) { + val context = LocalContext.current + val enabled = variant != null + val explain = { Toast.makeText(context, disabledReason, Toast.LENGTH_SHORT).show() } + + Surface( + modifier = Modifier.fillMaxWidth(), + shape = ButtonDefaults.shape, + color = if (enabled) color else color.copy(alpha = 0.26f), + contentColor = Color.White, + ) { + Box( + modifier = + Modifier.combinedClickable( + onClick = { if (variant != null) onTap(variant) else explain() }, + onLongClick = { if (variant != null) onLongPress(variant) else explain() }, + ) + .fillMaxWidth() + .heightIn(min = 44.dp) + .padding(horizontal = 16.dp, vertical = 10.dp), + contentAlignment = Alignment.Center, + ) { + Text(label, style = MaterialTheme.typography.labelLarge) + } + } + } + + @androidx.compose.runtime.Composable + private fun ResetButton(dbOperationInFlight: Boolean, resetInProgress: Boolean) { + // Debounce demo-driven disablement so fast taps don't flicker the button; reset disables + // immediately via [resetInProgress]. [dbOperationInFlight] still guards [onClick] either way. + var enabled by remember { mutableStateOf(true) } + LaunchedEffect(dbOperationInFlight, resetInProgress) { + when { + resetInProgress -> enabled = false + dbOperationInFlight -> { + delay(RESET_DISABLE_DEBOUNCE_MS) + enabled = false + } + else -> enabled = true + } + } + + Button( + modifier = Modifier.fillMaxWidth().padding(top = 8.dp), + enabled = enabled, + colors = ButtonDefaults.buttonColors(containerColor = Color.Gray, contentColor = Color.White), + onClick = { + if (dbOperationInFlight) return@Button + lifecycleScope.launch { + this@SQLiteActivity.resetInProgress = true + this@SQLiteActivity.dbOperationInFlight = true + try { + val message = withContext(Dispatchers.IO) { resetDatabases() } + latestResult = message + sqlDetail = "DROP: deletes every demo database file, resetting all row counts to 0." + } finally { + this@SQLiteActivity.dbOperationInFlight = false + this@SQLiteActivity.resetInProgress = false + } + } + }, + ) { + Text("Drop all tables (reset)") + } + } + + @androidx.compose.runtime.Composable + private fun DetailField(label: String, value: String, borderColor: Color) { + OutlinedTextField( + value = value, + onValueChange = {}, + readOnly = true, + label = { Text(label) }, + textStyle = TextStyle(fontFamily = FontFamily.Monospace, fontSize = 12.sp), + // The border color is driven by the shimmer animation so the box pulses on each SQL run. + colors = + OutlinedTextFieldDefaults.colors( + focusedBorderColor = borderColor, + unfocusedBorderColor = borderColor, + ), + modifier = Modifier.fillMaxWidth(), + ) + } + + /** + * Runs [block] inside a scope-bound transaction and returns the result. When [shareScreenTrace] + * is enabled, the transaction continues this screen's trace so all demos in one visit share a + * trace; otherwise it starts its own trace (1 transaction = 1 trace). + */ + private suspend fun runInTransaction( + transactionName: String, + op: String, + block: suspend () -> String, + ): String { + // Continuing the screen trace keeps the shared trace id but mints a fresh span id for this + // transaction; the standalone path (and the continueTrace fallback when tracing is disabled) + // gives the transaction its own trace. + val context = + if (shareScreenTrace) { + Sentry.continueTrace(screenTraceHeader, null)?.apply { + name = transactionName + operation = op + } ?: TransactionContext(transactionName, op) + } else { + TransactionContext(transactionName, op) + } + + val options = TransactionOptions().apply { isBindToScope = true } + val transaction = Sentry.startTransaction(context, options) + + return try { + val result = block() + transaction.status = SpanStatus.OK + result + } catch (t: Throwable) { + transaction.status = SpanStatus.INTERNAL_ERROR + "$transactionName failed: ${t.message}" + } finally { + transaction.finish() + } + } + + /** Closes + deletes every demo database file (via [SampleDatabases]), then re-warms them. */ + private suspend fun resetDatabases(): String { + val cleared = SampleDatabases.reset(applicationContext) + return "Dropped tables: cleared $cleared database file(s)." + } + + private companion object { + + /** Demo SQL shorter than this won't visibly disable the reset button. */ + private const val RESET_DISABLE_DEBOUNCE_MS = 300L + + /** + * Builds a fresh sentry-trace header ("--") representing this screen + * visit's trace. The trailing "-1" marks it sampled so the whole session is kept. + */ + private fun newScreenTrace(): String = "${SentryId()}-${SpanId()}-1" + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt new file mode 100644 index 00000000000..63f217fcfbb --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt @@ -0,0 +1,222 @@ +package io.sentry.samples.android.sqlite + +import android.content.Context +import androidx.room.Room +import androidx.room3.Room as Room3 +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.db.SupportSQLiteDatabase +import androidx.sqlite.db.SupportSQLiteOpenHelper +import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory +import androidx.sqlite.driver.bundled.BundledSQLiteDriver +import androidx.sqlite.execSQL +import app.cash.sqldelight.driver.android.AndroidSqliteDriver +import io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper +import io.sentry.samples.android.sqlite.SampleDatabases.driverDirectLock +import io.sentry.samples.android.sqlite.SampleDatabases.openHelperDirectLock +import io.sentry.samples.android.sqlite.SampleDatabases.reset +import io.sentry.samples.android.sqlite.SampleDatabases.warmUp +import io.sentry.sqlite.SentrySQLiteDriver +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock + +/** + * Process-lifetime holder for the demo databases used by [SQLiteActivity]. + * + * Real apps open a database once (commonly a DI singleton) and keep it open for the process, so a + * screen that touches the DB almost always finds it already "warm". We model that here: [warmUp] is + * called from `MyApplication` at launch, off the main thread, so the one-time open + Room + * connection-pool bootstrap happens with no active transaction — those `db.sql.query` spans have + * nothing to attach to and are dropped. Every screen afterward reuses the warm handle and records + * only its statements of interest. + * + * Handles are held for the whole process: Android has no reliable "app closed" callback, and the OS + * reclaims the connections on process death, so we never close them except via [reset] (the "Drop + * all tables" button), which closes, deletes the files, and re-warms. + * + * The two "direct" handles wrap a single raw connection that isn't safe for concurrent use, so + * callers serialize their whole unit of work via [driverDirectLock] / [openHelperDirectLock]. Room + * and SQLDelight manage their own connection pools and don't need one. + */ +object SampleDatabases { + + private val sqlAccess = Mutex() + + val driverDirectLock = Any() + val openHelperDirectLock = Any() + + /** Serializes demo SQL and [reset] so handles are never closed mid-statement. */ + suspend fun withSqlAccess(block: suspend () -> T): T = sqlAccess.withLock { block() } + + @Volatile private var driverConnection: SQLiteConnection? = null + @Volatile private var driverRoom2Db: SampleRoom2Database? = null + @Volatile private var driverRoom3Db: SampleRoom3Database? = null + @Volatile private var directHelper: SupportSQLiteOpenHelper? = null + @Volatile private var openHelperRoomDb: SampleRoom2Database? = null + @Volatile private var sqlDelightDriver: AndroidSqliteDriver? = null + + fun driverConnection(context: Context): SQLiteConnection = + synchronized(driverDirectLock) { + driverConnection + ?: SentrySQLiteDriver.create(BundledSQLiteDriver()) + .open(databaseFile(context, "driver_direct.db")) + .also { + it.execSQL(SqlStatements.CREATE_SONG) // one-time table setup, at open + driverConnection = it + } + } + + fun driverRoom2Db(context: Context): SampleRoom2Database = + synchronized(this) { + driverRoom2Db + ?: Room.databaseBuilder( + context.applicationContext, + SampleRoom2Database::class.java, + "driver_room2.db", + ) + .setDriver(SentrySQLiteDriver.create(BundledSQLiteDriver())) + .setQueryCoroutineContext(Dispatchers.IO) + .fallbackToDestructiveMigration(true) + .build() + .also { driverRoom2Db = it } + } + + fun driverRoom3Db(context: Context): SampleRoom3Database = + synchronized(this) { + driverRoom3Db + ?: Room3.databaseBuilder(context.applicationContext, "driver_room3.db") + .setDriver(SentrySQLiteDriver.create(BundledSQLiteDriver())) + .setQueryCoroutineContext(Dispatchers.IO) + .build() + .also { driverRoom3Db = it } + } + + fun directHelper(context: Context): SupportSQLiteOpenHelper = + synchronized(openHelperDirectLock) { + directHelper ?: buildDirectHelper(context).also { directHelper = it } + } + + fun openHelperRoomDb(context: Context): SampleRoom2Database = + synchronized(this) { + openHelperRoomDb + ?: Room.databaseBuilder( + context.applicationContext, + SampleRoom2Database::class.java, + "openhelper_room.db", + ) + .openHelperFactory { configuration -> + SentrySupportSQLiteOpenHelper.create( + FrameworkSQLiteOpenHelperFactory().create(configuration) + ) + } + .fallbackToDestructiveMigration(true) + .build() + .also { openHelperRoomDb = it } + } + + fun sqlDelightDriver(context: Context): AndroidSqliteDriver = + synchronized(this) { + sqlDelightDriver + ?: AndroidSqliteDriver( + schema = SampleSQLDelightDatabase.Schema, + context = context.applicationContext, + name = "openhelper_sqldelight.db", + factory = + SupportSQLiteOpenHelper.Factory { configuration -> + SentrySupportSQLiteOpenHelper.create( + FrameworkSQLiteOpenHelperFactory().create(configuration) + ) + }, + ) + .also { sqlDelightDriver = it } + } + + private fun buildDirectHelper(context: Context): SupportSQLiteOpenHelper { + val configuration = + SupportSQLiteOpenHelper.Configuration.builder(context.applicationContext) + .name("openhelper_direct.db") + .callback( + object : SupportSQLiteOpenHelper.Callback(1) { + override fun onCreate(db: SupportSQLiteDatabase) { + db.execSQL(SqlStatements.CREATE_SONG) + } + + override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) = + Unit + } + ) + .build() + return SentrySupportSQLiteOpenHelper.create( + FrameworkSQLiteOpenHelperFactory().create(configuration) + ) + } + + /** Opens every database on a background thread, forcing the one-time open + bootstrap to run. */ + fun warmUp(context: Context) { + val appContext = context.applicationContext + // Fire-and-forget: the warm-up outlives no particular screen, so a bare scope is fine here. + CoroutineScope(Dispatchers.IO).launch { + runCatching { driverConnection(appContext) } + // primeWriter() + count() opens both Room pool connections (writer + reader), so the first + // demo INSERT/SELECT reuses them instead of bootstrapping a connection inside its + // transaction. + runCatching { driverRoom2Db(appContext).songDao().also { it.primeWriter() }.count() } + runCatching { driverRoom3Db(appContext).songDao().also { it.primeWriter() }.count() } + runCatching { directHelper(appContext).writableDatabase } + runCatching { openHelperRoomDb(appContext).songDao().also { it.primeWriter() }.count() } + runCatching { + SampleSQLDelightDatabase(sqlDelightDriver(appContext)) + .songQueries + .countSongs() + .executeAsOne() + } + } + } + + /** + * Closes the open handles, deletes every demo database file, then re-warms. Returns the number of + * files cleared. Waits for any in-flight demo SQL (including [UiLoadActivity]) to finish first. + */ + suspend fun reset(context: Context): Int = withSqlAccess { + closeAll() + val appContext = context.applicationContext + val names = + listOf( + "driver_direct.db", + "driver_room2.db", + "driver_room3.db", + "openhelper_direct.db", + "openhelper_room.db", + "openhelper_sqldelight.db", + ) + val cleared = names.count { appContext.deleteDatabase(it) } + warmUp(appContext) + cleared + } + + private fun closeAll() { + synchronized(driverDirectLock) { + driverConnection?.close() + driverConnection = null + } + synchronized(openHelperDirectLock) { + directHelper?.close() + directHelper = null + } + synchronized(this) { + driverRoom2Db?.close() + driverRoom2Db = null + driverRoom3Db?.close() + driverRoom3Db = null + openHelperRoomDb?.close() + openHelperRoomDb = null + sqlDelightDriver?.close() + sqlDelightDriver = null + } + } + + private fun databaseFile(context: Context, name: String): String = + context.applicationContext.getDatabasePath(name).also { it.parentFile?.mkdirs() }.absolutePath +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Song.sq b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Song.sq new file mode 100644 index 00000000000..345e55a3582 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/Song.sq @@ -0,0 +1,17 @@ +CREATE TABLE song ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title TEXT NOT NULL, + artist TEXT NOT NULL +); + +insertSong: +INSERT INTO song(title, artist) +VALUES (?, ?); + +selectAll: +SELECT * +FROM song; + +countSongs: +SELECT count(*) +FROM song; diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt new file mode 100644 index 00000000000..543f1169294 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt @@ -0,0 +1,226 @@ +package io.sentry.samples.android.sqlite + +import android.content.Context +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.db.SupportSQLiteDatabase + +/** + * Rows inserted (and then consumed + processed) per demo when "heavy application-level work" is + * enabled. + */ +private const val HEAVY_ROW_COUNT = 50 + +/** + * Identifies a single SQLite demo: one of the two integrations crossed with the way it's used + * (raw/direct, Room, or SQLDelight). Used to dispatch the same SQL from both trace styles. + */ +enum class SqlDemo { + DRIVER_DIRECT, + DRIVER_ROOM2, + DRIVER_ROOM3, + OPENHELPER_DIRECT, + OPENHELPER_ROOM, + OPENHELPER_SQLDELIGHT, +} + +/** + * Executable SQL and demo runners for the SQLite sample screens. The human-readable "SQL run" + * summaries shown in the UI live in the per-demo [DisplayInfo] constants; keep those in lockstep + * with the statements here. + * + * The actual SQL each demo runs is kept separate from how its trace is created so the two screens + * can share it: + * - [SQLiteActivity]: Wraps [execute] in a manual `Sentry.startTransaction(…)`. + * - [UiLoadActivity]: Calls the same [execute] with no manual transaction, so the screen's auto + * `ui.load` transaction owns the resulting `db.sql.query` spans. + * + * All demos read the shared, already-warm handles from [SampleDatabases] and return a short status + * line. [heavy] mirrors the screen's "heavy app-level work" toggle. When enabled, each demo also + * batch inserts [HEAVY_ROW_COUNT] rows and consumes them with per-row [appWork]. + */ +object SqlStatements { + + const val CREATE_SONG = + "CREATE TABLE IF NOT EXISTS song(id INTEGER PRIMARY KEY, title TEXT, artist TEXT)" + const val INSERT_SONG = "INSERT INTO song(title, artist) VALUES (?, ?)" + const val SELECT_SONGS = "SELECT id, title, artist FROM song" + const val COUNT_SONGS = "SELECT count(*) FROM song" + + /** + * A single multi-row INSERT for [rowCount] songs, bound with [batchSongArgs]. One statement <> + * one round-trip, which is the realistic way to add a known batch of rows, rather than a loop of + * [rowCount] single-row inserts. + */ + fun insertSongsBatch(rowCount: Int): String = + "INSERT INTO song(title, artist) VALUES " + List(rowCount) { "(?, ?)" }.joinToString(", ") + + /** Flattened title/artist bind args for [insertSongsBatch]: "song 0", "artist 0", "song 1", … */ + fun batchSongArgs(rowCount: Int): Array = + Array(rowCount * 2) { i -> if (i % 2 == 0) "song ${i / 2}" else "artist ${i / 2}" } + + suspend fun execute(context: Context, demo: SqlDemo, heavy: Boolean): String = + SampleDatabases.withSqlAccess { + when (demo) { + SqlDemo.DRIVER_DIRECT -> driverDirect(context, heavy) + SqlDemo.DRIVER_ROOM2 -> driverWithRoom2(context, heavy) + SqlDemo.DRIVER_ROOM3 -> driverWithRoom3(context, heavy) + SqlDemo.OPENHELPER_DIRECT -> openHelperDirect(context, heavy) + SqlDemo.OPENHELPER_ROOM -> openHelperWithRoom(context, heavy) + SqlDemo.OPENHELPER_SQLDELIGHT -> openHelperWithSqlDelight(context, heavy) + } + } + + // --- 1. SentrySQLiteDriver, used directly ------------------------------------------------- + + private fun driverDirect(context: Context, heavy: Boolean): String = + synchronized(SampleDatabases.driverDirectLock) { + val connection = SampleDatabases.driverConnection(context) + insert(connection, "Mishima / Closing", "Philip Glass") + insert(connection, "School of Velocity, op 299 no 1, ", "Carl Czerny") + + if (heavy) { + // One multi-row INSERT for all HEAVY_ROWS rows, rather than a naive loop of single-row + // inserts. + connection.prepare(insertSongsBatch(HEAVY_ROW_COUNT)).use { statement -> + var param = 1 + repeat(HEAVY_ROW_COUNT) { row -> + statement.bindText(param++, "song $row") + statement.bindText(param++, "artist $row") + } + statement.step() + } + + connection.prepare(SELECT_SONGS).use { statement -> + while (statement.step()) { + // Consumption: pull each column across the JNI boundary into the ART heap. + val row = "${statement.getLong(0)}:${statement.getText(1)}:${statement.getText(2)}" + // Application work: e.g. per-row decryption. + appWork(row) + } + } + } + "Driver (Direct): ${count(connection)} rows." + } + + private fun insert(connection: SQLiteConnection, title: String, artist: String) { + connection.prepare(INSERT_SONG).use { statement -> + statement.bindText(1, title) + statement.bindText(2, artist) + statement.step() + } + } + + private fun count(connection: SQLiteConnection): Long = + connection.prepare(COUNT_SONGS).use { statement -> + if (statement.step()) statement.getLong(0) else 0 + } + + // --- 2. SentrySQLiteDriver, used through Room 2.7+ ---------------------------------------- + + private suspend fun driverWithRoom2(context: Context, heavy: Boolean): String = + roomDemo(SampleDatabases.driverRoom2Db(context).songDao(), "Driver (Room 2)", heavy) + + /** + * Shared Room 2 demo so the driver and open-helper paths run *identical* SQL. The only difference + * is how each integration instruments it: the driver spans every read, while the open helper's + * Room reads go via `moveToNext()` and emit no span, so only the INSERTs are spanned. + */ + private suspend fun roomDemo(dao: SongDao, label: String, heavy: Boolean): String { + dao.insert(SongEntity(title = "Spiders (Kidsmoke)", artist = "Wilco")) + if (heavy) { + // Batch insert: one insertAll() runs all rows in a single transaction, vs. a per-row loop. + dao.insertAll(List(HEAVY_ROW_COUNT) { SongEntity(title = "song $it", artist = "artist $it") }) + dao.getAll().forEach { appWork("${it.id}:${it.title}:${it.artist}") } + } + return "$label: ${dao.count()} rows." + } + + // --- 2b. SentrySQLiteDriver, used through Room 3.0+ (androidx.room3) ----------------------- + + private suspend fun driverWithRoom3(context: Context, heavy: Boolean): String { + val dao = SampleDatabases.driverRoom3Db(context).songDao() + dao.insert(SongEntity3(title = "What's Up", artist = "4 Non Blondes")) + if (heavy) { + // Batch insert: one insertAll() runs all rows in a single transaction, vs. a naive per-row + // loop. + dao.insertAll( + List(HEAVY_ROW_COUNT) { SongEntity3(title = "song $it", artist = "artist $it") } + ) + dao.getAll().forEach { appWork("${it.id}:${it.title}:${it.artist}") } + } + return "Driver (Room 3): ${dao.count()} rows." + } + + // --- 3. SentrySupportSQLiteOpenHelper, used directly -------------------------------------- + + private fun openHelperDirect(context: Context, heavy: Boolean): String = + synchronized(SampleDatabases.openHelperDirectLock) { + // Runs the *same* SQL as driverDirect(), so the only difference you see in the Sentry UI is + // how each integration instruments identical statements. + val db = SampleDatabases.directHelper(context).writableDatabase + db.execSQL(INSERT_SONG, arrayOf("Mishima / Closing", "Philip Glass")) + db.execSQL(INSERT_SONG, arrayOf("School of Velocity, op 299 no 1, ", "Carl Czerny")) + if (heavy) { + // One multi-row INSERT for all HEAVY_ROWS rows, rather than a naive loop of single-row + // inserts. + db.execSQL(insertSongsBatch(HEAVY_ROW_COUNT), batchSongArgs(HEAVY_ROW_COUNT)) + db.query(SELECT_SONGS).use { cursor -> + while (cursor.moveToNext()) { + // Consumption: read each column out of the cursor window. + val row = "${cursor.getLong(0)}:${cursor.getString(1)}:${cursor.getString(2)}" + // Application work: e.g. per-row decryption. + appWork(row) + } + } + } + "OpenHelper (Direct): ${querySongCount(db)} rows." + } + + /** + * Runs the shared `SELECT count(*)` through the open helper and returns the value, read the + * normal way: moveToFirst() + getInt(). These are delegated straight to the underlying cursor + * (the open helper only instruments getCount()/onMove()/fillWindow()), so this read produces no + * `db.sql.query` span — the same as a real app reading a scalar count. + */ + private fun querySongCount(db: SupportSQLiteDatabase): Int = + db.query(COUNT_SONGS).use { cursor -> + cursor.moveToFirst() + cursor.getInt(0) + } + + // --- 4. SentrySupportSQLiteOpenHelper, used through Room ---------------------------------- + + // Runs the same [roomDemo] SQL as the driver path; only the instrumentation differs. + private suspend fun openHelperWithRoom(context: Context, heavy: Boolean): String = + roomDemo(SampleDatabases.openHelperRoomDb(context).songDao(), "OpenHelper (Room)", heavy) + + // --- 5. SentrySupportSQLiteOpenHelper, used through SQLDelight ---------------------------- + + private fun openHelperWithSqlDelight(context: Context, heavy: Boolean): String { + val database = SampleSQLDelightDatabase(SampleDatabases.sqlDelightDriver(context)) + database.songQueries.insertSong("Nightcall", "Kavinsky") + if (heavy) { + // Wrap the batch in one transaction, vs. each insertSong() naively committing on its own. + database.transaction { + repeat(HEAVY_ROW_COUNT) { database.songQueries.insertSong("song $it", "artist $it") } + } + database.songQueries.selectAll().executeAsList().forEach { + appWork("${it.id}:${it.title}:${it.artist}") + } + } + // SQLDelight reads its cursor only via moveToNext(), which is delegated past the wrapper, so + // this count read produces no span. + val count = database.songQueries.countSongs().executeAsOne() + return "OpenHelper (SQLDelight): $count rows." + } + + /** + * Simulates per-row application-level work (e.g. decrypting a column) on consumed results. This + * is deliberately CPU-heavy and unrelated to the SQLite engine. + */ + private fun appWork(value: String) { + val digest = java.security.MessageDigest.getInstance("SHA-256") + var bytes = value.toByteArray() + repeat(500) { bytes = digest.digest(bytes) } + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt new file mode 100644 index 00000000000..b32811e8c91 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt @@ -0,0 +1,69 @@ +package io.sentry.samples.android.sqlite + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.lifecycle.lifecycleScope +import io.sentry.Sentry +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext + +/** + * Activity that lets us simulate SDK auto-generation of a `ui.load` transaction + attach SQLite + * statement spans to it. + * + * Timing note: the work runs off the main thread, so it finishes after the screen is first drawn. + * Time-to-full-display tracing (enabled in the manifest) keeps the `ui.load` transaction open until + * [Sentry.reportFullyDisplayed], which we call once the work completes — otherwise the transaction + * would auto-finish at first display and the late db spans would have nowhere to attach. + */ +class UiLoadActivity : ComponentActivity() { + + private var status by mutableStateOf("Running under the screen's auto ui.load transaction…") + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val id = + SqlDemo.entries.find { it.name == intent.getStringExtra(EXTRA_DEMO_ID) } + ?: run { + finish() + return + } + val heavy = intent.getBooleanExtra(EXTRA_HEAVY, false) + + setContent { UiLoadScreen(status = status, onClose = ::finish) } + + // No Sentry.startTransaction(): the work runs under the auto ui.load:UiLoadActivity span. + lifecycleScope.launch { + status = + try { + val result = + withContext(Dispatchers.IO) { SqlStatements.execute(applicationContext, id, heavy) } + "$result\n\nRan under the auto ui.load transaction." + } catch (t: Throwable) { + "Load failed: ${t.message}" + } finally { + // Close the TTFD window so the ui.load transaction finishes with the db spans attached. + Sentry.reportFullyDisplayed() + } + } + } + + companion object { + private const val EXTRA_DEMO_ID = "demo_id" + private const val EXTRA_HEAVY = "heavy" + + /** Builds the intent that runs [id] (honoring the [heavy] toggle) on this UiLoadScreen. */ + fun intent(context: Context, id: SqlDemo, heavy: Boolean): Intent = + Intent(context, UiLoadActivity::class.java) + .putExtra(EXTRA_DEMO_ID, id.name) + .putExtra(EXTRA_HEAVY, heavy) + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt new file mode 100644 index 00000000000..6495726448d --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt @@ -0,0 +1,110 @@ +package io.sentry.samples.android.sqlite + +import androidx.compose.animation.core.Animatable +import androidx.compose.animation.core.LinearEasing +import androidx.compose.animation.core.tween +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.offset +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.statusBarsPadding +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.drawWithContent +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.BlendMode +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.CompositingStrategy +import androidx.compose.ui.graphics.graphicsLayer +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import io.sentry.samples.android.R + +private val ShimmerHighlight = Color(0xFFBDBDBD) + +@Composable +fun UiLoadScreen(status: String, onClose: () -> Unit) { + MaterialTheme { + Surface { + Box( + modifier = Modifier.fillMaxSize().statusBarsPadding().navigationBarsPadding().padding(24.dp) + ) { + Column( + modifier = Modifier.align(Alignment.Center).fillMaxWidth().offset(y = (-48).dp), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + ShimmerSentryGlyph(modifier = Modifier.size(96.dp)) + Spacer(modifier = Modifier.height(24.dp)) + Text( + text = status, + style = MaterialTheme.typography.bodyLarge, + textAlign = TextAlign.Center, + ) + } + + Button( + onClick = onClose, + modifier = Modifier.align(Alignment.BottomCenter).fillMaxWidth(), + colors = + ButtonDefaults.buttonColors(containerColor = Color.Black, contentColor = Color.White), + ) { + Text("Close") + } + } + } + } +} + +@Composable +private fun ShimmerSentryGlyph(modifier: Modifier = Modifier) { + val progress = remember { Animatable(0f) } + LaunchedEffect(Unit) { + progress.animateTo( + targetValue = 1f, + animationSpec = tween(durationMillis = 700, delayMillis = 250, easing = LinearEasing), + ) + } + + Image( + painter = painterResource(R.drawable.sentry_glyph), + contentDescription = "Sentry", + modifier = + modifier + .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } + .drawWithContent { + drawContent() + val p = progress.value + val band = size.width * 0.5f + // Sweep the highlight band diagonally from off the bottom-left corner (p=0) to off the + // top-right corner (p=1): x travels left→right, y travels bottom→top. + val x = -band + (size.width + 2f * band) * p + val y = (size.height + band) - (size.height + 2f * band) * p + drawRect( + brush = + Brush.linearGradient( + colors = listOf(Color.Black, ShimmerHighlight, Color.Black), + start = Offset(x, y), + end = Offset(x + band, y - band), + ), + blendMode = BlendMode.SrcAtop, + ) + }, + ) +} From 7c1a728e8bd2faa42b8f1c25c9f16a145baab60f Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 18 Jun 2026 12:38:54 +0200 Subject: [PATCH 214/391] chore(android-sqlite): Skip wrapping SupportSQLiteDriver bridge to avoid duplicate spans (#5514) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SentrySQLiteDriver.create() now recognizes the Room 2.7+ androidx.sqlite.driver.SupportSQLiteDriver bridge adapter and returns it unwrapped. That lets us protect against the one known vector where using both SentrySQLiteDriver and SentrySupportSQLiteOpenHelper with the same db table is allowed under either the Room or SQLDelight APIs: ```kotlin // AVOID — this configuration produces duplicate spans for every SQL statement. // Step 1: Developer wraps their open helper with Sentry, either manually or // via the Sentry Android Gradle Plugin. val sentryWrappedHelper: SupportSQLiteOpenHelper = SentrySupportSQLiteOpenHelper.create( FrameworkSQLiteOpenHelperFactory().create(configuration) ) // Step 2: Developer builds the compat driver around that wrapped helper. val driver: SQLiteDriver = SupportSQLiteDriver(sentryWrappedHelper) // Step 3: Developer (wrongly!) wraps the driver with Sentry as well. All // spans will now be duplicated. val sentryWrappedDriver: SQLiteDriver = SentrySQLiteDriver.create(driver) Room.databaseBuilder(context, MyDb::class.java, "mydb") .setDriver(sentryWrappedDriver) .build() ``` This commit lets us avoid step 3 by no-op'ing if a developer tries to pass a SupportSQLiteDriver to SentrySQLiteDriver.create(). --- sentry-android-sqlite/proguard-rules.pro | 4 + .../io/sentry/sqlite/SentrySQLiteDriver.kt | 32 ++- .../sqlite/driver/SupportSQLiteDriver.kt | 18 ++ .../sentry/sqlite/SentrySQLiteDriverTest.kt | 11 ++ .../samples/android/sqlite/DisplayInfo.kt | 5 + .../samples/android/sqlite/SQLiteActivity.kt | 183 ++++++++++++++---- .../samples/android/sqlite/SampleDatabases.kt | 181 +++++++++++++++-- .../samples/android/sqlite/SqlStatements.kt | 35 ++++ .../samples/android/sqlite/UiLoadActivity.kt | 5 +- 9 files changed, 412 insertions(+), 62 deletions(-) create mode 100644 sentry-android-sqlite/src/test/java/androidx/sqlite/driver/SupportSQLiteDriver.kt diff --git a/sentry-android-sqlite/proguard-rules.pro b/sentry-android-sqlite/proguard-rules.pro index 02ab589d3bd..13fa4bf9dea 100644 --- a/sentry-android-sqlite/proguard-rules.pro +++ b/sentry-android-sqlite/proguard-rules.pro @@ -4,4 +4,8 @@ # https://developer.android.com/studio/build/shrink-code#decode-stack-trace -keepattributes LineNumberTable,SourceFile +# SentrySQLiteDriver.create() uses a runtime class-name check to skip wrapping the Room 2.7+ +# SupportSQLiteDriver bridge adapter and avoid duplicate spans. +-keepnames class androidx.sqlite.driver.SupportSQLiteDriver + ##---------------End: proguard configuration for SQLite ---------- diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt index e869778b811..f0f41782c22 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt @@ -22,11 +22,6 @@ import org.jetbrains.annotations.ApiStatus * .build() * ``` * - * **Warning:** Do not use [SentrySQLiteDriver] together with - * [SentrySupportSQLiteOpenHelper][io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper] on the - * same database file. Both wrappers instrument at different layers and combining them will produce - * duplicate spans. - * * @param delegate The [SQLiteDriver] instance to delegate calls to. */ @ApiStatus.Experimental @@ -73,11 +68,32 @@ public class SentrySQLiteDriver private constructor(private val delegate: SQLite public companion object { /** - * Wraps the provided delegate in a [SentrySQLiteDriver]. Returns the delegate as-is if already - * wrapped. + * Name of the bridge adapter often used with Room 2.7+. It implements the `SQLiteDriver` + * interface and its constructor consumes a `SupportSQLiteOpenHelper`. (Users of the Sentry + * Android Gradle Plugin will have the `SupportSQLiteOpenHelper` wrapped for them + * automatically.) We deliberately avoid wrapping the adapter to prevent duplicate spans. + * + * String (rather than an `is` check) lets us avoid a compile-time dependency on + * androidx.sqlite:sqlite-framework. + */ + private const val SUPPORT_SQLITE_DRIVER_FQN = "androidx.sqlite.driver.SupportSQLiteDriver" + + /** + * Wraps the provided delegate in a [SentrySQLiteDriver]. + * + * To avoid duplicate spans, returns the delegate as-is if: + * 1. it's already wrapped, or + * 2. it's an `androidx.sqlite.driver.SupportSQLiteDriver`. + * + * In the case of (2), wrap the open helper passed to the `SupportSQLiteDriver` constructor via + * `SentrySupportSQLiteOpenHelper` instead. */ @JvmStatic public fun create(delegate: SQLiteDriver): SQLiteDriver = - delegate as? SentrySQLiteDriver ?: SentrySQLiteDriver(delegate) + if (delegate is SentrySQLiteDriver || delegate.javaClass.name == SUPPORT_SQLITE_DRIVER_FQN) { + delegate + } else { + SentrySQLiteDriver(delegate) + } } } diff --git a/sentry-android-sqlite/src/test/java/androidx/sqlite/driver/SupportSQLiteDriver.kt b/sentry-android-sqlite/src/test/java/androidx/sqlite/driver/SupportSQLiteDriver.kt new file mode 100644 index 00000000000..2de7f1d38f5 --- /dev/null +++ b/sentry-android-sqlite/src/test/java/androidx/sqlite/driver/SupportSQLiteDriver.kt @@ -0,0 +1,18 @@ +package androidx.sqlite.driver + +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteDriver + +/** + * Minimal stub of `androidx.sqlite.driver.SupportSQLiteDriver` (which lives in + * `androidx.sqlite:sqlite-framework`, not on this module's compile/test classpath) for verifying + * behavior of `SentrySQLiteDriver.create(SupportSQLiteDriver)`. + */ +internal class SupportSQLiteDriver : SQLiteDriver { + + override val hasConnectionPool: Boolean = false + + override fun open(fileName: String): SQLiteConnection { + throw UnsupportedOperationException("Test stub; not for runtime use") + } +} diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt index 9b2345a975f..5816f3d859c 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteDriverTest.kt @@ -3,6 +3,7 @@ package io.sentry.sqlite import androidx.sqlite.SQLiteConnection import androidx.sqlite.SQLiteDriver import androidx.sqlite.SQLiteStatement +import androidx.sqlite.driver.SupportSQLiteDriver import io.sentry.IScopes import io.sentry.Sentry import io.sentry.SentryIntegrationPackageStorage @@ -64,6 +65,16 @@ class SentrySQLiteDriverTest { assertSame(wrapped, doubleWrapped) } + @Test + fun `create with SupportSQLiteDriver bridge returns same instance without wrapping`() { + val bridge = SupportSQLiteDriver() + + val result = SentrySQLiteDriver.create(bridge) + + assertSame(bridge, result) + assertFalse(result is SentrySQLiteDriver) + } + @Test fun `hasConnectionPool forwards delegate value when supported`() { whenever(fixture.mockDriver.hasConnectionPool).thenReturn(true) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/DisplayInfo.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/DisplayInfo.kt index 14582fe305e..fd80a5aae1e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/DisplayInfo.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/DisplayInfo.kt @@ -87,6 +87,11 @@ internal val OPENHELPER_ROOM = .trimIndent(), ) +// Bridge demos run the same SQL as the driver paths; spans come from the open-helper layer. +internal val BRIDGE_DIRECT = DRIVER_DIRECT + +internal val BRIDGE_ROOM2 = DRIVER_ROOM2 + internal val OPENHELPER_SQLDELIGHT = DisplayInfo( sql = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt index 1ff6828a757..9a27ecda353 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt @@ -1,6 +1,7 @@ package io.sentry.samples.android.sqlite import android.os.Bundle +import android.util.Log import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent @@ -33,6 +34,9 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.PlainTooltip +import androidx.compose.material3.SegmentedButton +import androidx.compose.material3.SegmentedButtonDefaults +import androidx.compose.material3.SingleChoiceSegmentedButtonRow import androidx.compose.material3.Surface import androidx.compose.material3.Switch import androidx.compose.material3.SwitchColors @@ -73,6 +77,7 @@ import kotlinx.coroutines.withContext private val SentryPink = Color(0xFFC85B9C) private val SentryPurple = Color(0xFF7B52FB) +private val SentryOrange = Color(0xFFE8743F) private val SentryRed = Color(0xFFF55459) /** Intro text, surfaced via the "?" tooltip next to the "Run it" header. */ @@ -88,10 +93,33 @@ private val CONTROL_SECTION_GAP = TOGGLE_SECTION_GAP * 2 private val SECTION_HEADER_HEIGHT = 28.dp -/** Which sentry-android-sqlite integration the demo buttons currently target. */ -private enum class Integration(val color: Color, val apiName: String) { - DRIVER(SentryPurple, "SQLiteDriver"), - OPEN_HELPER(SentryPink, "SupportSQLiteOpenHelper"), +/** Which sentry-android-sqlite integration the demo currently targets. */ +private enum class IntegrationMode( + val color: Color, + val segmentLabel: String, + val apiName: String, + val subtitle: String, +) { + DRIVER( + SentryPurple, + "SQLiteDriver", + "SQLiteDriver", + "SentrySQLiteDriver.create(BundledSQLiteDriver)", + ), + OPEN_HELPER( + SentryPink, + "OpenHelper", + "SupportSQLiteOpenHelper", + "SentrySupportSQLiteOpenHelper.create(...)", + ), + // Not directly-supported, but lets us verify behavior when both the DRIVER and OPEN_HELPER + // integrations are used together via the SupportSQLiteDriver bridge. + BRIDGE( + SentryOrange, + "Bridge", + "SupportSQLiteDriver bridge", + "SentrySQLiteDriver.create(SupportSQLiteDriver(Sentry helper))", + ), } /** @@ -107,11 +135,24 @@ private class DemoVariant( ) /** - * A single demo button in the list. [driver] / [openHelper] hold the variant for each integration; - * a null variant means the row doesn't apply to that integration and renders dimmed, explaining why - * on click (Room 3 is driver-only; SQLDelight is open-helper-only). + * A single demo button in the list. [driver] / [openHelper] / [bridge] hold the variant for each + * integration; a null variant means the row doesn't apply and renders dimmed (e.g., Room 3 is + * driver-only; SQLDelight is open-helper-only; etc.). */ -private class DemoRow(val label: String, val driver: DemoVariant?, val openHelper: DemoVariant?) +private class DemoRow( + val label: String, + val driver: DemoVariant?, + val openHelper: DemoVariant?, + val bridge: DemoVariant?, +) { + + fun variantFor(mode: IntegrationMode): DemoVariant? = + when (mode) { + IntegrationMode.DRIVER -> driver + IntegrationMode.OPEN_HELPER -> openHelper + IntegrationMode.BRIDGE -> bridge + } +} // The demo buttons, top to bottom, paired with each integration's variant. Pure data — the actual // SQL lives in SqlStatements, dispatched by id. @@ -133,6 +174,13 @@ private val DEMO_ROWS = op = "db.sql.openhelper-direct", displayInfo = OPENHELPER_DIRECT, ), + bridge = + DemoVariant( + demo = SqlDemo.BRIDGE_DIRECT, + transactionName = "Bridge stack — Direct", + op = "db.sql.bridge-direct", + displayInfo = BRIDGE_DIRECT, + ), ), DemoRow( label = "Room 2", @@ -150,6 +198,13 @@ private val DEMO_ROWS = op = "db.sql.openhelper-room", displayInfo = OPENHELPER_ROOM, ), + bridge = + DemoVariant( + demo = SqlDemo.BRIDGE_ROOM2, + transactionName = "Bridge stack — Room 2", + op = "db.sql.bridge-room2", + displayInfo = BRIDGE_ROOM2, + ), ), DemoRow( label = "Room 3", @@ -161,6 +216,7 @@ private val DEMO_ROWS = displayInfo = DRIVER_ROOM3, ), openHelper = null, // Room 3 only runs on the SQLiteDriver path. + bridge = null, ), DemoRow( label = "SQLDelight", @@ -172,6 +228,7 @@ private val DEMO_ROWS = op = "db.sql.openhelper-sqldelight", displayInfo = OPENHELPER_SQLDELIGHT, ), + bridge = null, ), ) @@ -187,6 +244,7 @@ private val DEMO_ROWS = class SQLiteActivity : ComponentActivity() { private var latestResult by mutableStateOf("") + private var warmUpErrors by mutableStateOf("") private var sqlDetail by mutableStateOf(SQL_DETAIL_HINT) private var heavyWork by mutableStateOf(false) @@ -198,8 +256,8 @@ class SQLiteActivity : ComponentActivity() { */ private var shareScreenTrace by mutableStateOf(false) - /** Which integration the demo buttons target. Switching it disables the rows that don't apply. */ - private var integration by mutableStateOf(Integration.DRIVER) + /** Which integration is currently being demoed. Switching it disables rows that don't apply. */ + private var integration by mutableStateOf(IntegrationMode.DRIVER) /** Incremented on each tap that runs SQL. Used to retrigger the detail box's outline shimmer. */ private var runTick by mutableStateOf(0) @@ -265,31 +323,19 @@ class SQLiteActivity : ComponentActivity() { SectionHeader("Configure it") - val openHelper = integration == Integration.OPEN_HELPER - val integrationSwitchColors = - SwitchDefaults.colors( - checkedTrackColor = SentryPink, - checkedBorderColor = SentryPink, - uncheckedTrackColor = SentryPurple, - uncheckedBorderColor = SentryPurple, - uncheckedThumbColor = Color.White, - ) val controlSwitchColors = SwitchDefaults.colors( checkedTrackColor = Color.Black, checkedBorderColor = Color.Black, ) - ToggleRow( - label = if (openHelper) "SentrySupportSQLiteOpenHelper" else "SentrySQLiteDriver", - checked = openHelper, - labelColor = if (openHelper) SentryPink else SentryPurple, - switchColors = integrationSwitchColors, - ) { - integration = if (it) Integration.OPEN_HELPER else Integration.DRIVER - // Switching integration starts a fresh comparison: clear the detail box and result. - sqlDetail = SQL_DETAIL_HINT - latestResult = "" - } + IntegrationModeSelector( + selected = integration, + onSelected = { + integration = it + sqlDetail = SQL_DETAIL_HINT + latestResult = "" + }, + ) ToggleRow( label = if (heavyWork) "Heavy app-level work" else "No app-level work", checked = heavyWork, @@ -313,12 +359,12 @@ class SQLiteActivity : ComponentActivity() { // integration's variant; a row that doesn't apply explains why via a toast (see // [DemoRowButton]). DEMO_ROWS.forEach { row -> - val variant = if (integration == Integration.DRIVER) row.driver else row.openHelper + val variant = row.variantFor(integration) DemoRowButton( label = row.label, color = integration.color, variant = variant, - disabledReason = "${row.label} doesn't use the ${integration.apiName}", + disabledReason = "${row.label} doesn't support the ${integration.apiName} stack", ) } @@ -330,12 +376,26 @@ class SQLiteActivity : ComponentActivity() { // Same [CONTROL_SECTION_GAP] above as the other sections, separating the controls from // the detail output. SectionHeader("Under the hood", topPadding = CONTROL_SECTION_GAP) + LaunchedEffect(Unit) { + while (!SampleDatabases.isWarmUpComplete()) { + warmUpErrors = SampleDatabases.warmUpErrors + delay(250) + } + warmUpErrors = SampleDatabases.warmUpErrors + } + if (warmUpErrors.isNotEmpty()) { + Text( + text = warmUpErrors, + style = MaterialTheme.typography.bodyMedium, + color = SentryRed, + ) + } // The latest run result (row counts, errors). Hidden until the first run. if (latestResult.isNotEmpty()) { Text( text = latestResult, style = MaterialTheme.typography.bodyMedium, - color = if (latestResult.contains("failed")) SentryRed else Color.Unspecified, + color = if (latestResult.looksLikeError()) SentryRed else Color.Unspecified, ) } DetailField("SQL run", sqlDetail, borderColor = detailOutline) @@ -361,12 +421,13 @@ class SQLiteActivity : ComponentActivity() { lifecycleScope.launch { dbOperationInFlight = true try { - latestResult = + val result = withContext(Dispatchers.IO) { runInTransaction(variant.transactionName, variant.op) { SqlStatements.execute(applicationContext, variant.demo, heavyWork) } } + latestResult = result } finally { dbOperationInFlight = false } @@ -385,9 +446,41 @@ class SQLiteActivity : ComponentActivity() { startActivity(UiLoadActivity.intent(this, variant.demo, heavyWork)) } + @OptIn(ExperimentalMaterial3Api::class) + @androidx.compose.runtime.Composable + private fun IntegrationModeSelector( + selected: IntegrationMode, + onSelected: (IntegrationMode) -> Unit, + ) { + SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) { + IntegrationMode.entries.forEachIndexed { index, mode -> + SegmentedButton( + shape = + SegmentedButtonDefaults.itemShape(index = index, count = IntegrationMode.entries.size), + onClick = { onSelected(mode) }, + selected = selected == mode, + icon = {}, + colors = + SegmentedButtonDefaults.colors( + activeContainerColor = mode.color, + activeContentColor = Color.White, + ), + label = { Text(mode.segmentLabel, style = MaterialTheme.typography.labelSmall) }, + ) + } + } + + Text( + text = selected.subtitle, + style = MaterialTheme.typography.bodySmall, + color = Color.Gray, + modifier = Modifier.padding(top = 6.dp), + ) + } + /** * A compact, left-justified labeled switch. [labelColor] defaults to [Color.Unspecified] so the - * label inherits the default text color; the integration toggle passes its pink/purple instead. + * label inherits the default text color. */ @androidx.compose.runtime.Composable private fun ToggleRow( @@ -533,7 +626,11 @@ class SQLiteActivity : ComponentActivity() { try { val message = withContext(Dispatchers.IO) { resetDatabases() } latestResult = message + warmUpErrors = SampleDatabases.warmUpErrors sqlDetail = "DROP: deletes every demo database file, resetting all row counts to 0." + } catch (t: Throwable) { + Log.e(TAG, "Reset failed", t) + latestResult = "Reset failed: ${t.message ?: t.javaClass.simpleName}" } finally { this@SQLiteActivity.dbOperationInFlight = false this@SQLiteActivity.resetInProgress = false @@ -595,7 +692,8 @@ class SQLiteActivity : ComponentActivity() { result } catch (t: Throwable) { transaction.status = SpanStatus.INTERNAL_ERROR - "$transactionName failed: ${t.message}" + Log.e(TAG, "$transactionName failed", t) + "$transactionName failed: ${t.message ?: t.javaClass.simpleName}" } finally { transaction.finish() } @@ -604,11 +702,20 @@ class SQLiteActivity : ComponentActivity() { /** Closes + deletes every demo database file (via [SampleDatabases]), then re-warms them. */ private suspend fun resetDatabases(): String { val cleared = SampleDatabases.reset(applicationContext) - return "Dropped tables: cleared $cleared database file(s)." + SampleDatabases.awaitWarmUp() + return buildString { + append("Dropped tables: cleared $cleared database file(s).") + if (SampleDatabases.warmUpErrors.isNotEmpty()) { + append("\n\n") + append(SampleDatabases.warmUpErrors) + } + } } private companion object { + private const val TAG = "SQLiteActivity" + /** Demo SQL shorter than this won't visibly disable the reset button. */ private const val RESET_DISABLE_DEBOUNCE_MS = 300L @@ -619,3 +726,5 @@ class SQLiteActivity : ComponentActivity() { private fun newScreenTrace(): String = "${SentryId()}-${SpanId()}-1" } } + +private fun String.looksLikeError(): Boolean = contains("failed", ignoreCase = true) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt index 63f217fcfbb..19b292cd91e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt @@ -1,12 +1,14 @@ package io.sentry.samples.android.sqlite import android.content.Context +import android.util.Log import androidx.room.Room import androidx.room3.Room as Room3 import androidx.sqlite.SQLiteConnection import androidx.sqlite.db.SupportSQLiteDatabase import androidx.sqlite.db.SupportSQLiteOpenHelper import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory +import androidx.sqlite.driver.SupportSQLiteDriver import androidx.sqlite.driver.bundled.BundledSQLiteDriver import androidx.sqlite.execSQL import app.cash.sqldelight.driver.android.AndroidSqliteDriver @@ -18,6 +20,7 @@ import io.sentry.samples.android.sqlite.SampleDatabases.warmUp import io.sentry.sqlite.SentrySQLiteDriver import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock @@ -42,18 +45,40 @@ import kotlinx.coroutines.sync.withLock */ object SampleDatabases { + private const val TAG = "SampleDatabases" + + /** Non-empty when one or more warm-up steps failed; shown on [SQLiteActivity]. */ + @Volatile + var warmUpErrors: String = "" + private set + + @Volatile private var warmUpComplete = false + @Volatile private var warmUpGeneration = 0 + @Volatile private var warmUpJob: Job? = null + + fun isWarmUpComplete(): Boolean = warmUpComplete + + /** Blocks until the in-flight [warmUp] job (if any) finishes. */ + suspend fun awaitWarmUp() { + warmUpJob?.join() + } + private val sqlAccess = Mutex() val driverDirectLock = Any() + val bridgeDirectLock = Any() val openHelperDirectLock = Any() /** Serializes demo SQL and [reset] so handles are never closed mid-statement. */ suspend fun withSqlAccess(block: suspend () -> T): T = sqlAccess.withLock { block() } @Volatile private var driverConnection: SQLiteConnection? = null + @Volatile private var bridgeConnection: SQLiteConnection? = null @Volatile private var driverRoom2Db: SampleRoom2Database? = null + @Volatile private var bridgeRoom2Db: SampleRoom2Database? = null @Volatile private var driverRoom3Db: SampleRoom3Database? = null @Volatile private var directHelper: SupportSQLiteOpenHelper? = null + @Volatile private var bridgeDirectHelper: SupportSQLiteOpenHelper? = null @Volatile private var openHelperRoomDb: SampleRoom2Database? = null @Volatile private var sqlDelightDriver: AndroidSqliteDriver? = null @@ -68,6 +93,45 @@ object SampleDatabases { } } + /** + * The Room 2.7+ duplicate-span scenario: a Sentry-wrapped open helper bridged to + * [SupportSQLiteDriver], then passed to [SentrySQLiteDriver.create] (which no-ops on the bridge). + */ + fun bridgeConnection(context: Context): SQLiteConnection = + synchronized(bridgeDirectLock) { + bridgeConnection + ?: run { + // SupportSQLiteDriver.open() requires fileName to match the helper's databaseName(); + // use the absolute path Room and the direct driver path both pass to open(). + val dbPath = databaseFile(context, "bridge_direct.db") + SentrySQLiteDriver.create(SupportSQLiteDriver(buildBridgeDirectHelper(context, dbPath))) + .open(dbPath) + .also { + it.execSQL(SqlStatements.CREATE_SONG) + bridgeConnection = it + } + } + } + + fun bridgeRoom2Db(context: Context): SampleRoom2Database = + synchronized(this) { + bridgeRoom2Db + ?: Room.databaseBuilder( + context.applicationContext, + SampleRoom2Database::class.java, + "bridge_room2.db", + ) + .setDriver( + SentrySQLiteDriver.create( + SupportSQLiteDriver(buildBridgeRoom2Helper(context.applicationContext)) + ) + ) + .setQueryCoroutineContext(Dispatchers.IO) + .fallbackToDestructiveMigration(true) + .build() + .also { bridgeRoom2Db = it } + } + fun driverRoom2Db(context: Context): SampleRoom2Database = synchronized(this) { driverRoom2Db @@ -133,10 +197,50 @@ object SampleDatabases { .also { sqlDelightDriver = it } } - private fun buildDirectHelper(context: Context): SupportSQLiteOpenHelper { + private fun buildDirectHelper(context: Context): SupportSQLiteOpenHelper = + buildSentryHelper(context, "openhelper_direct.db").also { directHelper = it } + + private fun buildBridgeDirectHelper(context: Context, dbPath: String): SupportSQLiteOpenHelper = + buildSentryHelper(context, dbPath).also { bridgeDirectHelper = it } + + /** + * Open helper for the Bridge + Room 2 stack. Must not create tables in [onCreate] — Room owns the + * schema when [setDriver] is used. Room also passes [SupportSQLiteOpenHelper.databaseName] (the + * short name below), not an absolute path, to [SupportSQLiteDriver.open]. + * + * The callback version must be 1 (FrameworkSQLiteOpenHelper rejects < 1). That sets `PRAGMA + * user_version = 1` before Room opens, so Room would skip [onCreate] and validate the empty file + * as pre-packaged → "invalid schema". [onOpen] clears user_version back to 0 until + * [ROOM_MASTER_TABLE] exists. + */ + private fun buildBridgeRoom2Helper(context: Context): SupportSQLiteOpenHelper { val configuration = SupportSQLiteOpenHelper.Configuration.builder(context.applicationContext) - .name("openhelper_direct.db") + .name("bridge_room2.db") + .callback( + object : SupportSQLiteOpenHelper.Callback(1) { + override fun onCreate(db: SupportSQLiteDatabase) = Unit + + override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) = + Unit + + override fun onOpen(db: SupportSQLiteDatabase) { + if (!db.hasRoomMasterTable()) { + db.execSQL("PRAGMA user_version = 0") + } + } + } + ) + .build() + return SentrySupportSQLiteOpenHelper.create( + FrameworkSQLiteOpenHelperFactory().create(configuration) + ) + } + + private fun buildSentryHelper(context: Context, dbName: String): SupportSQLiteOpenHelper { + val configuration = + SupportSQLiteOpenHelper.Configuration.builder(context.applicationContext) + .name(dbName) .callback( object : SupportSQLiteOpenHelper.Callback(1) { override fun onCreate(db: SupportSQLiteDatabase) { @@ -156,22 +260,50 @@ object SampleDatabases { /** Opens every database on a background thread, forcing the one-time open + bootstrap to run. */ fun warmUp(context: Context) { val appContext = context.applicationContext + val generation = ++warmUpGeneration + warmUpComplete = false + warmUpErrors = "" // Fire-and-forget: the warm-up outlives no particular screen, so a bare scope is fine here. - CoroutineScope(Dispatchers.IO).launch { - runCatching { driverConnection(appContext) } - // primeWriter() + count() opens both Room pool connections (writer + reader), so the first - // demo INSERT/SELECT reuses them instead of bootstrapping a connection inside its - // transaction. - runCatching { driverRoom2Db(appContext).songDao().also { it.primeWriter() }.count() } - runCatching { driverRoom3Db(appContext).songDao().also { it.primeWriter() }.count() } - runCatching { directHelper(appContext).writableDatabase } - runCatching { openHelperRoomDb(appContext).songDao().also { it.primeWriter() }.count() } - runCatching { - SampleSQLDelightDatabase(sqlDelightDriver(appContext)) - .songQueries - .countSongs() - .executeAsOne() + warmUpJob = + CoroutineScope(Dispatchers.IO).launch { + val failures = mutableListOf() + runWarmUpStep("driver direct", failures) { driverConnection(appContext) } + runWarmUpStep("bridge direct", failures) { bridgeConnection(appContext) } + // primeWriter() + count() opens both Room pool connections (writer + reader), so the first + // demo INSERT/SELECT reuses them instead of bootstrapping a connection inside its + // transaction. + runWarmUpStep("driver Room 2", failures) { + driverRoom2Db(appContext).songDao().also { it.primeWriter() }.count() + } + runWarmUpStep("bridge Room 2", failures) { + bridgeRoom2Db(appContext).songDao().also { it.primeWriter() }.count() + } + runWarmUpStep("driver Room 3", failures) { + driverRoom3Db(appContext).songDao().also { it.primeWriter() }.count() + } + runWarmUpStep("open helper direct", failures) { directHelper(appContext).writableDatabase } + runWarmUpStep("open helper Room", failures) { + openHelperRoomDb(appContext).songDao().also { it.primeWriter() }.count() + } + runWarmUpStep("SQLDelight", failures) { + SampleSQLDelightDatabase(sqlDelightDriver(appContext)) + .songQueries + .countSongs() + .executeAsOne() + } + if (generation == warmUpGeneration) { + warmUpErrors = failures.joinToString("\n") { "Warm-up failed: $it" } + warmUpComplete = true + } } + } + + private inline fun runWarmUpStep(step: String, failures: MutableList, block: () -> Unit) { + try { + block() + } catch (t: Throwable) { + Log.e(TAG, "Warm-up failed: $step", t) + failures.add("$step: ${t.message ?: t.javaClass.simpleName}") } } @@ -185,7 +317,9 @@ object SampleDatabases { val names = listOf( "driver_direct.db", + "bridge_direct.db", "driver_room2.db", + "bridge_room2.db", "driver_room3.db", "openhelper_direct.db", "openhelper_room.db", @@ -201,6 +335,12 @@ object SampleDatabases { driverConnection?.close() driverConnection = null } + synchronized(bridgeDirectLock) { + bridgeConnection?.close() + bridgeConnection = null + bridgeDirectHelper?.close() + bridgeDirectHelper = null + } synchronized(openHelperDirectLock) { directHelper?.close() directHelper = null @@ -208,6 +348,8 @@ object SampleDatabases { synchronized(this) { driverRoom2Db?.close() driverRoom2Db = null + bridgeRoom2Db?.close() + bridgeRoom2Db = null driverRoom3Db?.close() driverRoom3Db = null openHelperRoomDb?.close() @@ -219,4 +361,11 @@ object SampleDatabases { private fun databaseFile(context: Context, name: String): String = context.applicationContext.getDatabasePath(name).also { it.parentFile?.mkdirs() }.absolutePath + + private fun SupportSQLiteDatabase.hasRoomMasterTable(): Boolean = + query("SELECT 1 FROM sqlite_master WHERE name = '$ROOM_MASTER_TABLE' LIMIT 1").use { + it.moveToFirst() + } } + +private const val ROOM_MASTER_TABLE = "room_master_table" diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt index 543f1169294..9bd2d624694 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt @@ -18,6 +18,8 @@ enum class SqlDemo { DRIVER_DIRECT, DRIVER_ROOM2, DRIVER_ROOM3, + BRIDGE_DIRECT, + BRIDGE_ROOM2, OPENHELPER_DIRECT, OPENHELPER_ROOM, OPENHELPER_SQLDELIGHT, @@ -64,6 +66,8 @@ object SqlStatements { SqlDemo.DRIVER_DIRECT -> driverDirect(context, heavy) SqlDemo.DRIVER_ROOM2 -> driverWithRoom2(context, heavy) SqlDemo.DRIVER_ROOM3 -> driverWithRoom3(context, heavy) + SqlDemo.BRIDGE_DIRECT -> bridgeDirect(context, heavy) + SqlDemo.BRIDGE_ROOM2 -> bridgeWithRoom2(context, heavy) SqlDemo.OPENHELPER_DIRECT -> openHelperDirect(context, heavy) SqlDemo.OPENHELPER_ROOM -> openHelperWithRoom(context, heavy) SqlDemo.OPENHELPER_SQLDELIGHT -> openHelperWithSqlDelight(context, heavy) @@ -115,6 +119,37 @@ object SqlStatements { if (statement.step()) statement.getLong(0) else 0 } + // --- 1b. SupportSQLiteDriver bridge (helper + driver both wrapped; SDK skips driver wrap) -- + + private fun bridgeDirect(context: Context, heavy: Boolean): String = + synchronized(SampleDatabases.bridgeDirectLock) { + val connection = SampleDatabases.bridgeConnection(context) + insert(connection, "Mishima / Closing", "Philip Glass") + insert(connection, "School of Velocity, op 299 no 1, ", "Carl Czerny") + + if (heavy) { + connection.prepare(insertSongsBatch(HEAVY_ROW_COUNT)).use { statement -> + var param = 1 + repeat(HEAVY_ROW_COUNT) { row -> + statement.bindText(param++, "song $row") + statement.bindText(param++, "artist $row") + } + statement.step() + } + + connection.prepare(SELECT_SONGS).use { statement -> + while (statement.step()) { + val row = "${statement.getLong(0)}:${statement.getText(1)}:${statement.getText(2)}" + appWork(row) + } + } + } + "Bridge (Direct): ${count(connection)} rows." + } + + private suspend fun bridgeWithRoom2(context: Context, heavy: Boolean): String = + roomDemo(SampleDatabases.bridgeRoom2Db(context).songDao(), "Bridge (Room 2)", heavy) + // --- 2. SentrySQLiteDriver, used through Room 2.7+ ---------------------------------------- private suspend fun driverWithRoom2(context: Context, heavy: Boolean): String = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt index b32811e8c91..3cc6d394daa 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadActivity.kt @@ -3,6 +3,7 @@ package io.sentry.samples.android.sqlite import android.content.Context import android.content.Intent import android.os.Bundle +import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.runtime.getValue @@ -48,7 +49,8 @@ class UiLoadActivity : ComponentActivity() { withContext(Dispatchers.IO) { SqlStatements.execute(applicationContext, id, heavy) } "$result\n\nRan under the auto ui.load transaction." } catch (t: Throwable) { - "Load failed: ${t.message}" + Log.e(TAG, "Load failed", t) + "Load failed: ${t.message ?: t.javaClass.simpleName}" } finally { // Close the TTFD window so the ui.load transaction finishes with the db spans attached. Sentry.reportFullyDisplayed() @@ -57,6 +59,7 @@ class UiLoadActivity : ComponentActivity() { } companion object { + private const val TAG = "UiLoadActivity" private const val EXTRA_DEMO_ID = "demo_id" private const val EXTRA_HEAVY = "heavy" From 547d3e463dec24c1b99586f85e0cd5f2d73b9022 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 10:04:12 +0200 Subject: [PATCH 215/391] chore: update scripts/update-sentry-native-ndk.sh to 0.15.1 (#5570) Co-authored-by: GitHub --- CHANGELOG.md | 6 ++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8428f033b78..76b2d974e5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ - To use it, pass `SQLiteDriver` to `SentrySQLiteDriver.create(...)` - Requires `androidx.sqlite:sqlite` (2.5.0+) on runtime classpath (typically provided by Room or SQLDelight) +### Dependencies + +- Bump Native SDK from v0.15.0 to v0.15.1 ([#5570](https://github.com/getsentry/sentry-java/pull/5570)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0151) + - [diff](https://github.com/getsentry/sentry-native/compare/0.15.0...0.15.1) + ## 8.44.0 ### Features diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 91a7669194f..68521efdfcc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -166,7 +166,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.15.0" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.15.1" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From 9c501bbbe56976ba47b467455062992eac005b07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 08:07:08 +0000 Subject: [PATCH 216/391] chore(deps): bump actions/checkout in the github-actions group (#5569) Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 6.0.3 to 7.0.0 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/changes-in-high-risk-code.yml | 2 +- .github/workflows/check-tombstone-proto-schema.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/enforce-license-compliance.yml | 2 +- .github/workflows/format-code.yml | 2 +- .github/workflows/generate-javadocs.yml | 2 +- .github/workflows/integration-tests-benchmarks.yml | 4 ++-- .github/workflows/integration-tests-size.yml | 2 +- .github/workflows/integration-tests-ui-critical.yml | 4 ++-- .github/workflows/integration-tests-ui.yml | 2 +- .github/workflows/release-build.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 2 +- .github/workflows/spring-boot-3-matrix.yml | 2 +- .github/workflows/spring-boot-4-matrix.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 40f8509fee4..8ddb961ec96 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 375e94e7499..f2ffd96f9c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} submodules: 'recursive' diff --git a/.github/workflows/changes-in-high-risk-code.yml b/.github/workflows/changes-in-high-risk-code.yml index 028b4217ef2..78918167207 100644 --- a/.github/workflows/changes-in-high-risk-code.yml +++ b/.github/workflows/changes-in-high-risk-code.yml @@ -16,7 +16,7 @@ jobs: high_risk_code: ${{ steps.changes.outputs.high_risk_code }} high_risk_code_files: ${{ steps.changes.outputs.high_risk_code_files }} steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Get changed files id: changes uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 diff --git a/.github/workflows/check-tombstone-proto-schema.yml b/.github/workflows/check-tombstone-proto-schema.yml index 535b2170fae..3e30f97e45e 100644 --- a/.github/workflows/check-tombstone-proto-schema.yml +++ b/.github/workflows/check-tombstone-proto-schema.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Check for newer Tombstone proto schema run: ./scripts/check-tombstone-proto-schema.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e24b7c96c14..ccc9cc04a85 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index e5e4530933b..38680fe0a23 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -20,7 +20,7 @@ jobs: java-version: '17' - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 # TODO: remove this when upstream is fixed - name: Disable Gradle configuration cache (see https://github.com/fossas/fossa-cli/issues/872) diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index ec427af3564..2892df16701 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index 2e82024077a..fabd36736aa 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 4d323f0394a..45b063705dc 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' @@ -77,7 +77,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index e2fa42ddc16..5c212d5895a 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Setup Java Version uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 18809c060e1..7d0b74b4329 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Set up Java 17 uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 @@ -77,7 +77,7 @@ jobs: arch: x86_64 steps: - name: Checkout code - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Enable KVM run: | diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index f7b95a26d12..92e29ecbef7 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 9fecaf32b5e..050782006f0 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eddeaa24cd9..dd266d948c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: with: app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: token: ${{ steps.token.outputs.token }} # Needs to be set, otherwise git describe --tags will fail with: No names found, cannot describe anything diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 7628a0bbba0..6e0b1366c9f 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 40670eaf258..00e93f5442b 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 128051ed03e..450dbd8c98d 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 62a1b7665c0..67f81f2fb64 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -98,7 +98,7 @@ jobs: agent: "false" agent-auto-init: "true" steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: 'recursive' From 8da852cc8e39d8246ba5a712c88d38b64618b074 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 19 Jun 2026 11:11:14 +0200 Subject: [PATCH 217/391] fix(android): Make FirstDrawDoneListener cleanup OnGlobalLayoutListener after use (#5567) * fix(android): Make FirstDrawDoneListener cleanup OnGlobalLayoutListener after use The OnGlobalLayoutListener registered in onDraw() to defer removal of the OnDrawListener was never itself removed. In single-Activity apps (e.g. React Native), this caused an unbounded per-navigation leak on the ViewTreeObserver, accumulating one listener per registerForNextDraw call. Make the OnGlobalLayoutListener remove itself after firing. Fixes JAVA-545 Co-Authored-By: Claude Opus 4.6 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 +++ .../internal/util/FirstDrawDoneListener.java | 9 +++++- .../util/FirstDrawDoneListenerTest.kt | 31 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76b2d974e5a..395b1f2e2b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Fix `FirstDrawDoneListener` leaking an `OnGlobalLayoutListener` per registration ([#5567](https://github.com/getsentry/sentry-java/pull/5567)) + ### Features - Add experimental `SentrySQLiteDriver` to `sentry-android-sqlite` for instrumenting `androidx.sqlite.SQLiteDriver` ([#5563](https://github.com/getsentry/sentry-java/pull/5563)) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java index f2612b4aa84..0629b7a4908 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java @@ -112,7 +112,14 @@ public void onDraw() { // OnDrawListeners cannot be removed within onDraw, so we remove it with a // GlobalLayoutListener view.getViewTreeObserver() - .addOnGlobalLayoutListener(() -> view.getViewTreeObserver().removeOnDrawListener(this)); + .addOnGlobalLayoutListener( + new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + view.getViewTreeObserver().removeOnGlobalLayoutListener(this); + view.getViewTreeObserver().removeOnDrawListener(FirstDrawDoneListener.this); + } + }); mainThreadHandler.postAtFrontOfQueue(callback); } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/FirstDrawDoneListenerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/FirstDrawDoneListenerTest.kt index 008a036cbfc..44d6d9fd03a 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/FirstDrawDoneListenerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/FirstDrawDoneListenerTest.kt @@ -128,6 +128,37 @@ class FirstDrawDoneListenerTest { assertTrue(fixture.onDrawListeners.isEmpty()) } + @Test + fun `OnGlobalLayoutListener is removed after cleanup`() { + val view = fixture.getSut() + + // Initialize mOnGlobalLayoutListeners via a dummy add/remove + val dummyGlobalListener = ViewTreeObserver.OnGlobalLayoutListener {} + view.viewTreeObserver.addOnGlobalLayoutListener(dummyGlobalListener) + view.viewTreeObserver.removeOnGlobalLayoutListener(dummyGlobalListener) + + // CopyOnWriteArray wraps an internal ArrayList called mData + val copyOnWriteArray: Any = view.viewTreeObserver.getProperty("mOnGlobalLayoutListeners") + val mDataField = copyOnWriteArray.javaClass.getDeclaredField("mData") + mDataField.isAccessible = true + + @Suppress("UNCHECKED_CAST") + fun globalLayoutListeners(): ArrayList<*> = mDataField.get(copyOnWriteArray) as ArrayList<*> + + assertTrue(globalLayoutListeners().isEmpty()) + + FirstDrawDoneListener.registerForNextDraw(view, {}, fixture.buildInfo) + + // onDraw registers a cleanup OnGlobalLayoutListener + view.viewTreeObserver.dispatchOnDraw() + assertFalse(globalLayoutListeners().isEmpty()) + + // onGlobalLayout fires the cleanup, which removes both the draw and layout listeners + view.viewTreeObserver.dispatchOnGlobalLayout() + assertTrue(globalLayoutListeners().isEmpty()) + assertTrue(fixture.onDrawListeners.isEmpty()) + } + @Test fun `registerForNextDraw calls the given callback on the main thread after onDraw`() { val view = fixture.getSut() From f4269fd1cb8cbeef665b2e1316819fc632e2e338 Mon Sep 17 00:00:00 2001 From: runningcode <332597+runningcode@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:51:59 +0000 Subject: [PATCH 218/391] release: 8.44.1 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 395b1f2e2b1..b3bdcd38bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.44.1 ### Fixes diff --git a/gradle.properties b/gradle.properties index 19127ac9832..f2e3da3ca09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.44.0 +versionName=8.44.1 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 69943b840653f4dde405bdc32c4fde5732dcc43f Mon Sep 17 00:00:00 2001 From: arb Date: Fri, 19 Jun 2026 16:00:18 +0200 Subject: [PATCH 219/391] refactor(android-sqlite): Rename classes instrumenting SQLite spans for consistency (#5555) --- ...QLiteSpanManager.kt => OpenHelperSpans.kt} | 3 +- .../sqlite/SentryCrossProcessCursor.kt | 8 +-- .../sqlite/SentrySupportSQLiteDatabase.kt | 21 ++++--- .../sqlite/SentrySupportSQLiteOpenHelper.kt | 6 +- .../sqlite/SentrySupportSQLiteStatement.kt | 17 +++--- ...eSpanInstrumentation.kt => DriverSpans.kt} | 26 ++++----- .../sentry/sqlite/SentrySQLiteConnection.kt | 2 +- .../io/sentry/sqlite/SentrySQLiteDriver.kt | 2 +- .../io/sentry/sqlite/SentrySQLiteStatement.kt | 4 +- ...nManagerTest.kt => OpenHelperSpansTest.kt} | 6 +- .../sqlite/SentryCrossProcessCursorTest.kt | 4 +- .../sqlite/SentrySupportSQLiteDatabaseTest.kt | 4 +- .../SentrySupportSQLiteStatementTest.kt | 4 +- ...trumentationTest.kt => DriverSpansTest.kt} | 55 +++++++++---------- .../sqlite/SentrySQLiteConnectionTest.kt | 4 +- .../sqlite/SentrySQLiteStatementTest.kt | 10 ++-- 16 files changed, 82 insertions(+), 94 deletions(-) rename sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/{SQLiteSpanManager.kt => OpenHelperSpans.kt} (96%) rename sentry-android-sqlite/src/main/java/io/sentry/sqlite/{SQLiteSpanInstrumentation.kt => DriverSpans.kt} (81%) rename sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/{SQLiteSpanManagerTest.kt => OpenHelperSpansTest.kt} (97%) rename sentry-android-sqlite/src/test/java/io/sentry/sqlite/{SQLiteSpanInstrumentationTest.kt => DriverSpansTest.kt} (77%) diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/OpenHelperSpans.kt similarity index 96% rename from sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt rename to sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/OpenHelperSpans.kt index 1bdeb7d369c..059eb1bb1b5 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SQLiteSpanManager.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/OpenHelperSpans.kt @@ -13,7 +13,8 @@ import io.sentry.SpanStatus private const val TRACE_ORIGIN = "auto.db.sqlite" -internal class SQLiteSpanManager( +/** Span instrumentation for [SentrySupportSQLiteOpenHelper]. */ +internal class OpenHelperSpans( private val scopes: IScopes = ScopesAdapter.getInstance(), private val databaseName: String? = null, ) { diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentryCrossProcessCursor.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentryCrossProcessCursor.kt index 1f3796a8975..f5f8424aca3 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentryCrossProcessCursor.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentryCrossProcessCursor.kt @@ -13,7 +13,7 @@ import android.database.CursorWindow */ internal class SentryCrossProcessCursor( private val delegate: CrossProcessCursor, - private val spanManager: SQLiteSpanManager, + private val spans: OpenHelperSpans, private val sql: String, ) : CrossProcessCursor by delegate { // We have to start the span only the first time, regardless of how many times its methods get @@ -25,7 +25,7 @@ internal class SentryCrossProcessCursor( return delegate.count } isSpanStarted = true - return spanManager.performSql(sql) { delegate.count } + return spans.performSql(sql) { delegate.count } } override fun onMove(oldPosition: Int, newPosition: Int): Boolean { @@ -33,7 +33,7 @@ internal class SentryCrossProcessCursor( return delegate.onMove(oldPosition, newPosition) } isSpanStarted = true - return spanManager.performSql(sql) { delegate.onMove(oldPosition, newPosition) } + return spans.performSql(sql) { delegate.onMove(oldPosition, newPosition) } } override fun fillWindow(position: Int, window: CursorWindow?) { @@ -41,6 +41,6 @@ internal class SentryCrossProcessCursor( return delegate.fillWindow(position, window) } isSpanStarted = true - return spanManager.performSql(sql) { delegate.fillWindow(position, window) } + return spans.performSql(sql) { delegate.fillWindow(position, window) } } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabase.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabase.kt index bfe3265f89b..458203a232f 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabase.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabase.kt @@ -14,11 +14,11 @@ import androidx.sqlite.db.SupportSQLiteStatement * and it's created automatically by the [SentrySupportSQLiteOpenHelper]. * * @param delegate The [SupportSQLiteDatabase] instance to delegate calls to. - * @param sqLiteSpanManager The [SQLiteSpanManager] responsible for the creation of the spans. + * @param spans The [OpenHelperSpans] manager responsible for the creation of the spans. */ internal class SentrySupportSQLiteDatabase( private val delegate: SupportSQLiteDatabase, - private val sqLiteSpanManager: SQLiteSpanManager, + private val spans: OpenHelperSpans, ) : SupportSQLiteDatabase by delegate { /** * Compiles the given SQL statement. It will return Sentry's wrapper around @@ -28,35 +28,34 @@ internal class SentrySupportSQLiteDatabase( * @return Compiled statement. */ override fun compileStatement(sql: String): SupportSQLiteStatement = - SentrySupportSQLiteStatement(delegate.compileStatement(sql), sqLiteSpanManager, sql) + SentrySupportSQLiteStatement(delegate.compileStatement(sql), spans, sql) @Suppress("AcronymName") // To keep consistency with framework method name. override fun execPerConnectionSQL( sql: String, @SuppressLint("ArrayReturn") bindArgs: Array?, ) { - sqLiteSpanManager.performSql(sql) { delegate.execPerConnectionSQL(sql, bindArgs) } + spans.performSql(sql) { delegate.execPerConnectionSQL(sql, bindArgs) } } - override fun query(query: String): Cursor = - sqLiteSpanManager.performSql(query) { delegate.query(query) } + override fun query(query: String): Cursor = spans.performSql(query) { delegate.query(query) } override fun query(query: String, bindArgs: Array): Cursor = - sqLiteSpanManager.performSql(query) { delegate.query(query, bindArgs) } + spans.performSql(query) { delegate.query(query, bindArgs) } override fun query(query: SupportSQLiteQuery): Cursor = - sqLiteSpanManager.performSql(query.sql) { delegate.query(query) } + spans.performSql(query.sql) { delegate.query(query) } override fun query(query: SupportSQLiteQuery, cancellationSignal: CancellationSignal?): Cursor = - sqLiteSpanManager.performSql(query.sql) { delegate.query(query, cancellationSignal) } + spans.performSql(query.sql) { delegate.query(query, cancellationSignal) } @Throws(SQLException::class) override fun execSQL(sql: String) { - sqLiteSpanManager.performSql(sql) { delegate.execSQL(sql) } + spans.performSql(sql) { delegate.execSQL(sql) } } @Throws(SQLException::class) override fun execSQL(sql: String, bindArgs: Array) { - sqLiteSpanManager.performSql(sql) { delegate.execSQL(sql, bindArgs) } + spans.performSql(sql) { delegate.execSQL(sql, bindArgs) } } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper.kt index 76b405d9f11..12b63cfa128 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper.kt @@ -33,14 +33,14 @@ import androidx.sqlite.db.SupportSQLiteOpenHelper public class SentrySupportSQLiteOpenHelper private constructor(private val delegate: SupportSQLiteOpenHelper) : SupportSQLiteOpenHelper by delegate { - private val sqLiteSpanManager = SQLiteSpanManager(databaseName = delegate.databaseName) + private val spans = OpenHelperSpans(databaseName = delegate.databaseName) private val sentryWritableDatabase: SupportSQLiteDatabase by lazy { - SentrySupportSQLiteDatabase(delegate.writableDatabase, sqLiteSpanManager) + SentrySupportSQLiteDatabase(delegate.writableDatabase, spans) } private val sentryReadableDatabase: SupportSQLiteDatabase by lazy { - SentrySupportSQLiteDatabase(delegate.readableDatabase, sqLiteSpanManager) + SentrySupportSQLiteDatabase(delegate.readableDatabase, spans) } override val writableDatabase: SupportSQLiteDatabase diff --git a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteStatement.kt b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteStatement.kt index 1a364dc27ba..3df6d287b28 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteStatement.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/android/sqlite/SentrySupportSQLiteStatement.kt @@ -9,25 +9,22 @@ import androidx.sqlite.db.SupportSQLiteStatement * [SentrySupportSQLiteDatabase.compileStatement]. * * @param delegate The [SupportSQLiteStatement] instance to delegate calls to. - * @param sqLiteSpanManager The [SQLiteSpanManager] responsible for the creation of the spans. + * @param spans The [OpenHelperSpans] manager responsible for the creation of the spans. * @param sql The query string. */ internal class SentrySupportSQLiteStatement( private val delegate: SupportSQLiteStatement, - private val sqLiteSpanManager: SQLiteSpanManager, + private val spans: OpenHelperSpans, private val sql: String, ) : SupportSQLiteStatement by delegate { - override fun execute() = sqLiteSpanManager.performSql(sql) { delegate.execute() } + override fun execute() = spans.performSql(sql) { delegate.execute() } - override fun executeUpdateDelete(): Int = - sqLiteSpanManager.performSql(sql) { delegate.executeUpdateDelete() } + override fun executeUpdateDelete(): Int = spans.performSql(sql) { delegate.executeUpdateDelete() } - override fun executeInsert(): Long = - sqLiteSpanManager.performSql(sql) { delegate.executeInsert() } + override fun executeInsert(): Long = spans.performSql(sql) { delegate.executeInsert() } - override fun simpleQueryForLong(): Long = - sqLiteSpanManager.performSql(sql) { delegate.simpleQueryForLong() } + override fun simpleQueryForLong(): Long = spans.performSql(sql) { delegate.simpleQueryForLong() } override fun simpleQueryForString(): String? = - sqLiteSpanManager.performSql(sql) { delegate.simpleQueryForString() } + spans.performSql(sql) { delegate.simpleQueryForString() } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DriverSpans.kt similarity index 81% rename from sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt rename to sentry-android-sqlite/src/main/java/io/sentry/sqlite/DriverSpans.kt index f0998dfdc23..b3c0eb7c713 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SQLiteSpanInstrumentation.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/DriverSpans.kt @@ -20,20 +20,17 @@ private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite" private val EMPTY_NANO_TIME = SentryNanotimeDate(0, 0L) /** Span instrumentation for [SentrySQLiteDriver]. */ -internal class SQLiteSpanInstrumentation( - private val scopes: IScopes, - private val dbMetadata: DbMetadata, -) { +internal class DriverSpans(private val scopes: IScopes, private val dbMetadata: DbMetadata) { private val stackTraceFactory = SentryStackTraceFactory(scopes.options) /** - * Returns a timestamp in nanoseconds for use with [recordSpan]. Timestamp is ns-precise if the - * active parent span uses a [SentryNanotimeDate] (the ordinary case); otherwise it's ms-precise. + * Returns a timestamp in nanoseconds for use with [record]. Timestamp is ns-precise if the active + * parent span uses a [SentryNanotimeDate] (the ordinary case); otherwise it's ms-precise. * - * Note: Internalizing the start time in [recordSpan] would shift spans to end-of-work on the - * trace timeline, which is less desirable; callers capture the start before doing database work - * and pass it back to [recordSpan]. + * Note: Internalizing the start time in [record] would shift spans to end-of-work on the trace + * timeline, which is less desirable; callers capture the start before doing database work and + * pass it back to [record]. */ fun startTimestamp(): Long = // Try to retain nanosecond precision + avoid SentryDate allocation... @@ -42,7 +39,7 @@ internal class SQLiteSpanInstrumentation( ?: scopes.options.dateProvider.now().nanoTimestamp() /** Records a `db.sql.query` span. */ - fun recordSpan( + fun record( sql: String, startTimestampNanos: Long, durationNanos: Long, @@ -73,14 +70,11 @@ internal class SQLiteSpanInstrumentation( companion object { /** - * Returns [SQLiteSpanInstrumentation] based on the [fileName] argument passed to + * Returns [DriverSpans] based on the [fileName] argument passed to * [SQLiteDriver.open][androidx.sqlite.SQLiteDriver.open]. */ - fun fromFileName( - fileName: String, - scopes: IScopes = ScopesAdapter.getInstance(), - ): SQLiteSpanInstrumentation = - SQLiteSpanInstrumentation(scopes, dbMetadataFromFileName(fileName)) + fun fromFileName(fileName: String, scopes: IScopes = ScopesAdapter.getInstance()): DriverSpans = + DriverSpans(scopes, dbMetadataFromFileName(fileName)) } } diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt index 45ee9a39b27..e01544b0523 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteConnection.kt @@ -5,7 +5,7 @@ import androidx.sqlite.SQLiteStatement internal class SentrySQLiteConnection( private val delegate: SQLiteConnection, - private val spans: SQLiteSpanInstrumentation, + private val spans: DriverSpans, ) : SQLiteConnection by delegate { override fun prepare(sql: String): SQLiteStatement { diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt index f0f41782c22..22f6353d883 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt @@ -48,7 +48,7 @@ public class SentrySQLiteDriver private constructor(private val delegate: SQLite val connection = delegate.open(fileName) return try { - val spans = SQLiteSpanInstrumentation.fromFileName(fileName) + val spans = DriverSpans.fromFileName(fileName) // create() ensures delegate is unwrapped, so we don't need to protect against double-wrapping // the connection. SentrySQLiteConnection(connection, spans) diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt index a739a396bcb..e220a74cd1e 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteStatement.kt @@ -16,7 +16,7 @@ import io.sentry.SpanStatus */ internal class SentrySQLiteStatement( private val delegate: SQLiteStatement, - private val spans: SQLiteSpanInstrumentation, + private val spans: DriverSpans, private val sql: String, private val nanoTimeProvider: () -> Long = { System.nanoTime() }, ) : SQLiteStatement by delegate { @@ -74,6 +74,6 @@ internal class SentrySQLiteStatement( val duration = accumulatedDbNanos firstStepTimestampNanos = null accumulatedDbNanos = 0L - spans.recordSpan(sql, startNanos, duration, status, throwable) + spans.record(sql, startNanos, duration, status, throwable) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SQLiteSpanManagerTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/OpenHelperSpansTest.kt similarity index 97% rename from sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SQLiteSpanManagerTest.kt rename to sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/OpenHelperSpansTest.kt index 6fd6fa51bb3..0552094838e 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SQLiteSpanManagerTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/OpenHelperSpansTest.kt @@ -21,13 +21,13 @@ import org.junit.Before import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -class SQLiteSpanManagerTest { +class OpenHelperSpansTest { private class Fixture { private val scopes = mock() lateinit var sentryTracer: SentryTracer lateinit var options: SentryOptions - fun getSut(isSpanActive: Boolean = true, databaseName: String? = null): SQLiteSpanManager { + fun getSut(isSpanActive: Boolean = true, databaseName: String? = null): OpenHelperSpans { options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } whenever(scopes.options).thenReturn(options) sentryTracer = SentryTracer(TransactionContext("name", "op"), scopes) @@ -35,7 +35,7 @@ class SQLiteSpanManagerTest { if (isSpanActive) { whenever(scopes.span).thenReturn(sentryTracer) } - return SQLiteSpanManager(scopes, databaseName) + return OpenHelperSpans(scopes, databaseName) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentryCrossProcessCursorTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentryCrossProcessCursorTest.kt index 44836dd0c97..27eff29c9f3 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentryCrossProcessCursorTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentryCrossProcessCursorTest.kt @@ -20,7 +20,7 @@ import org.mockito.kotlin.whenever class SentryCrossProcessCursorTest { private class Fixture { private val scopes = mock() - private val spanManager = SQLiteSpanManager(scopes) + private val spans = OpenHelperSpans(scopes) val mockCursor = mock() lateinit var options: SentryOptions lateinit var sentryTracer: SentryTracer @@ -33,7 +33,7 @@ class SentryCrossProcessCursorTest { if (isSpanActive) { whenever(scopes.span).thenReturn(sentryTracer) } - return SentryCrossProcessCursor(mockCursor, spanManager, sql) + return SentryCrossProcessCursor(mockCursor, spans, sql) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabaseTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabaseTest.kt index 81bd964cc87..6a47eb6fa92 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabaseTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteDatabaseTest.kt @@ -23,7 +23,7 @@ import org.mockito.kotlin.whenever class SentrySupportSQLiteDatabaseTest { private class Fixture { private val scopes = mock() - private val spanManager = SQLiteSpanManager(scopes) + private val spans = OpenHelperSpans(scopes) val mockDatabase = mock() lateinit var sentryTracer: SentryTracer lateinit var options: SentryOptions @@ -41,7 +41,7 @@ class SentrySupportSQLiteDatabaseTest { whenever(scopes.span).thenReturn(sentryTracer) } - return SentrySupportSQLiteDatabase(mockDatabase, spanManager) + return SentrySupportSQLiteDatabase(mockDatabase, spans) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteStatementTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteStatementTest.kt index b2b4998ace8..c4d810adbcd 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteStatementTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/android/sqlite/SentrySupportSQLiteStatementTest.kt @@ -18,7 +18,7 @@ import org.mockito.kotlin.whenever class SentrySupportSQLiteStatementTest { private class Fixture { private val scopes = mock() - private val spanManager = SQLiteSpanManager(scopes) + private val spans = OpenHelperSpans(scopes) val mockStatement = mock() lateinit var sentryTracer: SentryTracer lateinit var options: SentryOptions @@ -31,7 +31,7 @@ class SentrySupportSQLiteStatementTest { if (isSpanActive) { whenever(scopes.span).thenReturn(sentryTracer) } - return SentrySupportSQLiteStatement(mockStatement, spanManager, sql) + return SentrySupportSQLiteStatement(mockStatement, spans, sql) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DriverSpansTest.kt similarity index 77% rename from sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt rename to sentry-android-sqlite/src/test/java/io/sentry/sqlite/DriverSpansTest.kt index 74bd1c7f882..319fc20d7ce 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SQLiteSpanInstrumentationTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/DriverSpansTest.kt @@ -21,7 +21,7 @@ import kotlin.test.assertTrue import org.mockito.kotlin.mock import org.mockito.kotlin.whenever -class SQLiteSpanInstrumentationTest { +class DriverSpansTest { private class Fixture { @@ -29,17 +29,14 @@ class SQLiteSpanInstrumentationTest { lateinit var sentryTracer: SentryTracer lateinit var options: SentryOptions - fun getSut( - isTransactionActive: Boolean = true, - fileName: String = ":memory:", - ): SQLiteSpanInstrumentation { + fun getSut(isTransactionActive: Boolean = true, fileName: String = ":memory:"): DriverSpans { options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } whenever(scopes.options).thenReturn(options) sentryTracer = SentryTracer(TransactionContext("name", "op"), scopes) if (isTransactionActive) { whenever(scopes.span).thenReturn(sentryTracer) } - return SQLiteSpanInstrumentation.fromFileName(fileName, scopes) + return DriverSpans.fromFileName(fileName, scopes) } } @@ -56,7 +53,7 @@ class SQLiteSpanInstrumentationTest { val start = sut.startTimestamp() val durationNanos = 42_000_000L - sut.recordSpan("SELECT 1", start, durationNanos, SpanStatus.OK) + sut.record("SELECT 1", start, durationNanos, SpanStatus.OK) val span = fixture.sentryTracer.children.first() @@ -81,7 +78,7 @@ class SQLiteSpanInstrumentationTest { whenever(fixture.scopes.options).thenReturn(options) whenever(fixture.scopes.span).thenReturn(parentSpan) - val sut = SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) + val sut = DriverSpans.fromFileName(":memory:", fixture.scopes) assertEquals(providerDate.nanoTimestamp(), sut.startTimestamp()) } @@ -97,31 +94,31 @@ class SQLiteSpanInstrumentationTest { whenever(fixture.scopes.options).thenReturn(options) whenever(fixture.scopes.span).thenReturn(null) - val sut = SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) + val sut = DriverSpans.fromFileName(":memory:", fixture.scopes) assertEquals(providerDate.nanoTimestamp(), sut.startTimestamp()) } @Test - fun `recordSpan records a span if a transaction is active`() { + fun `record method records a span if a transaction is active`() { val sut = fixture.getSut(isTransactionActive = true) - sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) assertEquals(1, fixture.sentryTracer.children.size) } @Test - fun `recordSpan does not record a span if no transaction is active`() { + fun `record method does not record a span if no transaction is active`() { val sut = fixture.getSut(isTransactionActive = false) val start = sut.startTimestamp() - sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", start, 1_000_000, SpanStatus.OK) assertEquals(0, fixture.sentryTracer.children.size) } @Test - fun `recordSpan creates a span with correct properties`() { + fun `record method creates a span with correct properties`() { val sut = fixture.getSut() val start = sut.startTimestamp() - sut.recordSpan("SELECT * FROM users", start, 1_000_000, SpanStatus.OK) + sut.record("SELECT * FROM users", start, 1_000_000, SpanStatus.OK) val span = fixture.sentryTracer.children.firstOrNull() assertNotNull(span) @@ -133,24 +130,24 @@ class SQLiteSpanInstrumentationTest { } @Test - fun `recordSpan sets finishDate equal to startDate + durationNanos`() { + fun `record method sets finishDate equal to startDate + durationNanos`() { val sut = fixture.getSut() val start = sut.startTimestamp() val durationNanos = 42_000_000L - sut.recordSpan("SELECT 1", start, durationNanos, SpanStatus.OK) + sut.record("SELECT 1", start, durationNanos, SpanStatus.OK) val span = fixture.sentryTracer.children.first() assertEquals(span.startDate.nanoTimestamp() + durationNanos, span.finishDate!!.nanoTimestamp()) } @Test - fun `recordSpan attaches throwable when provided`() { + fun `record method attaches throwable when provided`() { val sut = fixture.getSut() val start = sut.startTimestamp() val exception = RuntimeException("disk I/O error") - sut.recordSpan("INSERT INTO t VALUES(1)", start, 500_000, SpanStatus.INTERNAL_ERROR, exception) + sut.record("INSERT INTO t VALUES(1)", start, 500_000, SpanStatus.INTERNAL_ERROR, exception) val span = fixture.sentryTracer.children.first() assertEquals(SpanStatus.INTERNAL_ERROR, span.status) @@ -158,10 +155,10 @@ class SQLiteSpanInstrumentationTest { } @Test - fun `recordSpan sets db system and db name when fileName is not the in-memory sentinel`() { + fun `record method sets db system and db name when fileName is not the in-memory sentinel`() { val sut = fixture.getSut(fileName = "/data/data/com.example/databases/tracks.db") val start = sut.startTimestamp() - sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", start, 1_000_000, SpanStatus.OK) val span = fixture.sentryTracer.children.first() assertEquals("sqlite", span.data[SpanDataConvention.DB_SYSTEM_KEY]) @@ -169,10 +166,10 @@ class SQLiteSpanInstrumentationTest { } @Test - fun `recordSpan sets db system only when fileName is the in-memory sentinel`() { + fun `record method sets db system only when fileName is the in-memory sentinel`() { val sut = fixture.getSut(fileName = ":memory:") val start = sut.startTimestamp() - sut.recordSpan("SELECT 1", start, 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", start, 1_000_000, SpanStatus.OK) val span = fixture.sentryTracer.children.first() assertEquals("in-memory", span.data[SpanDataConvention.DB_SYSTEM_KEY]) @@ -180,13 +177,13 @@ class SQLiteSpanInstrumentationTest { } @Test - fun `recordSpan sets blocked_main_thread to true and attaches call stack on main thread`() { + fun `record method sets blocked_main_thread to true and attaches call stack on main thread`() { val sut = fixture.getSut() fixture.options.threadChecker = mock() whenever(fixture.options.threadChecker.isMainThread).thenReturn(true) whenever(fixture.options.threadChecker.currentThreadName).thenReturn("main") - sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) val span = fixture.sentryTracer.children.first() assertTrue(span.getData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY) as Boolean) @@ -194,20 +191,20 @@ class SQLiteSpanInstrumentationTest { } @Test - fun `recordSpan sets blocked_main_thread to false and does not attach a call stack on background thread`() { + fun `record method sets blocked_main_thread to false and does not attach a call stack on background thread`() { val sut = fixture.getSut() fixture.options.threadChecker = mock() whenever(fixture.options.threadChecker.isMainThread).thenReturn(false) whenever(fixture.options.threadChecker.currentThreadName).thenReturn("worker") - sut.recordSpan("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) + sut.record("SELECT 1", sut.startTimestamp(), 1_000_000, SpanStatus.OK) val span = fixture.sentryTracer.children.first() assertFalse(span.getData(SpanDataConvention.BLOCKED_MAIN_THREAD_KEY) as Boolean) assertNull(span.getData(SpanDataConvention.CALL_STACK_KEY)) } - private fun setUpWithNanotimeDates(vararg dates: SentryNanotimeDate): SQLiteSpanInstrumentation { + private fun setUpWithNanotimeDates(vararg dates: SentryNanotimeDate): DriverSpans { val dateQueue = ArrayDeque(dates.toList()) val options = SentryOptions().apply { @@ -217,6 +214,6 @@ class SQLiteSpanInstrumentationTest { whenever(fixture.scopes.options).thenReturn(options) fixture.sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) whenever(fixture.scopes.span).thenReturn(fixture.sentryTracer) - return SQLiteSpanInstrumentation.fromFileName(":memory:", fixture.scopes) + return DriverSpans.fromFileName(":memory:", fixture.scopes) } } diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt index b405d054f03..212e3b032e4 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteConnectionTest.kt @@ -24,7 +24,7 @@ class SentrySQLiteConnectionTest { options = SentryOptions().apply { dsn = "https://key@sentry.io/proj" } whenever(scopes.options).thenReturn(options) whenever(mockConnection.prepare("SELECT 1")).thenReturn(mockStatement) - val spans = SQLiteSpanInstrumentation.fromFileName("test.db", scopes) + val spans = DriverSpans.fromFileName("test.db", scopes) return SentrySQLiteConnection(mockConnection, spans) } } @@ -41,7 +41,7 @@ class SentrySQLiteConnectionTest { @Test fun `prepare with already-wrapped statement returns same instance without re-wrapping`() { val sut = fixture.getSut() - val spans = SQLiteSpanInstrumentation.fromFileName("test.db", fixture.scopes) + val spans = DriverSpans.fromFileName("test.db", fixture.scopes) val alreadyInstrumented = SentrySQLiteStatement(fixture.mockStatement, spans, "SELECT 1") whenever(fixture.mockConnection.prepare("SELECT 1")).thenReturn(alreadyInstrumented) diff --git a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt index ce2c3f00cd5..bc6b074545a 100644 --- a/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt +++ b/sentry-android-sqlite/src/test/java/io/sentry/sqlite/SentrySQLiteStatementTest.kt @@ -19,7 +19,7 @@ class SentrySQLiteStatementTest { private class Fixture { val mockStatement = mock() - val mockSpans = mock() + val mockSpans = mock() val startTimestampNanos = 1_000_000_000_000L val fakeClock = AtomicLong(0L) @@ -40,7 +40,7 @@ class SentrySQLiteStatementTest { verifyNeverCalledRecordSpan() sut.step() verify(fixture.mockSpans) - .recordSpan( + .record( eq("SELECT * FROM users"), eq(fixture.startTimestampNanos), any(), @@ -58,7 +58,7 @@ class SentrySQLiteStatementTest { assertFailsWith { sut.step() } verify(fixture.mockSpans) - .recordSpan( + .record( eq("BAD SQL"), eq(fixture.startTimestampNanos), any(), @@ -224,7 +224,7 @@ class SentrySQLiteStatementTest { sut.step() val durationCaptor = argumentCaptor() - verify(fixture.mockSpans).recordSpan(any(), any(), durationCaptor.capture(), any(), anyOrNull()) + verify(fixture.mockSpans).record(any(), any(), durationCaptor.capture(), any(), anyOrNull()) // Each step contributes its internal time (10 + 20 + 30) plus one unit from // fakeClock::getAndIncrement between before/after reads, so total is 63. assertEquals(63L, durationCaptor.firstValue) @@ -285,6 +285,6 @@ class SentrySQLiteStatementTest { } private fun verifyCalledRecordSpan(times: Int = 1) { - verify(fixture.mockSpans, times(times)).recordSpan(any(), any(), any(), any(), anyOrNull()) + verify(fixture.mockSpans, times(times)).record(any(), any(), any(), any(), anyOrNull()) } } From 05aa61daa3d25b2c82424779b5dec47c2c37556b Mon Sep 17 00:00:00 2001 From: arb Date: Fri, 19 Jun 2026 17:20:19 +0200 Subject: [PATCH 220/391] chore(samples-android): Adapt SQLite demo screen to SAGP build mode (#5568) Exposes a `BuildConfig.USE_SAGP` property from the recently introduced -PuseSagp flag ([#5538](https://github.com/getsentry/sentry-java/pull/5538)). Lets us update the SQLite screen in the Android sample app so that it swizzles between auto-instrumenting vs manually wrapping `SQLiteDriver`, depending on the whether SAGP was applied to the build. --- .../sentry-samples-android/build.gradle.kts | 12 ++ .../samples/android/sqlite/SQLiteActivity.kt | 111 +++++++++++++----- .../samples/android/sqlite/SampleDatabases.kt | 45 ++++--- 3 files changed, 112 insertions(+), 56 deletions(-) diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 74e3c3a57b8..96ded862f95 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -1,4 +1,5 @@ import com.android.build.api.artifact.SingleArtifact +import com.android.build.api.variant.BuildConfigField import com.android.build.api.variant.impl.VariantImpl import io.sentry.android.gradle.extensions.InstrumentationFeature import io.sentry.android.gradle.extensions.SentryPluginExtension @@ -135,6 +136,17 @@ android { } androidComponents.onVariants { variant -> + variant.buildConfigFields?.put( + "USE_SAGP", + providers.provider { + BuildConfigField( + type = "boolean", + value = providers.gradleProperty("useSagp").isPresent.toString(), + comment = "Whether the Sentry Android Gradle Plugin was applied", + ) + }, + ) + val taskName = "toggle${variant.name.capitalized()}NativeLogging" val toggleNativeLoggingTask = project.tasks.register(taskName) { diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt index 9a27ecda353..54334b6e407 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SQLiteActivity.kt @@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.HelpOutline @@ -45,6 +46,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TooltipBox import androidx.compose.material3.TooltipDefaults import androidx.compose.material3.rememberTooltipState +import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -70,6 +72,7 @@ import io.sentry.SpanStatus import io.sentry.TransactionContext import io.sentry.TransactionOptions import io.sentry.protocol.SentryId +import io.sentry.samples.android.BuildConfig import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -93,33 +96,45 @@ private val CONTROL_SECTION_GAP = TOGGLE_SECTION_GAP * 2 private val SECTION_HEADER_HEIGHT = 28.dp +private const val SAGP_DIRECT_DRIVER_MESSAGE = + "SAGP doesn't auto-instrument SQLiteDriver for direct use" + /** Which sentry-android-sqlite integration the demo currently targets. */ private enum class IntegrationMode( val color: Color, val segmentLabel: String, val apiName: String, - val subtitle: String, ) { - DRIVER( - SentryPurple, - "SQLiteDriver", - "SQLiteDriver", - "SentrySQLiteDriver.create(BundledSQLiteDriver)", - ), - OPEN_HELPER( - SentryPink, - "OpenHelper", - "SupportSQLiteOpenHelper", - "SentrySupportSQLiteOpenHelper.create(...)", - ), + + DRIVER(SentryPurple, "SQLiteDriver", "SQLiteDriver"), + OPEN_HELPER(SentryPink, "OpenHelper", "SupportSQLiteOpenHelper"), // Not directly-supported, but lets us verify behavior when both the DRIVER and OPEN_HELPER // integrations are used together via the SupportSQLiteDriver bridge. - BRIDGE( - SentryOrange, - "Bridge", - "SupportSQLiteDriver bridge", - "SentrySQLiteDriver.create(SupportSQLiteDriver(Sentry helper))", - ), + BRIDGE(SentryOrange, "Bridge", "SupportSQLiteDriver bridge"); + + fun subtitle(): String = + when (this) { + DRIVER -> + if (BuildConfig.USE_SAGP) { + "BundledSQLiteDriver (SAGP auto-wrap)" + } else { + "SentrySQLiteDriver.create(BundledSQLiteDriver)" + } + + OPEN_HELPER -> + if (BuildConfig.USE_SAGP) { + "FrameworkSQLiteOpenHelperFactory (SAGP auto-wrap)" + } else { + "SentrySupportSQLiteOpenHelper.create(...)" + } + + BRIDGE -> + if (BuildConfig.USE_SAGP) { + "SupportSQLiteDriver(open helper) (SAGP auto-wrap)" + } else { + "SentrySQLiteDriver.create(SupportSQLiteDriver(Sentry helper))" + } + } } /** @@ -318,6 +333,7 @@ class SQLiteActivity : ComponentActivity() { lerp(MaterialTheme.colorScheme.outline, integration.color, shimmer.value) Text(text = "SQLite Instrumentation", style = MaterialTheme.typography.headlineSmall) + SagpBuildPill() Spacer(Modifier.height(titleGap)) @@ -364,6 +380,7 @@ class SQLiteActivity : ComponentActivity() { label = row.label, color = integration.color, variant = variant, + sagpDisabledReason = sagpDisabledReason(integration, row), disabledReason = "${row.label} doesn't support the ${integration.apiName} stack", ) } @@ -447,7 +464,7 @@ class SQLiteActivity : ComponentActivity() { } @OptIn(ExperimentalMaterial3Api::class) - @androidx.compose.runtime.Composable + @Composable private fun IntegrationModeSelector( selected: IntegrationMode, onSelected: (IntegrationMode) -> Unit, @@ -471,18 +488,36 @@ class SQLiteActivity : ComponentActivity() { } Text( - text = selected.subtitle, + text = selected.subtitle(), style = MaterialTheme.typography.bodySmall, color = Color.Gray, modifier = Modifier.padding(top = 6.dp), ) } + @Composable + private fun SagpBuildPill() { + val useSagp = BuildConfig.USE_SAGP + + Surface( + shape = RoundedCornerShape(percent = 50), + color = if (useSagp) SentryPurple.copy(alpha = 0.15f) else Color.Gray.copy(alpha = 0.2f), + modifier = Modifier.padding(top = 6.dp), + ) { + Text( + text = if (useSagp) "Built with SAGP" else "Built without SAGP", + style = MaterialTheme.typography.labelSmall, + color = if (useSagp) SentryPurple else Color.DarkGray, + modifier = Modifier.padding(horizontal = 10.dp, vertical = 4.dp), + ) + } + } + /** * A compact, left-justified labeled switch. [labelColor] defaults to [Color.Unspecified] so the * label inherits the default text color. */ - @androidx.compose.runtime.Composable + @Composable private fun ToggleRow( label: String, checked: Boolean, @@ -509,11 +544,11 @@ class SQLiteActivity : ComponentActivity() { } } - @androidx.compose.runtime.Composable + @Composable private fun SectionHeader( title: String, topPadding: Dp = 8.dp, - trailing: (@androidx.compose.runtime.Composable () -> Unit)? = null, + trailing: (@Composable () -> Unit)? = null, ) { Column(modifier = Modifier.fillMaxWidth().padding(top = topPadding)) { Row(verticalAlignment = Alignment.CenterVertically) { @@ -529,7 +564,7 @@ class SQLiteActivity : ComponentActivity() { * tooltip that auto-dismisses after a few seconds. */ @OptIn(ExperimentalMaterial3Api::class) - @androidx.compose.runtime.Composable + @Composable private fun HelpTooltip() { val tooltipState = rememberTooltipState(isPersistent = true) val scope = rememberCoroutineScope() @@ -565,16 +600,19 @@ class SQLiteActivity : ComponentActivity() { * dimmed and, when clicked, explains why via a toast ([disabledReason]) instead of running. */ @OptIn(ExperimentalFoundationApi::class) - @androidx.compose.runtime.Composable + @Composable private fun DemoRowButton( label: String, color: Color, variant: DemoVariant?, + sagpDisabledReason: String?, disabledReason: String, ) { val context = LocalContext.current - val enabled = variant != null - val explain = { Toast.makeText(context, disabledReason, Toast.LENGTH_SHORT).show() } + val enabled = variant != null && sagpDisabledReason == null + val explain = { + Toast.makeText(context, sagpDisabledReason ?: disabledReason, Toast.LENGTH_SHORT).show() + } Surface( modifier = Modifier.fillMaxWidth(), @@ -585,8 +623,8 @@ class SQLiteActivity : ComponentActivity() { Box( modifier = Modifier.combinedClickable( - onClick = { if (variant != null) onTap(variant) else explain() }, - onLongClick = { if (variant != null) onLongPress(variant) else explain() }, + onClick = { if (enabled) onTap(variant) else explain() }, + onLongClick = { if (enabled) onLongPress(variant) else explain() }, ) .fillMaxWidth() .heightIn(min = 44.dp) @@ -598,7 +636,7 @@ class SQLiteActivity : ComponentActivity() { } } - @androidx.compose.runtime.Composable + @Composable private fun ResetButton(dbOperationInFlight: Boolean, resetInProgress: Boolean) { // Debounce demo-driven disablement so fast taps don't flicker the button; reset disables // immediately via [resetInProgress]. [dbOperationInFlight] still guards [onClick] either way. @@ -642,7 +680,7 @@ class SQLiteActivity : ComponentActivity() { } } - @androidx.compose.runtime.Composable + @Composable private fun DetailField(label: String, value: String, borderColor: Color) { OutlinedTextField( value = value, @@ -699,6 +737,15 @@ class SQLiteActivity : ComponentActivity() { } } + private fun sagpDisabledReason(mode: IntegrationMode, row: DemoRow): String? { + if (!BuildConfig.USE_SAGP) return null + val demo = row.variantFor(mode)?.demo ?: return null + return when (demo) { + SqlDemo.DRIVER_DIRECT -> SAGP_DIRECT_DRIVER_MESSAGE + else -> null + } + } + /** Closes + deletes every demo database file (via [SampleDatabases]), then re-warms them. */ private suspend fun resetDatabases(): String { val cleared = SampleDatabases.reset(applicationContext) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt index 19b292cd91e..f01a529499d 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt @@ -5,6 +5,7 @@ import android.util.Log import androidx.room.Room import androidx.room3.Room as Room3 import androidx.sqlite.SQLiteConnection +import androidx.sqlite.SQLiteDriver import androidx.sqlite.db.SupportSQLiteDatabase import androidx.sqlite.db.SupportSQLiteOpenHelper import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory @@ -13,6 +14,7 @@ import androidx.sqlite.driver.bundled.BundledSQLiteDriver import androidx.sqlite.execSQL import app.cash.sqldelight.driver.android.AndroidSqliteDriver import io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper +import io.sentry.samples.android.BuildConfig import io.sentry.samples.android.sqlite.SampleDatabases.driverDirectLock import io.sentry.samples.android.sqlite.SampleDatabases.openHelperDirectLock import io.sentry.samples.android.sqlite.SampleDatabases.reset @@ -85,12 +87,10 @@ object SampleDatabases { fun driverConnection(context: Context): SQLiteConnection = synchronized(driverDirectLock) { driverConnection - ?: SentrySQLiteDriver.create(BundledSQLiteDriver()) - .open(databaseFile(context, "driver_direct.db")) - .also { - it.execSQL(SqlStatements.CREATE_SONG) // one-time table setup, at open - driverConnection = it - } + ?: wrapDriver(BundledSQLiteDriver()).open(databaseFile(context, "driver_direct.db")).also { + it.execSQL(SqlStatements.CREATE_SONG) // one-time table setup, at open + driverConnection = it + } } /** @@ -104,7 +104,7 @@ object SampleDatabases { // SupportSQLiteDriver.open() requires fileName to match the helper's databaseName(); // use the absolute path Room and the direct driver path both pass to open(). val dbPath = databaseFile(context, "bridge_direct.db") - SentrySQLiteDriver.create(SupportSQLiteDriver(buildBridgeDirectHelper(context, dbPath))) + wrapDriver(SupportSQLiteDriver(buildBridgeDirectHelper(context, dbPath))) .open(dbPath) .also { it.execSQL(SqlStatements.CREATE_SONG) @@ -122,9 +122,7 @@ object SampleDatabases { "bridge_room2.db", ) .setDriver( - SentrySQLiteDriver.create( - SupportSQLiteDriver(buildBridgeRoom2Helper(context.applicationContext)) - ) + wrapDriver(SupportSQLiteDriver(buildBridgeRoom2Helper(context.applicationContext))) ) .setQueryCoroutineContext(Dispatchers.IO) .fallbackToDestructiveMigration(true) @@ -140,7 +138,7 @@ object SampleDatabases { SampleRoom2Database::class.java, "driver_room2.db", ) - .setDriver(SentrySQLiteDriver.create(BundledSQLiteDriver())) + .setDriver(wrapDriver(BundledSQLiteDriver())) .setQueryCoroutineContext(Dispatchers.IO) .fallbackToDestructiveMigration(true) .build() @@ -151,7 +149,7 @@ object SampleDatabases { synchronized(this) { driverRoom3Db ?: Room3.databaseBuilder(context.applicationContext, "driver_room3.db") - .setDriver(SentrySQLiteDriver.create(BundledSQLiteDriver())) + .setDriver(wrapDriver(BundledSQLiteDriver())) .setQueryCoroutineContext(Dispatchers.IO) .build() .also { driverRoom3Db = it } @@ -171,9 +169,7 @@ object SampleDatabases { "openhelper_room.db", ) .openHelperFactory { configuration -> - SentrySupportSQLiteOpenHelper.create( - FrameworkSQLiteOpenHelperFactory().create(configuration) - ) + wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) } .fallbackToDestructiveMigration(true) .build() @@ -189,9 +185,7 @@ object SampleDatabases { name = "openhelper_sqldelight.db", factory = SupportSQLiteOpenHelper.Factory { configuration -> - SentrySupportSQLiteOpenHelper.create( - FrameworkSQLiteOpenHelperFactory().create(configuration) - ) + wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) }, ) .also { sqlDelightDriver = it } @@ -232,9 +226,7 @@ object SampleDatabases { } ) .build() - return SentrySupportSQLiteOpenHelper.create( - FrameworkSQLiteOpenHelperFactory().create(configuration) - ) + return wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) } private fun buildSentryHelper(context: Context, dbName: String): SupportSQLiteOpenHelper { @@ -252,17 +244,22 @@ object SampleDatabases { } ) .build() - return SentrySupportSQLiteOpenHelper.create( - FrameworkSQLiteOpenHelperFactory().create(configuration) - ) + return wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) } + private fun wrapDriver(driver: SQLiteDriver): SQLiteDriver = + if (BuildConfig.USE_SAGP) driver else SentrySQLiteDriver.create(driver) + + private fun wrapOpenHelper(delegate: SupportSQLiteOpenHelper): SupportSQLiteOpenHelper = + if (BuildConfig.USE_SAGP) delegate else SentrySupportSQLiteOpenHelper.create(delegate) + /** Opens every database on a background thread, forcing the one-time open + bootstrap to run. */ fun warmUp(context: Context) { val appContext = context.applicationContext val generation = ++warmUpGeneration warmUpComplete = false warmUpErrors = "" + Log.i(TAG, "Warm-up starting (USE_SAGP=${BuildConfig.USE_SAGP})") // Fire-and-forget: the warm-up outlives no particular screen, so a bare scope is fine here. warmUpJob = CoroutineScope(Dispatchers.IO).launch { From 0c118e902e8632b9fc107e8063613ea19fd11e70 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Mon, 22 Jun 2026 11:02:52 +0200 Subject: [PATCH 221/391] feat(android): Report app start reason as `app.vitals.start.reason` on standalone app start transaction (#5552) * feat(android): Report app start reason on standalone app start transaction Read ApplicationStartInfo.getReason() (API 35+) and attach it as app.start.reason trace data on the standalone app.start transaction in both the foreground and headless paths. Co-Authored-By: Claude Opus 4.8 (1M context) * feat(android): Register StandaloneAppStart SDK integration marker Advertise that standalone app start tracing is active by adding a StandaloneAppStart marker to the SDK metadata integrations when the feature is enabled. Internal SDK metadata only. Co-Authored-By: Claude Opus 4.8 (1M context) * docs(changelog): Note app.start.reason is searchable in Trace Explorer Address review feedback to mention that customers can search and group by the app.vitals.start.reason attribute. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../api/sentry-android-core.api | 2 + .../core/ActivityLifecycleIntegration.java | 10 +++ .../core/performance/AppStartMetrics.java | 45 ++++++++++++ .../core/ActivityLifecycleIntegrationTest.kt | 71 +++++++++++++++++++ .../performance/AppStartMetricsTestApi35.kt | 42 +++++++++++ 6 files changed, 171 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3bdcd38bc4..5d9d4dddac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Emits a transaction named `App Start` with op `app.start`, carrying the existing app start measurements and phase spans (`process.load`, `contentprovider.load`, `application.load`, activity lifecycle spans) as direct children of the root - The standalone transaction shares the same `traceId` as the first `ui.load` activity transaction so they remain linked in the trace view - Also covers non-activity starts (broadcast receivers, services, content providers) + - On Android 15+ (API 35), the standalone `app.start` transaction reports why the OS started the process via `app.vitals.start.reason` trace data (e.g. `launcher`, `broadcast`, `service`, `content_provider`), derived from `ApplicationStartInfo.getReason()`. You can search and group by this attribute in the Trace Explorer. ([#5552](https://github.com/getsentry/sentry-java/pull/5552)) ### Improvements diff --git a/sentry-android-core/api/sentry-android-core.api b/sentry-android-core/api/sentry-android-core.api index 0500ba44990..58325d08b5b 100644 --- a/sentry-android-core/api/sentry-android-core.api +++ b/sentry-android-core/api/sentry-android-core.api @@ -746,6 +746,7 @@ public class io/sentry/android/core/performance/AppStartMetrics : io/sentry/andr public fun getAppStartContinuousProfiler ()Lio/sentry/IContinuousProfiler; public fun getAppStartEndTime ()Lio/sentry/SentryDate; public fun getAppStartProfiler ()Lio/sentry/ITransactionProfiler; + public fun getAppStartReason ()Ljava/lang/String; public fun getAppStartSamplingDecision ()Lio/sentry/TracesSamplingDecision; public fun getAppStartSentryTraceHeader ()Ljava/lang/String; public fun getAppStartTimeSpan ()Lio/sentry/android/core/performance/TimeSpan; @@ -780,6 +781,7 @@ public class io/sentry/android/core/performance/AppStartMetrics : io/sentry/andr public fun setAppStartSentryTraceHeader (Ljava/lang/String;)V public fun setAppStartTraceId (Lio/sentry/protocol/SentryId;)V public fun setAppStartType (Lio/sentry/android/core/performance/AppStartMetrics$AppStartType;)V + public fun setCachedStartInfo (Landroid/app/ApplicationStartInfo;)V public fun setClassLoadedUptimeMs (J)V public fun setHeadlessAppStartListener (Lio/sentry/android/core/performance/AppStartMetrics$HeadlessAppStartListener;)V public fun shouldSendStartMeasurements ()Z diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java index 8a891926341..d70ff837178 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java @@ -71,6 +71,7 @@ public final class ActivityLifecycleIntegration static final long APP_START_TO_UI_LOAD_CONTINUATION_MAX_GAP_NANOS = TimeUnit.MINUTES.toNanos(1); private static final String TRACE_ORIGIN = "auto.ui.activity"; static final String APP_START_SCREEN_DATA = "app.vitals.start.screen"; + static final String APP_START_REASON_DATA = "app.vitals.start.reason"; static final String APP_START_TRACE_ORIGIN = "auto.app.start"; private final @NotNull Application application; @@ -139,6 +140,7 @@ public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions if (performanceEnabled && this.options.isEnableStandaloneAppStartTracing()) { AppStartMetrics.getInstance().setHeadlessAppStartListener(this::onHeadlessAppStart); + addIntegrationToSdkVersion("StandaloneAppStart"); } this.options.getLogger().log(SentryLevel.DEBUG, "ActivityLifecycleIntegration installed."); @@ -285,6 +287,10 @@ private void startTracing(final @NotNull Activity activity) { appStartSamplingDecision), appStartTransactionOptions); appStartTransaction.setData(APP_START_SCREEN_DATA, activityName); + final @Nullable String appStartReason = AppStartMetrics.getInstance().getAppStartReason(); + if (appStartReason != null) { + appStartTransaction.setData(APP_START_REASON_DATA, appStartReason); + } } // Continue either the foreground app.start above or an earlier headless app.start. @@ -1001,6 +1007,10 @@ private void onHeadlessAppStart() { null); final @NotNull ITransaction transaction = scopes.startTransaction(txnContext, txnOptions); + final @Nullable String appStartReason = metrics.getAppStartReason(); + if (appStartReason != null) { + transaction.setData(APP_START_REASON_DATA, appStartReason); + } metrics.setAppStartTraceId(transaction.getSpanContext().getTraceId()); // Persist trace headers so a later ui.load can share traceId and sampleRand. metrics.setAppStartSentryTraceHeader(transaction.toSentryTrace().getValue()); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java index d8cb0827ba4..36cae8686ca 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java @@ -166,6 +166,45 @@ public void setAppStartType(final @NotNull AppStartType appStartType) { return appStartType; } + /** + * The reason the OS started the process, mapped from {@link ApplicationStartInfo#getReason()}. + * Only available on API 35+ (when {@link #cachedStartInfo} was resolved); returns {@code null} + * otherwise or for an unmapped reason. + */ + public @Nullable String getAppStartReason() { + if (cachedStartInfo == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { + return null; + } + switch (cachedStartInfo.getReason()) { + case ApplicationStartInfo.START_REASON_ALARM: + return "alarm"; + case ApplicationStartInfo.START_REASON_BACKUP: + return "backup"; + case ApplicationStartInfo.START_REASON_BOOT_COMPLETE: + return "boot_complete"; + case ApplicationStartInfo.START_REASON_BROADCAST: + return "broadcast"; + case ApplicationStartInfo.START_REASON_CONTENT_PROVIDER: + return "content_provider"; + case ApplicationStartInfo.START_REASON_JOB: + return "job"; + case ApplicationStartInfo.START_REASON_LAUNCHER: + return "launcher"; + case ApplicationStartInfo.START_REASON_LAUNCHER_RECENTS: + return "launcher_recents"; + case ApplicationStartInfo.START_REASON_PUSH: + return "push"; + case ApplicationStartInfo.START_REASON_SERVICE: + return "service"; + case ApplicationStartInfo.START_REASON_START_ACTIVITY: + return "start_activity"; + case ApplicationStartInfo.START_REASON_OTHER: + return "other"; + default: + return null; + } + } + public boolean isAppLaunchedInForeground() { return appLaunchedInForeground.getValue(); } @@ -372,6 +411,12 @@ public void setClassLoadedUptimeMs(final long classLoadedUptimeMs) { CLASS_LOADED_UPTIME_MS = classLoadedUptimeMs; } + @TestOnly + @ApiStatus.Internal + public void setCachedStartInfo(final @Nullable ApplicationStartInfo cachedStartInfo) { + this.cachedStartInfo = cachedStartInfo; + } + /** * Called by instrumentation * diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt index 19f43432bef..8b842a0cfa9 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt @@ -4,6 +4,7 @@ import android.app.Activity import android.app.ActivityManager import android.app.ActivityManager.RunningAppProcessInfo import android.app.Application +import android.app.ApplicationStartInfo import android.content.Context import android.os.Build import android.os.Bundle @@ -274,6 +275,76 @@ class ActivityLifecycleIntegrationTest { ) } + @Test + @Config(sdk = [Build.VERSION_CODES.VANILLA_ICE_CREAM]) + fun `Standalone app start transaction carries app start reason when available`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + + setAppStartTime() + val startInfo = + mock().apply { + whenever(reason).thenReturn(ApplicationStartInfo.START_REASON_LAUNCHER) + } + AppStartMetrics.getInstance().setCachedStartInfo(startInfo) + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + val appStartTransaction = + fixture.createdTransactions.single { + it.spanContext.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP + } + assertEquals("launcher", appStartTransaction.getData("app.vitals.start.reason")) + } + + @Test + fun `Standalone app start transaction has no app start reason when unavailable`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + + setAppStartTime() + + val activity = mock() + sut.onActivityCreated(activity, fixture.bundle) + + val appStartTransaction = + fixture.createdTransactions.single { + it.spanContext.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP + } + assertNull(appStartTransaction.getData("app.vitals.start.reason")) + } + + @Test + @Config(sdk = [Build.VERSION_CODES.VANILLA_ICE_CREAM]) + fun `Headless standalone app start transaction carries app start reason when available`() { + val sut = + fixture.getSut { + it.tracesSampleRate = 1.0 + it.isEnableStandaloneAppStartTracing = true + } + sut.register(fixture.scopes, fixture.options) + prepareHeadlessAppStart(appStartType = AppStartType.COLD) + val startInfo = + mock().apply { + whenever(reason).thenReturn(ApplicationStartInfo.START_REASON_BROADCAST) + } + AppStartMetrics.getInstance().setCachedStartInfo(startInfo) + + driveHeadlessAppStart() + + val transaction = fixture.createdTransactions.single() + assertEquals("broadcast", transaction.getData("app.vitals.start.reason")) + } + @Test fun `HeadlessAppStartListener is registered when standalone flag is on and performance enabled`() { val sut = diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt index 30686852156..b5d87ab77cb 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt @@ -15,6 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertNull import org.junit.Before import org.junit.runner.RunWith import org.mockito.kotlin.mock @@ -207,6 +208,47 @@ class AppStartMetricsTestApi35 { assertEquals(1, listenerCalls.get()) } + @Test + fun `getAppStartReason maps ApplicationStartInfo reason to string on API 35`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + whenever(mockStartInfo.reason).thenReturn(ApplicationStartInfo.START_REASON_BROADCAST) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + val metrics = AppStartMetrics.getInstance() + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + + assertEquals("broadcast", metrics.appStartReason) + } + + @Test + fun `getAppStartReason returns null when no ApplicationStartInfo is available`() { + SentryShadowActivityManager.setHistoricalProcessStartReasons(emptyList()) + val metrics = AppStartMetrics.getInstance() + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + + assertNull(metrics.appStartReason) + } + + @Test + fun `getAppStartReason returns null for an unmapped reason`() { + val mockStartInfo = mock() + whenever(mockStartInfo.startupState).thenReturn(ApplicationStartInfo.STARTUP_STATE_STARTED) + whenever(mockStartInfo.startType).thenReturn(ApplicationStartInfo.START_TYPE_COLD) + whenever(mockStartInfo.reason).thenReturn(Int.MAX_VALUE) + SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) + val metrics = AppStartMetrics.getInstance() + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + + assertNull(metrics.appStartReason) + } + private fun waitForMainLooperIdle() { Handler(Looper.getMainLooper()).post {} Shadows.shadowOf(Looper.getMainLooper()).idle() From f037273666b1f288823a4d6a135dcf517dd61468 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 22 Jun 2026 14:00:00 +0200 Subject: [PATCH 222/391] fix(replay): Release MediaMuxer when no frames are encoded (#5583) * fix(replay): Release MediaMuxer when no frames are encoded The MediaMuxer is created when the video encoder is constructed, but its release() was reachable only on the happy path. Two cases leaked it: - createVideoOf returned early when frameCount was 0 without releasing the encoder. - SimpleMp4FrameMuxer.release() called muxer.stop() before muxer.release(). stop() throws if the muxer was never started (no frame ever muxed), so release() was skipped. This surfaced as a CloseGuard "resource was acquired but never released" warning. Guard stop() behind the started flag so release() is always reached, and release the encoder on the no-frames return path. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 6 ++++++ .../src/main/java/io/sentry/android/replay/ReplayCache.kt | 4 ++++ .../io/sentry/android/replay/video/SimpleMp4FrameMuxer.kt | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d9d4dddac0..8d66d755a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583)) + ## 8.44.1 ### Fixes diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayCache.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayCache.kt index 32e42dafac1..b3b9edae055 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayCache.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayCache.kt @@ -199,6 +199,10 @@ public class ReplayCache(private val options: SentryOptions, private val replayI if (frameCount == 0) { options.logger.log(DEBUG, "Generated a video with no frames, not capturing a replay segment") + encoderLock.acquire().use { + encoder?.release() + encoder = null + } deleteFile(videoFile) return null } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleMp4FrameMuxer.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleMp4FrameMuxer.kt index 36741686701..e32af9bb44b 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleMp4FrameMuxer.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleMp4FrameMuxer.kt @@ -67,7 +67,11 @@ internal class SimpleMp4FrameMuxer(path: String, fps: Float) : SimpleFrameMuxer } override fun release() { - muxer.stop() + // stop() throws if the muxer was never started (e.g. no frame was ever muxed), so we guard it + // to ensure release() is always reached and the underlying resources are freed + if (started) { + muxer.stop() + } muxer.release() } From 57d359a2dee07eb48c5b2f6fad04d540af7fe407 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 22 Jun 2026 14:21:24 +0200 Subject: [PATCH 223/391] docs(replay): Add THIRD_PARTY_NOTICES entry for SimpleMp4FrameMuxer (#5586) * docs(replay): Add THIRD_PARTY_NOTICES entry for SimpleMp4FrameMuxer SimpleMp4FrameMuxer is adapted from the flutter_screen_recorder library and carries a complete attribution header, but the corresponding entry in THIRD_PARTY_NOTICES.md was never added. Warden's check-code-attribution flags the missing entry as independently required regardless of header completeness. Co-Authored-By: Claude Opus 4.8 (1M context) * docs(replay): Cover all adapted flutter_screen_recorder and Curtains files SimpleFrameMuxer and SimpleVideoEncoder are adapted from the same flutter_screen_recorder library as SimpleMp4FrameMuxer; fold all three into one notice entry. Also extend the existing Square Curtains scope to list io.sentry.android.replay.Windows, which is adapted from Curtains but was not mentioned. Co-Authored-By: Claude Opus 4.8 (1M context) * fix(replay): Correct adapted-from URL in SimpleVideoEncoder header The attribution header pointed at the upstream SimpleFrameMuxer.kt instead of SimpleVideoEncoder.kt. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- THIRD_PARTY_NOTICES.md | 39 ++++++++++++++++++- .../replay/video/SimpleVideoEncoder.kt | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index c1fa7e8f65b..925add4a71a 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -154,7 +154,7 @@ limitations under the License. ### Scope -The Sentry Java SDK includes an adapted version of Square's Curtains library for null-safe `Window.Callback` handling. The code resides in `io.sentry.android.replay.util.FixedWindowCallback`. +The Sentry Java SDK includes adapted versions of Square's Curtains library for null-safe `Window.Callback` handling and for tracking attached window roots. The code resides in `io.sentry.android.replay.util.FixedWindowCallback` and `io.sentry.android.replay.Windows`. ``` Copyright 2021 Square Inc. @@ -513,3 +513,40 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` + +--- + +## fzyzcjy — Flutter Screen Recorder (MIT) + +**Source:** https://github.com/fzyzcjy/flutter_screen_recorder (Commit: dce41cec25c66baf42c6bac4198e95874ce3eb9d)
+**License:** MIT License
+**Copyright:** Copyright (c) 2021 fzyzcjy + +### Scope + +The Sentry Android Replay SDK includes adapted versions of the video encoding and muxing classes from the flutter_screen_recorder library, used to encode and mux replay video frames into an MP4 file. The code resides in the `io.sentry.android.replay.video` package and includes `SimpleFrameMuxer`, `SimpleMp4FrameMuxer`, and `SimpleVideoEncoder`. + +``` +Copyright (c) 2021 fzyzcjy + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +In addition to the standard MIT license, this library requires the following: The recorder itself +only saves data on user's phone locally, thus it does not have any privacy problem. However, if +you are going to get the records out of the local storage (e.g. upload the records to your +server), please explicitly ask the user for permission, and promise to only use the records to +debug your app. This is a part of the license of this library. +``` diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt index a400be865e7..de14aadaaab 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt @@ -1,6 +1,6 @@ /** * Adapted from - * https://github.com/fzyzcjy/flutter_screen_recorder/blob/dce41cec25c66baf42c6bac4198e95874ce3eb9d/packages/fast_screen_recorder/android/src/main/kotlin/com/cjy/fast_screen_recorder/SimpleFrameMuxer.kt + * https://github.com/fzyzcjy/flutter_screen_recorder/blob/dce41cec25c66baf42c6bac4198e95874ce3eb9d/packages/fast_screen_recorder/android/src/main/kotlin/com/cjy/fast_screen_recorder/SimpleVideoEncoder.kt * * Copyright (c) 2021 fzyzcjy * From f982bad2175a3302c67624af6ec2bd27d72a549f Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 23 Jun 2026 11:13:24 +0200 Subject: [PATCH 224/391] build(samples): Remove outputs.upToDateWhen { false } from systemTest tasks (#5522) * build(samples): Remove outputs.upToDateWhen { false } from systemTest tasks The systemTest tasks in the sample modules forced Gradle to always treat their outputs as out of date, disabling up-to-date checks and build cache reuse. Removing this lets Gradle rely on its normal input/output tracking for the Test tasks. Co-Authored-By: Claude Opus 4.8 (1M context) * build(samples): Track systemTest app archive via convention plugin The system tests launch the packaged sample (war/shadowJar/bootJar) from build/libs as a separate process, so the archive is a real input to the systemTest task even though it is not on the test classpath. Without it, removing outputs.upToDateWhen { false } would let Gradle mark systemTest up-to-date while a separate jar build refreshed the artifact, skipping verification against the rebuilt sample. Move that wiring into a single io.sentry.systemtest convention plugin in build-logic instead of repeating it in every sample build file. The plugin auto-detects the packaging task (war, else shadowJar, else bootJar), mirroring the selection in test/system-test-runner.py, and declares its archive as an input and dependency. Each sample just applies the plugin. Co-Authored-By: Claude Opus 4.8 (1M context) * build(samples): Track OpenTelemetry agent jar as systemTest input The agent-based OpenTelemetry samples are launched by the runner with -javaagent:, started outside the test JVM. That jar is not on the test classpath nor one of the app archives, so without tracking it systemTest could stay up-to-date and be skipped while the runner launches a newer agent. Add a usesOpenTelemetryAgent opt-in to the io.sentry.systemtest plugin; the three agent samples enable it and the agent jar is then tracked as a content input. The runner already builds and launches the agent before invoking the task, so it is tracked by path without a cross-project task dependency, which keeps it configuration-on-demand and configuration cache compatible. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- .../kotlin/io.sentry.systemtest.gradle.kts | 38 +++++++++++++++++++ .../io/sentry/gradle/SystemTestExtension.kt | 17 +++++++++ .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../sentry-samples-console/build.gradle.kts | 3 +- .../sentry-samples-jul/build.gradle.kts | 3 +- .../sentry-samples-log4j2/build.gradle.kts | 3 +- .../sentry-samples-logback/build.gradle.kts | 3 +- .../sentry-samples-spring-7/build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 6 ++- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 6 ++- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 6 ++- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- .../sentry-samples-spring/build.gradle.kts | 3 +- 24 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 build-logic/src/main/kotlin/io.sentry.systemtest.gradle.kts create mode 100644 build-logic/src/main/kotlin/io/sentry/gradle/SystemTestExtension.kt diff --git a/build-logic/src/main/kotlin/io.sentry.systemtest.gradle.kts b/build-logic/src/main/kotlin/io.sentry.systemtest.gradle.kts new file mode 100644 index 00000000000..a21079e1336 --- /dev/null +++ b/build-logic/src/main/kotlin/io.sentry.systemtest.gradle.kts @@ -0,0 +1,38 @@ +import io.sentry.gradle.SystemTestExtension +import org.gradle.api.tasks.ClasspathNormalizer + +val systemTest = extensions.create("sentrySystemTest") + +// The sample system tests launch the packaged app (war/shadowJar/bootJar) from build/libs as a +// separate process, so the archive is a real input even though it is not on the test classpath. +// Agent-based samples are additionally launched with -javaagent:, another runtime +// input not on the classpath. See test/system-test-runner.py. +tasks.matching { it.name == "systemTest" }.configureEach { + val archiveTask = + listOf("war", "shadowJar", "bootJar").firstOrNull { it in tasks.names } + ?: throw GradleException( + "io.sentry.systemtest is applied to $path but none of war/shadowJar/bootJar " + + "exist to provide the launched app archive for the systemTest task" + ) + // Declaring the archive as an input also wires the dependency on its producing task. + inputs + .files(tasks.named(archiveTask)) + .withPropertyName("appArchive") + .withNormalizer(ClasspathNormalizer::class.java) + + if (systemTest.usesOpenTelemetryAgent.get()) { + // The runner builds the agent and launches the app with -javaagent before invoking this task, + // so the agent jar is tracked for content only (by path, no cross-project task dependency): a + // change to it makes systemTest out of date even though it runs outside the test JVM. + val version = providers.gradleProperty("versionName").get() + inputs + .files( + rootProject.layout.projectDirectory.file( + "sentry-opentelemetry/sentry-opentelemetry-agent/build/libs/" + + "sentry-opentelemetry-agent-$version.jar" + ) + ) + .withPropertyName("openTelemetryAgent") + .withNormalizer(ClasspathNormalizer::class.java) + } +} diff --git a/build-logic/src/main/kotlin/io/sentry/gradle/SystemTestExtension.kt b/build-logic/src/main/kotlin/io/sentry/gradle/SystemTestExtension.kt new file mode 100644 index 00000000000..9111ce17b1f --- /dev/null +++ b/build-logic/src/main/kotlin/io/sentry/gradle/SystemTestExtension.kt @@ -0,0 +1,17 @@ +package io.sentry.gradle + +import org.gradle.api.provider.Property + +/** Configuration for the `io.sentry.systemtest` convention plugin. */ +abstract class SystemTestExtension { + /** + * Set to `true` for samples that the system-test runner launches with the Sentry OpenTelemetry + * Java agent (`-javaagent`). The agent jar is then tracked as a `systemTest` input so the task + * re-runs when the agent changes, even though it is started outside the test JVM. + */ + abstract val usesOpenTelemetryAgent: Property + + init { + usesOpenTelemetryAgent.convention(false) + } +} diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts index f5d14dc2c38..9db90129958 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.console.Main") } @@ -71,8 +72,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts index 483f6bea799..261894baaa0 100644 --- a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.console.Main") } @@ -74,8 +75,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index 79878ab9a08..3e70e79ae71 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.console.Main") } @@ -75,8 +76,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-jul/build.gradle.kts b/sentry-samples/sentry-samples-jul/build.gradle.kts index 01e6a95f13d..310af1e7bce 100644 --- a/sentry-samples/sentry-samples-jul/build.gradle.kts +++ b/sentry-samples/sentry-samples-jul/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.jul.Main") } @@ -66,8 +67,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-log4j2/build.gradle.kts index 005e1116528..962fd56a839 100644 --- a/sentry-samples/sentry-samples-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-log4j2/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.log4j2.Main") } @@ -72,8 +73,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-logback/build.gradle.kts b/sentry-samples/sentry-samples-logback/build.gradle.kts index 05f96c346a8..1a7f3a23875 100644 --- a/sentry-samples/sentry-samples-logback/build.gradle.kts +++ b/sentry-samples/sentry-samples-logback/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.gradle.versions) alias(libs.plugins.shadow) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.logback.Main") } @@ -66,8 +67,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-7/build.gradle.kts b/sentry-samples/sentry-samples-spring-7/build.gradle.kts index e3300cd2841..3e108aabd1e 100644 --- a/sentry-samples/sentry-samples-spring-7/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-7/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.kotlin.spring) id("war") alias(libs.plugins.gretty) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring7.Main") } @@ -77,8 +78,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index 64ef57692c3..722788830f1 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-4" @@ -90,8 +91,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index e12b960e0fd..b9551ffcf74 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-4" @@ -110,6 +111,9 @@ tasks.register("bootRunWithAgent").configure { jvmArgs = listOf("-Dotel.javaagent.debug=true", "-javaagent:$agentJarPath") } +// The runner launches this sample with -javaagent, so track the agent jar as a systemTest input. +sentrySystemTest { usesOpenTelemetryAgent = true } + tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" @@ -118,8 +122,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index 7329d5cc0ea..d793201d4c0 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-4-otlp" @@ -91,8 +92,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index a311b8a972e..6d8d3c81e09 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-4-webflux" @@ -70,8 +71,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index cdb33ecc675..4e463671a78 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-4" @@ -92,8 +93,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index 7966e621ebd..553affc3620 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-jakarta" @@ -95,8 +96,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index 3c7e00ae552..e4fefab7de7 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-jakarta" @@ -120,6 +121,9 @@ tasks.register("bootRunWithAgent").configure { jvmArgs = listOf("-Dotel.javaagent.debug=true", "-javaagent:$agentJarPath") } +// The runner launches this sample with -javaagent, so track the agent jar as a systemTest input. +sentrySystemTest { usesOpenTelemetryAgent = true } + tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" @@ -128,8 +132,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index d5e4caa595d..65850a6f2bd 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-jakarta" @@ -98,8 +99,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index 0b8c5a181e7..e32eec82ac8 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } @@ -140,8 +141,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index b78f1f01881..085d6e362af 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } @@ -154,6 +155,9 @@ tasks.register("bootRunWithAgent").configure { jvmArgs = listOf("-Dotel.javaagent.debug=true", "-javaagent:$agentJarPath") } +// The runner launches this sample with -javaagent, so track the agent jar as a systemTest input. +sentrySystemTest { usesOpenTelemetryAgent = true } + tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" @@ -162,8 +166,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts index 8b2079ddd9c..3e462517ded 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.spring.dependency.management) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } group = "io.sentry.sample.spring-boot-webflux-jakarta" @@ -72,8 +73,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts index 2127dbfd79f..8dc51e07a53 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } @@ -107,8 +108,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index 0a2a6f2da57..54fe99d56d4 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.shadow) alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.boot.SentryDemoApplication") } @@ -141,8 +142,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts index 3dec793e5c9..5fe0334a629 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.kotlin.spring) id("war") alias(libs.plugins.gretty) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.jakarta.Main") } @@ -77,8 +78,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test diff --git a/sentry-samples/sentry-samples-spring/build.gradle.kts b/sentry-samples/sentry-samples-spring/build.gradle.kts index 02e7f632450..3ab6610d96d 100644 --- a/sentry-samples/sentry-samples-spring/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.kotlin.spring) id("war") alias(libs.plugins.gretty) + id("io.sentry.systemtest") } application { mainClass.set("io.sentry.samples.spring.Main") } @@ -78,8 +79,6 @@ tasks.register("systemTest").configure { testClassesDirs = test.output.classesDirs classpath = test.runtimeClasspath - outputs.upToDateWhen { false } - maxParallelForks = 1 // Cap JVM args per test From ec5e3a55656fea8e4eec6aeff74a211df4894a6d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 23 Jun 2026 20:09:38 +0200 Subject: [PATCH 225/391] fix(android): Fix crash when getHistoricalProcessStartReasons is called from a wrong process (#5597) * fix(android): Fix crash when getHistoricalProcessStartReasons is called from a wrong process * test(android): Add test and changelog for getHistoricalProcessStartReasons crash fix Co-Authored-By: Claude Opus 4.6 (1M context) * SecurityException -> RuntimeException --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + .../core/performance/AppStartMetrics.java | 31 +++++++++++++------ .../core/SentryShadowActivityManager.kt | 7 +++++ .../performance/AppStartMetricsTestApi35.kt | 14 +++++++++ 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d66d755a7c..0c3574f1fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Fix crash when `getHistoricalProcessStartReasons` is called from an isolated or wrong-userId process ([#5597](https://github.com/getsentry/sentry-java/pull/5597)) - Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583)) ## 8.44.1 diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java index 36cae8686ca..828e103e8b6 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java @@ -11,6 +11,7 @@ import android.os.Handler; import android.os.Looper; import android.os.SystemClock; +import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -467,18 +468,28 @@ public void registerLifecycleCallbacks(final @NotNull Application application) { final @Nullable ActivityManager activityManager = (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE); if (activityManager != null) { - final List historicalProcessStartReasons = - activityManager.getHistoricalProcessStartReasons(1); - if (!historicalProcessStartReasons.isEmpty()) { - final @NotNull ApplicationStartInfo info = historicalProcessStartReasons.get(0); - cachedStartInfo = info; - if (info.getStartupState() == ApplicationStartInfo.STARTUP_STATE_STARTED) { - if (info.getStartType() == ApplicationStartInfo.START_TYPE_COLD) { - appStartType = AppStartType.COLD; - } else { - appStartType = AppStartType.WARM; + try { + final List historicalProcessStartReasons = + activityManager.getHistoricalProcessStartReasons(1); + if (!historicalProcessStartReasons.isEmpty()) { + final @NotNull ApplicationStartInfo info = historicalProcessStartReasons.get(0); + cachedStartInfo = info; + if (info.getStartupState() == ApplicationStartInfo.STARTUP_STATE_STARTED) { + if (info.getStartType() == ApplicationStartInfo.START_TYPE_COLD) { + appStartType = AppStartType.COLD; + } else { + appStartType = AppStartType.WARM; + } } } + } catch (RuntimeException ignored) { + // getHistoricalProcessStartReasons may throw different kinds of exceptions, namely: + // - SecurityException when called from an isolated process + // - IllegalArgumentException when called with a wrong userId + // - others + // See impl: + // https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java;l=10866-10893 + Log.w("AppStartMetrics", ignored); // no logger instance here, so we just Log } } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt index a959c5dd865..93cb4759e99 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryShadowActivityManager.kt @@ -12,11 +12,16 @@ class SentryShadowActivityManager { companion object { private var historicalProcessStartReasons: List = emptyList() private var importance: Int = RunningAppProcessInfo.IMPORTANCE_FOREGROUND + private var historicalProcessStartReasonsException: RuntimeException? = null fun setHistoricalProcessStartReasons(startReasons: List) { historicalProcessStartReasons = startReasons } + fun setHistoricalProcessStartReasonsException(exception: RuntimeException) { + historicalProcessStartReasonsException = exception + } + fun setImportance(importance: Int) { this.importance = importance } @@ -24,6 +29,7 @@ class SentryShadowActivityManager { fun reset() { historicalProcessStartReasons = emptyList() importance = RunningAppProcessInfo.IMPORTANCE_FOREGROUND + historicalProcessStartReasonsException = null } @Implementation @@ -35,6 +41,7 @@ class SentryShadowActivityManager { @Implementation fun getHistoricalProcessStartReasons(maxNum: Int): List { + historicalProcessStartReasonsException?.let { throw it } return historicalProcessStartReasons.take(maxNum) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt index b5d87ab77cb..0624e70b898 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt @@ -249,6 +249,20 @@ class AppStartMetricsTestApi35 { assertNull(metrics.appStartReason) } + @Test + fun `does not crash when getHistoricalProcessStartReasons throws RuntimeException`() { + SentryShadowActivityManager.setHistoricalProcessStartReasonsException( + RuntimeException("isolated process") + ) + val metrics = AppStartMetrics.getInstance() + + val app = ApplicationProvider.getApplicationContext() + metrics.registerLifecycleCallbacks(app) + + assertEquals(AppStartMetrics.AppStartType.UNKNOWN, metrics.appStartType) + assertNull(metrics.appStartReason) + } + private fun waitForMainLooperIdle() { Handler(Looper.getMainLooper()).post {} Shadows.shadowOf(Looper.getMainLooper()).idle() From 818350078b0238d8db99964f3464614643490fa5 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 24 Jun 2026 13:23:23 +0200 Subject: [PATCH 226/391] fix(replay): Fix flaky ComposeMaskingOptionsTest (#5613) The `when sentry-unmask modifier is set unmasks the node` test intermittently failed because Robolectric can report zero bounds for some nodes when running the full test class, making them invisible (shouldMask = isVisible && ...). Restructure the test to: - Explicitly find the "Make Request" node and assert it IS visible and unmasked - Assert other visible nodes remain masked, with a guard against empty iteration - Tolerate intermittent zero-bounds on non-identifiable nodes (Robolectric artifact) Validated with the repro from getsentry/repro#51: 20/20 passes (vs ~10% flake rate before the fix). Fixes #5585 Co-authored-by: Claude Opus 4.6 (1M context) --- .../ComposeMaskingOptionsTest.kt | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt index e043b035668..fe3fbc1ba67 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt @@ -228,18 +228,24 @@ class ComposeMaskingOptionsTest { val textNodes = activity.get().collectNodesOfType(options) assertEquals(4, textNodes.size) // [TextField, Text, Button, Activity Title] - textNodes.forEach { - if ((it.layout as? ComposeTextLayout)?.layout?.layoutInput?.text?.text == "Make Request") { - assertFalse( - it.shouldMask, - "Node with text ${(it.layout as? ComposeTextLayout)?.layout?.layoutInput?.text?.text} should not be masked", - ) - } else { - assertTrue( - it.shouldMask, - "Node with text ${(it.layout as? ComposeTextLayout)?.layout?.layoutInput?.text?.text} should be masked", - ) + + val unmaskNode = + textNodes.first { + (it.layout as? ComposeTextLayout)?.layout?.layoutInput?.text?.text == "Make Request" } + assertTrue(unmaskNode.isVisible, "The unmasked node must be visible for the test to be valid") + assertFalse(unmaskNode.shouldMask, "Node with sentryReplayUnmask() should not be masked") + + // Robolectric may intermittently report zero bounds for some nodes when running + // the full test class, making them invisible (shouldMask = isVisible && ...). + // Assert that all other visible nodes remain masked. + val otherVisibleNodes = textNodes.filter { it !== unmaskNode && it.isVisible } + assertTrue(otherVisibleNodes.isNotEmpty(), "Expected at least one other visible text node") + otherVisibleNodes.forEach { + assertTrue( + it.shouldMask, + "Node with text ${(it.layout as? ComposeTextLayout)?.layout?.layoutInput?.text?.text} should be masked", + ) } } From 3c89fa4c79a2af40618acffcdc84f9a98eb4aca8 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 24 Jun 2026 14:33:54 +0200 Subject: [PATCH 227/391] ci(replay): Skip snapshot upload on PRs from forks (#5621) Fork PRs don't have access to the SENTRY_AUTH_TOKEN secret, so the sentry-cli snapshot upload would fail anyway. Guard the step to run only on pushes and same-repo PRs. Co-authored-by: Claude Opus 4.8 --- .github/workflows/integration-tests-ui.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 92e29ecbef7..e271227b97e 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -78,7 +78,8 @@ jobs: run: curl -sL https://sentry.io/get-cli/ | bash - name: Upload Replay Snapshots to Sentry - if: ${{ !cancelled() && env.SAUCE_USERNAME != null }} + # Skip on PRs from forks, which don't have access to the upload secret + if: ${{ !cancelled() && env.SAUCE_USERNAME != null && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: | shopt -s globstar nullglob pngs=(artifacts/**/*.png) From 477b848f9ad9a2eac9efa22553ca3da49cf0ab68 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 24 Jun 2026 16:44:37 +0200 Subject: [PATCH 228/391] ci(build): Skip snapshot upload on PRs from forks (#5622) Fork PRs don't have access to SENTRY_AUTH_TOKEN, so the upload step would attempt to run without credentials. Guard it the same way the replay snapshot upload is guarded so fork PRs cleanly skip it. --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2ffd96f9c5..6cba7e07e0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,8 @@ jobs: run: curl -sL https://sentry.io/get-cli/ | bash - name: Upload Snapshots to Sentry + # Skip on PRs from forks, which don't have access to the upload secret + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} run: | sentry-cli build snapshots ./sentry-android-core/build/test-snapshots \ --app-id sentry-android-core From 693fc159de6b16dff56436c11b55543111b4d207 Mon Sep 17 00:00:00 2001 From: tsushanth <78000697+tsushanth@users.noreply.github.com> Date: Wed, 24 Jun 2026 08:01:18 -0700 Subject: [PATCH 229/391] fix: use System.nanoTime() for cron check-in duration measurement (#5611) * fix: use System.nanoTime() for cron check-in duration measurement System.currentTimeMillis() is a wall-clock value and is subject to NTP adjustments and DST transitions. For long-running cron jobs this can produce incorrect or even negative durations in the check-in payload. Switch the start/end capture in CheckInUtils.withCheckIn() and the three SentryCheckInAdvice implementations (sentry-spring, sentry-spring-jakarta, sentry-spring-7) to System.nanoTime(), which is guaranteed monotonic. Use DateUtils.nanosToSeconds() (already present) to convert the delta. Fixes #5579 * changelog --------- Co-authored-by: Roman Zavarnitsyn --- CHANGELOG.md | 1 + .../java/io/sentry/spring7/checkin/SentryCheckInAdvice.java | 4 ++-- .../io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java | 4 ++-- .../java/io/sentry/spring/checkin/SentryCheckInAdvice.java | 4 ++-- sentry/src/main/java/io/sentry/util/CheckInUtils.java | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c3574f1fa6..5a01e722486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Use `System.nanoTime()` for cron check-in duration measurement to avoid incorrect durations from wall-clock adjustments ([#5611](https://github.com/getsentry/sentry-java/pull/5611)) - Fix crash when `getHistoricalProcessStartReasons` is called from an isolated or wrong-userId process ([#5597](https://github.com/getsentry/sentry-java/pull/5597)) - Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583)) diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/checkin/SentryCheckInAdvice.java b/sentry-spring-7/src/main/java/io/sentry/spring7/checkin/SentryCheckInAdvice.java index 274c20ac89a..d2c164b9a6e 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/checkin/SentryCheckInAdvice.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/checkin/SentryCheckInAdvice.java @@ -91,7 +91,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl TracingUtils.startNewTrace(scopes); @Nullable SentryId checkInId = null; - final long startTime = System.currentTimeMillis(); + final long startTime = System.nanoTime(); boolean didError = false; try { @@ -105,7 +105,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl } finally { final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK; CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status); - checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); + checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime)); scopes.captureCheckIn(checkIn); } } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java index d2b93471f1c..fa64ac0e3e4 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java @@ -91,7 +91,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl TracingUtils.startNewTrace(scopes); @Nullable SentryId checkInId = null; - final long startTime = System.currentTimeMillis(); + final long startTime = System.nanoTime(); boolean didError = false; try { @@ -105,7 +105,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl } finally { final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK; CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status); - checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); + checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime)); scopes.captureCheckIn(checkIn); } } diff --git a/sentry-spring/src/main/java/io/sentry/spring/checkin/SentryCheckInAdvice.java b/sentry-spring/src/main/java/io/sentry/spring/checkin/SentryCheckInAdvice.java index 719ead46b51..a96e9e29808 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/checkin/SentryCheckInAdvice.java +++ b/sentry-spring/src/main/java/io/sentry/spring/checkin/SentryCheckInAdvice.java @@ -94,7 +94,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl TracingUtils.startNewTrace(scopes); @Nullable SentryId checkInId = null; - final long startTime = System.currentTimeMillis(); + final long startTime = System.nanoTime(); boolean didError = false; try { @@ -108,7 +108,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl } finally { final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK; CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status); - checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); + checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime)); scopes.captureCheckIn(checkIn); } } diff --git a/sentry/src/main/java/io/sentry/util/CheckInUtils.java b/sentry/src/main/java/io/sentry/util/CheckInUtils.java index 7b44fffbc35..3deea093142 100644 --- a/sentry/src/main/java/io/sentry/util/CheckInUtils.java +++ b/sentry/src/main/java/io/sentry/util/CheckInUtils.java @@ -37,7 +37,7 @@ public static U withCheckIn( try (final @NotNull ISentryLifecycleToken ignored = Sentry.forkedScopes("CheckInUtils").makeCurrent()) { final @NotNull IScopes scopes = Sentry.getCurrentScopes(); - final long startTime = System.currentTimeMillis(); + final long startTime = System.nanoTime(); boolean didError = false; TracingUtils.startNewTrace(scopes); @@ -61,7 +61,7 @@ public static U withCheckIn( if (environment != null) { checkIn.setEnvironment(environment); } - checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime)); + checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime)); scopes.captureCheckIn(checkIn); } } From 0499903a71e617bd84b2f748b25f7ca2db71f134 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 17:26:29 +0200 Subject: [PATCH 230/391] chore: update scripts/update-sentry-native-ndk.sh to 0.15.2 (#5610) Co-authored-by: GitHub --- CHANGELOG.md | 6 ++++++ gradle/libs.versions.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a01e722486..596c36b3320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ - Fix crash when `getHistoricalProcessStartReasons` is called from an isolated or wrong-userId process ([#5597](https://github.com/getsentry/sentry-java/pull/5597)) - Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583)) +### Dependencies + +- Bump Native SDK from v0.15.1 to v0.15.2 ([#5610](https://github.com/getsentry/sentry-java/pull/5610)) + - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0152) + - [diff](https://github.com/getsentry/sentry-native/compare/0.15.1...0.15.2) + ## 8.44.1 ### Fixes diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68521efdfcc..24064703ca1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -166,7 +166,7 @@ quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } retrofit-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } -sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.15.1" } +sentry-native-ndk = { module = "io.sentry:sentry-native-ndk", version = "0.15.2" } servlet-api = { module = "javax.servlet:javax.servlet-api", version = "3.1.0" } servlet-jakarta-api = { module = "jakarta.servlet:jakarta.servlet-api", version = "6.1.0" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } From f8e292e692fee3774289917409f05080b443bec3 Mon Sep 17 00:00:00 2001 From: 0xadam-brown <281682121+0xadam-brown@users.noreply.github.com> Date: Wed, 24 Jun 2026 15:30:08 +0000 Subject: [PATCH 231/391] release: 8.45.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 596c36b3320..e1a4d05122c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.45.0 ### Fixes diff --git a/gradle.properties b/gradle.properties index f2e3da3ca09..f83b851f8d9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.44.1 +versionName=8.45.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 2c01eff3d05e76446bc1264d9235077ce183fee6 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 24 Jun 2026 18:50:01 +0200 Subject: [PATCH 232/391] fix(changelog): Move app start reason to 8.45.0 (#5625) --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a4d05122c..48a1115f8ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 8.45.0 +### Features + +- On Android 15+ (API 35), the standalone `app.start` transaction now reports why the OS started the process via `app.vitals.start.reason` trace data (e.g. `launcher`, `broadcast`, `service`, `content_provider`), derived from `ApplicationStartInfo.getReason()`. You can search and group by this attribute in the Trace Explorer. ([#5552](https://github.com/getsentry/sentry-java/pull/5552)) + ### Fixes - Use `System.nanoTime()` for cron check-in duration measurement to avoid incorrect durations from wall-clock adjustments ([#5611](https://github.com/getsentry/sentry-java/pull/5611)) @@ -41,7 +45,6 @@ - Emits a transaction named `App Start` with op `app.start`, carrying the existing app start measurements and phase spans (`process.load`, `contentprovider.load`, `application.load`, activity lifecycle spans) as direct children of the root - The standalone transaction shares the same `traceId` as the first `ui.load` activity transaction so they remain linked in the trace view - Also covers non-activity starts (broadcast receivers, services, content providers) - - On Android 15+ (API 35), the standalone `app.start` transaction reports why the OS started the process via `app.vitals.start.reason` trace data (e.g. `launcher`, `broadcast`, `service`, `content_provider`), derived from `ApplicationStartInfo.getReason()`. You can search and group by this attribute in the Trace Explorer. ([#5552](https://github.com/getsentry/sentry-java/pull/5552)) ### Improvements From 6424f21f3573988056d194317e654ef11d605426 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 25 Jun 2026 10:50:50 +0200 Subject: [PATCH 233/391] build: Remove redundant test source set declarations (#5624) The line configure { test { java.srcDir("src/test/java") } } re-added Gradle's default test source directory, which is a no-op. Remove it from all 51 build files. --- sentry-apache-http-client-5/build.gradle.kts | 2 -- sentry-apollo-3/build.gradle.kts | 2 -- sentry-apollo-4/build.gradle.kts | 2 -- sentry-apollo/build.gradle.kts | 2 -- sentry-async-profiler/build.gradle.kts | 2 -- sentry-graphql-22/build.gradle.kts | 2 -- sentry-graphql-core/build.gradle.kts | 2 -- sentry-graphql/build.gradle.kts | 2 -- sentry-jcache/build.gradle.kts | 2 -- sentry-jdbc/build.gradle.kts | 2 -- sentry-jul/build.gradle.kts | 2 -- sentry-kafka/build.gradle.kts | 2 -- sentry-kotlin-extensions/build.gradle.kts | 2 -- sentry-ktor-client/build.gradle.kts | 2 -- sentry-launchdarkly-server/build.gradle.kts | 2 -- sentry-log4j2/build.gradle.kts | 2 -- sentry-logback/build.gradle.kts | 2 -- sentry-okhttp/build.gradle.kts | 2 -- sentry-openfeature/build.gradle.kts | 2 -- sentry-openfeign/build.gradle.kts | 2 -- .../sentry-opentelemetry-agentcustomization/build.gradle.kts | 2 -- .../sentry-opentelemetry-bootstrap/build.gradle.kts | 2 -- sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts | 2 -- sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts | 2 -- sentry-quartz/build.gradle.kts | 2 -- sentry-reactor/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- sentry-samples/sentry-samples-console-otlp/build.gradle.kts | 2 -- sentry-samples/sentry-samples-console/build.gradle.kts | 2 -- sentry-samples/sentry-samples-jul/build.gradle.kts | 2 -- sentry-samples/sentry-samples-log4j2/build.gradle.kts | 2 -- sentry-samples/sentry-samples-logback/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-7/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-otlp/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-webflux/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts | 2 -- sentry-servlet-jakarta/build.gradle.kts | 2 -- sentry-servlet/build.gradle.kts | 2 -- sentry-spotlight/build.gradle.kts | 2 -- sentry-spring-7/build.gradle.kts | 2 -- sentry-spring-boot-4-starter/build.gradle.kts | 2 -- sentry-spring-boot-4/build.gradle.kts | 2 -- sentry-spring-boot-jakarta/build.gradle.kts | 2 -- sentry-spring-boot-starter-jakarta/build.gradle.kts | 2 -- sentry-spring-boot-starter/build.gradle.kts | 2 -- sentry-spring-jakarta/build.gradle.kts | 2 -- sentry-system-test-support/build.gradle.kts | 2 -- sentry-test-support/build.gradle.kts | 2 -- sentry/build.gradle.kts | 2 -- 51 files changed, 102 deletions(-) diff --git a/sentry-apache-http-client-5/build.gradle.kts b/sentry-apache-http-client-5/build.gradle.kts index df93fbe8823..00916258b8f 100644 --- a/sentry-apache-http-client-5/build.gradle.kts +++ b/sentry-apache-http-client-5/build.gradle.kts @@ -33,8 +33,6 @@ dependencies { testImplementation(libs.mockito.kotlin) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-apollo-3/build.gradle.kts b/sentry-apollo-3/build.gradle.kts index 1eb71bc217a..d70085e27bd 100644 --- a/sentry-apollo-3/build.gradle.kts +++ b/sentry-apollo-3/build.gradle.kts @@ -42,8 +42,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { diff --git a/sentry-apollo-4/build.gradle.kts b/sentry-apollo-4/build.gradle.kts index 144297ddb9d..d9f41891dc1 100644 --- a/sentry-apollo-4/build.gradle.kts +++ b/sentry-apollo-4/build.gradle.kts @@ -49,8 +49,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { diff --git a/sentry-apollo/build.gradle.kts b/sentry-apollo/build.gradle.kts index c115e6b8fe3..0fc853886df 100644 --- a/sentry-apollo/build.gradle.kts +++ b/sentry-apollo/build.gradle.kts @@ -43,8 +43,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { diff --git a/sentry-async-profiler/build.gradle.kts b/sentry-async-profiler/build.gradle.kts index ef000b465a1..17093fe6a09 100644 --- a/sentry-async-profiler/build.gradle.kts +++ b/sentry-async-profiler/build.gradle.kts @@ -36,8 +36,6 @@ dependencies { testImplementation(libs.mockito.inline) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-graphql-22/build.gradle.kts b/sentry-graphql-22/build.gradle.kts index c36ca09856d..3c0667fd0d4 100644 --- a/sentry-graphql-22/build.gradle.kts +++ b/sentry-graphql-22/build.gradle.kts @@ -41,8 +41,6 @@ dependencies { testImplementation("com.netflix.graphql.dgs:graphql-error-types:4.9.2") } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-graphql-core/build.gradle.kts b/sentry-graphql-core/build.gradle.kts index d625c31dea6..62635ded34e 100644 --- a/sentry-graphql-core/build.gradle.kts +++ b/sentry-graphql-core/build.gradle.kts @@ -40,8 +40,6 @@ dependencies { testImplementation("com.netflix.graphql.dgs:graphql-error-types:4.9.2") } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-graphql/build.gradle.kts b/sentry-graphql/build.gradle.kts index 68efbc7389e..30000655079 100644 --- a/sentry-graphql/build.gradle.kts +++ b/sentry-graphql/build.gradle.kts @@ -41,8 +41,6 @@ dependencies { testImplementation("com.netflix.graphql.dgs:graphql-error-types:4.9.2") } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jcache/build.gradle.kts b/sentry-jcache/build.gradle.kts index 2c476dbd007..1cc3b6e0e3d 100644 --- a/sentry-jcache/build.gradle.kts +++ b/sentry-jcache/build.gradle.kts @@ -36,8 +36,6 @@ dependencies { testImplementation(libs.mockito.inline) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jdbc/build.gradle.kts b/sentry-jdbc/build.gradle.kts index 8a7808530b1..1e86048053e 100644 --- a/sentry-jdbc/build.gradle.kts +++ b/sentry-jdbc/build.gradle.kts @@ -34,8 +34,6 @@ dependencies { testImplementation(libs.mockito.inline) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-jul/build.gradle.kts b/sentry-jul/build.gradle.kts index b59a1481d19..66c46bcee21 100644 --- a/sentry-jul/build.gradle.kts +++ b/sentry-jul/build.gradle.kts @@ -33,8 +33,6 @@ dependencies { testImplementation(libs.slf4j.api) } -configure { test { java.srcDir("src/test/java") } } - tasks { test { // used to test io.sentry.jul.SentryHandler diff --git a/sentry-kafka/build.gradle.kts b/sentry-kafka/build.gradle.kts index 603014f9af9..ef1ff252468 100644 --- a/sentry-kafka/build.gradle.kts +++ b/sentry-kafka/build.gradle.kts @@ -33,8 +33,6 @@ dependencies { testImplementation(libs.kafka.clients) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-kotlin-extensions/build.gradle.kts b/sentry-kotlin-extensions/build.gradle.kts index 5092976de32..8c4312641a8 100644 --- a/sentry-kotlin-extensions/build.gradle.kts +++ b/sentry-kotlin-extensions/build.gradle.kts @@ -37,8 +37,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } tasks.withType().configureEach { diff --git a/sentry-ktor-client/build.gradle.kts b/sentry-ktor-client/build.gradle.kts index 745acaa11fb..647563cc1d1 100644 --- a/sentry-ktor-client/build.gradle.kts +++ b/sentry-ktor-client/build.gradle.kts @@ -44,8 +44,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } buildConfig { diff --git a/sentry-launchdarkly-server/build.gradle.kts b/sentry-launchdarkly-server/build.gradle.kts index 207400676a0..370252c2154 100644 --- a/sentry-launchdarkly-server/build.gradle.kts +++ b/sentry-launchdarkly-server/build.gradle.kts @@ -37,8 +37,6 @@ dependencies { testImplementation(libs.launchdarkly.server) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-log4j2/build.gradle.kts b/sentry-log4j2/build.gradle.kts index 7d406076e2f..1c5cf94e8eb 100644 --- a/sentry-log4j2/build.gradle.kts +++ b/sentry-log4j2/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { testImplementation(libs.mockito.kotlin) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.log4j2") diff --git a/sentry-logback/build.gradle.kts b/sentry-logback/build.gradle.kts index d2084e95467..1c42a4e1c03 100644 --- a/sentry-logback/build.gradle.kts +++ b/sentry-logback/build.gradle.kts @@ -32,8 +32,6 @@ dependencies { testImplementation(libs.mockito.kotlin) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.logback") diff --git a/sentry-okhttp/build.gradle.kts b/sentry-okhttp/build.gradle.kts index ea831f174cc..d547720c174 100644 --- a/sentry-okhttp/build.gradle.kts +++ b/sentry-okhttp/build.gradle.kts @@ -43,8 +43,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } buildConfig { diff --git a/sentry-openfeature/build.gradle.kts b/sentry-openfeature/build.gradle.kts index 5847f48e7b5..fbabcb81aa5 100644 --- a/sentry-openfeature/build.gradle.kts +++ b/sentry-openfeature/build.gradle.kts @@ -37,8 +37,6 @@ dependencies { testImplementation(libs.openfeature) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-openfeign/build.gradle.kts b/sentry-openfeign/build.gradle.kts index e9e3a2b18de..9b1ac2bbc29 100644 --- a/sentry-openfeign/build.gradle.kts +++ b/sentry-openfeign/build.gradle.kts @@ -34,8 +34,6 @@ dependencies { testImplementation(libs.okhttp.mockwebserver) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts index ed6605f8da4..71f31ce2afb 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts @@ -40,8 +40,6 @@ dependencies { testImplementation(libs.mockito.kotlin) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts index 503c92c95f0..d4bd1af9ede 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-bootstrap/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { testImplementation(libs.otel.semconv.incubating) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts index 5b3b9d97ff4..91ec023e178 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts @@ -45,8 +45,6 @@ dependencies { testImplementation(libs.otel.semconv.incubating) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts index 21e75c0ed7d..d63c8a5c451 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/build.gradle.kts @@ -41,8 +41,6 @@ dependencies { // testImplementation(libs.otel.semconv.incubating) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-quartz/build.gradle.kts b/sentry-quartz/build.gradle.kts index 69c0e72ee07..6e227abafe6 100644 --- a/sentry-quartz/build.gradle.kts +++ b/sentry-quartz/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { testImplementation(libs.mockito.inline) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-reactor/build.gradle.kts b/sentry-reactor/build.gradle.kts index 4d389b0a334..07024b3a23b 100644 --- a/sentry-reactor/build.gradle.kts +++ b/sentry-reactor/build.gradle.kts @@ -43,8 +43,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.reactor") diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts index 9db90129958..23df981060f 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts @@ -62,8 +62,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts index 261894baaa0..9bb0678bf65 100644 --- a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts @@ -65,8 +65,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index 3e70e79ae71..8fdef6ef70e 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -66,8 +66,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-jul/build.gradle.kts b/sentry-samples/sentry-samples-jul/build.gradle.kts index 310af1e7bce..5381f3ff2f0 100644 --- a/sentry-samples/sentry-samples-jul/build.gradle.kts +++ b/sentry-samples/sentry-samples-jul/build.gradle.kts @@ -57,8 +57,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-log4j2/build.gradle.kts index 962fd56a839..07df6703c85 100644 --- a/sentry-samples/sentry-samples-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-log4j2/build.gradle.kts @@ -63,8 +63,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-logback/build.gradle.kts b/sentry-samples/sentry-samples-logback/build.gradle.kts index 1a7f3a23875..bb37638d8c5 100644 --- a/sentry-samples/sentry-samples-logback/build.gradle.kts +++ b/sentry-samples/sentry-samples-logback/build.gradle.kts @@ -57,8 +57,6 @@ tasks.jar { // Fix the startScripts task dependency tasks.startScripts { dependsOn(tasks.shadowJar) } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-7/build.gradle.kts b/sentry-samples/sentry-samples-spring-7/build.gradle.kts index 3e108aabd1e..6de7ed62e9f 100644 --- a/sentry-samples/sentry-samples-spring-7/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-7/build.gradle.kts @@ -68,8 +68,6 @@ tasks.withType().configureEach { } } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index 722788830f1..afdb92e5c5b 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -81,8 +81,6 @@ dependencies { dependencyManagement { imports { mavenBom(libs.otel.instrumentation.bom.get().toString()) } } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index b9551ffcf74..f0e2d468fec 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -84,8 +84,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.register("bootRunWithAgent").configure { group = "application" diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index d793201d4c0..d7c2c009bc9 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -82,8 +82,6 @@ dependencies { dependencyManagement { imports { mavenBom(libs.otel.instrumentation.bom.get().toString()) } } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index 6d8d3c81e09..20ccf2d662c 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -49,8 +49,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { kotlin { explicitApi() diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index 4e463671a78..2cc1f34b9eb 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -83,8 +83,6 @@ dependencies { testImplementation("ch.qos.logback:logback-core:1.5.16") } -configure { test { java.srcDir("src/test/java") } } - tasks.register("systemTest").configure { group = "verification" description = "Runs the System tests" diff --git a/sentry-servlet-jakarta/build.gradle.kts b/sentry-servlet-jakarta/build.gradle.kts index 728e147dc9b..3cdc4772f18 100644 --- a/sentry-servlet-jakarta/build.gradle.kts +++ b/sentry-servlet-jakarta/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { testImplementation(libs.servlet.jakarta.api) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-servlet/build.gradle.kts b/sentry-servlet/build.gradle.kts index 142a1cd2f20..9f12d4ee177 100644 --- a/sentry-servlet/build.gradle.kts +++ b/sentry-servlet/build.gradle.kts @@ -36,8 +36,6 @@ dependencies { testImplementation(libs.springboot.starter.web) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spotlight/build.gradle.kts b/sentry-spotlight/build.gradle.kts index b034c8267db..71498aecd92 100644 --- a/sentry-spotlight/build.gradle.kts +++ b/sentry-spotlight/build.gradle.kts @@ -35,8 +35,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - tasks { check { dependsOn(animalsnifferMain) } } buildConfig { diff --git a/sentry-spring-7/build.gradle.kts b/sentry-spring-7/build.gradle.kts index ec90aedcbeb..4e5ea54d294 100644 --- a/sentry-spring-7/build.gradle.kts +++ b/sentry-spring-7/build.gradle.kts @@ -82,8 +82,6 @@ dependencies { testImplementation(projects.sentryReactor) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.spring7") diff --git a/sentry-spring-boot-4-starter/build.gradle.kts b/sentry-spring-boot-4-starter/build.gradle.kts index c0f655e965f..bffe53aab01 100644 --- a/sentry-spring-boot-4-starter/build.gradle.kts +++ b/sentry-spring-boot-4-starter/build.gradle.kts @@ -38,8 +38,6 @@ dependencies { errorprone(libs.nullaway) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-boot-4/build.gradle.kts b/sentry-spring-boot-4/build.gradle.kts index 43e105ad8db..2a6634b257f 100644 --- a/sentry-spring-boot-4/build.gradle.kts +++ b/sentry-spring-boot-4/build.gradle.kts @@ -108,8 +108,6 @@ dependencies { testImplementation(libs.springboot4.resttestclient) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.spring.boot4") diff --git a/sentry-spring-boot-jakarta/build.gradle.kts b/sentry-spring-boot-jakarta/build.gradle.kts index edd2d605916..1ed9373f4bf 100644 --- a/sentry-spring-boot-jakarta/build.gradle.kts +++ b/sentry-spring-boot-jakarta/build.gradle.kts @@ -100,8 +100,6 @@ dependencies { testImplementation(projects.sentryAsyncProfiler) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.spring.boot.jakarta") diff --git a/sentry-spring-boot-starter-jakarta/build.gradle.kts b/sentry-spring-boot-starter-jakarta/build.gradle.kts index d7d10b73b8c..c6fe511073e 100644 --- a/sentry-spring-boot-starter-jakarta/build.gradle.kts +++ b/sentry-spring-boot-starter-jakarta/build.gradle.kts @@ -38,8 +38,6 @@ dependencies { errorprone(libs.nullaway) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-boot-starter/build.gradle.kts b/sentry-spring-boot-starter/build.gradle.kts index 3ef4ac59379..f4da56179cb 100644 --- a/sentry-spring-boot-starter/build.gradle.kts +++ b/sentry-spring-boot-starter/build.gradle.kts @@ -30,8 +30,6 @@ dependencies { errorprone(libs.nullaway) } -configure { test { java.srcDir("src/test/java") } } - tasks.withType().configureEach { options.errorprone { check("NullAway", net.ltgt.gradle.errorprone.CheckSeverity.ERROR) diff --git a/sentry-spring-jakarta/build.gradle.kts b/sentry-spring-jakarta/build.gradle.kts index b4a61129df7..f103bfcbe0a 100644 --- a/sentry-spring-jakarta/build.gradle.kts +++ b/sentry-spring-jakarta/build.gradle.kts @@ -77,8 +77,6 @@ dependencies { testImplementation(projects.sentryReactor) } -configure { test { java.srcDir("src/test/java") } } - buildConfig { useJavaOutput() packageName("io.sentry.spring.jakarta") diff --git a/sentry-system-test-support/build.gradle.kts b/sentry-system-test-support/build.gradle.kts index 4d4c7d5bb6e..7f08bf6d01b 100644 --- a/sentry-system-test-support/build.gradle.kts +++ b/sentry-system-test-support/build.gradle.kts @@ -41,8 +41,6 @@ dependencies { implementation(libs.mockito.kotlin) } -configure { test { java.srcDir("src/test/java") } } - apollo { service("service") { srcDir("src/main/graphql") diff --git a/sentry-test-support/build.gradle.kts b/sentry-test-support/build.gradle.kts index f108915d463..a0b508c9715 100644 --- a/sentry-test-support/build.gradle.kts +++ b/sentry-test-support/build.gradle.kts @@ -31,5 +31,3 @@ dependencies { implementation(libs.kotlin.test.junit) implementation(libs.mockito.kotlin) } - -configure { test { java.srcDir("src/test/java") } } diff --git a/sentry/build.gradle.kts b/sentry/build.gradle.kts index a2ecd281296..9717cb176ae 100644 --- a/sentry/build.gradle.kts +++ b/sentry/build.gradle.kts @@ -37,8 +37,6 @@ dependencies { signature("${gummyBearsModule}:${libs.versions.gummyBears.get()}@signature") } -configure { test { java.srcDir("src/test/java") } } - animalsniffer { ignore = listOf( From d735888152fb47be1e04654e453e37febe3a0b9d Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 25 Jun 2026 12:04:33 +0200 Subject: [PATCH 234/391] chore(android-sqlite): Update SQLite instrumentation documentation after 8.45.0 release (#5572) We'll be coordinating the 8.45.0 release with SAGP auto-instrumentation for the SentrySQLiteDriver. Commit contains related documentation updates. --- sentry-android-sqlite/README.md | 4 +++- .../main/java/io/sentry/sqlite/SentrySQLiteDriver.kt | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sentry-android-sqlite/README.md b/sentry-android-sqlite/README.md index 7bf9edf3474..307beb51f0e 100644 --- a/sentry-android-sqlite/README.md +++ b/sentry-android-sqlite/README.md @@ -4,11 +4,13 @@ SQLite instrumentation for AndroidX APIs. Two instrumentation paths are supported: -- **`androidx.sqlite.SQLiteDriver`**: Used by Room 2.7+ and 3.0+. +- **`androidx.sqlite.SQLiteDriver`**: Used by Room 2.7+ and 3.0+. Applied automatically by the Sentry Android Gradle Plugin. - **`androidx.sqlite.db.SupportSQLiteOpenHelper`**: Used by SQLDelight and legacy (pre-2.7) Room. Applied automatically by the Sentry Android Gradle Plugin. To avoid duplicate spans, only one path should be used per database file. Most Room and SQLDelight APIs enforce that division. The exception is Room's `SupportSQLiteDriver`: either the `SupportSQLiteOpenHelper` it consumes should be wrapped or the support driver itself, but never both. +See the [SQLite integration docs](https://docs.sentry.io/platforms/android/integrations/room-and-sqlite/) for more details. + ## Package layout The module is organized as two separate packages: diff --git a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt index 22f6353d883..4a616ba3abe 100644 --- a/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt +++ b/sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt @@ -22,6 +22,9 @@ import org.jetbrains.annotations.ApiStatus * .build() * ``` * + * If you're using the Sentry Android Gradle Plugin (SAGP) 6.13.0+, wrapping will be performed + * automatically. + * * @param delegate The [SQLiteDriver] instance to delegate calls to. */ @ApiStatus.Experimental @@ -87,9 +90,16 @@ public class SentrySQLiteDriver private constructor(private val delegate: SQLite * * In the case of (2), wrap the open helper passed to the `SupportSQLiteDriver` constructor via * `SentrySupportSQLiteOpenHelper` instead. + * + * Note that wrapping will be performed if the delegate isn't a `SupportSQLiteDriver` itself but + * wraps or subclasses one. In that case, ensure the open helper passed to the support driver + * constructor is *not* wrapped. */ + // Warning! The SAGP depends on this method's ABI. @JvmStatic public fun create(delegate: SQLiteDriver): SQLiteDriver = + // FQN check simplifies our SAGP implementation, allowing it to naively instrument all + // RoomDatabase.Builder.setDriver() call sites. if (delegate is SentrySQLiteDriver || delegate.javaClass.name == SUPPORT_SQLITE_DRIVER_FQN) { delegate } else { From 6bbdfbea7809761ded2735fc5a81acbab5182dc2 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 25 Jun 2026 12:48:15 +0200 Subject: [PATCH 235/391] chore(changelog): Add 8.43.3 hotfix (#5620) Add release notes for version 8.43.3 with fixes. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a1115f8ae..2049c2b2543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,12 @@ - Fix attachments being duplicated on native events that carry scope attachments ([#5548](https://github.com/getsentry/sentry-java/pull/5548)) - Fix performance collector scheduling many tasks in a row ([#5524](https://github.com/getsentry/sentry-java/pull/5524)) +## 8.43.3 + +### Fixes + +- Fix crash when `getHistoricalProcessStartReasons` is called from an isolated or wrong-userId process ([#5597](https://github.com/getsentry/sentry-java/pull/5597)) + ## 8.43.2 ### Improvements From fa825503d1a24bca46aa0f7a71b9d1a06ee00351 Mon Sep 17 00:00:00 2001 From: arb Date: Thu, 25 Jun 2026 13:42:36 +0200 Subject: [PATCH 236/391] chore(deps): Bump dependencies associated with SentrySQLiteDriver (#5630) Bumps SAGP to 6.13.0, Room 3 to 3.0.0-rc01, and androidx.sqlite to 2.7.0-rc01. Lets us ensure the Android sample app runs against the latest Room build + picks up the SQLiteDriver auto-instrumentation introduced in SAGP 6.13.0. --- gradle/libs.versions.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 24064703ca1..3984cb7115b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -33,10 +33,10 @@ otelSemanticConventions = "1.40.0" otelSemanticConventionsAlpha = "1.40.0-alpha" retrofit = "2.9.0" room2 = "2.8.4" -room3 = "3.0.0-alpha06" -sagp = "6.10.0" +room3 = "3.0.0-rc01" +sagp = "6.13.0" sqlite = "2.6.2" -sqliteAlpha = "2.7.0-alpha06" # Required by Room3 3.0.0-alpha* +sqliteRc = "2.7.0-rc01" # Required by Room3 3.0.0-rc* slf4j = "1.7.30" spotless = "8.4.0" springboot2 = "2.7.18" @@ -107,8 +107,8 @@ androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = " androidx-room3-compiler = { module = "androidx.room3:room3-compiler", version.ref = "room3" } androidx-room3-runtime = { module = "androidx.room3:room3-runtime", version.ref = "room3" } androidx-sqlite = { module = "androidx.sqlite:sqlite", version.ref = "sqlite" } -androidx-sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqliteAlpha" } -androidx-sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqliteAlpha" } +androidx-sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqliteRc" } +androidx-sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqliteRc" } androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" } androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" } async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" } From f082155e971b6ff724767cdc68f269f188f58d0a Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 25 Jun 2026 13:46:19 +0200 Subject: [PATCH 237/391] build: Remove redundant Java compatibility block from sentry-apollo-4 (#5633) The root build script already sets sourceCompatibility/targetCompatibility to VERSION_1_8 for every java-library subproject, so the module-level declaration was a no-op. --- sentry-apollo-4/build.gradle.kts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sentry-apollo-4/build.gradle.kts b/sentry-apollo-4/build.gradle.kts index d9f41891dc1..abb7ccb760e 100644 --- a/sentry-apollo-4/build.gradle.kts +++ b/sentry-apollo-4/build.gradle.kts @@ -11,11 +11,6 @@ plugins { alias(libs.plugins.animalsniffer) } -configure { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - tasks.withType().configureEach { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9 From e0a2a6e63c9cf289a0d15f16b91b2ce19adf2fc6 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 25 Jun 2026 14:18:18 +0200 Subject: [PATCH 238/391] build: Remove redundant mavenCentral repository declarations (#5638) settings.gradle.kts already declares google(), mavenCentral() and mavenLocal() via dependencyResolutionManagement for every project, so the module-level repositories { mavenCentral() } blocks were redundant. With the default PREFER_PROJECT mode they only narrowed each project to mavenCentral; removing them falls back to the central superset and resolution is unaffected. --- sentry-reactor/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- sentry-samples/sentry-samples-console-otlp/build.gradle.kts | 2 -- sentry-samples/sentry-samples-console/build.gradle.kts | 2 -- sentry-samples/sentry-samples-jul/build.gradle.kts | 2 -- sentry-samples/sentry-samples-log4j2/build.gradle.kts | 2 -- sentry-samples/sentry-samples-logback/build.gradle.kts | 2 -- sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts | 2 -- sentry-samples/sentry-samples-servlet/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-7/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-otlp/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-4-webflux/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- .../sentry-samples-spring-boot-jakarta/build.gradle.kts | 2 -- .../build.gradle.kts | 2 -- .../sentry-samples-spring-boot-opentelemetry/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts | 2 -- .../sentry-samples-spring-boot-webflux/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-boot/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts | 2 -- sentry-samples/sentry-samples-spring/build.gradle.kts | 2 -- 25 files changed, 50 deletions(-) diff --git a/sentry-reactor/build.gradle.kts b/sentry-reactor/build.gradle.kts index 07024b3a23b..615ce38ecc5 100644 --- a/sentry-reactor/build.gradle.kts +++ b/sentry-reactor/build.gradle.kts @@ -62,8 +62,6 @@ tasks.withType().configureEach { } } -repositories { mavenCentral() } - tasks.jar { manifest { attributes( diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts index 23df981060f..5b67053449e 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts index 9bb0678bf65..232a4ff2248 100644 --- a/sentry-samples/sentry-samples-console-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-console-otlp/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-console/build.gradle.kts b/sentry-samples/sentry-samples-console/build.gradle.kts index 8fdef6ef70e..f490939ed61 100644 --- a/sentry-samples/sentry-samples-console/build.gradle.kts +++ b/sentry-samples/sentry-samples-console/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-jul/build.gradle.kts b/sentry-samples/sentry-samples-jul/build.gradle.kts index 5381f3ff2f0..25e682a19ba 100644 --- a/sentry-samples/sentry-samples-jul/build.gradle.kts +++ b/sentry-samples/sentry-samples-jul/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-log4j2/build.gradle.kts index 07df6703c85..52c5c8bb035 100644 --- a/sentry-samples/sentry-samples-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-log4j2/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-logback/build.gradle.kts b/sentry-samples/sentry-samples-logback/build.gradle.kts index bb37638d8c5..d608f0aa549 100644 --- a/sentry-samples/sentry-samples-logback/build.gradle.kts +++ b/sentry-samples/sentry-samples-logback/build.gradle.kts @@ -15,8 +15,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts index 202b8d8f058..90bc1ffc86f 100644 --- a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts +++ b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts @@ -19,8 +19,6 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8 java.targetCompatibility = JavaVersion.VERSION_1_8 -repositories { mavenCentral() } - dependencies { implementation(platform(libs.springboot2.bom)) implementation(libs.springboot.starter.web) diff --git a/sentry-samples/sentry-samples-servlet/build.gradle.kts b/sentry-samples/sentry-samples-servlet/build.gradle.kts index 9dc9278bcb9..01ecef54154 100644 --- a/sentry-samples/sentry-samples-servlet/build.gradle.kts +++ b/sentry-samples/sentry-samples-servlet/build.gradle.kts @@ -8,8 +8,6 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8 java.targetCompatibility = JavaVersion.VERSION_1_8 -repositories { mavenCentral() } - dependencies { implementation(projects.sentryServlet) implementation("javax.servlet:javax.servlet-api:4.0.1") diff --git a/sentry-samples/sentry-samples-spring-7/build.gradle.kts b/sentry-samples/sentry-samples-spring-7/build.gradle.kts index 6de7ed62e9f..daeab91f28d 100644 --- a/sentry-samples/sentry-samples-spring-7/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-7/build.gradle.kts @@ -26,8 +26,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencyManagement { imports { mavenBom(SpringBootPlugin.BOM_COORDINATES) } } dependencies { diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts index afdb92e5c5b..090afbd4542 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/build.gradle.kts @@ -17,8 +17,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts index f0e2d468fec..fa73c191a92 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/build.gradle.kts @@ -18,8 +18,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts index d7c2c009bc9..22245cae979 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/build.gradle.kts @@ -17,8 +17,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts index 20ccf2d662c..b75f70b3574 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/build.gradle.kts @@ -17,8 +17,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencies { implementation(Config.Libs.kotlinReflect) implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION)) diff --git a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts index 2cc1f34b9eb..17ec5b2a45f 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-4/build.gradle.kts @@ -17,8 +17,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - configure { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts index 553affc3620..39d6dbf39b6 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/build.gradle.kts @@ -18,8 +18,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencyManagement { imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts index e4fefab7de7..6f1af65dc88 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/build.gradle.kts @@ -19,8 +19,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencyManagement { imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts index 65850a6f2bd..320a9cc2512 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/build.gradle.kts @@ -18,8 +18,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencyManagement { imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index e32eec82ac8..27d0cd1a772 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -21,8 +21,6 @@ java.sourceCompatibility = JavaVersion.VERSION_11 java.targetCompatibility = JavaVersion.VERSION_11 -repositories { mavenCentral() } - fun springBoot2SupportsOptionalIntegrations(): Boolean { val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") val parts = version.split(".").map { it.toIntOrNull() ?: 0 } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index 085d6e362af..37aae899e4f 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -21,8 +21,6 @@ java.sourceCompatibility = JavaVersion.VERSION_11 java.targetCompatibility = JavaVersion.VERSION_11 -repositories { mavenCentral() } - fun springBoot2SupportsOptionalIntegrations(): Boolean { val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") val parts = version.split(".").map { it.toIntOrNull() ?: 0 } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts index 3e462517ded..213eb60296d 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/build.gradle.kts @@ -18,8 +18,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - dependencyManagement { imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${libs.versions.springboot3.get()}") diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts index 8dc51e07a53..836608500dc 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts @@ -21,8 +21,6 @@ java.sourceCompatibility = JavaVersion.VERSION_11 java.targetCompatibility = JavaVersion.VERSION_11 -repositories { mavenCentral() } - fun springBoot2SupportsGraphql(): Boolean { val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") val parts = version.split(".").map { it.toIntOrNull() ?: 0 } diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index 54fe99d56d4..0c8d2dc28e7 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -21,8 +21,6 @@ java.sourceCompatibility = JavaVersion.VERSION_11 java.targetCompatibility = JavaVersion.VERSION_11 -repositories { mavenCentral() } - fun springBoot2SupportsOptionalIntegrations(): Boolean { val version = libs.versions.springboot2.get().removeSuffix(".RELEASE") val parts = version.split(".").map { it.toIntOrNull() ?: 0 } diff --git a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts index 5fe0334a629..2b360019cb5 100644 --- a/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-jakarta/build.gradle.kts @@ -24,8 +24,6 @@ java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 -repositories { mavenCentral() } - // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" diff --git a/sentry-samples/sentry-samples-spring/build.gradle.kts b/sentry-samples/sentry-samples-spring/build.gradle.kts index 3ab6610d96d..236e577a17a 100644 --- a/sentry-samples/sentry-samples-spring/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring/build.gradle.kts @@ -25,8 +25,6 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -repositories { mavenCentral() } - // Apollo 4.x requires coroutines 1.9.0+, override Spring Boot's managed version extra["kotlin-coroutines.version"] = "1.9.0" From 2ebf90a0da3127c7b3adee4a86fe3c142bc6fa26 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 25 Jun 2026 15:45:49 +0200 Subject: [PATCH 239/391] perf(core): SDK Overhead Reduction (#5499) * collection: SDK Overhead Reduction * perf(core): Skip java.specification.version lookup on Android Android is never Java 9+, so the System.getProperty + Double.valueOf parse in the Platform static initializer is unnecessary overhead on the Android cold-start path. Short-circuit to isJavaNinePlus=false when isAndroid is true. * perf(android): Replace reflective OptionsContainer with direct subclass Replace OptionsContainer.create(SentryAndroidOptions.class) which uses getDeclaredConstructor().newInstance() with a direct SentryAndroidOptionsContainer subclass that returns new SentryAndroidOptions() without reflection. Make OptionsContainer non-final (@Open) with a protected no-arg constructor so Android can subclass it. * collection: SDK Overhead reduction for JVM * perf(core): Short-circuit combined scope breadcrumbs Avoid allocating and sorting a merged breadcrumb queue when only one component scope has breadcrumbs. This keeps the full merge path for multi-scope breadcrumbs and returns the default write scope queue when all scopes are empty. Co-Authored-By: Claude * perf(core): Reduce envelope writer buffer size Use an explicit 512-character BufferedWriter buffer for envelope item and envelope serialization. This avoids allocating the oversized default char buffer for each short-lived serialization writer while preserving the existing OutputStreamWriter-based encoding path. Co-Authored-By: Claude * changelog * perf(core): Remove redundant event map copies Avoid creating temporary maps when applying scope and options tags or scope extras. The event setters already copy these maps, so this preserves snapshot semantics while reducing allocation overhead. Co-Authored-By: Claude * changelog * changelog * perf(core): Short-circuit combined scope collections Avoid allocating merged collection copies when only one combined scope contains values. This extends the breadcrumbs optimization to tags, attributes, extras, and attachments while preserving merge behavior when multiple scopes contribute data. Co-Authored-By: Claude * changelog * perf(android): Use TimeZone.getDefault for device timezone Avoid constructing a Calendar only to read the default device timezone. The locale passed to Calendar does not affect the timezone value, so TimeZone.getDefault returns the same value with less work during device context collection. Co-Authored-By: Claude * perf(core): Replace Calendar with Date in DateUtils Avoid constructing Calendar instances when DateUtils only needs the current epoch millis or a Date for an existing millis value. Date stores epoch millis without timezone state, so the returned values are unchanged while avoiding unnecessary Calendar allocation and field computation. Co-Authored-By: Claude * perf(core): Reduce JsonWriter stack allocation Shrink the vendored JsonWriter nesting stack from 32 entries to 8 entries. The stack still grows on demand for deeply nested payloads, while common SDK serialization avoids the larger initial array allocation. Co-Authored-By: Claude * perf(core): Lazily allocate Breadcrumb data Avoid allocating a ConcurrentHashMap for breadcrumbs that never set data. Initialize the data map on first write while preserving concurrent writes with double-checked locking. Co-Authored-By: Claude * perf(core): Reduce context serialization allocations Use sorted key arrays when serializing contexts to avoid allocating an ArrayList for each serialization. This preserves deterministic key ordering while keeping the snapshot representation smaller. Co-Authored-By: Claude * perf(core): Lazily allocate reflection serializer state Defer creation of the reflection serializer visiting set until reflection serialization is actually needed. Normal SDK payload serialization uses explicit serializers, so this avoids an unused HashSet allocation for each writer. * perf(core): Lazily create reflection JSON serializer Defer creation of JsonReflectionObjectSerializer until unknown-object reflection serialization is needed. Normal SDK payloads use explicit serializers, so this avoids allocating unused reflection serializer state for each writer. * fix(android): Preserve locale timezone extension Keep the Calendar-based timezone path for Android 13+ locales that carry a Unicode tz extension. This preserves the existing device timezone behavior while keeping the direct default timezone fast path for normal locales. Co-Authored-By: Claude * perf(core): Replace ISO8601 timestamp handling Replace the Calendar-backed vendored ISO8601 formatting and parsing path with a small Sentry-specific utility that works directly from epoch milliseconds. This avoids formatter and parser allocations on timestamp-heavy serialization paths while keeping the existing DateUtils API as the facade. Co-Authored-By: Claude * ref(core): Move ISO8601 utility to vendor package Move the Sentry ISO8601 helper under the vendor package and mark it as internal API so the adapted public-domain date conversion code is isolated from core SDK classes. Update attribution metadata to reflect the public-domain dedication source. Co-Authored-By: Claude * perf(core): Avoid cloning Date getters * fix(core): Preserve ISO8601 utility compatibility Match edge-case behavior from the previous vendored ISO8601 utility for date-only timestamps, trailing characters after Z, and Gregorian cutover dates. * fix(core): Preserve mutable breadcrumb data access Initialize the lazy breadcrumb data map when callers request the full map. This keeps getData() mutable for existing callers while preserving lazy allocation for breadcrumbs that only serialize or read individual values. Co-Authored-By: Claude * docs(android): Explain timezone Calendar fallback Document why Android 13+ locales with Unicode timezone extensions keep using Calendar while normal locales use the default timezone directly for performance. Co-Authored-By: Claude * fix(core): Avoid KeySetView in context serialization Use ConcurrentHashMap.keys() when creating sorted context key snapshots so the serialization path stays compatible with Android API 21. Keep the array snapshot optimization without relying on KeySetView, which AnimalSniffer rejects for the SDK's minSdk. Co-Authored-By: Claude * test(core): Add breadcrumb timestamp serialization coverage Cover that breadcrumbs backed by timestamp milliseconds serialize the same timestamp as breadcrumbs backed by Date for the same instant. * fix(core): Parse date-only timestamps with timezones Preserve ISO8601 parser compatibility for date-only values that include a timezone suffix. Keep modern date-only timezone parsing on the fast path and add parity coverage against the previous parser. * docs(core): Add timezone changelog entry * docs(core): Add DateUtils changelog entry * docs(core): Add JsonWriter changelog entry * docs(core): Add breadcrumb changelog entry * docs(core): Add contexts changelog entry * docs(core): Add reflection state changelog entry * docs(core): Add reflection serializer changelog entry * docs(core): Add ISO8601 handling changelog entry * docs(core): Add Date getter changelog entries * changelog --------- Co-authored-by: Claude --- CHANGELOG.md | 26 ++ THIRD_PARTY_NOTICES.md | 16 + .../sentry/android/core/DeviceInfoUtil.java | 11 +- .../io/sentry/android/core/SentryAndroid.java | 3 +- .../core/SentryAndroidOptionsContainer.java | 16 + .../sentry/android/core/DeviceInfoUtilTest.kt | 32 ++ sentry/api/sentry.api | 10 +- .../src/main/java/io/sentry/Breadcrumb.java | 65 ++- .../java/io/sentry/CombinedScopeView.java | 157 ++++++- sentry/src/main/java/io/sentry/DateUtils.java | 35 +- .../java/io/sentry/JsonObjectSerializer.java | 14 +- .../JsonReflectionObjectSerializer.java | 10 +- .../main/java/io/sentry/JsonSerializer.java | 5 +- .../java/io/sentry/MainEventProcessor.java | 3 +- .../main/java/io/sentry/MonitorContexts.java | 6 +- .../main/java/io/sentry/OptionsContainer.java | 18 +- .../src/main/java/io/sentry/SentryClient.java | 9 +- .../java/io/sentry/SentryEnvelopeItem.java | 41 +- .../src/main/java/io/sentry/SentryEvent.java | 2 +- sentry/src/main/java/io/sentry/Session.java | 8 +- .../src/main/java/io/sentry/protocol/App.java | 3 +- .../java/io/sentry/protocol/Contexts.java | 6 +- .../main/java/io/sentry/protocol/Device.java | 3 +- .../java/io/sentry/util/CollectionUtils.java | 21 + .../main/java/io/sentry/util/Platform.java | 21 +- .../io/sentry/vendor/SentryIso8601Utils.java | 397 ++++++++++++++++++ .../sentry/vendor/gson/stream/JsonWriter.java | 4 +- .../src/test/java/io/sentry/BreadcrumbTest.kt | 36 ++ .../java/io/sentry/CombinedScopeViewTest.kt | 69 +++ .../src/test/java/io/sentry/DateUtilsTest.kt | 204 +++++++++ .../io/sentry/JsonObjectSerializerTest.kt | 24 ++ .../java/io/sentry/MainEventProcessorTest.kt | 13 + .../java/io/sentry/MonitorContextsTest.kt | 19 + .../test/java/io/sentry/SentryClientTest.kt | 18 + .../test/java/io/sentry/protocol/AppTest.kt | 5 +- .../protocol/BreadcrumbSerializationTest.kt | 8 + .../java/io/sentry/protocol/DeviceTest.kt | 5 +- .../SentryBaseEventSerializationTest.kt | 23 + 38 files changed, 1252 insertions(+), 114 deletions(-) create mode 100644 sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptionsContainer.java create mode 100644 sentry/src/main/java/io/sentry/vendor/SentryIso8601Utils.java create mode 100644 sentry/src/test/java/io/sentry/MonitorContextsTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 2049c2b2543..851fc3985e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## Unreleased + +### Behavioral Changes + +- Collections returned by scope (e.g. `getBreadcrumbs`, `getTags`, `getAttachments`) are shared state and should not be mutated. ([#5541](https://github.com/getsentry/sentry-java/pull/5541)) + - Previously, when going through `CombinedScopeView`, we were returning a copy where mutations didn't show up in the underlying scopes. + - This has now changed in order to reduce SDK overhead. +- `Date` objects returned by SDK data model getters are shared state and should not be mutated. ([#5603](https://github.com/getsentry/sentry-java/pull/5603)) + - Previously, these getters returned defensive copies for some date fields. + - This has now changed in order to reduce SDK overhead. + +### Performance + +- Reduce writer buffer size from 8192 to 512 ([#5544](https://github.com/getsentry/sentry-java/pull/5544)) +- Remove redundant event map copies ([#5536](https://github.com/getsentry/sentry-java/pull/5536)) +- Optimize combined scope by adding an early return if only one scope has data ([#5541](https://github.com/getsentry/sentry-java/pull/5541)) +- Reduce model access overhead by avoiding defensive `Date` copies in SDK data model getters. ([#5603](https://github.com/getsentry/sentry-java/pull/5603)) +- Reduce timestamp parsing and formatting overhead with Sentry-specific ISO-8601 handling. ([#5602](https://github.com/getsentry/sentry-java/pull/5602)) +- Reduce JSON serialization overhead by creating the reflection serializer only when unknown-object fallback serialization is needed. ([#5601](https://github.com/getsentry/sentry-java/pull/5601)) +- Reduce JSON serialization overhead by allocating reflection cycle-tracking state only when reflection serialization is used. ([#5600](https://github.com/getsentry/sentry-java/pull/5600)) +- Reduce context serialization overhead by sorting key snapshots with arrays instead of temporary lists. ([#5599](https://github.com/getsentry/sentry-java/pull/5599)) +- Reduce breadcrumb allocation overhead by creating the `Breadcrumb` data map only when data is added. ([#5598](https://github.com/getsentry/sentry-java/pull/5598)) +- Reduce JSON serialization overhead by lowering the initial `JsonWriter` nesting stack size while preserving on-demand growth. ([#5591](https://github.com/getsentry/sentry-java/pull/5591)) +- Reduce timestamp helper overhead by replacing unnecessary `Calendar` usage in `DateUtils` with direct `Date` creation. ([#5589](https://github.com/getsentry/sentry-java/pull/5589)) +- Reduce Android startup overhead by using the default timezone directly on older devices or when no timezone info is available in the locale. ([#5587](https://github.com/getsentry/sentry-java/pull/5587)) + ## 8.45.0 ### Features diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 925add4a71a..7b87b92dcb3 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -62,6 +62,22 @@ limitations under the License. --- +## Howard Hinnant — Date Algorithms (Public Domain) + +**Source:** https://howardhinnant.github.io/date_algorithms.html
+**License:** Public Domain
+**Copyright:** None; public domain dedication by Howard Hinnant + +### Scope + +The Sentry Java SDK includes adapted civil date conversion algorithms from Howard Hinnant's date algorithms for UTC ISO 8601 timestamp parsing and formatting. The code resides in `io.sentry.vendor.SentryIso8601Utils`. + +``` +Consider these donated to the public domain. +``` + +--- + ## Android Open Source Project — Base64 (Apache 2.0) **Source:** https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/util/Base64.java
diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java index f3b17c5854a..63b88c0e440 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java @@ -257,14 +257,19 @@ private void setDeviceIO( @SuppressWarnings("NewApi") @NotNull private TimeZone getTimeZone() { - if (buildInfoProvider.getSdkInfoVersion() >= Build.VERSION_CODES.N) { + // Only use the costly Calendar API on Android 13+ (API Level 33+) when the locale contains a + // Unicode timezone extension (for example "en-US-u-tz-usnyc"), because Calendar honors that + // extension. For all other cases, use the process default timezone directly for performance. + if (buildInfoProvider.getSdkInfoVersion() >= Build.VERSION_CODES.TIRAMISU) { LocaleList locales = context.getResources().getConfiguration().getLocales(); if (!locales.isEmpty()) { Locale locale = locales.get(0); - return Calendar.getInstance(locale).getTimeZone(); + if (locale.getUnicodeLocaleType("tz") != null) { + return Calendar.getInstance(locale).getTimeZone(); + } } } - return Calendar.getInstance().getTimeZone(); + return TimeZone.getDefault(); } @SuppressWarnings("JdkObsolete") diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java index 0d249f73790..f27259fd635 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java @@ -9,7 +9,6 @@ import io.sentry.IScopes; import io.sentry.ISentryLifecycleToken; import io.sentry.Integration; -import io.sentry.OptionsContainer; import io.sentry.Sentry; import io.sentry.SentryLevel; import io.sentry.SentryOptions; @@ -98,7 +97,7 @@ public static void init( @NotNull Sentry.OptionsConfiguration configuration) { try (final @NotNull ISentryLifecycleToken ignored = staticLock.acquire()) { Sentry.init( - OptionsContainer.create(SentryAndroidOptions.class), + new SentryAndroidOptionsContainer(), options -> { final io.sentry.util.LoadClass classLoader = new io.sentry.util.LoadClass(); final boolean isTimberUpstreamAvailable = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptionsContainer.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptionsContainer.java new file mode 100644 index 00000000000..678f7ab29b2 --- /dev/null +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroidOptionsContainer.java @@ -0,0 +1,16 @@ +package io.sentry.android.core; + +import io.sentry.OptionsContainer; +import org.jetbrains.annotations.NotNull; + +/** + * Direct OptionsContainer for SentryAndroidOptions that avoids reflective + * getDeclaredConstructor().newInstance() on the Android startup path. + */ +final class SentryAndroidOptionsContainer extends OptionsContainer { + + @Override + public @NotNull SentryAndroidOptions createInstance() { + return new SentryAndroidOptions(); + } +} diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt index 6d90d6be538..faf993e1610 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt @@ -2,16 +2,22 @@ package io.sentry.android.core import android.content.Context import android.content.Intent +import android.content.res.Configuration import android.os.BatteryManager +import android.os.Build +import android.os.LocaleList import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import io.sentry.android.core.internal.util.CpuInfoUtils +import java.util.Locale +import java.util.TimeZone import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull import org.junit.runner.RunWith +import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) class DeviceInfoUtilTest { @@ -47,6 +53,32 @@ class DeviceInfoUtilTest { assertNotNull(deviceInfo.memorySize) } + @Test + fun `sets default timezone`() { + val deviceInfoUtil = DeviceInfoUtil.getInstance(context, SentryAndroidOptions()) + val deviceInfo = deviceInfoUtil.collectDeviceInformation(false, false) + + assertEquals(TimeZone.getDefault(), deviceInfo.timezone) + } + + @Test + @Config(sdk = [Build.VERSION_CODES.TIRAMISU]) + fun `preserves timezone from locale unicode extension`() { + val defaultTimeZone = TimeZone.getDefault() + try { + TimeZone.setDefault(TimeZone.getTimeZone("UTC")) + val configuration = Configuration(context.resources.configuration) + configuration.setLocales(LocaleList(Locale.forLanguageTag("en-US-u-tz-usnyc"))) + val localizedContext = context.createConfigurationContext(configuration) + val deviceInfoUtil = DeviceInfoUtil(localizedContext, SentryAndroidOptions()) + val deviceInfo = deviceInfoUtil.collectDeviceInformation(false, false) + + assertEquals("America/New_York", deviceInfo.timezone?.id) + } finally { + TimeZone.setDefault(defaultTimeZone) + } + } + @Test fun `does include cpu data`() { CpuInfoUtils.getInstance().setCpuMaxFrequencies(listOf(1024)) diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index e9083350349..04c876fdbdb 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -1312,7 +1312,6 @@ public final class io/sentry/JsonObjectReader : io/sentry/ObjectReader { public final class io/sentry/JsonObjectSerializer { public static final field OBJECT_PLACEHOLDER Ljava/lang/String; - public final field jsonReflectionObjectSerializer Lio/sentry/JsonReflectionObjectSerializer; public fun (I)V public fun serialize (Lio/sentry/ObjectWriter;Lio/sentry/ILogger;Ljava/lang/Object;)V } @@ -2067,7 +2066,8 @@ public abstract interface class io/sentry/ObjectWriter { public abstract fun value (Z)Lio/sentry/ObjectWriter; } -public final class io/sentry/OptionsContainer { +public class io/sentry/OptionsContainer { + protected fun ()V public static fun create (Ljava/lang/Class;)Lio/sentry/OptionsContainer; public fun createInstance ()Ljava/lang/Object; } @@ -7618,6 +7618,7 @@ public final class io/sentry/util/CollectionUtils { public static fun newHashMap (Ljava/util/Map;)Ljava/util/Map; public static fun reverseListIterator (Ljava/util/concurrent/CopyOnWriteArrayList;)Ljava/util/ListIterator; public static fun size (Ljava/lang/Iterable;)I + public static fun toSortedStringArray (Ljava/util/Enumeration;I)[Ljava/lang/String; } public abstract interface class io/sentry/util/CollectionUtils$Mapper { @@ -8075,6 +8076,11 @@ public class io/sentry/vendor/Base64 { public static fun encodeToString ([BIII)Ljava/lang/String; } +public final class io/sentry/vendor/SentryIso8601Utils { + public static fun formatTimestamp (J)Ljava/lang/String; + public static fun parseTimestamp (Ljava/lang/String;)J +} + public class io/sentry/vendor/gson/internal/bind/util/ISO8601Utils { public static final field TIMEZONE_UTC Ljava/util/TimeZone; public fun ()V diff --git a/sentry/src/main/java/io/sentry/Breadcrumb.java b/sentry/src/main/java/io/sentry/Breadcrumb.java index d122d1459bf..fff6954ee56 100644 --- a/sentry/src/main/java/io/sentry/Breadcrumb.java +++ b/sentry/src/main/java/io/sentry/Breadcrumb.java @@ -34,8 +34,10 @@ public final class Breadcrumb implements JsonUnknown, JsonSerializable, Comparab /** The type of breadcrumb. */ private @Nullable String type; + private static final @NotNull Map EMPTY_DATA = Collections.emptyMap(); + /** Data associated with this breadcrumb. */ - private @NotNull Map data = new ConcurrentHashMap<>(); + private volatile @NotNull Map data = EMPTY_DATA; /** Dotted strings that indicate what the crumb is or where it comes from. */ private @Nullable String category; @@ -78,9 +80,11 @@ public Breadcrumb(final long timestamp) { this.type = breadcrumb.type; this.category = breadcrumb.category; this.origin = breadcrumb.origin; - final Map dataClone = CollectionUtils.newConcurrentHashMap(breadcrumb.data); - if (dataClone != null) { - this.data = dataClone; + if (!breadcrumb.data.isEmpty()) { + final Map dataClone = CollectionUtils.newConcurrentHashMap(breadcrumb.data); + if (dataClone != null) { + this.data = dataClone; + } } this.unknown = CollectionUtils.newConcurrentHashMap(breadcrumb.unknown); this.level = breadcrumb.level; @@ -100,7 +104,7 @@ public static Breadcrumb fromMap( @NotNull Date timestamp = DateUtils.getCurrentDateTime(); String message = null; String type = null; - @NotNull Map data = new ConcurrentHashMap<>(); + Map data = null; String category = null; String origin = null; SentryLevel level = null; @@ -129,6 +133,9 @@ public static Breadcrumb fromMap( if (untypedData != null) { for (Map.Entry dataEntry : untypedData.entrySet()) { if (dataEntry.getKey() instanceof String && dataEntry.getValue() != null) { + if (data == null) { + data = new ConcurrentHashMap<>(); + } data.put((String) dataEntry.getKey(), dataEntry.getValue()); } else { options @@ -166,7 +173,9 @@ public static Breadcrumb fromMap( final Breadcrumb breadcrumb = new Breadcrumb(timestamp); breadcrumb.message = message; breadcrumb.type = type; - breadcrumb.data = data; + if (data != null) { + breadcrumb.data = data; + } breadcrumb.category = category; breadcrumb.origin = origin; breadcrumb.level = level; @@ -494,7 +503,7 @@ public static Breadcrumb fromMap( breadcrumb.setData("view.tag", viewTag); } for (final Map.Entry entry : additionalData.entrySet()) { - breadcrumb.getData().put(entry.getKey(), entry.getValue()); + breadcrumb.setData(entry.getKey(), entry.getValue()); } breadcrumb.setLevel(SentryLevel.INFO); return breadcrumb; @@ -553,9 +562,9 @@ public Breadcrumb(@Nullable String message) { @SuppressWarnings("JavaUtilDate") public @NotNull Date getTimestamp() { if (timestamp != null) { - return (Date) timestamp.clone(); + return timestamp; } else if (timestampMs != null) { - // we memoize it here into timestamp to avoid instantiating Calendar again and again + // we memoize it here into timestamp to avoid creating a Date again and again timestamp = DateUtils.getDateTime(timestampMs); return timestamp; } @@ -598,6 +607,20 @@ public void setType(@Nullable String type) { this.type = type; } + private @NotNull Map getOrCreateData() { + Map currentData = data; + if (currentData == EMPTY_DATA) { + synchronized (this) { + currentData = data; + if (currentData == EMPTY_DATA) { + currentData = new ConcurrentHashMap<>(); + data = currentData; + } + } + } + return currentData; + } + /** * Returns the data map * @@ -606,7 +629,7 @@ public void setType(@Nullable String type) { @ApiStatus.Internal @NotNull public Map getData() { - return data; + return getOrCreateData(); } /** @@ -636,7 +659,7 @@ public void setData(@Nullable String key, @Nullable Object value) { if (value == null) { removeData(key); } else { - data.put(key, value); + getOrCreateData().put(key, value); } } @@ -649,7 +672,10 @@ public void removeData(@Nullable String key) { if (key == null) { return; } - data.remove(key); + final Map currentData = data; + if (currentData != EMPTY_DATA) { + currentData.remove(key); + } } /** @@ -823,7 +849,12 @@ public static final class JsonKeys { public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger logger) throws IOException { writer.beginObject(); - writer.name(JsonKeys.TIMESTAMP).value(logger, getTimestamp()); + writer + .name(JsonKeys.TIMESTAMP) + .value( + timestampMs != null + ? DateUtils.getTimestampFromMillis(timestampMs) + : DateUtils.getTimestamp(getTimestamp())); if (message != null) { writer.name(JsonKeys.MESSAGE).value(message); } @@ -859,7 +890,7 @@ public static final class Deserializer implements JsonDeserializer { @NotNull Date timestamp = DateUtils.getCurrentDateTime(); String message = null; String type = null; - @NotNull Map data = new ConcurrentHashMap<>(); + Map data = null; String category = null; String origin = null; SentryLevel level = null; @@ -884,7 +915,7 @@ public static final class Deserializer implements JsonDeserializer { Map deserializedData = CollectionUtils.newConcurrentHashMap( (Map) reader.nextObjectOrNull()); - if (deserializedData != null) { + if (deserializedData != null && !deserializedData.isEmpty()) { data = deserializedData; } break; @@ -913,7 +944,9 @@ public static final class Deserializer implements JsonDeserializer { Breadcrumb breadcrumb = new Breadcrumb(timestamp); breadcrumb.message = message; breadcrumb.type = type; - breadcrumb.data = data; + if (data != null) { + breadcrumb.data = data; + } breadcrumb.category = category; breadcrumb.origin = origin; breadcrumb.level = level; diff --git a/sentry/src/main/java/io/sentry/CombinedScopeView.java b/sentry/src/main/java/io/sentry/CombinedScopeView.java index f21f8697fa4..ea2d752d44b 100644 --- a/sentry/src/main/java/io/sentry/CombinedScopeView.java +++ b/sentry/src/main/java/io/sentry/CombinedScopeView.java @@ -171,10 +171,31 @@ public void setFingerprint(@NotNull List fingerprint) { @Override public @NotNull Queue getBreadcrumbs() { + final @NotNull Queue globalBreadcrumbs = globalScope.getBreadcrumbs(); + final @NotNull Queue isolationBreadcrumbs = isolationScope.getBreadcrumbs(); + final @NotNull Queue currentBreadcrumbs = scope.getBreadcrumbs(); + + final boolean hasGlobalBreadcrumbs = !globalBreadcrumbs.isEmpty(); + final boolean hasIsolationBreadcrumbs = !isolationBreadcrumbs.isEmpty(); + final boolean hasCurrentBreadcrumbs = !currentBreadcrumbs.isEmpty(); + + if (!hasGlobalBreadcrumbs && !hasIsolationBreadcrumbs && !hasCurrentBreadcrumbs) { + return getDefaultScopeValue(globalBreadcrumbs, isolationBreadcrumbs, currentBreadcrumbs); + } + if (!hasIsolationBreadcrumbs && !hasCurrentBreadcrumbs) { + return globalBreadcrumbs; + } + if (!hasGlobalBreadcrumbs && !hasCurrentBreadcrumbs) { + return isolationBreadcrumbs; + } + if (!hasGlobalBreadcrumbs && !hasIsolationBreadcrumbs) { + return currentBreadcrumbs; + } + final @NotNull List allBreadcrumbs = new ArrayList<>(); - allBreadcrumbs.addAll(globalScope.getBreadcrumbs()); - allBreadcrumbs.addAll(isolationScope.getBreadcrumbs()); - allBreadcrumbs.addAll(scope.getBreadcrumbs()); + allBreadcrumbs.addAll(globalBreadcrumbs); + allBreadcrumbs.addAll(isolationBreadcrumbs); + allBreadcrumbs.addAll(currentBreadcrumbs); Collections.sort(allBreadcrumbs); final @NotNull Queue breadcrumbs = @@ -224,10 +245,31 @@ public void clear() { @Override public @NotNull Map getTags() { + final @NotNull Map globalTags = globalScope.getTags(); + final @NotNull Map isolationTags = isolationScope.getTags(); + final @NotNull Map currentTags = scope.getTags(); + + final boolean hasGlobalTags = !globalTags.isEmpty(); + final boolean hasIsolationTags = !isolationTags.isEmpty(); + final boolean hasCurrentTags = !currentTags.isEmpty(); + + if (!hasGlobalTags && !hasIsolationTags && !hasCurrentTags) { + return getDefaultScopeValue(globalTags, isolationTags, currentTags); + } + if (!hasIsolationTags && !hasCurrentTags) { + return globalTags; + } + if (!hasGlobalTags && !hasCurrentTags) { + return isolationTags; + } + if (!hasGlobalTags && !hasIsolationTags) { + return currentTags; + } + final @NotNull Map allTags = new ConcurrentHashMap<>(); - allTags.putAll(globalScope.getTags()); - allTags.putAll(isolationScope.getTags()); - allTags.putAll(scope.getTags()); + allTags.putAll(globalTags); + allTags.putAll(isolationTags); + allTags.putAll(currentTags); return allTags; } @@ -243,10 +285,32 @@ public void removeTag(@Nullable String key) { @Override public @NotNull Map getAttributes() { + final @NotNull Map globalAttributes = globalScope.getAttributes(); + final @NotNull Map isolationAttributes = + isolationScope.getAttributes(); + final @NotNull Map currentAttributes = scope.getAttributes(); + + final boolean hasGlobalAttributes = !globalAttributes.isEmpty(); + final boolean hasIsolationAttributes = !isolationAttributes.isEmpty(); + final boolean hasCurrentAttributes = !currentAttributes.isEmpty(); + + if (!hasGlobalAttributes && !hasIsolationAttributes && !hasCurrentAttributes) { + return getDefaultScopeValue(globalAttributes, isolationAttributes, currentAttributes); + } + if (!hasIsolationAttributes && !hasCurrentAttributes) { + return globalAttributes; + } + if (!hasGlobalAttributes && !hasCurrentAttributes) { + return isolationAttributes; + } + if (!hasGlobalAttributes && !hasIsolationAttributes) { + return currentAttributes; + } + final @NotNull Map allAttributes = new ConcurrentHashMap<>(); - allAttributes.putAll(globalScope.getAttributes()); - allAttributes.putAll(isolationScope.getAttributes()); - allAttributes.putAll(scope.getAttributes()); + allAttributes.putAll(globalAttributes); + allAttributes.putAll(isolationAttributes); + allAttributes.putAll(currentAttributes); return allAttributes; } @@ -272,11 +336,32 @@ public void removeAttribute(@Nullable String key) { @Override public @NotNull Map getExtras() { - final @NotNull Map allTags = new ConcurrentHashMap<>(); - allTags.putAll(globalScope.getExtras()); - allTags.putAll(isolationScope.getExtras()); - allTags.putAll(scope.getExtras()); - return allTags; + final @NotNull Map globalExtras = globalScope.getExtras(); + final @NotNull Map isolationExtras = isolationScope.getExtras(); + final @NotNull Map currentExtras = scope.getExtras(); + + final boolean hasGlobalExtras = !globalExtras.isEmpty(); + final boolean hasIsolationExtras = !isolationExtras.isEmpty(); + final boolean hasCurrentExtras = !currentExtras.isEmpty(); + + if (!hasGlobalExtras && !hasIsolationExtras && !hasCurrentExtras) { + return getDefaultScopeValue(globalExtras, isolationExtras, currentExtras); + } + if (!hasIsolationExtras && !hasCurrentExtras) { + return globalExtras; + } + if (!hasGlobalExtras && !hasCurrentExtras) { + return isolationExtras; + } + if (!hasGlobalExtras && !hasIsolationExtras) { + return currentExtras; + } + + final @NotNull Map allExtras = new ConcurrentHashMap<>(); + allExtras.putAll(globalExtras); + allExtras.putAll(isolationExtras); + allExtras.putAll(currentExtras); + return allExtras; } @Override @@ -342,6 +427,23 @@ public void removeContexts(@Nullable String key) { return getSpecificScope(null); } + private @NotNull T getDefaultScopeValue( + final @NotNull T globalValue, + final @NotNull T isolationValue, + final @NotNull T currentValue) { + switch (getOptions().getDefaultScopeType()) { + case CURRENT: + return currentValue; + case ISOLATION: + return isolationValue; + case GLOBAL: + return globalValue; + default: + // calm the compiler + return currentValue; + } + } + IScope getSpecificScope(final @Nullable ScopeType scopeType) { if (scopeType != null) { switch (scopeType) { @@ -373,10 +475,31 @@ IScope getSpecificScope(final @Nullable ScopeType scopeType) { @Override public @NotNull List getAttachments() { + final @NotNull List globalAttachments = globalScope.getAttachments(); + final @NotNull List isolationAttachments = isolationScope.getAttachments(); + final @NotNull List currentAttachments = scope.getAttachments(); + + final boolean hasGlobalAttachments = !globalAttachments.isEmpty(); + final boolean hasIsolationAttachments = !isolationAttachments.isEmpty(); + final boolean hasCurrentAttachments = !currentAttachments.isEmpty(); + + if (!hasGlobalAttachments && !hasIsolationAttachments && !hasCurrentAttachments) { + return getDefaultScopeValue(globalAttachments, isolationAttachments, currentAttachments); + } + if (!hasIsolationAttachments && !hasCurrentAttachments) { + return globalAttachments; + } + if (!hasGlobalAttachments && !hasCurrentAttachments) { + return isolationAttachments; + } + if (!hasGlobalAttachments && !hasIsolationAttachments) { + return currentAttachments; + } + final @NotNull List allAttachments = new CopyOnWriteArrayList<>(); - allAttachments.addAll(globalScope.getAttachments()); - allAttachments.addAll(isolationScope.getAttachments()); - allAttachments.addAll(scope.getAttachments()); + allAttachments.addAll(globalAttachments); + allAttachments.addAll(isolationAttachments); + allAttachments.addAll(currentAttachments); return allAttachments; } diff --git a/sentry/src/main/java/io/sentry/DateUtils.java b/sentry/src/main/java/io/sentry/DateUtils.java index e407391c394..fcba83fbe05 100644 --- a/sentry/src/main/java/io/sentry/DateUtils.java +++ b/sentry/src/main/java/io/sentry/DateUtils.java @@ -1,13 +1,8 @@ package io.sentry; -import static io.sentry.vendor.gson.internal.bind.util.ISO8601Utils.TIMEZONE_UTC; - -import io.sentry.vendor.gson.internal.bind.util.ISO8601Utils; +import io.sentry.vendor.SentryIso8601Utils; import java.math.BigDecimal; import java.math.RoundingMode; -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.Calendar; import java.util.Date; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -15,6 +10,7 @@ /** Utilities to deal with dates */ @ApiStatus.Internal +@SuppressWarnings("JavaUtilDate") public final class DateUtils { private DateUtils() {} @@ -24,10 +20,9 @@ private DateUtils() {} * * @return the UTC Date */ - @SuppressWarnings("JdkObsolete") + @SuppressWarnings("JavaUtilDate") public static @NotNull Date getCurrentDateTime() { - final Calendar calendar = Calendar.getInstance(TIMEZONE_UTC); - return calendar.getTime(); + return new Date(); } /** @@ -39,8 +34,8 @@ private DateUtils() {} public static @NotNull Date getDateTime(final @NotNull String timestamp) throws IllegalArgumentException { try { - return ISO8601Utils.parse(timestamp, new ParsePosition(0)); - } catch (ParseException e) { + return getDateTime(SentryIso8601Utils.parseTimestamp(timestamp)); + } catch (IllegalArgumentException e) { throw new IllegalArgumentException("timestamp is not ISO format " + timestamp); } } @@ -51,7 +46,6 @@ private DateUtils() {} * @param timestamp millis eg 1581410911.988 (1581410911 seconds and 988 millis) * @return the UTC Date */ - @SuppressWarnings("JdkObsolete") public static @NotNull Date getDateTimeWithMillisPrecision(final @NotNull String timestamp) throws IllegalArgumentException { try { @@ -69,7 +63,17 @@ private DateUtils() {} * @return the UTC/ISO 8601 timestamp */ public static @NotNull String getTimestamp(final @NotNull Date date) { - return ISO8601Utils.format(date, true); + return getTimestampFromMillis(date.getTime()); + } + + /** + * Get the UTC/ISO 8601 timestamp from millis. + * + * @param millis the UTC millis from the epoch + * @return the UTC/ISO 8601 timestamp + */ + static @NotNull String getTimestampFromMillis(final long millis) { + return SentryIso8601Utils.formatTimestamp(millis); } /** @@ -78,10 +82,9 @@ private DateUtils() {} * @param millis the UTC millis from the epoch * @return the UTC Date */ + @SuppressWarnings("JavaUtilDate") public static @NotNull Date getDateTime(final long millis) { - final Calendar calendar = Calendar.getInstance(TIMEZONE_UTC); - calendar.setTimeInMillis(millis); - return calendar.getTime(); + return new Date(millis); } /** diff --git a/sentry/src/main/java/io/sentry/JsonObjectSerializer.java b/sentry/src/main/java/io/sentry/JsonObjectSerializer.java index 5f986746be9..38abc960521 100644 --- a/sentry/src/main/java/io/sentry/JsonObjectSerializer.java +++ b/sentry/src/main/java/io/sentry/JsonObjectSerializer.java @@ -28,10 +28,11 @@ public final class JsonObjectSerializer { public static final String OBJECT_PLACEHOLDER = "[OBJECT]"; - public final JsonReflectionObjectSerializer jsonReflectionObjectSerializer; + private final int maxDepth; + private @Nullable JsonReflectionObjectSerializer jsonReflectionObjectSerializer; public JsonObjectSerializer(int maxDepth) { - jsonReflectionObjectSerializer = new JsonReflectionObjectSerializer(maxDepth); + this.maxDepth = maxDepth; } public void serialize( @@ -127,7 +128,7 @@ public void serialize( writer.value(object.toString()); } else { try { - Object serializableObject = jsonReflectionObjectSerializer.serialize(object, logger); + Object serializableObject = getJsonReflectionObjectSerializer().serialize(object, logger); serialize(writer, logger, serializableObject); } catch (Exception exception) { logger.log(SentryLevel.ERROR, "Failed serializing unknown object.", exception); @@ -138,6 +139,13 @@ public void serialize( // Helper + private @NotNull JsonReflectionObjectSerializer getJsonReflectionObjectSerializer() { + if (jsonReflectionObjectSerializer == null) { + jsonReflectionObjectSerializer = new JsonReflectionObjectSerializer(maxDepth); + } + return jsonReflectionObjectSerializer; + } + private void serializeDate( @NotNull ObjectWriter writer, @NotNull ILogger logger, @NotNull Date date) throws IOException { diff --git a/sentry/src/main/java/io/sentry/JsonReflectionObjectSerializer.java b/sentry/src/main/java/io/sentry/JsonReflectionObjectSerializer.java index 97c23031044..bb9ee1fcd3f 100644 --- a/sentry/src/main/java/io/sentry/JsonReflectionObjectSerializer.java +++ b/sentry/src/main/java/io/sentry/JsonReflectionObjectSerializer.java @@ -30,7 +30,7 @@ @ApiStatus.Internal public final class JsonReflectionObjectSerializer { - private final Set visiting = new HashSet<>(); + private @Nullable Set visiting; private final int maxDepth; JsonReflectionObjectSerializer(int maxDepth) { @@ -69,6 +69,7 @@ public final class JsonReflectionObjectSerializer { } else if (object.getClass().isEnum()) { return object.toString(); } else { + final Set visiting = getVisiting(); if (visiting.contains(object)) { logger.log(SentryLevel.INFO, "Cyclic reference detected. Calling toString() on object."); return object.toString(); @@ -135,6 +136,13 @@ public final class JsonReflectionObjectSerializer { // Helper + private @NotNull Set getVisiting() { + if (visiting == null) { + visiting = new HashSet<>(); + } + return visiting; + } + private @NotNull List list(@NotNull Object[] objectArray, @NotNull ILogger logger) throws Exception { List list = new ArrayList<>(); diff --git a/sentry/src/main/java/io/sentry/JsonSerializer.java b/sentry/src/main/java/io/sentry/JsonSerializer.java index 2b24090d0cc..79a1c72bef3 100644 --- a/sentry/src/main/java/io/sentry/JsonSerializer.java +++ b/sentry/src/main/java/io/sentry/JsonSerializer.java @@ -64,6 +64,8 @@ public final class JsonSerializer implements ISerializer { @SuppressWarnings("CharsetObjectCanBeUsed") private static final Charset UTF_8 = Charset.forName("UTF-8"); + private static final int WRITER_BUFFER_SIZE = 512; + /** the SentryOptions */ private final @NotNull SentryOptions options; @@ -233,7 +235,8 @@ public void serialize(@NotNull SentryEnvelope envelope, @NotNull OutputStream ou // we do not want to close these as we would also close the stream that was passed in final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream); - final Writer writer = new BufferedWriter(new OutputStreamWriter(bufferedOutputStream, UTF_8)); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(bufferedOutputStream, UTF_8), WRITER_BUFFER_SIZE); try { envelope diff --git a/sentry/src/main/java/io/sentry/MainEventProcessor.java b/sentry/src/main/java/io/sentry/MainEventProcessor.java index 8c684bfb65a..d84c9e47be8 100644 --- a/sentry/src/main/java/io/sentry/MainEventProcessor.java +++ b/sentry/src/main/java/io/sentry/MainEventProcessor.java @@ -11,7 +11,6 @@ import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.jetbrains.annotations.ApiStatus; @@ -191,7 +190,7 @@ private void setSdk(final @NotNull SentryBaseEvent event) { private void setTags(final @NotNull SentryBaseEvent event) { if (event.getTags() == null) { - event.setTags(new HashMap<>(options.getTags())); + event.setTags(options.getTags()); } else { for (Map.Entry item : options.getTags().entrySet()) { if (!event.getTags().containsKey(item.getKey())) { diff --git a/sentry/src/main/java/io/sentry/MonitorContexts.java b/sentry/src/main/java/io/sentry/MonitorContexts.java index 193d9ee5a6f..a52ecc6b97f 100644 --- a/sentry/src/main/java/io/sentry/MonitorContexts.java +++ b/sentry/src/main/java/io/sentry/MonitorContexts.java @@ -1,10 +1,9 @@ package io.sentry; +import io.sentry.util.CollectionUtils; import io.sentry.util.Objects; import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; -import java.util.Collections; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,8 +48,7 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger throws IOException { writer.beginObject(); // Serialize in alphabetical order to keep determinism. - final List sortedKeys = Collections.list(keys()); - Collections.sort(sortedKeys); + final String[] sortedKeys = CollectionUtils.toSortedStringArray(keys(), size()); for (final String key : sortedKeys) { final Object value = get(key); if (value != null) { diff --git a/sentry/src/main/java/io/sentry/OptionsContainer.java b/sentry/src/main/java/io/sentry/OptionsContainer.java index 52032880aaf..b29aef2e000 100644 --- a/sentry/src/main/java/io/sentry/OptionsContainer.java +++ b/sentry/src/main/java/io/sentry/OptionsContainer.java @@ -1,28 +1,40 @@ package io.sentry; +import com.jakewharton.nopen.annotation.Open; +import io.sentry.util.Objects; import java.lang.reflect.InvocationTargetException; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; @ApiStatus.Internal -public final class OptionsContainer { +@Open +public class OptionsContainer { public @NotNull static OptionsContainer create(final @NotNull Class clazz) { return new OptionsContainer<>(clazz); } - private final @NotNull Class clazz; + private final @Nullable Class clazz; private OptionsContainer(final @NotNull Class clazz) { super(); this.clazz = clazz; } + /** Constructor for subclasses that create the instance directly without reflection. */ + protected OptionsContainer() { + super(); + this.clazz = null; + } + public @NotNull T createInstance() throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - return clazz.getDeclaredConstructor().newInstance(); + return Objects.requireNonNull(clazz, "OptionsContainer clazz is required") + .getDeclaredConstructor() + .newInstance(); } } diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 78225f05d19..a739eddd9d9 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -27,7 +27,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.jetbrains.annotations.ApiStatus; @@ -1425,7 +1424,7 @@ public void captureBatchedMetricsEvents(final @NotNull SentryMetricsEvents metri event.setUser(scope.getUser()); } if (event.getTags() == null) { - event.setTags(new HashMap<>(scope.getTags())); + event.setTags(scope.getTags()); } else { for (Map.Entry item : scope.getTags().entrySet()) { if (!event.getTags().containsKey(item.getKey())) { @@ -1483,7 +1482,7 @@ public void captureBatchedMetricsEvents(final @NotNull SentryMetricsEvents metri replayEvent.setUser(scope.getUser()); } if (replayEvent.getTags() == null) { - replayEvent.setTags(new HashMap<>(scope.getTags())); + replayEvent.setTags(scope.getTags()); } else { for (Map.Entry item : scope.getTags().entrySet()) { if (!replayEvent.getTags().containsKey(item.getKey())) { @@ -1523,7 +1522,7 @@ public void captureBatchedMetricsEvents(final @NotNull SentryMetricsEvents metri sentryBaseEvent.setUser(scope.getUser()); } if (sentryBaseEvent.getTags() == null) { - sentryBaseEvent.setTags(new HashMap<>(scope.getTags())); + sentryBaseEvent.setTags(scope.getTags()); } else { for (Map.Entry item : scope.getTags().entrySet()) { if (!sentryBaseEvent.getTags().containsKey(item.getKey())) { @@ -1537,7 +1536,7 @@ public void captureBatchedMetricsEvents(final @NotNull SentryMetricsEvents metri sortBreadcrumbsByDate(sentryBaseEvent, scope.getBreadcrumbs()); } if (sentryBaseEvent.getExtras() == null) { - sentryBaseEvent.setExtras(new HashMap<>(scope.getExtras())); + sentryBaseEvent.setExtras(scope.getExtras()); } else { for (Map.Entry item : scope.getExtras().entrySet()) { if (!sentryBaseEvent.getExtras().containsKey(item.getKey())) { diff --git a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java index dbbc36524db..728478f5906 100644 --- a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java +++ b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java @@ -41,6 +41,8 @@ public final class SentryEnvelopeItem { @SuppressWarnings("CharsetObjectCanBeUsed") private static final Charset UTF_8 = Charset.forName("UTF-8"); + private static final int WRITER_BUFFER_SIZE = 512; + private final SentryEnvelopeItemHeader header; // Either dataFactory is set or data needs to be set. private final @Nullable Callable dataFactory; @@ -85,7 +87,9 @@ public final class SentryEnvelopeItem { new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(session, writer); return stream.toByteArray(); } @@ -119,7 +123,9 @@ public final class SentryEnvelopeItem { new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(event, writer); return stream.toByteArray(); } @@ -179,7 +185,9 @@ public static SentryEnvelopeItem fromUserFeedback( new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(userFeedback, writer); return stream.toByteArray(); } @@ -206,7 +214,9 @@ public static SentryEnvelopeItem fromCheckIn( new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(checkIn, writer); return stream.toByteArray(); } @@ -344,7 +354,9 @@ private static void ensureAttachmentSizeLimit( } try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(profileChunk, writer); return stream.toByteArray(); } catch (IOException e) { @@ -403,7 +415,9 @@ private static void ensureAttachmentSizeLimit( profilingTraceData.readDeviceCpuFrequencies(); try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(profilingTraceData, writer); return stream.toByteArray(); } catch (IOException e) { @@ -437,7 +451,9 @@ private static void ensureAttachmentSizeLimit( new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(clientReport, writer); return stream.toByteArray(); } @@ -481,7 +497,8 @@ public static SentryEnvelopeItem fromReplay( try { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); final Writer writer = - new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { // relay expects the payload to be in this exact order: [event,rrweb,video] final Map replayPayload = new LinkedHashMap<>(); // first serialize replay event json bytes @@ -541,7 +558,9 @@ public static SentryEnvelopeItem fromLogs( new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(logEvents, writer); return stream.toByteArray(); } @@ -571,7 +590,9 @@ public static SentryEnvelopeItem fromMetrics( new CachedItem( () -> { try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + final Writer writer = + new BufferedWriter( + new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { serializer.serialize(metricsEvents, writer); return stream.toByteArray(); } diff --git a/sentry/src/main/java/io/sentry/SentryEvent.java b/sentry/src/main/java/io/sentry/SentryEvent.java index 007d50681fb..8b8575fe7ec 100644 --- a/sentry/src/main/java/io/sentry/SentryEvent.java +++ b/sentry/src/main/java/io/sentry/SentryEvent.java @@ -114,7 +114,7 @@ public SentryEvent(final @NotNull Date timestamp) { @SuppressWarnings({"JdkObsolete", "JavaUtilDate"}) public Date getTimestamp() { - return (Date) timestamp.clone(); + return timestamp; } public void setTimestamp(final @NotNull Date timestamp) { diff --git a/sentry/src/main/java/io/sentry/Session.java b/sentry/src/main/java/io/sentry/Session.java index 3ce2d70e89e..2fdfffb35d9 100644 --- a/sentry/src/main/java/io/sentry/Session.java +++ b/sentry/src/main/java/io/sentry/Session.java @@ -131,10 +131,7 @@ public boolean isTerminated() { @SuppressWarnings({"JdkObsolete", "JavaUtilDate"}) public @Nullable Date getStarted() { - if (started == null) { - return null; - } - return (Date) started.clone(); + return started; } public @Nullable String getDistinctId() { @@ -193,8 +190,7 @@ public int errorCount() { @SuppressWarnings({"JdkObsolete", "JavaUtilDate"}) public @Nullable Date getTimestamp() { - final Date timestampRef = timestamp; - return timestampRef != null ? (Date) timestampRef.clone() : null; + return timestamp; } /** Ends a session and update its values */ diff --git a/sentry/src/main/java/io/sentry/protocol/App.java b/sentry/src/main/java/io/sentry/protocol/App.java index 989c3464be8..878ad0ec960 100644 --- a/sentry/src/main/java/io/sentry/protocol/App.java +++ b/sentry/src/main/java/io/sentry/protocol/App.java @@ -98,8 +98,7 @@ public void setAppIdentifier(final @Nullable String appIdentifier) { @SuppressWarnings({"JdkObsolete", "JavaUtilDate"}) public @Nullable Date getAppStartTime() { - final Date appStartTimeRef = appStartTime; - return appStartTimeRef != null ? (Date) appStartTimeRef.clone() : null; + return appStartTime; } public void setAppStartTime(final @Nullable Date appStartTime) { diff --git a/sentry/src/main/java/io/sentry/protocol/Contexts.java b/sentry/src/main/java/io/sentry/protocol/Contexts.java index 35168e5bcc2..83a770eb0fc 100644 --- a/sentry/src/main/java/io/sentry/protocol/Contexts.java +++ b/sentry/src/main/java/io/sentry/protocol/Contexts.java @@ -10,14 +10,13 @@ import io.sentry.ProfileContext; import io.sentry.SpanContext; import io.sentry.util.AutoClosableReentrantLock; +import io.sentry.util.CollectionUtils; import io.sentry.util.HintUtils; import io.sentry.util.Objects; import io.sentry.vendor.gson.stream.JsonToken; import java.io.IOException; -import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -302,8 +301,7 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger throws IOException { writer.beginObject(); // Serialize in alphabetical order to keep determinism. - final List sortedKeys = Collections.list(keys()); - Collections.sort(sortedKeys); + final String[] sortedKeys = CollectionUtils.toSortedStringArray(keys(), internalStorage.size()); for (final String key : sortedKeys) { final Object value = get(key); if (value != null) { diff --git a/sentry/src/main/java/io/sentry/protocol/Device.java b/sentry/src/main/java/io/sentry/protocol/Device.java index e6113efbcb5..5b765640a39 100644 --- a/sentry/src/main/java/io/sentry/protocol/Device.java +++ b/sentry/src/main/java/io/sentry/protocol/Device.java @@ -366,8 +366,7 @@ public void setScreenDpi(final @Nullable Integer screenDpi) { @SuppressWarnings({"JdkObsolete", "JavaUtilDate"}) public @Nullable Date getBootTime() { - final Date bootTimeRef = bootTime; - return bootTimeRef != null ? (Date) bootTimeRef.clone() : null; + return bootTime; } public void setBootTime(final @Nullable Date bootTime) { diff --git a/sentry/src/main/java/io/sentry/util/CollectionUtils.java b/sentry/src/main/java/io/sentry/util/CollectionUtils.java index 266055fa1ce..5b00eb6531c 100644 --- a/sentry/src/main/java/io/sentry/util/CollectionUtils.java +++ b/sentry/src/main/java/io/sentry/util/CollectionUtils.java @@ -1,7 +1,9 @@ package io.sentry.util; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; +import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.ListIterator; @@ -15,9 +17,28 @@ /** Util class for Collections */ @ApiStatus.Internal public final class CollectionUtils { + private static final String[] EMPTY_STRINGS = new String[0]; private CollectionUtils() {} + public static @NotNull String[] toSortedStringArray( + final @NotNull Enumeration source, final int size) { + String[] sorted = size == 0 ? EMPTY_STRINGS : new String[size]; + int index = 0; + while (source.hasMoreElements()) { + if (index == sorted.length) { + sorted = Arrays.copyOf(sorted, sorted.length + 1); + } + sorted[index] = source.nextElement(); + index++; + } + if (index != sorted.length) { + sorted = Arrays.copyOf(sorted, index); + } + Arrays.sort(sorted); + return sorted; + } + /** * Returns an Iterator size * diff --git a/sentry/src/main/java/io/sentry/util/Platform.java b/sentry/src/main/java/io/sentry/util/Platform.java index cc924fb2815..ad2a4e7f3c3 100644 --- a/sentry/src/main/java/io/sentry/util/Platform.java +++ b/sentry/src/main/java/io/sentry/util/Platform.java @@ -20,16 +20,21 @@ public final class Platform { isAndroid = false; } - try { - final @Nullable String javaStringVersion = System.getProperty("java.specification.version"); - if (javaStringVersion != null) { - final @NotNull double javaVersion = Double.parseDouble(javaStringVersion); - isJavaNinePlus = javaVersion >= 9.0; - } else { + if (isAndroid) { + // Android is never Java 9+, skip the system property lookup + parse on the startup path. + isJavaNinePlus = false; + } else { + try { + final @Nullable String javaStringVersion = System.getProperty("java.specification.version"); + if (javaStringVersion != null) { + final @NotNull double javaVersion = Double.parseDouble(javaStringVersion); + isJavaNinePlus = javaVersion >= 9.0; + } else { + isJavaNinePlus = false; + } + } catch (Throwable e) { isJavaNinePlus = false; } - } catch (Throwable e) { - isJavaNinePlus = false; } } diff --git a/sentry/src/main/java/io/sentry/vendor/SentryIso8601Utils.java b/sentry/src/main/java/io/sentry/vendor/SentryIso8601Utils.java new file mode 100644 index 00000000000..b5cb1811aa9 --- /dev/null +++ b/sentry/src/main/java/io/sentry/vendor/SentryIso8601Utils.java @@ -0,0 +1,397 @@ +// Civil date conversion algorithms adapted from Howard Hinnant's date algorithms. +// Placed in the public domain by Howard Hinnant. +// https://howardhinnant.github.io/date_algorithms.html + +package io.sentry.vendor; + +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.SimpleTimeZone; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +@ApiStatus.Internal +public final class SentryIso8601Utils { + + private static final long MILLIS_PER_SECOND = 1000L; + private static final long MILLIS_PER_MINUTE = 60L * MILLIS_PER_SECOND; + private static final long MILLIS_PER_HOUR = 60L * MILLIS_PER_MINUTE; + private static final long MILLIS_PER_DAY = 24L * MILLIS_PER_HOUR; + private static final long GREGORIAN_CUTOVER_MILLIS = -12219292800000L; + private static final int DAYS_0000_TO_1970 = 719468; + + private SentryIso8601Utils() {} + + public static long parseTimestamp(final @NotNull String timestamp) { + final int length = timestamp.length(); + int offset = 0; + + final int year = parseInt(timestamp, offset, offset += 4); + if (checkOffset(timestamp, offset, '-')) { + offset++; + } + + final int month = parseInt(timestamp, offset, offset += 2); + if (checkOffset(timestamp, offset, '-')) { + offset++; + } + + final int day = parseInt(timestamp, offset, offset += 2); + + if (!checkOffset(timestamp, offset, 'T')) { + if (offset == length) { + return dateOnlyEpochMillis(year, month, day); + } + final char timezoneIndicator = timestamp.charAt(offset); + if (timezoneIndicator == 'Z' || timezoneIndicator == '+' || timezoneIndicator == '-') { + return dateOnlyEpochMillisWithTimezone(timestamp, length, offset, year, month, day); + } + throw new IllegalArgumentException("Invalid date separator"); + } + validateDate(year, month, day); + offset++; + + final int hour = parseInt(timestamp, offset, offset += 2); + if (checkOffset(timestamp, offset, ':')) { + offset++; + } + + final int minute = parseInt(timestamp, offset, offset += 2); + if (checkOffset(timestamp, offset, ':')) { + offset++; + } + + int second = 0; + int millisecond = 0; + if (length > offset) { + final char c = timestamp.charAt(offset); + if (c != 'Z' && c != '+' && c != '-') { + second = parseInt(timestamp, offset, offset += 2); + if (second > 59 && second < 63) { + second = 59; + } + if (checkOffset(timestamp, offset, '.')) { + offset++; + final int endOffset = indexOfNonDigit(timestamp, offset); + if (endOffset == offset) { + throw new IllegalArgumentException("Missing millisecond digits"); + } + final int parseEndOffset = Math.min(endOffset, offset + 3); + final int fraction = parseInt(timestamp, offset, parseEndOffset); + switch (parseEndOffset - offset) { + case 1: + millisecond = fraction * 100; + break; + case 2: + millisecond = fraction * 10; + break; + default: + millisecond = fraction; + break; + } + offset = endOffset; + } + } + } + validateTime(hour, minute, second, millisecond); + + if (length <= offset) { + throw new IllegalArgumentException("No time zone indicator"); + } + + final int timezoneOffsetMillis; + final boolean allowTrailingCharacters; + final char timezoneIndicator = timestamp.charAt(offset); + if (timezoneIndicator == 'Z') { + timezoneOffsetMillis = 0; + offset++; + allowTrailingCharacters = true; + } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { + final int sign = timezoneIndicator == '+' ? 1 : -1; + offset++; + final int timezoneHour = parseInt(timestamp, offset, offset += 2); + int timezoneMinute = 0; + if (checkOffset(timestamp, offset, ':')) { + offset++; + } + if (length >= offset + 2) { + timezoneMinute = parseInt(timestamp, offset, offset += 2); + } + validateTimezone(timezoneHour, timezoneMinute); + timezoneOffsetMillis = + sign * (int) (timezoneHour * MILLIS_PER_HOUR + timezoneMinute * MILLIS_PER_MINUTE); + allowTrailingCharacters = false; + } else { + throw new IllegalArgumentException("Invalid time zone indicator"); + } + + if (!allowTrailingCharacters && offset != length) { + throw new IllegalArgumentException("Invalid trailing characters"); + } + + if (isBeforeGregorianCutover(year, month, day)) { + return epochMillisWithCalendar( + year, month, day, hour, minute, second, millisecond, timezoneOffsetMillis); + } + + return epochMillis(year, month, day, hour, minute, second, millisecond, timezoneOffsetMillis); + } + + public static @NotNull String formatTimestamp(final long millis) { + if (millis < GREGORIAN_CUTOVER_MILLIS) { + return formatTimestampWithCalendar(millis); + } + + final long epochDay = Math.floorDiv(millis, MILLIS_PER_DAY); + int millisOfDay = (int) Math.floorMod(millis, MILLIS_PER_DAY); + + final int[] yearMonthDay = epochDayToYearMonthDay(epochDay); + final int hour = millisOfDay / (int) MILLIS_PER_HOUR; + millisOfDay -= hour * (int) MILLIS_PER_HOUR; + final int minute = millisOfDay / (int) MILLIS_PER_MINUTE; + millisOfDay -= minute * (int) MILLIS_PER_MINUTE; + final int second = millisOfDay / (int) MILLIS_PER_SECOND; + final int millisecond = millisOfDay - second * (int) MILLIS_PER_SECOND; + + final StringBuilder timestamp = new StringBuilder("yyyy-MM-ddThh:mm:ss.sssZ".length()); + padInt(timestamp, yearMonthDay[0], "yyyy".length()); + timestamp.append('-'); + padInt(timestamp, yearMonthDay[1], "MM".length()); + timestamp.append('-'); + padInt(timestamp, yearMonthDay[2], "dd".length()); + timestamp.append('T'); + padInt(timestamp, hour, "hh".length()); + timestamp.append(':'); + padInt(timestamp, minute, "mm".length()); + timestamp.append(':'); + padInt(timestamp, second, "ss".length()); + timestamp.append('.'); + padInt(timestamp, millisecond, "sss".length()); + timestamp.append('Z'); + return timestamp.toString(); + } + + private static long dateOnlyEpochMillis(final int year, final int month, final int day) { + return new GregorianCalendar(year, month - 1, day).getTimeInMillis(); + } + + private static long dateOnlyEpochMillisWithTimezone( + final @NotNull String timestamp, + final int length, + int offset, + final int year, + final int month, + final int day) { + final int timezoneOffsetMillis; + final boolean allowTrailingCharacters; + final char timezoneIndicator = timestamp.charAt(offset); + if (timezoneIndicator == 'Z') { + timezoneOffsetMillis = 0; + offset++; + allowTrailingCharacters = true; + } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { + final int sign = timezoneIndicator == '+' ? 1 : -1; + offset++; + final int timezoneHour = parseInt(timestamp, offset, offset += 2); + int timezoneMinute = 0; + if (checkOffset(timestamp, offset, ':')) { + offset++; + } + if (length >= offset + 2) { + timezoneMinute = parseInt(timestamp, offset, offset += 2); + } + validateTimezone(timezoneHour, timezoneMinute); + timezoneOffsetMillis = + sign * (int) (timezoneHour * MILLIS_PER_HOUR + timezoneMinute * MILLIS_PER_MINUTE); + allowTrailingCharacters = false; + } else { + throw new IllegalArgumentException("Invalid time zone indicator"); + } + + if (!allowTrailingCharacters && offset != length) { + throw new IllegalArgumentException("Invalid trailing characters"); + } + + if (isBeforeGregorianCutover(year, month, day)) { + return epochMillisWithCalendar(year, month, day, 0, 0, 0, 0, timezoneOffsetMillis); + } + validateDate(year, month, day); + return epochMillis(year, month, day, 0, 0, 0, 0, timezoneOffsetMillis); + } + + private static long epochMillisWithCalendar( + final int year, + final int month, + final int day, + final int hour, + final int minute, + final int second, + final int millisecond, + final int timezoneOffsetMillis) { + final GregorianCalendar calendar = new GregorianCalendar(new SimpleTimeZone(timezoneOffsetMillis, "GMT")); + calendar.setLenient(false); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DAY_OF_MONTH, day); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minute); + calendar.set(Calendar.SECOND, second); + calendar.set(Calendar.MILLISECOND, millisecond); + return calendar.getTimeInMillis(); + } + + private static @NotNull String formatTimestampWithCalendar(final long millis) { + final GregorianCalendar calendar = new GregorianCalendar(new SimpleTimeZone(0, "UTC")); + calendar.setTimeInMillis(millis); + + final StringBuilder timestamp = new StringBuilder("yyyy-MM-ddThh:mm:ss.sssZ".length()); + padInt(timestamp, calendar.get(Calendar.YEAR), "yyyy".length()); + timestamp.append('-'); + padInt(timestamp, calendar.get(Calendar.MONTH) + 1, "MM".length()); + timestamp.append('-'); + padInt(timestamp, calendar.get(Calendar.DAY_OF_MONTH), "dd".length()); + timestamp.append('T'); + padInt(timestamp, calendar.get(Calendar.HOUR_OF_DAY), "hh".length()); + timestamp.append(':'); + padInt(timestamp, calendar.get(Calendar.MINUTE), "mm".length()); + timestamp.append(':'); + padInt(timestamp, calendar.get(Calendar.SECOND), "ss".length()); + timestamp.append('.'); + padInt(timestamp, calendar.get(Calendar.MILLISECOND), "sss".length()); + timestamp.append('Z'); + return timestamp.toString(); + } + + private static long epochMillis( + final int year, + final int month, + final int day, + final int hour, + final int minute, + final int second, + final int millisecond, + final int timezoneOffsetMillis) { + return daysFromYearMonthDay(year, month, day) * MILLIS_PER_DAY + + hour * MILLIS_PER_HOUR + + minute * MILLIS_PER_MINUTE + + second * MILLIS_PER_SECOND + + millisecond + - timezoneOffsetMillis; + } + + private static long daysFromYearMonthDay(int year, final int month, final int day) { + year -= month <= 2 ? 1 : 0; + final long era = Math.floorDiv(year, 400); + final int yearOfEra = (int) (year - era * 400); + final int dayOfYear = (153 * (month + (month > 2 ? -3 : 9)) + 2) / 5 + day - 1; + final int dayOfEra = yearOfEra * 365 + yearOfEra / 4 - yearOfEra / 100 + dayOfYear; + return era * 146097 + dayOfEra - DAYS_0000_TO_1970; + } + + private static int[] epochDayToYearMonthDay(long epochDay) { + epochDay += DAYS_0000_TO_1970; + final long era = Math.floorDiv(epochDay, 146097); + final int dayOfEra = (int) (epochDay - era * 146097); + final int yearOfEra = (dayOfEra - dayOfEra / 1460 + dayOfEra / 36524 - dayOfEra / 146096) / 365; + final int year = (int) (yearOfEra + era * 400); + final int dayOfYear = dayOfEra - (365 * yearOfEra + yearOfEra / 4 - yearOfEra / 100); + final int monthPrime = (5 * dayOfYear + 2) / 153; + final int day = dayOfYear - (153 * monthPrime + 2) / 5 + 1; + final int month = monthPrime < 10 ? monthPrime + 3 : monthPrime - 9; + return new int[] {year + (month <= 2 ? 1 : 0), month, day}; + } + + private static boolean isBeforeGregorianCutover(final int year, final int month, final int day) { + return year < 1582 || (year == 1582 && (month < 10 || (month == 10 && day < 15))); + } + + private static void validateDate(final int year, final int month, final int day) { + if (year < 1 || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) { + throw new IllegalArgumentException("Invalid date"); + } + } + + private static void validateTime( + final int hour, final int minute, final int second, final int millisecond) { + if (hour < 0 + || hour > 23 + || minute < 0 + || minute > 59 + || second < 0 + || second > 59 + || millisecond < 0 + || millisecond > 999) { + throw new IllegalArgumentException("Invalid time"); + } + } + + private static void validateTimezone(final int hour, final int minute) { + if (hour < 0 || hour > 23 || minute < 0 || minute > 59) { + throw new IllegalArgumentException("Invalid time zone"); + } + } + + private static int daysInMonth(final int year, final int month) { + switch (month) { + case 2: + return isLeapYear(year) ? 29 : 28; + case 4: + case 6: + case 9: + case 11: + return 30; + default: + return 31; + } + } + + private static boolean isLeapYear(final int year) { + return (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); + } + + private static boolean checkOffset( + final @NotNull String value, final int offset, final char expected) { + return offset < value.length() && value.charAt(offset) == expected; + } + + private static int parseInt( + final @NotNull String value, final int beginIndex, final int endIndex) { + if (beginIndex < 0 || endIndex > value.length() || beginIndex >= endIndex) { + throw new NumberFormatException(value); + } + + int result = 0; + for (int i = beginIndex; i < endIndex; i++) { + final char c = value.charAt(i); + if (c < '0' || c > '9') { + throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex)); + } + result = result * 10 + c - '0'; + } + return result; + } + + private static void padInt( + final @NotNull StringBuilder buffer, final int value, final int length) { + if (value < 0) { + buffer.append('-'); + padInt(buffer, -value, length); + return; + } + final String strValue = Integer.toString(value); + for (int i = length - strValue.length(); i > 0; i--) { + buffer.append('0'); + } + buffer.append(strValue); + } + + private static int indexOfNonDigit(final @NotNull String string, final int offset) { + for (int i = offset; i < string.length(); i++) { + final char c = string.charAt(i); + if (c < '0' || c > '9') { + return i; + } + } + return string.length(); + } +} diff --git a/sentry/src/main/java/io/sentry/vendor/gson/stream/JsonWriter.java b/sentry/src/main/java/io/sentry/vendor/gson/stream/JsonWriter.java index b030bc174b7..3119c833fd2 100644 --- a/sentry/src/main/java/io/sentry/vendor/gson/stream/JsonWriter.java +++ b/sentry/src/main/java/io/sentry/vendor/gson/stream/JsonWriter.java @@ -17,7 +17,7 @@ // Source: https://github.com/google/gson // Tag: gson-parent-2.8.7 // Commit Hash: 4520489c29e770c64b11ca35e0a0fdf17a1874ab -// Changes: @ApiStatus.Internal, SuppressWarnings +// Changes: @ApiStatus.Internal, SuppressWarnings, reduced stack size package io.sentry.vendor.gson.stream; @@ -175,7 +175,7 @@ public class JsonWriter implements Closeable, Flushable { /** The output data, containing at most one top-level array or object. */ private final Writer out; - private int[] stack = new int[32]; + private int[] stack = new int[8]; private int stackSize = 0; { push(EMPTY_DOCUMENT); diff --git a/sentry/src/test/java/io/sentry/BreadcrumbTest.kt b/sentry/src/test/java/io/sentry/BreadcrumbTest.kt index 30c322641b8..f51acca81cb 100644 --- a/sentry/src/test/java/io/sentry/BreadcrumbTest.kt +++ b/sentry/src/test/java/io/sentry/BreadcrumbTest.kt @@ -1,6 +1,9 @@ package io.sentry import java.util.Date +import java.util.concurrent.CountDownLatch +import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -329,6 +332,39 @@ class BreadcrumbTest { breadcrumb.removeData(null) } + @Test + fun `getData returns mutable map for new breadcrumb`() { + val breadcrumb = Breadcrumb() + + breadcrumb.data["k"] = "v" + + assertEquals("v", breadcrumb.getData("k")) + } + + @Test + fun `concurrent first writes keep all data entries`() { + val breadcrumb = Breadcrumb() + val count = 32 + val executor = Executors.newFixedThreadPool(count) + val start = CountDownLatch(1) + val futures = + (0 until count).map { index -> + executor.submit { + start.await() + breadcrumb.setData("key-$index", index) + } + } + + start.countDown() + futures.forEach { it.get(5, TimeUnit.SECONDS) } + executor.shutdown() + + assertEquals(count, breadcrumb.data.size) + for (index in 0 until count) { + assertEquals(index, breadcrumb.data["key-$index"]) + } + } + class TestKey(val id: Long) { override fun toString(): String = id.toString() } diff --git a/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt b/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt index d768d6d32d6..fd187235a92 100644 --- a/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt +++ b/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt @@ -11,6 +11,7 @@ import junit.framework.TestCase.assertTrue import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull +import kotlin.test.assertNotSame import kotlin.test.assertNull import kotlin.test.assertSame import org.junit.Assert.assertNotEquals @@ -72,6 +73,74 @@ class CombinedScopeViewTest { assertEquals("current 2", breadcrumbs.poll().message) } + @Test + fun `returns single non-empty breadcrumb queue directly`() { + var combined = fixture.getSut() + fixture.globalScope.addBreadcrumb(Breadcrumb.info("global")) + assertSame(fixture.globalScope.breadcrumbs, combined.breadcrumbs) + + combined = fixture.getSut() + fixture.isolationScope.addBreadcrumb(Breadcrumb.info("isolation")) + assertSame(fixture.isolationScope.breadcrumbs, combined.breadcrumbs) + + combined = fixture.getSut() + fixture.scope.addBreadcrumb(Breadcrumb.info("current")) + assertSame(fixture.scope.breadcrumbs, combined.breadcrumbs) + } + + @Test + fun `returns default write scope breadcrumbs when all scopes are empty`() { + val combined = fixture.getSut(SentryOptions().also { it.defaultScopeType = ScopeType.CURRENT }) + + assertSame(fixture.scope.breadcrumbs, combined.breadcrumbs) + } + + @Test + fun `returns merged breadcrumb copy when multiple scopes have breadcrumbs`() { + val combined = fixture.getSut() + + fixture.globalScope.addBreadcrumb(Breadcrumb.info("global")) + fixture.isolationScope.addBreadcrumb(Breadcrumb.info("isolation")) + + val breadcrumbs = combined.breadcrumbs + + assertNotSame(fixture.globalScope.breadcrumbs, breadcrumbs) + assertNotSame(fixture.isolationScope.breadcrumbs, breadcrumbs) + assertEquals(2, breadcrumbs.size) + } + + @Test + fun `returns single non-empty combined collections directly`() { + val globalScope = mock() + val isolationScope = mock() + val scope = mock() + val combined = CombinedScopeView(globalScope, isolationScope, scope) + + val tags = mapOf("tag" to "value") + whenever(globalScope.tags).thenReturn(emptyMap()) + whenever(isolationScope.tags).thenReturn(emptyMap()) + whenever(scope.tags).thenReturn(tags) + assertSame(tags, combined.tags) + + val attributes = mapOf("attribute" to SentryAttribute.named("attribute", "value")) + whenever(globalScope.attributes).thenReturn(emptyMap()) + whenever(isolationScope.attributes).thenReturn(emptyMap()) + whenever(scope.attributes).thenReturn(attributes) + assertSame(attributes, combined.attributes) + + val extras = mapOf("extra" to "value") + whenever(globalScope.extras).thenReturn(emptyMap()) + whenever(isolationScope.extras).thenReturn(emptyMap()) + whenever(scope.extras).thenReturn(extras) + assertSame(extras, combined.extras) + + val attachments = listOf(createAttachment("attachment.png")) + whenever(globalScope.attachments).thenReturn(emptyList()) + whenever(isolationScope.attachments).thenReturn(emptyList()) + whenever(scope.attachments).thenReturn(attachments) + assertSame(attachments, combined.attachments) + } + @Test fun `oldest breadcrumbs are dropped first`() { val options = SentryOptions().also { it.maxBreadcrumbs = 5 } diff --git a/sentry/src/test/java/io/sentry/DateUtilsTest.kt b/sentry/src/test/java/io/sentry/DateUtilsTest.kt index 9e234b50c1b..97882198e62 100644 --- a/sentry/src/test/java/io/sentry/DateUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/DateUtilsTest.kt @@ -1,12 +1,16 @@ package io.sentry +import io.sentry.vendor.gson.internal.bind.util.ISO8601Utils +import java.text.ParsePosition import java.time.Instant import java.time.LocalDateTime import java.time.ZoneId import java.time.format.DateTimeFormatter import java.util.Date +import java.util.TimeZone import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFailsWith import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -34,6 +38,54 @@ class DateUtilsTest { assertEquals("2020-03-27T08:52:58.000Z", timestamp) } + @Test + fun `When ISO date has offset`() { + val input = + mapOf( + "2020-03-27T10:52:58.015+02:00" to "2020-03-27T08:52:58.015Z", + "2020-03-27T10:52:58.015+0200" to "2020-03-27T08:52:58.015Z", + "2020-03-27T10:52:58.015+02" to "2020-03-27T08:52:58.015Z", + "2020-03-27T05:52:58.015-03:00" to "2020-03-27T08:52:58.015Z", + ) + + input.forEach { + val timestamp = convertDate(DateUtils.getDateTime(it.key)).format(isoFormat) + + assertEquals(it.value, timestamp) + } + } + + @Test + fun `When ISO date uses compact separators`() { + val date = DateUtils.getDateTime("20200327T085258.015Z") + + val utcDate = convertDate(date) + val timestamp = utcDate.format(isoFormat) + + assertEquals("2020-03-27T08:52:58.015Z", timestamp) + } + + @Test + fun `When ISO date has short fraction`() { + val input = + mapOf( + "2020-03-27T08:52:58.1Z" to "2020-03-27T08:52:58.100Z", + "2020-03-27T08:52:58.12Z" to "2020-03-27T08:52:58.120Z", + "2020-03-27T08:52:58.123456Z" to "2020-03-27T08:52:58.123Z", + ) + + input.forEach { + val timestamp = convertDate(DateUtils.getDateTime(it.key)).format(isoFormat) + + assertEquals(it.value, timestamp) + } + } + + @Test + fun `When ISO date is invalid`() { + assertFailsWith { DateUtils.getDateTime("2020-02-30T08:52:58Z") } + } + @Test fun `Converts from Date to ISO 8601 and back to Date`() { val currentDate = DateUtils.getCurrentDateTime() @@ -78,6 +130,147 @@ class DateUtilsTest { assertTrue { utcCurrentDate.minusSeconds(1).isBefore(utcDate) } } + @Test + fun `Formats millis to ISO 8601 timestamp`() { + val input = + mapOf( + Instant.parse("1970-01-01T00:00:00.000Z").toEpochMilli() to "1970-01-01T00:00:00.000Z", + Instant.parse("1969-12-31T23:59:59.999Z").toEpochMilli() to "1969-12-31T23:59:59.999Z", + Instant.parse("2000-02-29T12:34:56.789Z").toEpochMilli() to "2000-02-29T12:34:56.789Z", + Instant.parse("1900-03-01T00:00:00.000Z").toEpochMilli() to "1900-03-01T00:00:00.000Z", + Instant.parse("2100-03-01T00:00:00.000Z").toEpochMilli() to "2100-03-01T00:00:00.000Z", + Instant.parse("2400-02-29T23:59:59.999Z").toEpochMilli() to "2400-02-29T23:59:59.999Z", + ) + + input.forEach { assertEquals(it.value, DateUtils.getTimestampFromMillis(it.key)) } + } + + @Test + fun `Fast timestamp formatter matches previous ISO8601 formatter`() { + val input = + listOf( + "1582-10-04T00:00:00.000Z", + "1582-10-15T00:00:00.000Z", + "1900-03-01T00:00:00.000Z", + "1969-12-31T23:59:59.999Z", + "1970-01-01T00:00:00.000Z", + "1999-12-31T23:59:59.999Z", + "2000-02-29T12:34:56.789Z", + "2020-03-27T08:52:58.015Z", + "2024-02-29T23:59:59.001Z", + "2100-03-01T00:00:00.000Z", + "2400-02-29T23:59:59.999Z", + ) + + input + .map { ISO8601Utils.parse(it, ParsePosition(0)).time } + .forEach { + assertEquals( + ISO8601Utils.format(Date(it), true), + DateUtils.getTimestampFromMillis(it), + "millis=$it", + ) + } + } + + @Test + fun `Fast timestamp parser matches previous ISO8601 parser`() { + val input = + listOf( + "2020-03-27T08:52Z", + "2020-03-27T08:52:58Z", + "2020-03-27T08:52:58.015Z", + "20200327T085258.015Z", + "2020-03-27T10:52:58.015+02:00", + "2020-03-27T10:52:58.015+0200", + "2020-03-27T10:52:58.015+02", + "2020-03-27T05:52:58.015-03:00", + "2020-03-27T05:22:58.015-0330", + "2020-03-27T08:52:58.1Z", + "2020-03-27T08:52:58.12Z", + "2020-03-27T08:52:58.123456Z", + "2020-03-27T08:52:58Ztrailing", + "2016-12-31T23:59:60Z", + "1582-10-04T00:00:00.000Z", + "1582-10-15T00:00:00.000Z", + "1900-03-01T00:00:00.000Z", + "2000-02-29T12:34:56.789Z", + "2100-03-01T00:00:00.000Z", + ) + + input.forEach { + assertEquals( + ISO8601Utils.parse(it, ParsePosition(0)).time, + DateUtils.getDateTime(it).time, + "timestamp=$it", + ) + } + } + + @Test + fun `Fast timestamp parser matches previous ISO8601 parser for date-only values`() { + withDefaultTimeZone("America/Los_Angeles") { + val input = listOf("2020-03-27", "20200327", "2020-02-30") + + input.forEach { + assertEquals( + ISO8601Utils.parse(it, ParsePosition(0)).time, + DateUtils.getDateTime(it).time, + "timestamp=$it", + ) + } + } + } + + @Test + fun `Fast timestamp parser matches previous ISO8601 parser for date-only values with timezone`() { + val input = + listOf( + "2020-03-27Z", + "2020-03-27+02:00", + "2020-03-27+0200", + "2020-03-27+02", + "2020-03-27-03:30", + "20200327Z", + "20200327+02:00", + "20200327-0330", + ) + + input.forEach { + assertEquals( + ISO8601Utils.parse(it, ParsePosition(0)).time, + DateUtils.getDateTime(it).time, + "timestamp=$it", + ) + } + } + + @Test + fun `Fast timestamp parser rejects invalid date-only values with timezone like previous ISO8601 parser`() { + val timestamp = "2020-02-30Z" + + assertFailsWith { ISO8601Utils.parse(timestamp, ParsePosition(0)) } + assertFailsWith { DateUtils.getDateTime(timestamp) } + } + + @Test + fun `Fast timestamp parser rejects date-time without timezone like previous ISO8601 parser`() { + val input = listOf("2020-03-27T08:52", "2020-03-27T08:52:58", "2020-03-27T08:52:58.015") + + input.forEach { + assertFailsWith("timestamp=$it") { ISO8601Utils.parse(it, ParsePosition(0)) } + assertFailsWith("timestamp=$it") { DateUtils.getDateTime(it) } + } + } + + @Test + fun `Fast timestamp parser rejects Gregorian cutover gap like previous ISO8601 parser`() { + val timestamp = "1582-10-10T00:00:00.000Z" + + assertFailsWith { ISO8601Utils.parse(timestamp, ParsePosition(0)) } + assertFailsWith { DateUtils.getDateTime(timestamp) } + } + @Test fun `Millis formats to Date`() { val millis = 1591533492L * 1000L + 631 @@ -86,6 +279,7 @@ class DateUtilsTest { val utcActual = convertDate(actual) val timestamp = utcActual.format(isoFormat) + assertEquals(millis, actual.time) assertEquals("2020-06-07T12:38:12.631Z", timestamp) } @@ -120,6 +314,16 @@ class DateUtilsTest { private fun convertDate(date: Date): LocalDateTime = Instant.ofEpochMilli(date.time).atZone(utcTimeZone).toLocalDateTime() + private fun withDefaultTimeZone(timeZoneId: String, block: () -> Unit) { + val previousTimeZone = TimeZone.getDefault() + try { + TimeZone.setDefault(TimeZone.getTimeZone(timeZoneId)) + block() + } finally { + TimeZone.setDefault(previousTimeZone) + } + } + private fun assertClose(expected: Double, actual: Double?) { assertNotNull(actual) val diff = Math.abs(expected - actual) diff --git a/sentry/src/test/java/io/sentry/JsonObjectSerializerTest.kt b/sentry/src/test/java/io/sentry/JsonObjectSerializerTest.kt index 3323be84cda..572c27abced 100644 --- a/sentry/src/test/java/io/sentry/JsonObjectSerializerTest.kt +++ b/sentry/src/test/java/io/sentry/JsonObjectSerializerTest.kt @@ -7,6 +7,8 @@ import java.util.Locale import java.util.TimeZone import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicIntegerArray +import kotlin.test.assertNotNull +import kotlin.test.assertNull import org.junit.Test import org.mockito.kotlin.inOrder import org.mockito.kotlin.mock @@ -192,6 +194,21 @@ internal class JsonObjectSerializerTest { verify(jsonSerializable).serialize(fixture.writer, fixture.logger) } + @Test + fun `serialize json serializable does not create reflection serializer`() { + val serializer = fixture.getSUT() + val jsonSerializable: JsonSerializable = mock() + serializer.serialize(fixture.writer, fixture.logger, jsonSerializable) + assertNull(serializer.reflectionObjectSerializer) + } + + @Test + fun `serialize unknown object creates reflection serializer`() { + val serializer = fixture.getSUT() + serializer.serialize(fixture.writer, fixture.logger, object {}) + assertNotNull(serializer.reflectionObjectSerializer) + } + @Test fun `serialize unknown object without data`() { val value = object {} @@ -355,3 +372,10 @@ internal class JsonObjectSerializerTest { data class ClassWithEnumProperty(val enumProperty: DataCategory) data class ClassWithLocaleProperty(val localeProperty: Locale) + +private val JsonObjectSerializer.reflectionObjectSerializer: JsonReflectionObjectSerializer? + get() { + val field = JsonObjectSerializer::class.java.getDeclaredField("jsonReflectionObjectSerializer") + field.isAccessible = true + return field.get(this) as JsonReflectionObjectSerializer? + } diff --git a/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt b/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt index 229fd571871..fe5c835c90f 100644 --- a/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt +++ b/sentry/src/test/java/io/sentry/MainEventProcessorTest.kt @@ -358,6 +358,19 @@ class MainEventProcessorTest { } } + @Test + fun `options tags are copied when applied to event`() { + val sut = fixture.getSut(tags = mapOf("tag1" to "value1")) + val event = SentryEvent() + + sut.process(event, Hint()) + val eventTags = event.tags!! + + fixture.sentryOptions.setTag("tag2", "value2") + + assertFalse(eventTags.containsKey("tag2")) + } + @Test fun `when event has a tag set with the same name as SentryOptions tags, the tag value from the event is retained`() { val sut = fixture.getSut(tags = mapOf("tag1" to "value1", "tag2" to "value2")) diff --git a/sentry/src/test/java/io/sentry/MonitorContextsTest.kt b/sentry/src/test/java/io/sentry/MonitorContextsTest.kt new file mode 100644 index 00000000000..2b0d57e605e --- /dev/null +++ b/sentry/src/test/java/io/sentry/MonitorContextsTest.kt @@ -0,0 +1,19 @@ +package io.sentry + +import io.sentry.protocol.SerializationUtils +import kotlin.test.Test +import kotlin.test.assertEquals +import org.mockito.kotlin.mock + +class MonitorContextsTest { + @Test + fun `serializes entries in alphabetical order`() { + val contexts = + MonitorContexts().apply { + put("b", 2) + put("a", 1) + } + + assertEquals("{\"a\":1,\"b\":2}", SerializationUtils.serializeToString(contexts, mock())) + } +} diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index ab6fd2075a3..f51345957e4 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -534,6 +534,24 @@ class SentryClientTest { assertNotNull(event.request) { assertEquals("post", it.method) } } + @Test + fun `when captureEvent applies scope tags and extras, event map containers are copied`() { + val event = SentryEvent() + val scope = createScope() + + val sut = fixture.getSut() + + sut.captureEvent(event, scope) + val eventTags = event.tags!! + val eventExtras = event.extras!! + + scope.setTag("newTag", "newValue") + scope.setExtra("newExtra", "newValue") + + assertFalse(eventTags.containsKey("newTag")) + assertFalse(eventExtras.containsKey("newExtra")) + } + @Test fun `when breadcrumbs are not empty, sort them out by date`() { val b1 = Breadcrumb(DateUtils.getDateTime("2020-03-27T08:52:58.001Z")) diff --git a/sentry/src/test/java/io/sentry/protocol/AppTest.kt b/sentry/src/test/java/io/sentry/protocol/AppTest.kt index 84b4c7088e3..cc0f504b7c8 100644 --- a/sentry/src/test/java/io/sentry/protocol/AppTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/AppTest.kt @@ -5,10 +5,11 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNotSame +import kotlin.test.assertSame class AppTest { @Test - fun `copying app wont have the same references`() { + fun `copying app keeps date reference and copies collections`() { val app = App() app.appBuild = "app build" app.appIdentifier = "app identifier" @@ -28,7 +29,7 @@ class AppTest { assertNotNull(clone) assertNotSame(app, clone) - assertNotSame(app.appStartTime, clone.appStartTime) + assertSame(app.appStartTime, clone.appStartTime) assertNotSame(app.permissions, clone.permissions) assertNotSame(app.viewNames, clone.viewNames) diff --git a/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt index 72856c3c27d..a33ddb91a2b 100644 --- a/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt @@ -11,6 +11,7 @@ import io.sentry.SentryLevel import io.sentry.SentryOptions import java.io.StringReader import java.io.StringWriter +import java.util.Date import kotlin.test.assertEquals import kotlin.test.assertTrue import org.junit.Test @@ -49,6 +50,13 @@ class BreadcrumbSerializationTest { assertEquals(expectedJson, actualJson) } + @Test + fun `timestampMs fast path serializes same timestamp as Date fallback`() { + val timestampMs = DateUtils.getDateTime("2009-11-16T01:08:47.123Z").time + + assertEquals(serialize(Breadcrumb(Date(timestampMs))), serialize(Breadcrumb(timestampMs))) + } + @Test fun deserializeFromMap() { val map: Map = diff --git a/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt b/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt index 121cbe6537f..a67305c37ea 100644 --- a/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/DeviceTest.kt @@ -6,11 +6,12 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNotSame +import kotlin.test.assertSame class DeviceTest { @Test - fun `copying device wont have the same references`() { + fun `copying device keeps date reference and copies other mutable references`() { val device = Device() device.archs = arrayOf("archs1", "archs2") device.bootTime = Date() @@ -23,7 +24,7 @@ class DeviceTest { assertNotNull(clone) assertNotSame(device, clone) assertNotSame(device.archs, clone.archs) - assertNotSame(device.bootTime, clone.bootTime) + assertSame(device.bootTime, clone.bootTime) assertNotSame(device.timezone, clone.timezone) assertNotSame(device.unknown, clone.unknown) } diff --git a/sentry/src/test/java/io/sentry/protocol/SentryBaseEventSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryBaseEventSerializationTest.kt index 4cafb1ed8a8..35322d2659e 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryBaseEventSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryBaseEventSerializationTest.kt @@ -9,6 +9,7 @@ import io.sentry.SentryBaseEvent import io.sentry.SentryIntegrationPackageStorage import io.sentry.vendor.gson.stream.JsonToken import kotlin.test.assertEquals +import kotlin.test.assertFalse import org.junit.After import org.junit.Before import org.junit.Test @@ -102,4 +103,26 @@ class SentryBaseEventSerializationTest { assertEquals(expectedJson, actualJson) } + + @Test + fun `setTags copies source map`() { + val source = mutableMapOf("a" to "1") + val sut = Sut() + + sut.tags = source + source["b"] = "2" + + assertFalse(sut.tags!!.containsKey("b")) + } + + @Test + fun `setExtras copies source map`() { + val source = mutableMapOf("a" to "1") + val sut = Sut() + + sut.setExtras(source) + source["b"] = "2" + + assertFalse(sut.extras!!.containsKey("b")) + } } From 8c43a107a007ae5e2aea365bdf434318784049d7 Mon Sep 17 00:00:00 2001 From: adinauer <2542832+adinauer@users.noreply.github.com> Date: Thu, 25 Jun 2026 14:21:16 +0000 Subject: [PATCH 240/391] release: 8.46.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 851fc3985e5..085cf8e35df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.46.0 ### Behavioral Changes diff --git a/gradle.properties b/gradle.properties index f83b851f8d9..804e4b58573 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.45.0 +versionName=8.46.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From d500866b45ecf8012bdd05876ab70b538a7d6371 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 25 Jun 2026 20:21:03 +0200 Subject: [PATCH 241/391] fix(replay): Fix network detail response body size being unknown for gzip-compressed responses (#5592) * fix(replay): Derive response body size from peeked bytes when contentLength is unknown For gzip-compressed responses, OkHttp strips the Content-Length header during transparent decompression, so response.body.contentLength() returns -1. This caused NetworkRequestData.responseBodySize to be unknown for replay network details. Add originalByteCount to NetworkBody, set it from the actual byte array in NetworkBodyParser.fromBytes, and use it as a fallback in NetworkDetailCaptureUtils when the passed bodySize is null or -1. This piggybacks on the existing peekBody call with no additional I/O. Co-Authored-By: Claude Opus 4.6 (1M context) * changelog * Changelog * fix(replay): make NetworkBody 3-arg constructor package-private Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 4 ++ .../io/sentry/util/network/NetworkBody.java | 15 ++++- .../util/network/NetworkBodyParser.java | 17 ++++-- .../network/NetworkDetailCaptureUtils.java | 8 ++- .../util/network/NetworkBodyParserTest.kt | 21 +++++++ .../network/NetworkDetailCaptureUtilsTest.kt | 58 +++++++++++++++++++ 6 files changed, 117 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 085cf8e35df..4e8df66b782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 8.46.0 +### Fixes + +- Session Replay: Fix network detail response body size being unknown for gzip-compressed responses ([#5592](https://github.com/getsentry/sentry-java/pull/5592)) + ### Behavioral Changes - Collections returned by scope (e.g. `getBreadcrumbs`, `getTags`, `getAttachments`) are shared state and should not be mutated. ([#5541](https://github.com/getsentry/sentry-java/pull/5541)) diff --git a/sentry/src/main/java/io/sentry/util/network/NetworkBody.java b/sentry/src/main/java/io/sentry/util/network/NetworkBody.java index 5b4f6365ad4..bcea8cff6e7 100644 --- a/sentry/src/main/java/io/sentry/util/network/NetworkBody.java +++ b/sentry/src/main/java/io/sentry/util/network/NetworkBody.java @@ -16,15 +16,24 @@ public final class NetworkBody { private final @Nullable Object body; private final @Nullable List warnings; + private final long originalByteCount; public NetworkBody(final @Nullable Object body) { - this(body, null); + this(body, null, -1); } public NetworkBody( final @Nullable Object body, final @Nullable List warnings) { + this(body, warnings, -1); + } + + NetworkBody( + final @Nullable Object body, + final @Nullable List warnings, + final long originalByteCount) { this.body = body; this.warnings = warnings; + this.originalByteCount = originalByteCount; } public @Nullable Object getBody() { @@ -35,6 +44,10 @@ public NetworkBody( return warnings; } + long getOriginalByteCount() { + return originalByteCount; + } + // Based on // https://github.com/getsentry/sentry/blob/ccb61aa9b0f33e1333830093a5ce3bd5db88ef33/static/app/utils/replays/replay.tsx#L5-L12 public enum NetworkBodyWarning { diff --git a/sentry/src/main/java/io/sentry/util/network/NetworkBodyParser.java b/sentry/src/main/java/io/sentry/util/network/NetworkBodyParser.java index 49325a99003..42df5ca35b9 100644 --- a/sentry/src/main/java/io/sentry/util/network/NetworkBodyParser.java +++ b/sentry/src/main/java/io/sentry/util/network/NetworkBodyParser.java @@ -45,24 +45,33 @@ private NetworkBodyParser() {} return null; } + final boolean isTruncated = bytes.length > maxSizeBytes; + final long originalByteCount = bytes.length; + if (contentType != null && isBinaryContentType(contentType)) { // For binary content, return a description instead of the actual content return new NetworkBody( - "[Binary data, " + bytes.length + " bytes, type: " + contentType + "]"); + "[Binary data, " + bytes.length + " bytes, type: " + contentType + "]", + null, + originalByteCount); } // Convert to string and parse try { final String effectiveCharset = charset != null ? charset : "UTF-8"; final int size = Math.min(bytes.length, maxSizeBytes); - final boolean isPartial = bytes.length > maxSizeBytes; final String content = new String(bytes, 0, size, effectiveCharset); - return parse(content, contentType, isPartial, logger); + final NetworkBody parsed = parse(content, contentType, isTruncated, logger); + if (parsed == null) { + return null; + } + return new NetworkBody(parsed.getBody(), parsed.getWarnings(), originalByteCount); } catch (UnsupportedEncodingException e) { logger.log(SentryLevel.WARNING, "Failed to decode bytes: " + e.getMessage()); return new NetworkBody( "[Failed to decode bytes, " + bytes.length + " bytes]", - Collections.singletonList(NetworkBody.NetworkBodyWarning.BODY_PARSE_ERROR)); + Collections.singletonList(NetworkBody.NetworkBodyWarning.BODY_PARSE_ERROR), + originalByteCount); } } diff --git a/sentry/src/main/java/io/sentry/util/network/NetworkDetailCaptureUtils.java b/sentry/src/main/java/io/sentry/util/network/NetworkDetailCaptureUtils.java index e0438c375b1..f5134693e00 100644 --- a/sentry/src/main/java/io/sentry/util/network/NetworkDetailCaptureUtils.java +++ b/sentry/src/main/java/io/sentry/util/network/NetworkDetailCaptureUtils.java @@ -160,9 +160,15 @@ private static boolean shouldCaptureUrl( body = bodyExtractor.extract(httpObject); } + // When contentLength is unknown (-1), use the actual byte count from body extraction + Long effectiveBodySize = bodySize; + if ((bodySize == null || bodySize == -1L) && body != null && body.getOriginalByteCount() >= 0) { + effectiveBodySize = body.getOriginalByteCount(); + } + Map headers = getCaptureHeaders(headerExtractor.extract(httpObject), allowedHeaders); - return new ReplayNetworkRequestOrResponse(bodySize, body, headers); + return new ReplayNetworkRequestOrResponse(effectiveBodySize, body, headers); } } diff --git a/sentry/src/test/java/io/sentry/util/network/NetworkBodyParserTest.kt b/sentry/src/test/java/io/sentry/util/network/NetworkBodyParserTest.kt index 3b1da25a0c2..04a19d47712 100644 --- a/sentry/src/test/java/io/sentry/util/network/NetworkBodyParserTest.kt +++ b/sentry/src/test/java/io/sentry/util/network/NetworkBodyParserTest.kt @@ -341,6 +341,27 @@ class NetworkBodyParserTest { val body = NetworkBodyParser.fromBytes(bytes, "image/png", null, bytes.size, logger) assertNotNull(body) assertEquals("[Binary data, 100 bytes, type: image/png]", body.body) + assertEquals(100, body.originalByteCount) + } + + @Test + fun `originalByteCount is set when body fits within limit`() { + val logger = mock() + val bytes = """{"key":"value"}""".toByteArray() + + val body = NetworkBodyParser.fromBytes(bytes, "application/json", null, bytes.size, logger) + assertNotNull(body) + assertEquals(bytes.size.toLong(), body.originalByteCount) + } + + @Test + fun `originalByteCount is set to capped size when body is truncated`() { + val logger = mock() + val bytes = """{"key":"value"}""".toByteArray() + + val body = NetworkBodyParser.fromBytes(bytes, "application/json", null, bytes.size - 1, logger) + assertNotNull(body) + assertEquals(bytes.size.toLong(), body.originalByteCount) } @Test diff --git a/sentry/src/test/java/io/sentry/util/network/NetworkDetailCaptureUtilsTest.kt b/sentry/src/test/java/io/sentry/util/network/NetworkDetailCaptureUtilsTest.kt index cf4ec4828ff..25b142af7e9 100644 --- a/sentry/src/test/java/io/sentry/util/network/NetworkDetailCaptureUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/network/NetworkDetailCaptureUtilsTest.kt @@ -1,12 +1,70 @@ package io.sentry.util.network +import io.sentry.ILogger import java.util.LinkedHashMap import kotlin.test.assertEquals +import kotlin.test.assertNull import kotlin.test.assertTrue import org.junit.Test +import org.mockito.kotlin.mock class NetworkDetailCaptureUtilsTest { + @Test + fun `createResponse uses originalByteCount when bodySize is unknown`() { + val logger = mock() + val jsonBytes = """{"key":"value"}""".toByteArray() + + val result = + NetworkDetailCaptureUtils.createResponse( + jsonBytes, + -1L, + true, + { bytes -> + NetworkBodyParser.fromBytes(bytes, "application/json", null, bytes.size, logger) + }, + emptyList(), + { emptyMap() }, + ) + + assertEquals(jsonBytes.size.toLong(), result.size) + } + + @Test + fun `createResponse keeps explicit bodySize when available`() { + val logger = mock() + val jsonBytes = """{"key":"value"}""".toByteArray() + + val result = + NetworkDetailCaptureUtils.createResponse( + jsonBytes, + 42L, + true, + { bytes -> + NetworkBodyParser.fromBytes(bytes, "application/json", null, bytes.size, logger) + }, + emptyList(), + { emptyMap() }, + ) + + assertEquals(42L, result.size) + } + + @Test + fun `createResponse keeps null bodySize when body capture is off`() { + val result = + NetworkDetailCaptureUtils.createResponse( + "unused", + null, + false, + { null }, + emptyList(), + { emptyMap() }, + ) + + assertNull(result.size) + } + @Test fun `getCaptureHeaders should match headers case-insensitively`() { // Setup: allHeaders with mixed case keys From b3299ecb0a4145c3409adfb2ad70c8c444741626 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 06:47:34 +0000 Subject: [PATCH 242/391] chore(deps): bump the github-actions group across 1 directory with 6 updates (#5647) Bumps the github-actions group with 6 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/setup-java](https://github.com/actions/setup-java) | `5.3.0` | `5.4.0` | | [gradle/actions/setup-gradle](https://github.com/gradle/actions) | `6.1.0` | `6.2.0` | | [actions/cache](https://github.com/actions/cache) | `5.0.5` | `6.0.0` | | [getsentry/craft/.github/workflows/changelog-preview.yml](https://github.com/getsentry/craft) | `2.26.10` | `2.26.12` | | [getsentry/craft](https://github.com/getsentry/craft) | `2.26.10` | `2.26.12` | | [actions/setup-python](https://github.com/actions/setup-python) | `6.2.0` | `6.3.0` | Updates `actions/setup-java` from 5.3.0 to 5.4.0 - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/ad2b38190b15e4d6bdf0c97fb4fca8412226d287...1bcf9fb12cf4aa7d266a90ae39939e61372fe520) Updates `gradle/actions/setup-gradle` from 6.1.0 to 6.2.0 - [Release notes](https://github.com/gradle/actions/releases) - [Commits](https://github.com/gradle/actions/compare/50e97c2cd7a37755bbfafc9c5b7cafaece252f6e...3f131e8634966bd73d06cc69884922b02e6faf92) Updates `actions/cache` from 5.0.5 to 6.0.0 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/27d5ce7f107fe9357f9df03efb73ab90386fccae...2c8a9bd7457de244a408f35966fab2fb45fda9c8) Updates `getsentry/craft/.github/workflows/changelog-preview.yml` from 2.26.10 to 2.26.12 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/acdb88019720182caf57293360d7cdc8db9e75ac...9312e4dfc82e545ef0cad911c23f430fe5f52673) Updates `getsentry/craft` from 2.26.10 to 2.26.12 - [Release notes](https://github.com/getsentry/craft/releases) - [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/craft/compare/acdb88019720182caf57293360d7cdc8db9e75ac...9312e4dfc82e545ef0cad911c23f430fe5f52673) Updates `actions/setup-python` from 6.2.0 to 6.3.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/a309ff8b426b58ec0e2a45f0f869d46889d02405...ece7cb06caefa5fff74198d8649806c4678c61a1) --- updated-dependencies: - dependency-name: actions/setup-java dependency-version: 5.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: gradle/actions/setup-gradle dependency-version: 6.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: actions/cache dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: getsentry/craft/.github/workflows/changelog-preview.yml dependency-version: 2.26.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: getsentry/craft dependency-version: 2.26.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/setup-python dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/agp-matrix.yml | 6 +++--- .github/workflows/build.yml | 6 +++--- .github/workflows/changelog-preview.yml | 2 +- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/enforce-license-compliance.yml | 4 ++-- .github/workflows/format-code.yml | 4 ++-- .github/workflows/generate-javadocs.yml | 4 ++-- .github/workflows/integration-tests-benchmarks.yml | 10 +++++----- .github/workflows/integration-tests-size.yml | 6 +++--- .github/workflows/integration-tests-ui-critical.yml | 6 +++--- .github/workflows/integration-tests-ui.yml | 4 ++-- .github/workflows/release-build.yml | 4 ++-- .github/workflows/release.yml | 2 +- .github/workflows/spring-boot-2-matrix.yml | 8 ++++---- .github/workflows/spring-boot-3-matrix.yml | 8 ++++---- .github/workflows/spring-boot-4-matrix.yml | 8 ++++---- .github/workflows/system-tests-backend.yml | 6 +++--- 17 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index 8ddb961ec96..d196d595d73 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -33,13 +33,13 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} @@ -50,7 +50,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 id: avd-cache with: path: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cba7e07e0a..57106c8e05a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,20 +25,20 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml index d814ca72002..3e510787ce2 100644 --- a/.github/workflows/changelog-preview.yml +++ b/.github/workflows/changelog-preview.yml @@ -15,5 +15,5 @@ permissions: jobs: changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@acdb88019720182caf57293360d7cdc8db9e75ac # v2 + uses: getsentry/craft/.github/workflows/changelog-preview.yml@9312e4dfc82e545ef0cad911c23f430fe5f52673 # v2 secrets: inherit diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ccc9cc04a85..c3cad17b1a9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,13 +25,13 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 38680fe0a23..33a0cc237fc 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 - name: Set up Java - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/format-code.yml b/.github/workflows/format-code.yml index 2892df16701..3fc47aa0f6b 100644 --- a/.github/workflows/format-code.yml +++ b/.github/workflows/format-code.yml @@ -13,13 +13,13 @@ jobs: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index fabd36736aa..be15b66d370 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -14,13 +14,13 @@ jobs: submodules: 'recursive' - name: set up JDK 17 - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 - name: Generate Aggregate Javadocs run: | diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 45b063705dc..fa025030e8a 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -32,13 +32,13 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} @@ -82,17 +82,17 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + - uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 id: app-plain-cache with: path: sentry-android-integration-tests/test-app-plain/build/outputs/apk/release/test-app-plain-release.apk diff --git a/.github/workflows/integration-tests-size.yml b/.github/workflows/integration-tests-size.yml index 5c212d5895a..d67237d7089 100644 --- a/.github/workflows/integration-tests-size.yml +++ b/.github/workflows/integration-tests-size.yml @@ -23,20 +23,20 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Setup Java Version - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: "temurin" java-version: "17" # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index 7d0b74b4329..bd4a9058ddc 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -30,13 +30,13 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Set up Java 17 - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} @@ -86,7 +86,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: AVD cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 id: avd-cache with: path: | diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index e271227b97e..9404975a1fc 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -27,13 +27,13 @@ jobs: submodules: 'recursive' - name: 'Set up Java: 17' - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 050782006f0..eac4a94966c 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -20,13 +20,13 @@ jobs: submodules: 'recursive' - name: Setup Java Version - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 - name: Build artifacts run: make publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd266d948c2..807236d4ed2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - name: Prepare release - uses: getsentry/craft@acdb88019720182caf57293360d7cdc8db9e75ac # v2 + uses: getsentry/craft@9312e4dfc82e545ef0cad911c23f430fe5f52673 # v2 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: diff --git a/.github/workflows/spring-boot-2-matrix.yml b/.github/workflows/spring-boot-2-matrix.yml index 6e0b1366c9f..cf69a869def 100644 --- a/.github/workflows/spring-boot-2-matrix.yml +++ b/.github/workflows/spring-boot-2-matrix.yml @@ -35,7 +35,7 @@ jobs: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.10.5' @@ -45,20 +45,20 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-3-matrix.yml b/.github/workflows/spring-boot-3-matrix.yml index 00e93f5442b..2a94987549c 100644 --- a/.github/workflows/spring-boot-3-matrix.yml +++ b/.github/workflows/spring-boot-3-matrix.yml @@ -35,7 +35,7 @@ jobs: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.10.5' @@ -45,20 +45,20 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/spring-boot-4-matrix.yml b/.github/workflows/spring-boot-4-matrix.yml index 450dbd8c98d..b5516e17453 100644 --- a/.github/workflows/spring-boot-4-matrix.yml +++ b/.github/workflows/spring-boot-4-matrix.yml @@ -35,7 +35,7 @@ jobs: submodules: 'recursive' - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.10.5' @@ -45,20 +45,20 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' # Workaround for https://github.com/gradle/actions/issues/21 to use config cache - name: Cache buildSrc - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0 with: path: buildSrc/build key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }} - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index 67f81f2fb64..ed6b5eab5f7 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -102,7 +102,7 @@ jobs: with: submodules: 'recursive' - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: '3.10.5' @@ -112,13 +112,13 @@ jobs: python3 -m pip install -r requirements.txt - name: Set up Java - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5 + uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 with: distribution: 'temurin' java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} From c4538565b7fe7d1d50dddb46c44b2b93129d74ee Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 26 Jun 2026 10:21:49 +0200 Subject: [PATCH 243/391] test(replay): ignore flaky ComposeMaskingOptionsTest unmask test (#5648) * test(replay): ignore flaky ComposeMaskingOptionsTest unmask test Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> * Format code --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Sentry Github Bot --- .../android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt index fe3fbc1ba67..baf0a32a415 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt @@ -44,6 +44,7 @@ import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHiera import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode import java.io.File +import kotlin.test.Ignore import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -219,6 +220,9 @@ class ComposeMaskingOptionsTest { } @Test + @Ignore( + "Flaky: Robolectric intermittently reports zero bounds for nodes, causing isVisible=false and making the assertion non-deterministic" + ) fun `when sentry-unmask modifier is set unmasks the node`() { ComposeMaskingOptionsActivity.textModifierApplier = { Modifier.sentryReplayUnmask() } val activity = buildActivity(ComposeMaskingOptionsActivity::class.java).setup() From d8b6ce11cabd05be9a3f03a1d20fe247956d091d Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 26 Jun 2026 10:52:36 +0200 Subject: [PATCH 244/391] perf(android): Hit-test gestures without getLocationOnScreen (#5595) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf(android): Hit-test gestures without getLocationOnScreen (JAVA-534) ViewUtils.findTarget called View.getLocationOnScreen for every visited view, and that walks from the view up to the root each time, making the traversal O(N*depth) per tap and scroll start. Instead, map the touch point down into each child's local coordinate space as we descend the tree — the same way ViewGroup dispatches touch events — so each view costs O(1) and the whole traversal is O(N). The locators still receive the original decor-view-relative coordinates, since the Compose locator hit-tests against window coordinates. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * Update changelog * test(android): Cover scroll and child matrix in findTarget hit-testing (JAVA-534) The existing test only exercised the left/top offset path of mapToChild. Add cases for a scrolled parent and a non-identity child matrix so the other two coordinate-mapping branches are covered, and switch the class to Robolectric so the real Matrix math runs. Co-Authored-By: Claude Opus 4.8 (1M context) * Move changelog entry to Unreleased as a performance improvement Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 6 ++ .../core/internal/gestures/ViewUtils.java | 88 +++++++++++---- .../core/internal/gestures/ViewHelpers.kt | 29 ++--- .../core/internal/gestures/ViewUtilsTest.kt | 100 +++++++++++++++++- .../gestures/ComposeGestureTargetLocator.kt | 9 +- 5 files changed, 184 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e8df66b782..eaec96a2e0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Performance + +- Speed up touch gesture target detection on deeply nested view hierarchies by hit-testing in local coordinates instead of calling `getLocationOnScreen` per view ([#5595](https://github.com/getsentry/sentry-java/pull/5595)) + ## 8.46.0 ### Fixes diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java index 501a05a5007..6f52612e50d 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java @@ -1,13 +1,14 @@ package io.sentry.android.core.internal.gestures; import android.content.res.Resources; +import android.graphics.Matrix; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import io.sentry.android.core.SentryAndroidOptions; import io.sentry.internal.gestures.GestureTargetLocator; import io.sentry.internal.gestures.UiElement; -import java.util.LinkedList; +import java.util.ArrayDeque; import java.util.List; import java.util.Queue; import org.jetbrains.annotations.ApiStatus; @@ -17,30 +18,53 @@ @ApiStatus.Internal public final class ViewUtils { - private static final int[] coordinates = new int[2]; - /** - * Verifies if the given touch coordinates are within the bounds of the given view. + * Verifies if the given touch coordinates, expressed in the view's own local coordinate space, + * are within the bounds of the given view. * * @param view the view to check if the touch coordinates are within its bounds - * @param x - the x coordinate of a {@link MotionEvent} - * @param y - the y coordinate of {@link MotionEvent} + * @param localX - the x coordinate of the touch, relative to the view's top-left corner + * @param localY - the y coordinate of the touch, relative to the view's top-left corner * @return true if the touch coordinates are within the bounds of the view, false otherwise */ private static boolean touchWithinBounds( - final @Nullable View view, final float x, final float y) { + final @Nullable View view, final float localX, final float localY) { if (view == null) { return false; } - view.getLocationOnScreen(coordinates); - int vx = coordinates[0]; - int vy = coordinates[1]; + final int w = view.getWidth(); + final int h = view.getHeight(); - int w = view.getWidth(); - int h = view.getHeight(); + return !(localX < 0 || localX > w || localY < 0 || localY > h); + } - return !(x < vx || x > vx + w || y < vy || y > vy + h); + /** + * Maps a touch point expressed in the parent's local coordinate space into the child's local + * coordinate space. This mirrors how {@link ViewGroup} dispatches touch events to its children + * and lets us hit-test the whole tree with a single downward traversal, instead of calling {@link + * View#getLocationOnScreen(int[])} (which walks up to the root) for every view. + */ + private static @NotNull ViewWithLocation mapToChild( + final @NotNull View child, + final float parentX, + final float parentY, + final int parentScrollX, + final int parentScrollY) { + float childX = parentX + parentScrollX - child.getLeft(); + float childY = parentY + parentScrollY - child.getTop(); + + final @Nullable Matrix matrix = child.getMatrix(); + if (matrix != null && !matrix.isIdentity()) { + final Matrix inverse = new Matrix(); + if (matrix.invert(inverse)) { + final float[] point = {childX, childY}; + inverse.mapPoints(point); + childX = point[0]; + childY = point[1]; + } + } + return new ViewWithLocation(child, childX, childY); } /** @@ -48,8 +72,8 @@ private static boolean touchWithinBounds( * given {@code viewTargetSelector}. * * @param decorView - the root view of this window - * @param x - the x coordinate of a {@link MotionEvent} - * @param y - the y coordinate of {@link MotionEvent} + * @param x - the x coordinate of a {@link MotionEvent}, relative to the decor view + * @param y - the y coordinate of {@link MotionEvent}, relative to the decor view * @param targetType - the type of target to find * @return the {@link View} that contains the touch coordinates and complements the {@code * viewTargetSelector} @@ -62,25 +86,35 @@ private static boolean touchWithinBounds( final UiElement.Type targetType) { final List locators = options.getGestureTargetLocators(); - final Queue queue = new LinkedList<>(); - queue.add(decorView); + final Queue queue = new ArrayDeque<>(); + // The touch coordinates from the MotionEvent are already relative to the decor view, i.e. in + // its local coordinate space. + queue.add(new ViewWithLocation(decorView, x, y)); @Nullable UiElement target = null; - while (queue.size() > 0) { - final View view = queue.poll(); + while (!queue.isEmpty()) { + final ViewWithLocation current = queue.poll(); + final View view = current.view; - if (!touchWithinBounds(view, x, y)) { + if (!touchWithinBounds(view, current.x, current.y)) { // if the touch is not hitting the view, skip traversal of its children continue; } if (view instanceof ViewGroup) { final ViewGroup viewGroup = (ViewGroup) view; + final int scrollX = viewGroup.getScrollX(); + final int scrollY = viewGroup.getScrollY(); for (int i = 0; i < viewGroup.getChildCount(); i++) { - queue.add(viewGroup.getChildAt(i)); + final @Nullable View child = viewGroup.getChildAt(i); + if (child != null) { + queue.add(mapToChild(child, current.x, current.y, scrollX, scrollY)); + } } } + // Locators receive the original decor-view-relative coordinates, as the Compose locator + // hit-tests against window coordinates. for (int i = 0; i < locators.size(); i++) { final GestureTargetLocator locator = locators.get(i); final @Nullable UiElement newTarget = locator.locate(view, x, y, targetType); @@ -96,6 +130,18 @@ private static boolean touchWithinBounds( return target; } + private static final class ViewWithLocation { + final @NotNull View view; + final float x; + final float y; + + ViewWithLocation(final @NotNull View view, final float x, final float y) { + this.view = view; + this.x = x; + this.y = y; + } + } + /** * Retrieves the human-readable view id based on {@code view.getContext().getResources()}, falls * back to a hexadecimal id representation in case the view id is not available in the resources. diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt index 1a4f28bbe35..15123ce0a31 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewHelpers.kt @@ -5,9 +5,6 @@ import android.content.res.Resources import android.view.MotionEvent import android.view.View import android.view.Window -import kotlin.math.abs -import org.mockito.kotlin.any -import org.mockito.kotlin.doAnswer import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.whenever @@ -35,31 +32,17 @@ internal inline fun mockView( context: Context? = null, finalize: (T) -> Unit = {}, ): T { - val coordinates = IntArray(2) - if (!touchWithinBounds) { - coordinates[0] = (event.x).toInt() + 10 - coordinates[1] = (event.y).toInt() + 10 - } else { - coordinates[0] = (event.x).toInt() - 10 - coordinates[1] = (event.y).toInt() - 10 - } + // The decor-view-relative touch point used in these tests is (0, 0), and child views are mocked + // at offset (0, 0), so the point reaches every view unchanged. A view therefore contains the + // touch iff its width/height are non-negative; a negative size marks the touch as outside. + val size = if (touchWithinBounds) 10 else -1 val mockView: T = mock { whenever(it.id).thenReturn(id) whenever(it.context).thenReturn(context) whenever(it.isClickable).thenReturn(clickable) whenever(it.visibility).thenReturn(if (visible) View.VISIBLE else View.GONE) - - whenever(it.getLocationOnScreen(any())).doAnswer { - val array = it.arguments[0] as IntArray - array[0] = coordinates[0] - array[1] = coordinates[1] - null - } - - val diffPosX = abs(event.x - coordinates[0]).toInt() - val diffPosY = abs(event.y - coordinates[1]).toInt() - whenever(it.width).thenReturn(diffPosX + 10) - whenever(it.height).thenReturn(diffPosY + 10) + whenever(it.width).thenReturn(size) + whenever(it.height).thenReturn(size) finalize(this.mock) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt index 77a38e6ccc1..10064b1cd74 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt @@ -2,10 +2,19 @@ package io.sentry.android.core.internal.gestures import android.content.Context import android.content.res.Resources +import android.graphics.Matrix import android.view.View +import android.view.ViewGroup +import androidx.test.ext.junit.runners.AndroidJUnit4 +import io.sentry.android.core.SentryAndroidOptions +import io.sentry.internal.gestures.UiElement +import io.sentry.util.LazyEvaluator import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.doReturn import org.mockito.kotlin.doThrow @@ -14,12 +23,13 @@ import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.whenever +@RunWith(AndroidJUnit4::class) class ViewUtilsTest { @Test fun `getResourceId returns resourceId when available`() { val view = mock { - whenever(it.id).doReturn(View.generateViewId()) + whenever(it.id).doReturn(0x7f010001) val context = mock() val resources = mock() @@ -80,6 +90,94 @@ class ViewUtilsTest { verify(context, never()).resources } + @Test + fun `findTarget hit-tests children in their own local coordinate space`() { + val child = clickableChild() + val decorView = + mock { + whenever(it.width).thenReturn(1000) + whenever(it.height).thenReturn(1000) + whenever(it.childCount).thenReturn(1) + whenever(it.getChildAt(0)).thenReturn(child) + } + val options = optionsWithViewLocator() + + // (120, 220) maps to (20, 20) in the child's space -> inside its 50x50 bounds. + assertNotNull(ViewUtils.findTarget(options, decorView, 120f, 220f, UiElement.Type.CLICKABLE)) + + // (90, 220) maps to (-10, 20) in the child's space -> outside, despite being inside the decor. + assertNull(ViewUtils.findTarget(options, decorView, 90f, 220f, UiElement.Type.CLICKABLE)) + } + + @Test + fun `findTarget accounts for parent scroll when mapping into a child`() { + val child = clickableChild() + val decorView = + mock { + whenever(it.width).thenReturn(1000) + whenever(it.height).thenReturn(1000) + whenever(it.scrollX).thenReturn(30) + whenever(it.scrollY).thenReturn(40) + whenever(it.childCount).thenReturn(1) + whenever(it.getChildAt(0)).thenReturn(child) + } + val options = optionsWithViewLocator() + + // With scroll (30, 40), (90, 180) maps to (90 + 30 - 100, 180 + 40 - 200) = (20, 20) -> inside. + assertNotNull(ViewUtils.findTarget(options, decorView, 90f, 180f, UiElement.Type.CLICKABLE)) + + // The same point without accounting for scroll would map to (-10, -20) -> outside the child. + assertNull(ViewUtils.findTarget(options, decorView, 50f, 140f, UiElement.Type.CLICKABLE)) + } + + @Test + fun `findTarget applies the inverse of a non-identity child matrix`() { + // The child is visually translated by (40, 40) within its parent, so a parent-space point is + // mapped back by (-40, -40) to reach the child's own coordinate space. + val matrix = Matrix().apply { setTranslate(40f, 40f) } + val child = clickableChild { whenever(it.matrix).thenReturn(matrix) } + val decorView = + mock { + whenever(it.width).thenReturn(1000) + whenever(it.height).thenReturn(1000) + whenever(it.childCount).thenReturn(1) + whenever(it.getChildAt(0)).thenReturn(child) + } + val options = optionsWithViewLocator() + + // (180, 280) lands at (80, 80) before the matrix (outside 50x50), but the inverse pulls it to + // (40, 40) -> inside. + assertNotNull(ViewUtils.findTarget(options, decorView, 180f, 280f, UiElement.Type.CLICKABLE)) + + // (130, 230) lands at (30, 30) before the matrix (inside), but the inverse pushes it to + // (-10, -10) -> outside. + assertNull(ViewUtils.findTarget(options, decorView, 130f, 230f, UiElement.Type.CLICKABLE)) + } + + // A clickable child positioned at (100, 200) within its parent, 50x50 in size. + private fun clickableChild(finalize: (View) -> Unit = {}): View { + val context = mock() + val resources = mock() + whenever(context.resources).thenReturn(resources) + whenever(resources.getResourceEntryName(any())).thenReturn("child") + return mock { + whenever(it.id).thenReturn(0x7f010001) + whenever(it.context).thenReturn(context) + whenever(it.isClickable).thenReturn(true) + whenever(it.visibility).thenReturn(View.VISIBLE) + whenever(it.left).thenReturn(100) + whenever(it.top).thenReturn(200) + whenever(it.width).thenReturn(50) + whenever(it.height).thenReturn(50) + finalize(this.mock) + } + } + + private fun optionsWithViewLocator(): SentryAndroidOptions = + SentryAndroidOptions().apply { + gestureTargetLocators = listOf(AndroidViewGestureTargetLocator(LazyEvaluator { true })) + } + @Test fun `getResourceIdWithFallback falls back to hexadecimal id when resource not found`() { val view = diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt index 54deb774c53..47dda6eda9c 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocator.kt @@ -15,7 +15,7 @@ import io.sentry.compose.boundsInWindow import io.sentry.internal.gestures.GestureTargetLocator import io.sentry.internal.gestures.UiElement import io.sentry.util.AutoClosableReentrantLock -import java.util.LinkedList +import java.util.ArrayDeque import java.util.Queue @OptIn(InternalComposeUiApi::class) @@ -45,7 +45,7 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT val rootLayoutNode = root.root // Pair - val queue: Queue> = LinkedList() + val queue: Queue> = ArrayDeque() queue.add(Pair(rootLayoutNode, null)) // the final tag to return, only relevant for clicks @@ -92,7 +92,10 @@ public class ComposeGestureTargetLocator(private val logger: ILogger) : GestureT } } } - queue.addAll(node.zSortedChildren.asMutableList().map { Pair(it, tag) }) + val children = node.zSortedChildren.asMutableList() + for (index in children.indices) { + queue.add(Pair(children[index], tag)) + } } } From d28345f99bf478304e7bfab7beda00c46b01ece0 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Mon, 29 Jun 2026 10:18:37 +0200 Subject: [PATCH 245/391] fix(core): Guard clearSession with session lock to prevent NPE (#5657) * fix(core): Guard clearSession with session lock to prevent NPE clearSession() reset the session field without acquiring sessionLock, unlike the other session mutators (startSession, endSession, withSession). This allowed it to null out the session between a null-check and a dereference (e.g. session.clone()) in those locked methods, leading to a NullPointerException. Acquire sessionLock so all session mutations are mutually exclusive. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * changelog * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 4 ++++ sentry/src/main/java/io/sentry/Scope.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaec96a2e0a..dbb532e1f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) + ### Performance - Speed up touch gesture target detection on deeply nested view hierarchies by hit-testing in local coordinates instead of calling `getLocationOnScreen` per view ([#5595](https://github.com/getsentry/sentry-java/pull/5595)) diff --git a/sentry/src/main/java/io/sentry/Scope.java b/sentry/src/main/java/io/sentry/Scope.java index 9e8d3ee554e..282fc4df67f 100644 --- a/sentry/src/main/java/io/sentry/Scope.java +++ b/sentry/src/main/java/io/sentry/Scope.java @@ -1147,7 +1147,9 @@ public SentryOptions getOptions() { @ApiStatus.Internal @Override public void clearSession() { - session = null; + try (final @NotNull ISentryLifecycleToken ignored = sessionLock.acquire()) { + session = null; + } } @ApiStatus.Internal From 151b497f664e05aed370dcab83278ba3c68ee826 Mon Sep 17 00:00:00 2001 From: XYZboom <58654313+XYZboom@users.noreply.github.com> Date: Mon, 29 Jun 2026 16:52:49 +0800 Subject: [PATCH 246/391] Add @Throws on SentryOkHttpInterceptor::intercept. (#5654) Fixes #5653 --- CHANGELOG.md | 4 ++++ .../src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbb532e1f82..4a37500b9a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Behavioral Changes + +- `SentryOkHttpInterceptor::intercept` now throws `IOException`. This is a source-only and Java-only breaking change ([#5654](https://github.com/getsentry/sentry-java/pull/5654)) + ### Fixes - Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) diff --git a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt index ea8fdb44159..7031be3b0b3 100644 --- a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt +++ b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt @@ -77,6 +77,7 @@ public open class SentryOkHttpInterceptor( } @Suppress("LongMethod") + @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { var request = chain.request() From 012eaebafc1507c0a4767236b7acc5c26fca1988 Mon Sep 17 00:00:00 2001 From: Chris Aigner <25478494+christophaigner@users.noreply.github.com> Date: Mon, 29 Jun 2026 20:55:43 +0200 Subject: [PATCH 247/391] docs: Add AI Use section to CONTRIBUTING.md (#5659) Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7eb38413d64..f4354c72a89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,3 +68,8 @@ issue without a closing keyword is not enough. Build and tests are automatically run against branches and pull requests via GH Actions. + + +# AI Use + +You are welcome to use whatever tools you prefer for making a contribution. However, any changes you propose have to be reviewed and tested by you, a human, first, before you submit a pull request with them for the Sentry team to review. If we feel like that did not happen, we will close the PR outright. For example, we will not review visibly AI-generated PRs from an agent instructed to look for and "fix" open issues in the repo. This aligns with our SDK principle: [every line has an owner](https://develop.sentry.dev/sdk/getting-started/principles/#every-line-has-an-owner). From 8fe8bad58f1cfd746f853286f0f241a3f2c5b3fb Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 30 Jun 2026 11:20:16 +0200 Subject: [PATCH 248/391] perf: Reduce reflection cost during SDK init (Init Reflection stack) (#5634) * collection: Reduce reflection cost during SDK init * perf(core): [Init Reflection 1] Probe class availability without initializing (#5635) * perf(core): Probe class availability without initializing the class LoadClass.loadClass used Class.forName(name) which initializes the class. Used purely for availability probing during init, this eagerly runs unrelated static initializers (e.g. Compose's Owner, the fragment integration). Use Class.forName(name, false, classLoader) so the class is only initialized lazily on first real use. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * changelog: move init reflection entries to Performance * perf(core): Limit no-init class probing to isClassAvailable The previous change made loadClass itself skip class initialization, which affected callers that load a class to actually use it (NDK integration, OTEL span factory and scopes storage). Restore loadClass to its initializing behavior and confine the non-initializing probe to isClassAvailable, which is only ever used for classpath availability checks. This keeps SDK init cheap while leaving real-use callers unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../main/java/io/sentry/util/LoadClass.java | 34 ++++++++- .../test/java/io/sentry/util/LoadClassTest.kt | 70 +++++++++++++++++++ 3 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 sentry/src/test/java/io/sentry/util/LoadClassTest.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a37500b9a1..dce1fd22d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Performance - Speed up touch gesture target detection on deeply nested view hierarchies by hit-testing in local coordinates instead of calling `getLocationOnScreen` per view ([#5595](https://github.com/getsentry/sentry-java/pull/5595)) +- Probe class availability without initializing the class during SDK init ([#5635](https://github.com/getsentry/sentry-java/pull/5635)) ## 8.46.0 diff --git a/sentry/src/main/java/io/sentry/util/LoadClass.java b/sentry/src/main/java/io/sentry/util/LoadClass.java index 1946ce8381f..2c39cace39b 100644 --- a/sentry/src/main/java/io/sentry/util/LoadClass.java +++ b/sentry/src/main/java/io/sentry/util/LoadClass.java @@ -12,15 +12,23 @@ public class LoadClass { /** - * Try to load a class via reflection + * Loads and initializes a class via reflection. Use this when you intend to actually use the + * class (e.g. instantiate it or invoke its methods). The returned class is fully initialized, so + * its static initializers run. To merely check whether a class is on the classpath, use {@link + * #isClassAvailable} instead, which avoids running those initializers. * * @param clazz the full class name * @param logger an instance of ILogger * @return a Class<?> if it's available, or null */ public @Nullable Class loadClass(final @NotNull String clazz, final @Nullable ILogger logger) { + return loadClass(clazz, logger, true); + } + + private @Nullable Class loadClass( + final @NotNull String clazz, final @Nullable ILogger logger, final boolean initialize) { try { - return Class.forName(clazz); + return Class.forName(clazz, initialize, LoadClass.class.getClassLoader()); } catch (ClassNotFoundException e) { if (logger != null) { logger.log(SentryLevel.INFO, "Class not available: " + clazz); @@ -37,8 +45,19 @@ public class LoadClass { return null; } + /** + * Probes whether a class is on the classpath without initializing it. Use this for availability + * checks (e.g. deciding whether to register an integration); the class is not initialized, so its + * static initializers do not run until something actually uses it. This keeps SDK init cheap by + * not triggering unrelated initializers. If you need to use the class, use {@link #loadClass} + * instead. + * + * @param clazz the full class name + * @param logger an instance of ILogger + * @return true if the class is on the classpath + */ public boolean isClassAvailable(final @NotNull String clazz, final @Nullable ILogger logger) { - return loadClass(clazz, logger) != null; + return loadClass(clazz, logger, false) != null; } public boolean isClassAvailable( @@ -46,6 +65,15 @@ public boolean isClassAvailable( return isClassAvailable(clazz, options != null ? options.getLogger() : null); } + /** + * Like {@link #isClassAvailable}, but defers the (non-initializing) availability check until the + * result is first read. Use this when the check itself should not run during SDK init but only + * later, on first access. + * + * @param clazz the full class name + * @param logger an instance of ILogger + * @return a lazily-evaluated availability check + */ public LazyEvaluator isClassAvailableLazy( final @NotNull String clazz, final @Nullable ILogger logger) { return new LazyEvaluator<>(() -> isClassAvailable(clazz, logger)); diff --git a/sentry/src/test/java/io/sentry/util/LoadClassTest.kt b/sentry/src/test/java/io/sentry/util/LoadClassTest.kt new file mode 100644 index 00000000000..7a8bc802049 --- /dev/null +++ b/sentry/src/test/java/io/sentry/util/LoadClassTest.kt @@ -0,0 +1,70 @@ +package io.sentry.util + +import kotlin.test.Test +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class LoadClassTest { + @Test + fun `loadClass returns the class when it is available`() { + assertNotNull(LoadClass().loadClass("io.sentry.SentryEvent", null)) + } + + @Test + fun `loadClass returns null when the class is not available`() { + assertNull(LoadClass().loadClass("io.sentry.ThisClassDoesNotExist", null)) + } + + @Test + fun `isClassAvailable reflects whether the class is on the classpath`() { + val loadClass = LoadClass() + assertNotNull(loadClass.loadClass("io.sentry.SentryEvent", null)) + assertFalse( + loadClass.isClassAvailable("io.sentry.ThisClassDoesNotExist", null as io.sentry.ILogger?) + ) + } + + @Test + fun `isClassAvailable does not run the static initializer of the probed class`() { + // Reading the flag initializes the flag holder, not the probe. + assertFalse(IsClassAvailableNoInitFlag.initialized) + + // Obtaining the name via ::class.java does not initialize the probe either. + LoadClass() + .isClassAvailable(IsClassAvailableNoInitProbe::class.java.name, null as io.sentry.ILogger?) + + // Availability probing must not trigger the probe's static initializer. + assertFalse(IsClassAvailableNoInitFlag.initialized) + } + + @Test + fun `loadClass runs the static initializer of the loaded class`() { + assertFalse(LoadClassInitFlag.initialized) + + LoadClass().loadClass(LoadClassInitProbe::class.java.name, null) + + assertTrue(LoadClassInitFlag.initialized) + } +} + +private object IsClassAvailableNoInitFlag { + @JvmField var initialized = false +} + +private object IsClassAvailableNoInitProbe { + init { + IsClassAvailableNoInitFlag.initialized = true + } +} + +private object LoadClassInitFlag { + @JvmField var initialized = false +} + +private object LoadClassInitProbe { + init { + LoadClassInitFlag.initialized = true + } +} From e279b061f72b2bbcf3b1b3c178024933e0031f60 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 30 Jun 2026 11:45:14 +0200 Subject: [PATCH 249/391] perf(android): Avoid exception-driven control flow in getResourceId (#5631) * perf(android): Avoid exception-driven control flow in getResourceId ViewUtils.getResourceId threw Resources.NotFoundException for views with no id or a generated id, and callers caught and discarded it. During a view-hierarchy snapshot and on every gesture this ran per view, so in Compose-heavy apps where most views have generated ids the SDK constructed an exception (and a native stack trace fill) per view on the main thread. Add a non-throwing resolveResourceId that returns null for unresolved ids and route the hot callers through it. The public getResourceId remains as a throwing wrapper for backward compatibility. Behavior (emitted identifiers and fallbacks) is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../core/ViewHierarchyEventProcessor.java | 6 +- .../AndroidViewGestureTargetLocator.java | 10 +- .../core/internal/gestures/ViewUtils.java | 29 ++-- .../core/internal/gestures/ViewUtilsTest.kt | 126 ++++++++---------- 5 files changed, 85 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dce1fd22d22..6f9baf77a16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Speed up touch gesture target detection on deeply nested view hierarchies by hit-testing in local coordinates instead of calling `getLocationOnScreen` per view ([#5595](https://github.com/getsentry/sentry-java/pull/5595)) - Probe class availability without initializing the class during SDK init ([#5635](https://github.com/getsentry/sentry-java/pull/5635)) +- Avoid constructing an exception per view when resolving view ids during view-hierarchy and gesture capture ([#5631](https://github.com/getsentry/sentry-java/pull/5631)) ## 8.46.0 diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java index c32b05892f9..7090985a38b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java @@ -256,8 +256,10 @@ private static ViewHierarchyNode viewToNode(@NotNull final View view) { node.setType(className); try { - final String identifier = ViewUtils.getResourceId(view); - node.setIdentifier(identifier); + final @Nullable String identifier = ViewUtils.getResourceIdOrNull(view); + if (identifier != null) { + node.setIdentifier(identifier); + } } catch (Throwable e) { // ignored } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/AndroidViewGestureTargetLocator.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/AndroidViewGestureTargetLocator.java index c85fb80dc35..5f6187cd39a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/AndroidViewGestureTargetLocator.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/AndroidViewGestureTargetLocator.java @@ -1,6 +1,5 @@ package io.sentry.android.core.internal.gestures; -import android.content.res.Resources; import android.view.View; import android.widget.AbsListView; import android.widget.ScrollView; @@ -42,13 +41,12 @@ && isViewScrollable(view, isAndroidXAvailable.getValue())) { } private UiElement createUiElement(final @NotNull View targetView) { - try { - final String resourceName = ViewUtils.getResourceId(targetView); - @Nullable String className = ClassUtil.getClassName(targetView); - return new UiElement(targetView, className, resourceName, null, ORIGIN); - } catch (Resources.NotFoundException ignored) { + final @Nullable String resourceName = ViewUtils.getResourceIdOrNull(targetView); + if (resourceName == null) { return null; } + @Nullable String className = ClassUtil.getClassName(targetView); + return new UiElement(targetView, className, resourceName, null, ORIGIN); } private static boolean isViewTappable(final @NotNull View view) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java index 6f52612e50d..78c73713bd4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/ViewUtils.java @@ -150,32 +150,37 @@ private static final class ViewWithLocation { * @return human-readable view id */ static String getResourceIdWithFallback(final @NotNull View view) { - final int viewId = view.getId(); - try { - return getResourceId(view); - } catch (Resources.NotFoundException e) { + final @Nullable String resourceId = getResourceIdOrNull(view); + if (resourceId == null) { // fall back to hex representation of the id - return "0x" + Integer.toString(viewId, 16); + return "0x" + Integer.toString(view.getId(), 16); } + return resourceId; } /** - * Retrieves the human-readable view id based on {@code view.getContext().getResources()}. + * Retrieves the human-readable view id based on {@code view.getContext().getResources()}, or + * {@code null} when the view has no resource-backed id. Returning {@code null} rather than + * throwing avoids exception-driven control flow on hot, main-thread paths such as view-hierarchy + * snapshots and gesture target resolution. * * @param view - the view whose id is being retrieved - * @return human-readable view id - * @throws Resources.NotFoundException in case the view id was not found + * @return human-readable view id, or {@code null} if it cannot be resolved */ - public static String getResourceId(final @NotNull View view) throws Resources.NotFoundException { + public static @Nullable String getResourceIdOrNull(final @NotNull View view) { final int viewId = view.getId(); if (viewId == View.NO_ID || isViewIdGenerated(viewId)) { - throw new Resources.NotFoundException(); + return null; } final Resources resources = view.getContext().getResources(); - if (resources != null) { + if (resources == null) { + return ""; + } + try { return resources.getResourceEntryName(viewId); + } catch (Resources.NotFoundException e) { + return null; } - return ""; } private static boolean isViewIdGenerated(int id) { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt index 10064b1cd74..ed3e6d8ca89 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/ViewUtilsTest.kt @@ -11,13 +11,11 @@ import io.sentry.internal.gestures.UiElement import io.sentry.util.LazyEvaluator import kotlin.test.Test import kotlin.test.assertEquals -import kotlin.test.assertFailsWith import kotlin.test.assertNotNull import kotlin.test.assertNull import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.doReturn -import org.mockito.kotlin.doThrow import org.mockito.kotlin.mock import org.mockito.kotlin.never import org.mockito.kotlin.verify @@ -25,71 +23,6 @@ import org.mockito.kotlin.whenever @RunWith(AndroidJUnit4::class) class ViewUtilsTest { - @Test - fun `getResourceId returns resourceId when available`() { - val view = - mock { - whenever(it.id).doReturn(0x7f010001) - - val context = mock() - val resources = mock() - whenever(resources.getResourceEntryName(it.id)).thenReturn("test_view") - whenever(context.resources).thenReturn(resources) - whenever(it.context).thenReturn(context) - } - - assertEquals(ViewUtils.getResourceId(view), "test_view") - } - - @Test - fun `getResourceId throws when resource id is not available`() { - val view = - mock { - whenever(it.id).doReturn(View.generateViewId()) - - val context = mock() - val resources = mock() - whenever(resources.getResourceEntryName(any())).doThrow(Resources.NotFoundException()) - whenever(context.resources).thenReturn(resources) - whenever(it.context).thenReturn(context) - } - - assertFailsWith { ViewUtils.getResourceId(view) } - } - - @Test - fun `when view has no id set, resource name is not looked up `() { - val context = mock() - val resources = mock() - whenever(context.resources).thenReturn(resources) - - val view = - mock { - whenever(it.id).doReturn(View.NO_ID) - whenever(it.context).thenReturn(context) - } - - assertFailsWith { ViewUtils.getResourceId(view) } - verify(context, never()).resources - } - - @Test - fun `when view id is generated, resource name is not looked up `() { - val context = mock() - val resources = mock() - whenever(context.resources).thenReturn(resources) - - val view = - mock { - // View.generateViewId() starts with 1 - whenever(it.id).doReturn(1) - whenever(it.context).thenReturn(context) - } - - assertFailsWith { ViewUtils.getResourceId(view) } - verify(context, never()).resources - } - @Test fun `findTarget hit-tests children in their own local coordinate space`() { val child = clickableChild() @@ -178,6 +111,65 @@ class ViewUtilsTest { gestureTargetLocators = listOf(AndroidViewGestureTargetLocator(LazyEvaluator { true })) } + @Test + fun `getResourceIdOrNull returns resource name when available`() { + val view = + mock { + whenever(it.id).doReturn(0x7f010001) + + val context = mock() + val resources = mock() + whenever(resources.getResourceEntryName(it.id)).thenReturn("test_view") + whenever(context.resources).thenReturn(resources) + whenever(it.context).thenReturn(context) + } + + assertEquals("test_view", ViewUtils.getResourceIdOrNull(view)) + } + + @Test + fun `getResourceIdOrNull returns null without throwing for generated id`() { + val context = mock() + val view = + mock { + // View.generateViewId() starts with 1 + whenever(it.id).doReturn(1) + whenever(it.context).thenReturn(context) + } + + assertNull(ViewUtils.getResourceIdOrNull(view)) + verify(context, never()).resources + } + + @Test + fun `getResourceIdOrNull returns null without throwing when view has no id`() { + val context = mock() + val view = + mock { + whenever(it.id).doReturn(View.NO_ID) + whenever(it.context).thenReturn(context) + } + + assertNull(ViewUtils.getResourceIdOrNull(view)) + verify(context, never()).resources + } + + @Test + fun `getResourceIdOrNull returns null without throwing when resource not found`() { + val view = + mock { + whenever(it.id).doReturn(1234) + + val context = mock() + val resources = mock() + whenever(resources.getResourceEntryName(it.id)).thenThrow(Resources.NotFoundException()) + whenever(context.resources).thenReturn(resources) + whenever(it.context).thenReturn(context) + } + + assertNull(ViewUtils.getResourceIdOrNull(view)) + } + @Test fun `getResourceIdWithFallback falls back to hexadecimal id when resource not found`() { val view = From 3859a2cc37716e2c8d9f149a0d94a1552f22c248 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 30 Jun 2026 11:58:42 +0200 Subject: [PATCH 250/391] perf(android): Defer SentryFrameMetricsCollector thread startup (#5641) * perf(android): Start frame metrics thread lazily on first collection SentryFrameMetricsCollector created and started its HandlerThread in the constructor, blocking the calling thread (the main thread during SDK init) on HandlerThread.getLooper(). The handler is only needed once startCollection() registers a listener, so start the thread lazily there instead. Apps that never collect frame metrics no longer start the thread at all. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + .../util/SentryFrameMetricsCollector.java | 35 +++++++++++++++---- .../util/SentryFrameMetricsCollectorTest.kt | 10 ++++++ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9baf77a16..fb4fee3db81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Speed up touch gesture target detection on deeply nested view hierarchies by hit-testing in local coordinates instead of calling `getLocationOnScreen` per view ([#5595](https://github.com/getsentry/sentry-java/pull/5595)) - Probe class availability without initializing the class during SDK init ([#5635](https://github.com/getsentry/sentry-java/pull/5635)) - Avoid constructing an exception per view when resolving view ids during view-hierarchy and gesture capture ([#5631](https://github.com/getsentry/sentry-java/pull/5631)) +- Start the frame metrics thread lazily on first collection instead of during SDK init ([#5641](https://github.com/getsentry/sentry-java/pull/5641)) ## 8.46.0 diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java index 241ab1e4cca..4f76a51e86f 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java @@ -14,12 +14,14 @@ import android.view.Window; import androidx.annotation.RequiresApi; import io.sentry.ILogger; +import io.sentry.ISentryLifecycleToken; import io.sentry.SentryLevel; import io.sentry.SentryOptions; import io.sentry.SentryUUID; import io.sentry.android.core.BuildInfoProvider; import io.sentry.android.core.ContextUtils; import io.sentry.android.core.SentryFramesDelayResult; +import io.sentry.util.AutoClosableReentrantLock; import io.sentry.util.Objects; import java.lang.ref.WeakReference; import java.lang.reflect.Field; @@ -45,7 +47,8 @@ public final class SentryFrameMetricsCollector implements Application.ActivityLi private final @NotNull Set trackedWindows = new CopyOnWriteArraySet<>(); private final @NotNull ILogger logger; - private @Nullable Handler handler; + private volatile @Nullable Handler handler; + private final @NotNull AutoClosableReentrantLock handlerLock = new AutoClosableReentrantLock(); private @Nullable WeakReference currentWindow; private final @NotNull Map listenerMap = new ConcurrentHashMap<>(); @@ -113,12 +116,8 @@ public SentryFrameMetricsCollector( } isAvailable = true; - HandlerThread handlerThread = - new HandlerThread("io.sentry.android.core.internal.util.SentryFrameMetricsCollector"); - handlerThread.setUncaughtExceptionHandler( - (thread, e) -> logger.log(SentryLevel.ERROR, "Error during frames measurements.", e)); - handlerThread.start(); - handler = new Handler(handlerThread.getLooper()); + // The frame metrics HandlerThread is started lazily on the first startCollection() call. + // Starting it here would block the main thread on HandlerThread.getLooper() during SDK init. // We have to register the lifecycle callback, even if no profile is started, otherwise when we // start a profile, we wouldn't have the current activity and couldn't get the frameMetrics. @@ -281,12 +280,34 @@ public void onActivityDestroyed(@NotNull Activity activity) {} if (!isAvailable) { return null; } + ensureHandlerThreadStarted(); final String uid = SentryUUID.generateSentryId(); listenerMap.put(uid, listener); trackCurrentWindow(); return uid; } + /** + * Lazily starts the background HandlerThread used to receive frame metrics. Deferred out of the + * constructor because {@link HandlerThread#getLooper()} blocks the caller (the main thread during + * SDK init) until the thread is ready, and the handler is only needed once collection starts. + */ + private void ensureHandlerThreadStarted() { + if (handler != null) { + return; + } + try (final @NotNull ISentryLifecycleToken ignored = handlerLock.acquire()) { + if (handler == null) { + final HandlerThread handlerThread = + new HandlerThread("io.sentry.android.core.internal.util.SentryFrameMetricsCollector"); + handlerThread.setUncaughtExceptionHandler( + (thread, e) -> logger.log(SentryLevel.ERROR, "Error during frames measurements.", e)); + handlerThread.start(); + handler = new Handler(handlerThread.getLooper()); + } + } + } + public void stopCollection(final @Nullable String listenerId) { if (!isAvailable) { return; diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt index 02f65665a9e..f90c07b70e6 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollectorTest.kt @@ -141,6 +141,16 @@ class SentryFrameMetricsCollectorTest { assertNotNull(id) } + @Test + fun `handler thread is started lazily on first startCollection`() { + val collector = fixture.getSut(context) + // not started during construction (would block the main thread on getLooper at SDK init) + assertNull(collector.getProperty("handler")) + + collector.startCollection(mock()) + assertNotNull(collector.getProperty("handler")) + } + @Test fun `collector calls addOnFrameMetricsAvailableListener when an activity starts`() { val collector = fixture.getSut(context) From 307edcd968452d07d801c46362bf98f815fea808 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Tue, 30 Jun 2026 03:50:02 -0700 Subject: [PATCH 251/391] refactor: do not start redundant UI event transaction when one is already on Scope (#5658) SentryGestureListener.startTracing always started a UI transaction and only later, in applyScope, declined to bind it when the Scope already held a manually-bound transaction. The unbound UI transaction then gathered no children and was dropped as an idle transaction. Now we read the Scope's bound transaction first and return early without starting a new one when it is present. Fixes #5491 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> --- CHANGELOG.md | 2 ++ .../internal/gestures/SentryGestureListener.java | 15 +++++++++++++++ .../gestures/SentryGestureListenerTracingTest.kt | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb4fee3db81..73bb2ef396e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Fixes +- Don't start a redundant UI interaction transaction when a transaction is already bound to the Scope ([#5491](https://github.com/getsentry/sentry-java/issues/5491)) + - Previously, `SentryGestureListener` always started a UI transaction and only afterwards skipped binding it to the Scope when a manually-bound transaction already existed, leaving the new transaction to be dropped as an idle transaction without children. - Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) ### Performance diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java index 8caffedad94..61a32b675db 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java @@ -244,6 +244,21 @@ private void startTracing(final @NotNull UiElement target, final @NotNull Gestur } } + // if there's already a transaction bound to the Scope (e.g. started manually by the user), we + // skip starting a new UI transaction: it would never be bound to the Scope in applyScope, would + // gather no children, and would be dropped as an idle transaction without children + final @Nullable ITransaction[] boundTransaction = {null}; + scopes.configureScope(scope -> boundTransaction[0] = scope.getTransaction()); + if (boundTransaction[0] != null) { + options + .getLogger() + .log( + SentryLevel.DEBUG, + "Transaction won't be created for view with id: %s since there's already a transaction bound to the Scope.", + viewIdentifier); + return; + } + // we can only bind to the scope if there's no running transaction final String name = getActivityName(activity) + "." + viewIdentifier; final String op = UI_ACTION + "." + getGestureType(eventType); diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt index fe994f4a828..9d7606bfe44 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt @@ -160,6 +160,18 @@ class SentryGestureListenerTracingTest { sut.onSingleTapUp(fixture.event) } + @Test + fun `when a transaction is already bound to the Scope, does not start a new UI transaction`() { + val sut = fixture.getSut() + val boundTransaction = SentryTracer(TransactionContext("bound", "op"), fixture.scopes) + whenever(fixture.scope.transaction).thenReturn(boundTransaction) + + sut.onSingleTapUp(fixture.event) + + verify(fixture.scopes, never()).startTransaction(any(), any()) + assertEquals(false, boundTransaction.isFinished) + } + @Test fun `stopTracing remove transaction from scope`() { val sut = fixture.getSut() From 58b65f0fd57114f98e9f2bd4517e8ffae1d51e05 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Wed, 1 Jul 2026 11:48:59 +0200 Subject: [PATCH 252/391] chore: Add PR template checkbox for cross sdk review on public API changes (#5665) Add PR template checkbox for cross sdk review on public API changes --- .github/pull_request_template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b337ac9ea4e..e4a12165077 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -25,6 +25,7 @@ - [ ] Review from the native team if needed. - [ ] No breaking change or entry added to the changelog. - [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs. +- [ ] Public API changes reviewed by another Mobile SDK team member or implemented according to the [develop docs](https://develop.sentry.dev/) spec. ## :crystal_ball: Next steps From d06126055527212a23f245ea8640d20b61bb5cd2 Mon Sep 17 00:00:00 2001 From: tsushanth <78000697+tsushanth@users.noreply.github.com> Date: Thu, 2 Jul 2026 00:32:56 -0700 Subject: [PATCH 253/391] fix: guard executor shutdown in BaseCaptureStrategy.stop() (#5627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: guard executor shutdown in BaseCaptureStrategy.stop() Each start/stop cycle leaked one SentryReplayPersister-* thread because stop() reset delegated properties (segmentTimestamp, currentReplayId) whose setters dispatch to persistingExecutor, initialising the lazy — but stop() never shut it down. Replace the lazy delegate with an explicit nullable holder so the executor is only created when actually needed and can be detected at stop() time. Call shutdownNow() (non-blocking) rather than the blocking shutdown() to avoid ANRs when stop() runs on the main thread. Fixes #5564 * style: apply spotless formatting * refactor(replay): move persistingExecutor ownership to ReplayIntegration Move persistingExecutor out of BaseCaptureStrategy and into ReplayIntegration, passing it as a constructor argument to CaptureStrategy subclasses. Shut it down in ReplayIntegration.close() alongside replayExecutor so executor lifecycle is managed in one place. * Fix leak in ReplayIntegration due to persisting executor not being shut down Add the persistingExecutor argument to SessionCaptureStrategy and BufferCaptureStrategy constructor calls in tests, and add changelog entry. Co-Authored-By: Claude Opus 4.6 (1M context) * Remove stray merge conflict marker from CHANGELOG.md Co-Authored-By: Claude Opus 4.6 (1M context) * Remove no-op leak test from SessionCaptureStrategyTest The test used a mocked executor that never spawned threads, so the thread-count assertion was always true regardless of the fix. The executor lifecycle is now owned by ReplayIntegration, not SessionCaptureStrategy, so the test belonged at the wrong layer. Co-Authored-By: Claude Opus 4.6 (1M context) * Add executor leak regression test to ReplayIntegrationTest Uses real ScheduledThreadPoolExecutor threads so the test actually fails if the shutdown in close() is removed. Co-Authored-By: Claude Opus 4.6 (1M context) * Use shutdownNow() for replay executors in close() to avoid ANR shutdown() calls awaitTermination() which blocks up to shutdownTimeoutMillis. Since close() can run on the main thread (via Sentry.close() from hybrid SDKs), this risks an ANR. shutdownNow() is non-blocking and sufficient at teardown. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Roman Zavarnitsyn Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + .../android/replay/ReplayIntegration.kt | 36 +++++++++++++++++-- .../replay/capture/BaseCaptureStrategy.kt | 19 +--------- .../replay/capture/BufferCaptureStrategy.kt | 8 +++-- .../replay/capture/SessionCaptureStrategy.kt | 11 +++++- .../replay/util/ReplayExecutorService.kt | 8 +++++ .../android/replay/ReplayIntegrationTest.kt | 27 ++++++++++++++ .../capture/BufferCaptureStrategyTest.kt | 6 ++++ .../capture/SessionCaptureStrategyTest.kt | 8 +++++ 9 files changed, 101 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73bb2ef396e..b2f260761b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Don't start a redundant UI interaction transaction when a transaction is already bound to the Scope ([#5491](https://github.com/getsentry/sentry-java/issues/5491)) - Previously, `SentryGestureListener` always started a UI transaction and only afterwards skipped binding it to the Scope when a manually-bound transaction already existed, leaving the new transaction to be dropped as an idle transaction without children. - Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) +- Fix memory leak in `ReplayIntegration` due to persisting executor not being shut down ([#5627](https://github.com/getsentry/sentry-java/pull/5627)) ### Performance diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt index 116ab45af06..612517438f6 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt @@ -107,10 +107,17 @@ public class ReplayIntegration( private var gestureRecorder: GestureRecorder? = null private val random by lazy { Random() } internal val rootViewsSpy by lazy { RootViewsSpy.install() } - private val replayExecutor by lazy { + internal val lazyReplayExecutor = lazy { val delegate = Executors.newSingleThreadScheduledExecutor(ReplayExecutorServiceThreadFactory()) ReplayExecutorService(delegate, options) } + internal val replayExecutor by lazyReplayExecutor + internal val lazyPersistingExecutor = lazy { + val delegate = + Executors.newSingleThreadScheduledExecutor(ReplayPersistingExecutorServiceThreadFactory()) + ReplayExecutorService(delegate, options) + } + internal val persistingExecutor by lazyPersistingExecutor internal val isEnabled = AtomicBoolean(false) internal val isManualPause = AtomicBoolean(false) @@ -192,6 +199,7 @@ public class ReplayIntegration( scopes, dateProvider, replayExecutor, + persistingExecutor, replayCacheProvider, ) } else { @@ -201,6 +209,7 @@ public class ReplayIntegration( dateProvider, random, replayExecutor, + persistingExecutor, replayCacheProvider, ) } @@ -373,7 +382,20 @@ public class ReplayIntegration( recorder?.close() recorder = null rootViewsSpy.close() - replayExecutor.shutdown() + if (lazyReplayExecutor.isInitialized()) { + if (options.threadChecker.isMainThread) { + replayExecutor.gracefulShutdown() + } else { + replayExecutor.shutdown() + } + } + if (lazyPersistingExecutor.isInitialized()) { + if (options.threadChecker.isMainThread) { + persistingExecutor.gracefulShutdown() + } else { + persistingExecutor.shutdown() + } + } lifecycle.currentState = CLOSED } } @@ -554,4 +576,14 @@ public class ReplayIntegration( return ret } } + + private class ReplayPersistingExecutorServiceThreadFactory : ThreadFactory { + private var cnt = 0 + + override fun newThread(r: Runnable): Thread { + val ret = Thread(r, "SentryReplayPersister-" + cnt++) + ret.setDaemon(true) + return ret + } + } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt index dab98ec4e24..6bb58c5e2a2 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt @@ -25,7 +25,6 @@ import io.sentry.android.replay.ScreenshotRecorderConfig import io.sentry.android.replay.capture.CaptureStrategy.Companion.createSegment import io.sentry.android.replay.capture.CaptureStrategy.ReplaySegment import io.sentry.android.replay.gestures.ReplayGestureConverter -import io.sentry.android.replay.util.ReplayExecutorService import io.sentry.android.replay.util.ReplayRunnable import io.sentry.protocol.SentryId import io.sentry.rrweb.RRWebEvent @@ -34,9 +33,7 @@ import java.io.File import java.util.Date import java.util.Deque import java.util.concurrent.ConcurrentLinkedDeque -import java.util.concurrent.Executors import java.util.concurrent.ScheduledExecutorService -import java.util.concurrent.ThreadFactory import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.AtomicReference @@ -50,6 +47,7 @@ internal abstract class BaseCaptureStrategy( private val scopes: IScopes?, private val dateProvider: ICurrentDateProvider, protected val replayExecutor: ScheduledExecutorService, + protected val persistingExecutor: ScheduledExecutorService, private val replayCacheProvider: ((replayId: SentryId) -> ReplayCache)? = null, ) : CaptureStrategy { internal companion object { @@ -58,11 +56,6 @@ internal abstract class BaseCaptureStrategy( private const val MAX_TRACE_IDS = 100 } - private val persistingExecutor: ScheduledExecutorService by lazy { - val delegate = - Executors.newSingleThreadScheduledExecutor(ReplayPersistingExecutorServiceThreadFactory()) - ReplayExecutorService(delegate, options) - } private val gestureConverter = ReplayGestureConverter(dateProvider) protected val isTerminating = AtomicBoolean(false) @@ -192,16 +185,6 @@ internal abstract class BaseCaptureStrategy( } } - private class ReplayPersistingExecutorServiceThreadFactory : ThreadFactory { - private var cnt = 0 - - override fun newThread(r: Runnable): Thread { - val ret = Thread(r, "SentryReplayPersister-" + cnt++) - ret.setDaemon(true) - return ret - } - } - private inline fun persistableAtomicNullable( initialValue: T? = null, propertyName: String, diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt index 0eea2043bd8..0df8a642f63 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt @@ -33,6 +33,7 @@ internal class BufferCaptureStrategy( private val dateProvider: ICurrentDateProvider, private val random: Random, executor: ScheduledExecutorService, + persistingExecutor: ScheduledExecutorService, replayCacheProvider: ((replayId: SentryId) -> ReplayCache)? = null, ) : BaseCaptureStrategy( @@ -40,6 +41,7 @@ internal class BufferCaptureStrategy( scopes, dateProvider, executor, + persistingExecutor, replayCacheProvider = replayCacheProvider, ) { // TODO: capture envelopes for buffered segments instead, but don't send them until buffer is @@ -150,8 +152,10 @@ internal class BufferCaptureStrategy( ) return this } - // we hand over replayExecutor to the new strategy to preserve order of execution - val captureStrategy = SessionCaptureStrategy(options, scopes, dateProvider, replayExecutor) + // we hand over replayExecutor and persistingExecutor to the new strategy to preserve order of + // execution + val captureStrategy = + SessionCaptureStrategy(options, scopes, dateProvider, replayExecutor, persistingExecutor) captureStrategy.recorderConfig = recorderConfig captureStrategy.start( segmentId = currentSegment, diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt index 4d3ee588f01..d62efb534cc 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt @@ -21,8 +21,17 @@ internal class SessionCaptureStrategy( private val scopes: IScopes?, private val dateProvider: ICurrentDateProvider, executor: ScheduledExecutorService, + persistingExecutor: ScheduledExecutorService, replayCacheProvider: ((replayId: SentryId) -> ReplayCache)? = null, -) : BaseCaptureStrategy(options, scopes, dateProvider, executor, replayCacheProvider) { +) : + BaseCaptureStrategy( + options, + scopes, + dateProvider, + executor, + persistingExecutor, + replayCacheProvider, + ) { internal companion object { private const val TAG = "SessionCaptureStrategy" } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/ReplayExecutorService.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/ReplayExecutorService.kt index 31a3279d074..9e9491f516f 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/util/ReplayExecutorService.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/util/ReplayExecutorService.kt @@ -57,6 +57,14 @@ internal class ReplayExecutorService( } } } + + fun gracefulShutdown() { + synchronized(this) { + if (!isShutdown) { + delegate.shutdown() + } + } + } } internal class ReplayRunnable(val taskName: String, delegate: Runnable) : Runnable by delegate diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt index 3df0c9f005f..61b5213e76f 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt @@ -754,6 +754,12 @@ class ReplayIntegrationTest { null } }, + mock { + whenever(mock.submit(any())).doAnswer { + (it.arguments[0] as Runnable).run() + null + } + }, ) { _ -> fixture.replayCache } @@ -1104,6 +1110,20 @@ class ReplayIntegrationTest { assertEquals(traceId, traceIdRegistered) } + @Test + fun `close shuts down replay executors`() { + fixture.options.cacheDirPath = tmpDir.newFolder().absolutePath + + val replay = fixture.getSut(context) + replay.register(fixture.scopes, fixture.options) + replay.start() + replay.stop() + replay.close() + + assertTrue(replay.replayExecutor.isShutdown) + assertTrue(replay.persistingExecutor.isShutdown) + } + private fun getSessionCaptureStrategy(options: SentryOptions): SessionCaptureStrategy = SessionCaptureStrategy( options, @@ -1116,5 +1136,12 @@ class ReplayIntegrationTest { null } }, + persistingExecutor = + mock { + whenever(mock.submit(any())).doAnswer { + (it.arguments[0] as Runnable).run() + null + } + }, ) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt index 380e9b3ce75..b5048e856ff 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt @@ -111,6 +111,12 @@ class BufferCaptureStrategyTest { null } }, + mock { + whenever(it.submit(any())).doAnswer { invocation -> + (invocation.arguments[0] as Runnable).run() + null + } + }, ) { _ -> replayCache } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt index b5a00bc624b..dd9e6c6ce1d 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt @@ -122,6 +122,14 @@ class SessionCaptureStrategyTest { .whenever(it) .submit(any()) }, + mock { + doAnswer { invocation -> + (invocation.arguments[0] as Runnable).run() + null + } + .whenever(it) + .submit(any()) + }, ) { _ -> replayCache } From 0980ed763492be856f205dabfea93f14e8942878 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 2 Jul 2026 10:18:42 +0200 Subject: [PATCH 254/391] perf(core): Drop per-instance lock from SentryId and SpanId (#5645) * perf(core): Drop per-instance lock from SentryId and SpanId (JAVA-589) SentryId and SpanId stored their string value behind a LazyEvaluator, which allocates an AutoClosableReentrantLock (a ReentrantLock with its internal Sync) plus a capturing lambda on every instance. Since one SentryId is created per event/transaction and one SpanId per span, this per-instance lock machinery is far heavier than the single String it guards, and the eager string-arg constructors gained no laziness at all. Replace the LazyEvaluator with a plain volatile String guarded by a double-checked synchronized(this) block. Eager constructors now assign the value directly; the no-arg and UUID constructors still defer UUID-string generation. Synchronization is retained because UUID generation is non-idempotent and two racing threads must not produce different ids. Follow-up to the SDK Overhead Reduction work (#5499). Co-Authored-By: Claude Opus 4.8 * changelog --------- Co-authored-by: Claude Opus 4.8 --- CHANGELOG.md | 1 + sentry/src/main/java/io/sentry/SpanId.java | 31 ++++++++++----- .../java/io/sentry/protocol/SentryId.java | 39 ++++++++++++------- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f260761b3..2a9e71a0cf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Probe class availability without initializing the class during SDK init ([#5635](https://github.com/getsentry/sentry-java/pull/5635)) - Avoid constructing an exception per view when resolving view ids during view-hierarchy and gesture capture ([#5631](https://github.com/getsentry/sentry-java/pull/5631)) - Start the frame metrics thread lazily on first collection instead of during SDK init ([#5641](https://github.com/getsentry/sentry-java/pull/5641)) +- Reduce `SentryId` and `SpanId` allocation overhead by replacing their per-instance `LazyEvaluator` (and its lock) with a lightweight lazily-generated `String`. ([#5645](https://github.com/getsentry/sentry-java/pull/5645)) ## 8.46.0 diff --git a/sentry/src/main/java/io/sentry/SpanId.java b/sentry/src/main/java/io/sentry/SpanId.java index fcc7f3a4f38..2048647f9f9 100644 --- a/sentry/src/main/java/io/sentry/SpanId.java +++ b/sentry/src/main/java/io/sentry/SpanId.java @@ -2,24 +2,35 @@ import static io.sentry.util.StringUtils.PROPER_NIL_UUID; -import io.sentry.util.LazyEvaluator; import java.io.IOException; import java.util.Objects; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public final class SpanId implements JsonSerializable { public static final SpanId EMPTY_ID = new SpanId(PROPER_NIL_UUID.replace("-", "").substring(0, 16)); - private final @NotNull LazyEvaluator lazyValue; + private volatile @Nullable String value; public SpanId(final @NotNull String value) { - Objects.requireNonNull(value, "value is required"); - this.lazyValue = new LazyEvaluator<>(() -> value); + this.value = Objects.requireNonNull(value, "value is required"); } - public SpanId() { - this.lazyValue = new LazyEvaluator<>(SentryUUID::generateSpanId); + public SpanId() {} + + private @NotNull String getValue() { + String result = value; + if (result == null) { + synchronized (this) { + result = value; + if (result == null) { + result = SentryUUID.generateSpanId(); + value = result; + } + } + } + return result; } @Override @@ -27,17 +38,17 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpanId spanId = (SpanId) o; - return lazyValue.getValue().equals(spanId.lazyValue.getValue()); + return getValue().equals(spanId.getValue()); } @Override public int hashCode() { - return lazyValue.getValue().hashCode(); + return getValue().hashCode(); } @Override public String toString() { - return lazyValue.getValue(); + return getValue(); } // JsonElementSerializer @@ -45,7 +56,7 @@ public String toString() { @Override public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger logger) throws IOException { - writer.value(lazyValue.getValue()); + writer.value(getValue()); } // JsonElementDeserializer diff --git a/sentry/src/main/java/io/sentry/protocol/SentryId.java b/sentry/src/main/java/io/sentry/protocol/SentryId.java index a5bd7980c3f..8d85afe4639 100644 --- a/sentry/src/main/java/io/sentry/protocol/SentryId.java +++ b/sentry/src/main/java/io/sentry/protocol/SentryId.java @@ -6,7 +6,6 @@ import io.sentry.ObjectReader; import io.sentry.ObjectWriter; import io.sentry.SentryUUID; -import io.sentry.util.LazyEvaluator; import io.sentry.util.StringUtils; import io.sentry.util.UUIDStringUtils; import java.io.IOException; @@ -19,19 +18,15 @@ public final class SentryId implements JsonSerializable { public static final SentryId EMPTY_ID = new SentryId(StringUtils.PROPER_NIL_UUID.replace("-", "")); - private final @NotNull LazyEvaluator lazyStringValue; + private volatile @Nullable String value; + private final @Nullable UUID uuid; public SentryId() { this((UUID) null); } public SentryId(@Nullable UUID uuid) { - if (uuid != null) { - this.lazyStringValue = - new LazyEvaluator<>(() -> normalize(UUIDStringUtils.toSentryIdString(uuid))); - } else { - this.lazyStringValue = new LazyEvaluator<>(SentryUUID::generateSentryId); - } + this.uuid = uuid; } public SentryId(final @NotNull String sentryIdString) { @@ -42,16 +37,30 @@ public SentryId(final @NotNull String sentryIdString) { + "or 36 characters long (completed UUID). Received: " + sentryIdString); } - if (normalized.length() == 36) { - this.lazyStringValue = new LazyEvaluator<>(() -> normalize(normalized)); - } else { - this.lazyStringValue = new LazyEvaluator<>(() -> normalized); + this.uuid = null; + this.value = normalized.length() == 36 ? normalized.replace("-", "") : normalized; + } + + private @NotNull String getValue() { + String result = value; + if (result == null) { + synchronized (this) { + result = value; + if (result == null) { + result = + uuid != null + ? normalize(UUIDStringUtils.toSentryIdString(uuid)) + : SentryUUID.generateSentryId(); + value = result; + } + } } + return result; } @Override public String toString() { - return lazyStringValue.getValue(); + return getValue(); } @Override @@ -59,12 +68,12 @@ public boolean equals(final @Nullable Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SentryId sentryId = (SentryId) o; - return lazyStringValue.getValue().equals(sentryId.lazyStringValue.getValue()); + return getValue().equals(sentryId.getValue()); } @Override public int hashCode() { - return lazyStringValue.getValue().hashCode(); + return getValue().hashCode(); } private @NotNull String normalize(@NotNull String uuidString) { From 30862fca3f9c52541d12e1d966e19f22ed22d402 Mon Sep 17 00:00:00 2001 From: tsushanth <78000697+tsushanth@users.noreply.github.com> Date: Thu, 2 Jul 2026 01:23:22 -0700 Subject: [PATCH 255/391] fix(compose): add isImportantForBounds() to SentryTagModifierNode for compose-ui 1.11+ (#5672) * fix(compose): add isImportantForBounds() to SentryTagModifierNode for compose-ui 1.11+ compose-ui 1.11 added SemanticsModifierNode.isImportantForBounds() as an abstract method. SentryTagModifierNode was compiled against compose-ui 1.6.x, where the method does not exist, so its bytecode lacks an implementation. When an accessibility client (TalkBack, UiAutomator, adb uiautomator dump) traverses the Compose semantics tree at runtime on 1.11+, the JVM cannot find the method and throws AbstractMethodError. Adding fun isImportantForBounds(): Boolean = false without the override keyword (since the method is absent from the 1.6.x compile-time dependency) places the method in the class bytecode. The JVM satisfies the abstract method requirement via signature matching at runtime. SentryTagModifierNode stores only a semantic tag with no layout/visual effect, so false is the correct return value. * fix formatting * chore(changelog): Add Changelog entry --------- Co-authored-by: Markus Hintersteiner --- CHANGELOG.md | 1 + .../kotlin/io/sentry/compose/SentryModifier.kt | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a9e71a0cf4..31c600cbcf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Previously, `SentryGestureListener` always started a UI transaction and only afterwards skipped binding it to the Scope when a manually-bound transaction already existed, leaving the new transaction to be dropped as an idle transaction without children. - Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) - Fix memory leak in `ReplayIntegration` due to persisting executor not being shut down ([#5627](https://github.com/getsentry/sentry-java/pull/5627)) +- Fix AbstractMethodError when compose-ui 1.11+ is used in combination with `Modifier.sentryTag()` or the Sentry Kotlin compiler plugin ([#5672](https://github.com/getsentry/sentry-java/pull/5672)) ### Performance diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryModifier.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryModifier.kt index 3fec407987b..787c66b3b0b 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryModifier.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryModifier.kt @@ -53,5 +53,15 @@ public object SentryModifier { override fun SemanticsPropertyReceiver.applySemantics() { this[SentryTag] = tag } + + // SemanticsModifierNode.isImportantForBounds() was added as an abstract method in + // compose-ui 1.11. Classes compiled against earlier versions lack this method in + // their bytecode, which causes AbstractMethodError when the accessibility tree is + // traversed on 1.11+ runtimes. We can't use the `override` keyword here because + // the method doesn't exist in the compile-time dependency (compose-ui 1.6.x), but + // the JVM satisfies the abstract-method requirement at runtime via signature + // matching. SentryTagModifierNode only stores a semantic tag and has no visual + // effect on layout, so it is not important for bounds. + @Suppress("unused") fun isImportantForBounds(): Boolean = false } } From 4414d9f4cd5601bee4c95f72a868b2c1ddff1f80 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 2 Jul 2026 10:27:25 +0200 Subject: [PATCH 256/391] build: Remove global per-test JVM heap cap (#5671) * build: Remove global per-test JVM heap cap The minHeapSize/maxHeapSize cap in the root build.gradle.kts was applied to every module's test task. Most modules do not need it, so remove it and let tests use the JVM defaults. If a specific module turns out to require a larger heap, the cap can be re-added to that module only. Co-Authored-By: Claude Opus 4.8 * build: Restore per-test heap cap for sentry-android-core CI showed :sentry-android-core:testReleaseUnitTest fails with OutOfMemoryError (Robolectric loading the android-all jar) once the global cap is removed. Restore the 256m/2g cap for this module only, where it is actually needed. Co-Authored-By: Claude Opus 4.8 * build: Drop stale comment about root build.gradle.kts Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.8 --- build.gradle.kts | 4 ---- sentry-android-core/build.gradle.kts | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 93c82cd8c9a..2e334f43a65 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -103,10 +103,6 @@ allprojects { TestLogEvent.PASSED, TestLogEvent.FAILED ) - - // Cap JVM args per test - minHeapSize = "256m" - maxHeapSize = "2g" } withType().configureEach { options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try")) diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index f7440b19494..0388b7de486 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -40,6 +40,12 @@ android { unitTests.apply { isReturnDefaultValues = true isIncludeAndroidResources = true + // Robolectric loads the android-all jar into each test JVM, which needs more heap + // than the default. + all { + it.minHeapSize = "256m" + it.maxHeapSize = "2g" + } } } From ea2a517b565d0dc5c37a0e2f22f68324f0fc724f Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 2 Jul 2026 11:23:30 +0200 Subject: [PATCH 257/391] perf(core): Lazily allocate AutoClosableReentrantLock (JAVA-588) (#5643) * perf(core): Lazily allocate AutoClosableReentrantLock (JAVA-588) AutoClosableReentrantLock extended ReentrantLock, so every SDK object holding one allocated a ReentrantLock (and its AbstractQueuedSynchronizer) eagerly in its field initializer. A customer Perfetto trace showed ~81 such allocations on the main thread during SentryAndroid.init, many for locks that are never acquired during init. Hold the ReentrantLock internally and create it lazily on first acquire(), using an AtomicReferenceFieldUpdater CAS so creation stays atomic and Loom-friendly (no synchronized, preserving #3715). Every call site uses acquire() only, so dropping the ReentrantLock superclass touches no caller. Co-Authored-By: Claude Opus 4.8 (1M context) * changelog * perf(core): Harden lazy lock init and mark AutoClosableReentrantLock internal (JAVA-588) Replace the unreachable candidate fallback after a failed CAS with an explicit non-null check, so a broken invariant fails loudly instead of handing two threads different locks. Mark the class @ApiStatus.Internal and make the lazy-allocation test assert the lock field directly. Co-Authored-By: Claude Fable 5 * perf(core): Return the lock itself as the lifecycle token (JAVA-588) Every acquire() allocated a fresh lifecycle token, which is per-use garbage on every lock acquisition forever, not just at init. The token was stateless apart from its lock reference, so AutoClosableReentrantLock now implements ISentryLifecycleToken itself and acquire() returns this, making the steady-state acquire/close path allocation-free. Semantics are unchanged: try-with-resources closes once per acquire, so reentrant acquires stay balanced, and unlocking without holding the lock still throws IllegalMonitorStateException. Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 1 + sentry/api/sentry.api | 3 +- .../util/AutoClosableReentrantLock.java | 69 +++++++++++++++---- .../util/AutoClosableReentrantLockTest.kt | 58 ++++++++++++++++ 4 files changed, 116 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31c600cbcf4..95a6a5b5f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Avoid constructing an exception per view when resolving view ids during view-hierarchy and gesture capture ([#5631](https://github.com/getsentry/sentry-java/pull/5631)) - Start the frame metrics thread lazily on first collection instead of during SDK init ([#5641](https://github.com/getsentry/sentry-java/pull/5641)) - Reduce `SentryId` and `SpanId` allocation overhead by replacing their per-instance `LazyEvaluator` (and its lock) with a lightweight lazily-generated `String`. ([#5645](https://github.com/getsentry/sentry-java/pull/5645)) +- Lazily allocate the `ReentrantLock` backing `AutoClosableReentrantLock` to avoid eager lock allocations for SDK objects that never contend during `SentryAndroid.init` ([#5643](https://github.com/getsentry/sentry-java/pull/5643)) ## 8.46.0 diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 04c876fdbdb..383ea92b116 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -7589,9 +7589,10 @@ public abstract class io/sentry/transport/TransportResult { public static fun success ()Lio/sentry/transport/TransportResult; } -public final class io/sentry/util/AutoClosableReentrantLock : java/util/concurrent/locks/ReentrantLock { +public final class io/sentry/util/AutoClosableReentrantLock : io/sentry/ISentryLifecycleToken { public fun ()V public fun acquire ()Lio/sentry/ISentryLifecycleToken; + public fun close ()V } public final class io/sentry/util/CheckInUtils { diff --git a/sentry/src/main/java/io/sentry/util/AutoClosableReentrantLock.java b/sentry/src/main/java/io/sentry/util/AutoClosableReentrantLock.java index 2a95a58b5fe..cf53d860e08 100644 --- a/sentry/src/main/java/io/sentry/util/AutoClosableReentrantLock.java +++ b/sentry/src/main/java/io/sentry/util/AutoClosableReentrantLock.java @@ -1,29 +1,70 @@ package io.sentry.util; import io.sentry.ISentryLifecycleToken; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import java.util.concurrent.locks.ReentrantLock; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; -public final class AutoClosableReentrantLock extends ReentrantLock { +/** + * Hands out an {@link ISentryLifecycleToken} from {@link #acquire()} for use with + * try-with-resources (replacing {@code synchronized} blocks). + * + *

The underlying {@link ReentrantLock} is created lazily on the first {@link #acquire()}. Many + * SDK objects hold a lock but never contend on it (especially during {@code SentryAndroid.init}), + * so the eager allocation of a {@link ReentrantLock} (and its {@code AbstractQueuedSynchronizer}) + * was pure GC and main-thread overhead. We keep a {@link ReentrantLock} rather than reverting to + * {@code synchronized} to stay friendly to virtual threads (Loom), see #3715. + * + *

{@link #acquire()} returns this instance as the token, so the steady-state acquire/close path + * allocates nothing. Reentrant acquires stay balanced because try-with-resources calls {@link + * #close()} exactly once per acquire. + */ +@ApiStatus.Internal +public final class AutoClosableReentrantLock implements ISentryLifecycleToken { - private static final long serialVersionUID = -3283069816958445549L; + private static final @NotNull AtomicReferenceFieldUpdater< + AutoClosableReentrantLock, ReentrantLock> + LOCK_UPDATER = + AtomicReferenceFieldUpdater.newUpdater( + AutoClosableReentrantLock.class, ReentrantLock.class, "lock"); - public ISentryLifecycleToken acquire() { - lock(); - return new AutoClosableReentrantLockLifecycleToken(this); - } + private volatile @Nullable ReentrantLock lock; - static final class AutoClosableReentrantLockLifecycleToken implements ISentryLifecycleToken { + public @NotNull ISentryLifecycleToken acquire() { + getOrCreateLock().lock(); + return this; + } - private final @NotNull ReentrantLock lock; + @Override + public void close() { + Objects.requireNonNull(lock, "close() called before acquire()").unlock(); + } - AutoClosableReentrantLockLifecycleToken(final @NotNull ReentrantLock lock) { - this.lock = lock; + private @NotNull ReentrantLock getOrCreateLock() { + final @Nullable ReentrantLock existing = lock; + if (existing != null) { + return existing; } - - @Override - public void close() { - lock.unlock(); + final @NotNull ReentrantLock candidate = new ReentrantLock(); + if (LOCK_UPDATER.compareAndSet(this, null, candidate)) { + return candidate; } + // The CAS can only fail because another thread installed its lock first, and the field is + // never reset, so all callers end up contending on that same instance. + return Objects.requireNonNull(lock, "lock must have been set by the winning thread"); + } + + @TestOnly + boolean isLocked() { + final @Nullable ReentrantLock current = lock; + return current != null && current.isLocked(); + } + + @TestOnly + boolean isLockAllocated() { + return lock != null; } } diff --git a/sentry/src/test/java/io/sentry/util/AutoClosableReentrantLockTest.kt b/sentry/src/test/java/io/sentry/util/AutoClosableReentrantLockTest.kt index 4a69b9638e7..943a2c2bf70 100644 --- a/sentry/src/test/java/io/sentry/util/AutoClosableReentrantLockTest.kt +++ b/sentry/src/test/java/io/sentry/util/AutoClosableReentrantLockTest.kt @@ -1,7 +1,12 @@ package io.sentry.util +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertSame import kotlin.test.assertTrue class AutoClosableReentrantLockTest { @@ -11,4 +16,57 @@ class AutoClosableReentrantLockTest { lock.acquire().use { assertTrue(lock.isLocked) } assertFalse(lock.isLocked) } + + @Test + fun `acquire returns the lock itself as the token, allocating nothing`() { + val lock = AutoClosableReentrantLock() + lock.acquire().use { token -> assertSame(lock, token) } + } + + @Test + fun `does not allocate the underlying lock until first acquire`() { + val lock = AutoClosableReentrantLock() + assertFalse(lock.isLockAllocated) + lock.acquire().use {} + assertTrue(lock.isLockAllocated) + } + + @Test + fun `supports reentrant acquire from the same thread`() { + val lock = AutoClosableReentrantLock() + lock.acquire().use { + lock.acquire().use { assertTrue(lock.isLocked) } + assertTrue(lock.isLocked) + } + assertFalse(lock.isLocked) + } + + @Test + fun `mutually excludes concurrent threads`() { + val lock = AutoClosableReentrantLock() + val inCriticalSection = AtomicInteger(0) + val maxObserved = AtomicInteger(0) + val start = CountDownLatch(1) + val threadCount = 8 + val iterations = 1000 + val threads = + (0 until threadCount).map { + Thread { + start.await() + repeat(iterations) { + lock.acquire().use { + val current = inCriticalSection.incrementAndGet() + maxObserved.accumulateAndGet(current, ::maxOf) + inCriticalSection.decrementAndGet() + } + } + } + } + threads.forEach(Thread::start) + start.countDown() + threads.forEach { it.join(TimeUnit.SECONDS.toMillis(10)) } + + assertEquals(1, maxObserved.get()) + assertFalse(lock.isLocked) + } } From 844c3e85ea53e298315edb075db1fd39bfdd47f0 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Thu, 2 Jul 2026 11:24:49 +0200 Subject: [PATCH 258/391] build: Suppress obsolete Java 8 option warning under JDK 21+ (#5664) The root build compiles Java with -Xlint:all -Werror. On JDK 21+, javac flags -source/-target 8 as obsolete, and -Werror promotes that warning to an error, failing :sentry:compileJava. CI pins JDK 17, where the warning does not exist, so this only breaks local builds and tooling on newer JDKs (e.g. the Kotlin LSP's bundled JDK 25, whose Gradle project import aborts and loses cross-module resolution). Add -Xlint:-options, the suppression javac itself recommends when intentionally targeting an older release. Co-authored-by: Claude Opus 4.8 (1M context) --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2e334f43a65..55b5a71a1e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -105,7 +105,7 @@ allprojects { ) } withType().configureEach { - options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try")) + options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try", "-Xlint:-options")) } } } From ac08f86d4a15996d553eceef3d1cdfbbfe6bcc32 Mon Sep 17 00:00:00 2001 From: markushi <1411808+markushi@users.noreply.github.com> Date: Thu, 2 Jul 2026 09:52:17 +0000 Subject: [PATCH 259/391] release: 8.47.0 --- CHANGELOG.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95a6a5b5f67..5c43f0976ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 8.47.0 ### Behavioral Changes diff --git a/gradle.properties b/gradle.properties index 804e4b58573..4c0a1cffd1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ android.useAndroidX=true android.experimental.lint.version=8.13.1 # Release information -versionName=8.46.0 +versionName=8.47.0 # Override the SDK name on native crashes on Android sentryAndroidSdkName=sentry.native.android From 7d8a3947cce374aa65ec6b9e702733ff89a0f29d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 2 Jul 2026 13:44:30 +0200 Subject: [PATCH 260/391] fix(android-fragment): support detach/attach navigation in fragment tracing (#5660) * fix(android-fragment): support detach/attach navigation in fragment tracing For detach/attach tab navigation (manual tab switching, ViewPager v1 with FragmentPagerAdapter, custom navigation frameworks), onFragmentCreated is skipped for off-screen fragments that are re-attached. Previously this left ui.load spans open until the 30s activity transaction deadline, producing inflated performance data. Fix by calling startTracing in onFragmentViewCreated as well as onFragmentCreated. startTracing is idempotent (no-op if a span is already running), so the normal onFragmentCreated -> onFragmentViewCreated path is unaffected. Add matching stopTracing calls in onFragmentResumed (covers the detach/attach path where onFragmentStarted may be skipped) and onFragmentViewDestroyed (failsafe for fragments destroyed before reaching STARTED or RESUMED). stopTracing is also idempotent, so the normal path is unaffected. Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> * Format code * Add changelog entry and detach/attach sample Co-Authored-By: Claude Opus 4.6 (1M context) * Remove duplicate test methods in fragment lifecycle test Co-Authored-By: Claude Opus 4.6 (1M context) * fix: Update screen name on scope for detach/attach fragment re-attachment onFragmentCreated is skipped during detach/attach navigation, so the screen name was never updated for re-attached fragments. Mirror the screen tracking into onFragmentViewCreated to cover that path. Co-Authored-By: Claude Opus 4.6 (1M context) * Format code * Address PR feedback: internalize guards into startTracing and fix sample layout Move isAdded check, screen tracking, and tracing logic into startTracing() to deduplicate guards from onFragmentCreated and onFragmentViewCreated. Fix DetachAttachTabsActivity sample rendering on API 35+ by using NoActionBar theme and fitsSystemWindows. Co-Authored-By: Claude Opus 4.6 (1M context) * fix: Decouple screen tracking from performance tracing in fragments Screen name updates on scope should work independently of whether performance tracing is enabled. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Sentry Github Bot Co-authored-by: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 1 + .../SentryFragmentLifecycleCallbacks.kt | 39 ++++-- .../SentryFragmentLifecycleCallbacksTest.kt | 117 +++++++++++++++++- .../src/main/AndroidManifest.xml | 5 + .../android/DetachAttachTabsActivity.kt | 50 ++++++++ .../io/sentry/samples/android/MainActivity.kt | 12 ++ .../layout/activity_detach_attach_tabs.xml | 32 +++++ .../src/main/res/layout/fragment_tab.xml | 12 ++ 8 files changed, 257 insertions(+), 11 deletions(-) create mode 100644 sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/DetachAttachTabsActivity.kt create mode 100644 sentry-samples/sentry-samples-android/src/main/res/layout/activity_detach_attach_tabs.xml create mode 100644 sentry-samples/sentry-samples-android/src/main/res/layout/fragment_tab.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c43f0976ed..3a290e2b3e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes +- Fix fragment tracing not working with detach/attach navigation ([#5660](https://github.com/getsentry/sentry-java/pull/5660)) - Don't start a redundant UI interaction transaction when a transaction is already bound to the Scope ([#5491](https://github.com/getsentry/sentry-java/issues/5491)) - Previously, `SentryGestureListener` always started a UI transaction and only afterwards skipped binding it to the Scope when a manually-bound transaction already existed, leaving the new transaction to be dropped as an idle transaction without children. - Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657)) diff --git a/sentry-android-fragment/src/main/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacks.kt b/sentry-android-fragment/src/main/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacks.kt index 230510fb4de..374713ba969 100644 --- a/sentry-android-fragment/src/main/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacks.kt +++ b/sentry-android-fragment/src/main/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacks.kt @@ -76,14 +76,7 @@ public class SentryFragmentLifecycleCallbacks( ) { addBreadcrumb(fragment, FragmentLifecycleState.CREATED) - // we only start the tracing for the fragment if the fragment has been added to its activity - // and not only to the backstack - if (fragment.isAdded) { - if (scopes.options.isEnableScreenTracking) { - scopes.configureScope { it.screen = getFragmentName(fragment) } - } - startTracing(fragment) - } + startTracing(fragment) } override fun onFragmentViewCreated( @@ -93,17 +86,30 @@ public class SentryFragmentLifecycleCallbacks( savedInstanceState: Bundle?, ) { addBreadcrumb(fragment, FragmentLifecycleState.VIEW_CREATED) + + // For detach/attach navigation (e.g. manual tab switching, ViewPager v1 with + // FragmentPagerAdapter, custom navigation frameworks), onFragmentCreated is never called for + // off-screen fragments that are re-attached. Starting here enables a narrower + // "view created -> resumed" span for those paths. startTracing is idempotent, so for the + // normal onFragmentCreated -> onFragmentViewCreated path this is a no-op. + startTracing(fragment) } override fun onFragmentStarted(fragmentManager: FragmentManager, fragment: Fragment) { addBreadcrumb(fragment, FragmentLifecycleState.STARTED) - // ViewPager2 locks background fragments to STARTED state + // ViewPager2 locks background fragments to STARTED state, so we stop here to avoid + // spans hanging for off-screen fragments that never reach RESUMED. stopTracing(fragment) } override fun onFragmentResumed(fragmentManager: FragmentManager, fragment: Fragment) { addBreadcrumb(fragment, FragmentLifecycleState.RESUMED) + + // For detach/attach navigation, onFragmentStarted may not fire before onFragmentResumed. + // If a span is still running here, stop it now. stopTracing is idempotent, so this is a + // no-op for the normal path where onFragmentStarted already stopped the span. + stopTracing(fragment) } override fun onFragmentPaused(fragmentManager: FragmentManager, fragment: Fragment) { @@ -116,6 +122,10 @@ public class SentryFragmentLifecycleCallbacks( override fun onFragmentViewDestroyed(fragmentManager: FragmentManager, fragment: Fragment) { addBreadcrumb(fragment, FragmentLifecycleState.VIEW_DESTROYED) + + // Failsafe: cancel any span that didn't finish via the normal started/resumed path + // (e.g. fragment view destroyed before reaching STARTED or RESUMED). + stopTracing(fragment) } override fun onFragmentDestroyed(fragmentManager: FragmentManager, fragment: Fragment) { @@ -153,6 +163,16 @@ public class SentryFragmentLifecycleCallbacks( fragmentsWithOngoingTransactions.containsKey(fragment) private fun startTracing(fragment: Fragment) { + if (!fragment.isAdded) { + return + } + + val fragmentName = getFragmentName(fragment) + + if (scopes.options.isEnableScreenTracking) { + scopes.configureScope { it.screen = fragmentName } + } + if (!isPerformanceEnabled || isRunningSpan(fragment)) { return } @@ -160,7 +180,6 @@ public class SentryFragmentLifecycleCallbacks( var transaction: ISpan? = null scopes.configureScope { transaction = it.transaction } - val fragmentName = getFragmentName(fragment) val span = transaction?.startChild(FRAGMENT_LOAD_OP, fragmentName) span?.let { diff --git a/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt b/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt index 9446e1caef5..997c1206398 100644 --- a/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt +++ b/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt @@ -43,9 +43,15 @@ class SentryFragmentLifecycleCallbacksTest { enableAutoFragmentLifecycleTracing: Boolean = false, tracesSampleRate: Double? = 1.0, isAdded: Boolean = true, + enableScreenTracking: Boolean = false, ): SentryFragmentLifecycleCallbacks { whenever(scopes.options) - .thenReturn(SentryOptions().apply { setTracesSampleRate(tracesSampleRate) }) + .thenReturn( + SentryOptions().apply { + setTracesSampleRate(tracesSampleRate) + isEnableScreenTracking = enableScreenTracking + } + ) whenever(span.spanContext) .thenReturn(SpanContext(SentryId.EMPTY_ID, SpanId.EMPTY_ID, "op", null, null)) whenever(transaction.startChild(any(), any())).thenReturn(span) @@ -251,6 +257,115 @@ class SentryFragmentLifecycleCallbacksTest { verify(fixture.span).finish(check { assertEquals(SpanStatus.OK, it) }) } + @Test + fun `When fragment view is created via detach-attach, it should start tracing if enabled`() { + // Simulates detach/attach navigation: onFragmentCreated is NOT called, only + // onFragmentViewCreated + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true) + + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + + verify(fixture.transaction) + .startChild( + check { assertEquals(SentryFragmentLifecycleCallbacks.FRAGMENT_LOAD_OP, it) }, + check { assertEquals("androidx.fragment.app.Fragment", it) }, + ) + } + + @Test + fun `When fragment view is created via detach-attach, it should update screen name`() { + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true, enableScreenTracking = true) + + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + + verify(fixture.scope).screen = "androidx.fragment.app.Fragment" + } + + @Test + fun `When performance is disabled, it should still update screen name`() { + val sut = + fixture.getSut(enableAutoFragmentLifecycleTracing = false, enableScreenTracking = true) + + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + + verify(fixture.scope).screen = "androidx.fragment.app.Fragment" + verify(fixture.transaction, never()).startChild(any(), any()) + } + + @Test + fun `When fragment view is created after onFragmentCreated, it should not start a second span`() { + // Normal path: onFragmentCreated already started the span; onFragmentViewCreated is a no-op + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true) + + sut.onFragmentCreated(fixture.fragmentManager, fixture.fragment, savedInstanceState = null) + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + + verify(fixture.transaction).startChild(any(), any()) + } + + @Test + fun `When fragment is resumed, it should stop tracing if span is still running`() { + // Simulates detach/attach path where onFragmentStarted may be skipped + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true) + + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + sut.onFragmentResumed(fixture.fragmentManager, fixture.fragment) + + verify(fixture.span).finish(check { assertEquals(SpanStatus.OK, it) }) + } + + @Test + fun `When fragment is resumed after started, it should not double-finish the span`() { + // Normal path: onFragmentStarted already stopped the span; onFragmentResumed is a no-op + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true) + + sut.onFragmentCreated(fixture.fragmentManager, fixture.fragment, savedInstanceState = null) + sut.onFragmentStarted(fixture.fragmentManager, fixture.fragment) + sut.onFragmentResumed(fixture.fragmentManager, fixture.fragment) + + verify(fixture.span).finish(any()) + } + + @Test + fun `When fragment view is destroyed before started, it should stop tracing as failsafe`() { + val sut = fixture.getSut(enableAutoFragmentLifecycleTracing = true) + + sut.onFragmentViewCreated( + fixture.fragmentManager, + fixture.fragment, + view = mock(), + savedInstanceState = null, + ) + sut.onFragmentViewDestroyed(fixture.fragmentManager, fixture.fragment) + + verify(fixture.span).finish(check { assertEquals(SpanStatus.OK, it) }) + } + private fun verifyBreadcrumbAdded(expectedState: String) { verify(fixture.scopes) .addBreadcrumb( diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 1150dd5ef2e..d72087fbfa5 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -65,6 +65,11 @@ android:name=".ThirdActivityFragment" android:exported="false" /> + + diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/DetachAttachTabsActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/DetachAttachTabsActivity.kt new file mode 100644 index 00000000000..3a38814c5d8 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/DetachAttachTabsActivity.kt @@ -0,0 +1,50 @@ +package io.sentry.samples.android + +import android.os.Bundle +import android.view.View +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import androidx.fragment.app.commit + +class DetachAttachTabsActivity : AppCompatActivity(R.layout.activity_detach_attach_tabs) { + + private val tags = arrayOf("tab_a", "tab_b") + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + findViewById(R.id.btn_tab_a).setOnClickListener { showTab(0) } + findViewById(R.id.btn_tab_b).setOnClickListener { showTab(1) } + + if (savedInstanceState == null) { + val tabB = TabFragmentB() + supportFragmentManager.commit { + add(R.id.tab_container, TabFragmentA(), tags[0]) + add(R.id.tab_container, tabB, tags[1]) + detach(tabB) + } + } + } + + private fun showTab(index: Int) { + supportFragmentManager.commit { + for (i in tags.indices) { + val frag = supportFragmentManager.findFragmentByTag(tags[i]) ?: continue + if (i == index) attach(frag) else detach(frag) + } + } + } +} + +class TabFragmentA : Fragment(R.layout.fragment_tab) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + view.findViewById(R.id.tab_label).text = "Tab A" + } +} + +class TabFragmentB : Fragment(R.layout.fragment_tab) { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + view.findViewById(R.id.tab_label).text = "Tab B" + } +} diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt index b87e7a3190c..d53f7e4687f 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt @@ -794,6 +794,18 @@ fun IntegrationsScreen() { } } } + item { + SentryTraced("open_detach_attach_tabs") { + OutlinedButton( + onClick = { + activity.startActivity(Intent(activity, DetachAttachTabsActivity::class.java)) + }, + modifier = Modifier, + ) { + Text("Open Detach/Attach Tabs", maxLines = 2, overflow = TextOverflow.Ellipsis) + } + } + } item { SentryTraced("open_permissions_activity") { OutlinedButton( diff --git a/sentry-samples/sentry-samples-android/src/main/res/layout/activity_detach_attach_tabs.xml b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_detach_attach_tabs.xml new file mode 100644 index 00000000000..b2dc323d185 --- /dev/null +++ b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_detach_attach_tabs.xml @@ -0,0 +1,32 @@ + + + + + +