Skip to content

Commit 25e71db

Browse files
authored
Merge branch 'main' into feat/strict-trace-continuation
2 parents 1d8e301 + 8c1fb22 commit 25e71db

128 files changed

Lines changed: 6202 additions & 109 deletions

File tree

Some content is hidden

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

.agents/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.claude/skills

.claude/skills/test/SKILL.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: test
3+
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.
4+
allowed-tools: Bash, Read, Glob, AskUserQuestion
5+
argument-hint: [interactive] <module-name-or-file-path> [test-class-filter]
6+
---
7+
8+
# Run Tests
9+
10+
Run tests for a specific module. Auto-detects whether to run unit tests or system tests.
11+
12+
## Step 0: Check for Interactive Mode
13+
14+
If `$ARGUMENTS` starts with `interactive` (e.g., `/test interactive sentry ScopesTest`), enable interactive mode. Strip the `interactive` keyword from the arguments before proceeding.
15+
16+
In interactive mode, use AskUserQuestion at decision points as described in the steps below.
17+
18+
## Step 1: Parse the Argument
19+
20+
The argument can be either:
21+
- A **file path** (e.g., `@sentry/src/test/java/io/sentry/ScopesTest.kt`)
22+
- A **module name** (e.g., `sentry-android-core`, `sentry-samples-spring-boot-4`)
23+
- A **module name + test filter** (e.g., `sentry ScopesTest`)
24+
25+
Extract the module name and optional test class filter from the argument.
26+
27+
**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.
28+
29+
## Step 2: Detect Test Type
30+
31+
| Signal | Test Type |
32+
|--------|-----------|
33+
| Path contains `sentry-samples/` | System test |
34+
| Module name starts with `sentry-samples-` | System test |
35+
| Everything else | Unit test |
36+
37+
## Step 3a: Run Unit Tests
38+
39+
Determine the Gradle test task:
40+
41+
| Module Pattern | Test Task |
42+
|---------------|-----------|
43+
| `sentry-android-*` | `testDebugUnitTest` |
44+
| `sentry-compose*` | `testDebugUnitTest` |
45+
| `*-android` | `testDebugUnitTest` |
46+
| Everything else | `test` |
47+
48+
**Interactive mode:** Before running, read the test class file and use AskUserQuestion to ask:
49+
- "Run all tests in this class, or a specific method?" — list the test method names as options.
50+
51+
If the user picks a specific method, use `--tests="*ClassName.methodName"` as the filter.
52+
53+
With a test class filter:
54+
```bash
55+
./gradlew ':<module>:<task>' --tests="*<filter>*" --info
56+
```
57+
58+
Without a filter:
59+
```bash
60+
./gradlew ':<module>:<task>' --info
61+
```
62+
63+
## Step 3b: Run System Tests
64+
65+
System tests require the Python-based test runner which manages a mock Sentry server and sample app lifecycle.
66+
67+
1. Ensure the Python venv exists:
68+
```bash
69+
test -d .venv || make setupPython
70+
```
71+
72+
2. Extract the sample module name. For file paths like `sentry-samples/<sample-module>/src/...`, the sample module is the directory name (e.g., `sentry-samples-spring`).
73+
74+
3. Run the system test:
75+
```bash
76+
.venv/bin/python test/system-test-runner.py test --module <sample-module>
77+
```
78+
79+
This starts the mock Sentry server, starts the sample app (Spring Boot/Tomcat/CLI), runs tests via `./gradlew :sentry-samples:<sample-module>:systemTest`, and cleans up afterwards.
80+
81+
## Step 4: Report Results
82+
83+
Summarize the test outcome:
84+
- Total tests run, passed, failed, skipped
85+
- For failures: show the failing test name and the assertion/error message

