Sentry: add Soapbox context
This commit is contained in:
parent
a158b4dcf5
commit
e2b8a74e91
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import sourceCode from 'soapbox/utils/code';
|
||||
|
||||
import type { Account } from './schemas';
|
||||
|
||||
/** Start Sentry. */
|
||||
|
@ -36,6 +38,8 @@ async function startSentry(dsn: string): Promise<void> {
|
|||
// for finer control
|
||||
tracesSampleRate: 1.0,
|
||||
});
|
||||
|
||||
Sentry.setContext('soapbox', sourceCode);
|
||||
}
|
||||
|
||||
/** Associate the account with Sentry events. */
|
||||
|
@ -45,6 +49,7 @@ async function setSentryAccount(account: Account) {
|
|||
Sentry.setUser({
|
||||
id: account.id,
|
||||
username: account.acct,
|
||||
url: account.url,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ const tryGit = (cmd: string): string | undefined => {
|
|||
}
|
||||
};
|
||||
|
||||
const version = (pkg: Record<string, any>) => {
|
||||
const version = (pkg: { version: string }): string => {
|
||||
// Try to discern from GitLab CI first
|
||||
if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') {
|
||||
return pkg.version;
|
||||
|
|
Loading…
Reference in a new issue