# Description
This package encapsulates Sentry integration. So far:
- only for status-go (including when running as part of desktop and mobile)
- only for panics (no other error reporting)
Sentry is only enabled for users that **both**:
1. Opted-in for metrics
2. Use builds from our release CI
## 🛬 Where
We use self-hosted Sentry: https://sentry.infra.status.im/
## 🕐 When
### Which panics are reported:
- When running inside `status-desktop`/`status-mobile`:
- during API calls in `/mobile/status.go`
- inside all goroutines
- When running `status-backend`:
- any panic
### Which panics are NOT reported:
- When running inside `status-desktop`/`status-mobile`:
- during API calls in `/services/**/api.go` \
NOTE: These endpoints are executed through `go-ethereum`'s JSON-RPC server, which internally recovers all panics and doesn't provide any events or option to set an interceptor.
The only way to catch these panics is to replace the JSON-RPC server implementation.
- When running `status-go` unit tests:
- any panic \
NOTE: Go internally runs tests in a goroutine. The only way to catch these panics in tests is to manually `defer sentry.Recover()` in each test. This also requires a linter (similar to `lint-panics`) that checks this call is present. \
This is not a priority right now, because:
1. We have direct access to failed tests logs, which contain the panic stacktrace.
2. Panics are not expected to happen. Test must be passing to be able to merge the code. So it's only possible with a flaky test.
3. This would only apply to nightly/develop jobs, as we don't gather panic reports from PR-level jobs.
## 📦 What
Full list can be found in `sentry.Event`.
Notes regarding identity-disclosing properties:
- `ServerName` - completely removed from all events
- `Stacktrace`:
- No private user paths are exposed, as we only gather reports from CI-built binaries.
- `TraceID` - so far will be unique for each event
>Trace: A collection of spans representing the end-to-end journey of a request through your system that all share the same trace ID.
More details in [sentry docs](https://docs.sentry.io/product/explore/traces/#key-concepts).
# Configuration
There are 2 main tags to identify the error. The configuration is a bit complicated, but provides full information.
## Parameters
### `Environment`
| | |
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Defining question | Where it is running? |
| Set time | - `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 |
| Expected values |
Value | Description |
---|---|
`production` | End user machine |
~~`development`~~ | Developer machine |
~~`ci-pr`~~ | PR-level CI runs |
`ci-main` | CI runs for stable branch |
`ci-nightly` | CI nightly jobs on stable branch |
Value | Running as... |
---|---|
`status-desktop` | Library embedded into [status-desktop](https://github.com/status-im/status-desktop) |
`status-mobile` | Library embedded into [status-mobile](https://github.com/status-im/status-mobile) |
`status-backend` | Part of `cmd/status-backend` Can be other `cmd/*` as well. |
`matterbridge` | Part of [Status/Discord bridge app](https://github.com/status-im/matterbridge) |
`status-go-tests` | Inside status-go tests |