Sentry: add Soapbox context

environments/review-sentry-con-xug4gz/deployments/4158
Alex Gleason 2023-10-12 21:51:06 -05:00
rodzic a158b4dcf5
commit e2b8a74e91
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,5 @@
import sourceCode from 'soapbox/utils/code';
import type { Account } from './schemas'; import type { Account } from './schemas';
/** Start Sentry. */ /** Start Sentry. */
@ -36,6 +38,8 @@ async function startSentry(dsn: string): Promise<void> {
// for finer control // for finer control
tracesSampleRate: 1.0, tracesSampleRate: 1.0,
}); });
Sentry.setContext('soapbox', sourceCode);
} }
/** Associate the account with Sentry events. */ /** Associate the account with Sentry events. */
@ -45,6 +49,7 @@ async function setSentryAccount(account: Account) {
Sentry.setUser({ Sentry.setUser({
id: account.id, id: account.id,
username: account.acct, username: account.acct,
url: account.url,
}); });
} }

Wyświetl plik

@ -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 // Try to discern from GitLab CI first
if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') { if (CI_COMMIT_TAG === `v${pkg.version}` || CI_COMMIT_REF_NAME === 'stable') {
return pkg.version; return pkg.version;