Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .claude/skills/btrace-perfetto/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ If no arguments are provided, ask the user what they want to trace and which bra

## Step 2: Integrate btrace into Sample App

The sample app is at `sentry-samples/sentry-samples-android/`.
The sample app is at `sentry-android-integration-tests/sentry-samples-android/`.

### 2a: Add btrace dependency

In `sentry-samples/sentry-samples-android/build.gradle.kts`, add to the `dependencies` block:
In `sentry-android-integration-tests/sentry-samples-android/build.gradle.kts`, add to the `dependencies` block:

```kotlin
implementation("com.bytedance.btrace:rhea-inhouse:3.0.0")
Expand Down Expand Up @@ -98,7 +98,7 @@ protected void attachBaseContext(Context base) {

### 2d: Add ProGuard keep rules (release builds only)

Only needed when building release. In `sentry-samples/sentry-samples-android/proguard-rules.pro`, add:
Only needed when building release. In `sentry-android-integration-tests/sentry-samples-android/proguard-rules.pro`, add:

```
-keep class com.bytedance.rheatrace.** { *; }
Expand All @@ -112,13 +112,13 @@ The first rule prevents R8 from stripping btrace's HTTP server classes (fails wi
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
./gradlew -p sentry-android-integration-tests :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
./gradlew -p sentry-android-integration-tests :sentry-samples-android:installRelease
```

## Step 4: Capture Trace
Expand Down Expand Up @@ -170,9 +170,9 @@ 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
sentry-android-integration-tests/sentry-samples-android/build.gradle.kts \
sentry-android-integration-tests/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java \
sentry-android-integration-tests/sentry-samples-android/proguard-rules.pro
```
2. Checkout the other branch
3. Pop the stash: `git stash pop`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-macrobenchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Assemble target app and Macrobenchmark apk
if: env.SAUCE_USERNAME != null
run: ./gradlew -p sentry-samples/sentry-samples-android :assembleRelease :macrobenchmark:assembleBenchmark
run: ./gradlew -p sentry-android-integration-tests :sentry-samples-android:assembleRelease :sentry-uitest-android-macrobenchmark:assembleBenchmark

- name: Run Macrobenchmark in SauceLab
uses: saucelabs/saucectl-run-action@283660aa934c02723c497efa151d582a3acc5801 # pin@v3
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: sentry-samples-android
path: sentry-samples/sentry-samples-android
- name: sentry-android-integration-tests
path: sentry-android-integration-tests
- name: sentry-samples
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/spring-boot-2-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
paths-ignore:
- '*android*/**'
- 'sentry-compose/**'
- 'sentry-samples/sentry-samples-android/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/spring-boot-3-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
paths-ignore:
- '*android*/**'
- 'sentry-compose/**'
- 'sentry-samples/sentry-samples-android/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/spring-boot-4-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
paths-ignore:
- '*android*/**'
- 'sentry-compose/**'
- 'sentry-samples/sentry-samples-android/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .sauce/sentry-uitest-android-macrobenchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ defaults:
timeout: 40m

espresso:
app: ./sentry-samples/sentry-samples-android/build/outputs/apk/release/sentry-samples-android-release.apk
testApp: ./sentry-samples/sentry-samples-android/macrobenchmark/build/outputs/apk/benchmark/macrobenchmark-benchmark.apk
app: ./sentry-android-integration-tests/sentry-samples-android/build/outputs/apk/release/sentry-samples-android-release.apk
testApp: ./sentry-android-integration-tests/sentry-uitest-android-macrobenchmark/build/outputs/apk/benchmark/sentry-uitest-android-macrobenchmark-benchmark.apk

suites:

Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ resolves the per-module test task, including integration test suites, for you.
# Run critical UI tests
./scripts/test-ui-critical.sh

# Build the Android sample, a separate Gradle build that includes this one
./gradlew -p sentry-samples/sentry-samples-android assembleDebug
# Build the Android sample, in the same separate Gradle build as the UI tests
./gradlew -p sentry-android-integration-tests :sentry-samples-android:assembleDebug

# Build the JVM samples, another separate Gradle build that includes this one
./gradlew -p sentry-samples assemble
Expand Down Expand Up @@ -116,7 +116,7 @@ The repository is organized into multiple modules:

### Utility Modules
- **`sentry-test-support`** - Shared test utilities, including `MockSentryServer` and envelope matchers
- **`sentry-samples`** - Example applications, in two separate Gradle builds that include this one: `sentry-samples` (JVM) and `sentry-samples/sentry-samples-android`. Root tasks such as `check` and `spotlessApply` don't reach them, and `sentry-android-integration-tests` is a separate build too
- **`sentry-samples`** - Example applications, in two separate Gradle builds that include this one: `sentry-samples` (JVM) and `sentry-android-integration-tests` (the Android sample, next to the Android UI tests, benchmark and size test). Root tasks such as `check` and `spotlessApply` don't reach them
- **`sentry-bom`** - Bill of Materials for dependency management

### Key Architectural Patterns
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ update:
format:
./gradlew spotlessApply
./gradlew -p sentry-samples spotlessApply
./gradlew -p sentry-samples/sentry-samples-android spotlessApply
./gradlew -p sentry-android-integration-tests spotlessApply

# Spotless check's code
checkFormat:
./gradlew spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-samples spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-samples/sentry-samples-android spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-android-integration-tests spotlessJavaCheck spotlessKotlinCheck

# Binary compatibility validator
Expand Down
9 changes: 6 additions & 3 deletions sentry-android-integration-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Android performance-impact and integration tests
# Android sample, performance-impact and integration tests

This directory is a separate Gradle build that includes the SDK build, so run its tasks with
`./gradlew -p sentry-android-integration-tests <task>`. The SDK build doesn't include it, so
`./gradlew` from the repository root doesn't build, lint or format these apps.
`gradle.properties`, `gradlew`, `gradle/wrapper` and `gradle/gradle-daemon-jvm.properties` are
symlinks to the SDK build's, so both builds use the same Gradle, JDK and settings.

* [Espresso-based UI tests](./sentry-uitest-android) - run within SauceLabs (see /.sauce/*.yml)
* Also used for compatibility test matrix against new AGP versions
* [Sample app](./sentry-samples-android)
* [Macrobenchmark](./sentry-uitest-android-macrobenchmark) - cold start of the sample app, run locally or within SauceLabs (see /.sauce/*.yml)
* [Espresso-based UI tests](./sentry-uitest-android) - run on an emulator in the AGP matrix workflow
* [Maestro-based critical UI tests](./sentry-uitest-android-critical) - run by the UI Tests Critical workflow
* [App size test](./test-app-size) - built by the SDK Size Analysis workflow
2 changes: 2 additions & 0 deletions sentry-android-integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ plugins {
alias(libs.plugins.detekt) apply false
alias(libs.plugins.gradle.versions) apply false
alias(libs.plugins.sentry) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.sqldelight) apply false
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ profiling) and integrations (Compose, OkHttp, SQLite, etc.).
Install the app on your device or emulator:

```
./gradlew -p sentry-samples/sentry-samples-android installDebug
./gradlew -p sentry-android-integration-tests :sentry-samples-android:installDebug
```

or open the `sentry-samples/sentry-samples-android` directory in Android Studio and run the `sentry-samples-android` configuration.
or open the `sentry-android-integration-tests` directory in Android Studio and run the `sentry-samples-android` configuration.

The sample is a separate Gradle build that includes the SDK build, so changes to the SDK show up in the next build of the sample, with nothing to publish first.
The SDK build doesn't include the sample, so `./gradlew` from the repository root doesn't build, lint or format it.
`gradle.properties`, `gradlew`, `gradle/wrapper` and `gradle/gradle-daemon-jvm.properties` are symlinks to the SDK build's, so both builds use the same Gradle, JDK and settings.
The sample is part of [`sentry-android-integration-tests`](../README.md), a separate Gradle build that includes the SDK build, so changes to the SDK show up in the next build of the sample, with nothing to publish first.
The SDK build doesn't include it, so `./gradlew` from the repository root doesn't build, lint or format the sample.

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 -p sentry-samples/sentry-samples-android installDebug -PuseSagp
./gradlew -p sentry-android-integration-tests :sentry-samples-android:installDebug -PuseSagp
```

In Android Studio, add `useSagp=` (empty value) to `gradle.properties`, or pass `-PuseSagp` as a Gradle project property.
Expand Down Expand Up @@ -59,7 +58,7 @@ Re-run `publishToMavenLocal` after each SAGP change.
Then build from sentry-java:

```
./gradlew -p sentry-samples/sentry-samples-android installDebug -PuseSagp
./gradlew -p sentry-android-integration-tests :sentry-samples-android:installDebug -PuseSagp
```

## Viewing SDK output
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# macrobenchmark
# sentry-uitest-android-macrobenchmark

Jetpack Macrobenchmark for cold-start of `sentry-samples-android`, used to evaluate SDK-init
performance changes on a real device in a **stable, reproducible** way. Not run in CI.
Expand Down Expand Up @@ -28,7 +28,7 @@ unlocked-clock device after ~14 iterations, inflating the tail of longer runs.
Connect a device, then:

```bash
./gradlew -p sentry-samples/sentry-samples-android :macrobenchmark:connectedBenchmarkAndroidTest
./gradlew -p sentry-android-integration-tests :sentry-uitest-android-macrobenchmark:connectedBenchmarkAndroidTest
```

Results print to the console and are written to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
}
}

targetProjectPath = ":"
targetProjectPath = ":sentry-samples-android"
// Run the test in its own process so it measures the target app cold, not itself.
experimentalProperties["android.experimental.self-instrumenting"] = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ By default the envelopes sent to relay are caught by a mock server which allows

# How to use

Simply run `./gradlew -p sentry-android-integration-tests connectedCheck` to run all ui tests of all modules (requires a connected device, either physical or an emulator).
Simply run `./gradlew -p sentry-android-integration-tests :sentry-uitest-android:connectedCheck` to run all ui tests (requires a connected device, either physical or an emulator).

# CI
CI runs these tests on a GitHub Actions emulator in the AGP matrix workflow (`.github/workflows/agp-matrix.yml`).
Expand Down
2 changes: 2 additions & 0 deletions sentry-android-integration-tests/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ includeBuild("..")
// For the io.sentry.spotless and io.sentry.jdk-target convention plugins.
includeBuild("../build-logic")

include("sentry-samples-android")
include("sentry-uitest-android")
include("sentry-uitest-android-critical")
include("sentry-uitest-android-macrobenchmark")
include("test-app-size")
1 change: 0 additions & 1 deletion sentry-samples/sentry-samples-android/gradle.properties

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion sentry-samples/sentry-samples-android/gradle/wrapper

This file was deleted.

1 change: 0 additions & 1 deletion sentry-samples/sentry-samples-android/gradlew

This file was deleted.

64 changes: 0 additions & 64 deletions sentry-samples/sentry-samples-android/settings.gradle.kts

This file was deleted.

Loading