From e2b8a74e91e4360f3089be87be836b102e8d3367 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 12 Oct 2023 21:51:06 -0500 Subject: [PATCH] Sentry: add Soapbox context --- src/sentry.ts | 5 +++++ src/utils/code-compiletime.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sentry.ts b/src/sentry.ts index 4ef1ea77e..21ff9a583 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -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 { // 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, }); } diff --git a/src/utils/code-compiletime.ts b/src/utils/code-compiletime.ts index d9606c3a1..f229d5e10 100644 --- a/src/utils/code-compiletime.ts +++ b/src/utils/code-compiletime.ts @@ -15,7 +15,7 @@ const tryGit = (cmd: string): string | undefined => { } }; -const version = (pkg: Record) => { +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;