From 865dbed96ac80ebc3c671e71002bb85a5260da66 Mon Sep 17 00:00:00 2001 From: Grigory Kruglov Date: Tue, 29 Mar 2022 13:41:50 -0700 Subject: [PATCH] [fenix] Do not report caught exceptions to Sentry on release channel --- .../java/org/mozilla/fenix/components/Analytics.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/Analytics.kt b/app/src/main/java/org/mozilla/fenix/components/Analytics.kt index b58c3ec5c2..0c520506d8 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Analytics.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Analytics.kt @@ -49,6 +49,13 @@ class Analytics( } if (isSentryEnabled()) { + // We treat caught exceptions similar to debug logging. + // On the release channel volume of these is too high for our Sentry instances, and + // we get most value out of nightly/beta logging anyway. + val shouldSendCaughtExceptions = when (Config.channel) { + ReleaseChannel.Release -> false + else -> true + } val sentryService = SentryService( context, BuildConfig.SENTRY_TOKEN, @@ -58,6 +65,7 @@ class Analytics( ), environment = BuildConfig.BUILD_TYPE, sendEventForNativeCrashes = false, // Do not send native crashes to Sentry + sendCaughtExceptions = shouldSendCaughtExceptions, sentryProjectUrl = getSentryProjectUrl() ) @@ -133,7 +141,7 @@ class Analytics( } } -fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty() +private fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty() private fun getSentryProjectUrl(): String? { val baseUrl = "https://sentry.prod.mozaws.net/operations"