@brizz/sdk 0.1.30 → 0.1.32
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 +64 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-6M3CBP2N.js +8 -0
- package/dist/chunk-7SUF4VVI.js +36 -0
- package/dist/{chunk-LTXMCGVQ.cjs → chunk-A3OOY5A2.cjs} +49 -9
- package/dist/{chunk-NUTJMVD4.cjs → chunk-IH7TSRRT.cjs} +175 -199
- package/dist/{chunk-MWX3GIJW.js → chunk-LTLONC6I.js} +48 -8
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-OZCOXBB7.cjs +46 -0
- package/dist/chunk-SCYD7XCI.cjs +8 -0
- package/dist/{chunk-6UYAVA5T.js → chunk-U474AL6K.js} +16 -40
- package/dist/chunk-UNLNNKZ7.cjs +36 -0
- package/dist/{chunk-RORIBZEV.js → chunk-VGMJ3KUM.js} +0 -8
- package/dist/{chunk-JB6MA2RV.cjs → chunk-WC573FCI.cjs} +1 -7
- package/dist/{chunk-3OLW4TOG.js → chunk-Y4HNUX3Q.js} +1 -7
- package/dist/eve.cjs +88 -0
- package/dist/eve.d.cts +19 -0
- package/dist/eve.d.ts +19 -0
- package/dist/eve.js +88 -0
- package/dist/index.cjs +56 -28
- package/dist/index.js +41 -13
- package/dist/interrupt-6D6DA7R2.cjs +12 -0
- package/dist/{interrupt-HDNPDMYY.js → interrupt-VMUSMALH.js} +3 -2
- package/dist/{mcp-56TY4LZ5.js → mcp-3YERODPL.js} +6 -3
- package/dist/{mcp-6BDG4SWY.cjs → mcp-GXP22YAQ.cjs} +29 -26
- package/dist/preload.cjs +13 -10
- package/dist/preload.js +7 -4
- package/package.json +43 -28
- package/dist/chunk-GCORRK6B.cjs +0 -54
- package/dist/interrupt-HOP3XPQF.cjs +0 -11
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
7
|
+
var _chunkSCYD7XCIcjs = require('./chunk-SCYD7XCI.cjs');
|
|
6
8
|
|
|
7
|
-
var _chunkJB6MA2RVcjs = require('./chunk-JB6MA2RV.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var _chunkLTXMCGVQcjs = require('./chunk-LTXMCGVQ.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
var _chunkA3OOY5A2cjs = require('./chunk-A3OOY5A2.cjs');
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
|
|
@@ -29,7 +31,13 @@ var _chunkLTXMCGVQcjs = require('./chunk-LTXMCGVQ.cjs');
|
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunkOZCOXBB7cjs = require('./chunk-OZCOXBB7.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
|
|
33
41
|
|
|
34
42
|
// src/internal/instrumentation/registry.ts
|
|
35
43
|
var _instrumentationanthropic = require('@traceloop/instrumentation-anthropic');
|
|
@@ -56,15 +64,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
56
64
|
loadInstrumentation(InstrumentationClass, name, manualModule, exceptionLogger) {
|
|
57
65
|
try {
|
|
58
66
|
const inst = new InstrumentationClass({
|
|
59
|
-
exceptionLogger: exceptionLogger || ((error) =>
|
|
67
|
+
exceptionLogger: exceptionLogger || ((error) => _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
|
|
60
68
|
});
|
|
61
69
|
if (manualModule) {
|
|
62
70
|
inst.manuallyInstrument(manualModule);
|
|
63
|
-
|
|
71
|
+
_chunkWC573FCIcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
|
|
64
72
|
}
|
|
65
73
|
return inst;
|
|
66
74
|
} catch (error) {
|
|
67
|
-
|
|
75
|
+
_chunkWC573FCIcjs.logger.error(`Failed to load ${name} instrumentation: ${String(error)}`);
|
|
68
76
|
return null;
|
|
69
77
|
}
|
|
70
78
|
}
|
|
@@ -109,9 +117,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
109
117
|
const { LangChainInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@arizeai/openinference-instrumentation-langchain")));
|
|
110
118
|
const lcInst = new LangChainInstrumentation();
|
|
111
119
|
lcInst.manuallyInstrument(callbackManagerModule);
|
|
112
|
-
|
|
120
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangChain");
|
|
113
121
|
} catch (error) {
|
|
114
|
-
|
|
122
|
+
_chunkWC573FCIcjs.logger.error(
|
|
115
123
|
`Failed to load LangChain instrumentation. Ensure @langchain/core is installed: ${String(error)}`
|
|
116
124
|
);
|
|
117
125
|
}
|
|
@@ -124,9 +132,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
124
132
|
const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
|
|
125
133
|
const vertexInst = new VertexAIInstrumentation({ exceptionLogger });
|
|
126
134
|
vertexInst.manuallyInstrument(vertexModule);
|
|
127
|
-
|
|
135
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
|
|
128
136
|
} catch (error) {
|
|
129
|
-
|
|
137
|
+
_chunkWC573FCIcjs.logger.error(
|
|
130
138
|
`Failed to load Vertex AI instrumentation. Ensure @traceloop/instrumentation-vertexai is installed: ${String(error)}`
|
|
131
139
|
);
|
|
132
140
|
}
|
|
@@ -136,12 +144,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
136
144
|
const mcpModules = this.manualModules.mcp;
|
|
137
145
|
void (async () => {
|
|
138
146
|
try {
|
|
139
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
147
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-GXP22YAQ.cjs")));
|
|
140
148
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
141
149
|
instrumentation.manuallyInstrument(mcpModules);
|
|
142
|
-
|
|
150
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
143
151
|
} catch (error) {
|
|
144
|
-
|
|
152
|
+
_chunkWC573FCIcjs.logger.error(`Failed to apply MCP instrumentation: ${String(error)}`);
|
|
145
153
|
}
|
|
146
154
|
})();
|
|
147
155
|
}
|
|
@@ -151,7 +159,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
151
159
|
*/
|
|
152
160
|
setManualModules(modules) {
|
|
153
161
|
this.manualModules = modules;
|
|
154
|
-
|
|
162
|
+
_chunkWC573FCIcjs.logger.info("Manual instrumentation modules configured for Next.js/Webpack compatibility");
|
|
155
163
|
}
|
|
156
164
|
/**
|
|
157
165
|
* Get manual instrumentations only.
|
|
@@ -159,15 +167,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
159
167
|
*/
|
|
160
168
|
getManualInstrumentations() {
|
|
161
169
|
if (!this.manualModules || Object.keys(this.manualModules).length === 0) {
|
|
162
|
-
|
|
170
|
+
_chunkWC573FCIcjs.logger.debug("No manual instrumentation modules configured");
|
|
163
171
|
return [];
|
|
164
172
|
}
|
|
165
173
|
const instrumentations = [];
|
|
166
174
|
const exceptionLogger = (error) => {
|
|
167
|
-
|
|
175
|
+
_chunkWC573FCIcjs.logger.error(`Exception in manual instrumentation: ${String(error)}`);
|
|
168
176
|
};
|
|
169
177
|
this.loadManualInstrumentations(instrumentations, exceptionLogger);
|
|
170
|
-
|
|
178
|
+
_chunkWC573FCIcjs.logger.info(`Loaded ${instrumentations.length} manual instrumentations`);
|
|
171
179
|
return instrumentations;
|
|
172
180
|
}
|
|
173
181
|
}, _class);
|
|
@@ -444,7 +452,7 @@ function compilePatternEntries(patternEntries) {
|
|
|
444
452
|
try {
|
|
445
453
|
patternGroups.push(getGroupedPattern(patternEntry));
|
|
446
454
|
} catch (error) {
|
|
447
|
-
|
|
455
|
+
_chunkWC573FCIcjs.logger.warn(`Invalid pattern '${patternEntry.name}': ${patternEntry.pattern}`, error);
|
|
448
456
|
continue;
|
|
449
457
|
}
|
|
450
458
|
}
|
|
@@ -454,7 +462,7 @@ function compilePatternEntries(patternEntries) {
|
|
|
454
462
|
try {
|
|
455
463
|
return new RegExp(patternGroups.join("|"));
|
|
456
464
|
} catch (error) {
|
|
457
|
-
|
|
465
|
+
_chunkWC573FCIcjs.logger.warn("Failed to compile pattern entries into regex", error);
|
|
458
466
|
return null;
|
|
459
467
|
}
|
|
460
468
|
}
|
|
@@ -470,7 +478,7 @@ function getCompiledPatternsForRule(rule) {
|
|
|
470
478
|
}
|
|
471
479
|
function getCompiledAttributeNamePattern(rule) {
|
|
472
480
|
if (!rule.attributePattern) {
|
|
473
|
-
|
|
481
|
+
_chunkWC573FCIcjs.logger.debug("No attribute pattern provided, using default .*");
|
|
474
482
|
return /.*/;
|
|
475
483
|
}
|
|
476
484
|
let compiledPatternString = rule.attributePattern;
|
|
@@ -481,12 +489,12 @@ function getCompiledAttributeNamePattern(rule) {
|
|
|
481
489
|
}
|
|
482
490
|
function shouldContinueExecution(startTime, iterations, timeoutMs) {
|
|
483
491
|
if (Date.now() - startTime > timeoutMs) {
|
|
484
|
-
|
|
492
|
+
_chunkWC573FCIcjs.logger.warn("Regex execution timed out - potential ReDoS pattern detected");
|
|
485
493
|
return false;
|
|
486
494
|
}
|
|
487
495
|
const maxIterations = 1e3;
|
|
488
496
|
if (iterations > maxIterations) {
|
|
489
|
-
|
|
497
|
+
_chunkWC573FCIcjs.logger.warn("Regex execution exceeded maximum iterations - potential ReDoS pattern detected");
|
|
490
498
|
return false;
|
|
491
499
|
}
|
|
492
500
|
return true;
|
|
@@ -527,7 +535,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
|
|
|
527
535
|
});
|
|
528
536
|
}
|
|
529
537
|
} catch (error) {
|
|
530
|
-
|
|
538
|
+
_chunkWC573FCIcjs.logger.warn("Regex execution failed, skipping masking", error);
|
|
531
539
|
return value;
|
|
532
540
|
}
|
|
533
541
|
for (const matchInfo of matches.toReversed()) {
|
|
@@ -546,7 +554,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
|
|
|
546
554
|
}
|
|
547
555
|
}
|
|
548
556
|
}
|
|
549
|
-
|
|
557
|
+
_chunkWC573FCIcjs.logger.info(`Masking detected: pattern '${patternName}' found match in value`);
|
|
550
558
|
const masked = mode === "partial" ? matchInfo.text.at(0) + "*****" : "*****";
|
|
551
559
|
value = value.slice(0, matchInfo.start) + masked + value.slice(matchInfo.end);
|
|
552
560
|
}
|
|
@@ -555,7 +563,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
|
|
|
555
563
|
function maskStringByPatternBasedRule(value, rule) {
|
|
556
564
|
const patternEntries = convertPatternsToPatternEntries(rule.patterns);
|
|
557
565
|
if (patternEntries.length === 0) {
|
|
558
|
-
|
|
566
|
+
_chunkWC573FCIcjs.logger.warn("No patterns provided for masking rule, returning original value");
|
|
559
567
|
return value;
|
|
560
568
|
}
|
|
561
569
|
const mode = rule.mode;
|
|
@@ -599,7 +607,7 @@ function maskAttributes(attributes, rules, outputOriginalValue = false) {
|
|
|
599
607
|
const value = maskedAttributes[attribute];
|
|
600
608
|
if (value !== null && value !== void 0) {
|
|
601
609
|
if (outputOriginalValue) {
|
|
602
|
-
|
|
610
|
+
_chunkWC573FCIcjs.logger.debug(`Masking attribute '${attribute}' with original value`, { value });
|
|
603
611
|
}
|
|
604
612
|
maskedAttributes[attribute] = maskValue(value, rule);
|
|
605
613
|
}
|
|
@@ -619,7 +627,7 @@ var DEFAULT_LOG_MASKING_RULES = [
|
|
|
619
627
|
var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProcessor {
|
|
620
628
|
|
|
621
629
|
constructor(exporter, config) {
|
|
622
|
-
super(exporter);
|
|
630
|
+
super({ exporter });
|
|
623
631
|
this.config = config;
|
|
624
632
|
}
|
|
625
633
|
onEmit(logRecord) {
|
|
@@ -627,10 +635,10 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
627
635
|
if (maskingConfig) {
|
|
628
636
|
maskLog(logRecord, maskingConfig);
|
|
629
637
|
}
|
|
630
|
-
const associationProperties = _api.context.active().getValue(
|
|
638
|
+
const associationProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
|
|
631
639
|
if (associationProperties) {
|
|
632
640
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
633
|
-
logRecord.setAttribute(`${
|
|
641
|
+
logRecord.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
634
642
|
}
|
|
635
643
|
}
|
|
636
644
|
super.onEmit(logRecord);
|
|
@@ -639,7 +647,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
639
647
|
var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcessor {
|
|
640
648
|
|
|
641
649
|
constructor(exporter, config) {
|
|
642
|
-
super(exporter);
|
|
650
|
+
super({ exporter });
|
|
643
651
|
this.config = config;
|
|
644
652
|
}
|
|
645
653
|
onEmit(logRecord) {
|
|
@@ -647,10 +655,10 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
647
655
|
if (maskingConfig) {
|
|
648
656
|
maskLog(logRecord, maskingConfig);
|
|
649
657
|
}
|
|
650
|
-
const associationProperties = _api.context.active().getValue(
|
|
658
|
+
const associationProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
|
|
651
659
|
if (associationProperties) {
|
|
652
660
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
653
|
-
logRecord.setAttribute(`${
|
|
661
|
+
logRecord.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
654
662
|
}
|
|
655
663
|
}
|
|
656
664
|
super.onEmit(logRecord);
|
|
@@ -677,7 +685,7 @@ function maskLog(logRecord, config) {
|
|
|
677
685
|
newAttributes[key] = value;
|
|
678
686
|
}
|
|
679
687
|
for (const [key, value] of Object.entries(logRecord.attributes)) {
|
|
680
|
-
if (key.startsWith(
|
|
688
|
+
if (key.startsWith(_chunkOZCOXBB7cjs.INTERNAL_EVENT_PREFIX)) {
|
|
681
689
|
newAttributes[key] = value;
|
|
682
690
|
}
|
|
683
691
|
}
|
|
@@ -693,7 +701,7 @@ function maskLog(logRecord, config) {
|
|
|
693
701
|
}
|
|
694
702
|
return logRecord;
|
|
695
703
|
} catch (error) {
|
|
696
|
-
|
|
704
|
+
_chunkWC573FCIcjs.logger.error("Error masking log record:", error);
|
|
697
705
|
return logRecord;
|
|
698
706
|
}
|
|
699
707
|
}
|
|
@@ -715,60 +723,60 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
715
723
|
*/
|
|
716
724
|
initLogExporter(config) {
|
|
717
725
|
if (this.logExporter) {
|
|
718
|
-
|
|
726
|
+
_chunkWC573FCIcjs.logger.debug("Log exporter already initialized, skipping re-initialization");
|
|
719
727
|
return;
|
|
720
728
|
}
|
|
721
729
|
if (config.customLogExporter) {
|
|
722
|
-
|
|
730
|
+
_chunkWC573FCIcjs.logger.debug("Using custom log exporter");
|
|
723
731
|
this.logExporter = config.customLogExporter;
|
|
724
|
-
|
|
732
|
+
_chunkWC573FCIcjs.logger.debug("Custom log exporter initialized successfully");
|
|
725
733
|
return;
|
|
726
734
|
}
|
|
727
735
|
const logsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/logs";
|
|
728
|
-
|
|
736
|
+
_chunkWC573FCIcjs.logger.debug("Initializing default OTLP log exporter", { url: logsUrl });
|
|
729
737
|
const headers = { ...config.headers };
|
|
730
738
|
this.logExporter = new (0, _exporterlogsotlphttp.OTLPLogExporter)({
|
|
731
739
|
url: logsUrl,
|
|
732
740
|
headers
|
|
733
741
|
});
|
|
734
|
-
|
|
742
|
+
_chunkWC573FCIcjs.logger.debug("OTLP log exporter initialized successfully");
|
|
735
743
|
}
|
|
736
744
|
/**
|
|
737
745
|
* Initialize the log processor with masking support
|
|
738
746
|
*/
|
|
739
747
|
initLogProcessor(config) {
|
|
740
748
|
if (this.logProcessor) {
|
|
741
|
-
|
|
749
|
+
_chunkWC573FCIcjs.logger.debug("Log processor already initialized, skipping re-initialization");
|
|
742
750
|
return;
|
|
743
751
|
}
|
|
744
752
|
if (!this.logExporter) {
|
|
745
753
|
throw new Error("Log exporter must be initialized before processor");
|
|
746
754
|
}
|
|
747
|
-
|
|
755
|
+
_chunkWC573FCIcjs.logger.debug("Initializing log processor", {
|
|
748
756
|
disableBatch: config.disableBatch,
|
|
749
757
|
hasMasking: !!_optionalChain([config, 'access', _33 => _33.masking, 'optionalAccess', _34 => _34.eventMasking])
|
|
750
758
|
});
|
|
751
759
|
this.logProcessor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(this.logExporter, config) : new BrizzBatchLogRecordProcessor(this.logExporter, config);
|
|
752
|
-
|
|
760
|
+
_chunkWC573FCIcjs.logger.debug("Log processor initialized successfully");
|
|
753
761
|
}
|
|
754
762
|
/**
|
|
755
763
|
* Initialize the logger provider
|
|
756
764
|
*/
|
|
757
765
|
initLoggerProvider(config) {
|
|
758
766
|
if (this.loggerProvider) {
|
|
759
|
-
|
|
767
|
+
_chunkWC573FCIcjs.logger.debug("Logger provider already initialized, skipping re-initialization");
|
|
760
768
|
return;
|
|
761
769
|
}
|
|
762
770
|
if (!this.logProcessor) {
|
|
763
771
|
throw new Error("Log processor must be initialized before logger provider");
|
|
764
772
|
}
|
|
765
|
-
|
|
773
|
+
_chunkWC573FCIcjs.logger.debug("Creating resource with service name", {
|
|
766
774
|
serviceName: config.appName
|
|
767
775
|
});
|
|
768
776
|
const resourceAttributes = {
|
|
769
777
|
...config.resourceAttributes,
|
|
770
778
|
"service.name": config.appName,
|
|
771
|
-
[BRIZZ_SDK_VERSION]:
|
|
779
|
+
[BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
|
|
772
780
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
773
781
|
};
|
|
774
782
|
if (config.environment) {
|
|
@@ -778,29 +786,29 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
778
786
|
resourceAttributes["service.version"] = config.appVersion;
|
|
779
787
|
}
|
|
780
788
|
const resource = _resources.resourceFromAttributes.call(void 0, resourceAttributes);
|
|
781
|
-
|
|
789
|
+
_chunkWC573FCIcjs.logger.debug("Creating logger provider with resource");
|
|
782
790
|
this.loggerProvider = new (0, _sdklogs.LoggerProvider)({
|
|
783
791
|
resource,
|
|
784
792
|
processors: [this.logProcessor]
|
|
785
793
|
});
|
|
786
|
-
|
|
794
|
+
_chunkWC573FCIcjs.logger.debug("Logger provider initialization completed");
|
|
787
795
|
}
|
|
788
796
|
/**
|
|
789
797
|
* Initialize the logging module with the provided configuration
|
|
790
798
|
*/
|
|
791
799
|
setup(config) {
|
|
792
|
-
|
|
800
|
+
_chunkWC573FCIcjs.logger.info("Setting up logging module");
|
|
793
801
|
this.initLogExporter(config);
|
|
794
802
|
this.initLogProcessor(config);
|
|
795
803
|
this.initLoggerProvider(config);
|
|
796
804
|
_LoggingModule.instance = this;
|
|
797
|
-
|
|
805
|
+
_chunkWC573FCIcjs.logger.info("Logging module setup completed");
|
|
798
806
|
}
|
|
799
807
|
/**
|
|
800
808
|
* Emit a custom event to the telemetry pipeline
|
|
801
809
|
*/
|
|
802
810
|
emitEvent(name, attributes, body, severityNumber = _apilogs.SeverityNumber.INFO) {
|
|
803
|
-
|
|
811
|
+
_chunkWC573FCIcjs.logger.debug("Attempting to emit event", {
|
|
804
812
|
name,
|
|
805
813
|
hasAttributes: !!attributes,
|
|
806
814
|
attributesCount: attributes ? Object.keys(attributes).length : 0,
|
|
@@ -808,17 +816,17 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
808
816
|
severityNumber
|
|
809
817
|
});
|
|
810
818
|
if (!this.loggerProvider) {
|
|
811
|
-
|
|
819
|
+
_chunkWC573FCIcjs.logger.error("Cannot emit event: Logger provider not initialized");
|
|
812
820
|
throw new Error("Logging module not initialized");
|
|
813
821
|
}
|
|
814
822
|
const logAttributes = { "event.name": name };
|
|
815
823
|
if (attributes) {
|
|
816
824
|
Object.assign(logAttributes, attributes);
|
|
817
|
-
|
|
825
|
+
_chunkWC573FCIcjs.logger.debug("Combined log attributes", { attributes: Object.keys(logAttributes) });
|
|
818
826
|
}
|
|
819
|
-
|
|
827
|
+
_chunkWC573FCIcjs.logger.debug("Getting logger instance for brizz_events");
|
|
820
828
|
const eventLogger = this.loggerProvider.getLogger("brizz.events");
|
|
821
|
-
|
|
829
|
+
_chunkWC573FCIcjs.logger.debug("Emitting log record with eventName", { eventName: name });
|
|
822
830
|
try {
|
|
823
831
|
eventLogger.emit({
|
|
824
832
|
eventName: name,
|
|
@@ -826,10 +834,10 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
826
834
|
severityNumber,
|
|
827
835
|
body
|
|
828
836
|
});
|
|
829
|
-
|
|
837
|
+
_chunkWC573FCIcjs.logger.debug("Event successfully emitted", { eventName: name });
|
|
830
838
|
} catch (error) {
|
|
831
|
-
|
|
832
|
-
|
|
839
|
+
_chunkWC573FCIcjs.logger.error(`Failed to emit event '${name}'`, { error, eventName: name });
|
|
840
|
+
_chunkWC573FCIcjs.logger.error("Log record that failed", {
|
|
833
841
|
eventName: name,
|
|
834
842
|
hasAttributes: logAttributes,
|
|
835
843
|
severityNumber,
|
|
@@ -854,7 +862,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
854
862
|
* Shutdown the logging module
|
|
855
863
|
*/
|
|
856
864
|
async shutdown() {
|
|
857
|
-
|
|
865
|
+
_chunkWC573FCIcjs.logger.debug("Shutting down logging module");
|
|
858
866
|
if (this.loggerProvider) {
|
|
859
867
|
await this.loggerProvider.shutdown();
|
|
860
868
|
this.loggerProvider = null;
|
|
@@ -864,7 +872,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
864
872
|
if (_LoggingModule.instance === this) {
|
|
865
873
|
_LoggingModule.instance = null;
|
|
866
874
|
}
|
|
867
|
-
|
|
875
|
+
_chunkWC573FCIcjs.logger.debug("Logging module shutdown completed");
|
|
868
876
|
}
|
|
869
877
|
}, _class2.__initStatic(), _class2);
|
|
870
878
|
function emitEvent(name, attributes, body, severityNumber = _apilogs.SeverityNumber.INFO) {
|
|
@@ -884,16 +892,16 @@ function setCurrentSpanCustomProperties(properties) {
|
|
|
884
892
|
}
|
|
885
893
|
for (const [key, value] of Object.entries(properties)) {
|
|
886
894
|
try {
|
|
887
|
-
current.setAttribute(`${
|
|
895
|
+
current.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
888
896
|
} catch (e) {
|
|
889
897
|
}
|
|
890
898
|
}
|
|
891
899
|
}
|
|
892
900
|
function callWithProperties(properties, fn, thisArg, ...args) {
|
|
893
901
|
const base = _api.context.active();
|
|
894
|
-
const prev = base.getValue(
|
|
902
|
+
const prev = base.getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
|
|
895
903
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
896
|
-
const next = base.setValue(
|
|
904
|
+
const next = base.setValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY, merged);
|
|
897
905
|
return _api.context.with(next, fn, thisArg, ...args);
|
|
898
906
|
}
|
|
899
907
|
function withProperties(properties, fn, thisArg) {
|
|
@@ -910,10 +918,10 @@ function muteProperties(options) {
|
|
|
910
918
|
const { input = true, output = true } = options;
|
|
911
919
|
const properties = {};
|
|
912
920
|
if (input) {
|
|
913
|
-
properties[
|
|
921
|
+
properties[_chunkOZCOXBB7cjs.MUTE_INPUT] = "true";
|
|
914
922
|
}
|
|
915
923
|
if (output) {
|
|
916
|
-
properties[
|
|
924
|
+
properties[_chunkOZCOXBB7cjs.MUTE_OUTPUT] = "true";
|
|
917
925
|
}
|
|
918
926
|
return properties;
|
|
919
927
|
}
|
|
@@ -924,11 +932,11 @@ function withMute(options, fn, thisArg) {
|
|
|
924
932
|
return withProperties(muteProperties(options), fn, thisArg);
|
|
925
933
|
}
|
|
926
934
|
function withSessionId(sessionId, fn, thisArg, extraProperties) {
|
|
927
|
-
const properties = { [
|
|
935
|
+
const properties = { [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId, ...extraProperties };
|
|
928
936
|
return withProperties(properties, fn, thisArg);
|
|
929
937
|
}
|
|
930
938
|
function callWithSessionId(sessionId, fn, thisArg, ...args) {
|
|
931
|
-
return callWithProperties({ [
|
|
939
|
+
return callWithProperties({ [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
|
|
932
940
|
}
|
|
933
941
|
var Session = (_class3 = class {
|
|
934
942
|
|
|
@@ -956,8 +964,8 @@ var Session = (_class3 = class {
|
|
|
956
964
|
setInput(text, context4) {
|
|
957
965
|
this.inputs.push(text);
|
|
958
966
|
this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
959
|
-
this.span.setAttribute(
|
|
960
|
-
this.span.setAttribute(
|
|
967
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_INPUT, JSON.stringify(this.inputs));
|
|
968
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
|
|
961
969
|
}
|
|
962
970
|
/**
|
|
963
971
|
* Append an assistant turn to session output tracking.
|
|
@@ -972,8 +980,8 @@ var Session = (_class3 = class {
|
|
|
972
980
|
setOutput(text, context4) {
|
|
973
981
|
this.outputs.push(text);
|
|
974
982
|
this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
975
|
-
this.span.setAttribute(
|
|
976
|
-
this.span.setAttribute(
|
|
983
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
|
|
984
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
|
|
977
985
|
}
|
|
978
986
|
/**
|
|
979
987
|
* Set the session title on the span.
|
|
@@ -981,7 +989,7 @@ var Session = (_class3 = class {
|
|
|
981
989
|
* @param title - The generated title string
|
|
982
990
|
*/
|
|
983
991
|
setTitle(title) {
|
|
984
|
-
this.span.setAttribute(
|
|
992
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_TITLE, title);
|
|
985
993
|
}
|
|
986
994
|
/**
|
|
987
995
|
* Update custom properties on the session span.
|
|
@@ -991,7 +999,7 @@ var Session = (_class3 = class {
|
|
|
991
999
|
*/
|
|
992
1000
|
updateProperties(properties) {
|
|
993
1001
|
for (const [key, value] of Object.entries(properties)) {
|
|
994
|
-
this.span.setAttribute(`${
|
|
1002
|
+
this.span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
995
1003
|
}
|
|
996
1004
|
}
|
|
997
1005
|
/**
|
|
@@ -1021,35 +1029,35 @@ var SessionTitle = class {
|
|
|
1021
1029
|
* @param title - The generated title string
|
|
1022
1030
|
*/
|
|
1023
1031
|
setTitle(title) {
|
|
1024
|
-
this.span.setAttribute(
|
|
1032
|
+
this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_TITLE, title);
|
|
1025
1033
|
}
|
|
1026
1034
|
};
|
|
1027
1035
|
function getActiveSession() {
|
|
1028
|
-
return _api.context.active().getValue(
|
|
1036
|
+
return _api.context.active().getValue(_chunkOZCOXBB7cjs.SESSION_OBJECT_CONTEXT_KEY);
|
|
1029
1037
|
}
|
|
1030
1038
|
function resolveSessionIdFromContext() {
|
|
1031
1039
|
const active = getActiveSession();
|
|
1032
1040
|
if (active) {
|
|
1033
1041
|
return active.sessionId;
|
|
1034
1042
|
}
|
|
1035
|
-
const props = _api.context.active().getValue(
|
|
1036
|
-
return _optionalChain([props, 'optionalAccess', _37 => _37[
|
|
1043
|
+
const props = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
|
|
1044
|
+
return _optionalChain([props, 'optionalAccess', _37 => _37[_chunkOZCOXBB7cjs.SESSION_ID]]);
|
|
1037
1045
|
}
|
|
1038
1046
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1039
1047
|
try {
|
|
1040
|
-
emitEventWithSessionId(sessionId,
|
|
1041
|
-
[
|
|
1042
|
-
[
|
|
1043
|
-
[
|
|
1048
|
+
emitEventWithSessionId(sessionId, _chunkOZCOXBB7cjs.EXTERNAL_LINK_EVENT_NAME, {
|
|
1049
|
+
[_chunkOZCOXBB7cjs.EXTERNAL_LINK_URL]: url,
|
|
1050
|
+
[_chunkOZCOXBB7cjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
|
|
1051
|
+
[_chunkOZCOXBB7cjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
|
|
1044
1052
|
});
|
|
1045
1053
|
} catch (error) {
|
|
1046
|
-
|
|
1054
|
+
_chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
|
|
1047
1055
|
}
|
|
1048
1056
|
}
|
|
1049
1057
|
function addExternalLink(url, options) {
|
|
1050
1058
|
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1051
1059
|
if (!sessionId) {
|
|
1052
|
-
|
|
1060
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1053
1061
|
"addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
|
|
1054
1062
|
);
|
|
1055
1063
|
return;
|
|
@@ -1058,19 +1066,19 @@ function addExternalLink(url, options) {
|
|
|
1058
1066
|
}
|
|
1059
1067
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1060
1068
|
const isTitle = _optionalChain([options, 'optionalAccess', _41 => _41.mode]) === "title";
|
|
1061
|
-
const spanName = isTitle ?
|
|
1069
|
+
const spanName = isTitle ? _chunkOZCOXBB7cjs.SESSION_TITLE_SPAN_NAME : _chunkOZCOXBB7cjs.SESSION_SPAN_NAME;
|
|
1062
1070
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1063
1071
|
return tracer.startActiveSpan(spanName, (span) => {
|
|
1064
|
-
span.setAttribute(`${
|
|
1072
|
+
span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${_chunkOZCOXBB7cjs.SESSION_ID}`, sessionId);
|
|
1065
1073
|
if (extraProperties) {
|
|
1066
1074
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
1067
|
-
span.setAttribute(`${
|
|
1075
|
+
span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
1068
1076
|
}
|
|
1069
1077
|
}
|
|
1070
1078
|
const session = new Session(sessionId, span);
|
|
1071
|
-
const contextProperties = { [
|
|
1079
|
+
const contextProperties = { [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId };
|
|
1072
1080
|
if (isTitle) {
|
|
1073
|
-
contextProperties[
|
|
1081
|
+
contextProperties[_chunkOZCOXBB7cjs.SESSION_TITLE_GENERATION] = "true";
|
|
1074
1082
|
}
|
|
1075
1083
|
if (extraProperties) {
|
|
1076
1084
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
@@ -1078,7 +1086,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1078
1086
|
}
|
|
1079
1087
|
}
|
|
1080
1088
|
return callWithProperties(contextProperties, () => {
|
|
1081
|
-
const sessionCtx = _api.context.active().setValue(
|
|
1089
|
+
const sessionCtx = _api.context.active().setValue(_chunkOZCOXBB7cjs.SESSION_OBJECT_CONTEXT_KEY, session);
|
|
1082
1090
|
return _api.context.with(sessionCtx, () => {
|
|
1083
1091
|
try {
|
|
1084
1092
|
const result = callback(session);
|
|
@@ -1108,14 +1116,14 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1108
1116
|
function startSessionTitle(callback, options) {
|
|
1109
1117
|
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _43 => _43(), 'optionalAccess', _44 => _44.sessionId])));
|
|
1110
1118
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1111
|
-
return tracer.startActiveSpan(
|
|
1119
|
+
return tracer.startActiveSpan(_chunkOZCOXBB7cjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1112
1120
|
if (resolvedSessionId) {
|
|
1113
|
-
span.setAttribute(`${
|
|
1121
|
+
span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${_chunkOZCOXBB7cjs.SESSION_ID}`, resolvedSessionId);
|
|
1114
1122
|
}
|
|
1115
1123
|
const sessionTitle = new SessionTitle(span);
|
|
1116
|
-
const properties = { [
|
|
1124
|
+
const properties = { [_chunkOZCOXBB7cjs.SESSION_TITLE_GENERATION]: "true" };
|
|
1117
1125
|
if (resolvedSessionId) {
|
|
1118
|
-
properties[
|
|
1126
|
+
properties[_chunkOZCOXBB7cjs.SESSION_ID] = resolvedSessionId;
|
|
1119
1127
|
}
|
|
1120
1128
|
return callWithProperties(properties, () => {
|
|
1121
1129
|
try {
|
|
@@ -1161,32 +1169,32 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
|
|
|
1161
1169
|
*/
|
|
1162
1170
|
initMetricsExporter(config) {
|
|
1163
1171
|
if (this.metricsExporter) {
|
|
1164
|
-
|
|
1172
|
+
_chunkWC573FCIcjs.logger.debug("Metrics exporter already initialized, skipping re-initialization");
|
|
1165
1173
|
return;
|
|
1166
1174
|
}
|
|
1167
1175
|
const metricsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/metrics";
|
|
1168
|
-
|
|
1176
|
+
_chunkWC573FCIcjs.logger.debug("Initializing metrics exporter", { url: metricsUrl });
|
|
1169
1177
|
this.metricsExporter = new (0, _exportermetricsotlphttp.OTLPMetricExporter)({
|
|
1170
1178
|
url: metricsUrl,
|
|
1171
1179
|
headers: config.headers
|
|
1172
1180
|
});
|
|
1173
|
-
|
|
1181
|
+
_chunkWC573FCIcjs.logger.debug("Metrics exporter initialized successfully");
|
|
1174
1182
|
}
|
|
1175
1183
|
/**
|
|
1176
1184
|
* Initialize the metrics reader
|
|
1177
1185
|
*/
|
|
1178
1186
|
initMetricsReader(config) {
|
|
1179
1187
|
if (this.metricsReader) {
|
|
1180
|
-
|
|
1188
|
+
_chunkWC573FCIcjs.logger.debug("Metrics reader already initialized, skipping re-initialization");
|
|
1181
1189
|
return;
|
|
1182
1190
|
}
|
|
1183
1191
|
if (config.customMetricReader) {
|
|
1184
|
-
|
|
1192
|
+
_chunkWC573FCIcjs.logger.debug("Using custom metric reader");
|
|
1185
1193
|
this.metricsReader = config.customMetricReader;
|
|
1186
|
-
|
|
1194
|
+
_chunkWC573FCIcjs.logger.debug("Custom metric reader initialized successfully");
|
|
1187
1195
|
return;
|
|
1188
1196
|
}
|
|
1189
|
-
|
|
1197
|
+
_chunkWC573FCIcjs.logger.debug(
|
|
1190
1198
|
"Using default metrics flow - creating OTLP exporter and PeriodicExportingMetricReader"
|
|
1191
1199
|
);
|
|
1192
1200
|
this.initMetricsExporter(config);
|
|
@@ -1196,16 +1204,16 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
|
|
|
1196
1204
|
this.metricsReader = new (0, _sdkmetrics.PeriodicExportingMetricReader)({
|
|
1197
1205
|
exporter: this.metricsExporter
|
|
1198
1206
|
});
|
|
1199
|
-
|
|
1207
|
+
_chunkWC573FCIcjs.logger.debug("Default metrics reader initialized successfully");
|
|
1200
1208
|
}
|
|
1201
1209
|
/**
|
|
1202
1210
|
* Initialize the metrics module with the provided configuration
|
|
1203
1211
|
*/
|
|
1204
1212
|
setup(config) {
|
|
1205
|
-
|
|
1213
|
+
_chunkWC573FCIcjs.logger.info("Setting up metrics module");
|
|
1206
1214
|
this.initMetricsReader(config);
|
|
1207
1215
|
_MetricsModule.instance = this;
|
|
1208
|
-
|
|
1216
|
+
_chunkWC573FCIcjs.logger.info("Metrics module setup completed");
|
|
1209
1217
|
}
|
|
1210
1218
|
/**
|
|
1211
1219
|
* Get the metrics exporter
|
|
@@ -1229,13 +1237,13 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
|
|
|
1229
1237
|
* Shutdown the metrics module
|
|
1230
1238
|
*/
|
|
1231
1239
|
shutdown() {
|
|
1232
|
-
|
|
1240
|
+
_chunkWC573FCIcjs.logger.debug("Shutting down metrics module");
|
|
1233
1241
|
this.metricsReader = null;
|
|
1234
1242
|
this.metricsExporter = null;
|
|
1235
1243
|
if (_MetricsModule.instance === this) {
|
|
1236
1244
|
_MetricsModule.instance = null;
|
|
1237
1245
|
}
|
|
1238
|
-
|
|
1246
|
+
_chunkWC573FCIcjs.logger.debug("Metrics module shutdown completed");
|
|
1239
1247
|
}
|
|
1240
1248
|
}, _class4.__initStatic2(), _class4);
|
|
1241
1249
|
function getMetricsExporter() {
|
|
@@ -1260,7 +1268,7 @@ var BrizzSpanExporter = class {
|
|
|
1260
1268
|
const resourceAttrs = {
|
|
1261
1269
|
...config.resourceAttributes,
|
|
1262
1270
|
"service.name": config.appName,
|
|
1263
|
-
[BRIZZ_SDK_VERSION]:
|
|
1271
|
+
[BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
|
|
1264
1272
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1265
1273
|
};
|
|
1266
1274
|
if (config.environment) {
|
|
@@ -1291,7 +1299,7 @@ var BrizzSpanExporter = class {
|
|
|
1291
1299
|
try {
|
|
1292
1300
|
return Promise.resolve(filter(span));
|
|
1293
1301
|
} catch (error) {
|
|
1294
|
-
|
|
1302
|
+
_chunkWC573FCIcjs.logger.warn("beforeSendSpan threw; span will be kept", { error });
|
|
1295
1303
|
return Promise.resolve(true);
|
|
1296
1304
|
}
|
|
1297
1305
|
});
|
|
@@ -1304,7 +1312,7 @@ var BrizzSpanExporter = class {
|
|
|
1304
1312
|
this._delegate.export(filtered, resultCallback);
|
|
1305
1313
|
return;
|
|
1306
1314
|
}).catch((error) => {
|
|
1307
|
-
|
|
1315
|
+
_chunkWC573FCIcjs.logger.warn("beforeSendSpan rejected; all spans will be kept", { error });
|
|
1308
1316
|
this._delegate.export(patchedSpans, resultCallback);
|
|
1309
1317
|
});
|
|
1310
1318
|
}
|
|
@@ -1323,10 +1331,10 @@ var BrizzSpanExporter = class {
|
|
|
1323
1331
|
|
|
1324
1332
|
var _sdktracebase = require('@opentelemetry/sdk-trace-base');
|
|
1325
1333
|
function applyContextAttributes(span) {
|
|
1326
|
-
const sessionProperties = _api.context.active().getValue(
|
|
1334
|
+
const sessionProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
|
|
1327
1335
|
if (sessionProperties) {
|
|
1328
1336
|
for (const [key, value] of Object.entries(sessionProperties)) {
|
|
1329
|
-
span.setAttribute(`${
|
|
1337
|
+
span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
|
|
1330
1338
|
}
|
|
1331
1339
|
}
|
|
1332
1340
|
}
|
|
@@ -1394,7 +1402,7 @@ function maskReadableSpan(span, config) {
|
|
|
1394
1402
|
}
|
|
1395
1403
|
}
|
|
1396
1404
|
} catch (error) {
|
|
1397
|
-
|
|
1405
|
+
_chunkWC573FCIcjs.logger.error("Error masking span", { err: error });
|
|
1398
1406
|
}
|
|
1399
1407
|
}
|
|
1400
1408
|
|
|
@@ -1414,50 +1422,50 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1414
1422
|
*/
|
|
1415
1423
|
initSpanExporter(config) {
|
|
1416
1424
|
if (this.spanExporter) {
|
|
1417
|
-
|
|
1425
|
+
_chunkWC573FCIcjs.logger.debug("Span exporter already initialized, skipping re-initialization");
|
|
1418
1426
|
return;
|
|
1419
1427
|
}
|
|
1420
1428
|
if (config.customSpanExporter) {
|
|
1421
|
-
|
|
1429
|
+
_chunkWC573FCIcjs.logger.debug("Using custom span exporter");
|
|
1422
1430
|
this.spanExporter = new BrizzSpanExporter(config.customSpanExporter, config);
|
|
1423
|
-
|
|
1431
|
+
_chunkWC573FCIcjs.logger.debug("Custom span exporter initialized successfully");
|
|
1424
1432
|
return;
|
|
1425
1433
|
}
|
|
1426
1434
|
const tracesUrl = config.baseUrl.replace(/\/$/, "") + "/v1/traces";
|
|
1427
|
-
|
|
1435
|
+
_chunkWC573FCIcjs.logger.debug("Initializing default OTLP span exporter", { url: tracesUrl });
|
|
1428
1436
|
const otlpExporter = new (0, _exportertraceotlpproto.OTLPTraceExporter)({
|
|
1429
1437
|
url: tracesUrl,
|
|
1430
1438
|
headers: config.headers
|
|
1431
1439
|
});
|
|
1432
1440
|
this.spanExporter = new BrizzSpanExporter(otlpExporter, config);
|
|
1433
|
-
|
|
1441
|
+
_chunkWC573FCIcjs.logger.debug("OTLP span exporter initialized successfully");
|
|
1434
1442
|
}
|
|
1435
1443
|
/**
|
|
1436
1444
|
* Initialize the span processor with masking support
|
|
1437
1445
|
*/
|
|
1438
1446
|
initSpanProcessor(config) {
|
|
1439
1447
|
if (this.spanProcessor) {
|
|
1440
|
-
|
|
1448
|
+
_chunkWC573FCIcjs.logger.debug("Span processor already initialized, skipping re-initialization");
|
|
1441
1449
|
return;
|
|
1442
1450
|
}
|
|
1443
1451
|
if (!this.spanExporter) {
|
|
1444
1452
|
throw new Error("Span exporter must be initialized before processor");
|
|
1445
1453
|
}
|
|
1446
|
-
|
|
1454
|
+
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
1447
1455
|
disableBatch: config.disableBatch,
|
|
1448
1456
|
hasMasking: !!_optionalChain([config, 'access', _54 => _54.masking, 'optionalAccess', _55 => _55.spanMasking])
|
|
1449
1457
|
});
|
|
1450
1458
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
1451
|
-
|
|
1459
|
+
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
1452
1460
|
this.spanProcessor = spanProcessor;
|
|
1453
1461
|
}
|
|
1454
1462
|
/**
|
|
1455
1463
|
* Initialize the tracing module with the provided configuration
|
|
1456
1464
|
*/
|
|
1457
1465
|
setup(config) {
|
|
1458
|
-
|
|
1466
|
+
_chunkWC573FCIcjs.logger.info("Setting up tracing module");
|
|
1459
1467
|
if (config.disableSpanExporter) {
|
|
1460
|
-
|
|
1468
|
+
_chunkWC573FCIcjs.logger.info(
|
|
1461
1469
|
"Span exporter disabled via disableSpanExporter; skipping exporter and processor setup"
|
|
1462
1470
|
);
|
|
1463
1471
|
this.spanExporter = null;
|
|
@@ -1468,7 +1476,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1468
1476
|
this.initSpanExporter(config);
|
|
1469
1477
|
this.initSpanProcessor(config);
|
|
1470
1478
|
_TracingModule.instance = this;
|
|
1471
|
-
|
|
1479
|
+
_chunkWC573FCIcjs.logger.info("Tracing module setup completed");
|
|
1472
1480
|
}
|
|
1473
1481
|
/**
|
|
1474
1482
|
* Get the span exporter
|
|
@@ -1489,7 +1497,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1489
1497
|
return this.spanProcessor;
|
|
1490
1498
|
}
|
|
1491
1499
|
async shutdown() {
|
|
1492
|
-
|
|
1500
|
+
_chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
|
|
1493
1501
|
if (this.spanProcessor) {
|
|
1494
1502
|
await this.spanProcessor.shutdown();
|
|
1495
1503
|
this.spanProcessor = null;
|
|
@@ -1499,7 +1507,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1499
1507
|
this.spanExporter = null;
|
|
1500
1508
|
}
|
|
1501
1509
|
_TracingModule.instance = null;
|
|
1502
|
-
|
|
1510
|
+
_chunkWC573FCIcjs.logger.debug("Tracing module shutdown completed");
|
|
1503
1511
|
}
|
|
1504
1512
|
}, _class5.__initStatic3(), _class5);
|
|
1505
1513
|
function getSpanExporter() {
|
|
@@ -1523,50 +1531,18 @@ var _instrumentation = require('@opentelemetry/instrumentation');
|
|
|
1523
1531
|
|
|
1524
1532
|
var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
1525
1533
|
|
|
1526
|
-
// src/internal/dsn.ts
|
|
1527
|
-
var PLACEHOLDER_SERVICE = "<service-name>";
|
|
1528
|
-
var SERVICE_NAME_HEADER = "X-Brizz-Service-Name";
|
|
1529
|
-
function parseDSN(dsn) {
|
|
1530
|
-
let parsed;
|
|
1531
|
-
try {
|
|
1532
|
-
parsed = new globalThis.URL(dsn);
|
|
1533
|
-
} catch (e2) {
|
|
1534
|
-
return null;
|
|
1535
|
-
}
|
|
1536
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || !parsed.username || !parsed.host) {
|
|
1537
|
-
return null;
|
|
1538
|
-
}
|
|
1539
|
-
const scheme = parsed.protocol === "https:" ? "https" : "http";
|
|
1540
|
-
let service;
|
|
1541
|
-
try {
|
|
1542
|
-
service = decodeURIComponent(parsed.pathname.replace(/^\//, ""));
|
|
1543
|
-
} catch (e3) {
|
|
1544
|
-
return null;
|
|
1545
|
-
}
|
|
1546
|
-
if (service === "" || service === PLACEHOLDER_SERVICE) {
|
|
1547
|
-
return null;
|
|
1548
|
-
}
|
|
1549
|
-
return {
|
|
1550
|
-
scheme,
|
|
1551
|
-
host: parsed.host,
|
|
1552
|
-
bearer: decodeURIComponent(parsed.username),
|
|
1553
|
-
service,
|
|
1554
|
-
baseUrl: `${scheme}://${parsed.host}`
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
1534
|
// src/internal/config.ts
|
|
1559
1535
|
function resolveConfig(options) {
|
|
1560
|
-
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _56 => _56.logLevel, 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]) ||
|
|
1536
|
+
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _56 => _56.logLevel, 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
1561
1537
|
let resolvedLogLevel;
|
|
1562
1538
|
if (envLogLevel) {
|
|
1563
|
-
resolvedLogLevel =
|
|
1539
|
+
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
|
|
1564
1540
|
} else if (typeof options.logLevel === "string") {
|
|
1565
|
-
resolvedLogLevel =
|
|
1541
|
+
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, options.logLevel);
|
|
1566
1542
|
} else {
|
|
1567
|
-
resolvedLogLevel = options.logLevel ||
|
|
1543
|
+
resolvedLogLevel = options.logLevel || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL;
|
|
1568
1544
|
}
|
|
1569
|
-
|
|
1545
|
+
_chunkWC573FCIcjs.setLogLevel.call(void 0, resolvedLogLevel);
|
|
1570
1546
|
let maskingStatus;
|
|
1571
1547
|
if (options.masking === true) {
|
|
1572
1548
|
maskingStatus = "enabled";
|
|
@@ -1577,7 +1553,7 @@ function resolveConfig(options) {
|
|
|
1577
1553
|
} else {
|
|
1578
1554
|
maskingStatus = "default-disabled";
|
|
1579
1555
|
}
|
|
1580
|
-
|
|
1556
|
+
_chunkWC573FCIcjs.logger.debug("Starting configuration resolution", {
|
|
1581
1557
|
appName: options.appName,
|
|
1582
1558
|
baseUrl: options.baseUrl,
|
|
1583
1559
|
hasApiKey: !!options.apiKey,
|
|
@@ -1631,14 +1607,14 @@ function resolveConfig(options) {
|
|
|
1631
1607
|
(name) => process.env[name] !== void 0
|
|
1632
1608
|
);
|
|
1633
1609
|
if (envConflicts.length > 0) {
|
|
1634
|
-
|
|
1610
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1635
1611
|
`Ignoring ${envConflicts.join(", ")} \u2014 dsn / BRIZZ_DSN takes precedence.`
|
|
1636
1612
|
);
|
|
1637
1613
|
}
|
|
1638
1614
|
resolvedConfig.apiKey = void 0;
|
|
1639
1615
|
resolvedConfig.baseUrl = "https://telemetry.brizz.dev";
|
|
1640
1616
|
resolvedConfig.appName = "unknown-app";
|
|
1641
|
-
parsedDSN = parseDSN(dsnInput);
|
|
1617
|
+
parsedDSN = _chunkUNLNNKZ7cjs.parseDSN.call(void 0, dsnInput);
|
|
1642
1618
|
if (parsedDSN) {
|
|
1643
1619
|
resolvedConfig.appName = parsedDSN.service;
|
|
1644
1620
|
resolvedConfig.baseUrl = parsedDSN.baseUrl;
|
|
@@ -1651,16 +1627,16 @@ function resolveConfig(options) {
|
|
|
1651
1627
|
try {
|
|
1652
1628
|
const envHeaders = JSON.parse(process.env["BRIZZ_HEADERS"]);
|
|
1653
1629
|
Object.assign(resolvedConfig.headers, envHeaders);
|
|
1654
|
-
|
|
1630
|
+
_chunkWC573FCIcjs.logger.debug("Added headers from environment variable", {
|
|
1655
1631
|
headers: Object.keys(envHeaders)
|
|
1656
1632
|
});
|
|
1657
1633
|
} catch (error) {
|
|
1658
|
-
|
|
1634
|
+
_chunkWC573FCIcjs.logger.error("Failed to parse BRIZZ_HEADERS environment variable", { error });
|
|
1659
1635
|
throw new Error("Invalid JSON in BRIZZ_HEADERS environment variable", { cause: error });
|
|
1660
1636
|
}
|
|
1661
1637
|
}
|
|
1662
1638
|
if (dsnInput) {
|
|
1663
|
-
const authHeaderKeys = /* @__PURE__ */ new Set(["authorization", SERVICE_NAME_HEADER.toLowerCase()]);
|
|
1639
|
+
const authHeaderKeys = /* @__PURE__ */ new Set(["authorization", _chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER.toLowerCase()]);
|
|
1664
1640
|
resolvedConfig.headers = Object.fromEntries(
|
|
1665
1641
|
Object.entries(resolvedConfig.headers).filter(
|
|
1666
1642
|
([key]) => !authHeaderKeys.has(key.toLowerCase())
|
|
@@ -1668,10 +1644,10 @@ function resolveConfig(options) {
|
|
|
1668
1644
|
);
|
|
1669
1645
|
if (parsedDSN) {
|
|
1670
1646
|
resolvedConfig.headers["Authorization"] = `Bearer ${parsedDSN.bearer}`;
|
|
1671
|
-
resolvedConfig.headers[SERVICE_NAME_HEADER] = parsedDSN.service;
|
|
1647
|
+
resolvedConfig.headers[_chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER] = parsedDSN.service;
|
|
1672
1648
|
}
|
|
1673
1649
|
}
|
|
1674
|
-
|
|
1650
|
+
_chunkWC573FCIcjs.logger.debug("Configuration resolved with environment variables", {
|
|
1675
1651
|
appName: resolvedConfig.appName,
|
|
1676
1652
|
baseUrl: resolvedConfig.baseUrl,
|
|
1677
1653
|
hasApiKey: !!resolvedConfig.apiKey,
|
|
@@ -1720,7 +1696,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1720
1696
|
*/
|
|
1721
1697
|
createAndStartProviders(options, resolvedConfig) {
|
|
1722
1698
|
if (options.disableNodeSdk) {
|
|
1723
|
-
|
|
1699
|
+
_chunkWC573FCIcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
|
|
1724
1700
|
return;
|
|
1725
1701
|
}
|
|
1726
1702
|
const registry = InstrumentationRegistry.getInstance();
|
|
@@ -1728,7 +1704,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1728
1704
|
const resourceAttributes = {
|
|
1729
1705
|
...resolvedConfig.resourceAttributes,
|
|
1730
1706
|
"service.name": resolvedConfig.appName,
|
|
1731
|
-
[BRIZZ_SDK_VERSION]:
|
|
1707
|
+
[BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
|
|
1732
1708
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1733
1709
|
};
|
|
1734
1710
|
if (resolvedConfig.environment) {
|
|
@@ -1740,18 +1716,18 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1740
1716
|
const resource = _resources.defaultResource.call(void 0, ).merge(_resources.detectResources.call(void 0, { detectors: [_resources.envDetector, _resources.hostDetector, _resources.processDetector] })).merge(_resources.resourceFromAttributes.call(void 0, resourceAttributes));
|
|
1741
1717
|
this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
|
|
1742
1718
|
resource,
|
|
1743
|
-
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0,
|
|
1719
|
+
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkA3OOY5A2cjs.InterruptPropagator)(), getSpanProcessor()]
|
|
1744
1720
|
});
|
|
1745
1721
|
this._tracerProvider.register();
|
|
1746
1722
|
this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
|
|
1747
1723
|
_api.metrics.setGlobalMeterProvider(this._meterProvider);
|
|
1748
1724
|
if (manualInstrumentations.length > 0) {
|
|
1749
1725
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: manualInstrumentations });
|
|
1750
|
-
|
|
1726
|
+
_chunkWC573FCIcjs.logger.info(
|
|
1751
1727
|
`Telemetry providers started with ${manualInstrumentations.length} manual instrumentations`
|
|
1752
1728
|
);
|
|
1753
1729
|
} else {
|
|
1754
|
-
|
|
1730
|
+
_chunkWC573FCIcjs.logger.info(
|
|
1755
1731
|
"Telemetry providers started - using auto-instrumentations loaded at import time"
|
|
1756
1732
|
);
|
|
1757
1733
|
}
|
|
@@ -1766,17 +1742,17 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1766
1742
|
* @private
|
|
1767
1743
|
*/
|
|
1768
1744
|
initializeModules(config) {
|
|
1769
|
-
|
|
1770
|
-
|
|
1745
|
+
_chunkWC573FCIcjs.logger.info("Initializing telemetry modules");
|
|
1746
|
+
_chunkWC573FCIcjs.logger.debug("Initializing tracing module");
|
|
1771
1747
|
const tracingModule = new TracingModule();
|
|
1772
1748
|
tracingModule.setup(config);
|
|
1773
|
-
|
|
1749
|
+
_chunkWC573FCIcjs.logger.debug("Initializing metrics module");
|
|
1774
1750
|
const metricsModule = new MetricsModule();
|
|
1775
1751
|
metricsModule.setup(config);
|
|
1776
|
-
|
|
1752
|
+
_chunkWC573FCIcjs.logger.debug("Initializing logging module");
|
|
1777
1753
|
const loggingModule = new LoggingModule();
|
|
1778
1754
|
loggingModule.setup(config);
|
|
1779
|
-
|
|
1755
|
+
_chunkWC573FCIcjs.logger.info("All telemetry modules initialized successfully");
|
|
1780
1756
|
}
|
|
1781
1757
|
/**
|
|
1782
1758
|
* Detect the current module system (ESM or CJS) using reliable indicators
|
|
@@ -1785,7 +1761,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1785
1761
|
* @private
|
|
1786
1762
|
*/
|
|
1787
1763
|
detectModuleSystem() {
|
|
1788
|
-
const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof
|
|
1764
|
+
const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof _chunkOBGZSXTJcjs.__require === "function" && typeof __filename === "string" && typeof __dirname === "string" && this === (typeof exports !== "undefined" ? exports : void 0);
|
|
1789
1765
|
return inCJS ? "CJS" : "ESM";
|
|
1790
1766
|
}
|
|
1791
1767
|
/**
|
|
@@ -1793,29 +1769,29 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1793
1769
|
* @private
|
|
1794
1770
|
*/
|
|
1795
1771
|
async shutdownModules() {
|
|
1796
|
-
|
|
1772
|
+
_chunkWC573FCIcjs.logger.info("Shutting down telemetry modules");
|
|
1797
1773
|
try {
|
|
1798
1774
|
try {
|
|
1799
1775
|
const tracingModule = TracingModule.getInstance();
|
|
1800
1776
|
await tracingModule.shutdown();
|
|
1801
|
-
} catch (
|
|
1802
|
-
|
|
1777
|
+
} catch (e2) {
|
|
1778
|
+
_chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
|
|
1803
1779
|
}
|
|
1804
1780
|
try {
|
|
1805
1781
|
const metricsModule = MetricsModule.getInstance();
|
|
1806
1782
|
metricsModule.shutdown();
|
|
1807
|
-
} catch (
|
|
1808
|
-
|
|
1783
|
+
} catch (e3) {
|
|
1784
|
+
_chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
|
|
1809
1785
|
}
|
|
1810
1786
|
try {
|
|
1811
1787
|
const loggingModule = LoggingModule.getInstance();
|
|
1812
1788
|
await loggingModule.shutdown();
|
|
1813
|
-
} catch (
|
|
1814
|
-
|
|
1789
|
+
} catch (e4) {
|
|
1790
|
+
_chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
|
|
1815
1791
|
}
|
|
1816
|
-
|
|
1792
|
+
_chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
|
|
1817
1793
|
} catch (error) {
|
|
1818
|
-
|
|
1794
|
+
_chunkWC573FCIcjs.logger.error("Error shutting down modules", { error });
|
|
1819
1795
|
throw error;
|
|
1820
1796
|
}
|
|
1821
1797
|
}
|
|
@@ -1836,21 +1812,21 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1836
1812
|
*/
|
|
1837
1813
|
initialize(options) {
|
|
1838
1814
|
if (this._initialized) {
|
|
1839
|
-
|
|
1815
|
+
_chunkWC573FCIcjs.logger.warn("Brizz SDK already initialized");
|
|
1840
1816
|
return;
|
|
1841
1817
|
}
|
|
1842
|
-
|
|
1818
|
+
_chunkWC573FCIcjs.logger.info("Starting Brizz SDK initialization");
|
|
1843
1819
|
try {
|
|
1844
1820
|
const resolvedConfig = resolveConfig(options);
|
|
1845
1821
|
this.initializeModules(resolvedConfig);
|
|
1846
1822
|
this.setupInstrumentation(options);
|
|
1847
1823
|
this.createAndStartProviders(options, resolvedConfig);
|
|
1848
1824
|
this._initialized = true;
|
|
1849
|
-
|
|
1825
|
+
_chunkWC573FCIcjs.logger.info("Brizz SDK initialization completed successfully", {
|
|
1850
1826
|
moduleSystem: this.detectModuleSystem()
|
|
1851
1827
|
});
|
|
1852
1828
|
} catch (error) {
|
|
1853
|
-
|
|
1829
|
+
_chunkWC573FCIcjs.logger.error("Failed to initialize Brizz SDK", { error });
|
|
1854
1830
|
throw new Error(`Failed to initialize SDK: ${String(error)}`, { cause: error });
|
|
1855
1831
|
}
|
|
1856
1832
|
}
|
|
@@ -1871,7 +1847,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1871
1847
|
*/
|
|
1872
1848
|
async shutdown() {
|
|
1873
1849
|
if (!this._initialized) {
|
|
1874
|
-
|
|
1850
|
+
_chunkWC573FCIcjs.logger.warn("Brizz SDK not initialized");
|
|
1875
1851
|
return;
|
|
1876
1852
|
}
|
|
1877
1853
|
try {
|
|
@@ -1884,12 +1860,12 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1884
1860
|
this._tracerProvider = null;
|
|
1885
1861
|
this._meterProvider = null;
|
|
1886
1862
|
__Brizz.instance = null;
|
|
1887
|
-
|
|
1863
|
+
_chunkWC573FCIcjs.logger.info("Brizz SDK shut down successfully");
|
|
1888
1864
|
} catch (error) {
|
|
1889
1865
|
if (error instanceof Error && error.message.includes("ENOTFOUND")) {
|
|
1890
|
-
|
|
1866
|
+
_chunkWC573FCIcjs.logger.debug(`Network error during shutdown (expected in tests): ${error.message}`);
|
|
1891
1867
|
} else {
|
|
1892
|
-
|
|
1868
|
+
_chunkWC573FCIcjs.logger.error(`Failed to shutdown Brizz SDK: ${String(error)}`);
|
|
1893
1869
|
throw error;
|
|
1894
1870
|
}
|
|
1895
1871
|
}
|
|
@@ -1902,7 +1878,7 @@ function detectRuntime() {
|
|
|
1902
1878
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
1903
1879
|
const noNodeJSGlobals = typeof __filename === "undefined" && typeof __dirname === "undefined";
|
|
1904
1880
|
const noModuleSystem = typeof module === "undefined" && typeof exports === "undefined";
|
|
1905
|
-
const hasRequire = typeof
|
|
1881
|
+
const hasRequire = typeof _chunkOBGZSXTJcjs.__require === "function";
|
|
1906
1882
|
const isESM = noNodeJSGlobals && noModuleSystem;
|
|
1907
1883
|
const isCJS = hasRequire && typeof module !== "undefined" && typeof exports !== "undefined" && typeof __filename === "string" && typeof __dirname === "string";
|
|
1908
1884
|
const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
|
|
@@ -1910,7 +1886,7 @@ function detectRuntime() {
|
|
|
1910
1886
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1911
1887
|
!!_optionalChain([process, 'access', _71 => _71.features, 'optionalAccess', _72 => _72.typescript]) || !!_optionalChain([globalThis, 'access', _73 => _73.module, 'optionalAccess', _74 => _74.register])
|
|
1912
1888
|
);
|
|
1913
|
-
|
|
1889
|
+
_chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
|
|
1914
1890
|
nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
|
|
1915
1891
|
isESM,
|
|
1916
1892
|
isCJS,
|
|
@@ -1926,7 +1902,7 @@ function detectRuntime() {
|
|
|
1926
1902
|
checks: {
|
|
1927
1903
|
__filename: typeof __filename,
|
|
1928
1904
|
__dirname: typeof __dirname,
|
|
1929
|
-
require: typeof
|
|
1905
|
+
require: typeof _chunkOBGZSXTJcjs.__require,
|
|
1930
1906
|
module: typeof module,
|
|
1931
1907
|
exports: typeof exports,
|
|
1932
1908
|
"process.features": process.features,
|