Skip to content

Commit 7774981

Browse files
authored
feat: add sentry profiling (#1019)
1 parent b80f3a7 commit 7774981

File tree

7 files changed

+486
-81
lines changed

7 files changed

+486
-81
lines changed

apps/web/next.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ const nextConfig = {
1212
output: 'standalone',
1313
transpilePackages: INTERNAL_PACKAGES,
1414
serverExternalPackages: [
15-
'@latitude-data/sdk',
1615
'@latitude-data/compiler',
16+
'@latitude-data/sdk',
17+
'@napi-rs/canvas',
1718
'@sentry/nextjs',
19+
'@sentry/profiling-node',
20+
'@sentry/utils',
1821
'bullmq',
1922
'jose',
2023
'nodemailer-mailgun-transport',
21-
'@napi-rs/canvas',
2224
'pdfjs-dist',
2325
'promptl-ai',
2426
],

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@monaco-editor/react": "^4.6.0",
2929
"@napi-rs/canvas": "^0.1.65",
3030
"@sentry/nextjs": "^8.34.0",
31+
"@sentry/profiling-node": "^9.8.0",
3132
"@sentry/utils": "^8.30.0",
3233
"@sindresorhus/slugify": "^2.2.1",
3334
"@t3-oss/env-nextjs": "^0.10.1",

apps/web/sentry.client.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import * as Sentry from '@sentry/nextjs'
66

77
Sentry.init({
8-
// TODO: This should be the process.env.SENTRY_WEB_DSN env var
9-
dsn: 'https://6e31ecebeab94c81ef6be3b0b8ab5773@o1153048.ingest.us.sentry.io/4507922531418112',
8+
dsn: process.env.SENTRY_WEB_DSN,
109

1110
// Add optional integrations for additional features
1211
integrations: [Sentry.replayIntegration()],

apps/web/sentry.server.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44

55
import { env } from '@latitude-data/env'
66
import * as Sentry from '@sentry/nextjs'
7+
import { nodeProfilingIntegration } from '@sentry/profiling-node'
78

89
Sentry.init({
910
dsn: env.SENTRY_WEB_DSN,
1011
enabled: !!env.SENTRY_WEB_DSN,
1112

13+
integrations: [nodeProfilingIntegration],
14+
tracesSampleRate: 1.0,
15+
profilesSampleRate: 1.0,
16+
1217
// Setting this option to true will print useful information to the console while you're setting up Sentry.
1318
debug: false,
1419
})

apps/workers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@latitude-data/env": "workspace:^",
2121
"@sentry/cli": "^2.37.0",
2222
"@sentry/node": "^8.30.0",
23+
"@sentry/profiling-node": "^9.8.0",
2324
"@t3-oss/env-core": "*",
2425
"@tavily/core": "^0.3.1",
2526
"dd-trace": "^5.37.1",

apps/workers/src/utils/sentry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import { env } from '@latitude-data/env'
21
import * as Sentry from '@sentry/node'
2+
import { env } from '@latitude-data/env'
3+
import { nodeProfilingIntegration } from '@sentry/profiling-node'
34

45
if (env.SENTRY_WORKERS_DSN) {
56
Sentry.init({
67
dsn: env.SENTRY_WORKERS_DSN,
7-
88
enabled: !!env.SENTRY_WORKERS_DSN,
9+
integrations: [nodeProfilingIntegration],
10+
tracesSampleRate: 1.0,
11+
profilesSampleRate: 1.0,
12+
13+
environment: env.NODE_ENV,
914
})
1015
}
1116

0 commit comments

Comments
 (0)