feat: sentry improvements (#532)

* feat: process request record from sentry locally

* feat: added analytics for logged in users
This commit is contained in:
Dani Akash
2026-03-23 19:45:28 +05:30
committed by GitHub
parent 4928b7e84b
commit 86ec88ed80
10 changed files with 223 additions and 2 deletions

View File

@@ -51,7 +51,15 @@ export function createChatRoutes(deps: ChatRouteDeps) {
Sentry.setContext('request', {
provider: request.provider,
model: request.model,
baseUrl: request.baseUrl,
baseUrl: request.baseUrl
? (() => {
try {
return new URL(request.baseUrl).origin
} catch {
return undefined
}
})()
: undefined,
})
metrics.log('chat.request', {

View File

@@ -2,6 +2,8 @@
* @license
* Copyright 2025 BrowserOS
*/
import { sanitizeEvent } from '@browseros/shared/sentry/sanitize'
import * as Sentry from '@sentry/bun'
import { INLINED_ENV } from '../env'
@@ -17,6 +19,10 @@ Sentry.init({
sendDefaultPii: true,
environment: SENTRY_ENVIRONMENT,
release: VERSION,
beforeSend(event) {
return sanitizeEvent(event)
},
})
export { Sentry }

View File

@@ -198,6 +198,7 @@ export class Application {
logger.debug('Sentry disabled: missing SENTRY_DSN')
}
Sentry.setUser({ id: browserosId })
Sentry.setContext('browseros', {
client_id: this.config.instanceClientId,
install_id: this.config.instanceInstallId,