File tree Expand file tree Collapse file tree 5 files changed +712
-11
lines changed Expand file tree Collapse file tree 5 files changed +712
-11
lines changed Original file line number Diff line number Diff line change @@ -74,3 +74,11 @@ PROMETHEUS_ENABLED="false"
7474PROMETHEUS_HTTP_PATH = " /metrics"
7575PROMETHEUS_PORT = " 8088"
7676PROMETHEUS_HOST = " localhost"
77+
78+ # Sentry integration
79+ SENTRY_ENABLED = " false"
80+ SENTRY_DSN = " "
81+ SENTRY_SEND_DEFAULT_PII = " false"
82+ SENTRY_TRACES_SAMPLE_RATE = " 1.0"
83+ SENTRY_PROFILE_SESSION_SAMPLE_RATE = " 1.0"
84+ SENTRY_EVENT_LOOP_BLOCK_THRESHOLD_MS = " 100"
Original file line number Diff line number Diff line change 1111 },
1212 "scripts" : {
1313 "dev" : " tsx watch src/index.ts" ,
14- "build" : " del dist && tsc" ,
14+ "build" : " rm -rf dist && tsc" ,
1515 "seed" : " API_KEY=cosmo_669b576aaadc10ee1ae81d9193425705 tsx src/bin/seed.ts" ,
1616 "delete-user" : " tsx src/bin/delete-user.ts" ,
1717 "deactivate-org" : " tsx src/bin/deactivate-org.ts" ,
5151 "@graphql-tools/utils" : " ^10.1.2" ,
5252 "@keycloak/keycloak-admin-client" : " ^25.0.2" ,
5353 "@octokit/webhooks-types" : " ^7.6.1" ,
54+ "@sentry/node" : " ^10.11.0" ,
55+ "@sentry/node-native" : " ^10.11.0" ,
56+ "@sentry/profiling-node" : " ^10.11.0" ,
5457 "@tiptap/core" : " ^2.1.13" ,
5558 "@wundergraph/composition" : " workspace:*" ,
5659 "@wundergraph/cosmo-connect" : " workspace:*" ,
116119 "typescript" : " 5.5.2" ,
117120 "vitest" : " ^3.2.4"
118121 }
119- }
122+ }
Original file line number Diff line number Diff line change 1+ // sentry.config.ts
2+ import * as Sentry from "@sentry/node" ;
3+
4+ import { nodeProfilingIntegration } from "@sentry/profiling-node" ;
5+ import { eventLoopBlockIntegration } from "@sentry/node-native" ;
6+
7+ if ( process . env . SENTRY_ENABLED ) {
8+ Sentry . init ( {
9+ dsn : process . env . SENTRY_DSN ,
10+ integrations : [
11+ eventLoopBlockIntegration ( { threshold : Number ( process . env . SENTRY_EVENT_LOOP_BLOCK_THRESHOLD_MS ) } ) ,
12+ nodeProfilingIntegration ( )
13+ ] ,
14+ profileSessionSampleRate : Number ( process . env . SENTRY_PROFILE_SESSION_SAMPLE_RATE ) ,
15+ sendDefaultPii : Boolean ( process . env . SENTRY_SEND_DEFAULT_PII ) ,
16+ tracesSampleRate : Number ( process . env . SENTRY_TRACES_SAMPLE_RATE )
17+ } ) ;
18+ }
19+
20+ export * as Sentry from "@sentry/node" ;
Original file line number Diff line number Diff line change @@ -170,6 +170,15 @@ if (STRIPE_SECRET_KEY) {
170170 } ;
171171}
172172
173+ if ( process . env . SENTRY_ENABLED === "true" ) {
174+ if ( process . env . SENTRY_DSN ) {
175+ await import ( "./core/sentry.config.js" ) ;
176+ }
177+ else {
178+ throw new Error ( 'SENTRY_ENABLED is set but SENTRY_DSN is not' ) ;
179+ }
180+ }
181+
173182const app = await build ( options ) ;
174183
175184await app . listen ( {
You can’t perform that action at this time.
0 commit comments