mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-13 15:46:22 +00:00
feat: sentry improvements (#532)
* feat: process request record from sentry locally * feat: added analytics for logged in users
This commit is contained in:
@@ -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', {
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user