Skip to content

Commit d735888

Browse files
authored
chore(android-sqlite): Update SQLite instrumentation documentation after 8.45.0 release (#5572)
We'll be coordinating the 8.45.0 release with SAGP auto-instrumentation for the SentrySQLiteDriver. Commit contains related documentation updates.
1 parent 6424f21 commit d735888

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

sentry-android-sqlite/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ SQLite instrumentation for AndroidX APIs.
44

55
Two instrumentation paths are supported:
66

7-
- **`androidx.sqlite.SQLiteDriver`**: Used by Room 2.7+ and 3.0+.
7+
- **`androidx.sqlite.SQLiteDriver`**: Used by Room 2.7+ and 3.0+. Applied automatically by the Sentry Android Gradle Plugin.
88
- **`androidx.sqlite.db.SupportSQLiteOpenHelper`**: Used by SQLDelight and legacy (pre-2.7) Room. Applied automatically by the Sentry Android Gradle Plugin.
99

1010
To avoid duplicate spans, only one path should be used per database file. Most Room and SQLDelight APIs enforce that division. The exception is Room's `SupportSQLiteDriver`: either the `SupportSQLiteOpenHelper` it consumes should be wrapped or the support driver itself, but never both.
1111

12+
See the [SQLite integration docs](https://docs.sentry.io/platforms/android/integrations/room-and-sqlite/) for more details.
13+
1214
## Package layout
1315

1416
The module is organized as two separate packages:

sentry-android-sqlite/src/main/java/io/sentry/sqlite/SentrySQLiteDriver.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import org.jetbrains.annotations.ApiStatus
2222
* .build()
2323
* ```
2424
*
25+
* If you're using the Sentry Android Gradle Plugin (SAGP) 6.13.0+, wrapping will be performed
26+
* automatically.
27+
*
2528
* @param delegate The [SQLiteDriver] instance to delegate calls to.
2629
*/
2730
@ApiStatus.Experimental
@@ -87,9 +90,16 @@ public class SentrySQLiteDriver private constructor(private val delegate: SQLite
8790
*
8891
* In the case of (2), wrap the open helper passed to the `SupportSQLiteDriver` constructor via
8992
* `SentrySupportSQLiteOpenHelper` instead.
93+
*
94+
* Note that wrapping will be performed if the delegate isn't a `SupportSQLiteDriver` itself but
95+
* wraps or subclasses one. In that case, ensure the open helper passed to the support driver
96+
* constructor is *not* wrapped.
9097
*/
98+
// Warning! The SAGP depends on this method's ABI.
9199
@JvmStatic
92100
public fun create(delegate: SQLiteDriver): SQLiteDriver =
101+
// FQN check simplifies our SAGP implementation, allowing it to naively instrument all
102+
// RoomDatabase.Builder.setDriver() call sites.
93103
if (delegate is SentrySQLiteDriver || delegate.javaClass.name == SUPPORT_SQLITE_DRIVER_FQN) {
94104
delegate
95105
} else {

0 commit comments

Comments
 (0)