Files
klz-cables.com/.pnpm-store/v10/files/24/30252e867b036bddf3869e30877a21180a19b295f6cb71426b17b471f52f801276c2933e077cfda235a4b1ac15147db9b3ad2c648cb8a62f6f8c4887041123
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

75 lines
2.2 KiB
Plaintext

import { InstrumentationBase, InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile } from '@opentelemetry/instrumentation';
import { SDK_VERSION, getClient, instrumentStateGraphCompile } from '@sentry/core';
const supportedVersions = ['>=0.0.0 <2.0.0'];
/**
* Sentry LangGraph instrumentation using OpenTelemetry.
*/
class SentryLangGraphInstrumentation extends InstrumentationBase {
constructor(config = {}) {
super('@sentry/instrumentation-langgraph', SDK_VERSION, config);
}
/**
* Initializes the instrumentation by defining the modules to be patched.
*/
init() {
const module = new InstrumentationNodeModuleDefinition(
'@langchain/langgraph',
supportedVersions,
this._patch.bind(this),
exports$1 => exports$1,
[
new InstrumentationNodeModuleFile(
/**
* In CJS, LangGraph packages re-export from dist/index.cjs files.
* Patching only the root module sometimes misses the real implementation or
* gets overwritten when that file is loaded. We add a file-level patch so that
* _patch runs again on the concrete implementation
*/
'@langchain/langgraph/dist/index.cjs',
supportedVersions,
this._patch.bind(this),
exports$1 => exports$1,
),
],
);
return module;
}
/**
* Core patch logic applying instrumentation to the LangGraph module.
*/
_patch(exports$1) {
const client = getClient();
const defaultPii = Boolean(client?.getOptions().sendDefaultPii);
const config = this.getConfig();
const recordInputs = config.recordInputs ?? defaultPii;
const recordOutputs = config.recordOutputs ?? defaultPii;
const options = {
recordInputs,
recordOutputs,
};
// Patch StateGraph.compile to instrument both compile() and invoke()
if (exports$1.StateGraph && typeof exports$1.StateGraph === 'function') {
const StateGraph = exports$1.StateGraph
;
StateGraph.prototype.compile = instrumentStateGraphCompile(
StateGraph.prototype.compile ,
options,
);
}
return exports$1;
}
}
export { SentryLangGraphInstrumentation };
//# sourceMappingURL=instrumentation.js.map