Skip to content

The open alternative to Salesforce, designed for AI.

fix(server): sample AI SDK v7 agent spans at 100% in Sentry (#27913)

Etienne7126f24cd152
diff --git a/packages/twenty-server/src/instrument.ts b/packages/twenty-server/src/instrument.ts
index fe3fa265e42..faf18d14d89 100644
--- a/packages/twenty-server/src/instrument.ts
+++ b/packages/twenty-server/src/instrument.ts
@@ -100,7 +100,9 @@ if (process.env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.SENTRY) {
],
tracesSampleRate,
tracesSampler: ({ name, inheritOrSampleWith }) =>
- name.startsWith('ai.') ? 1 : inheritOrSampleWith(tracesSampleRate),
+ name.startsWith('invoke_agent')
+ ? 1
+ : inheritOrSampleWith(tracesSampleRate),
profilesSampleRate: parseSampleRate({
value: process.env.SENTRY_PROFILES_SAMPLE_RATE,
fallback: 0.01,