@brizz/sdk 0.1.52 → 0.1.53
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/dist/{chunk-2T7OEV33.cjs → chunk-STTOBCTP.cjs} +1 -1
- package/dist/{chunk-W7VSQ4KQ.js → chunk-XV3ZJO5K.js} +1 -1
- package/dist/index.cjs +304 -73
- package/dist/index.js +284 -53
- package/dist/{mcp-TOZFTC5Y.js → mcp-DBLN5ZBE.js} +1 -1
- package/dist/{mcp-MVZSP5NE.cjs → mcp-KH5LOG5H.cjs} +11 -11
- package/dist/types/cjs/internal/instrumentation/registry.d.ts +1 -0
- package/dist/types/cjs/internal/instrumentation/typesafe.d.ts +34 -0
- package/dist/types/esm/internal/instrumentation/registry.d.ts +1 -0
- package/dist/types/esm/internal/instrumentation/typesafe.d.ts +34 -0
- package/package.json +9 -3
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 _chunkSTTOBCTPcjs = require('./chunk-STTOBCTP.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -104,7 +104,7 @@ var _api = require('@opentelemetry/api');
|
|
|
104
104
|
|
|
105
105
|
// src/internal/instrumentation/langgraph/attributes.ts
|
|
106
106
|
var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
107
|
-
var INSTRUMENTATION_VERSION =
|
|
107
|
+
var INSTRUMENTATION_VERSION = _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, );
|
|
108
108
|
var MODULE_NAME = "@langchain/langgraph";
|
|
109
109
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
110
110
|
function isSupportedVersion(version) {
|
|
@@ -426,6 +426,217 @@ function attachRunToIteration(stream, run) {
|
|
|
426
426
|
return iterable;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
+
// src/internal/instrumentation/typesafe.ts
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
var INSTRUMENTATION_NAME2 = "@brizz/sdk/typesafe";
|
|
437
|
+
var MODULE_NAME2 = "@typesafe-ai/sdk";
|
|
438
|
+
var SUPPORTED_VERSIONS2 = [">=0.5.7 <1"];
|
|
439
|
+
var SPAN_NAME = "typesafe.system_one";
|
|
440
|
+
var PROVIDER_NAME = "typesafe";
|
|
441
|
+
var OPERATION_NAME = "classify";
|
|
442
|
+
var ATTR_OPERATION_NAME = "gen_ai.operation.name";
|
|
443
|
+
var ATTR_PROVIDER_NAME = "gen_ai.provider.name";
|
|
444
|
+
var ATTR_REQUEST_MODEL = "gen_ai.request.model";
|
|
445
|
+
var ATTR_RESPONSE_MODEL = "gen_ai.response.model";
|
|
446
|
+
var ATTR_INPUT_TOKENS = "gen_ai.usage.input_tokens";
|
|
447
|
+
var ATTR_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
|
|
448
|
+
var ATTR_INPUT_MESSAGES = "gen_ai.input.messages";
|
|
449
|
+
var ATTR_QUESTIONS = "typesafe.questions";
|
|
450
|
+
var ATTR_ANSWERS = "typesafe.answers";
|
|
451
|
+
var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
|
|
452
|
+
var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
453
|
+
constructor(config = {}) {
|
|
454
|
+
super(INSTRUMENTATION_NAME2, _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ), config);
|
|
455
|
+
}
|
|
456
|
+
init() {
|
|
457
|
+
return [
|
|
458
|
+
new (0, _instrumentation.InstrumentationNodeModuleDefinition)(
|
|
459
|
+
MODULE_NAME2,
|
|
460
|
+
SUPPORTED_VERSIONS2,
|
|
461
|
+
(moduleExports) => {
|
|
462
|
+
this.manuallyInstrument(moduleExports);
|
|
463
|
+
return moduleExports;
|
|
464
|
+
},
|
|
465
|
+
(moduleExports) => moduleExports
|
|
466
|
+
)
|
|
467
|
+
];
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Patch a `@typesafe-ai/sdk` module the caller already imported. The
|
|
471
|
+
* module-load hook above only fires for CommonJS requires, so an ESM or
|
|
472
|
+
* bundled consumer reaches the instrumentation through here — from
|
|
473
|
+
* `patchInstalledTypeSafe`, or `instrumentModules: { typesafe }`.
|
|
474
|
+
*/
|
|
475
|
+
manuallyInstrument(moduleExports) {
|
|
476
|
+
const client = _optionalChain([moduleExports, 'optionalAccess', _19 => _19.TypeSafeClient]);
|
|
477
|
+
if (typeof client !== "function" || !client.prototype) {
|
|
478
|
+
_chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: module does not expose TypeSafeClient \u2014 skipping patch");
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (patchSystemOne(client.prototype, () => this.tracer)) {
|
|
482
|
+
_chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: patched TypeSafeClient.systemOne");
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
function patchInstalledTypeSafe() {
|
|
487
|
+
let requireFromSdk;
|
|
488
|
+
let version;
|
|
489
|
+
try {
|
|
490
|
+
requireFromSdk = _module.createRequire.call(void 0, __filename);
|
|
491
|
+
version = requireFromSdk(`${MODULE_NAME2}/package.json`).version;
|
|
492
|
+
} catch (error) {
|
|
493
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe not resolved, not patched: ${String(error)}`);
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (!isSupportedVersion2(version)) {
|
|
497
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe ${version} is outside ${SUPPORTED_VERSIONS2.join(" ")}, not patched`);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
let instrumentation;
|
|
501
|
+
try {
|
|
502
|
+
instrumentation = new TypeSafeInstrumentation({ enabled: false });
|
|
503
|
+
} catch (error) {
|
|
504
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not constructed: ${String(error)}`);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
const loaded = requireFromSdk.cache[requireFromSdk.resolve(MODULE_NAME2)];
|
|
509
|
+
if (loaded) {
|
|
510
|
+
instrumentation.manuallyInstrument(loaded.exports);
|
|
511
|
+
}
|
|
512
|
+
} catch (error) {
|
|
513
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe CJS build not patched: ${String(error)}`);
|
|
514
|
+
}
|
|
515
|
+
void (async () => {
|
|
516
|
+
try {
|
|
517
|
+
instrumentation.manuallyInstrument(await Promise.resolve().then(() => _interopRequireWildcard(require("@typesafe-ai/sdk"))));
|
|
518
|
+
} catch (error) {
|
|
519
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe not patched: ${String(error)}`);
|
|
520
|
+
}
|
|
521
|
+
})();
|
|
522
|
+
}
|
|
523
|
+
function isSupportedVersion2(version) {
|
|
524
|
+
const [major, minor, patch] = version.split(".").map((part) => Number.parseInt(part, 10));
|
|
525
|
+
if ([major, minor, patch].some((part) => part === void 0 || Number.isNaN(part))) {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
return major === 0 && (minor > 5 || minor === 5 && patch >= 7);
|
|
529
|
+
}
|
|
530
|
+
function patchSystemOne(proto, getTracer) {
|
|
531
|
+
const target = proto;
|
|
532
|
+
const original = proto.systemOne;
|
|
533
|
+
if (target[PATCHED_FLAG2] || typeof original !== "function") {
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
proto.systemOne = function brizzSystemOne(request, ...rest) {
|
|
537
|
+
const span = startSpan(getTracer, request);
|
|
538
|
+
if (!span) {
|
|
539
|
+
return original.call(this, request, ...rest);
|
|
540
|
+
}
|
|
541
|
+
let pending;
|
|
542
|
+
try {
|
|
543
|
+
pending = _api.context.with(
|
|
544
|
+
_api.trace.setSpan(_api.context.active(), span),
|
|
545
|
+
() => original.call(this, request, ...rest)
|
|
546
|
+
);
|
|
547
|
+
} catch (error) {
|
|
548
|
+
endSpan(span, error);
|
|
549
|
+
throw error;
|
|
550
|
+
}
|
|
551
|
+
return observe(pending, span);
|
|
552
|
+
};
|
|
553
|
+
target[PATCHED_FLAG2] = true;
|
|
554
|
+
return true;
|
|
555
|
+
}
|
|
556
|
+
function observe(pending, span) {
|
|
557
|
+
const onError = (error) => endSpan(span, error);
|
|
558
|
+
try {
|
|
559
|
+
if (typeof _optionalChain([pending, 'optionalAccess', _20 => _20.asResponse]) === "function") {
|
|
560
|
+
pending.asResponse().then((response) => {
|
|
561
|
+
if (typeof _optionalChain([response, 'optionalAccess', _21 => _21.clone]) !== "function") {
|
|
562
|
+
endSpan(span);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
response.clone().json().then((body) => {
|
|
566
|
+
recordResult(span, body);
|
|
567
|
+
endSpan(span);
|
|
568
|
+
}, onError);
|
|
569
|
+
}, onError);
|
|
570
|
+
return pending;
|
|
571
|
+
}
|
|
572
|
+
if (typeof _optionalChain([pending, 'optionalAccess', _22 => _22.then]) === "function") {
|
|
573
|
+
pending.then((result) => {
|
|
574
|
+
recordResult(span, result);
|
|
575
|
+
endSpan(span);
|
|
576
|
+
}, onError);
|
|
577
|
+
return pending;
|
|
578
|
+
}
|
|
579
|
+
} catch (error) {
|
|
580
|
+
_chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not observe the call: ${String(error)}`);
|
|
581
|
+
}
|
|
582
|
+
endSpan(span);
|
|
583
|
+
return pending;
|
|
584
|
+
}
|
|
585
|
+
function startSpan(getTracer, request) {
|
|
586
|
+
try {
|
|
587
|
+
const model = typeof _optionalChain([request, 'optionalAccess', _23 => _23.model]) === "string" && request.model !== "" ? request.model : void 0;
|
|
588
|
+
const attributes = {
|
|
589
|
+
[ATTR_OPERATION_NAME]: OPERATION_NAME,
|
|
590
|
+
[ATTR_PROVIDER_NAME]: PROVIDER_NAME,
|
|
591
|
+
[ATTR_INPUT_MESSAGES]: JSON.stringify([
|
|
592
|
+
{ role: "user", parts: [{ type: "text", content: text(_optionalChain([request, 'optionalAccess', _24 => _24.state])) }] }
|
|
593
|
+
])
|
|
594
|
+
};
|
|
595
|
+
if (model) {
|
|
596
|
+
attributes[ATTR_REQUEST_MODEL] = model;
|
|
597
|
+
}
|
|
598
|
+
if (_optionalChain([request, 'optionalAccess', _25 => _25.questions]) !== void 0) {
|
|
599
|
+
attributes[ATTR_QUESTIONS] = JSON.stringify(request.questions);
|
|
600
|
+
}
|
|
601
|
+
return getTracer().startSpan(SPAN_NAME, { kind: _api.SpanKind.CLIENT, attributes });
|
|
602
|
+
} catch (error) {
|
|
603
|
+
_chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not start span: ${String(error)}`);
|
|
604
|
+
return void 0;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
function recordResult(span, result) {
|
|
608
|
+
try {
|
|
609
|
+
const { model, usage, answers } = _nullishCoalesce(result, () => ( {}));
|
|
610
|
+
if (typeof model === "string" && model) {
|
|
611
|
+
span.setAttribute(ATTR_RESPONSE_MODEL, model);
|
|
612
|
+
}
|
|
613
|
+
if (typeof _optionalChain([usage, 'optionalAccess', _26 => _26.input_tokens]) === "number") {
|
|
614
|
+
span.setAttribute(ATTR_INPUT_TOKENS, usage.input_tokens);
|
|
615
|
+
}
|
|
616
|
+
if (typeof _optionalChain([usage, 'optionalAccess', _27 => _27.output_tokens]) === "number") {
|
|
617
|
+
span.setAttribute(ATTR_OUTPUT_TOKENS, usage.output_tokens);
|
|
618
|
+
}
|
|
619
|
+
if (answers !== void 0) {
|
|
620
|
+
span.setAttribute(ATTR_ANSWERS, JSON.stringify(answers));
|
|
621
|
+
}
|
|
622
|
+
} catch (error) {
|
|
623
|
+
_chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not record the answers: ${String(error)}`);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function endSpan(span, error) {
|
|
627
|
+
if (!span.isRecording()) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
if (error !== void 0) {
|
|
631
|
+
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
632
|
+
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: String(error) });
|
|
633
|
+
}
|
|
634
|
+
span.end();
|
|
635
|
+
}
|
|
636
|
+
function text(value) {
|
|
637
|
+
return typeof value === "string" ? value : _nullishCoalesce(JSON.stringify(value), () => ( ""));
|
|
638
|
+
}
|
|
639
|
+
|
|
429
640
|
// src/internal/instrumentation/auto-init.ts
|
|
430
641
|
var exceptionLogger = (error) => {
|
|
431
642
|
_chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`);
|
|
@@ -468,7 +679,7 @@ function loadGenAIInstrumentations() {
|
|
|
468
679
|
function loadMCPInstrumentation() {
|
|
469
680
|
void (async () => {
|
|
470
681
|
try {
|
|
471
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
682
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KH5LOG5H.cjs")));
|
|
472
683
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
473
684
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
|
|
474
685
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -487,6 +698,14 @@ function loadLangGraphInstrumentation() {
|
|
|
487
698
|
_chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
|
|
488
699
|
}
|
|
489
700
|
}
|
|
701
|
+
function loadTypeSafeInstrumentation() {
|
|
702
|
+
try {
|
|
703
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [new TypeSafeInstrumentation()] });
|
|
704
|
+
_chunkWC573FCIcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
|
|
705
|
+
} catch (error) {
|
|
706
|
+
_chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not loaded: ${String(error)}`);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
490
709
|
function loadVertexAIInstrumentation() {
|
|
491
710
|
void (async () => {
|
|
492
711
|
try {
|
|
@@ -565,6 +784,7 @@ function autoInitializeInstrumentations() {
|
|
|
565
784
|
const genAIInstrumentations = loadGenAIInstrumentations();
|
|
566
785
|
loadMCPInstrumentation();
|
|
567
786
|
loadLangGraphInstrumentation();
|
|
787
|
+
loadTypeSafeInstrumentation();
|
|
568
788
|
loadVertexAIInstrumentation();
|
|
569
789
|
loadGoogleGenAIInstrumentation();
|
|
570
790
|
loadVercelAITelemetry();
|
|
@@ -595,7 +815,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
|
595
815
|
|
|
596
816
|
// src/internal/config.ts
|
|
597
817
|
function resolveConfig(options) {
|
|
598
|
-
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access',
|
|
818
|
+
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _28 => _28.logLevel, 'optionalAccess', _29 => _29.toString, 'call', _30 => _30()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
599
819
|
let resolvedLogLevel;
|
|
600
820
|
if (envLogLevel) {
|
|
601
821
|
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
|
|
@@ -770,7 +990,7 @@ function runMetadataFromContext() {
|
|
|
770
990
|
return Object.keys(metadata).length > 0 ? metadata : void 0;
|
|
771
991
|
}
|
|
772
992
|
function patchCallbackManagerModule(module2) {
|
|
773
|
-
const callbackManager = _optionalChain([module2, 'optionalAccess',
|
|
993
|
+
const callbackManager = _optionalChain([module2, 'optionalAccess', _31 => _31.CallbackManager]);
|
|
774
994
|
if (callbackManager === null || typeof callbackManager !== "function" && typeof callbackManager !== "object") {
|
|
775
995
|
return false;
|
|
776
996
|
}
|
|
@@ -801,7 +1021,7 @@ function patchCallbackManagerModule(module2) {
|
|
|
801
1021
|
}
|
|
802
1022
|
function patchToolStart(prototype) {
|
|
803
1023
|
const proto = prototype;
|
|
804
|
-
const original = _optionalChain([proto, 'optionalAccess',
|
|
1024
|
+
const original = _optionalChain([proto, 'optionalAccess', _32 => _32["handleToolStart"]]);
|
|
805
1025
|
if (!proto || typeof original !== "function") {
|
|
806
1026
|
return;
|
|
807
1027
|
}
|
|
@@ -839,7 +1059,7 @@ function patchInstalledCallbackManager() {
|
|
|
839
1059
|
function restampLangChainSpan(span) {
|
|
840
1060
|
try {
|
|
841
1061
|
const scope = span.instrumentationScope;
|
|
842
|
-
if (_optionalChain([scope, 'optionalAccess',
|
|
1062
|
+
if (_optionalChain([scope, 'optionalAccess', _33 => _33.name]) !== SCOPE_NAME) {
|
|
843
1063
|
return;
|
|
844
1064
|
}
|
|
845
1065
|
const attrs = span.attributes;
|
|
@@ -899,7 +1119,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
899
1119
|
* @private
|
|
900
1120
|
*/
|
|
901
1121
|
loadManualInstrumentations(instrumentations, exceptionLogger2) {
|
|
902
|
-
if (_optionalChain([this, 'access',
|
|
1122
|
+
if (_optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.openAI])) {
|
|
903
1123
|
try {
|
|
904
1124
|
const openAIInst = new (0, _openinferenceinstrumentationopenai.OpenAIInstrumentation)();
|
|
905
1125
|
openAIInst.manuallyInstrument(this.manualModules.openAI);
|
|
@@ -910,18 +1130,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
910
1130
|
}
|
|
911
1131
|
}
|
|
912
1132
|
const instrumentationConfigs = [
|
|
913
|
-
{ class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access',
|
|
914
|
-
{ class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access',
|
|
915
|
-
{ class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access',
|
|
916
|
-
{ class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access',
|
|
1133
|
+
{ class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.anthropic]) },
|
|
1134
|
+
{ class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.cohere]) },
|
|
1135
|
+
{ class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.bedrock]) },
|
|
1136
|
+
{ class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.pinecone]) },
|
|
917
1137
|
{
|
|
918
1138
|
class: _instrumentationllamaindex.LlamaIndexInstrumentation,
|
|
919
1139
|
name: "LlamaIndex",
|
|
920
|
-
module: _optionalChain([this, 'access',
|
|
1140
|
+
module: _optionalChain([this, 'access', _44 => _44.manualModules, 'optionalAccess', _45 => _45.llamaindex])
|
|
921
1141
|
},
|
|
922
|
-
{ class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access',
|
|
923
|
-
{ class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access',
|
|
924
|
-
{ class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access',
|
|
1142
|
+
{ class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _46 => _46.manualModules, 'optionalAccess', _47 => _47.chromadb]) },
|
|
1143
|
+
{ class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _48 => _48.manualModules, 'optionalAccess', _49 => _49.qdrant]) },
|
|
1144
|
+
{ class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _50 => _50.manualModules, 'optionalAccess', _51 => _51.together]) }
|
|
925
1145
|
];
|
|
926
1146
|
for (const config of instrumentationConfigs) {
|
|
927
1147
|
if (!config.module) {
|
|
@@ -937,7 +1157,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
937
1157
|
instrumentations.push(instrumentation);
|
|
938
1158
|
}
|
|
939
1159
|
}
|
|
940
|
-
if (_optionalChain([this, 'access',
|
|
1160
|
+
if (_optionalChain([this, 'access', _52 => _52.manualModules, 'optionalAccess', _53 => _53.langchain, 'optionalAccess', _54 => _54.callbackManagerModule])) {
|
|
941
1161
|
const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
|
|
942
1162
|
void (async () => {
|
|
943
1163
|
try {
|
|
@@ -953,7 +1173,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
953
1173
|
}
|
|
954
1174
|
})();
|
|
955
1175
|
}
|
|
956
|
-
if (_optionalChain([this, 'access',
|
|
1176
|
+
if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langgraph])) {
|
|
957
1177
|
try {
|
|
958
1178
|
new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
|
|
959
1179
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
|
|
@@ -961,7 +1181,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
961
1181
|
_chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
|
|
962
1182
|
}
|
|
963
1183
|
}
|
|
964
|
-
if (_optionalChain([this, 'access',
|
|
1184
|
+
if (_optionalChain([this, 'access', _57 => _57.manualModules, 'optionalAccess', _58 => _58.typesafe])) {
|
|
1185
|
+
try {
|
|
1186
|
+
new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
|
|
1187
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
|
|
1188
|
+
} catch (error) {
|
|
1189
|
+
_chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
if (_optionalChain([this, 'access', _59 => _59.manualModules, 'optionalAccess', _60 => _60.google_vertexai])) {
|
|
965
1193
|
const vertexModule = this.manualModules.google_vertexai;
|
|
966
1194
|
void (async () => {
|
|
967
1195
|
try {
|
|
@@ -976,7 +1204,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
976
1204
|
}
|
|
977
1205
|
})();
|
|
978
1206
|
}
|
|
979
|
-
if (_optionalChain([this, 'access',
|
|
1207
|
+
if (_optionalChain([this, 'access', _61 => _61.manualModules, 'optionalAccess', _62 => _62.google_genai])) {
|
|
980
1208
|
const genaiModule = this.manualModules.google_genai;
|
|
981
1209
|
void (async () => {
|
|
982
1210
|
try {
|
|
@@ -991,11 +1219,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
991
1219
|
}
|
|
992
1220
|
})();
|
|
993
1221
|
}
|
|
994
|
-
if (_optionalChain([this, 'access',
|
|
1222
|
+
if (_optionalChain([this, 'access', _63 => _63.manualModules, 'optionalAccess', _64 => _64.mcp])) {
|
|
995
1223
|
const mcpModules = this.manualModules.mcp;
|
|
996
1224
|
void (async () => {
|
|
997
1225
|
try {
|
|
998
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
1226
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KH5LOG5H.cjs")));
|
|
999
1227
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1000
1228
|
instrumentation.manuallyInstrument(mcpModules);
|
|
1001
1229
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1071,8 +1299,8 @@ function withProperties(properties, fn, thisArg) {
|
|
|
1071
1299
|
function propagatePropertiesImperatively(properties, base = _api.context.active()) {
|
|
1072
1300
|
try {
|
|
1073
1301
|
const manager = _api.context;
|
|
1074
|
-
const mgr = _optionalChain([manager, 'access',
|
|
1075
|
-
const store = _optionalChain([mgr, 'optionalAccess',
|
|
1302
|
+
const mgr = _optionalChain([manager, 'access', _65 => _65._getContextManager, 'optionalCall', _66 => _66()]);
|
|
1303
|
+
const store = _optionalChain([mgr, 'optionalAccess', _67 => _67._asyncLocalStorage]);
|
|
1076
1304
|
if (!store || typeof store.enterWith !== "function") {
|
|
1077
1305
|
return;
|
|
1078
1306
|
}
|
|
@@ -1174,7 +1402,7 @@ function withServiceName(name, fn, thisArg) {
|
|
|
1174
1402
|
}
|
|
1175
1403
|
function resolveServiceNameFromContext() {
|
|
1176
1404
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1177
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1405
|
+
return _optionalChain([props, 'optionalAccess', _68 => _68[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
|
|
1178
1406
|
}
|
|
1179
1407
|
function userProperties(user) {
|
|
1180
1408
|
const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
|
|
@@ -1241,7 +1469,7 @@ function withMessageId(id, fn, thisArg) {
|
|
|
1241
1469
|
}
|
|
1242
1470
|
function inheritedMuteTools() {
|
|
1243
1471
|
const properties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1244
|
-
return _optionalChain([properties, 'optionalAccess',
|
|
1472
|
+
return _optionalChain([properties, 'optionalAccess', _69 => _69[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
|
|
1245
1473
|
}
|
|
1246
1474
|
function muteProperties(options) {
|
|
1247
1475
|
const { input = true, output = true, tools = output } = options;
|
|
@@ -1300,9 +1528,9 @@ var Session = (_class2 = class {
|
|
|
1300
1528
|
* @param text - Text to append (null becomes a null/"hide marker")
|
|
1301
1529
|
* @param context - Optional per-turn context bag to attach to this turn
|
|
1302
1530
|
*/
|
|
1303
|
-
setInput(
|
|
1304
|
-
this.inputs.push(
|
|
1305
|
-
this.inputContexts.push(_nullishCoalesce(
|
|
1531
|
+
setInput(text2, context8) {
|
|
1532
|
+
this.inputs.push(text2);
|
|
1533
|
+
this.inputContexts.push(_nullishCoalesce(context8, () => ( {})));
|
|
1306
1534
|
this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT, JSON.stringify(this.inputs));
|
|
1307
1535
|
this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
|
|
1308
1536
|
}
|
|
@@ -1316,9 +1544,9 @@ var Session = (_class2 = class {
|
|
|
1316
1544
|
* @param text - Text to append (null becomes a null/"hide marker")
|
|
1317
1545
|
* @param context - Optional per-turn context bag to attach to this turn
|
|
1318
1546
|
*/
|
|
1319
|
-
setOutput(
|
|
1320
|
-
this.outputs.push(
|
|
1321
|
-
this.outputContexts.push(_nullishCoalesce(
|
|
1547
|
+
setOutput(text2, context8) {
|
|
1548
|
+
this.outputs.push(text2);
|
|
1549
|
+
this.outputContexts.push(_nullishCoalesce(context8, () => ( {})));
|
|
1322
1550
|
this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
|
|
1323
1551
|
this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
|
|
1324
1552
|
}
|
|
@@ -1403,7 +1631,7 @@ var Session = (_class2 = class {
|
|
|
1403
1631
|
* (free-form category, defaults to `'generic'`)
|
|
1404
1632
|
*/
|
|
1405
1633
|
addExternalLink(url, options) {
|
|
1406
|
-
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1634
|
+
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _70 => _70.title]), _optionalChain([options, 'optionalAccess', _71 => _71.linkType]));
|
|
1407
1635
|
}
|
|
1408
1636
|
}, _class2);
|
|
1409
1637
|
var SessionTitle = class {
|
|
@@ -1429,11 +1657,11 @@ function resolveSessionIdFromContext() {
|
|
|
1429
1657
|
return active.sessionId;
|
|
1430
1658
|
}
|
|
1431
1659
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1432
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1660
|
+
return _optionalChain([props, 'optionalAccess', _72 => _72[_chunkRV7JIIDGcjs.SESSION_ID]]);
|
|
1433
1661
|
}
|
|
1434
1662
|
function resolveMessageIdFromContext() {
|
|
1435
1663
|
const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
1436
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1664
|
+
return _optionalChain([props, 'optionalAccess', _73 => _73[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
|
|
1437
1665
|
}
|
|
1438
1666
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1439
1667
|
try {
|
|
@@ -1447,30 +1675,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
|
|
|
1447
1675
|
}
|
|
1448
1676
|
}
|
|
1449
1677
|
function addExternalLink(url, options) {
|
|
1450
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1678
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1451
1679
|
if (!sessionId) {
|
|
1452
1680
|
_chunkWC573FCIcjs.logger.warn(
|
|
1453
1681
|
"addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
|
|
1454
1682
|
);
|
|
1455
1683
|
return;
|
|
1456
1684
|
}
|
|
1457
|
-
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1685
|
+
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _75 => _75.title]), _optionalChain([options, 'optionalAccess', _76 => _76.linkType]));
|
|
1458
1686
|
}
|
|
1459
1687
|
function recordFeedback(type, options) {
|
|
1460
1688
|
const eventAttributes = { [_chunkRV7JIIDGcjs.FEEDBACK_TYPE]: type };
|
|
1461
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1689
|
+
if (_optionalChain([options, 'optionalAccess', _77 => _77.score]) !== void 0) {
|
|
1462
1690
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SCORE] = options.score;
|
|
1463
1691
|
}
|
|
1464
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1692
|
+
if (_optionalChain([options, 'optionalAccess', _78 => _78.reason]) !== void 0) {
|
|
1465
1693
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_REASON] = options.reason;
|
|
1466
1694
|
}
|
|
1467
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1695
|
+
if (_optionalChain([options, 'optionalAccess', _79 => _79.comment]) !== void 0) {
|
|
1468
1696
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_COMMENT] = options.comment;
|
|
1469
1697
|
}
|
|
1470
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1698
|
+
if (_optionalChain([options, 'optionalAccess', _80 => _80.source]) !== void 0) {
|
|
1471
1699
|
eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SOURCE] = options.source;
|
|
1472
1700
|
}
|
|
1473
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1701
|
+
if (_optionalChain([options, 'optionalAccess', _81 => _81.attributes])) {
|
|
1474
1702
|
for (const [key, value] of Object.entries(options.attributes)) {
|
|
1475
1703
|
const k = `${_chunkRV7JIIDGcjs.FEEDBACK_ATTR_PREFIX}${key}`;
|
|
1476
1704
|
if (eventAttributes[k] === void 0) {
|
|
@@ -1478,8 +1706,8 @@ function recordFeedback(type, options) {
|
|
|
1478
1706
|
}
|
|
1479
1707
|
}
|
|
1480
1708
|
}
|
|
1481
|
-
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1482
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1709
|
+
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.messageId]), () => ( resolveMessageIdFromContext()));
|
|
1710
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1483
1711
|
if (messageId === void 0 && sessionId === void 0) {
|
|
1484
1712
|
_chunkWC573FCIcjs.logger.warn(
|
|
1485
1713
|
"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."
|
|
@@ -1510,7 +1738,7 @@ function recordMetric(options) {
|
|
|
1510
1738
|
try {
|
|
1511
1739
|
recordMetricImpl(options);
|
|
1512
1740
|
} catch (error) {
|
|
1513
|
-
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess',
|
|
1741
|
+
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _84 => _84.name]))}) failed; metric dropped.`, error);
|
|
1514
1742
|
}
|
|
1515
1743
|
}
|
|
1516
1744
|
function recordMetricImpl(options) {
|
|
@@ -1614,14 +1842,14 @@ function recordMetricImpl(options) {
|
|
|
1614
1842
|
);
|
|
1615
1843
|
continue;
|
|
1616
1844
|
}
|
|
1617
|
-
let
|
|
1618
|
-
if (
|
|
1845
|
+
let text2 = typeof attrValue === "string" ? attrValue : String(attrValue);
|
|
1846
|
+
if (text2.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
|
|
1619
1847
|
_chunkWC573FCIcjs.logger.warn(
|
|
1620
1848
|
`recordMetric(${name}) attribute ${JSON.stringify(normalizedKey)} exceeds ${METRIC_ATTRIBUTE_VALUE_MAX_LEN} characters; truncated.`
|
|
1621
1849
|
);
|
|
1622
|
-
|
|
1850
|
+
text2 = text2.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
|
|
1623
1851
|
}
|
|
1624
|
-
eventAttributes[`${_chunkRV7JIIDGcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] =
|
|
1852
|
+
eventAttributes[`${_chunkRV7JIIDGcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text2;
|
|
1625
1853
|
accepted += 1;
|
|
1626
1854
|
}
|
|
1627
1855
|
}
|
|
@@ -1630,7 +1858,7 @@ function recordMetricImpl(options) {
|
|
|
1630
1858
|
eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = traceId;
|
|
1631
1859
|
}
|
|
1632
1860
|
if (scope === _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
|
|
1633
|
-
const spanContext = _optionalChain([_api.trace, 'access',
|
|
1861
|
+
const spanContext = _optionalChain([_api.trace, 'access', _85 => _85.getActiveSpan, 'call', _86 => _86(), 'optionalAccess', _87 => _87.spanContext, 'call', _88 => _88()]);
|
|
1634
1862
|
if (!spanContext || !_api.isSpanContextValid.call(void 0, spanContext)) {
|
|
1635
1863
|
_chunkWC573FCIcjs.logger.warn(
|
|
1636
1864
|
`recordMetric(${name}) called with scope 'trace' but no trace; metric dropped. Pass options.traceId, or call inside the span of the trace being scored.`
|
|
@@ -1668,7 +1896,7 @@ function recordMetricImpl(options) {
|
|
|
1668
1896
|
}
|
|
1669
1897
|
}
|
|
1670
1898
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1671
|
-
const isTitle = _optionalChain([options, 'optionalAccess',
|
|
1899
|
+
const isTitle = _optionalChain([options, 'optionalAccess', _89 => _89.mode]) === "title";
|
|
1672
1900
|
const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
|
|
1673
1901
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1674
1902
|
return tracer.startActiveSpan(spanName, (span) => {
|
|
@@ -1717,7 +1945,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1717
1945
|
});
|
|
1718
1946
|
}
|
|
1719
1947
|
function startSessionTitle(callback, options) {
|
|
1720
|
-
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1948
|
+
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _91 => _91(), 'optionalAccess', _92 => _92.sessionId])));
|
|
1721
1949
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1722
1950
|
return tracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1723
1951
|
if (resolvedSessionId) {
|
|
@@ -2139,10 +2367,12 @@ function maskValue(value, rule) {
|
|
|
2139
2367
|
return maskStringByPatternBasedRule(value, rule);
|
|
2140
2368
|
}
|
|
2141
2369
|
if (typeof value === "boolean" || typeof value === "number") {
|
|
2142
|
-
|
|
2370
|
+
const masked = maskStringByPatternBasedRule(String(value), rule);
|
|
2371
|
+
return masked === String(value) ? value : masked;
|
|
2143
2372
|
}
|
|
2144
2373
|
if (Array.isArray(value)) {
|
|
2145
|
-
|
|
2374
|
+
const masked = value.map((v) => maskStringByPatternBasedRule(String(v), rule));
|
|
2375
|
+
return masked.every((m, i) => m === String(value[i])) ? value : masked;
|
|
2146
2376
|
}
|
|
2147
2377
|
if (value !== null && typeof value === "object") {
|
|
2148
2378
|
const result = {};
|
|
@@ -2189,7 +2419,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
2189
2419
|
this.config = config;
|
|
2190
2420
|
}
|
|
2191
2421
|
onEmit(logRecord) {
|
|
2192
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
2422
|
+
const maskingConfig = _optionalChain([this, 'access', _93 => _93.config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.eventMasking]);
|
|
2193
2423
|
if (maskingConfig) {
|
|
2194
2424
|
maskLog(logRecord, maskingConfig);
|
|
2195
2425
|
}
|
|
@@ -2209,7 +2439,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
2209
2439
|
this.config = config;
|
|
2210
2440
|
}
|
|
2211
2441
|
onEmit(logRecord) {
|
|
2212
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
2442
|
+
const maskingConfig = _optionalChain([this, 'access', _96 => _96.config, 'access', _97 => _97.masking, 'optionalAccess', _98 => _98.eventMasking]);
|
|
2213
2443
|
if (maskingConfig) {
|
|
2214
2444
|
maskLog(logRecord, maskingConfig);
|
|
2215
2445
|
}
|
|
@@ -2310,14 +2540,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2310
2540
|
_chunkWC573FCIcjs.logger.debug("Creating logger provider", {
|
|
2311
2541
|
serviceName,
|
|
2312
2542
|
disableBatch: config.disableBatch,
|
|
2313
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
2543
|
+
hasMasking: !!_optionalChain([config, 'access', _99 => _99.masking, 'optionalAccess', _100 => _100.eventMasking])
|
|
2314
2544
|
});
|
|
2315
2545
|
const exporter = this.createLogExporter(config, serviceName);
|
|
2316
2546
|
const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
|
|
2317
2547
|
const resourceAttributes = {
|
|
2318
2548
|
...config.resourceAttributes,
|
|
2319
2549
|
"service.name": serviceName,
|
|
2320
|
-
[BRIZZ_SDK_VERSION]:
|
|
2550
|
+
[BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
|
|
2321
2551
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2322
2552
|
};
|
|
2323
2553
|
if (config.environment) {
|
|
@@ -2566,7 +2796,7 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2566
2796
|
const resourceAttrs = {
|
|
2567
2797
|
...config.resourceAttributes,
|
|
2568
2798
|
"service.name": config.appName,
|
|
2569
|
-
[BRIZZ_SDK_VERSION]:
|
|
2799
|
+
[BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
|
|
2570
2800
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2571
2801
|
};
|
|
2572
2802
|
if (config.environment) {
|
|
@@ -2693,8 +2923,8 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2693
2923
|
}
|
|
2694
2924
|
async forceFlush() {
|
|
2695
2925
|
await Promise.all([
|
|
2696
|
-
_optionalChain([this, 'access',
|
|
2697
|
-
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access',
|
|
2926
|
+
_optionalChain([this, 'access', _101 => _101._delegate, 'access', _102 => _102.forceFlush, 'optionalCall', _103 => _103()]),
|
|
2927
|
+
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _104 => _104.forceFlush, 'optionalCall', _105 => _105()]))
|
|
2698
2928
|
]);
|
|
2699
2929
|
}
|
|
2700
2930
|
}, _class5);
|
|
@@ -2749,7 +2979,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
2749
2979
|
}
|
|
2750
2980
|
onEnd(span) {
|
|
2751
2981
|
restampLangChainSpan(span);
|
|
2752
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
2982
|
+
const maskingConfig = _optionalChain([this, 'access', _106 => _106.config, 'access', _107 => _107.masking, 'optionalAccess', _108 => _108.spanMasking]);
|
|
2753
2983
|
if (maskingConfig) {
|
|
2754
2984
|
maskReadableSpan(span, maskingConfig);
|
|
2755
2985
|
}
|
|
@@ -2768,7 +2998,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
2768
2998
|
}
|
|
2769
2999
|
onEnd(span) {
|
|
2770
3000
|
restampLangChainSpan(span);
|
|
2771
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
3001
|
+
const maskingConfig = _optionalChain([this, 'access', _109 => _109.config, 'access', _110 => _110.masking, 'optionalAccess', _111 => _111.spanMasking]);
|
|
2772
3002
|
if (maskingConfig) {
|
|
2773
3003
|
maskReadableSpan(span, maskingConfig);
|
|
2774
3004
|
}
|
|
@@ -2785,12 +3015,12 @@ function maskReadableSpan(span, config) {
|
|
|
2785
3015
|
for (const [k, v] of Object.entries(attrs)) {
|
|
2786
3016
|
masked[k] = v;
|
|
2787
3017
|
}
|
|
2788
|
-
if (_optionalChain([config, 'access',
|
|
3018
|
+
if (_optionalChain([config, 'access', _112 => _112.rules, 'optionalAccess', _113 => _113.length])) {
|
|
2789
3019
|
masked = maskAttributes(masked, config.rules);
|
|
2790
3020
|
}
|
|
2791
3021
|
if (!config.disableDefaultRules) {
|
|
2792
|
-
const
|
|
2793
|
-
Object.assign(masked, maskAttributes(
|
|
3022
|
+
const text2 = Object.fromEntries(Object.entries(masked).filter(([k]) => isText(attrs[k])));
|
|
3023
|
+
Object.assign(masked, maskAttributes(text2, DEFAULT_MASKING_RULES));
|
|
2794
3024
|
}
|
|
2795
3025
|
const maskedEntries = Object.entries(masked);
|
|
2796
3026
|
for (const [k, v] of maskedEntries) {
|
|
@@ -2857,7 +3087,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
2857
3087
|
}
|
|
2858
3088
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
2859
3089
|
disableBatch: config.disableBatch,
|
|
2860
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
3090
|
+
hasMasking: !!_optionalChain([config, 'access', _114 => _114.masking, 'optionalAccess', _115 => _115.spanMasking])
|
|
2861
3091
|
});
|
|
2862
3092
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
2863
3093
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -3077,9 +3307,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3077
3307
|
*/
|
|
3078
3308
|
setupInstrumentation(options) {
|
|
3079
3309
|
const registry = InstrumentationRegistry.getInstance();
|
|
3080
|
-
|
|
3310
|
+
_chunkSTTOBCTPcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
3081
3311
|
patchInstalledCallbackManager();
|
|
3082
3312
|
patchInstalledLangGraph();
|
|
3313
|
+
patchInstalledTypeSafe();
|
|
3083
3314
|
if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
|
|
3084
3315
|
registry.setManualModules(options.instrumentModules);
|
|
3085
3316
|
}
|
|
@@ -3102,7 +3333,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3102
3333
|
const resourceAttributes = {
|
|
3103
3334
|
...resolvedConfig.resourceAttributes,
|
|
3104
3335
|
"service.name": resolvedConfig.appName,
|
|
3105
|
-
[BRIZZ_SDK_VERSION]:
|
|
3336
|
+
[BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
|
|
3106
3337
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
3107
3338
|
};
|
|
3108
3339
|
if (resolvedConfig.environment) {
|
|
@@ -3250,10 +3481,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3250
3481
|
}
|
|
3251
3482
|
try {
|
|
3252
3483
|
await this.shutdownModules();
|
|
3253
|
-
await _optionalChain([this, 'access',
|
|
3254
|
-
await _optionalChain([this, 'access',
|
|
3255
|
-
await _optionalChain([this, 'access',
|
|
3256
|
-
await _optionalChain([this, 'access',
|
|
3484
|
+
await _optionalChain([this, 'access', _116 => _116._tracerProvider, 'optionalAccess', _117 => _117.forceFlush, 'call', _118 => _118()]);
|
|
3485
|
+
await _optionalChain([this, 'access', _119 => _119._tracerProvider, 'optionalAccess', _120 => _120.shutdown, 'call', _121 => _121()]);
|
|
3486
|
+
await _optionalChain([this, 'access', _122 => _122._meterProvider, 'optionalAccess', _123 => _123.forceFlush, 'call', _124 => _124()]);
|
|
3487
|
+
await _optionalChain([this, 'access', _125 => _125._meterProvider, 'optionalAccess', _126 => _126.shutdown, 'call', _127 => _127()]);
|
|
3257
3488
|
this._initialized = false;
|
|
3258
3489
|
this._tracerProvider = null;
|
|
3259
3490
|
this._meterProvider = null;
|