Enable Sentry in the SDK: add SDK Sentry DSN value
This is provided to the SDK in `PlatformInitializer`.
This commit is contained in:
parent
fbaedd017e
commit
53ab38d990
6 changed files with 16 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ import io.element.android.features.rageshake.api.logs.createWriteToFilesConfigur
|
||||||
import io.element.android.libraries.architecture.bindings
|
import io.element.android.libraries.architecture.bindings
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||||
import io.element.android.libraries.matrix.api.tracing.TracingConfiguration
|
import io.element.android.libraries.matrix.api.tracing.TracingConfiguration
|
||||||
|
import io.element.android.services.analyticsproviders.sentry.SentryConfig
|
||||||
import io.element.android.x.di.AppBindings
|
import io.element.android.x.di.AppBindings
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
|
@ -38,6 +39,7 @@ class PlatformInitializer : Initializer<Unit> {
|
||||||
logLevel = logLevel,
|
logLevel = logLevel,
|
||||||
extraTargets = listOf(ELEMENT_X_TARGET),
|
extraTargets = listOf(ELEMENT_X_TARGET),
|
||||||
traceLogPacks = runBlocking { preferencesStore.getTracingLogPacksFlow().first() },
|
traceLogPacks = runBlocking { preferencesStore.getTracingLogPacksFlow().first() },
|
||||||
|
sdkSentryDsn = SentryConfig.SDK_DSN.takeIf { it.isNotBlank() },
|
||||||
)
|
)
|
||||||
bugReporter.setCurrentTracingLogLevel(logLevel.name)
|
bugReporter.setCurrentTracingLogLevel(logLevel.name)
|
||||||
platformService.init(tracingConfiguration)
|
platformService.init(tracingConfiguration)
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,5 @@ data class TracingConfiguration(
|
||||||
val traceLogPacks: Set<TraceLogPack>,
|
val traceLogPacks: Set<TraceLogPack>,
|
||||||
val writesToLogcat: Boolean,
|
val writesToLogcat: Boolean,
|
||||||
val writesToFilesConfiguration: WriteToFilesConfiguration,
|
val writesToFilesConfiguration: WriteToFilesConfiguration,
|
||||||
|
val sdkSentryDsn: String?,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -60,5 +60,5 @@ fun TracingConfiguration.map(): org.matrix.rustcomponents.sdk.TracingConfigurati
|
||||||
extraTargets = extraTargets,
|
extraTargets = extraTargets,
|
||||||
traceLogPacks = traceLogPacks.map(),
|
traceLogPacks = traceLogPacks.map(),
|
||||||
writeToFiles = writesToFilesConfiguration.toTracingFileConfiguration(),
|
writeToFiles = writesToFilesConfiguration.toTracingFileConfiguration(),
|
||||||
sentryDsn = null,
|
sentryDsn = sdkSentryDsn,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ object BuildTimeConfig {
|
||||||
val SERVICES_POSTHOG_HOST: String? = null
|
val SERVICES_POSTHOG_HOST: String? = null
|
||||||
val SERVICES_POSTHOG_APIKEY: String? = null
|
val SERVICES_POSTHOG_APIKEY: String? = null
|
||||||
val SERVICES_SENTRY_DSN: String? = null
|
val SERVICES_SENTRY_DSN: String? = null
|
||||||
|
val SERVICES_SENTRY_SDK_DSN: String? = null
|
||||||
val BUG_REPORT_URL: String? = null
|
val BUG_REPORT_URL: String? = null
|
||||||
val BUG_REPORT_APP_NAME: String? = null
|
val BUG_REPORT_APP_NAME: String? = null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@ android {
|
||||||
}
|
}
|
||||||
?: ""
|
?: ""
|
||||||
)
|
)
|
||||||
|
buildConfigFieldStr(
|
||||||
|
name = "SDK_SENTRY_DSN",
|
||||||
|
value = if (isEnterpriseBuild) {
|
||||||
|
BuildTimeConfig.SERVICES_SENTRY_SDK_DSN
|
||||||
|
} else {
|
||||||
|
System.getenv("ELEMENT_SDK_SENTRY_DSN")
|
||||||
|
?: readLocalProperty("services.analyticsproviders.sdk.sentry.dsn")
|
||||||
|
}
|
||||||
|
?: ""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ package io.element.android.services.analyticsproviders.sentry
|
||||||
object SentryConfig {
|
object SentryConfig {
|
||||||
const val NAME = "Sentry"
|
const val NAME = "Sentry"
|
||||||
const val DSN = BuildConfig.SENTRY_DSN
|
const val DSN = BuildConfig.SENTRY_DSN
|
||||||
|
const val SDK_DSN = BuildConfig.SDK_SENTRY_DSN
|
||||||
const val ENV_DEBUG = "DEBUG"
|
const val ENV_DEBUG = "DEBUG"
|
||||||
const val ENV_NIGHTLY = "NIGHTLY"
|
const val ENV_NIGHTLY = "NIGHTLY"
|
||||||
const val ENV_RELEASE = "RELEASE"
|
const val ENV_RELEASE = "RELEASE"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue