diff --git a/src/instrument.ts b/src/instrument.ts index e8b7951..c73d8e6 100644 --- a/src/instrument.ts +++ b/src/instrument.ts @@ -4,6 +4,16 @@ import {nodeProfilingIntegration} from '@sentry/profiling-node'; Sentry.init({ dsn: process.env.SENTRY_DSN, integrations: [nodeProfilingIntegration()], - profilesSampleRate: 1, tracesSampleRate: 1, }); + +const client = Sentry.getClient(); + +if (client) { + const profilingIntegration = client.getIntegrationByName("ProfilingIntegration"); + + if (profilingIntegration) { + // @ts-expect-error this is purposefuly not exposed by the SDK for now + profilingIntegration._profiler.start(); + } +}