diff --git a/.env b/.env index d2afc6525f..2bee64a57d 100644 --- a/.env +++ b/.env @@ -36,3 +36,4 @@ SHOW_NOT_IMPLEMENTED_FEATURES=0 ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.e2e b/.env.e2e index 54454a0a81..3a47251298 100644 --- a/.env.e2e +++ b/.env.e2e @@ -40,3 +40,4 @@ ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.jenkins b/.env.jenkins index 041440679d..3376e24ffb 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -37,3 +37,4 @@ TEST_NETWORKS_ENABLED=1 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.nightly b/.env.nightly index e63c879111..e7dbabdf38 100644 --- a/.env.nightly +++ b/.env.nightly @@ -24,3 +24,4 @@ TEST_NETWORKS_ENABLED=0 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=0 +SENTRY_ENVIRONMENT=ci-nightly diff --git a/.env.release b/.env.release index c34df0d0ee..4edcc8be34 100644 --- a/.env.release +++ b/.env.release @@ -21,3 +21,4 @@ TEST_NETWORKS_ENABLED=0 STATUS_PROXY_STAGE_NAME=prod FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=0 +SENTRY_ENVIRONMENT=production diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt index 720e89f9a8..c431228676 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt @@ -108,6 +108,15 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va ) } + @ReactMethod + fun intendedPanic(message: String) { + StatusBackendClient.executeStatusGoRequest( + endpoint = "IntendedPanic", + requestBody = "", + statusgoFunction = { Statusgo.intendedPanic(message) }, + ) + } + @ReactMethod fun addCentralizedMetric(request: String, callback: Callback) { StatusBackendClient.executeStatusGoRequestWithCallback( diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 00842f9dea..50af3fe513 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -109,6 +109,13 @@ RCT_EXPORT_METHOD(getNodeConfig:(RCTResponseSenderBlock)callback) { callback:callback]; } +RCT_EXPORT_METHOD(intendedPanic:(NSString *)message) { +#if DEBUG + NSLog(@"IntendedPanic() method called"); +#endif + StatusgoIntendedPanic(message); +} + RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(fleets) { return [StatusBackendClient executeStatusGoRequestWithResult:@"Fleets" body:@"" diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 0283dab696..93dd303f96 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -77,6 +77,7 @@ #shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX" status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env "STATUS_BACKEND_SERVER_ROOT_DATA_DIR" + status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID" status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN" status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY" diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index e6ae1b5e5f..40fdf2eeb6 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -5,6 +5,7 @@ [legacy.status-im.ui.components.list.views :as list] [quo.core :as quo] [re-frame.core :as re-frame] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) @@ -22,7 +23,14 @@ peer-syncing-enabled?]}] (keep identity - [{:size :small + [(when (ff/enabled? ::ff/app-monitoring.intentional-crash) + {:size :small + :title "Force crash immediately" + :accessibility-label :intended-panic + :on-press (fn [] + (re-frame/dispatch [:app-monitoring/intended-panic + "status-mobile intentional panic"]))}) + {:size :small :title (i18n/label :t/log-level) :accessibility-label :log-level-settings-button :on-press diff --git a/src/native_module/core.cljs b/src/native_module/core.cljs index fc1f3a4ee8..e399b9ac1e 100644 --- a/src/native_module/core.cljs +++ b/src/native_module/core.cljs @@ -581,3 +581,7 @@ (.createAccountFromPrivateKey ^js (account-manager) (types/clj->json {:privateKey private-key}) callback))) + +(defn intended-panic + [message] + (.intendedPanic ^js (status) message)) diff --git a/src/status_im/common/app_monitoring/effects.cljs b/src/status_im/common/app_monitoring/effects.cljs new file mode 100644 index 0000000000..7939d6f942 --- /dev/null +++ b/src/status_im/common/app_monitoring/effects.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.effects + (:require + [native-module.core :as native-module] + [utils.re-frame :as rf])) + +(rf/reg-fx :effects.app-monitoring/intended-panic + (fn [message] + (native-module/intended-panic message))) diff --git a/src/status_im/common/app_monitoring/events.cljs b/src/status_im/common/app_monitoring/events.cljs new file mode 100644 index 0000000000..d66ab5c6ef --- /dev/null +++ b/src/status_im/common/app_monitoring/events.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.events + (:require + status-im.common.app-monitoring.effects + [utils.re-frame :as rf])) + +(rf/reg-event-fx :app-monitoring/intended-panic + (fn [_ [message]] + {:fx [[:effects.app-monitoring/intended-panic message]]})) diff --git a/src/status_im/config.cljs b/src/status_im/config.cljs index 86877c589e..2f51e9bebf 100644 --- a/src/status_im/config.cljs +++ b/src/status_im/config.cljs @@ -150,3 +150,8 @@ (goog-define STATUS_BACKEND_SERVER_ROOT_DATA_DIR "") ;; if you're using android simulator, I suggest set the env variable to "http://10.0.2.2:" (goog-define STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX "https://localhost:") + +;;;; Sentry +;; Documentation: status-go/internal/sentry/README.md +(goog-define SENTRY_DSN_STATUS_GO "") +(def sentry-dsn-status-go SENTRY_DSN_STATUS_GO) diff --git a/src/status_im/contexts/profile/events.cljs b/src/status_im/contexts/profile/events.cljs index 0b32c07fb3..fa0f053341 100644 --- a/src/status_im/contexts/profile/events.cljs +++ b/src/status_im/contexts/profile/events.cljs @@ -37,6 +37,7 @@ {:dataDir (native-module/backup-disabled-data-dir) :mixpanelAppId config/mixpanel-app-id :mixpanelToken config/mixpanel-token + :sentryDSN config/sentry-dsn-status-go :mediaServerEnableTLS (config/enabled? config/STATUS_BACKEND_SERVER_MEDIA_SERVER_ENABLE_TLS) :logEnabled (not (string/blank? config/log-level)) :logLevel config/log-level diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 3b1f2ee3c4..8e3fe54290 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -2,6 +2,7 @@ (:require status-im.common.alert-banner.events status-im.common.alert.effects + status-im.common.app-monitoring.events status-im.common.async-storage.effects status-im.common.emoji-picker.events status-im.common.font.events diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index 1a24061a8b..19399887c4 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -11,6 +11,7 @@ (def ^:private initial-flags {::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED) + ::app-monitoring.intentional-crash (enabled-in-env? :FLAG_INTENTIONAL_CRASH_ENABLED) ;; Feature toggled (off by default) because the desktop app disabled this ;; feature and we want both clients in sync. We keep the code because it diff --git a/src/tests/test_utils.cljs b/src/tests/test_utils.cljs index e1aa16c865..e8332e1aa3 100644 --- a/src/tests/test_utils.cljs +++ b/src/tests/test_utils.cljs @@ -126,12 +126,9 @@ (def status (clj->js - {:getNodeConfig - (fn [] (types/clj->json {:WakuV2Config ""})) - :addCentralizedMetric - (fn [_ callback] - (callback)) - :fleets - (fn [] (.fleets native-status)) - :startLocalNotifications - identity})) + {:intendedPanic identity + :getNodeConfig (fn [] (types/clj->json {:WakuV2Config ""})) + :addCentralizedMetric (fn [_ callback] + (callback)) + :fleets (fn [] (.fleets native-status)) + :startLocalNotifications identity}))