Skip to content

ADFA-4397: Migrate crash and log reporting from Sentry to GlitchTip - #1490

Merged
Daniel-ADFA merged 3 commits into
stagefrom
ADFA-4397
Jul 13, 2026
Merged

ADFA-4397: Migrate crash and log reporting from Sentry to GlitchTip#1490
Daniel-ADFA merged 3 commits into
stagefrom
ADFA-4397

Conversation

@Daniel-ADFA

Copy link
Copy Markdown
Contributor

Point the Sentry Android SDK at GlitchTip instead of Sentry. The SDK, DSN format, and tooling stay the same; only the endpoint moves. The DSN comes from local.properties for local builds and from CI secrets for release builds, so nothing is hardcoded.

Point the Sentry Android SDK at GlitchTip instead of Sentry. The SDK,
DSN format, and tooling stay the same; only the endpoint moves. The DSN
comes from local.properties for local builds and from CI secrets for
release builds, so nothing is hardcoded.

- Forward the app's logback output to GlitchTip. WARN and above go to the
  Logs view; INFO and above ride along as breadcrumbs (breadcrumbs are free).
- Tag each event with the device as the user so crashes can be filtered
  per user.
- Drop Sentry features GlitchTip does not support: session replay and
  profiling (dependency plus manifest flags removed).
- Keep event volume inside the 100k plan: error logs no longer become
  issues (real crashes are still captured), and performance transactions
  are disabled. Logs bill at 0.1 and share the same event pool.
@Daniel-ADFA
Daniel-ADFA requested a review from a team July 7, 2026 21:39

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough
  • Migrated crash/log reporting endpoint from Sentry to GlitchTip by updating DSN wiring to a unified GLITCHTIP_DSN/glitchtipDsn value while keeping the existing Sentry (SDK) integration.

  • Centralized DSN configuration: glitchtipDsn is read from local.properties for local builds, with fallback to the GLITCHTIP_DSN environment variable for CI/release; debug and release builds now share this single source.

  • Updated Gradle dependency set for logging integration by replacing session replay/replay artifact (sentry-android-replay) with sentry-logback.

  • Adjusted Android manifest Sentry metadata: set io.sentry.traces.sample-rate to 0.0 and removed profiling/session-replay-related metadata while keeping io.sentry.send-default-pii=true and io.sentry.logs.enabled=true.

  • Updated Sentry initialization in DeviceProtectedApplicationLoader to remove the session replay quality override, configure Logback → Sentry forwarding (root logger appender with event/breadcrumb/level thresholds), and enrich Sentry with user context (ANDROID_ID + device manufacturer/model).

  • Updated CI workflows to pass GLITCHTIP_DSN (replacing SENTRY_DSN_DEBUG / related Sentry DSN env wiring).

  • Made initialization more resilient during direct-boot startup by wrapping Sentry and Logback setup in runCatching to avoid blocking app startup.

  • Risk/privacy: io.sentry.send-default-pii remains enabled and the app sets user context using device identifiers (ANDROID_ID, manufacturer, model), which may require privacy/compliance review.

  • Risk/observability: traces are disabled (sample-rate=0.0) and profiling/session replay features were removed/disabled, reducing incident diagnostics.

  • Risk/configuration: if GLITCHTIP_DSN (CI secrets) or glitchtipDsn (local properties) is missing/misconfigured, crash/log reporting to GlitchTip may fail.

Walkthrough

This PR replaces Sentry session replay with Logback-based logging, routes a shared GlitchTip DSN through build and workflow configuration, updates Sentry initialization with a Logback appender and device user data, and reduces Sentry manifest metadata.

Changes

Sentry Logback Migration