.github/workflows/spring-boot-4-matrix.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,13 @@ jobs:
132132
--auto-init "false" \
133133
--build "true"
134134
135-
# needs a fix in opentelemetry-spring-boot-starter
136-
# - name: Run sentry-samples-spring-boot-4-opentelemetry-noagent
137-
# run: |
138-
# python3 test/system-test-runner.py test \
139-
# --module "sentry-samples-spring-boot-4-opentelemetry-noagent" \
140-
# --agent false \
141-
# --auto-init "true" \
142-
# --build "true"
135+
- name: Run sentry-samples-spring-boot-4-opentelemetry-noagent
136+
run: |
137+
python3 test/system-test-runner.py test \
138+
--module "sentry-samples-spring-boot-4-opentelemetry-noagent" \
139+
--agent false \
140+
--auto-init "true" \
141+
--build "true"
143142
144143
- name: Run sentry-samples-spring-7
145144
run: |

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ jobs:
7272
- sample: "sentry-samples-spring-boot-4-webflux"
7373
agent: "false"
7474
agent-auto-init: "true"
75-
# - sample: "sentry-samples-spring-boot-4-opentelemetry-noagent"
76-
# agent: "false"
77-
# agent-auto-init: "true"
75+
- sample: "sentry-samples-spring-boot-4-opentelemetry-noagent"
76+
agent: "false"
77+
agent-auto-init: "true"
7878
- sample: "sentry-samples-spring-boot-4-opentelemetry"
7979
agent: "true"
8080
agent-auto-init: "true"

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local.properties
1313
**/sentry-native-local
1414
target/
1515
.classpath
16+
.factorypath
1617
.project
1718
.settings/
1819
bin/
@@ -30,5 +31,6 @@ spy.log
3031
**/tomcat.8080/webapps/
3132
**/__pycache__
3233

33-
# Local Claude Code settings that should not be committed
34+
# Local Claude Code settings/state that should not be committed
3435
.claude/settings.local.json
36+
.claude/worktrees/

