From f3182d213ee19207644583c4deedefe0a1777b17 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 18 Jun 2024 15:02:24 -0400 Subject: [PATCH] feat(profiling) use continuous profiler instead of the span/txn based one (#161) * feat(profiling) use continuous profiler instead * Update src/instrument.ts Co-authored-by: Abhijeet Prasad * Update src/instrument.ts Co-authored-by: Abhijeet Prasad --------- Co-authored-by: Abhijeet Prasad --- src/instrument.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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(); + } +}