File tree Expand file tree Collapse file tree
node/src/integrations/tracing/vercelai
server-utils/src/vercel-ai Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,10 +195,10 @@ export function defineIntegration<Fn extends IntegrationFn>(
195195 * });
196196 * ```
197197 */
198- export function extendIntegration < Base extends Integration , Extended extends Partial < Integration > > (
199- integration : Base ,
200- extendedIntegration : Extended ,
201- ) : Omit < Base , keyof Extended > & Extended {
198+ export function extendIntegration <
199+ Base extends Integration ,
200+ Extended extends Record < string , unknown > & Partial < Integration > ,
201+ > ( integration : Base , extendedIntegration : Extended ) : Omit < Base , keyof Extended > & Extended {
202202 // The extension overrides the base for any shared key (object spread + the wrapping below), so the
203203 // result type drops the overridden base keys rather than intersecting them — `Base & Extended` would
204204 // wrongly intersect shared keys (e.g. a re-typed property collapses to `never`).
Original file line number Diff line number Diff line change 11import type { Client , IntegrationFn } from '@sentry/core' ;
2- import { addVercelAiProcessors , defineIntegration } from '@sentry/core' ;
2+ import { addVercelAiProcessors , defineIntegration , extendIntegration } from '@sentry/core' ;
33import { generateInstrumentOnce , type modulesIntegration } from '@sentry/node-core' ;
44import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils' ;
55import { INTEGRATION_NAME } from './constants' ;
@@ -22,12 +22,10 @@ const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
2222
2323 const parentIntegration = serverUtilsVercelAiIntegration ( options ) ;
2424
25- return {
26- name : INTEGRATION_NAME ,
25+ return extendIntegration ( parentIntegration , {
2726 options,
2827 setupOnce ( ) {
2928 instrumentation = instrumentVercelAi ( ) ;
30- parentIntegration . setupOnce ?.( ) ;
3129 } ,
3230 afterAllSetup ( client ) {
3331 // Auto-detect if we should force the integration when running with 'ai' package available
@@ -40,7 +38,7 @@ const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
4038 instrumentation ?. callWhenPatched ( ( ) => addVercelAiProcessors ( client ) ) ;
4139 }
4240 } ,
43- } ;
41+ } ) ;
4442} ) satisfies IntegrationFn ;
4543
4644/**
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ type VercelAiOptions = {
2626
2727const _vercelAiIntegration = ( ( options : VercelAiOptions = { } ) => {
2828 return {
29- name : 'VercelAi' ,
29+ name : 'VercelAi' as const ,
3030 setupOnce ( ) {
3131 // Bail if this is not available
3232 if ( ! dc . tracingChannel ) {
You can’t perform that action at this time.
0 commit comments