File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/node/src/integrations/tracing/langgraph Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -107,10 +107,12 @@ export class SentryLangGraphInstrumentation extends InstrumentationBase<LangGrap
107107 }
108108
109109 // Patch createReactAgent to instrument the agent creation and invocation
110- if ( exports . createReactAgent && typeof exports . createReactAgent === 'function' ) {
111- const originalCreateReactAgent = exports . createReactAgent ;
110+ const wrappedCreateReactAgent = instrumentCreateReactAgent ( exports . createReactAgent as ( ...args : unknown [ ] ) => CompiledGraph , options ) ;
111+ try {
112+ exports . createReactAgent = wrappedCreateReactAgent ;
113+ } catch ( error ) {
112114 Object . defineProperty ( exports , 'createReactAgent' , {
113- value : instrumentCreateReactAgent ( originalCreateReactAgent as ( ... args : unknown [ ] ) => CompiledGraph , options ) ,
115+ value : wrappedCreateReactAgent ,
114116 writable : true ,
115117 enumerable : true ,
116118 configurable : true ,
You can’t perform that action at this time.
0 commit comments