To include the Datadog integration for SQLDelight in your project, simply add the
following to your application's build.gradle
file.
dependencies {
implementation "com.datadoghq:dd-sdk-android-rum:<latest-version>"
implementation "com.datadoghq:dd-sdk-android-trace:<latest-version>"
implementation "com.datadoghq:dd-sdk-android-sqldelight:<latest-version>"
}
- Setup RUM monitoring, see the dedicated Datadog Android RUM Collection documentation to learn how.
- Setup Trace monitoring, see the dedicated Datadog Android Trace Collection documentation to learn how.
- Following SQLDelight's Generated API documentation, you just have to provide the
DatadogSqliteCallback
in theAndroidSqliteDriver
constructor.
Doing this detects whenever a database is corrupted and sends a relevant RUM error event for it.
val database = YourDatabase(
AndroidSqliteDriver(
YourDatabase.Schema,
context,
callback = DatadogSqliteCallback(YourDatabase.Schema)
))
If you are using SQLDelight transactions, you can trace the transaction block using the following 2 methods:
database.yourQuery.transactionTraced("<SPAN_NAME>", noEnclosing) {
// …
}
val result = database.yourQuery.transactionTracedWithResult("<SPAN_NAME>", noEnclosing) {
// …
}
They behave as the default methods (transaction(noEnclosing,block)
, transactionWithResult(noEnclosing,block)
) and they simply require a span name as an
extra argument.
Pull requests are welcome, but please open an issue first to discuss what you would like to change. For more information, read the Contributing Guide.