Skip to content

Commit 17b303d

Browse files
committed
resolve conflicts
1 parent efb6037 commit 17b303d

File tree

1 file changed

+8
-19
lines changed
  • packages/core/src/tracing/langgraph

1 file changed

+8
-19
lines changed

packages/core/src/tracing/langgraph/index.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { getClient } from '../../currentScopes';
21
import { captureException } from '../../exports';
32
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes';
43
import { SPAN_STATUS_ERROR } from '../../tracing';
@@ -41,26 +40,16 @@ import { extractToolsFromCompiledGraph, setResponseAttributes } from './utils';
4140
* const compiled = graph.compile({ name: 'my_agent' });
4241
* ```
4342
*/
44-
export function instrumentLangGraph(
45-
stateGraph: { compile?: (...args: unknown[]) => CompiledGraph },
46-
options: LangGraphOptions = {},
47-
): void {
48-
const client = getClient();
49-
const clientOptions = client?.getOptions();
50-
const defaultPii = Boolean(clientOptions?.sendDefaultPii);
43+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44+
export function instrumentLangGraph<T extends { compile: (...args: any[]) => any }>(
45+
stateGraph: T,
46+
options?: LangGraphOptions,
47+
): T {
48+
const _options: LangGraphOptions = options || {};
5149

52-
const recordInputs = options.recordInputs ?? defaultPii;
53-
const recordOutputs = options.recordOutputs ?? defaultPii;
50+
stateGraph.compile = instrumentStateGraphCompile(stateGraph.compile.bind(stateGraph), _options);
5451

55-
const instrumentationOptions: LangGraphOptions = {
56-
recordInputs,
57-
recordOutputs,
58-
};
59-
60-
if (stateGraph.compile && typeof stateGraph.compile === 'function') {
61-
const originalCompile = stateGraph.compile;
62-
stateGraph.compile = instrumentStateGraphCompile(originalCompile, instrumentationOptions);
63-
}
52+
return stateGraph;
6453
}
6554

6655
/**

0 commit comments

Comments
 (0)