CHANGELOG.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,48 @@
88
- 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.
99
- 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`).
1010
- 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`).
11+
12+
## 8.37.0
13+
14+
### Fixes
15+
16+
- Session Replay: Fix Compose text masking mismatch with weighted text ([#5218](https://github.com/getsentry/sentry-java/pull/5218))
17+
18+
### Features
19+
20+
- Add cache tracing instrumentation for Spring Boot 2, 3, and 4 ([#5165](https://github.com/getsentry/sentry-java/pull/5165))
21+
- Wraps Spring `CacheManager` and `Cache` beans to produce cache spans
22+
- Set `sentry.enable-cache-tracing` to `true` to enable this feature
23+
- Add JCache (JSR-107) cache tracing via new `sentry-jcache` module ([#5165](https://github.com/getsentry/sentry-java/pull/5165))
24+
- Wraps JCache `Cache` with `SentryJCacheWrapper` to produce cache spans
25+
- Set the `enableCacheTracing` option to `true` to enable this feature
26+
- 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))
1127
- Android: Add `beforeErrorSampling` callback to Session Replay ([#5214](https://github.com/getsentry/sentry-java/pull/5214))
1228
- Allows filtering which errors trigger replay capture before the `onErrorSampleRate` is checked
1329
- Returning `false` skips replay capture entirely for that error; returning `true` proceeds with the normal sample rate check
1430
- Example usage:
15-
```java
31+
```kotlin
1632
SentryAndroid.init(context) { options ->
1733
options.sessionReplay.beforeErrorSampling =
1834
SentryReplayOptions.BeforeErrorSamplingCallback { event, hint ->
19-
// Skip replay for handled exceptions
20-
val hasUnhandled = event.exceptions?.any { it.mechanism?.isHandled == false } == true
21-
hasUnhandled
35+
// Only capture replay for crashes (excluding e.g. handled exceptions)
36+
event.isCrashed
2237
}
2338
}
2439
```
2540

41+
### Dependencies
42+
43+
- Bump Native SDK from v0.13.2 to v0.13.3 ([#5215](https://github.com/getsentry/sentry-java/pull/5215))
44+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0133)
45+
- [diff](https://github.com/getsentry/sentry-native/compare/0.13.2...0.13.3)
46+
- Bump OpenTelemetry ([#5225](https://github.com/getsentry/sentry-java/pull/5225))
47+
- `opentelemetry` to `1.60.1` (was `1.57.0`)
48+
- `opentelemetry-instrumentation` to `2.26.0` (was `2.23.0`)
49+
- `opentelemetry-instrumentation-alpha` to `2.26.0-alpha` (was `2.23.0-alpha`)
50+
- `opentelemetry-semconv` to `1.40.0` (was `1.37.0`)
51+
- `opentelemetry-semconv-alpha` to `1.40.0-alpha` (was `1.37.0-alpha`)
52+
2653
## 8.36.0
2754

2855
### Features

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Sentry SDK for Java and Android
5757
| sentry-graphql | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-graphql?style=for-the-badge&logo=sentry&color=green) |
5858
| 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) |
5959
| 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) |
60+
| sentry-jcache | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-jcache?style=for-the-badge&logo=sentry&color=green) |
6061
| sentry-quartz | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-quartz?style=for-the-badge&logo=sentry&color=green) |
6162
| sentry-openfeign | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeign?style=for-the-badge&logo=sentry&color=green) |
6263
| sentry-openfeature | ![Maven Central Version](https://img.shields.io/maven-central/v/io.sentry/sentry-openfeature?style=for-the-badge&logo=sentry&color=green) |

buildSrc/src/main/java/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ object Config {
7777
val SENTRY_GRAPHQL_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql"
7878
val SENTRY_GRAPHQL_CORE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql-core"
7979
val SENTRY_GRAPHQL22_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.graphql22"
80+
val SENTRY_JCACHE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jcache"
8081
val SENTRY_QUARTZ_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.quartz"
8182
val SENTRY_JDBC_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.jdbc"
8283
val SENTRY_OPENFEATURE_SDK_NAME = "$SENTRY_JAVA_SDK_NAME.openfeature"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ android.useAndroidX=true
1212
android.experimental.lint.version=8.9.0
1313

1414
# Release information
15-
versionName=8.36.0
15+
versionName=8.37.0
1616

1717
# Override the SDK name on native crashes on Android
1818
sentryAndroidSdkName=sentry.native.android

gradle/libs.versions.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ nopen = "1.0.1"
2222
# see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility
2323
# see https://developer.android.com/jetpack/androidx/releases/compose-kotlin
2424
okhttp = "4.9.2"
25-
otel = "1.57.0"
26-
otelInstrumentation = "2.23.0"
27-
otelInstrumentationAlpha = "2.23.0-alpha"
25+
otel = "1.60.1"
26+
otelInstrumentation = "2.26.0"
27+
otelInstrumentationAlpha = "2.26.0-alpha"
2828
# 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
29-
otelSemanticConventions = "1.37.0"
30-
otelSemanticConventionsAlpha = "1.37.0-alpha"
29+
otelSemanticConventions = "1.40.0"
30+
otelSemanticConventionsAlpha = "1.40.0-alpha"
3131
retrofit = "2.9.0"
3232
slf4j = "1.7.30"
3333
springboot2 = "2.7.18"
@@ -99,6 +99,8 @@ androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version
9999
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
100100
async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" }
101101
async-profiler-jfr-converter = { module = "tools.profiler:jfr-converter", version.ref = "asyncProfiler" }
102+
caffeine = { module = "com.github.ben-manes.caffeine:caffeine" }
103+
caffeine-jcache = { module = "com.github.ben-manes.caffeine:jcache", version = "3.2.0" }
102104
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" }
103105
commons-compress = {module = "org.apache.commons:commons-compress", version = "1.25.0"}
104106
context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" }
@@ -144,6 +146,7 @@ otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", vers
144146
otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" }
145147
p6spy = { module = "p6spy:p6spy", version = "3.9.1" }
146148
epitaph = { module = "com.abovevacant:epitaph", version = "0.1.1" }
149+
jcache = { module = "javax.cache:cache-api", version = "1.1.1" }
147150
quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" }
148151
reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" }
149152
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
@@ -166,6 +169,7 @@ springboot-starter-aop = { module = "org.springframework.boot:spring-boot-starte
166169
springboot-starter-security = { module = "org.springframework.boot:spring-boot-starter-security", version.ref = "springboot2" }
167170
springboot-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot2" }
168171
springboot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot2" }
172+
springboot-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot2" }
169173
springboot3-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" }
170174
springboot3-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot3" }
171175
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
178182
springboot3-starter-security = { module = "org.springframework.boot:spring-boot-starter-security", version.ref = "springboot3" }
179183
springboot3-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot3" }
180184
springboot3-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot3" }
185+
springboot3-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot3" }
181186
springboot4-otel = { module = "io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter", version.ref = "otelInstrumentation" }
182187
springboot4-resttestclient = { module = "org.springframework.boot:spring-boot-resttestclient", version.ref = "springboot4" }
183188
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
193198
springboot4-starter-webclient = { module = "org.springframework.boot:spring-boot-starter-webclient", version.ref = "springboot4" }
194199
springboot4-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc", version.ref = "springboot4" }
195200
springboot4-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "springboot4" }
201+
springboot4-starter-cache = { module = "org.springframework.boot:spring-boot-starter-cache", version.ref = "springboot4" }
196202
timber = { module = "com.jakewharton.timber:timber", version = "4.7.1" }
197203

198204
# Animalsniffer signature

0 commit comments

Comments
 (0)