File tree Expand file tree Collapse file tree 3 files changed +155
-92
lines changed Expand file tree Collapse file tree 3 files changed +155
-92
lines changed Original file line number Diff line number Diff line change 1616 "author" : " Microsoft" ,
1717 "license" : " MIT" ,
1818 "dependencies" : {
19+ "@arizeai/openinference-instrumentation-langchain" : " ^3.4.3" ,
1920 "@azure/functions" : " ^4.0.0" ,
2021 "@azure/identity" : " ^4.2.0" ,
2122 "@azure/monitor-opentelemetry" : " ^1.12.0" ,
3031 "@opentelemetry/instrumentation" : " ^0.205.0" ,
3132 "@opentelemetry/sdk-trace-base" : " ^2.1.0" ,
3233 "@opentelemetry/sdk-trace-node" : " ^2.0.1" ,
33- "@traceloop/instrumentation-langchain" : " ^0.19.0" ,
34- "langchain" : " ^0.3.6"
34+ "langchain" : " ^0.3.34"
3535 },
3636 "devDependencies" : {
3737 "@types/node" : " ^22" ,
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import { useAzureMonitor } from "@azure/monitor-opentelemetry";
66import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http" ;
77import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node" ;
88import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base" ;
9- import { LangChainInstrumentation } from "@traceloop/ instrumentation-langchain" ;
10- import { registerInstrumentations } from "@opentelemetry/instrumentation " ;
9+ import { LangChainInstrumentation } from "@arizeai/openinference- instrumentation-langchain" ;
10+ import * as CallbackManagerModule from "@langchain/core/callbacks/manager " ;
1111
1212let isTracingInitialized = false ;
1313if ( ! isTracingInitialized ) {
@@ -32,9 +32,9 @@ if (!isTracingInitialized) {
3232 provider . register ( ) ;
3333 }
3434
35- registerInstrumentations ( {
36- instrumentations : [ new LangChainInstrumentation ( ) ] ,
37- } ) ;
35+ // Manually instrument LangChain's CallbackManager to capture traces
36+ const langchainInstrumentation = new LangChainInstrumentation ( ) ;
37+ langchainInstrumentation . manuallyInstrument ( CallbackManagerModule ) ;
3838
3939 isTracingInitialized = true ;
4040}
You can’t perform that action at this time.
0 commit comments