Skip to content

feat(android-sqlite): Add SentrySQLiteDriver (JAVA-275)#5466

Draft
0xadam-brown wants to merge 2 commits into
mainfrom
feat/support-sqlite-driver
Draft

feat(android-sqlite): Add SentrySQLiteDriver (JAVA-275)#5466
0xadam-brown wants to merge 2 commits into
mainfrom
feat/support-sqlite-driver

Conversation

@0xadam-brown
Copy link
Copy Markdown
Member

📜 Description

Adds SentrySQLiteDriver, a new instrumentation path for Room 2.7+ apps that have migrated to the androidx.sqlite.SQLiteDriver API.

  • Wraps SQLiteDriver.open() to produce a SentrySQLiteConnection
  • Wraps SQLiteConnection.prepare() to produce a SentrySQLiteStatement
  • Wraps SQLiteStatement.step() to create a Sentry span for each executed statement
  • Sets db.name to the basename of the path passed to SQLiteDriver.open() (e.g., myapp.db from /data/.../databases/myapp.db)
  • Adds LegacyInstrumentedSQLiteStatement to handle the SupportSQLiteDriver adapter path without duplicate wrapping

New classes live in io.sentry.sqlite (not io.sentry.android.sqlite) so they depend only on the multiplatform androidx.sqlite.* interfaces, keeping the door open for future KMP support.

💡 Motivation and Context

Room 2.7 introduced the SQLiteDriver API as a replacement for SupportSQLiteOpenHelper. Users upgrading to Room 2.7+ needed a way to instrument the new API surface without losing span coverage — and without producing duplicate spans if they're running both paths during a staged migration.

Fixes JAVA-275.

💚 How did you test it?

Unit tests cover:

  • SentrySQLiteDriver delegation and wrapping
  • SentrySQLiteConnection delegation and wrapping
  • SentrySQLiteStatement span creation, cancellation, and success/error tagging
  • SQLiteSpanRecorder span lifecycle (start/finish/cancel)
  • LegacyInstrumentedSQLiteStatement no-op passthrough

📝 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.

🔮 Next steps

Introduces support for AndroidX's SQLiteDriver via a new SentrySQLiteDriver wrapper.

SentrySQLiteDriver automatically creates Sentry spans for each SQL statement. It's
the Driver API / KMP-compatible equivalent of SentrySupportSQLiteOpenHelper.

---

Co-authored-by: Angus Holder <7407345+angusholder@users.noreply.github.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 22, 2026

JAVA-275

@github-actions
Copy link
Copy Markdown
Contributor

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against e646444

@sentry
Copy link
Copy Markdown

sentry Bot commented May 22, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.42.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions
Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 303.45 ms 392.65 ms 89.20 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
91bb874 310.68 ms 359.24 ms 48.56 ms
ad8da22 314.38 ms 352.29 ms 37.91 ms
27d7cf8 306.76 ms 366.66 ms 59.90 ms
092f017 353.13 ms 433.84 ms 80.71 ms
b750b96 421.25 ms 444.09 ms 22.84 ms
a1eadfa 345.67 ms 411.26 ms 65.59 ms
5f14e5d 325.76 ms 368.32 ms 42.56 ms
22f4345 325.23 ms 454.66 ms 129.43 ms
9054d65 330.94 ms 403.24 ms 72.30 ms
cf708bd 408.35 ms 458.98 ms 50.63 ms

App size

Revision Plain With Sentry Diff
91bb874 1.58 MiB 2.13 MiB 559.07 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
27d7cf8 1.58 MiB 2.12 MiB 549.42 KiB
092f017 0 B 0 B 0 B
b750b96 1.58 MiB 2.10 MiB 533.20 KiB
a1eadfa 0 B 0 B 0 B
5f14e5d 1.58 MiB 2.19 MiB 620.00 KiB
22f4345 1.58 MiB 2.29 MiB 719.83 KiB
9054d65 1.58 MiB 2.29 MiB 723.38 KiB
cf708bd 1.58 MiB 2.11 MiB 539.71 KiB

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.

1 participant