Sending vercel ai-sdk opentelemetry through Sentry VercelAiIntegration. Global OTel API conflict #2659
Replies: 3 comments
-
|
Trying this now |
Beta Was this translation helpful? Give feedback.
-
|
Hm no this didn't work as this is missing whatever sentry adds to spans when using vercelAiIntegration |
Beta Was this translation helpful? Give feedback.
-
|
Yeah the problem is that sentry aiSdk integration intercepts the spans to modify attributes that vercel ai sdk sends with their own prefixes, which is happening, but sentry can't send traces as it fails during otel register at the start when skipOpenTelemetrySetup: false. But if skipOpenTelemetrySetup: true then they are just not sent over. And any other solution like custom exporter would skip the custom integrations like span attribute interception |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Sentry has Vercel AI SDK integration
It works by adding span processor to opentelemetry. With default setup it fails because it conflicts with trigger.dev's global opentelemetry APIs. If I set
skipOpenTelemetrySetup:truein Sentry init and turn on debugging, the spans are created but never reach sentry as there's no Span processor created.What I tried:
-
tasks.onStart()- Too early, provider not readytasks.middleware()- ReturnsProxyTracerProvider, can't modifyCreated
SentryOTLPBridgeExporterthat implementsSpanExporterinterface - Partially Working:Sentry's
addVercelAiProcessors()function adds special span processors that transform OTel spans into Sentry's AI-specific format. These processors don't run when using our custom bridge because we bypass Sentry's OTel setup entirely.Anyone knows of alternative way to try to make it work, or should I just accept that I can't get AI insights in sentry when running ai-sdk from trigger.dev tasks?
Beta Was this translation helpful? Give feedback.
All reactions