Layer / File(s) Summary
Dependency and version catalog updates
gradle/libs.versions.toml, app/build.gradle.kts
Replaces sentry-android-replay with sentry-logback in the version catalog and app dependencies.
DSN wiring
app/build.gradle.kts, .github/workflows/*
Introduces glitchtipDsn, updates both build types to use the shared manifest placeholder, and swaps workflow Sentry environment bindings to GLITCHTIP_DSN.
Sentry initialization and Logback appender wiring
app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt
Removes SentryReplayQuality, configures a SentryAppender on the root logger, and sets Sentry user data from Android device identifiers.
Manifest Sentry metadata reduction
app/src/main/AndroidManifest.xml
Sets io.sentry.traces.sample-rate to 0.0 and removes profiling and session replay metadata from the Android manifest.

Estimated code review effort: 4 (Complex) | ~40 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ApplicationLoader
  participant SentryAndroid
  participant Logback
  participant SentryAppender
  participant Sentry

  ApplicationLoader->>SentryAndroid: initialize Sentry options
  ApplicationLoader->>Logback: obtain root logger
  ApplicationLoader->>SentryAppender: configure logging thresholds
  ApplicationLoader->>Logback: attach SentryAppender
  ApplicationLoader->>Sentry: set device user data
Loading

Suggested reviewers: jatezzz

Poem

I hopped through logs with ear and grin,
New GlitchTip breadcrumbs tucked within.
No replay trails, just Logback light,
And Sentry purrs with user insight.
🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving crash and log reporting from Sentry to GlitchTip.
Description check ✅ Passed The description matches the changeset by explaining the GlitchTip migration, DSN sourcing, and preserved SDK/tooling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ADFA-4397

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/build.gradle.kts (1)

357-360: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stale comment references removed replay dependency.

The comment above still says "core + replay for quality configuration" but sentry.android.replay was removed and sentry.logback was added.

📝 Proposed fix
-	// Sentry Android SDK (core + replay for quality configuration)
+	// Sentry Android SDK (core + Logback appender for GlitchTip log/breadcrumb forwarding)
 	implementation(libs.sentry.core)
 	implementation(libs.sentry.android.core)
 	implementation(libs.sentry.logback)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/build.gradle.kts` around lines 357 - 360, The dependency block for the
Sentry Android SDK has a stale comment that still references replay even though
only core, android core, and logback are included now. Update the comment near
the Sentry dependency declarations to match the actual set of dependencies in
the build script, using the existing Sentry dependency entries as the reference
point.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt`:
- Around line 75-97: Wrap the Sentry and Logback initialization in
DeviceProtectedApplicationLoader.load() in a runCatching block so
startup-critical failures do not abort direct-boot setup. Keep the existing
SentryAndroid.init, LoggerContext/SentryAppender configuration, and
Sentry.setUser logic inside the guarded block, and make sure any exception is
swallowed or logged without preventing the later ShizukuSettings.initialize()
and EventBus setup from running.

---

Nitpick comments:
In `@app/build.gradle.kts`:
- Around line 357-360: The dependency block for the Sentry Android SDK has a
stale comment that still references replay even though only core, android core,
and logback are included now. Update the comment near the Sentry dependency
declarations to match the actual set of dependencies in the build script, using
the existing Sentry dependency entries as the reference point.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79fe817f-c893-4847-8028-6adf51828d4e

📥 Commits

Reviewing files that changed from the base of the PR and between db0137a and 6637313.

📒 Files selected for processing (4)
  • app/build.gradle.kts
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt
  • gradle/libs.versions.toml

Comment thread app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt Outdated
…init

- Read one glitchtipDsn / GLITCHTIP_DSN for both debug and release builds
  and drop the unused SENTRY_ORG, SENTRY_PROJECT, and SENTRY_AUTH_TOKEN.
- Wrap SentryAndroid.init, the logback appender setup, and Sentry.setUser
  in runCatching so a failure is logged and direct-boot startup still runs
  ShizukuSettings and the EventBus.
# Conflicts:
#	app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

28-28: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fail the release build when GLITCHTIP_DSN is missing.

app/build.gradle.kts converts a missing DSN into "", so this workflow can publish a release APK with crash/log reporting silently disabled. Add a non-empty check before assembling the APK.

Proposed validation
+      - name: Validate GlitchTip DSN
+        run: |
+          if [ -z "$GLITCHTIP_DSN" ]; then
+            echo "ERROR: GLITCHTIP_DSN secret is not set"
+            exit 1
+          fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 28, Update the release workflow to
validate that GLITCHTIP_DSN is present and non-empty before the APK assembly
step. Make the validation fail the job with a clear error when the secret is
missing, while preserving the existing GLITCHTIP_DSN environment wiring for the
build.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/release.yml:
- Line 28: Update the release workflow to validate that GLITCHTIP_DSN is present
and non-empty before the APK assembly step. Make the validation fail the job
with a clear error when the secret is missing, while preserving the existing
GLITCHTIP_DSN environment wiring for the build.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e9e667ed-63ae-4282-a8b7-a69272ac5aaf

📥 Commits

Reviewing files that changed from the base of the PR and between 25f35ad and 792adc2.

📒 Files selected for processing (6)
  • .github/workflows/debug.yml
  • .github/workflows/release.yml
  • app/build.gradle.kts
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/com/itsaky/androidide/app/DeviceProtectedApplicationLoader.kt
  • gradle/libs.versions.toml
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/src/main/AndroidManifest.xml
  • gradle/libs.versions.toml
  • .github/workflows/debug.yml
  • app/build.gradle.kts

@Daniel-ADFA
Daniel-ADFA merged commit b755cfd into stage Jul 13, 2026
4 checks passed
@Daniel-ADFA
Daniel-ADFA deleted the ADFA-4397 branch July 13, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants