@brizz/sdk 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/{chunk-APOYOP7D.js → chunk-3OMB2F7B.js} +1 -1
- package/dist/{chunk-3IGBYXLR.cjs → chunk-ELLCNMLI.cjs} +4 -4
- package/dist/{chunk-AOT5NJDV.js → chunk-FVVRWMPV.js} +2 -0
- package/dist/{chunk-5WBPX342.cjs → chunk-GMZQ6N77.cjs} +3 -1
- package/dist/{chunk-V727EJE5.js → chunk-HTFR2LKY.js} +2 -2
- package/dist/{chunk-EWT4TUB7.cjs → chunk-VAUO47L3.cjs} +8 -8
- package/dist/index.cjs +234 -153
- package/dist/index.js +108 -27
- package/dist/{interrupt-A6O7N72X.js → interrupt-YO3ID433.js} +2 -2
- package/dist/interrupt-YQHEXVES.cjs +12 -0
- package/dist/{mcp-3FOEDOF2.cjs → mcp-FWGIYACB.cjs} +12 -12
- package/dist/{mcp-GANFYW4J.js → mcp-LIAXZGBN.js} +2 -2
- package/dist/types/cjs/internal/instrumentation/langgraph/attributes.d.ts +1 -0
- package/dist/types/cjs/internal/instrumentation/langgraph/index.d.ts +1 -1
- package/dist/types/cjs/internal/instrumentation/langgraph/instrumentation.d.ts +1 -0
- package/dist/types/cjs/internal/semantic-conventions.d.ts +1 -0
- package/dist/types/cjs/internal/trace/session.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/langgraph/attributes.d.ts +1 -0
- package/dist/types/esm/internal/instrumentation/langgraph/index.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/langgraph/instrumentation.d.ts +1 -0
- package/dist/types/esm/internal/semantic-conventions.d.ts +1 -0
- package/dist/types/esm/internal/trace/session.d.ts +2 -0
- package/package.json +3 -2
- package/dist/interrupt-IKOUBQGN.cjs +0 -12
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
configure,
|
|
7
7
|
getSDKVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HTFR2LKY.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_LOG_LEVEL,
|
|
11
11
|
LogLevel,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "./chunk-Y4HNUX3Q.js";
|
|
17
17
|
import {
|
|
18
18
|
InterruptPropagator
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3OMB2F7B.js";
|
|
20
20
|
import {
|
|
21
21
|
AGENT_ID,
|
|
22
22
|
AGENT_NAME,
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
METRIC_POLARITY_NEGATIVE,
|
|
46
46
|
METRIC_POLARITY_POSITIVE,
|
|
47
47
|
METRIC_TIMESTAMP,
|
|
48
|
+
METRIC_TRACE_ID,
|
|
48
49
|
METRIC_UNIT,
|
|
49
50
|
METRIC_VALUE,
|
|
50
51
|
MUTE_INPUT,
|
|
@@ -73,7 +74,7 @@ import {
|
|
|
73
74
|
USER_NAME,
|
|
74
75
|
USER_PLAN,
|
|
75
76
|
USER_ROLE
|
|
76
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-FVVRWMPV.js";
|
|
77
78
|
import {
|
|
78
79
|
__require
|
|
79
80
|
} from "./chunk-3RG5ZIWI.js";
|
|
@@ -91,6 +92,7 @@ import { QdrantInstrumentation } from "@traceloop/instrumentation-qdrant";
|
|
|
91
92
|
import { TogetherInstrumentation } from "@traceloop/instrumentation-together";
|
|
92
93
|
|
|
93
94
|
// src/internal/instrumentation/langgraph/instrumentation.ts
|
|
95
|
+
import { createRequire } from "module";
|
|
94
96
|
import { SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
|
|
95
97
|
import {
|
|
96
98
|
InstrumentationBase,
|
|
@@ -102,6 +104,13 @@ var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
|
102
104
|
var INSTRUMENTATION_VERSION = getSDKVersion();
|
|
103
105
|
var MODULE_NAME = "@langchain/langgraph";
|
|
104
106
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
107
|
+
function isSupportedVersion(version) {
|
|
108
|
+
const [major, minor] = version.split(".").map(Number);
|
|
109
|
+
if (major === void 0 || minor === void 0 || Number.isNaN(major) || Number.isNaN(minor)) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return major === 1 || major === 0 && minor >= 2;
|
|
113
|
+
}
|
|
105
114
|
var CHECKPOINT_SPAN_NAME = "brizz.langgraph.checkpoint";
|
|
106
115
|
var ATTR_CHECKPOINT_PARENT_ID = "brizz.checkpoint_parent_id";
|
|
107
116
|
var ATTR_CHECKPOINT_ID = "brizz.checkpoint_id";
|
|
@@ -180,7 +189,8 @@ var LangGraphInstrumentation = class extends InstrumentationBase {
|
|
|
180
189
|
* Patch a LangGraph module the caller already imported.
|
|
181
190
|
*
|
|
182
191
|
* The module-load hook above only fires for CommonJS requires, so an ESM or
|
|
183
|
-
* bundled consumer reaches the instrumentation through here —
|
|
192
|
+
* bundled consumer reaches the instrumentation through here — from
|
|
193
|
+
* `patchInstalledLangGraph`, or from
|
|
184
194
|
* `Brizz.initialize({ instrumentModules: { langgraph } })`. Accepts either
|
|
185
195
|
* the package root or its `pregel` subpath.
|
|
186
196
|
*/
|
|
@@ -198,6 +208,43 @@ var LangGraphInstrumentation = class extends InstrumentationBase {
|
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
};
|
|
211
|
+
function patchInstalledLangGraph() {
|
|
212
|
+
let requireFromSdk;
|
|
213
|
+
let version;
|
|
214
|
+
try {
|
|
215
|
+
requireFromSdk = createRequire(import.meta.url);
|
|
216
|
+
version = requireFromSdk(`${MODULE_NAME}/package.json`).version;
|
|
217
|
+
} catch (error) {
|
|
218
|
+
logger.debug(`LangGraph not resolved, not patched: ${String(error)}`);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (!isSupportedVersion(version)) {
|
|
222
|
+
logger.debug(`LangGraph ${version} is outside ${SUPPORTED_VERSIONS.join(" ")}, not patched`);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
let instrumentation;
|
|
226
|
+
try {
|
|
227
|
+
instrumentation = new LangGraphInstrumentation({ enabled: false });
|
|
228
|
+
} catch (error) {
|
|
229
|
+
logger.debug(`LangGraph instrumentation not constructed: ${String(error)}`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const loaded = requireFromSdk.cache[requireFromSdk.resolve(MODULE_NAME)];
|
|
234
|
+
if (loaded) {
|
|
235
|
+
instrumentation.manuallyInstrument(loaded.exports);
|
|
236
|
+
}
|
|
237
|
+
} catch (error) {
|
|
238
|
+
logger.debug(`LangGraph CJS build not patched: ${String(error)}`);
|
|
239
|
+
}
|
|
240
|
+
void (async () => {
|
|
241
|
+
try {
|
|
242
|
+
instrumentation.manuallyInstrument(await import("@langchain/langgraph"));
|
|
243
|
+
} catch (error) {
|
|
244
|
+
logger.debug(`LangGraph not patched: ${String(error)}`);
|
|
245
|
+
}
|
|
246
|
+
})();
|
|
247
|
+
}
|
|
201
248
|
function patchPregelStream(proto, getTracer) {
|
|
202
249
|
const target = proto;
|
|
203
250
|
if (target[PATCHED_FLAG]) {
|
|
@@ -418,7 +465,7 @@ function loadGenAIInstrumentations() {
|
|
|
418
465
|
function loadMCPInstrumentation() {
|
|
419
466
|
void (async () => {
|
|
420
467
|
try {
|
|
421
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
468
|
+
const { MCPInstrumentation } = await import("./mcp-LIAXZGBN.js");
|
|
422
469
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
423
470
|
registerInstrumentations({ instrumentations: [mcp] });
|
|
424
471
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -482,7 +529,7 @@ function loadVercelAITelemetry() {
|
|
|
482
529
|
}
|
|
483
530
|
const isV7 = typeof ai.registerTelemetry === "function";
|
|
484
531
|
const integrations = [];
|
|
485
|
-
const { createInterruptIntegration } = await import("./interrupt-
|
|
532
|
+
const { createInterruptIntegration } = await import("./interrupt-YO3ID433.js");
|
|
486
533
|
integrations.push(createInterruptIntegration());
|
|
487
534
|
let otelCollectorLoaded = false;
|
|
488
535
|
try {
|
|
@@ -693,7 +740,7 @@ import { QdrantInstrumentation as QdrantInstrumentation2 } from "@traceloop/inst
|
|
|
693
740
|
import { TogetherInstrumentation as TogetherInstrumentation2 } from "@traceloop/instrumentation-together";
|
|
694
741
|
|
|
695
742
|
// src/internal/instrumentation/langchain.ts
|
|
696
|
-
import { createRequire } from "module";
|
|
743
|
+
import { createRequire as createRequire2 } from "module";
|
|
697
744
|
import { context as context2 } from "@opentelemetry/api";
|
|
698
745
|
var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
|
|
699
746
|
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
|
|
@@ -753,7 +800,7 @@ function patchInstalledCallbackManager() {
|
|
|
753
800
|
logger.debug(`LangChain callback manager not patched: ${String(error)}`);
|
|
754
801
|
}
|
|
755
802
|
try {
|
|
756
|
-
const requireFromSdk =
|
|
803
|
+
const requireFromSdk = createRequire2(import.meta.url);
|
|
757
804
|
patchCallbackManagerModule(requireFromSdk("@langchain/core/callbacks/manager"));
|
|
758
805
|
} catch (error) {
|
|
759
806
|
logger.debug(`LangChain CJS callback manager not patched: ${String(error)}`);
|
|
@@ -914,7 +961,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
914
961
|
const mcpModules = this.manualModules.mcp;
|
|
915
962
|
void (async () => {
|
|
916
963
|
try {
|
|
917
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
964
|
+
const { MCPInstrumentation } = await import("./mcp-LIAXZGBN.js");
|
|
918
965
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
919
966
|
instrumentation.manuallyInstrument(mcpModules);
|
|
920
967
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1059,22 +1106,23 @@ function setSessionId(id) {
|
|
|
1059
1106
|
propagatePropertiesImperatively(properties);
|
|
1060
1107
|
}
|
|
1061
1108
|
var SERVICE_NAME_MAX_BYTES = 256;
|
|
1062
|
-
function
|
|
1109
|
+
function serviceNameProblem(name) {
|
|
1063
1110
|
if (typeof name !== "string" || name === "") {
|
|
1064
|
-
|
|
1065
|
-
return {};
|
|
1111
|
+
return "must be a non-empty string";
|
|
1066
1112
|
}
|
|
1067
1113
|
if (/[\r\n\0]/.test(name)) {
|
|
1068
|
-
|
|
1069
|
-
`Service name ${JSON.stringify(name)} contains CR, LF, or NUL; keeping the configured appName.`
|
|
1070
|
-
);
|
|
1071
|
-
return {};
|
|
1114
|
+
return `${JSON.stringify(name)} contains CR, LF, or NUL`;
|
|
1072
1115
|
}
|
|
1073
1116
|
const byteLength = new globalThis.TextEncoder().encode(name).length;
|
|
1074
1117
|
if (byteLength > SERVICE_NAME_MAX_BYTES) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1118
|
+
return `is ${byteLength} bytes, over the ${SERVICE_NAME_MAX_BYTES}-byte limit`;
|
|
1119
|
+
}
|
|
1120
|
+
return void 0;
|
|
1121
|
+
}
|
|
1122
|
+
function serviceNameProperties(name) {
|
|
1123
|
+
const problem = serviceNameProblem(name);
|
|
1124
|
+
if (problem !== void 0) {
|
|
1125
|
+
logger.warn(`Service name ${problem}; keeping the configured appName.`);
|
|
1078
1126
|
return {};
|
|
1079
1127
|
}
|
|
1080
1128
|
return { [SERVICE_NAME]: name };
|
|
@@ -1457,6 +1505,13 @@ function recordMetricImpl(options) {
|
|
|
1457
1505
|
);
|
|
1458
1506
|
return;
|
|
1459
1507
|
}
|
|
1508
|
+
if (options.serviceName !== void 0) {
|
|
1509
|
+
const problem = serviceNameProblem(options.serviceName);
|
|
1510
|
+
if (problem !== void 0) {
|
|
1511
|
+
logger.warn(`recordMetric(${name}) service name ${problem}; metric dropped.`);
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1460
1515
|
const eventAttributes = {
|
|
1461
1516
|
[METRIC_NAME]: name,
|
|
1462
1517
|
[METRIC_VALUE]: numericValue
|
|
@@ -1526,16 +1581,32 @@ function recordMetricImpl(options) {
|
|
|
1526
1581
|
accepted += 1;
|
|
1527
1582
|
}
|
|
1528
1583
|
}
|
|
1529
|
-
const
|
|
1530
|
-
if (
|
|
1584
|
+
const traceId = typeof options.traceId === "string" && options.traceId !== "" ? options.traceId : void 0;
|
|
1585
|
+
if (traceId !== void 0) {
|
|
1586
|
+
eventAttributes[METRIC_TRACE_ID] = traceId;
|
|
1587
|
+
}
|
|
1588
|
+
const sessionId = options.sessionId ?? (traceId === void 0 ? resolveSessionIdFromContext() : void 0);
|
|
1589
|
+
if (sessionId === void 0 && traceId === void 0) {
|
|
1531
1590
|
logger.warn(
|
|
1532
|
-
`recordMetric(${name}) called with no resolvable session id; the metric cannot be attributed to a conversation and is dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope.`
|
|
1591
|
+
`recordMetric(${name}) called with no resolvable session id or trace id; the metric cannot be attributed to a conversation and is dropped. Pass options.sessionId or options.traceId, or call inside a startSession/callWithSessionId scope.`
|
|
1533
1592
|
);
|
|
1534
1593
|
return;
|
|
1535
1594
|
}
|
|
1595
|
+
const base = context3.active();
|
|
1596
|
+
const ambient = base.getValue(PROPERTIES_CONTEXT_KEY);
|
|
1597
|
+
const properties = { ...ambient };
|
|
1598
|
+
if (sessionId === void 0) {
|
|
1599
|
+
delete properties[SESSION_ID];
|
|
1600
|
+
delete properties[MESSAGE_ID];
|
|
1601
|
+
} else {
|
|
1602
|
+
properties[SESSION_ID] = sessionId;
|
|
1603
|
+
}
|
|
1604
|
+
if (options.serviceName !== void 0) {
|
|
1605
|
+
properties[SERVICE_NAME] = options.serviceName;
|
|
1606
|
+
}
|
|
1536
1607
|
try {
|
|
1537
|
-
|
|
1538
|
-
|
|
1608
|
+
context3.with(
|
|
1609
|
+
base.setValue(PROPERTIES_CONTEXT_KEY, properties),
|
|
1539
1610
|
() => emitEvent(METRIC_EVENT_NAME, eventAttributes)
|
|
1540
1611
|
);
|
|
1541
1612
|
} catch (error) {
|
|
@@ -2161,7 +2232,16 @@ var LoggingModule = class _LoggingModule {
|
|
|
2161
2232
|
createLogExporter(config, serviceName) {
|
|
2162
2233
|
if (config.customLogExporter) {
|
|
2163
2234
|
logger.debug("Using custom log exporter");
|
|
2164
|
-
|
|
2235
|
+
if (serviceName === config.appName) {
|
|
2236
|
+
return config.customLogExporter;
|
|
2237
|
+
}
|
|
2238
|
+
const shared = config.customLogExporter;
|
|
2239
|
+
return {
|
|
2240
|
+
export: (logs, resultCallback) => shared.export(logs, resultCallback),
|
|
2241
|
+
forceFlush: async () => shared.forceFlush(),
|
|
2242
|
+
shutdown: async () => {
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2165
2245
|
}
|
|
2166
2246
|
const logsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/logs";
|
|
2167
2247
|
logger.debug("Initializing default OTLP log exporter", { url: logsUrl, serviceName });
|
|
@@ -2287,12 +2367,12 @@ var LoggingModule = class _LoggingModule {
|
|
|
2287
2367
|
*/
|
|
2288
2368
|
async shutdown() {
|
|
2289
2369
|
logger.debug("Shutting down logging module");
|
|
2370
|
+
await Promise.all([...this.scopedProviders.values()].map(async (p) => p.shutdown()));
|
|
2371
|
+
this.scopedProviders.clear();
|
|
2290
2372
|
if (this.loggerProvider) {
|
|
2291
2373
|
await this.loggerProvider.shutdown();
|
|
2292
2374
|
this.loggerProvider = null;
|
|
2293
2375
|
}
|
|
2294
|
-
await Promise.all([...this.scopedProviders.values()].map(async (p) => p.shutdown()));
|
|
2295
|
-
this.scopedProviders.clear();
|
|
2296
2376
|
this.config = null;
|
|
2297
2377
|
if (_LoggingModule.instance === this) {
|
|
2298
2378
|
_LoggingModule.instance = null;
|
|
@@ -2925,6 +3005,7 @@ var _Brizz = class __Brizz {
|
|
|
2925
3005
|
const registry = InstrumentationRegistry.getInstance();
|
|
2926
3006
|
configure(resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
2927
3007
|
patchInstalledCallbackManager();
|
|
3008
|
+
patchInstalledLangGraph();
|
|
2928
3009
|
if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
|
|
2929
3010
|
registry.setManualModules(options.instrumentModules);
|
|
2930
3011
|
}
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
InterruptPropagator,
|
|
3
3
|
_resetInterruptState,
|
|
4
4
|
createInterruptIntegration
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-3OMB2F7B.js";
|
|
6
|
+
import "./chunk-FVVRWMPV.js";
|
|
7
7
|
import "./chunk-3RG5ZIWI.js";
|
|
8
8
|
export {
|
|
9
9
|
InterruptPropagator,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkELLCNMLIcjs = require('./chunk-ELLCNMLI.cjs');
|
|
6
|
+
require('./chunk-GMZQ6N77.cjs');
|
|
7
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.InterruptPropagator = _chunkELLCNMLIcjs.InterruptPropagator; exports._resetInterruptState = _chunkELLCNMLIcjs._resetInterruptState; exports.createInterruptIntegration = _chunkELLCNMLIcjs.createInterruptIntegration;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkVAUO47L3cjs = require('./chunk-VAUO47L3.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-GMZQ6N77.cjs');
|
|
16
16
|
require('./chunk-OBGZSXTJ.cjs');
|
|
17
17
|
|
|
18
18
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -387,14 +387,14 @@ function wrapOnRequest(original, tracer) {
|
|
|
387
387
|
return original.apply(this, args);
|
|
388
388
|
}
|
|
389
389
|
const method = request.method;
|
|
390
|
-
if (method === METHOD_TOOLS_CALL &&
|
|
390
|
+
if (method === METHOD_TOOLS_CALL && _chunkVAUO47L3cjs.isSessionToolCall.call(void 0, request)) {
|
|
391
391
|
return answerSessionToolCall(this, request, tracer, args, original);
|
|
392
392
|
}
|
|
393
393
|
const handler = _nullishCoalesce(handlers.get(method), () => ( this.fallbackRequestHandler));
|
|
394
394
|
if (!handler) {
|
|
395
395
|
return original.apply(this, args);
|
|
396
396
|
}
|
|
397
|
-
const tracking =
|
|
397
|
+
const tracking = _chunkVAUO47L3cjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkVAUO47L3cjs.popTrackingArguments.call(void 0, request) : {};
|
|
398
398
|
const started = safeStartServerSpan(tracer, request, this, tracking);
|
|
399
399
|
if (!started) {
|
|
400
400
|
return original.apply(this, args);
|
|
@@ -404,9 +404,9 @@ function wrapOnRequest(original, tracer) {
|
|
|
404
404
|
if (method === METHOD_TOOLS_LIST) {
|
|
405
405
|
hooks.onResult = (result) => {
|
|
406
406
|
let advertised = result;
|
|
407
|
-
if (
|
|
407
|
+
if (_chunkVAUO47L3cjs.isEnabled.call(void 0, )) {
|
|
408
408
|
try {
|
|
409
|
-
advertised =
|
|
409
|
+
advertised = _chunkVAUO47L3cjs.patchListToolsResult.call(void 0, result);
|
|
410
410
|
} catch (error) {
|
|
411
411
|
_chunkWC573FCIcjs.logger.warn(
|
|
412
412
|
`Brizz MCP: failed to patch tools/list schemas: ${String(error)}`
|
|
@@ -417,7 +417,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
417
417
|
try {
|
|
418
418
|
emitSchemaSpansFromListResponse(
|
|
419
419
|
advertised,
|
|
420
|
-
|
|
420
|
+
_chunkVAUO47L3cjs.resolveTransportSessionId.call(void 0, this),
|
|
421
421
|
tracer
|
|
422
422
|
);
|
|
423
423
|
} catch (error) {
|
|
@@ -430,7 +430,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
430
430
|
}
|
|
431
431
|
if (method !== METHOD_TOOLS_CALL) {
|
|
432
432
|
hooks.onError = () => {
|
|
433
|
-
|
|
433
|
+
_chunkVAUO47L3cjs.stampAndPropagateSession.call(void 0, span, _chunkVAUO47L3cjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
const wrappedHandler = (req, extra) => _api.context.with(
|
|
@@ -464,7 +464,7 @@ function answerSessionToolCall(protocol, request, tracer, args, original) {
|
|
|
464
464
|
if (!handlers) {
|
|
465
465
|
return original.apply(protocol, args);
|
|
466
466
|
}
|
|
467
|
-
const { id, result } =
|
|
467
|
+
const { id, result } = _chunkVAUO47L3cjs.sessionToolResult.call(void 0, );
|
|
468
468
|
const started = safeStartServerSpan(tracer, request, protocol, { sessionId: id });
|
|
469
469
|
const handler = () => started ? _api.context.with(started.spanCtx, () => result) : result;
|
|
470
470
|
const hadEntry = handlers.has(METHOD_TOOLS_CALL);
|
|
@@ -554,8 +554,8 @@ function safeStartServerSpan(tracer, request, protocol, tracking = {}) {
|
|
|
554
554
|
parentCtx
|
|
555
555
|
);
|
|
556
556
|
applyServerRequestAttributes(span, request, protocol);
|
|
557
|
-
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => (
|
|
558
|
-
const { context: sessCtx } =
|
|
557
|
+
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkVAUO47L3cjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
|
|
558
|
+
const { context: sessCtx } = _chunkVAUO47L3cjs.stampAndPropagateSession.call(void 0,
|
|
559
559
|
span,
|
|
560
560
|
resolved,
|
|
561
561
|
parentCtx,
|
|
@@ -611,7 +611,7 @@ function safeEnd(span) {
|
|
|
611
611
|
|
|
612
612
|
// src/internal/instrumentation/mcp/version.ts
|
|
613
613
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
614
|
-
var INSTRUMENTATION_VERSION =
|
|
614
|
+
var INSTRUMENTATION_VERSION = _chunkVAUO47L3cjs.getSDKVersion.call(void 0, );
|
|
615
615
|
|
|
616
616
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
617
617
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
resolveTransportSessionId,
|
|
9
9
|
sessionToolResult,
|
|
10
10
|
stampAndPropagateSession
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HTFR2LKY.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
14
14
|
} from "./chunk-Y4HNUX3Q.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-FVVRWMPV.js";
|
|
16
16
|
import "./chunk-3RG5ZIWI.js";
|
|
17
17
|
|
|
18
18
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -2,6 +2,7 @@ export declare const INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
|
2
2
|
export declare const INSTRUMENTATION_VERSION: string;
|
|
3
3
|
export declare const MODULE_NAME = "@langchain/langgraph";
|
|
4
4
|
export declare const SUPPORTED_VERSIONS: string[];
|
|
5
|
+
export declare function isSupportedVersion(version: string): boolean;
|
|
5
6
|
export declare const CHECKPOINT_SPAN_NAME = "brizz.langgraph.checkpoint";
|
|
6
7
|
export declare const ATTR_CHECKPOINT_PARENT_ID = "brizz.checkpoint_parent_id";
|
|
7
8
|
export declare const ATTR_CHECKPOINT_ID = "brizz.checkpoint_id";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { LangGraphInstrumentation } from './instrumentation.js';
|
|
1
|
+
export { LangGraphInstrumentation, patchInstalledLangGraph } from './instrumentation.js';
|
|
@@ -8,4 +8,5 @@ export declare class LangGraphInstrumentation extends InstrumentationBase<Instru
|
|
|
8
8
|
manuallyInstrument(moduleExports: unknown): void;
|
|
9
9
|
private applyPatch;
|
|
10
10
|
}
|
|
11
|
+
export declare function patchInstalledLangGraph(): void;
|
|
11
12
|
export declare function patchPregelStream(proto: IPregelLike, getTracer: () => Tracer): boolean;
|
|
@@ -53,6 +53,7 @@ export declare const METRIC_POLARITY = "brizz.internal.metric.polarity";
|
|
|
53
53
|
export declare const METRIC_MIN = "brizz.internal.metric.min";
|
|
54
54
|
export declare const METRIC_MAX = "brizz.internal.metric.max";
|
|
55
55
|
export declare const METRIC_TIMESTAMP = "brizz.internal.metric.timestamp";
|
|
56
|
+
export declare const METRIC_TRACE_ID = "brizz.internal.metric.trace_id";
|
|
56
57
|
export declare const METRIC_ATTRIBUTE_PREFIX = "brizz.internal.metric.attribute.";
|
|
57
58
|
export declare const RESERVED_METRIC_NAMES: Set<string>;
|
|
58
59
|
export declare const METRIC_POLARITY_POSITIVE = "positive";
|
|
@@ -132,6 +132,8 @@ export declare function recordMetric(options: {
|
|
|
132
132
|
maxValue?: number;
|
|
133
133
|
timestamp?: Date;
|
|
134
134
|
sessionId?: string;
|
|
135
|
+
traceId?: string;
|
|
136
|
+
serviceName?: string;
|
|
135
137
|
}): void;
|
|
136
138
|
export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
|
|
137
139
|
mode?: 'default' | 'title';
|
|
@@ -2,6 +2,7 @@ export declare const INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
|
2
2
|
export declare const INSTRUMENTATION_VERSION: string;
|
|
3
3
|
export declare const MODULE_NAME = "@langchain/langgraph";
|
|
4
4
|
export declare const SUPPORTED_VERSIONS: string[];
|
|
5
|
+
export declare function isSupportedVersion(version: string): boolean;
|
|
5
6
|
export declare const CHECKPOINT_SPAN_NAME = "brizz.langgraph.checkpoint";
|
|
6
7
|
export declare const ATTR_CHECKPOINT_PARENT_ID = "brizz.checkpoint_parent_id";
|
|
7
8
|
export declare const ATTR_CHECKPOINT_ID = "brizz.checkpoint_id";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { LangGraphInstrumentation } from './instrumentation.js';
|
|
1
|
+
export { LangGraphInstrumentation, patchInstalledLangGraph } from './instrumentation.js';
|
|
@@ -8,4 +8,5 @@ export declare class LangGraphInstrumentation extends InstrumentationBase<Instru
|
|
|
8
8
|
manuallyInstrument(moduleExports: unknown): void;
|
|
9
9
|
private applyPatch;
|
|
10
10
|
}
|
|
11
|
+
export declare function patchInstalledLangGraph(): void;
|
|
11
12
|
export declare function patchPregelStream(proto: IPregelLike, getTracer: () => Tracer): boolean;
|
|
@@ -53,6 +53,7 @@ export declare const METRIC_POLARITY = "brizz.internal.metric.polarity";
|
|
|
53
53
|
export declare const METRIC_MIN = "brizz.internal.metric.min";
|
|
54
54
|
export declare const METRIC_MAX = "brizz.internal.metric.max";
|
|
55
55
|
export declare const METRIC_TIMESTAMP = "brizz.internal.metric.timestamp";
|
|
56
|
+
export declare const METRIC_TRACE_ID = "brizz.internal.metric.trace_id";
|
|
56
57
|
export declare const METRIC_ATTRIBUTE_PREFIX = "brizz.internal.metric.attribute.";
|
|
57
58
|
export declare const RESERVED_METRIC_NAMES: Set<string>;
|
|
58
59
|
export declare const METRIC_POLARITY_POSITIVE = "positive";
|
|
@@ -132,6 +132,8 @@ export declare function recordMetric(options: {
|
|
|
132
132
|
maxValue?: number;
|
|
133
133
|
timestamp?: Date;
|
|
134
134
|
sessionId?: string;
|
|
135
|
+
traceId?: string;
|
|
136
|
+
serviceName?: string;
|
|
135
137
|
}): void;
|
|
136
138
|
export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
|
|
137
139
|
mode?: 'default' | 'title';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"prerelease:exit": "changeset pre exit",
|
|
60
60
|
"check:types-package": "attw --pack . --entrypoints . eve google-genai --ignore-rules no-resolution",
|
|
61
61
|
"check:types-consumer": "node scripts/check-consumer-types.mjs",
|
|
62
|
-
"check:types": "pnpm run check:types-package && pnpm run check:types-consumer"
|
|
62
|
+
"check:types": "pnpm run check:types-package && pnpm run check:types-consumer",
|
|
63
|
+
"check:esm-langgraph": "node scripts/check-esm-langgraph.mjs"
|
|
63
64
|
},
|
|
64
65
|
"exports": {
|
|
65
66
|
".": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunk3IGBYXLRcjs = require('./chunk-3IGBYXLR.cjs');
|
|
6
|
-
require('./chunk-5WBPX342.cjs');
|
|
7
|
-
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.InterruptPropagator = _chunk3IGBYXLRcjs.InterruptPropagator; exports._resetInterruptState = _chunk3IGBYXLRcjs._resetInterruptState; exports.createInterruptIntegration = _chunk3IGBYXLRcjs.createInterruptIntegration;
|