Skip to content

Commit e3ce940

Browse files
committed
Merge branch 'main' into feat/compose-user-feedback
# Conflicts: # CHANGELOG.md # sentry/src/test/java/io/sentry/SentryOptionsTest.kt
2 parents 1f32141 + 485c1a6 commit e3ce940

File tree

32 files changed

+1554
-114
lines changed

32 files changed

+1554
-114
lines changed

.cursor/rules/coding.mdc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
alwaysApply: true
3+
description: Cursor Coding Rules
4+
---
5+
6+
# Contributing Rules for Agents
7+
8+
## Overview
9+
10+
sentry-java is the Java and Android SDK for Sentry. This repository contains the source code and examples for SDK usage.
11+
12+
## Tech Stack
13+
14+
- **Language**: Java and Kotlin
15+
- **Build Framework**: Gradle
16+
17+
## Key Commands
18+
19+
```bash
20+
# Format code and regenerate .api files
21+
./gradlew spotlessApply apiDump
22+
23+
# Run all tests and linter
24+
./gradlew check
25+
26+
# Run unit tests for a specific file
27+
./gradle ':<module>:testDebugUnitTest' --tests="*<file name>*" --info
28+
```
29+
30+
## Contributing Guidelines
31+
32+
1. Follow existing code style and language
33+
2. Do not modify the API files (e.g. sentry.api) manually, instead run `./gradlew apiDump` to regenerate them
34+
3. Write comprehensive tests
35+
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
36+
5. Consider backwards compatibility
37+
38+
## Coding rules
39+
40+
1. First think through the problem, read the codebase for relevant files, and propose a plan
41+
2. Before you begin working, check in with me and I will verify the plan
42+
3. Then, begin working on the todo items, marking them as complete as you go
43+
4. Please do not describe every step of the way and just give me a high level explanation of what changes you made
44+
5. Make every task and code change you do as simple as possible. We want to avoid making any massive or complex changes. Every change should impact as little code as possible. Everything is about simplicity.
45+
6. Once you're done, format the code and regenerate the .api files using the following command `./gradlew spotlessApply apiDump`
46+
7. As a last step, git stage the relevant files and propose (but not execute) a single git commit command (e.g. `git commit -m "<git commit message>"`)
47+
48+
49+
## Useful Resources
50+
51+
- Main SDK documentation: https://develop.sentry.dev/sdk/overview/
52+
- Internal contributing guide: https://docs.sentry.io/internal/contributing/
53+
- Git commit messages conventions: https://develop.sentry.dev/engineering-practices/commit-messages/

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export VIRTUAL_ENV=".venv"
2+
layout python3

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

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,39 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
sample: [ "sentry-samples-spring-boot-jakarta" ]
24-
agent: [ "0" ]
24+
agent: [ "false" ]
2525
agent-auto-init: [ "true" ]
2626
include:
2727
- sample: "sentry-samples-spring-boot"
28+
agent: "false"
29+
agent-auto-init: "true"
2830
- sample: "sentry-samples-spring-boot-opentelemetry-noagent"
31+
agent: "false"
32+
agent-auto-init: "true"
2933
- sample: "sentry-samples-spring-boot-opentelemetry"
30-
agent: "1"
34+
agent: "true"
3135
agent-auto-init: "true"
3236
- sample: "sentry-samples-spring-boot-opentelemetry"
33-
agent: "1"
37+
agent: "true"
3438
agent-auto-init: "false"
3539
- sample: "sentry-samples-spring-boot-webflux-jakarta"
40+
agent: "false"
41+
agent-auto-init: "true"
3642
- sample: "sentry-samples-spring-boot-webflux"
43+
agent: "false"
44+
agent-auto-init: "true"
3745
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry-noagent"
46+
agent: "false"
47+
agent-auto-init: "true"
3848
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry"
39-
agent: "1"
49+
agent: "true"
4050
agent-auto-init: "true"
4151
- sample: "sentry-samples-spring-boot-jakarta-opentelemetry"
42-
agent: "1"
52+
agent: "true"
4353
agent-auto-init: "false"
54+
- sample: "sentry-samples-console"
55+
agent: "false"
56+
agent-auto-init: "true"
4457
steps:
4558
- uses: actions/checkout@v4
4659
with:
@@ -50,6 +63,11 @@ jobs:
5063
with:
5164
python-version: '3.10.5'
5265

