@brizz/sdk 0.1.54 → 0.1.56
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 +1 -1
- package/dist/{chunk-MLMF2O5P.js → chunk-AWYGZM6I.js} +1 -1
- package/dist/{chunk-YGLDHCWC.js → chunk-B5IY6O4N.js} +1 -1
- package/dist/{chunk-VZJNEST4.cjs → chunk-DC2MFO65.cjs} +15 -1
- package/dist/{chunk-FQBVTIBR.cjs → chunk-RD4XCYKT.cjs} +2 -2
- package/dist/{chunk-DBN4NKIG.js → chunk-TDPQDITP.js} +15 -1
- package/dist/{chunk-KGNFUQ6Z.cjs → chunk-VY6GEZSP.cjs} +1 -1
- package/dist/{google-genai-PERR37LR.js → google-genai-3ERJNC7Q.js} +2 -2
- package/dist/google-genai-GVCKSJMR.cjs +11 -0
- package/dist/google-genai.cjs +3 -3
- package/dist/google-genai.js +2 -2
- package/dist/index.cjs +149 -111
- package/dist/index.js +54 -16
- package/dist/{mcp-KU7MFTOB.js → mcp-WIKXDZIJ.js} +2 -2
- package/dist/{mcp-4M4XL46N.cjs → mcp-YFR4MUPD.cjs} +17 -17
- package/dist/types/cjs/index.d.ts +2 -2
- package/dist/types/cjs/internal/config.d.ts +1 -1
- package/dist/types/cjs/internal/instrumentation/langchain.d.ts +1 -1
- package/dist/types/cjs/internal/instrumentation/vercel-ai/interrupt.d.ts +1 -1
- package/dist/types/cjs/internal/log/logging.d.ts +5 -5
- package/dist/types/cjs/internal/log/processors/log-processor.d.ts +4 -4
- package/dist/types/cjs/internal/sdk.d.ts +1 -1
- package/dist/types/cjs/internal/trace/exporters/eve-trace-exporter.d.ts +1 -1
- package/dist/types/cjs/internal/trace/exporters/span-exporter.d.ts +1 -1
- package/dist/types/cjs/internal/trace/processors/eve-session-processor.d.ts +1 -1
- package/dist/types/cjs/internal/trace/processors/span-processor.d.ts +1 -1
- package/dist/types/cjs/internal/trace/provider.d.ts +1 -0
- package/dist/types/cjs/internal/trace/tracing.d.ts +2 -2
- package/dist/types/esm/index.d.ts +2 -2
- package/dist/types/esm/internal/config.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/langchain.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/vercel-ai/interrupt.d.ts +1 -1
- package/dist/types/esm/internal/log/logging.d.ts +5 -5
- package/dist/types/esm/internal/log/processors/log-processor.d.ts +4 -4
- package/dist/types/esm/internal/sdk.d.ts +1 -1
- package/dist/types/esm/internal/trace/exporters/eve-trace-exporter.d.ts +1 -1
- package/dist/types/esm/internal/trace/exporters/span-exporter.d.ts +1 -1
- package/dist/types/esm/internal/trace/processors/eve-session-processor.d.ts +1 -1
- package/dist/types/esm/internal/trace/processors/span-processor.d.ts +1 -1
- package/dist/types/esm/internal/trace/provider.d.ts +1 -0
- package/dist/types/esm/internal/trace/tracing.d.ts +2 -2
- package/package.json +29 -31
- package/dist/google-genai-44O4QORJ.cjs +0 -11
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkVY6GEZSPcjs = require('./chunk-VY6GEZSP.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -14,7 +14,8 @@ var _chunkKGNFUQ6Zcjs = require('./chunk-KGNFUQ6Z.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
var _chunkDC2MFO65cjs = require('./chunk-DC2MFO65.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
@@ -112,7 +113,7 @@ var _api = require('@opentelemetry/api');
|
|
|
112
113
|
|
|
113
114
|
// src/internal/instrumentation/langgraph/attributes.ts
|
|
114
115
|
var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
115
|
-
var INSTRUMENTATION_VERSION =
|
|
116
|
+
var INSTRUMENTATION_VERSION = _chunkVY6GEZSPcjs.getSDKVersion.call(void 0, );
|
|
116
117
|
var MODULE_NAME = "@langchain/langgraph";
|
|
117
118
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
118
119
|
function isSupportedVersion(version) {
|
|
@@ -182,7 +183,7 @@ var parentRecorded = /* @__PURE__ */ new WeakSet();
|
|
|
182
183
|
var LangGraphInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
183
184
|
constructor(config = {}) {
|
|
184
185
|
super(INSTRUMENTATION_NAME, INSTRUMENTATION_VERSION, config);
|
|
185
|
-
this.setTracerProvider(
|
|
186
|
+
this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
|
|
186
187
|
}
|
|
187
188
|
init() {
|
|
188
189
|
return [
|
|
@@ -439,7 +440,7 @@ function attachRunToIteration(stream, run) {
|
|
|
439
440
|
var _openinferenceinstrumentationopenai = require('@arizeai/openinference-instrumentation-openai');
|
|
440
441
|
var BrizzOpenAIInstrumentation = class extends _openinferenceinstrumentationopenai.OpenAIInstrumentation {
|
|
441
442
|
get tracer() {
|
|
442
|
-
return
|
|
443
|
+
return _chunkDC2MFO65cjs.brizzTracerProvider.getTracer(this.instrumentationName, this.instrumentationVersion);
|
|
443
444
|
}
|
|
444
445
|
};
|
|
445
446
|
|
|
@@ -468,8 +469,8 @@ var ATTR_ANSWERS = "typesafe.answers";
|
|
|
468
469
|
var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
|
|
469
470
|
var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
470
471
|
constructor(config = {}) {
|
|
471
|
-
super(INSTRUMENTATION_NAME2,
|
|
472
|
-
this.setTracerProvider(
|
|
472
|
+
super(INSTRUMENTATION_NAME2, _chunkVY6GEZSPcjs.getSDKVersion.call(void 0, ), config);
|
|
473
|
+
this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
|
|
473
474
|
}
|
|
474
475
|
init() {
|
|
475
476
|
return [
|
|
@@ -687,7 +688,7 @@ function loadGenAIInstrumentations() {
|
|
|
687
688
|
}
|
|
688
689
|
}
|
|
689
690
|
try {
|
|
690
|
-
_instrumentation.registerInstrumentations.call(void 0, { instrumentations, tracerProvider:
|
|
691
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations, tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
|
|
691
692
|
_chunkWC573FCIcjs.logger.info(`Auto-registered ${instrumentations.length} GenAI instrumentations`);
|
|
692
693
|
} catch (error) {
|
|
693
694
|
_chunkWC573FCIcjs.logger.error(`Failed to register GenAI instrumentations: ${String(error)}`);
|
|
@@ -697,9 +698,9 @@ function loadGenAIInstrumentations() {
|
|
|
697
698
|
function loadMCPInstrumentation() {
|
|
698
699
|
void (async () => {
|
|
699
700
|
try {
|
|
700
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
701
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-YFR4MUPD.cjs")));
|
|
701
702
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
702
|
-
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider:
|
|
703
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
|
|
703
704
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
704
705
|
} catch (error) {
|
|
705
706
|
_chunkWC573FCIcjs.logger.debug(
|
|
@@ -712,7 +713,7 @@ function loadLangGraphInstrumentation() {
|
|
|
712
713
|
try {
|
|
713
714
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
714
715
|
instrumentations: [new LangGraphInstrumentation()],
|
|
715
|
-
tracerProvider:
|
|
716
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
716
717
|
});
|
|
717
718
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded LangGraph instrumentation");
|
|
718
719
|
} catch (error) {
|
|
@@ -723,7 +724,7 @@ function loadTypeSafeInstrumentation() {
|
|
|
723
724
|
try {
|
|
724
725
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
725
726
|
instrumentations: [new TypeSafeInstrumentation()],
|
|
726
|
-
tracerProvider:
|
|
727
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
727
728
|
});
|
|
728
729
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
|
|
729
730
|
} catch (error) {
|
|
@@ -737,7 +738,7 @@ function loadVertexAIInstrumentation() {
|
|
|
737
738
|
const vertexAI = new VertexAIInstrumentation({ exceptionLogger });
|
|
738
739
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
739
740
|
instrumentations: [vertexAI],
|
|
740
|
-
tracerProvider:
|
|
741
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
741
742
|
});
|
|
742
743
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded Vertex AI instrumentation");
|
|
743
744
|
} catch (error) {
|
|
@@ -750,11 +751,11 @@ function loadVertexAIInstrumentation() {
|
|
|
750
751
|
function loadGoogleGenAIInstrumentation() {
|
|
751
752
|
void (async () => {
|
|
752
753
|
try {
|
|
753
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
754
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-GVCKSJMR.cjs")));
|
|
754
755
|
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
755
756
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
756
757
|
instrumentations: [googleGenAI],
|
|
757
|
-
tracerProvider:
|
|
758
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
758
759
|
});
|
|
759
760
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
760
761
|
} catch (error) {
|
|
@@ -788,7 +789,7 @@ function loadVercelAITelemetry() {
|
|
|
788
789
|
const otel = await Promise.resolve().then(() => _interopRequireWildcard(require("@ai-sdk/otel")));
|
|
789
790
|
if (typeof otel.LegacyOpenTelemetry === "function") {
|
|
790
791
|
integrations.push(
|
|
791
|
-
new otel.LegacyOpenTelemetry({ tracer:
|
|
792
|
+
new otel.LegacyOpenTelemetry({ tracer: _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("ai") })
|
|
792
793
|
);
|
|
793
794
|
otelCollectorLoaded = true;
|
|
794
795
|
}
|
|
@@ -843,8 +844,8 @@ var autoInstrumentationsLoaded = autoInitializeInstrumentations();
|
|
|
843
844
|
|
|
844
845
|
var _resources2 = require('@opentelemetry/resources');
|
|
845
846
|
var _sdkmetrics = require('@opentelemetry/sdk-metrics');
|
|
846
|
-
var
|
|
847
|
-
|
|
847
|
+
var _sdktrace = require('@opentelemetry/sdk-trace');
|
|
848
|
+
|
|
848
849
|
|
|
849
850
|
// src/internal/config.ts
|
|
850
851
|
function parseBoolEnv(name) {
|
|
@@ -1013,6 +1014,8 @@ var SDK_LANGUAGE = "typescript";
|
|
|
1013
1014
|
|
|
1014
1015
|
var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
|
|
1015
1016
|
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
|
|
1017
|
+
var TRACER_PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.tracerPatched");
|
|
1018
|
+
var runContexts = /* @__PURE__ */ new WeakMap();
|
|
1016
1019
|
var OMITTED_KEYS = /* @__PURE__ */ new Set([
|
|
1017
1020
|
_chunkRV7JIIDGcjs.USER_EMAIL,
|
|
1018
1021
|
_chunkRV7JIIDGcjs.USER_NAME,
|
|
@@ -1059,15 +1062,50 @@ function patchCallbackManagerModule(module2) {
|
|
|
1059
1062
|
}
|
|
1060
1063
|
} catch (e2) {
|
|
1061
1064
|
}
|
|
1065
|
+
_optionalChain([manager, 'optionalAccess', _32 => _32.handlers, 'optionalAccess', _33 => _33.forEach, 'call', _34 => _34((handler) => {
|
|
1066
|
+
try {
|
|
1067
|
+
patchTracer(handler);
|
|
1068
|
+
} catch (e3) {
|
|
1069
|
+
}
|
|
1070
|
+
})]);
|
|
1062
1071
|
return manager;
|
|
1063
1072
|
};
|
|
1064
1073
|
patchToolStart(statics["prototype"]);
|
|
1065
1074
|
statics[PATCHED_MARKER] = true;
|
|
1066
1075
|
return true;
|
|
1067
1076
|
}
|
|
1077
|
+
function patchTracer(handler) {
|
|
1078
|
+
const tracer = handler;
|
|
1079
|
+
if (typeof tracer !== "object" || tracer === null || tracer[TRACER_PATCHED_MARKER] === true) {
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
const addRunToRunMap = tracer["_addRunToRunMap"];
|
|
1083
|
+
const onRunCreate = tracer["onRunCreate"];
|
|
1084
|
+
const endTrace = tracer["_endTrace"];
|
|
1085
|
+
if (typeof addRunToRunMap !== "function" || typeof onRunCreate !== "function" || typeof endTrace !== "function") {
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
tracer[TRACER_PATCHED_MARKER] = true;
|
|
1089
|
+
tracer["onRunCreate"] = inRunContext(onRunCreate);
|
|
1090
|
+
tracer["_endTrace"] = inRunContext(endTrace);
|
|
1091
|
+
const addRun = addRunToRunMap;
|
|
1092
|
+
tracer["_addRunToRunMap"] = function(...args) {
|
|
1093
|
+
const run = addRun.apply(this, args);
|
|
1094
|
+
if (typeof run === "object" && run !== null) {
|
|
1095
|
+
runContexts.set(run, _api.context.active());
|
|
1096
|
+
}
|
|
1097
|
+
return run;
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function inRunContext(method) {
|
|
1101
|
+
return function(...args) {
|
|
1102
|
+
const runContext = runContexts.get(args[0]);
|
|
1103
|
+
return runContext ? _api.context.with(runContext, () => method.apply(this, args)) : method.apply(this, args);
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1068
1106
|
function patchToolStart(prototype) {
|
|
1069
1107
|
const proto = prototype;
|
|
1070
|
-
const original = _optionalChain([proto, 'optionalAccess',
|
|
1108
|
+
const original = _optionalChain([proto, 'optionalAccess', _35 => _35["handleToolStart"]]);
|
|
1071
1109
|
if (!proto || typeof original !== "function") {
|
|
1072
1110
|
return;
|
|
1073
1111
|
}
|
|
@@ -1082,7 +1120,7 @@ function patchToolStart(prototype) {
|
|
|
1082
1120
|
delete rest[TOOL_CALL_ID_METADATA_KEY];
|
|
1083
1121
|
this.metadata = rest;
|
|
1084
1122
|
}
|
|
1085
|
-
} catch (
|
|
1123
|
+
} catch (e4) {
|
|
1086
1124
|
}
|
|
1087
1125
|
return handleToolStart.apply(this, args);
|
|
1088
1126
|
};
|
|
@@ -1105,7 +1143,7 @@ function patchInstalledCallbackManager() {
|
|
|
1105
1143
|
function restampLangChainSpan(span) {
|
|
1106
1144
|
try {
|
|
1107
1145
|
const scope = span.instrumentationScope;
|
|
1108
|
-
if (_optionalChain([scope, 'optionalAccess',
|
|
1146
|
+
if (_optionalChain([scope, 'optionalAccess', _36 => _36.name]) !== SCOPE_NAME) {
|
|
1109
1147
|
return;
|
|
1110
1148
|
}
|
|
1111
1149
|
const attrs = span.attributes;
|
|
@@ -1147,7 +1185,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1147
1185
|
*/
|
|
1148
1186
|
loadInstrumentation(InstrumentationClass, name, manualModule, exceptionLogger2) {
|
|
1149
1187
|
try {
|
|
1150
|
-
const inst =
|
|
1188
|
+
const inst = _chunkDC2MFO65cjs.bindToBrizz.call(void 0,
|
|
1151
1189
|
new InstrumentationClass({
|
|
1152
1190
|
exceptionLogger: exceptionLogger2 || ((error) => _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
|
|
1153
1191
|
})
|
|
@@ -1167,7 +1205,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1167
1205
|
* @private
|
|
1168
1206
|
*/
|
|
1169
1207
|
loadManualInstrumentations(instrumentations, exceptionLogger2) {
|
|
1170
|
-
if (_optionalChain([this, 'access',
|
|
1208
|
+
if (_optionalChain([this, 'access', _37 => _37.manualModules, 'optionalAccess', _38 => _38.openAI])) {
|
|
1171
1209
|
try {
|
|
1172
1210
|
const openAIInst = new BrizzOpenAIInstrumentation();
|
|
1173
1211
|
openAIInst.manuallyInstrument(this.manualModules.openAI);
|
|
@@ -1178,18 +1216,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1178
1216
|
}
|
|
1179
1217
|
}
|
|
1180
1218
|
const instrumentationConfigs = [
|
|
1181
|
-
{ class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access',
|
|
1182
|
-
{ class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access',
|
|
1183
|
-
{ class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access',
|
|
1184
|
-
{ class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access',
|
|
1219
|
+
{ class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _39 => _39.manualModules, 'optionalAccess', _40 => _40.anthropic]) },
|
|
1220
|
+
{ class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _41 => _41.manualModules, 'optionalAccess', _42 => _42.cohere]) },
|
|
1221
|
+
{ class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _43 => _43.manualModules, 'optionalAccess', _44 => _44.bedrock]) },
|
|
1222
|
+
{ class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.pinecone]) },
|
|
1185
1223
|
{
|
|
1186
1224
|
class: _instrumentationllamaindex.LlamaIndexInstrumentation,
|
|
1187
1225
|
name: "LlamaIndex",
|
|
1188
|
-
module: _optionalChain([this, 'access',
|
|
1226
|
+
module: _optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.llamaindex])
|
|
1189
1227
|
},
|
|
1190
|
-
{ class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access',
|
|
1191
|
-
{ class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access',
|
|
1192
|
-
{ class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access',
|
|
1228
|
+
{ class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.chromadb]) },
|
|
1229
|
+
{ class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.qdrant]) },
|
|
1230
|
+
{ class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _53 => _53.manualModules, 'optionalAccess', _54 => _54.together]) }
|
|
1193
1231
|
];
|
|
1194
1232
|
for (const config of instrumentationConfigs) {
|
|
1195
1233
|
if (!config.module) {
|
|
@@ -1205,12 +1243,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1205
1243
|
instrumentations.push(instrumentation);
|
|
1206
1244
|
}
|
|
1207
1245
|
}
|
|
1208
|
-
if (_optionalChain([this, 'access',
|
|
1246
|
+
if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langchain, 'optionalAccess', _57 => _57.callbackManagerModule])) {
|
|
1209
1247
|
const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
|
|
1210
1248
|
void (async () => {
|
|
1211
1249
|
try {
|
|
1212
1250
|
const { LangChainInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@arizeai/openinference-instrumentation-langchain")));
|
|
1213
|
-
const lcInst = new LangChainInstrumentation({ tracerProvider:
|
|
1251
|
+
const lcInst = new LangChainInstrumentation({ tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
|
|
1214
1252
|
lcInst.manuallyInstrument(callbackManagerModule);
|
|
1215
1253
|
patchCallbackManagerModule(callbackManagerModule);
|
|
1216
1254
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangChain");
|
|
@@ -1221,7 +1259,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1221
1259
|
}
|
|
1222
1260
|
})();
|
|
1223
1261
|
}
|
|
1224
|
-
if (_optionalChain([this, 'access',
|
|
1262
|
+
if (_optionalChain([this, 'access', _58 => _58.manualModules, 'optionalAccess', _59 => _59.langgraph])) {
|
|
1225
1263
|
try {
|
|
1226
1264
|
new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
|
|
1227
1265
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
|
|
@@ -1229,7 +1267,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1229
1267
|
_chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
|
|
1230
1268
|
}
|
|
1231
1269
|
}
|
|
1232
|
-
if (_optionalChain([this, 'access',
|
|
1270
|
+
if (_optionalChain([this, 'access', _60 => _60.manualModules, 'optionalAccess', _61 => _61.typesafe])) {
|
|
1233
1271
|
try {
|
|
1234
1272
|
new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
|
|
1235
1273
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
|
|
@@ -1237,12 +1275,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1237
1275
|
_chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
|
|
1238
1276
|
}
|
|
1239
1277
|
}
|
|
1240
|
-
if (_optionalChain([this, 'access',
|
|
1278
|
+
if (_optionalChain([this, 'access', _62 => _62.manualModules, 'optionalAccess', _63 => _63.google_vertexai])) {
|
|
1241
1279
|
const vertexModule = this.manualModules.google_vertexai;
|
|
1242
1280
|
void (async () => {
|
|
1243
1281
|
try {
|
|
1244
1282
|
const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
|
|
1245
|
-
const vertexInst =
|
|
1283
|
+
const vertexInst = _chunkDC2MFO65cjs.bindToBrizz.call(void 0, new VertexAIInstrumentation({ exceptionLogger: exceptionLogger2 }));
|
|
1246
1284
|
vertexInst.manuallyInstrument(vertexModule);
|
|
1247
1285
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
|
|
1248
1286
|
} catch (error) {
|
|
@@ -1252,11 +1290,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1252
1290
|
}
|
|
1253
1291
|
})();
|
|
1254
1292
|
}
|
|
1255
|
-
if (_optionalChain([this, 'access',
|
|
1293
|
+
if (_optionalChain([this, 'access', _64 => _64.manualModules, 'optionalAccess', _65 => _65.google_genai])) {
|
|
1256
1294
|
const genaiModule = this.manualModules.google_genai;
|
|
1257
1295
|
void (async () => {
|
|
1258
1296
|
try {
|
|
1259
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
1297
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-GVCKSJMR.cjs")));
|
|
1260
1298
|
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1261
1299
|
genaiInst.manuallyInstrument(genaiModule);
|
|
1262
1300
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
@@ -1267,11 +1305,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1267
1305
|
}
|
|
1268
1306
|
})();
|
|
1269
1307
|
}
|
|
1270
|
-
if (_optionalChain([this, 'access',
|
|
1308
|
+
if (_optionalChain([this, 'access', _66 => _66.manualModules, 'optionalAccess', _67 => _67.mcp])) {
|
|
1271
1309
|
const mcpModules = this.manualModules.mcp;
|
|
1272
1310
|
void (async () => {
|
|
1273
1311
|
try {
|
|
1274
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
1312
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-YFR4MUPD.cjs")));
|
|
1275
1313
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1276
1314
|
instrumentation.manuallyInstrument(mcpModules);
|
|
1277
1315
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1308,14 +1346,14 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1308
1346
|
}, _class);
|
|
1309
1347
|
|
|
1310
1348
|
// src/internal/log/logging.ts
|
|
1311
|
-
|
|
1349
|
+
|
|
1312
1350
|
var _exporterlogsotlphttp = require('@opentelemetry/exporter-logs-otlp-http');
|
|
1313
1351
|
|
|
1314
1352
|
var _sdklogs = require('@opentelemetry/sdk-logs');
|
|
1315
1353
|
|
|
1316
1354
|
// src/internal/trace/session.ts
|
|
1317
1355
|
|
|
1318
|
-
var sessionTracer =
|
|
1356
|
+
var sessionTracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk");
|
|
1319
1357
|
function setCurrentSpanCustomProperties(properties) {
|
|
1320
1358
|
const current = _api.trace.getActiveSpan();
|
|
1321
1359
|
if (!current || !current.isRecording()) {
|
|
@@ -1324,7 +1362,7 @@ function setCurrentSpanCustomProperties(properties) {
|
|
|
1324
1362
|
for (const [key, value] of Object.entries(properties)) {
|
|
1325
1363
|
try {
|
|
1326
1364
|
current.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
|
|
1327
|
-
} catch (
|
|
1365
|
+
} catch (e5) {
|
|
1328
1366
|
}
|
|
1329
1367
|
}
|
|
1330
1368
|
}
|
|
@@ -1348,15 +1386,15 @@ function withProperties(properties, fn, thisArg) {
|
|
|
1348
1386
|
function propagatePropertiesImperatively(properties, base = _api.context.active()) {
|
|
1349
1387
|
try {
|
|
1350
1388
|
const manager = _api.context;
|
|
1351
|
-
const mgr = _optionalChain([manager, 'access',
|
|
1352
|
-
const store = _optionalChain([mgr, 'optionalAccess',
|
|
1389
|
+
const mgr = _optionalChain([manager, 'access', _68 => _68._getContextManager, 'optionalCall', _69 => _69()]);
|
|
1390
|
+
const store = _optionalChain([mgr, 'optionalAccess', _70 => _70._asyncLocalStorage]);
|
|
1353
1391
|
if (!store || typeof store.enterWith !== "function") {
|
|
1354
1392
|
return;
|
|
1355
1393
|
}
|
|
1356
1394
|
const prev = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1357
1395
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
1358
1396
|
store.enterWith(base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, merged));
|
|
1359
|
-
} catch (
|
|
1397
|
+
} catch (e6) {
|
|
1360
1398
|
}
|
|
1361
1399
|
}
|
|
1362
1400
|
function setUser(user) {
|
|
@@ -1451,7 +1489,7 @@ function withServiceName(name, fn, thisArg) {
|
|
|
1451
1489
|
}
|
|
1452
1490
|
function resolveServiceNameFromContext() {
|
|
1453
1491
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1454
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1492
|
+
return _optionalChain([props, 'optionalAccess', _71 => _71[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
|
|
1455
1493
|
}
|
|
1456
1494
|
function userProperties(user) {
|
|
1457
1495
|
const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
|
|
@@ -1518,7 +1556,7 @@ function withMessageId(id, fn, thisArg) {
|
|
|
1518
1556
|
}
|
|
1519
1557
|
function inheritedMuteTools() {
|
|
1520
1558
|
const properties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1521
|
-
return _optionalChain([properties, 'optionalAccess',
|
|
1559
|
+
return _optionalChain([properties, 'optionalAccess', _72 => _72[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
|
|
1522
1560
|
}
|
|
1523
1561
|
function muteProperties(options) {
|
|
1524
1562
|
const { input = true, output = true, tools = output } = options;
|
|
@@ -1680,7 +1718,7 @@ var Session = (_class2 = class {
|
|
|
1680
1718
|
* (free-form category, defaults to `'generic'`)
|
|
1681
1719
|
*/
|
|
1682
1720
|
addExternalLink(url, options) {
|
|
1683
|
-
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1721
|
+
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _73 => _73.title]), _optionalChain([options, 'optionalAccess', _74 => _74.linkType]));
|
|
1684
1722
|
}
|
|
1685
1723
|
}, _class2);
|
|
1686
1724
|
var SessionTitle = class {
|
|
@@ -1706,11 +1744,11 @@ function resolveSessionIdFromContext() {
|
|
|
1706
1744
|
return active.sessionId;
|
|
1707
1745
|
}
|
|
1708
1746
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1709
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1747
|
+
return _optionalChain([props, 'optionalAccess', _75 => _75[_chunkRV7JIIDGcjs.SESSION_ID]]);
|
|
1710
1748
|
}
|
|
1711
1749
|
function resolveMessageIdFromContext() {
|
|
1712
1750
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1713
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1751
|
+
return _optionalChain([props, 'optionalAccess', _76 => _76[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
|
|
1714
1752
|
}
|
|
1715
1753
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1716
1754
|
try {
|
|
@@ -1724,30 +1762,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
|
|
|
1724
1762
|
}
|
|
1725
1763
|
}
|
|
1726
1764
|
function addExternalLink(url, options) {
|
|
1727
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1765
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _77 => _77.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1728
1766
|
if (!sessionId) {
|
|
1729
1767
|
_chunkWC573FCIcjs.logger.warn(
|
|
1730
1768
|
"addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
|
|
1731
1769
|
);
|
|
1732
1770
|
return;
|
|
1733
1771
|
}
|
|
1734
|
-
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1772
|
+
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _78 => _78.title]), _optionalChain([options, 'optionalAccess', _79 => _79.linkType]));
|
|
1735
1773
|
}
|
|
1736
1774
|
function recordFeedback(type, options) {
|
|
1737
1775
|
const eventAttributes = { [_chunkRV7JIIDGcjs.FEEDBACK_TYPE]: type };
|
|
1738
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1776
|
+
if (_optionalChain([options, 'optionalAccess', _80 => _80.score]) !== void 0) {
|
|
1739
1777
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SCORE] = options.score;
|
|
1740
1778
|
}
|
|
1741
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1779
|
+
if (_optionalChain([options, 'optionalAccess', _81 => _81.reason]) !== void 0) {
|
|
1742
1780
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_REASON] = options.reason;
|
|
1743
1781
|
}
|
|
1744
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1782
|
+
if (_optionalChain([options, 'optionalAccess', _82 => _82.comment]) !== void 0) {
|
|
1745
1783
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_COMMENT] = options.comment;
|
|
1746
1784
|
}
|
|
1747
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1785
|
+
if (_optionalChain([options, 'optionalAccess', _83 => _83.source]) !== void 0) {
|
|
1748
1786
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SOURCE] = options.source;
|
|
1749
1787
|
}
|
|
1750
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1788
|
+
if (_optionalChain([options, 'optionalAccess', _84 => _84.attributes])) {
|
|
1751
1789
|
for (const [key, value] of Object.entries(options.attributes)) {
|
|
1752
1790
|
const k = `${_chunkRV7JIIDGcjs.FEEDBACK_ATTR_PREFIX}${key}`;
|
|
1753
1791
|
if (eventAttributes[k] === void 0) {
|
|
@@ -1755,8 +1793,8 @@ function recordFeedback(type, options) {
|
|
|
1755
1793
|
}
|
|
1756
1794
|
}
|
|
1757
1795
|
}
|
|
1758
|
-
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1759
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1796
|
+
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _85 => _85.messageId]), () => ( resolveMessageIdFromContext()));
|
|
1797
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _86 => _86.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1760
1798
|
if (messageId === void 0 && sessionId === void 0) {
|
|
1761
1799
|
_chunkWC573FCIcjs.logger.warn(
|
|
1762
1800
|
"recordFeedback called with no resolvable message id or session id; the feedback cannot be attributed to a message or conversation. Pass options.messageId / options.sessionId or call inside a startSession/callWithMessageId scope."
|
|
@@ -1787,7 +1825,7 @@ function recordMetric(options) {
|
|
|
1787
1825
|
try {
|
|
1788
1826
|
recordMetricImpl(options);
|
|
1789
1827
|
} catch (error) {
|
|
1790
|
-
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess',
|
|
1828
|
+
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _87 => _87.name]))}) failed; metric dropped.`, error);
|
|
1791
1829
|
}
|
|
1792
1830
|
}
|
|
1793
1831
|
function recordMetricImpl(options) {
|
|
@@ -1907,7 +1945,7 @@ function recordMetricImpl(options) {
|
|
|
1907
1945
|
eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = traceId;
|
|
1908
1946
|
}
|
|
1909
1947
|
if (scope === _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
|
|
1910
|
-
const spanContext = _optionalChain([_api.trace, 'access',
|
|
1948
|
+
const spanContext = _optionalChain([_api.trace, 'access', _88 => _88.getActiveSpan, 'call', _89 => _89(), 'optionalAccess', _90 => _90.spanContext, 'call', _91 => _91()]);
|
|
1911
1949
|
if (!spanContext || !_api.isSpanContextValid.call(void 0, spanContext)) {
|
|
1912
1950
|
_chunkWC573FCIcjs.logger.warn(
|
|
1913
1951
|
`recordMetric(${name}) called with scope 'trace' but no trace; metric dropped. Pass options.traceId, or call inside the span of the trace being scored.`
|
|
@@ -1945,7 +1983,7 @@ function recordMetricImpl(options) {
|
|
|
1945
1983
|
}
|
|
1946
1984
|
}
|
|
1947
1985
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1948
|
-
const isTitle = _optionalChain([options, 'optionalAccess',
|
|
1986
|
+
const isTitle = _optionalChain([options, 'optionalAccess', _92 => _92.mode]) === "title";
|
|
1949
1987
|
const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
|
|
1950
1988
|
return sessionTracer.startActiveSpan(spanName, (span) => {
|
|
1951
1989
|
span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, sessionId);
|
|
@@ -1993,7 +2031,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1993
2031
|
});
|
|
1994
2032
|
}
|
|
1995
2033
|
function startSessionTitle(callback, options) {
|
|
1996
|
-
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2034
|
+
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _93 => _93.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _94 => _94(), 'optionalAccess', _95 => _95.sessionId])));
|
|
1997
2035
|
return sessionTracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1998
2036
|
if (resolvedSessionId) {
|
|
1999
2037
|
span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, resolvedSessionId);
|
|
@@ -2466,7 +2504,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
2466
2504
|
this.config = config;
|
|
2467
2505
|
}
|
|
2468
2506
|
onEmit(logRecord) {
|
|
2469
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
2507
|
+
const maskingConfig = _optionalChain([this, 'access', _96 => _96.config, 'access', _97 => _97.masking, 'optionalAccess', _98 => _98.eventMasking]);
|
|
2470
2508
|
if (maskingConfig) {
|
|
2471
2509
|
maskLog(logRecord, maskingConfig);
|
|
2472
2510
|
}
|
|
@@ -2486,7 +2524,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
2486
2524
|
this.config = config;
|
|
2487
2525
|
}
|
|
2488
2526
|
onEmit(logRecord) {
|
|
2489
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
2527
|
+
const maskingConfig = _optionalChain([this, 'access', _99 => _99.config, 'access', _100 => _100.masking, 'optionalAccess', _101 => _101.eventMasking]);
|
|
2490
2528
|
if (maskingConfig) {
|
|
2491
2529
|
maskLog(logRecord, maskingConfig);
|
|
2492
2530
|
}
|
|
@@ -2587,14 +2625,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2587
2625
|
_chunkWC573FCIcjs.logger.debug("Creating logger provider", {
|
|
2588
2626
|
serviceName,
|
|
2589
2627
|
disableBatch: config.disableBatch,
|
|
2590
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
2628
|
+
hasMasking: !!_optionalChain([config, 'access', _102 => _102.masking, 'optionalAccess', _103 => _103.eventMasking])
|
|
2591
2629
|
});
|
|
2592
2630
|
const exporter = this.createLogExporter(config, serviceName);
|
|
2593
2631
|
const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
|
|
2594
2632
|
const resourceAttributes = {
|
|
2595
2633
|
...config.resourceAttributes,
|
|
2596
2634
|
"service.name": serviceName,
|
|
2597
|
-
[BRIZZ_SDK_VERSION]:
|
|
2635
|
+
[BRIZZ_SDK_VERSION]: _chunkVY6GEZSPcjs.getSDKVersion.call(void 0, ),
|
|
2598
2636
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2599
2637
|
};
|
|
2600
2638
|
if (config.environment) {
|
|
@@ -2641,7 +2679,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2641
2679
|
/**
|
|
2642
2680
|
* Emit a custom event to the telemetry pipeline
|
|
2643
2681
|
*/
|
|
2644
|
-
emitEvent(name, attributes, body, severityNumber =
|
|
2682
|
+
emitEvent(name, attributes, body, severityNumber = _api.SeverityNumber.INFO) {
|
|
2645
2683
|
_chunkWC573FCIcjs.logger.debug("Attempting to emit event", {
|
|
2646
2684
|
name,
|
|
2647
2685
|
hasAttributes: !!attributes,
|
|
@@ -2695,7 +2733,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2695
2733
|
}
|
|
2696
2734
|
async forceFlush() {
|
|
2697
2735
|
await Promise.all(
|
|
2698
|
-
[...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess',
|
|
2736
|
+
[...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _104 => _104.forceFlush, 'call', _105 => _105()]))
|
|
2699
2737
|
);
|
|
2700
2738
|
}
|
|
2701
2739
|
/**
|
|
@@ -2716,10 +2754,10 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2716
2754
|
_chunkWC573FCIcjs.logger.debug("Logging module shutdown completed");
|
|
2717
2755
|
}
|
|
2718
2756
|
}, _class3.__initStatic(), _class3);
|
|
2719
|
-
function emitEvent(name, attributes, body, severityNumber =
|
|
2757
|
+
function emitEvent(name, attributes, body, severityNumber = _api.SeverityNumber.INFO) {
|
|
2720
2758
|
return LoggingModule.getInstance().emitEvent(name, attributes, body, severityNumber);
|
|
2721
2759
|
}
|
|
2722
|
-
function emitEventWithSessionId(sessionId, name, attributes, body, severityNumber =
|
|
2760
|
+
function emitEventWithSessionId(sessionId, name, attributes, body, severityNumber = _api.SeverityNumber.INFO) {
|
|
2723
2761
|
return callWithSessionId(sessionId, () => {
|
|
2724
2762
|
LoggingModule.getInstance().emitEvent(name, attributes, body, severityNumber);
|
|
2725
2763
|
});
|
|
@@ -2808,7 +2846,7 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
|
|
|
2808
2846
|
return this.metricsReader;
|
|
2809
2847
|
}
|
|
2810
2848
|
async forceFlush() {
|
|
2811
|
-
await _optionalChain([this, 'access',
|
|
2849
|
+
await _optionalChain([this, 'access', _106 => _106.metricsReader, 'optionalAccess', _107 => _107.forceFlush, 'call', _108 => _108()]);
|
|
2812
2850
|
}
|
|
2813
2851
|
/**
|
|
2814
2852
|
* Shutdown the metrics module
|
|
@@ -2851,7 +2889,7 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2851
2889
|
const resourceAttrs = {
|
|
2852
2890
|
...config.resourceAttributes,
|
|
2853
2891
|
"service.name": config.appName,
|
|
2854
|
-
[BRIZZ_SDK_VERSION]:
|
|
2892
|
+
[BRIZZ_SDK_VERSION]: _chunkVY6GEZSPcjs.getSDKVersion.call(void 0, ),
|
|
2855
2893
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2856
2894
|
};
|
|
2857
2895
|
if (config.environment) {
|
|
@@ -2978,8 +3016,8 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2978
3016
|
}
|
|
2979
3017
|
async forceFlush() {
|
|
2980
3018
|
await Promise.all([
|
|
2981
|
-
_optionalChain([this, 'access',
|
|
2982
|
-
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access',
|
|
3019
|
+
_optionalChain([this, 'access', _109 => _109._delegate, 'access', _110 => _110.forceFlush, 'optionalCall', _111 => _111()]),
|
|
3020
|
+
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _112 => _112.forceFlush, 'optionalCall', _113 => _113()]))
|
|
2983
3021
|
]);
|
|
2984
3022
|
}
|
|
2985
3023
|
}, _class5);
|
|
@@ -3025,10 +3063,10 @@ var DEFAULT_MASKING_RULES = [
|
|
|
3025
3063
|
patterns: DEFAULT_PII_PATTERNS
|
|
3026
3064
|
}
|
|
3027
3065
|
];
|
|
3028
|
-
var BrizzSimpleSpanProcessor = class extends
|
|
3066
|
+
var BrizzSimpleSpanProcessor = class extends _sdktrace.SimpleSpanProcessor {
|
|
3029
3067
|
|
|
3030
3068
|
constructor(spanExporter, config) {
|
|
3031
|
-
super(spanExporter);
|
|
3069
|
+
super({ exporter: spanExporter });
|
|
3032
3070
|
this.config = config;
|
|
3033
3071
|
}
|
|
3034
3072
|
onStart(span, parentContext) {
|
|
@@ -3037,17 +3075,17 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
3037
3075
|
}
|
|
3038
3076
|
onEnd(span) {
|
|
3039
3077
|
restampLangChainSpan(span);
|
|
3040
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
3078
|
+
const maskingConfig = _optionalChain([this, 'access', _114 => _114.config, 'access', _115 => _115.masking, 'optionalAccess', _116 => _116.spanMasking]);
|
|
3041
3079
|
if (maskingConfig) {
|
|
3042
3080
|
maskReadableSpan(span, maskingConfig);
|
|
3043
3081
|
}
|
|
3044
3082
|
super.onEnd(span);
|
|
3045
3083
|
}
|
|
3046
3084
|
};
|
|
3047
|
-
var BrizzBatchSpanProcessor = class extends
|
|
3085
|
+
var BrizzBatchSpanProcessor = class extends _sdktrace.BatchSpanProcessor {
|
|
3048
3086
|
|
|
3049
3087
|
constructor(spanExporter, config) {
|
|
3050
|
-
super(spanExporter);
|
|
3088
|
+
super({ exporter: spanExporter });
|
|
3051
3089
|
this.config = config;
|
|
3052
3090
|
}
|
|
3053
3091
|
onStart(span, parentContext) {
|
|
@@ -3056,7 +3094,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
3056
3094
|
}
|
|
3057
3095
|
onEnd(span) {
|
|
3058
3096
|
restampLangChainSpan(span);
|
|
3059
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
3097
|
+
const maskingConfig = _optionalChain([this, 'access', _117 => _117.config, 'access', _118 => _118.masking, 'optionalAccess', _119 => _119.spanMasking]);
|
|
3060
3098
|
if (maskingConfig) {
|
|
3061
3099
|
maskReadableSpan(span, maskingConfig);
|
|
3062
3100
|
}
|
|
@@ -3073,7 +3111,7 @@ function maskReadableSpan(span, config) {
|
|
|
3073
3111
|
for (const [k, v] of Object.entries(attrs)) {
|
|
3074
3112
|
masked[k] = v;
|
|
3075
3113
|
}
|
|
3076
|
-
if (_optionalChain([config, 'access',
|
|
3114
|
+
if (_optionalChain([config, 'access', _120 => _120.rules, 'optionalAccess', _121 => _121.length])) {
|
|
3077
3115
|
masked = maskAttributes(masked, config.rules);
|
|
3078
3116
|
}
|
|
3079
3117
|
if (!config.disableDefaultRules) {
|
|
@@ -3145,7 +3183,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
3145
3183
|
}
|
|
3146
3184
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
3147
3185
|
disableBatch: config.disableBatch,
|
|
3148
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
3186
|
+
hasMasking: !!_optionalChain([config, 'access', _122 => _122.masking, 'optionalAccess', _123 => _123.spanMasking])
|
|
3149
3187
|
});
|
|
3150
3188
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
3151
3189
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -3189,7 +3227,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
3189
3227
|
return this.spanProcessor;
|
|
3190
3228
|
}
|
|
3191
3229
|
async forceFlush() {
|
|
3192
|
-
await _optionalChain([this, 'access',
|
|
3230
|
+
await _optionalChain([this, 'access', _124 => _124.spanProcessor, 'optionalAccess', _125 => _125.forceFlush, 'call', _126 => _126()]);
|
|
3193
3231
|
}
|
|
3194
3232
|
async shutdown() {
|
|
3195
3233
|
_chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
|
|
@@ -3234,8 +3272,8 @@ function encodeToken(agent) {
|
|
|
3234
3272
|
function currentTraceparent() {
|
|
3235
3273
|
const carrier = {};
|
|
3236
3274
|
try {
|
|
3237
|
-
|
|
3238
|
-
} catch (
|
|
3275
|
+
_chunkDC2MFO65cjs.injectTraceContext.call(void 0, _api.context.active(), carrier);
|
|
3276
|
+
} catch (e7) {
|
|
3239
3277
|
}
|
|
3240
3278
|
return _nullishCoalesce(carrier["traceparent"], () => ( ""));
|
|
3241
3279
|
}
|
|
@@ -3258,7 +3296,7 @@ function decodeToken(token) {
|
|
|
3258
3296
|
try {
|
|
3259
3297
|
const payload = JSON.parse(Buffer.from(token, "base64url").toString("utf8"));
|
|
3260
3298
|
return payload.id ? payload : void 0;
|
|
3261
|
-
} catch (
|
|
3299
|
+
} catch (e8) {
|
|
3262
3300
|
return void 0;
|
|
3263
3301
|
}
|
|
3264
3302
|
}
|
|
@@ -3295,8 +3333,8 @@ function resolveAgent(agent) {
|
|
|
3295
3333
|
sessionId = decoded.sessionId;
|
|
3296
3334
|
if (decoded.traceparent) {
|
|
3297
3335
|
try {
|
|
3298
|
-
parentContext =
|
|
3299
|
-
} catch (
|
|
3336
|
+
parentContext = _chunkDC2MFO65cjs.extractTraceContext.call(void 0, parentContext, { traceparent: decoded.traceparent });
|
|
3337
|
+
} catch (e9) {
|
|
3300
3338
|
}
|
|
3301
3339
|
}
|
|
3302
3340
|
}
|
|
@@ -3373,7 +3411,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3373
3411
|
*/
|
|
3374
3412
|
setupInstrumentation(options) {
|
|
3375
3413
|
const registry = InstrumentationRegistry.getInstance();
|
|
3376
|
-
|
|
3414
|
+
_chunkVY6GEZSPcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
3377
3415
|
patchInstalledCallbackManager();
|
|
3378
3416
|
patchInstalledLangGraph();
|
|
3379
3417
|
patchInstalledTypeSafe();
|
|
@@ -3390,7 +3428,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3390
3428
|
const registry = InstrumentationRegistry.getInstance();
|
|
3391
3429
|
const manualInstrumentations = registry.getManualInstrumentations();
|
|
3392
3430
|
if (options.disableNodeSdk) {
|
|
3393
|
-
|
|
3431
|
+
_chunkDC2MFO65cjs.setPrivateTracerProvider.call(void 0, null);
|
|
3394
3432
|
if (!resolvedConfig.setGlobalTracerProvider) {
|
|
3395
3433
|
_chunkWC573FCIcjs.logger.warn(
|
|
3396
3434
|
"Brizz: setGlobalTracerProvider: false has no effect with disableNodeSdk: true. Brizz creates no TracerProvider, so spans follow the provider you register with getSpanProcessor()."
|
|
@@ -3399,7 +3437,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3399
3437
|
if (manualInstrumentations.length > 0) {
|
|
3400
3438
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3401
3439
|
instrumentations: manualInstrumentations,
|
|
3402
|
-
tracerProvider:
|
|
3440
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
3403
3441
|
});
|
|
3404
3442
|
}
|
|
3405
3443
|
_chunkWC573FCIcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
|
|
@@ -3408,7 +3446,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3408
3446
|
const resourceAttributes = {
|
|
3409
3447
|
...resolvedConfig.resourceAttributes,
|
|
3410
3448
|
"service.name": resolvedConfig.appName,
|
|
3411
|
-
[BRIZZ_SDK_VERSION]:
|
|
3449
|
+
[BRIZZ_SDK_VERSION]: _chunkVY6GEZSPcjs.getSDKVersion.call(void 0, ),
|
|
3412
3450
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
3413
3451
|
};
|
|
3414
3452
|
if (resolvedConfig.environment) {
|
|
@@ -3420,20 +3458,20 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3420
3458
|
const resource = _resources2.defaultResource.call(void 0, ).merge(_resources2.detectResources.call(void 0, { detectors: [_resources2.envDetector, _resources2.hostDetector, _resources2.processDetector] })).merge(_resources2.resourceFromAttributes.call(void 0, resourceAttributes));
|
|
3421
3459
|
const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkO2IBZJOJcjs.InterruptPropagator)(), getSpanProcessor()];
|
|
3422
3460
|
if (resolvedConfig.setGlobalTracerProvider) {
|
|
3423
|
-
this._tracerProvider = new (0,
|
|
3461
|
+
this._tracerProvider = new (0, _sdktrace.TracerProvider)({ resource, spanProcessors });
|
|
3424
3462
|
this.registerGlobalTracerProvider(this._tracerProvider);
|
|
3425
3463
|
} else {
|
|
3426
|
-
this._tracerProvider = new (0,
|
|
3464
|
+
this._tracerProvider = new (0, _sdktrace.TracerProvider)({
|
|
3427
3465
|
resource,
|
|
3428
3466
|
spanProcessors,
|
|
3429
|
-
sampler: new (0,
|
|
3467
|
+
sampler: new (0, _sdktrace.AlwaysOnSampler)()
|
|
3430
3468
|
});
|
|
3431
|
-
if (
|
|
3469
|
+
if (_chunkDC2MFO65cjs.ensureContextManager.call(void 0, ) === "failed") {
|
|
3432
3470
|
_chunkWC573FCIcjs.logger.warn(
|
|
3433
3471
|
"Brizz: no OpenTelemetry context manager is active and Brizz could not install one; span parenting and session/user propagation will not work."
|
|
3434
3472
|
);
|
|
3435
3473
|
}
|
|
3436
|
-
|
|
3474
|
+
_chunkDC2MFO65cjs.setPrivateTracerProvider.call(void 0, this._tracerProvider);
|
|
3437
3475
|
_chunkWC573FCIcjs.logger.info(
|
|
3438
3476
|
"Brizz: using a private TracerProvider; Brizz spans are exported to Brizz only and the global TracerProvider is left untouched."
|
|
3439
3477
|
);
|
|
@@ -3444,7 +3482,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3444
3482
|
if (manualInstrumentations.length > 0) {
|
|
3445
3483
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3446
3484
|
instrumentations: manualInstrumentations,
|
|
3447
|
-
tracerProvider:
|
|
3485
|
+
tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
|
|
3448
3486
|
});
|
|
3449
3487
|
_chunkWC573FCIcjs.logger.info(
|
|
3450
3488
|
`Telemetry providers started with ${manualInstrumentations.length} manual instrumentations`
|
|
@@ -3462,8 +3500,8 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3462
3500
|
* @private
|
|
3463
3501
|
*/
|
|
3464
3502
|
registerGlobalTracerProvider(provider) {
|
|
3465
|
-
|
|
3466
|
-
|
|
3503
|
+
_chunkDC2MFO65cjs.setPrivateTracerProvider.call(void 0, null);
|
|
3504
|
+
_chunkDC2MFO65cjs.registerTracerProvider.call(void 0, provider);
|
|
3467
3505
|
const registered = globalTracerDelegate();
|
|
3468
3506
|
if (registered === provider) {
|
|
3469
3507
|
return;
|
|
@@ -3518,19 +3556,19 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3518
3556
|
try {
|
|
3519
3557
|
const tracingModule = TracingModule.getInstance();
|
|
3520
3558
|
await tracingModule.shutdown();
|
|
3521
|
-
} catch (
|
|
3559
|
+
} catch (e10) {
|
|
3522
3560
|
_chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
|
|
3523
3561
|
}
|
|
3524
3562
|
try {
|
|
3525
3563
|
const metricsModule = MetricsModule.getInstance();
|
|
3526
3564
|
metricsModule.shutdown();
|
|
3527
|
-
} catch (
|
|
3565
|
+
} catch (e11) {
|
|
3528
3566
|
_chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
|
|
3529
3567
|
}
|
|
3530
3568
|
try {
|
|
3531
3569
|
const loggingModule = LoggingModule.getInstance();
|
|
3532
3570
|
await loggingModule.shutdown();
|
|
3533
|
-
} catch (
|
|
3571
|
+
} catch (e12) {
|
|
3534
3572
|
_chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
|
|
3535
3573
|
}
|
|
3536
3574
|
_chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
|
|
@@ -3652,10 +3690,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3652
3690
|
}
|
|
3653
3691
|
try {
|
|
3654
3692
|
await this.shutdownModules();
|
|
3655
|
-
await _optionalChain([this, 'access',
|
|
3656
|
-
await _optionalChain([this, 'access',
|
|
3657
|
-
await _optionalChain([this, 'access',
|
|
3658
|
-
await _optionalChain([this, 'access',
|
|
3693
|
+
await _optionalChain([this, 'access', _127 => _127._tracerProvider, 'optionalAccess', _128 => _128.forceFlush, 'call', _129 => _129()]);
|
|
3694
|
+
await _optionalChain([this, 'access', _130 => _130._tracerProvider, 'optionalAccess', _131 => _131.shutdown, 'call', _132 => _132()]);
|
|
3695
|
+
await _optionalChain([this, 'access', _133 => _133._meterProvider, 'optionalAccess', _134 => _134.forceFlush, 'call', _135 => _135()]);
|
|
3696
|
+
await _optionalChain([this, 'access', _136 => _136._meterProvider, 'optionalAccess', _137 => _137.shutdown, 'call', _138 => _138()]);
|
|
3659
3697
|
this._initialized = false;
|
|
3660
3698
|
this._tracerProvider = null;
|
|
3661
3699
|
this._meterProvider = null;
|
|
@@ -3723,4 +3761,4 @@ var Brizz = new _Brizz();
|
|
|
3723
3761
|
|
|
3724
3762
|
|
|
3725
3763
|
|
|
3726
|
-
exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.SeverityNumber =
|
|
3764
|
+
exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.SeverityNumber = _api.SeverityNumber; exports.addExternalLink = addExternalLink; exports.callWithMessageId = callWithMessageId; exports.callWithMute = callWithMute; exports.callWithOrganization = callWithOrganization; exports.callWithProperties = callWithProperties; exports.callWithServiceName = callWithServiceName; exports.callWithSessionId = callWithSessionId; exports.callWithUser = callWithUser; exports.emitEvent = emitEvent; exports.emitEventWithSessionId = emitEventWithSessionId; exports.getActiveSession = getActiveSession; exports.getLogLevel = _chunkWC573FCIcjs.getLogLevel; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.getTracerProvider = _chunkDC2MFO65cjs.getTracerProvider; exports.logger = _chunkWC573FCIcjs.logger; exports.maskAttributes = maskAttributes; exports.maskValue = maskValue; exports.recordFeedback = recordFeedback; exports.recordMetric = recordMetric; exports.setAgent = setAgent; exports.setCurrentSpanCustomProperties = setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = setMessageId; exports.setOrganization = setOrganization; exports.setServiceName = setServiceName; exports.setSessionId = setSessionId; exports.setUser = setUser; exports.startAgent = startAgent; exports.startSession = startSession; exports.startSessionTitle = startSessionTitle; exports.withAgent = withAgent; exports.withMessageId = withMessageId; exports.withMute = withMute; exports.withOrganization = withOrganization; exports.withProperties = withProperties; exports.withServiceName = withServiceName; exports.withSessionId = withSessionId; exports.withUser = withUser;
|