@brizz/sdk 0.1.53 → 0.1.54
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 +38 -0
- package/dist/chunk-DBN4NKIG.js +107 -0
- package/dist/{chunk-KFETJN5M.cjs → chunk-FQBVTIBR.cjs} +7 -0
- package/dist/{chunk-STTOBCTP.cjs → chunk-KGNFUQ6Z.cjs} +1 -1
- package/dist/{chunk-XV3ZJO5K.js → chunk-MLMF2O5P.js} +1 -1
- package/dist/chunk-VZJNEST4.cjs +107 -0
- package/dist/{chunk-TEY6FAVZ.js → chunk-YGLDHCWC.js} +7 -0
- package/dist/google-genai-44O4QORJ.cjs +11 -0
- package/dist/{google-genai-T7I4FFIP.js → google-genai-PERR37LR.js} +2 -1
- package/dist/google-genai.cjs +3 -2
- package/dist/google-genai.js +2 -1
- package/dist/index.cjs +226 -54
- package/dist/index.js +210 -38
- package/dist/{mcp-KH5LOG5H.cjs → mcp-4M4XL46N.cjs} +39 -16
- package/dist/{mcp-DBLN5ZBE.js → mcp-KU7MFTOB.js} +29 -6
- package/dist/types/cjs/index.d.ts +1 -1
- package/dist/types/cjs/internal/config.d.ts +1 -0
- package/dist/types/cjs/internal/instrumentation/openai.d.ts +5 -0
- package/dist/types/cjs/internal/log/logging.d.ts +1 -0
- package/dist/types/cjs/internal/metric/metrics.d.ts +1 -0
- package/dist/types/cjs/internal/sdk.d.ts +3 -0
- package/dist/types/cjs/internal/trace/index.d.ts +1 -0
- package/dist/types/cjs/internal/trace/provider.d.ts +15 -0
- package/dist/types/cjs/internal/trace/tracing.d.ts +1 -0
- package/dist/types/esm/index.d.ts +1 -1
- package/dist/types/esm/internal/config.d.ts +1 -0
- package/dist/types/esm/internal/instrumentation/openai.d.ts +5 -0
- package/dist/types/esm/internal/log/logging.d.ts +1 -0
- package/dist/types/esm/internal/metric/metrics.d.ts +1 -0
- package/dist/types/esm/internal/sdk.d.ts +3 -0
- package/dist/types/esm/internal/trace/index.d.ts +1 -0
- package/dist/types/esm/internal/trace/provider.d.ts +15 -0
- package/dist/types/esm/internal/trace/tracing.d.ts +1 -0
- package/package.json +16 -15
- package/dist/google-genai-LMEZ62FB.cjs +0 -10
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,16 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkKGNFUQ6Zcjs = require('./chunk-KGNFUQ6Z.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkVZJNEST4cjs = require('./chunk-VZJNEST4.cjs');
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
|
|
@@ -83,7 +92,6 @@ var _chunkRV7JIIDGcjs = require('./chunk-RV7JIIDG.cjs');
|
|
|
83
92
|
var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
|
|
84
93
|
|
|
85
94
|
// src/internal/instrumentation/auto-init.ts
|
|
86
|
-
var _openinferenceinstrumentationopenai = require('@arizeai/openinference-instrumentation-openai');
|
|
87
95
|
var _instrumentation = require('@opentelemetry/instrumentation');
|
|
88
96
|
var _instrumentationanthropic = require('@traceloop/instrumentation-anthropic');
|
|
89
97
|
var _instrumentationbedrock = require('@traceloop/instrumentation-bedrock');
|
|
@@ -104,7 +112,7 @@ var _api = require('@opentelemetry/api');
|
|
|
104
112
|
|
|
105
113
|
// src/internal/instrumentation/langgraph/attributes.ts
|
|
106
114
|
var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
107
|
-
var INSTRUMENTATION_VERSION =
|
|
115
|
+
var INSTRUMENTATION_VERSION = _chunkKGNFUQ6Zcjs.getSDKVersion.call(void 0, );
|
|
108
116
|
var MODULE_NAME = "@langchain/langgraph";
|
|
109
117
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
110
118
|
function isSupportedVersion(version) {
|
|
@@ -174,6 +182,7 @@ var parentRecorded = /* @__PURE__ */ new WeakSet();
|
|
|
174
182
|
var LangGraphInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
175
183
|
constructor(config = {}) {
|
|
176
184
|
super(INSTRUMENTATION_NAME, INSTRUMENTATION_VERSION, config);
|
|
185
|
+
this.setTracerProvider(_chunkVZJNEST4cjs.brizzTracerProvider);
|
|
177
186
|
}
|
|
178
187
|
init() {
|
|
179
188
|
return [
|
|
@@ -426,6 +435,14 @@ function attachRunToIteration(stream, run) {
|
|
|
426
435
|
return iterable;
|
|
427
436
|
}
|
|
428
437
|
|
|
438
|
+
// src/internal/instrumentation/openai.ts
|
|
439
|
+
var _openinferenceinstrumentationopenai = require('@arizeai/openinference-instrumentation-openai');
|
|
440
|
+
var BrizzOpenAIInstrumentation = class extends _openinferenceinstrumentationopenai.OpenAIInstrumentation {
|
|
441
|
+
get tracer() {
|
|
442
|
+
return _chunkVZJNEST4cjs.brizzTracerProvider.getTracer(this.instrumentationName, this.instrumentationVersion);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
|
|
429
446
|
// src/internal/instrumentation/typesafe.ts
|
|
430
447
|
|
|
431
448
|
|
|
@@ -451,7 +468,8 @@ var ATTR_ANSWERS = "typesafe.answers";
|
|
|
451
468
|
var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
|
|
452
469
|
var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
453
470
|
constructor(config = {}) {
|
|
454
|
-
super(INSTRUMENTATION_NAME2,
|
|
471
|
+
super(INSTRUMENTATION_NAME2, _chunkKGNFUQ6Zcjs.getSDKVersion.call(void 0, ), config);
|
|
472
|
+
this.setTracerProvider(_chunkVZJNEST4cjs.brizzTracerProvider);
|
|
455
473
|
}
|
|
456
474
|
init() {
|
|
457
475
|
return [
|
|
@@ -644,7 +662,7 @@ var exceptionLogger = (error) => {
|
|
|
644
662
|
function loadGenAIInstrumentations() {
|
|
645
663
|
const instrumentations = [];
|
|
646
664
|
try {
|
|
647
|
-
instrumentations.push(new (
|
|
665
|
+
instrumentations.push(new BrizzOpenAIInstrumentation());
|
|
648
666
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded OpenAI instrumentation");
|
|
649
667
|
} catch (error) {
|
|
650
668
|
_chunkWC573FCIcjs.logger.error(`Failed to auto-load OpenAI instrumentation: ${String(error)}`);
|
|
@@ -669,7 +687,7 @@ function loadGenAIInstrumentations() {
|
|
|
669
687
|
}
|
|
670
688
|
}
|
|
671
689
|
try {
|
|
672
|
-
_instrumentation.registerInstrumentations.call(void 0, { instrumentations });
|
|
690
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations, tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider });
|
|
673
691
|
_chunkWC573FCIcjs.logger.info(`Auto-registered ${instrumentations.length} GenAI instrumentations`);
|
|
674
692
|
} catch (error) {
|
|
675
693
|
_chunkWC573FCIcjs.logger.error(`Failed to register GenAI instrumentations: ${String(error)}`);
|
|
@@ -679,9 +697,9 @@ function loadGenAIInstrumentations() {
|
|
|
679
697
|
function loadMCPInstrumentation() {
|
|
680
698
|
void (async () => {
|
|
681
699
|
try {
|
|
682
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
700
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-4M4XL46N.cjs")));
|
|
683
701
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
684
|
-
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
|
|
702
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider });
|
|
685
703
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
686
704
|
} catch (error) {
|
|
687
705
|
_chunkWC573FCIcjs.logger.debug(
|
|
@@ -692,7 +710,10 @@ function loadMCPInstrumentation() {
|
|
|
692
710
|
}
|
|
693
711
|
function loadLangGraphInstrumentation() {
|
|
694
712
|
try {
|
|
695
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
713
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
714
|
+
instrumentations: [new LangGraphInstrumentation()],
|
|
715
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
716
|
+
});
|
|
696
717
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded LangGraph instrumentation");
|
|
697
718
|
} catch (error) {
|
|
698
719
|
_chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
|
|
@@ -700,7 +721,10 @@ function loadLangGraphInstrumentation() {
|
|
|
700
721
|
}
|
|
701
722
|
function loadTypeSafeInstrumentation() {
|
|
702
723
|
try {
|
|
703
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
724
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
725
|
+
instrumentations: [new TypeSafeInstrumentation()],
|
|
726
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
727
|
+
});
|
|
704
728
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
|
|
705
729
|
} catch (error) {
|
|
706
730
|
_chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not loaded: ${String(error)}`);
|
|
@@ -711,7 +735,10 @@ function loadVertexAIInstrumentation() {
|
|
|
711
735
|
try {
|
|
712
736
|
const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
|
|
713
737
|
const vertexAI = new VertexAIInstrumentation({ exceptionLogger });
|
|
714
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
738
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
739
|
+
instrumentations: [vertexAI],
|
|
740
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
741
|
+
});
|
|
715
742
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded Vertex AI instrumentation");
|
|
716
743
|
} catch (error) {
|
|
717
744
|
_chunkWC573FCIcjs.logger.debug(
|
|
@@ -723,9 +750,12 @@ function loadVertexAIInstrumentation() {
|
|
|
723
750
|
function loadGoogleGenAIInstrumentation() {
|
|
724
751
|
void (async () => {
|
|
725
752
|
try {
|
|
726
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
753
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-44O4QORJ.cjs")));
|
|
727
754
|
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
728
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
755
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
756
|
+
instrumentations: [googleGenAI],
|
|
757
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
758
|
+
});
|
|
729
759
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
730
760
|
} catch (error) {
|
|
731
761
|
_chunkWC573FCIcjs.logger.debug(
|
|
@@ -757,7 +787,9 @@ function loadVercelAITelemetry() {
|
|
|
757
787
|
try {
|
|
758
788
|
const otel = await Promise.resolve().then(() => _interopRequireWildcard(require("@ai-sdk/otel")));
|
|
759
789
|
if (typeof otel.LegacyOpenTelemetry === "function") {
|
|
760
|
-
integrations.push(
|
|
790
|
+
integrations.push(
|
|
791
|
+
new otel.LegacyOpenTelemetry({ tracer: _chunkVZJNEST4cjs.brizzTracerProvider.getTracer("ai") })
|
|
792
|
+
);
|
|
761
793
|
otelCollectorLoaded = true;
|
|
762
794
|
}
|
|
763
795
|
} catch (e) {
|
|
@@ -811,9 +843,22 @@ var autoInstrumentationsLoaded = autoInitializeInstrumentations();
|
|
|
811
843
|
|
|
812
844
|
var _resources2 = require('@opentelemetry/resources');
|
|
813
845
|
var _sdkmetrics = require('@opentelemetry/sdk-metrics');
|
|
846
|
+
var _sdktracebase = require('@opentelemetry/sdk-trace-base');
|
|
814
847
|
var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
815
848
|
|
|
816
849
|
// src/internal/config.ts
|
|
850
|
+
function parseBoolEnv(name) {
|
|
851
|
+
const raw = process.env[name];
|
|
852
|
+
if (raw === void 0) {
|
|
853
|
+
return void 0;
|
|
854
|
+
}
|
|
855
|
+
const value = raw.trim().toLowerCase();
|
|
856
|
+
if (value === "true" || value === "false") {
|
|
857
|
+
return value === "true";
|
|
858
|
+
}
|
|
859
|
+
_chunkWC573FCIcjs.logger.warn(`Brizz: ignoring ${name}=${raw}; expected true or false.`);
|
|
860
|
+
return void 0;
|
|
861
|
+
}
|
|
817
862
|
function resolveConfig(options) {
|
|
818
863
|
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();
|
|
819
864
|
let resolvedLogLevel;
|
|
@@ -865,7 +910,8 @@ function resolveConfig(options) {
|
|
|
865
910
|
disableSpanExporter: process.env["BRIZZ_DISABLE_SPAN_EXPORTER"] === "true" || !!options.disableSpanExporter,
|
|
866
911
|
environment: process.env["BRIZZ_ENVIRONMENT"] || options.environment,
|
|
867
912
|
logLevel: resolvedLogLevel,
|
|
868
|
-
masking: resolvedMasking
|
|
913
|
+
masking: resolvedMasking,
|
|
914
|
+
setGlobalTracerProvider: _nullishCoalesce(_nullishCoalesce(parseBoolEnv("BRIZZ_SET_GLOBAL_TRACER_PROVIDER"), () => ( options.setGlobalTracerProvider)), () => ( true))
|
|
869
915
|
};
|
|
870
916
|
const dsnInput = process.env["BRIZZ_DSN"] || options.dsn;
|
|
871
917
|
let parsedDSN = null;
|
|
@@ -935,6 +981,7 @@ function resolveConfig(options) {
|
|
|
935
981
|
hasApiKey: !!resolvedConfig.apiKey,
|
|
936
982
|
dsnProvided: !!dsnInput,
|
|
937
983
|
disableBatch: resolvedConfig.disableBatch,
|
|
984
|
+
setGlobalTracerProvider: resolvedConfig.setGlobalTracerProvider,
|
|
938
985
|
envOverrides: {
|
|
939
986
|
hasEnvApiKey: !!process.env["BRIZZ_API_KEY"],
|
|
940
987
|
hasEnvBaseUrl: !!process.env["BRIZZ_BASE_URL"],
|
|
@@ -961,7 +1008,6 @@ var SDK_LANGUAGE = "typescript";
|
|
|
961
1008
|
|
|
962
1009
|
|
|
963
1010
|
|
|
964
|
-
|
|
965
1011
|
// src/internal/instrumentation/langchain.ts
|
|
966
1012
|
|
|
967
1013
|
|
|
@@ -1101,9 +1147,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1101
1147
|
*/
|
|
1102
1148
|
loadInstrumentation(InstrumentationClass, name, manualModule, exceptionLogger2) {
|
|
1103
1149
|
try {
|
|
1104
|
-
const inst =
|
|
1105
|
-
|
|
1106
|
-
|
|
1150
|
+
const inst = _chunkVZJNEST4cjs.bindToBrizz.call(void 0,
|
|
1151
|
+
new InstrumentationClass({
|
|
1152
|
+
exceptionLogger: exceptionLogger2 || ((error) => _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
|
|
1153
|
+
})
|
|
1154
|
+
);
|
|
1107
1155
|
if (manualModule) {
|
|
1108
1156
|
inst.manuallyInstrument(manualModule);
|
|
1109
1157
|
_chunkWC573FCIcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
|
|
@@ -1121,7 +1169,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1121
1169
|
loadManualInstrumentations(instrumentations, exceptionLogger2) {
|
|
1122
1170
|
if (_optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.openAI])) {
|
|
1123
1171
|
try {
|
|
1124
|
-
const openAIInst = new (
|
|
1172
|
+
const openAIInst = new BrizzOpenAIInstrumentation();
|
|
1125
1173
|
openAIInst.manuallyInstrument(this.manualModules.openAI);
|
|
1126
1174
|
instrumentations.push(openAIInst);
|
|
1127
1175
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for OpenAI");
|
|
@@ -1162,7 +1210,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1162
1210
|
void (async () => {
|
|
1163
1211
|
try {
|
|
1164
1212
|
const { LangChainInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@arizeai/openinference-instrumentation-langchain")));
|
|
1165
|
-
const lcInst = new LangChainInstrumentation();
|
|
1213
|
+
const lcInst = new LangChainInstrumentation({ tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider });
|
|
1166
1214
|
lcInst.manuallyInstrument(callbackManagerModule);
|
|
1167
1215
|
patchCallbackManagerModule(callbackManagerModule);
|
|
1168
1216
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangChain");
|
|
@@ -1194,7 +1242,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1194
1242
|
void (async () => {
|
|
1195
1243
|
try {
|
|
1196
1244
|
const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
|
|
1197
|
-
const vertexInst = new VertexAIInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1245
|
+
const vertexInst = _chunkVZJNEST4cjs.bindToBrizz.call(void 0, new VertexAIInstrumentation({ exceptionLogger: exceptionLogger2 }));
|
|
1198
1246
|
vertexInst.manuallyInstrument(vertexModule);
|
|
1199
1247
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
|
|
1200
1248
|
} catch (error) {
|
|
@@ -1208,7 +1256,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1208
1256
|
const genaiModule = this.manualModules.google_genai;
|
|
1209
1257
|
void (async () => {
|
|
1210
1258
|
try {
|
|
1211
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
1259
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-44O4QORJ.cjs")));
|
|
1212
1260
|
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1213
1261
|
genaiInst.manuallyInstrument(genaiModule);
|
|
1214
1262
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
@@ -1223,7 +1271,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1223
1271
|
const mcpModules = this.manualModules.mcp;
|
|
1224
1272
|
void (async () => {
|
|
1225
1273
|
try {
|
|
1226
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
1274
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-4M4XL46N.cjs")));
|
|
1227
1275
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1228
1276
|
instrumentation.manuallyInstrument(mcpModules);
|
|
1229
1277
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1267,6 +1315,7 @@ var _sdklogs = require('@opentelemetry/sdk-logs');
|
|
|
1267
1315
|
|
|
1268
1316
|
// src/internal/trace/session.ts
|
|
1269
1317
|
|
|
1318
|
+
var sessionTracer = _chunkVZJNEST4cjs.brizzTracerProvider.getTracer("@brizz/sdk");
|
|
1270
1319
|
function setCurrentSpanCustomProperties(properties) {
|
|
1271
1320
|
const current = _api.trace.getActiveSpan();
|
|
1272
1321
|
if (!current || !current.isRecording()) {
|
|
@@ -1898,8 +1947,7 @@ function recordMetricImpl(options) {
|
|
|
1898
1947
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1899
1948
|
const isTitle = _optionalChain([options, 'optionalAccess', _89 => _89.mode]) === "title";
|
|
1900
1949
|
const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
|
|
1901
|
-
|
|
1902
|
-
return tracer.startActiveSpan(spanName, (span) => {
|
|
1950
|
+
return sessionTracer.startActiveSpan(spanName, (span) => {
|
|
1903
1951
|
span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, sessionId);
|
|
1904
1952
|
if (extraProperties) {
|
|
1905
1953
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
@@ -1946,8 +1994,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1946
1994
|
}
|
|
1947
1995
|
function startSessionTitle(callback, options) {
|
|
1948
1996
|
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _91 => _91(), 'optionalAccess', _92 => _92.sessionId])));
|
|
1949
|
-
|
|
1950
|
-
return tracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1997
|
+
return sessionTracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1951
1998
|
if (resolvedSessionId) {
|
|
1952
1999
|
span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, resolvedSessionId);
|
|
1953
2000
|
}
|
|
@@ -2547,7 +2594,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2547
2594
|
const resourceAttributes = {
|
|
2548
2595
|
...config.resourceAttributes,
|
|
2549
2596
|
"service.name": serviceName,
|
|
2550
|
-
[BRIZZ_SDK_VERSION]:
|
|
2597
|
+
[BRIZZ_SDK_VERSION]: _chunkKGNFUQ6Zcjs.getSDKVersion.call(void 0, ),
|
|
2551
2598
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2552
2599
|
};
|
|
2553
2600
|
if (config.environment) {
|
|
@@ -2646,6 +2693,11 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2646
2693
|
getLoggerProvider() {
|
|
2647
2694
|
return this.loggerProvider;
|
|
2648
2695
|
}
|
|
2696
|
+
async forceFlush() {
|
|
2697
|
+
await Promise.all(
|
|
2698
|
+
[...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _101 => _101.forceFlush, 'call', _102 => _102()]))
|
|
2699
|
+
);
|
|
2700
|
+
}
|
|
2649
2701
|
/**
|
|
2650
2702
|
* Shutdown the logging module
|
|
2651
2703
|
*/
|
|
@@ -2755,6 +2807,9 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
|
|
|
2755
2807
|
}
|
|
2756
2808
|
return this.metricsReader;
|
|
2757
2809
|
}
|
|
2810
|
+
async forceFlush() {
|
|
2811
|
+
await _optionalChain([this, 'access', _103 => _103.metricsReader, 'optionalAccess', _104 => _104.forceFlush, 'call', _105 => _105()]);
|
|
2812
|
+
}
|
|
2758
2813
|
/**
|
|
2759
2814
|
* Shutdown the metrics module
|
|
2760
2815
|
*/
|
|
@@ -2796,7 +2851,7 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2796
2851
|
const resourceAttrs = {
|
|
2797
2852
|
...config.resourceAttributes,
|
|
2798
2853
|
"service.name": config.appName,
|
|
2799
|
-
[BRIZZ_SDK_VERSION]:
|
|
2854
|
+
[BRIZZ_SDK_VERSION]: _chunkKGNFUQ6Zcjs.getSDKVersion.call(void 0, ),
|
|
2800
2855
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2801
2856
|
};
|
|
2802
2857
|
if (config.environment) {
|
|
@@ -2923,8 +2978,8 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2923
2978
|
}
|
|
2924
2979
|
async forceFlush() {
|
|
2925
2980
|
await Promise.all([
|
|
2926
|
-
_optionalChain([this, 'access',
|
|
2927
|
-
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access',
|
|
2981
|
+
_optionalChain([this, 'access', _106 => _106._delegate, 'access', _107 => _107.forceFlush, 'optionalCall', _108 => _108()]),
|
|
2982
|
+
...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _109 => _109.forceFlush, 'optionalCall', _110 => _110()]))
|
|
2928
2983
|
]);
|
|
2929
2984
|
}
|
|
2930
2985
|
}, _class5);
|
|
@@ -2934,7 +2989,7 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2934
2989
|
|
|
2935
2990
|
|
|
2936
2991
|
|
|
2937
|
-
|
|
2992
|
+
|
|
2938
2993
|
function applyContextAttributes(span) {
|
|
2939
2994
|
const sessionProperties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
|
|
2940
2995
|
if (sessionProperties) {
|
|
@@ -2956,7 +3011,10 @@ var LIBRARY_ID_ATTRIBUTES = [
|
|
|
2956
3011
|
"langsmith.metadata.thread_id",
|
|
2957
3012
|
"langsmith.metadata.session_id",
|
|
2958
3013
|
"langsmith.metadata.conversation_id",
|
|
2959
|
-
"langsmith.trace.session_id"
|
|
3014
|
+
"langsmith.trace.session_id",
|
|
3015
|
+
// User-id aliases the streamer copies into brizz.user.id (userIDAliases).
|
|
3016
|
+
"user.id",
|
|
3017
|
+
"langfuse.user.id"
|
|
2960
3018
|
];
|
|
2961
3019
|
var DEFAULT_RULE_ATTRIBUTES = String.raw`^(?!brizz\.(?!session\.(?:input|output)(?:\.context)?$|session\.title$|internal\.intent$)` + `|(?:${LIBRARY_ID_ATTRIBUTES.map((key) => key.replaceAll(".", String.raw`\.`)).join("|")})$)`;
|
|
2962
3020
|
var isText = (value) => typeof value === "string" || Array.isArray(value) && value.some((item) => typeof item === "string");
|
|
@@ -2979,7 +3037,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
2979
3037
|
}
|
|
2980
3038
|
onEnd(span) {
|
|
2981
3039
|
restampLangChainSpan(span);
|
|
2982
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
3040
|
+
const maskingConfig = _optionalChain([this, 'access', _111 => _111.config, 'access', _112 => _112.masking, 'optionalAccess', _113 => _113.spanMasking]);
|
|
2983
3041
|
if (maskingConfig) {
|
|
2984
3042
|
maskReadableSpan(span, maskingConfig);
|
|
2985
3043
|
}
|
|
@@ -2998,7 +3056,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
2998
3056
|
}
|
|
2999
3057
|
onEnd(span) {
|
|
3000
3058
|
restampLangChainSpan(span);
|
|
3001
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
3059
|
+
const maskingConfig = _optionalChain([this, 'access', _114 => _114.config, 'access', _115 => _115.masking, 'optionalAccess', _116 => _116.spanMasking]);
|
|
3002
3060
|
if (maskingConfig) {
|
|
3003
3061
|
maskReadableSpan(span, maskingConfig);
|
|
3004
3062
|
}
|
|
@@ -3015,7 +3073,7 @@ function maskReadableSpan(span, config) {
|
|
|
3015
3073
|
for (const [k, v] of Object.entries(attrs)) {
|
|
3016
3074
|
masked[k] = v;
|
|
3017
3075
|
}
|
|
3018
|
-
if (_optionalChain([config, 'access',
|
|
3076
|
+
if (_optionalChain([config, 'access', _117 => _117.rules, 'optionalAccess', _118 => _118.length])) {
|
|
3019
3077
|
masked = maskAttributes(masked, config.rules);
|
|
3020
3078
|
}
|
|
3021
3079
|
if (!config.disableDefaultRules) {
|
|
@@ -3087,7 +3145,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
3087
3145
|
}
|
|
3088
3146
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
3089
3147
|
disableBatch: config.disableBatch,
|
|
3090
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
3148
|
+
hasMasking: !!_optionalChain([config, 'access', _119 => _119.masking, 'optionalAccess', _120 => _120.spanMasking])
|
|
3091
3149
|
});
|
|
3092
3150
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
3093
3151
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -3130,6 +3188,9 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
3130
3188
|
}
|
|
3131
3189
|
return this.spanProcessor;
|
|
3132
3190
|
}
|
|
3191
|
+
async forceFlush() {
|
|
3192
|
+
await _optionalChain([this, 'access', _121 => _121.spanProcessor, 'optionalAccess', _122 => _122.forceFlush, 'call', _123 => _123()]);
|
|
3193
|
+
}
|
|
3133
3194
|
async shutdown() {
|
|
3134
3195
|
_chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
|
|
3135
3196
|
if (this.spanProcessor) {
|
|
@@ -3173,7 +3234,7 @@ function encodeToken(agent) {
|
|
|
3173
3234
|
function currentTraceparent() {
|
|
3174
3235
|
const carrier = {};
|
|
3175
3236
|
try {
|
|
3176
|
-
|
|
3237
|
+
_chunkVZJNEST4cjs.injectTraceContext.call(void 0, _api.context.active(), carrier);
|
|
3177
3238
|
} catch (e6) {
|
|
3178
3239
|
}
|
|
3179
3240
|
return _nullishCoalesce(carrier["traceparent"], () => ( ""));
|
|
@@ -3234,7 +3295,7 @@ function resolveAgent(agent) {
|
|
|
3234
3295
|
sessionId = decoded.sessionId;
|
|
3235
3296
|
if (decoded.traceparent) {
|
|
3236
3297
|
try {
|
|
3237
|
-
parentContext =
|
|
3298
|
+
parentContext = _chunkVZJNEST4cjs.extractTraceContext.call(void 0, parentContext, { traceparent: decoded.traceparent });
|
|
3238
3299
|
} catch (e8) {
|
|
3239
3300
|
}
|
|
3240
3301
|
}
|
|
@@ -3287,6 +3348,11 @@ function resolveMcpSessionTracking(configured) {
|
|
|
3287
3348
|
const enabled = fromEnv === "true";
|
|
3288
3349
|
return typeof configured === "object" ? { ...configured, enabled } : enabled;
|
|
3289
3350
|
}
|
|
3351
|
+
var BRIZZ_OWNED = /* @__PURE__ */ Symbol.for("brizz.sdk.ownedTracerProvider");
|
|
3352
|
+
function globalTracerDelegate() {
|
|
3353
|
+
const global = _api.trace.getTracerProvider();
|
|
3354
|
+
return typeof global.getDelegate === "function" ? global.getDelegate() : global;
|
|
3355
|
+
}
|
|
3290
3356
|
var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init15.call(this);_class7.prototype.__init16.call(this);_class7.prototype.__init17.call(this); }
|
|
3291
3357
|
static __initStatic4() {this.instance = null}
|
|
3292
3358
|
static getInstance() {
|
|
@@ -3307,7 +3373,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3307
3373
|
*/
|
|
3308
3374
|
setupInstrumentation(options) {
|
|
3309
3375
|
const registry = InstrumentationRegistry.getInstance();
|
|
3310
|
-
|
|
3376
|
+
_chunkKGNFUQ6Zcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
3311
3377
|
patchInstalledCallbackManager();
|
|
3312
3378
|
patchInstalledLangGraph();
|
|
3313
3379
|
patchInstalledTypeSafe();
|
|
@@ -3324,8 +3390,17 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3324
3390
|
const registry = InstrumentationRegistry.getInstance();
|
|
3325
3391
|
const manualInstrumentations = registry.getManualInstrumentations();
|
|
3326
3392
|
if (options.disableNodeSdk) {
|
|
3393
|
+
_chunkVZJNEST4cjs.setPrivateTracerProvider.call(void 0, null);
|
|
3394
|
+
if (!resolvedConfig.setGlobalTracerProvider) {
|
|
3395
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
3396
|
+
"Brizz: setGlobalTracerProvider: false has no effect with disableNodeSdk: true. Brizz creates no TracerProvider, so spans follow the provider you register with getSpanProcessor()."
|
|
3397
|
+
);
|
|
3398
|
+
}
|
|
3327
3399
|
if (manualInstrumentations.length > 0) {
|
|
3328
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3400
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3401
|
+
instrumentations: manualInstrumentations,
|
|
3402
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
3403
|
+
});
|
|
3329
3404
|
}
|
|
3330
3405
|
_chunkWC573FCIcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
|
|
3331
3406
|
return;
|
|
@@ -3333,7 +3408,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3333
3408
|
const resourceAttributes = {
|
|
3334
3409
|
...resolvedConfig.resourceAttributes,
|
|
3335
3410
|
"service.name": resolvedConfig.appName,
|
|
3336
|
-
[BRIZZ_SDK_VERSION]:
|
|
3411
|
+
[BRIZZ_SDK_VERSION]: _chunkKGNFUQ6Zcjs.getSDKVersion.call(void 0, ),
|
|
3337
3412
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
3338
3413
|
};
|
|
3339
3414
|
if (resolvedConfig.environment) {
|
|
@@ -3343,15 +3418,34 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3343
3418
|
resourceAttributes["service.version"] = resolvedConfig.appVersion;
|
|
3344
3419
|
}
|
|
3345
3420
|
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));
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3421
|
+
const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkO2IBZJOJcjs.InterruptPropagator)(), getSpanProcessor()];
|
|
3422
|
+
if (resolvedConfig.setGlobalTracerProvider) {
|
|
3423
|
+
this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({ resource, spanProcessors });
|
|
3424
|
+
this.registerGlobalTracerProvider(this._tracerProvider);
|
|
3425
|
+
} else {
|
|
3426
|
+
this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
|
|
3427
|
+
resource,
|
|
3428
|
+
spanProcessors,
|
|
3429
|
+
sampler: new (0, _sdktracebase.AlwaysOnSampler)()
|
|
3430
|
+
});
|
|
3431
|
+
if (_chunkVZJNEST4cjs.ensureContextManager.call(void 0, ) === "failed") {
|
|
3432
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
3433
|
+
"Brizz: no OpenTelemetry context manager is active and Brizz could not install one; span parenting and session/user propagation will not work."
|
|
3434
|
+
);
|
|
3435
|
+
}
|
|
3436
|
+
_chunkVZJNEST4cjs.setPrivateTracerProvider.call(void 0, this._tracerProvider);
|
|
3437
|
+
_chunkWC573FCIcjs.logger.info(
|
|
3438
|
+
"Brizz: using a private TracerProvider; Brizz spans are exported to Brizz only and the global TracerProvider is left untouched."
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3441
|
+
Reflect.set(this._tracerProvider, BRIZZ_OWNED, true);
|
|
3351
3442
|
this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
|
|
3352
3443
|
_api.metrics.setGlobalMeterProvider(this._meterProvider);
|
|
3353
3444
|
if (manualInstrumentations.length > 0) {
|
|
3354
|
-
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3445
|
+
_instrumentation.registerInstrumentations.call(void 0, {
|
|
3446
|
+
instrumentations: manualInstrumentations,
|
|
3447
|
+
tracerProvider: _chunkVZJNEST4cjs.brizzTracerProvider
|
|
3448
|
+
});
|
|
3355
3449
|
_chunkWC573FCIcjs.logger.info(
|
|
3356
3450
|
`Telemetry providers started with ${manualInstrumentations.length} manual instrumentations`
|
|
3357
3451
|
);
|
|
@@ -3361,6 +3455,27 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3361
3455
|
);
|
|
3362
3456
|
}
|
|
3363
3457
|
}
|
|
3458
|
+
/**
|
|
3459
|
+
* Register `provider` globally and say so when another provider already
|
|
3460
|
+
* holds the slot: OpenTelemetry refuses the second registration without a
|
|
3461
|
+
* word, and every Brizz span then goes to the other provider.
|
|
3462
|
+
* @private
|
|
3463
|
+
*/
|
|
3464
|
+
registerGlobalTracerProvider(provider) {
|
|
3465
|
+
_chunkVZJNEST4cjs.setPrivateTracerProvider.call(void 0, null);
|
|
3466
|
+
provider.register();
|
|
3467
|
+
const registered = globalTracerDelegate();
|
|
3468
|
+
if (registered === provider) {
|
|
3469
|
+
return;
|
|
3470
|
+
}
|
|
3471
|
+
if (Reflect.get(registered, BRIZZ_OWNED) === true) {
|
|
3472
|
+
_chunkWC573FCIcjs.logger.debug("A TracerProvider from an earlier Brizz.initialize() is still registered");
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
3476
|
+
"Brizz: another OpenTelemetry TracerProvider is already registered globally, so Brizz could not register its own. Spans from Brizz instrumentations will go to that provider, not to Brizz. Pass setGlobalTracerProvider: false to Brizz.initialize() (or set BRIZZ_SET_GLOBAL_TRACER_PROVIDER=false) to send them to Brizz on a separate provider."
|
|
3477
|
+
);
|
|
3478
|
+
}
|
|
3364
3479
|
/**
|
|
3365
3480
|
* Initialize telemetry modules.
|
|
3366
3481
|
*
|
|
@@ -3459,6 +3574,62 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3459
3574
|
throw new Error(`Failed to initialize SDK: ${String(error)}`, { cause: error });
|
|
3460
3575
|
}
|
|
3461
3576
|
}
|
|
3577
|
+
/**
|
|
3578
|
+
* Send the telemetry Brizz has queued, without shutting down.
|
|
3579
|
+
*
|
|
3580
|
+
* On serverless platforms that throttle CPU once a response is sent (Cloud
|
|
3581
|
+
* Run, Lambda), await it before responding: the batch timer may not fire
|
|
3582
|
+
* again before the instance is frozen or recycled. Never throws.
|
|
3583
|
+
*
|
|
3584
|
+
* @param timeoutMillis - How long to wait. Defaults to 5000.
|
|
3585
|
+
* @returns `true` when everything was sent within the budget; `false` on a
|
|
3586
|
+
* timeout, an export error, or before `initialize()`.
|
|
3587
|
+
*
|
|
3588
|
+
* @example
|
|
3589
|
+
* ```typescript
|
|
3590
|
+
* await Brizz.flush();
|
|
3591
|
+
* res.send(reply);
|
|
3592
|
+
* ```
|
|
3593
|
+
*/
|
|
3594
|
+
async flush(timeoutMillis = 5e3) {
|
|
3595
|
+
if (!this._initialized) {
|
|
3596
|
+
_chunkWC573FCIcjs.logger.debug("Brizz.flush called before Brizz.initialize; nothing to flush");
|
|
3597
|
+
return false;
|
|
3598
|
+
}
|
|
3599
|
+
const settle = async (name, flush) => {
|
|
3600
|
+
try {
|
|
3601
|
+
await flush();
|
|
3602
|
+
return true;
|
|
3603
|
+
} catch (error) {
|
|
3604
|
+
_chunkWC573FCIcjs.logger.debug(`Brizz.flush: flushing ${name} failed: ${String(error)}`);
|
|
3605
|
+
return false;
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
const work = Promise.all([
|
|
3609
|
+
settle("spans", () => TracingModule.getInstance().forceFlush()),
|
|
3610
|
+
settle("logs", () => LoggingModule.getInstance().forceFlush()),
|
|
3611
|
+
// Under disableNodeSdk the reader belongs to whatever MeterProvider the
|
|
3612
|
+
// app registered, if any; an unbound reader cannot flush.
|
|
3613
|
+
...this._meterProvider ? [settle("metrics", () => MetricsModule.getInstance().forceFlush())] : []
|
|
3614
|
+
]).then((results) => results.every(Boolean));
|
|
3615
|
+
let timer;
|
|
3616
|
+
const timedOut = new Promise((resolve) => {
|
|
3617
|
+
timer = setTimeout(() => resolve("timeout"), timeoutMillis);
|
|
3618
|
+
timer.unref();
|
|
3619
|
+
});
|
|
3620
|
+
try {
|
|
3621
|
+
const result = await Promise.race([work, timedOut]);
|
|
3622
|
+
if (result === "timeout") {
|
|
3623
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
3624
|
+
`Brizz.flush did not finish within ${timeoutMillis}ms; telemetry still queued will be sent with the next batch.`
|
|
3625
|
+
);
|
|
3626
|
+
return false;
|
|
3627
|
+
}
|
|
3628
|
+
return result;
|
|
3629
|
+
} finally {
|
|
3630
|
+
clearTimeout(timer);
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3462
3633
|
/**
|
|
3463
3634
|
* Gracefully shutdown the Brizz SDK.
|
|
3464
3635
|
*
|
|
@@ -3481,10 +3652,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3481
3652
|
}
|
|
3482
3653
|
try {
|
|
3483
3654
|
await this.shutdownModules();
|
|
3484
|
-
await _optionalChain([this, 'access',
|
|
3485
|
-
await _optionalChain([this, 'access',
|
|
3486
|
-
await _optionalChain([this, 'access',
|
|
3487
|
-
await _optionalChain([this, 'access',
|
|
3655
|
+
await _optionalChain([this, 'access', _124 => _124._tracerProvider, 'optionalAccess', _125 => _125.forceFlush, 'call', _126 => _126()]);
|
|
3656
|
+
await _optionalChain([this, 'access', _127 => _127._tracerProvider, 'optionalAccess', _128 => _128.shutdown, 'call', _129 => _129()]);
|
|
3657
|
+
await _optionalChain([this, 'access', _130 => _130._meterProvider, 'optionalAccess', _131 => _131.forceFlush, 'call', _132 => _132()]);
|
|
3658
|
+
await _optionalChain([this, 'access', _133 => _133._meterProvider, 'optionalAccess', _134 => _134.shutdown, 'call', _135 => _135()]);
|
|
3488
3659
|
this._initialized = false;
|
|
3489
3660
|
this._tracerProvider = null;
|
|
3490
3661
|
this._meterProvider = null;
|
|
@@ -3551,4 +3722,5 @@ var Brizz = new _Brizz();
|
|
|
3551
3722
|
|
|
3552
3723
|
|
|
3553
3724
|
|
|
3554
|
-
|
|
3725
|
+
|
|
3726
|
+
exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.SeverityNumber = _apilogs.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 = _chunkVZJNEST4cjs.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;
|