66+
- name: Install Python dependencies
67+
run: |
68+
python3 -m pip install --upgrade pip
69+
python3 -m pip install -r requirements.txt
70+
5371
- name: Set up Java
5472
uses: actions/setup-java@v4
5573
with:
@@ -90,17 +108,9 @@ jobs:
90108
-e '/.*"sentry-samples-android",/d' \
91109
build.gradle.kts
92110
93-
- name: Build server jar
94-
run: |
95-
./gradlew :sentry-samples:${{ matrix.sample }}:bootJar
96-
97-
- name: Build agent jar
98-
run: |
99-
./gradlew :sentry-opentelemetry:sentry-opentelemetry-agent:assemble
100-
101-
- name: Start server and run integration test for sentry-cli commands
111+
- name: Build and run system tests
102112
run: |
103-
test/system-test-run.sh "${{ matrix.sample }}" "${{ matrix.agent }}" "${{ matrix.agent-auto-init }}" "0"
113+
python3 test/system-test-runner.py test --module "${{ matrix.sample }}" --agent "${{ matrix.agent }}" --auto-init "${{ matrix.agent-auto-init }}" --build "true"
104114
105115
- name: Upload test results
106116
if: always()

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ distributions/
2020
*.vscode/
2121
sentry-spring-boot-starter-jakarta/src/main/resources/META-INF/spring.factories
2222
sentry-samples/sentry-samples-spring-boot-jakarta/spy.log
23+
sentry-mock-server.txt
24+
spring-server.txt
2325
spy.log
2426
.kotlin

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
- Add `SentryUserFeedbackButton` Composable ([#4559](https://github.com/getsentry/sentry-java/pull/4559))
88
- Also added `Sentry.showUserFeedbackDialog` static method
9+
- Add deadlineTimeout option ([#4555](https://github.com/getsentry/sentry-java/pull/4555))
910

1011
### Fixes
1112

1213
- Allow multiple UncaughtExceptionHandlerIntegrations to be active at the same time ([#4462](https://github.com/getsentry/sentry-java/pull/4462))
14+
- Prevent repeated scroll target determination during a single scroll gesture ([#4557](https://github.com/getsentry/sentry-java/pull/4557))
15+
- This should reduce the number of ANRs seen in `SentryGestureListener`
1316

1417
## 8.17.0
1518

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleUiTestRelease assembleUiTestCriticalRelease createCoverageReports runUiTestCritical check preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleUiTestRelease assembleUiTestCriticalRelease createCoverageReports runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish
22

33
all: stop clean javadocs compile createCoverageReports
44
assembleBenchmarks: assembleBenchmarkTestRelease
@@ -10,6 +10,7 @@ publish: clean dryRelease
1010
clean:
1111
./gradlew clean --no-configuration-cache
1212
rm -rf distributions
13+
rm -rf .venv
1314

1415
# build and run tests
1516
compile:
@@ -59,6 +60,20 @@ createCoverageReports:
5960
./gradlew jacocoTestReport
6061
./gradlew koverXmlReportRelease
6162

63+
# Create the Python virtual environment for system tests, and install the necessary dependencies
64+
setupPython:
65+
@test -d .venv || python3 -m venv .venv
66+
.venv/bin/pip install --upgrade pip
67+
.venv/bin/pip install -r requirements.txt
68+
69+
# Run system tests for sample applications
70+
systemTest: setupPython
71+
.venv/bin/python test/system-test-runner.py test --all
72+
73+
# Run system tests with interactive module selection
74+
systemTestInteractive: setupPython
75+
.venv/bin/python test/system-test-runner.py test --interactive
76+
6277
# Run tests and lint
6378
check:
6479
./gradlew check

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
certifi==2025.7.14
2+
charset-normalizer==3.4.2
3+
idna==3.10
4+
requests==2.32.4
5+
urllib3==2.5.0

sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ private void startTracing(final @NotNull Activity activity) {
189189
}
190190

191191
final TransactionOptions transactionOptions = new TransactionOptions();
192+
193+
// Set deadline timeout based on configured option
194+
final long deadlineTimeoutMillis = options.getDeadlineTimeout();
195+
// No deadline when zero or negative value is set
192196
transactionOptions.setDeadlineTimeout(
193-
TransactionOptions.DEFAULT_DEADLINE_TIMEOUT_AUTO_TRANSACTION);
197+
deadlineTimeoutMillis <= 0 ? null : deadlineTimeoutMillis);
194198

195199
if (options.isEnableActivityLifecycleTracingAutoFinish()) {
196200
transactionOptions.setIdleTimeout(options.getIdleTimeout());

sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ final class ManifestMetadataReader {
127127
static final String ENABLE_AUTO_TRACE_ID_GENERATION =
128128
"io.sentry.traces.enable-auto-id-generation";
129129

130+
static final String DEADLINE_TIMEOUT = "io.sentry.traces.deadline-timeout";
131+
130132
static final String FEEDBACK_NAME_REQUIRED = "io.sentry.feedback.is-name-required";
131133

132134
static final String FEEDBACK_SHOW_NAME = "io.sentry.feedback.show-name";
@@ -446,6 +448,9 @@ static void applyMetadata(
446448
ENABLE_AUTO_TRACE_ID_GENERATION,
447449
options.isEnableAutoTraceIdGeneration()));
448450

451+
options.setDeadlineTimeout(
452+
readLong(metadata, logger, DEADLINE_TIMEOUT, options.getDeadlineTimeout()));
453+
449454
if (options.getSessionReplay().getSessionSampleRate() == null) {
450455
final double sessionSampleRate =
451456
readDouble(metadata, logger, REPLAYS_SESSION_SAMPLE_RATE);

sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public boolean onScroll(
139139
options
140140
.getLogger()
141141
.log(SentryLevel.DEBUG, "Unable to find scroll target. No breadcrumb captured.");
142+
scrollState.type = GestureType.Scroll;
142143
return false;
143144
} else {
144145
options
@@ -249,8 +250,13 @@ private void startTracing(final @NotNull UiElement target, final @NotNull Gestur
249250

250251
final TransactionOptions transactionOptions = new TransactionOptions();
251252
transactionOptions.setWaitForChildren(true);
253+
254+
// Set deadline timeout based on configured option
255+
final long deadlineTimeoutMillis = options.getDeadlineTimeout();
256+
// No deadline when zero or negative value is set
252257
transactionOptions.setDeadlineTimeout(
253-
TransactionOptions.DEFAULT_DEADLINE_TIMEOUT_AUTO_TRANSACTION);
258+
deadlineTimeoutMillis <= 0 ? null : deadlineTimeoutMillis);
259+
254260
transactionOptions.setIdleTimeout(options.getIdleTimeout());
255261
transactionOptions.setTrimEnd(true);
256262
transactionOptions.setOrigin(TRACE_ORIGIN + "." + target.getOrigin());

0 commit comments

Comments
 (0)