Skip to content

Commit 3a4fd6a

Browse files
committed
.
1 parent 6721f30 commit 3a4fd6a

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

packages/core/src/tracing/langchain/embeddings.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,9 @@ export function instrumentEmbeddingMethod(
6262
originalMethod: (...args: unknown[]) => Promise<unknown>,
6363
options: LangChainOptions = {},
6464
): (...args: unknown[]) => Promise<unknown> {
65-
// Already instrumented
66-
if ((originalMethod as { __sentry_wrapped__?: boolean }).__sentry_wrapped__) {
67-
return originalMethod;
68-
}
69-
7065
const { recordInputs } = resolveAIRecordingOptions(options);
7166

72-
const proxy = new Proxy(originalMethod, {
67+
return new Proxy(originalMethod, {
7368
apply(target, thisArg, args: unknown[]): Promise<unknown> {
7469
const attributes = extractEmbeddingAttributes(thisArg);
7570
const modelName = attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] || 'unknown';
@@ -98,10 +93,6 @@ export function instrumentEmbeddingMethod(
9893
);
9994
},
10095
}) as (...args: unknown[]) => Promise<unknown>;
101-
102-
(proxy as { __sentry_wrapped__?: boolean }).__sentry_wrapped__ = true;
103-
104-
return proxy;
10596
}
10697

10798
/**

0 commit comments

Comments
 (0)