Backoffice sends errors, performance traces and session replays to
Sentry. The code is in
src/app/common/sentry.ts.
| Data | When |
|---|---|
| Errors | All errors that go to the Angular error handler |
| Traces | 10% of page loads and navigations (100% on dev builds) |
| Replays | Only for a session that has an error |
| User | The user ID. Backoffice does not send the email or name. |
domain |
Tag with the domain of the authority |
Replays mask all text and block all media.
Backoffice loads Sentry after the user signs in. Errors that occur before this stay in a queue (20 errors maximum). Backoffice sends them when Sentry starts.
Sentry does not start:
- On
localhost - In mock mode
- When the DSN is empty
Each domain can set its DSN in the domain config at
config.backoffice.sentry_dsn:
{
"backoffice": {
"sentry_dsn": "https://<key>@<org-id>.ingest.sentry.io/<project-id>"
}
}| Value | Result |
|---|---|
| Not set | Backoffice uses the PlaceOS default DSN |
| A DSN | Backoffice sends to that Sentry project |
"" or false |
Backoffice does not send data to Sentry |
To change the default DSN, change DEFAULT_SENTRY_DSN in
src/app/common/sentry.ts.
The build minifies the scripts. To show the original code in Sentry stack traces, CI uploads source maps to Sentry. Do these steps one time.
The slug is the short name of the organization in the Sentry URL:
https://<org-slug>.sentry.io/. You can also find it in Settings →
Organization → General Settings → Organization Slug.
- Go to Settings → Projects and open the project.
- Open Client Keys (DSN). Make sure that the DSN is the same as the
default DSN in
sentry.ts. The last number of the DSN is the project ID. - Open General Settings. The Name field is the project slug.
Do not use the numbers in the DSN. These are IDs, not slugs.
Go to Settings → Developer Settings → Organization Tokens and make a token. On some Sentry versions, this page has the name Auth Tokens.
In the GitHub repository, go to Settings → Secrets and variables → Actions. Add these repository secrets:
| Secret | Value |
|---|---|
SENTRY_AUTH_TOKEN |
The token from step 3 |
SENTRY_ORG |
The organization slug (step 1) |
SENTRY_PROJECT |
The project slug (step 2) |
CI does not upload source maps until all three secrets have a value. The upload starts on the next run of the BUILD workflow.
- Open the BUILD workflow run in GitHub Actions.
- Open the Upload source maps to Sentry step. Make sure that it does not
show
Skipping upload. - In Sentry, open an error from the new release. The stack trace must show the TypeScript source, not minified code.
The Upload source maps to Sentry step in
.github/workflows/build.yml does these
steps:
sentry-cli sourcemaps injectadds a debug ID to each script and its map. Sentry uses the debug ID to find the map for a script.config/ngsw-rehash.jsupdates the file hashes inngsw.json. The debug IDs change the scripts, and the service worker does not accept a file if its hash is different. Only production builds have a service worker.sentry-cli sourcemaps uploaduploads the maps to the releasebackoffice@<git hash>. This name must be the same asSENTRY_RELEASEinsentry.ts.
Production builds make hidden source maps. The scripts do not link to the maps, and CI deletes the maps before the deploy. Development builds keep their maps.