@brizz/sdk 0.1.48 → 0.1.50

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.
Files changed (25) hide show
  1. package/README.md +9 -0
  2. package/dist/{chunk-3OMB2F7B.js → chunk-7PRTTYWM.js} +1 -1
  3. package/dist/{chunk-FVVRWMPV.js → chunk-GUKWVI53.js} +7 -1
  4. package/dist/{chunk-ELLCNMLI.cjs → chunk-O2IBZJOJ.cjs} +4 -4
  5. package/dist/{chunk-GMZQ6N77.cjs → chunk-RV7JIIDG.cjs} +7 -1
  6. package/dist/{chunk-L4P4RJT5.js → chunk-STM7QUQP.js} +2 -2
  7. package/dist/{chunk-JDJLJ2V2.cjs → chunk-VH5N6E54.cjs} +8 -8
  8. package/dist/index.cjs +226 -156
  9. package/dist/index.js +80 -10
  10. package/dist/interrupt-BYLSBXTV.cjs +12 -0
  11. package/dist/{interrupt-YO3ID433.js → interrupt-UKJK5WOA.js} +2 -2
  12. package/dist/{mcp-3E34LCRM.cjs → mcp-3URJU7OY.cjs} +12 -12
  13. package/dist/{mcp-RLTZLXHY.js → mcp-AOBKXJND.js} +2 -2
  14. package/dist/types/cjs/internal/instrumentation/langgraph/attributes.d.ts +1 -0
  15. package/dist/types/cjs/internal/instrumentation/langgraph/index.d.ts +1 -1
  16. package/dist/types/cjs/internal/instrumentation/langgraph/instrumentation.d.ts +1 -0
  17. package/dist/types/cjs/internal/semantic-conventions.d.ts +3 -0
  18. package/dist/types/cjs/internal/trace/session.d.ts +1 -0
  19. package/dist/types/esm/internal/instrumentation/langgraph/attributes.d.ts +1 -0
  20. package/dist/types/esm/internal/instrumentation/langgraph/index.d.ts +1 -1
  21. package/dist/types/esm/internal/instrumentation/langgraph/instrumentation.d.ts +1 -0
  22. package/dist/types/esm/internal/semantic-conventions.d.ts +3 -0
  23. package/dist/types/esm/internal/trace/session.d.ts +1 -0
  24. package/package.json +3 -2
  25. package/dist/interrupt-YQHEXVES.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-L4P4RJT5.js";
8
+ } from "./chunk-STM7QUQP.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-3OMB2F7B.js";
19
+ } from "./chunk-7PRTTYWM.js";
20
20
  import {
21
21
  AGENT_ID,
22
22
  AGENT_NAME,
@@ -44,6 +44,9 @@ import {
44
44
  METRIC_POLARITY,
45
45
  METRIC_POLARITY_NEGATIVE,
46
46
  METRIC_POLARITY_POSITIVE,
47
+ METRIC_SCOPE,
48
+ METRIC_SCOPE_SESSION,
49
+ METRIC_SCOPE_TRACE,
47
50
  METRIC_TIMESTAMP,
48
51
  METRIC_TRACE_ID,
49
52
  METRIC_UNIT,
@@ -74,7 +77,7 @@ import {
74
77
  USER_NAME,
75
78
  USER_PLAN,
76
79
  USER_ROLE
77
- } from "./chunk-FVVRWMPV.js";
80
+ } from "./chunk-GUKWVI53.js";
78
81
  import {
79
82
  __require
80
83
  } from "./chunk-3RG5ZIWI.js";
@@ -92,6 +95,7 @@ import { QdrantInstrumentation } from "@traceloop/instrumentation-qdrant";
92
95
  import { TogetherInstrumentation } from "@traceloop/instrumentation-together";
93
96
 
94
97
  // src/internal/instrumentation/langgraph/instrumentation.ts
98
+ import { createRequire } from "module";
95
99
  import { SpanStatusCode, context, createContextKey, trace } from "@opentelemetry/api";
96
100
  import {
97
101
  InstrumentationBase,
@@ -103,6 +107,13 @@ var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
103
107
  var INSTRUMENTATION_VERSION = getSDKVersion();
104
108
  var MODULE_NAME = "@langchain/langgraph";
105
109
  var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
110
+ function isSupportedVersion(version) {
111
+ const [major, minor] = version.split(".").map(Number);
112
+ if (major === void 0 || minor === void 0 || Number.isNaN(major) || Number.isNaN(minor)) {
113
+ return false;
114
+ }
115
+ return major === 1 || major === 0 && minor >= 2;
116
+ }
106
117
  var CHECKPOINT_SPAN_NAME = "brizz.langgraph.checkpoint";
107
118
  var ATTR_CHECKPOINT_PARENT_ID = "brizz.checkpoint_parent_id";
108
119
  var ATTR_CHECKPOINT_ID = "brizz.checkpoint_id";
@@ -181,7 +192,8 @@ var LangGraphInstrumentation = class extends InstrumentationBase {
181
192
  * Patch a LangGraph module the caller already imported.
182
193
  *
183
194
  * The module-load hook above only fires for CommonJS requires, so an ESM or
184
- * bundled consumer reaches the instrumentation through here — via
195
+ * bundled consumer reaches the instrumentation through here — from
196
+ * `patchInstalledLangGraph`, or from
185
197
  * `Brizz.initialize({ instrumentModules: { langgraph } })`. Accepts either
186
198
  * the package root or its `pregel` subpath.
187
199
  */
@@ -199,6 +211,43 @@ var LangGraphInstrumentation = class extends InstrumentationBase {
199
211
  }
200
212
  }
201
213
  };
214
+ function patchInstalledLangGraph() {
215
+ let requireFromSdk;
216
+ let version;
217
+ try {
218
+ requireFromSdk = createRequire(import.meta.url);
219
+ version = requireFromSdk(`${MODULE_NAME}/package.json`).version;
220
+ } catch (error) {
221
+ logger.debug(`LangGraph not resolved, not patched: ${String(error)}`);
222
+ return;
223
+ }
224
+ if (!isSupportedVersion(version)) {
225
+ logger.debug(`LangGraph ${version} is outside ${SUPPORTED_VERSIONS.join(" ")}, not patched`);
226
+ return;
227
+ }
228
+ let instrumentation;
229
+ try {
230
+ instrumentation = new LangGraphInstrumentation({ enabled: false });
231
+ } catch (error) {
232
+ logger.debug(`LangGraph instrumentation not constructed: ${String(error)}`);
233
+ return;
234
+ }
235
+ try {
236
+ const loaded = requireFromSdk.cache[requireFromSdk.resolve(MODULE_NAME)];
237
+ if (loaded) {
238
+ instrumentation.manuallyInstrument(loaded.exports);
239
+ }
240
+ } catch (error) {
241
+ logger.debug(`LangGraph CJS build not patched: ${String(error)}`);
242
+ }
243
+ void (async () => {
244
+ try {
245
+ instrumentation.manuallyInstrument(await import("@langchain/langgraph"));
246
+ } catch (error) {
247
+ logger.debug(`LangGraph not patched: ${String(error)}`);
248
+ }
249
+ })();
250
+ }
202
251
  function patchPregelStream(proto, getTracer) {
203
252
  const target = proto;
204
253
  if (target[PATCHED_FLAG]) {
@@ -419,7 +468,7 @@ function loadGenAIInstrumentations() {
419
468
  function loadMCPInstrumentation() {
420
469
  void (async () => {
421
470
  try {
422
- const { MCPInstrumentation } = await import("./mcp-RLTZLXHY.js");
471
+ const { MCPInstrumentation } = await import("./mcp-AOBKXJND.js");
423
472
  const mcp = new MCPInstrumentation({ exceptionLogger });
424
473
  registerInstrumentations({ instrumentations: [mcp] });
425
474
  logger.debug("Auto-loaded MCP instrumentation");
@@ -483,7 +532,7 @@ function loadVercelAITelemetry() {
483
532
  }
484
533
  const isV7 = typeof ai.registerTelemetry === "function";
485
534
  const integrations = [];
486
- const { createInterruptIntegration } = await import("./interrupt-YO3ID433.js");
535
+ const { createInterruptIntegration } = await import("./interrupt-UKJK5WOA.js");
487
536
  integrations.push(createInterruptIntegration());
488
537
  let otelCollectorLoaded = false;
489
538
  try {
@@ -694,7 +743,7 @@ import { QdrantInstrumentation as QdrantInstrumentation2 } from "@traceloop/inst
694
743
  import { TogetherInstrumentation as TogetherInstrumentation2 } from "@traceloop/instrumentation-together";
695
744
 
696
745
  // src/internal/instrumentation/langchain.ts
697
- import { createRequire } from "module";
746
+ import { createRequire as createRequire2 } from "module";
698
747
  import { context as context2 } from "@opentelemetry/api";
699
748
  var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
700
749
  var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
@@ -754,7 +803,7 @@ function patchInstalledCallbackManager() {
754
803
  logger.debug(`LangChain callback manager not patched: ${String(error)}`);
755
804
  }
756
805
  try {
757
- const requireFromSdk = createRequire(import.meta.url);
806
+ const requireFromSdk = createRequire2(import.meta.url);
758
807
  patchCallbackManagerModule(requireFromSdk("@langchain/core/callbacks/manager"));
759
808
  } catch (error) {
760
809
  logger.debug(`LangChain CJS callback manager not patched: ${String(error)}`);
@@ -915,7 +964,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
915
964
  const mcpModules = this.manualModules.mcp;
916
965
  void (async () => {
917
966
  try {
918
- const { MCPInstrumentation } = await import("./mcp-RLTZLXHY.js");
967
+ const { MCPInstrumentation } = await import("./mcp-AOBKXJND.js");
919
968
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
920
969
  instrumentation.manuallyInstrument(mcpModules);
921
970
  logger.debug("Manual instrumentation enabled for MCP");
@@ -958,7 +1007,7 @@ import { resourceFromAttributes } from "@opentelemetry/resources";
958
1007
  import { LoggerProvider } from "@opentelemetry/sdk-logs";
959
1008
 
960
1009
  // src/internal/trace/session.ts
961
- import { context as context3, trace as trace2, SpanStatusCode as SpanStatusCode2 } from "@opentelemetry/api";
1010
+ import { context as context3, isSpanContextValid, trace as trace2, SpanStatusCode as SpanStatusCode2 } from "@opentelemetry/api";
962
1011
  function setCurrentSpanCustomProperties(properties) {
963
1012
  const current = trace2.getActiveSpan();
964
1013
  if (!current || !current.isRecording()) {
@@ -1466,10 +1515,20 @@ function recordMetricImpl(options) {
1466
1515
  return;
1467
1516
  }
1468
1517
  }
1518
+ const scope = options.scope ?? METRIC_SCOPE_SESSION;
1519
+ if (scope !== METRIC_SCOPE_SESSION && scope !== METRIC_SCOPE_TRACE) {
1520
+ logger.warn(
1521
+ `recordMetric(${name}) called with an invalid scope ${JSON.stringify(scope)}; expected '${METRIC_SCOPE_SESSION}' or '${METRIC_SCOPE_TRACE}'. Metric dropped.`
1522
+ );
1523
+ return;
1524
+ }
1469
1525
  const eventAttributes = {
1470
1526
  [METRIC_NAME]: name,
1471
1527
  [METRIC_VALUE]: numericValue
1472
1528
  };
1529
+ if (options.scope !== void 0) {
1530
+ eventAttributes[METRIC_SCOPE] = scope;
1531
+ }
1473
1532
  if (options.unit !== void 0) {
1474
1533
  eventAttributes[METRIC_UNIT] = options.unit;
1475
1534
  }
@@ -1539,6 +1598,16 @@ function recordMetricImpl(options) {
1539
1598
  if (traceId !== void 0) {
1540
1599
  eventAttributes[METRIC_TRACE_ID] = traceId;
1541
1600
  }
1601
+ if (scope === METRIC_SCOPE_TRACE && traceId === void 0) {
1602
+ const spanContext = trace2.getActiveSpan()?.spanContext();
1603
+ if (!spanContext || !isSpanContextValid(spanContext)) {
1604
+ logger.warn(
1605
+ `recordMetric(${name}) called with scope 'trace' but no trace; metric dropped. Pass options.traceId, or call inside the span of the trace being scored.`
1606
+ );
1607
+ return;
1608
+ }
1609
+ eventAttributes[METRIC_TRACE_ID] = spanContext.traceId;
1610
+ }
1542
1611
  const sessionId = options.sessionId ?? (traceId === void 0 ? resolveSessionIdFromContext() : void 0);
1543
1612
  if (sessionId === void 0 && traceId === void 0) {
1544
1613
  logger.warn(
@@ -2959,6 +3028,7 @@ var _Brizz = class __Brizz {
2959
3028
  const registry = InstrumentationRegistry.getInstance();
2960
3029
  configure(resolveMcpSessionTracking(options.mcpSessionTracking));
2961
3030
  patchInstalledCallbackManager();
3031
+ patchInstalledLangGraph();
2962
3032
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
2963
3033
  registry.setManualModules(options.instrumentModules);
2964
3034
  }
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkO2IBZJOJcjs = require('./chunk-O2IBZJOJ.cjs');
6
+ require('./chunk-RV7JIIDG.cjs');
7
+ require('./chunk-OBGZSXTJ.cjs');
8
+
9
+
10
+
11
+
12
+ exports.InterruptPropagator = _chunkO2IBZJOJcjs.InterruptPropagator; exports._resetInterruptState = _chunkO2IBZJOJcjs._resetInterruptState; exports.createInterruptIntegration = _chunkO2IBZJOJcjs.createInterruptIntegration;
@@ -2,8 +2,8 @@ import {
2
2
  InterruptPropagator,
3
3
  _resetInterruptState,
4
4
  createInterruptIntegration
5
- } from "./chunk-3OMB2F7B.js";
6
- import "./chunk-FVVRWMPV.js";
5
+ } from "./chunk-7PRTTYWM.js";
6
+ import "./chunk-GUKWVI53.js";
7
7
  import "./chunk-3RG5ZIWI.js";
8
8
  export {
9
9
  InterruptPropagator,
@@ -8,11 +8,11 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkJDJLJ2V2cjs = require('./chunk-JDJLJ2V2.cjs');
11
+ var _chunkVH5N6E54cjs = require('./chunk-VH5N6E54.cjs');
12
12
 
13
13
 
14
14
  var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
15
- require('./chunk-GMZQ6N77.cjs');
15
+ require('./chunk-RV7JIIDG.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 && _chunkJDJLJ2V2cjs.isSessionToolCall.call(void 0, request)) {
390
+ if (method === METHOD_TOOLS_CALL && _chunkVH5N6E54cjs.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 = _chunkJDJLJ2V2cjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkJDJLJ2V2cjs.popTrackingArguments.call(void 0, request) : {};
397
+ const tracking = _chunkVH5N6E54cjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkVH5N6E54cjs.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 (_chunkJDJLJ2V2cjs.isEnabled.call(void 0, )) {
407
+ if (_chunkVH5N6E54cjs.isEnabled.call(void 0, )) {
408
408
  try {
409
- advertised = _chunkJDJLJ2V2cjs.patchListToolsResult.call(void 0, result);
409
+ advertised = _chunkVH5N6E54cjs.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
- _chunkJDJLJ2V2cjs.resolveTransportSessionId.call(void 0, this),
420
+ _chunkVH5N6E54cjs.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
- _chunkJDJLJ2V2cjs.stampAndPropagateSession.call(void 0, span, _chunkJDJLJ2V2cjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
433
+ _chunkVH5N6E54cjs.stampAndPropagateSession.call(void 0, span, _chunkVH5N6E54cjs.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 } = _chunkJDJLJ2V2cjs.sessionToolResult.call(void 0, );
467
+ const { id, result } = _chunkVH5N6E54cjs.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, () => ( _chunkJDJLJ2V2cjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
558
- const { context: sessCtx } = _chunkJDJLJ2V2cjs.stampAndPropagateSession.call(void 0,
557
+ const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkVH5N6E54cjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
558
+ const { context: sessCtx } = _chunkVH5N6E54cjs.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 = _chunkJDJLJ2V2cjs.getSDKVersion.call(void 0, );
614
+ var INSTRUMENTATION_VERSION = _chunkVH5N6E54cjs.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-L4P4RJT5.js";
11
+ } from "./chunk-STM7QUQP.js";
12
12
  import {
13
13
  logger
14
14
  } from "./chunk-Y4HNUX3Q.js";
15
- import "./chunk-FVVRWMPV.js";
15
+ import "./chunk-GUKWVI53.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;
@@ -54,7 +54,10 @@ 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
56
  export declare const METRIC_TRACE_ID = "brizz.internal.metric.trace_id";
57
+ export declare const METRIC_SCOPE = "brizz.internal.metric.scope";
57
58
  export declare const METRIC_ATTRIBUTE_PREFIX = "brizz.internal.metric.attribute.";
58
59
  export declare const RESERVED_METRIC_NAMES: Set<string>;
59
60
  export declare const METRIC_POLARITY_POSITIVE = "positive";
60
61
  export declare const METRIC_POLARITY_NEGATIVE = "negative";
62
+ export declare const METRIC_SCOPE_SESSION = "session";
63
+ export declare const METRIC_SCOPE_TRACE = "trace";
@@ -134,6 +134,7 @@ export declare function recordMetric(options: {
134
134
  sessionId?: string;
135
135
  traceId?: string;
136
136
  serviceName?: string;
137
+ scope?: 'session' | 'trace';
137
138
  }): void;
138
139
  export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
139
140
  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;
@@ -54,7 +54,10 @@ 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
56
  export declare const METRIC_TRACE_ID = "brizz.internal.metric.trace_id";
57
+ export declare const METRIC_SCOPE = "brizz.internal.metric.scope";
57
58
  export declare const METRIC_ATTRIBUTE_PREFIX = "brizz.internal.metric.attribute.";
58
59
  export declare const RESERVED_METRIC_NAMES: Set<string>;
59
60
  export declare const METRIC_POLARITY_POSITIVE = "positive";
60
61
  export declare const METRIC_POLARITY_NEGATIVE = "negative";
62
+ export declare const METRIC_SCOPE_SESSION = "session";
63
+ export declare const METRIC_SCOPE_TRACE = "trace";
@@ -134,6 +134,7 @@ export declare function recordMetric(options: {
134
134
  sessionId?: string;
135
135
  traceId?: string;
136
136
  serviceName?: string;
137
+ scope?: 'session' | 'trace';
137
138
  }): void;
138
139
  export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
139
140
  mode?: 'default' | 'title';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
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 _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;