Skip to content

Commit 7d44c65

Browse files
committed
Fixed root cause of workaround
ref 070a35a - this should have been a little more obvious, it was because of the ordering in our code, we should set up OTel before Sentry
1 parent 070a35a commit 7d44c65

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/instrumentation.ts

+8-13
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,6 @@ import {
99
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
1010
import * as Sentry from '@sentry/node';
1111

12-
if (process.env.SENTRY_DSN) {
13-
Sentry.init({
14-
dsn: process.env.SENTRY_DSN,
15-
environment: process.env.NODE_ENV || 'unknown',
16-
release: process.env.K_REVISION,
17-
18-
// Enabled sampling but disable default integrations
19-
// Without this, OTel won't work, and I'm not sure why
20-
defaultIntegrations: false,
21-
tracesSampleRate: 1.0,
22-
});
23-
}
24-
2512
const sdk = new NodeSDK({
2613
instrumentations: getNodeAutoInstrumentations({
2714
'@opentelemetry/instrumentation-mysql2': {
@@ -74,6 +61,14 @@ try {
7461
console.error(e);
7562
}
7663

64+
if (process.env.SENTRY_DSN) {
65+
Sentry.init({
66+
dsn: process.env.SENTRY_DSN,
67+
environment: process.env.NODE_ENV || 'unknown',
68+
release: process.env.K_REVISION,
69+
});
70+
}
71+
7772
export function spanWrapper<TArgs extends unknown[], TReturn>(
7873
fn: (...args: TArgs) => TReturn | Promise<TReturn>,
7974
) {

0 commit comments

Comments
 (0)