File tree Expand file tree Collapse file tree
src/main/java/io/sentry/sqlite Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ ### Features
6+
7+ - Add experimental `SentrySQLiteDriver` to `sentry-android-sqlite` for instrumenting `androidx.sqlite.SQLiteDriver` ([#5563](https://github.com/getsentry/sentry-java/pull/5563))
8+ - To use it, pass `SQLiteDriver` to `SentrySQLiteDriver.create(...)`
9+ - Requires `androidx.sqlite:sqlite` (2.5.0+) on runtime classpath (typically provided by Room or SQLDelight)
10+
311## 8.44.0
412
513### Features
Original file line number Diff line number Diff line change @@ -21,3 +21,15 @@ public final class io/sentry/android/sqlite/SentrySupportSQLiteOpenHelper$Compan
2121 public final fun create (Landroidx/sqlite/db/SupportSQLiteOpenHelper;)Landroidx/sqlite/db/SupportSQLiteOpenHelper;
2222}
2323
24+ public final class io/sentry/sqlite/SentrySQLiteDriver : androidx/sqlite/SQLiteDriver {
25+ public static final field Companion Lio/sentry/sqlite/SentrySQLiteDriver$Companion;
26+ public synthetic fun <init> (Landroidx/sqlite/SQLiteDriver;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
27+ public static final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver;
28+ public fun hasConnectionPool ()Z
29+ public fun open (Ljava/lang/String;)Landroidx/sqlite/SQLiteConnection;
30+ }
31+
32+ public final class io/sentry/sqlite/SentrySQLiteDriver$Companion {
33+ public final fun create (Landroidx/sqlite/SQLiteDriver;)Landroidx/sqlite/SQLiteDriver;
34+ }
35+
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ android {
4747
4848 buildFeatures { buildConfig = true }
4949
50+ // Needed b/c Kotlin 1.4.x would otherwise pull in an older version without the annotations we
51+ // want.
52+ configurations.all { resolutionStrategy.force(libs.jetbrains.annotations.get()) }
53+
5054 androidComponents.beforeVariants {
5155 it.enable = ! Config .Android .shouldSkipDebugVariant(it.buildType)
5256 }
@@ -65,6 +69,7 @@ dependencies {
6569 api(projects.sentry)
6670
6771 compileOnly(libs.androidx.sqlite)
72+ compileOnly(libs.jetbrains.annotations)
6873
6974 implementation(kotlin(Config .kotlinStdLib, Config .kotlinStdLibVersionAndroid))
7075
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import androidx.sqlite.SQLiteDriver
55import io.sentry.ScopesAdapter
66import io.sentry.SentryIntegrationPackageStorage
77import io.sentry.SentryLevel
8+ import org.jetbrains.annotations.ApiStatus
89
910/* *
1011 * Wraps a [SQLiteDriver] and automatically adds spans for each SQL statement it executes.
@@ -28,13 +29,16 @@ import io.sentry.SentryLevel
2829 *
2930 * @param delegate The [SQLiteDriver] instance to delegate calls to.
3031 */
31- internal class SentrySQLiteDriver private constructor(private val delegate : SQLiteDriver ) :
32+ @ApiStatus.Experimental
33+ public class SentrySQLiteDriver private constructor(private val delegate : SQLiteDriver ) :
3234 SQLiteDriver {
3335
3436 init {
3537 SentryIntegrationPackageStorage .getInstance().addIntegration(" SQLiteDriver" )
3638 }
3739
40+ @Suppress(" INAPPLICABLE_JVM_NAME" )
41+ @get:JvmName(" hasConnectionPool" )
3842 override val hasConnectionPool: Boolean
3943 get() =
4044 try {
@@ -66,14 +70,14 @@ internal class SentrySQLiteDriver private constructor(private val delegate: SQLi
6670 }
6771 }
6872
69- companion object {
73+ public companion object {
7074
7175 /* *
7276 * Wraps the provided delegate in a [SentrySQLiteDriver]. Returns the delegate as-is if already
7377 * wrapped.
7478 */
7579 @JvmStatic
76- fun create (delegate : SQLiteDriver ): SQLiteDriver =
80+ public fun create (delegate : SQLiteDriver ): SQLiteDriver =
7781 delegate as ? SentrySQLiteDriver ? : SentrySQLiteDriver (delegate)
7882 }
7983}
You can’t perform that action at this time.
0 commit comments