-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat_: add Sentry panic reporting #6054
base: develop
Are you sure you want to change the base?
Conversation
Jenkins BuildsClick to see older builds (79)
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6054 +/- ##
===========================================
- Coverage 60.90% 60.86% -0.04%
===========================================
Files 819 823 +4
Lines 109444 109569 +125
===========================================
+ Hits 66656 66694 +38
- Misses 34950 35050 +100
+ Partials 7838 7825 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3a4d917
to
fcedb01
Compare
fcedb01
to
08ee67a
Compare
@igor-sirotin one point to consider, which @sunleos already mentioned, is the desire to keep usage data separate from everything else. We already have two separate flags, one for Waku usage data (telemetry) and general usage data (analytics/MixPanel). It would be better if we could have a new setting just for app monitoring, that way a user will be able to toggle it independently of the other two. One other reason is that we don't want internal CCs enabling the centralized metrics toggle because that skews MixPanel reports due to the small number of active (external) users. |
16d7c02
to
8e9547a
Compare
Settings planWe're discussing to make 3 separate toggles for analytics, but all under a single main toggle as well. Something like this:
What we haveSo far we have this controls in the database:
What we needMost probably we need 4 boolean flags. Might work with 3 as well, depending on what the design will be. PS. I will keep this PR without these controls and bind to |
5acde49
to
72d55a2
Compare
72d55a2
to
b1846a9
Compare
✔️ status-go/prs/macos/x86_64/main/PR-6054#12 🔹 ~5 min 31 sec 🔹 b1846a9 🔹 📦 macos package |
Requires:
Iterates:
Desktop PR:
Note
TODO:
Share usage data with Status
Initialize Sentry for unit testsWon't be done: go tests run in goroutines, which is created internally in
testing
package.The only way to workaround this is to add
defer common.LogOnPanic()
to EACH TEST. This doesn't seem to be that easy right now. And the benefit is not that big: we only need this for develop/nightly runs.Consider case when running client e2e tests with no metrics reporting (we still want crash reports)I guess we won't this do this now as well. Not high priority to have reports from in-test crashes.
Next steps:
Description
This PR iterates integration of Sentry into Status project. So far:
🛬 Where
We use self-hosted Sentry: https://sentry.infra.status.im/
🕐 When
When a panic (crash) happens in status-go in one of those cases:
status-desktop
/status-mobile
:/mobile/status.go
/services/**/api.go
status-backend
:📦 What
Here's some highlights:
Device info (OS, architecture, number of cpu cores)
Error stack trace:
Stacktrace contains paths to source files. When built locally, this might contain sensitive information, e.g. user name.
This will not be a problem for us, as we will only enable Sentry for builds made on our CI, so paths will only contain our CI-related paths, which is safe.
Trace ID (so far will be unique for each event)
More details in sentry docs.
Examples
Example of a status-go panic, while running as part of status-desktop:
Sentry event link or full JSON.
Example of a status-go panic , while running as part of status-backend:
Sentry event link or full JSON
Re: Privacy policy
Only enabled for users that both:
The feature is opt-in only:
status-go/mobile/status.go
Lines 107 to 115 in 3a4d917
I assume this should be fine within the existing Privacy policy. We don't report any more privacy-enclosing information than to the opt-in metrics.
Please check Sentry security and compliance for more details.
Configuration
I added 2 main tags to identify the error. The configuration is a bit complicated, but provides full information.
Question
production
can only be set at build time to prevent users from hacking the environment- All others can be set at runtime, because on CI we sometimes use same build for multiple environments
production
development
ci-pr
ci-main
ci-nightly
development
andci-pr
are dropped, because we only want to consider panics from stable codestatus-desktop
status-mobile
status-backend
cmd/status-backend
Can be other
cmd/*
as well.matterbridge
status-go-tests
To cover this requirements, I added these environment variables:
SENTRY_DSN
sentry.Init
- At runtime with
InitializeApplication
endpointSENTRY_CONTEXT_NAME
SENTRY_CONTEXT_VERSION
SENTRY_PRODUCTION
true
or1
:-Defines if this is a production build
-Sets environment to
production
-Has precedence over runtime
SENTRY_ENVIRONMENT
SENTRY_ENVIRONMENT
SENTRY_ENVIRONMENT
is setClient instructions
Set
SENTRY_CONTEXT_NAME
andSENTRY_CONTEXT_VERSION
at status-go build timeProvide
sentryDSN
to theInitializeApplication
call.DSN must be kept private and will be provided by CI. Expect a
STATUS_GO_SENTRY_DSN
environment variable.Why can't we consume `STATUS_GO_SENTRY_DSN` directly in status-go build?
Implementation details
internal/sentry
package that encapsulates all custom details, configurations, etc.status-go/common/utils.go
Line 102 in fcedb01
status-go/mobile/callog/status_request_log.go
Line 69 in fcedb01
status-go/cmd/status-backend/main.go
Line 40 in fcedb01
This covers all goroutines, because we have a linter to check that all goroutines have
defer common.LogOnPanic
.InitializeApplication
- covers desktop/mobile clientsstatus-go/mobile/status.go
Lines 105 to 108 in fcedb01
status-backend
- covers functional tests:status-go/cmd/status-backend/main.go
Lines 36 to 39 in fcedb01