Skip to content

Commit 8338a05

Browse files
committed
hapi with instrumentation file
1 parent ec7dd82 commit 8338a05

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

apps/hapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"scripts": {
99
"build": "tsc",
10-
"start": "yarn build && node dist/app.js",
10+
"start": "yarn build && node --require ./dist/instrumentation.js dist/app.js",
1111
"clean": "npx rimraf node_modules,pnpm-lock.yaml"
1212
},
1313
"license": "MIT",

apps/hapi/src/app.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1+
// import './instrumentation'; // file preloaded with --require option in node call
12
import * as Sentry from '@sentry/node';
2-
import dotenv from 'dotenv';
3-
4-
dotenv.config({ path: './../../.env' });
5-
6-
Sentry.init({
7-
environment: 'qa', // dynamic sampling bias to keep transactions
8-
dsn: process.env.SENTRY_DSN,
9-
includeLocalVariables: true,
10-
debug: true,
11-
tunnel: `http://localhost:3031/`, // proxy server
12-
tracesSampleRate: 1,
13-
});
14-
153
import Hapi from '@hapi/hapi';
164

17-
dotenv.config({ path: './../../.env' });
18-
195
declare global {
206
namespace globalThis {
217
var transactionIds: string[];

apps/hapi/src/instrumentation.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as Sentry from '@sentry/node';
2+
import dotenv from 'dotenv';
3+
4+
dotenv.config({ path: './../../.env' });
5+
6+
Sentry.init({
7+
environment: 'qa', // dynamic sampling bias to keep transactions
8+
dsn: process.env.SENTRY_DSN,
9+
includeLocalVariables: true,
10+
tunnel: `http://localhost:3031/`, // proxy server
11+
tracesSampleRate: 1,
12+
});

0 commit comments

Comments
 (0)