@brizz/sdk 0.1.35 → 0.1.37
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 +6 -1
- package/dist/{chunk-HZOBDXDS.cjs → chunk-2DSTZTDA.cjs} +1 -1
- package/dist/{chunk-KP3KG66W.js → chunk-4Q2CRWI6.js} +31 -7
- package/dist/{chunk-NEF2O7HF.cjs → chunk-77UGZGMP.cjs} +3 -1
- package/dist/{chunk-24CEDVD2.js → chunk-EC3MYSRM.js} +1 -1
- package/dist/{chunk-M3UGFLH7.cjs → chunk-EVRCHF74.cjs} +4 -4
- package/dist/{chunk-D27LNW3M.cjs → chunk-O5DVPC42.cjs} +156 -132
- package/dist/{chunk-GSKXPOLQ.js → chunk-OR3YPY4I.js} +1 -1
- package/dist/{chunk-QY4VADPP.js → chunk-WII4R5RE.js} +2 -0
- package/dist/index.cjs +14 -9
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -8
- package/dist/interrupt-DM3AWSBX.cjs +12 -0
- package/dist/{interrupt-KADNA6WK.js → interrupt-YJVZK4VC.js} +2 -2
- package/dist/{mcp-EJNZYON6.js → mcp-7Y3O5QSS.js} +2 -2
- package/dist/{mcp-KAYXU4AU.cjs → mcp-NC5OXRT4.cjs} +7 -7
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +11 -11
- package/dist/interrupt-7MWQCOY3.cjs +0 -12
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk2DSTZTDAcjs = require('./chunk-2DSTZTDA.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ var _chunkHZOBDXDScjs = require('./chunk-HZOBDXDS.cjs');
|
|
|
13
13
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkEVRCHF74cjs = require('./chunk-EVRCHF74.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -64,18 +64,19 @@ var _chunkM3UGFLH7cjs = require('./chunk-M3UGFLH7.cjs');
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
var _chunk77UGZGMPcjs = require('./chunk-77UGZGMP.cjs');
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
|
|
71
72
|
|
|
72
73
|
// src/internal/instrumentation/registry.ts
|
|
74
|
+
var _openinferenceinstrumentationopenai = require('@arizeai/openinference-instrumentation-openai');
|
|
73
75
|
var _instrumentationanthropic = require('@traceloop/instrumentation-anthropic');
|
|
74
76
|
var _instrumentationbedrock = require('@traceloop/instrumentation-bedrock');
|
|
75
77
|
var _instrumentationchromadb = require('@traceloop/instrumentation-chromadb');
|
|
76
78
|
var _instrumentationcohere = require('@traceloop/instrumentation-cohere');
|
|
77
79
|
var _instrumentationllamaindex = require('@traceloop/instrumentation-llamaindex');
|
|
78
|
-
var _instrumentationopenai = require('@traceloop/instrumentation-openai');
|
|
79
80
|
var _instrumentationpinecone = require('@traceloop/instrumentation-pinecone');
|
|
80
81
|
var _instrumentationqdrant = require('@traceloop/instrumentation-qdrant');
|
|
81
82
|
var _instrumentationtogether = require('@traceloop/instrumentation-together');
|
|
@@ -111,8 +112,17 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
111
112
|
* @private
|
|
112
113
|
*/
|
|
113
114
|
loadManualInstrumentations(instrumentations, exceptionLogger) {
|
|
115
|
+
if (_optionalChain([this, 'access', _2 => _2.manualModules, 'optionalAccess', _3 => _3.openAI])) {
|
|
116
|
+
try {
|
|
117
|
+
const openAIInst = new (0, _openinferenceinstrumentationopenai.OpenAIInstrumentation)();
|
|
118
|
+
openAIInst.manuallyInstrument(this.manualModules.openAI);
|
|
119
|
+
instrumentations.push(openAIInst);
|
|
120
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for OpenAI");
|
|
121
|
+
} catch (error) {
|
|
122
|
+
_chunkWC573FCIcjs.logger.error(`Failed to load OpenAI instrumentation: ${String(error)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
114
125
|
const instrumentationConfigs = [
|
|
115
|
-
{ class: _instrumentationopenai.OpenAIInstrumentation, name: "OpenAI", module: _optionalChain([this, 'access', _2 => _2.manualModules, 'optionalAccess', _3 => _3.openAI]) },
|
|
116
126
|
{ class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _4 => _4.manualModules, 'optionalAccess', _5 => _5.anthropic]) },
|
|
117
127
|
{ class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _6 => _6.manualModules, 'optionalAccess', _7 => _7.cohere]) },
|
|
118
128
|
{ class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _8 => _8.manualModules, 'optionalAccess', _9 => _9.bedrock]) },
|
|
@@ -189,7 +199,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
189
199
|
const mcpModules = this.manualModules.mcp;
|
|
190
200
|
void (async () => {
|
|
191
201
|
try {
|
|
192
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
202
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-NC5OXRT4.cjs")));
|
|
193
203
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
194
204
|
instrumentation.manuallyInstrument(mcpModules);
|
|
195
205
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -680,10 +690,10 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
680
690
|
if (maskingConfig) {
|
|
681
691
|
maskLog(logRecord, maskingConfig);
|
|
682
692
|
}
|
|
683
|
-
const associationProperties = _api.context.active().getValue(
|
|
693
|
+
const associationProperties = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
684
694
|
if (associationProperties) {
|
|
685
695
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
686
|
-
logRecord.setAttribute(`${
|
|
696
|
+
logRecord.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
687
697
|
}
|
|
688
698
|
}
|
|
689
699
|
super.onEmit(logRecord);
|
|
@@ -700,10 +710,10 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
700
710
|
if (maskingConfig) {
|
|
701
711
|
maskLog(logRecord, maskingConfig);
|
|
702
712
|
}
|
|
703
|
-
const associationProperties = _api.context.active().getValue(
|
|
713
|
+
const associationProperties = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
704
714
|
if (associationProperties) {
|
|
705
715
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
706
|
-
logRecord.setAttribute(`${
|
|
716
|
+
logRecord.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
707
717
|
}
|
|
708
718
|
}
|
|
709
719
|
super.onEmit(logRecord);
|
|
@@ -730,7 +740,7 @@ function maskLog(logRecord, config) {
|
|
|
730
740
|
newAttributes[key] = value;
|
|
731
741
|
}
|
|
732
742
|
for (const [key, value] of Object.entries(logRecord.attributes)) {
|
|
733
|
-
if (key.startsWith(
|
|
743
|
+
if (key.startsWith(_chunk77UGZGMPcjs.INTERNAL_EVENT_PREFIX)) {
|
|
734
744
|
newAttributes[key] = value;
|
|
735
745
|
}
|
|
736
746
|
}
|
|
@@ -821,7 +831,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
821
831
|
const resourceAttributes = {
|
|
822
832
|
...config.resourceAttributes,
|
|
823
833
|
"service.name": config.appName,
|
|
824
|
-
[BRIZZ_SDK_VERSION]:
|
|
834
|
+
[BRIZZ_SDK_VERSION]: _chunk2DSTZTDAcjs.getSDKVersion.call(void 0, ),
|
|
825
835
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
826
836
|
};
|
|
827
837
|
if (config.environment) {
|
|
@@ -937,16 +947,16 @@ function setCurrentSpanCustomProperties(properties) {
|
|
|
937
947
|
}
|
|
938
948
|
for (const [key, value] of Object.entries(properties)) {
|
|
939
949
|
try {
|
|
940
|
-
current.setAttribute(`${
|
|
950
|
+
current.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
941
951
|
} catch (e) {
|
|
942
952
|
}
|
|
943
953
|
}
|
|
944
954
|
}
|
|
945
955
|
function callWithProperties(properties, fn, thisArg, ...args) {
|
|
946
956
|
const base = _api.context.active();
|
|
947
|
-
const prev = base.getValue(
|
|
957
|
+
const prev = base.getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
948
958
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
949
|
-
const next = base.setValue(
|
|
959
|
+
const next = base.setValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY, merged);
|
|
950
960
|
return _api.context.with(next, fn, thisArg, ...args);
|
|
951
961
|
}
|
|
952
962
|
function withProperties(properties, fn, thisArg) {
|
|
@@ -968,25 +978,25 @@ function propagatePropertiesImperatively(properties) {
|
|
|
968
978
|
return;
|
|
969
979
|
}
|
|
970
980
|
const base = _api.context.active();
|
|
971
|
-
const prev = base.getValue(
|
|
981
|
+
const prev = base.getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
972
982
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
973
|
-
store.enterWith(base.setValue(
|
|
983
|
+
store.enterWith(base.setValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY, merged));
|
|
974
984
|
} catch (e2) {
|
|
975
985
|
}
|
|
976
986
|
}
|
|
977
987
|
function setUser(user) {
|
|
978
|
-
const properties = { [
|
|
988
|
+
const properties = { [_chunk77UGZGMPcjs.USER_ID]: user.id };
|
|
979
989
|
if (user.email !== void 0) {
|
|
980
|
-
properties[
|
|
990
|
+
properties[_chunk77UGZGMPcjs.USER_EMAIL] = user.email;
|
|
981
991
|
}
|
|
982
992
|
if (user.name !== void 0) {
|
|
983
|
-
properties[
|
|
993
|
+
properties[_chunk77UGZGMPcjs.USER_NAME] = user.name;
|
|
984
994
|
}
|
|
985
995
|
if (user.role !== void 0) {
|
|
986
|
-
properties[
|
|
996
|
+
properties[_chunk77UGZGMPcjs.USER_ROLE] = user.role;
|
|
987
997
|
}
|
|
988
998
|
if (user.plan !== void 0) {
|
|
989
|
-
properties[
|
|
999
|
+
properties[_chunk77UGZGMPcjs.USER_PLAN] = user.plan;
|
|
990
1000
|
}
|
|
991
1001
|
if (user.traits) {
|
|
992
1002
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
@@ -1000,15 +1010,15 @@ function setUser(user) {
|
|
|
1000
1010
|
propagatePropertiesImperatively(properties);
|
|
1001
1011
|
}
|
|
1002
1012
|
function setOrganization(org) {
|
|
1003
|
-
const properties = { [
|
|
1013
|
+
const properties = { [_chunk77UGZGMPcjs.ORGANIZATION_ID]: org.id };
|
|
1004
1014
|
if (org.name !== void 0) {
|
|
1005
|
-
properties[
|
|
1015
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_NAME] = org.name;
|
|
1006
1016
|
}
|
|
1007
1017
|
if (org.plan !== void 0) {
|
|
1008
|
-
properties[
|
|
1018
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_PLAN] = org.plan;
|
|
1009
1019
|
}
|
|
1010
1020
|
if (org.domain !== void 0) {
|
|
1011
|
-
properties[
|
|
1021
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_DOMAIN] = org.domain;
|
|
1012
1022
|
}
|
|
1013
1023
|
if (org.traits) {
|
|
1014
1024
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
@@ -1022,23 +1032,23 @@ function setOrganization(org) {
|
|
|
1022
1032
|
propagatePropertiesImperatively(properties);
|
|
1023
1033
|
}
|
|
1024
1034
|
function setMessageId(id) {
|
|
1025
|
-
const properties = { [
|
|
1035
|
+
const properties = { [_chunk77UGZGMPcjs.MESSAGE_ID]: id };
|
|
1026
1036
|
setCurrentSpanCustomProperties(properties);
|
|
1027
1037
|
propagatePropertiesImperatively(properties);
|
|
1028
1038
|
}
|
|
1029
1039
|
function userProperties(user) {
|
|
1030
|
-
const properties = { [
|
|
1040
|
+
const properties = { [_chunk77UGZGMPcjs.USER_ID]: user.id };
|
|
1031
1041
|
if (user.email !== void 0) {
|
|
1032
|
-
properties[
|
|
1042
|
+
properties[_chunk77UGZGMPcjs.USER_EMAIL] = user.email;
|
|
1033
1043
|
}
|
|
1034
1044
|
if (user.name !== void 0) {
|
|
1035
|
-
properties[
|
|
1045
|
+
properties[_chunk77UGZGMPcjs.USER_NAME] = user.name;
|
|
1036
1046
|
}
|
|
1037
1047
|
if (user.role !== void 0) {
|
|
1038
|
-
properties[
|
|
1048
|
+
properties[_chunk77UGZGMPcjs.USER_ROLE] = user.role;
|
|
1039
1049
|
}
|
|
1040
1050
|
if (user.plan !== void 0) {
|
|
1041
|
-
properties[
|
|
1051
|
+
properties[_chunk77UGZGMPcjs.USER_PLAN] = user.plan;
|
|
1042
1052
|
}
|
|
1043
1053
|
if (user.traits) {
|
|
1044
1054
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
@@ -1051,15 +1061,15 @@ function userProperties(user) {
|
|
|
1051
1061
|
return properties;
|
|
1052
1062
|
}
|
|
1053
1063
|
function organizationProperties(org) {
|
|
1054
|
-
const properties = { [
|
|
1064
|
+
const properties = { [_chunk77UGZGMPcjs.ORGANIZATION_ID]: org.id };
|
|
1055
1065
|
if (org.name !== void 0) {
|
|
1056
|
-
properties[
|
|
1066
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_NAME] = org.name;
|
|
1057
1067
|
}
|
|
1058
1068
|
if (org.plan !== void 0) {
|
|
1059
|
-
properties[
|
|
1069
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_PLAN] = org.plan;
|
|
1060
1070
|
}
|
|
1061
1071
|
if (org.domain !== void 0) {
|
|
1062
|
-
properties[
|
|
1072
|
+
properties[_chunk77UGZGMPcjs.ORGANIZATION_DOMAIN] = org.domain;
|
|
1063
1073
|
}
|
|
1064
1074
|
if (org.traits) {
|
|
1065
1075
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
@@ -1084,19 +1094,33 @@ function withOrganization(org, fn, thisArg) {
|
|
|
1084
1094
|
return withProperties(organizationProperties(org), fn, thisArg);
|
|
1085
1095
|
}
|
|
1086
1096
|
function callWithMessageId(id, fn, thisArg, ...args) {
|
|
1087
|
-
return callWithProperties({ [
|
|
1097
|
+
return callWithProperties({ [_chunk77UGZGMPcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
|
|
1088
1098
|
}
|
|
1089
1099
|
function withMessageId(id, fn, thisArg) {
|
|
1090
|
-
return withProperties({ [
|
|
1100
|
+
return withProperties({ [_chunk77UGZGMPcjs.MESSAGE_ID]: id }, fn, thisArg);
|
|
1101
|
+
}
|
|
1102
|
+
function inheritedMuteTools() {
|
|
1103
|
+
const properties = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
1104
|
+
return _optionalChain([properties, 'optionalAccess', _40 => _40[_chunk77UGZGMPcjs.MUTE_TOOLS]]);
|
|
1091
1105
|
}
|
|
1092
1106
|
function muteProperties(options) {
|
|
1093
|
-
const { input = true, output = true } = options;
|
|
1107
|
+
const { input = true, output = true, tools = output } = options;
|
|
1094
1108
|
const properties = {};
|
|
1095
1109
|
if (input) {
|
|
1096
|
-
properties[
|
|
1110
|
+
properties[_chunk77UGZGMPcjs.MUTE_INPUT] = "true";
|
|
1097
1111
|
}
|
|
1098
1112
|
if (output) {
|
|
1099
|
-
properties[
|
|
1113
|
+
properties[_chunk77UGZGMPcjs.MUTE_OUTPUT] = "true";
|
|
1114
|
+
}
|
|
1115
|
+
if (tools !== output) {
|
|
1116
|
+
properties[_chunk77UGZGMPcjs.MUTE_TOOLS] = String(tools);
|
|
1117
|
+
} else {
|
|
1118
|
+
const inherited = inheritedMuteTools();
|
|
1119
|
+
if (tools && inherited === "false") {
|
|
1120
|
+
properties[_chunk77UGZGMPcjs.MUTE_TOOLS] = "true";
|
|
1121
|
+
} else if (options.tools === false && inherited === "true") {
|
|
1122
|
+
properties[_chunk77UGZGMPcjs.MUTE_TOOLS] = "false";
|
|
1123
|
+
}
|
|
1100
1124
|
}
|
|
1101
1125
|
return properties;
|
|
1102
1126
|
}
|
|
@@ -1107,11 +1131,11 @@ function withMute(options, fn, thisArg) {
|
|
|
1107
1131
|
return withProperties(muteProperties(options), fn, thisArg);
|
|
1108
1132
|
}
|
|
1109
1133
|
function withSessionId(sessionId, fn, thisArg, extraProperties) {
|
|
1110
|
-
const properties = { [
|
|
1134
|
+
const properties = { [_chunk77UGZGMPcjs.SESSION_ID]: sessionId, ...extraProperties };
|
|
1111
1135
|
return withProperties(properties, fn, thisArg);
|
|
1112
1136
|
}
|
|
1113
1137
|
function callWithSessionId(sessionId, fn, thisArg, ...args) {
|
|
1114
|
-
return callWithProperties({ [
|
|
1138
|
+
return callWithProperties({ [_chunk77UGZGMPcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
|
|
1115
1139
|
}
|
|
1116
1140
|
var Session = (_class3 = class {
|
|
1117
1141
|
|
|
@@ -1139,8 +1163,8 @@ var Session = (_class3 = class {
|
|
|
1139
1163
|
setInput(text, context4) {
|
|
1140
1164
|
this.inputs.push(text);
|
|
1141
1165
|
this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
1142
|
-
this.span.setAttribute(
|
|
1143
|
-
this.span.setAttribute(
|
|
1166
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_INPUT, JSON.stringify(this.inputs));
|
|
1167
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
|
|
1144
1168
|
}
|
|
1145
1169
|
/**
|
|
1146
1170
|
* Append an assistant turn to session output tracking.
|
|
@@ -1155,8 +1179,8 @@ var Session = (_class3 = class {
|
|
|
1155
1179
|
setOutput(text, context4) {
|
|
1156
1180
|
this.outputs.push(text);
|
|
1157
1181
|
this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
1158
|
-
this.span.setAttribute(
|
|
1159
|
-
this.span.setAttribute(
|
|
1182
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
|
|
1183
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
|
|
1160
1184
|
}
|
|
1161
1185
|
/**
|
|
1162
1186
|
* Set the session title on the span.
|
|
@@ -1164,7 +1188,7 @@ var Session = (_class3 = class {
|
|
|
1164
1188
|
* @param title - The generated title string
|
|
1165
1189
|
*/
|
|
1166
1190
|
setTitle(title) {
|
|
1167
|
-
this.span.setAttribute(
|
|
1191
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_TITLE, title);
|
|
1168
1192
|
}
|
|
1169
1193
|
/**
|
|
1170
1194
|
* Update custom properties on the session span.
|
|
@@ -1174,7 +1198,7 @@ var Session = (_class3 = class {
|
|
|
1174
1198
|
*/
|
|
1175
1199
|
updateProperties(properties) {
|
|
1176
1200
|
for (const [key, value] of Object.entries(properties)) {
|
|
1177
|
-
this.span.setAttribute(`${
|
|
1201
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
1178
1202
|
}
|
|
1179
1203
|
}
|
|
1180
1204
|
/**
|
|
@@ -1186,21 +1210,21 @@ var Session = (_class3 = class {
|
|
|
1186
1210
|
setUser(user) {
|
|
1187
1211
|
if (user.traits) {
|
|
1188
1212
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
1189
|
-
this.span.setAttribute(`${
|
|
1213
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.user.${key}`, value);
|
|
1190
1214
|
}
|
|
1191
1215
|
}
|
|
1192
|
-
this.span.setAttribute(`${
|
|
1216
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.USER_ID}`, user.id);
|
|
1193
1217
|
if (user.email !== void 0) {
|
|
1194
|
-
this.span.setAttribute(`${
|
|
1218
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.USER_EMAIL}`, user.email);
|
|
1195
1219
|
}
|
|
1196
1220
|
if (user.name !== void 0) {
|
|
1197
|
-
this.span.setAttribute(`${
|
|
1221
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.USER_NAME}`, user.name);
|
|
1198
1222
|
}
|
|
1199
1223
|
if (user.role !== void 0) {
|
|
1200
|
-
this.span.setAttribute(`${
|
|
1224
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.USER_ROLE}`, user.role);
|
|
1201
1225
|
}
|
|
1202
1226
|
if (user.plan !== void 0) {
|
|
1203
|
-
this.span.setAttribute(`${
|
|
1227
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.USER_PLAN}`, user.plan);
|
|
1204
1228
|
}
|
|
1205
1229
|
}
|
|
1206
1230
|
/**
|
|
@@ -1212,18 +1236,18 @@ var Session = (_class3 = class {
|
|
|
1212
1236
|
setOrganization(org) {
|
|
1213
1237
|
if (org.traits) {
|
|
1214
1238
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
1215
|
-
this.span.setAttribute(`${
|
|
1239
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.organization.${key}`, value);
|
|
1216
1240
|
}
|
|
1217
1241
|
}
|
|
1218
|
-
this.span.setAttribute(`${
|
|
1242
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.ORGANIZATION_ID}`, org.id);
|
|
1219
1243
|
if (org.name !== void 0) {
|
|
1220
|
-
this.span.setAttribute(`${
|
|
1244
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.ORGANIZATION_NAME}`, org.name);
|
|
1221
1245
|
}
|
|
1222
1246
|
if (org.plan !== void 0) {
|
|
1223
|
-
this.span.setAttribute(`${
|
|
1247
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.ORGANIZATION_PLAN}`, org.plan);
|
|
1224
1248
|
}
|
|
1225
1249
|
if (org.domain !== void 0) {
|
|
1226
|
-
this.span.setAttribute(`${
|
|
1250
|
+
this.span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.ORGANIZATION_DOMAIN}`, org.domain);
|
|
1227
1251
|
}
|
|
1228
1252
|
}
|
|
1229
1253
|
/**
|
|
@@ -1239,7 +1263,7 @@ var Session = (_class3 = class {
|
|
|
1239
1263
|
* (free-form category, defaults to `'generic'`)
|
|
1240
1264
|
*/
|
|
1241
1265
|
addExternalLink(url, options) {
|
|
1242
|
-
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1266
|
+
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _41 => _41.title]), _optionalChain([options, 'optionalAccess', _42 => _42.linkType]));
|
|
1243
1267
|
}
|
|
1244
1268
|
}, _class3);
|
|
1245
1269
|
var SessionTitle = class {
|
|
@@ -1253,69 +1277,69 @@ var SessionTitle = class {
|
|
|
1253
1277
|
* @param title - The generated title string
|
|
1254
1278
|
*/
|
|
1255
1279
|
setTitle(title) {
|
|
1256
|
-
this.span.setAttribute(
|
|
1280
|
+
this.span.setAttribute(_chunk77UGZGMPcjs.SESSION_TITLE, title);
|
|
1257
1281
|
}
|
|
1258
1282
|
};
|
|
1259
1283
|
function getActiveSession() {
|
|
1260
|
-
return _api.context.active().getValue(
|
|
1284
|
+
return _api.context.active().getValue(_chunk77UGZGMPcjs.SESSION_OBJECT_CONTEXT_KEY);
|
|
1261
1285
|
}
|
|
1262
1286
|
function resolveSessionIdFromContext() {
|
|
1263
1287
|
const active = getActiveSession();
|
|
1264
1288
|
if (active) {
|
|
1265
1289
|
return active.sessionId;
|
|
1266
1290
|
}
|
|
1267
|
-
const props = _api.context.active().getValue(
|
|
1268
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1291
|
+
const props = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
1292
|
+
return _optionalChain([props, 'optionalAccess', _43 => _43[_chunk77UGZGMPcjs.SESSION_ID]]);
|
|
1269
1293
|
}
|
|
1270
1294
|
function resolveMessageIdFromContext() {
|
|
1271
|
-
const props = _api.context.active().getValue(
|
|
1272
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1295
|
+
const props = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
1296
|
+
return _optionalChain([props, 'optionalAccess', _44 => _44[_chunk77UGZGMPcjs.MESSAGE_ID]]);
|
|
1273
1297
|
}
|
|
1274
1298
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1275
1299
|
try {
|
|
1276
|
-
emitEventWithSessionId(sessionId,
|
|
1277
|
-
[
|
|
1278
|
-
[
|
|
1279
|
-
[
|
|
1300
|
+
emitEventWithSessionId(sessionId, _chunk77UGZGMPcjs.EXTERNAL_LINK_EVENT_NAME, {
|
|
1301
|
+
[_chunk77UGZGMPcjs.EXTERNAL_LINK_URL]: url,
|
|
1302
|
+
[_chunk77UGZGMPcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
|
|
1303
|
+
[_chunk77UGZGMPcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
|
|
1280
1304
|
});
|
|
1281
1305
|
} catch (error) {
|
|
1282
1306
|
_chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
|
|
1283
1307
|
}
|
|
1284
1308
|
}
|
|
1285
1309
|
function addExternalLink(url, options) {
|
|
1286
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1310
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _45 => _45.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1287
1311
|
if (!sessionId) {
|
|
1288
1312
|
_chunkWC573FCIcjs.logger.warn(
|
|
1289
1313
|
"addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
|
|
1290
1314
|
);
|
|
1291
1315
|
return;
|
|
1292
1316
|
}
|
|
1293
|
-
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1317
|
+
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _46 => _46.title]), _optionalChain([options, 'optionalAccess', _47 => _47.linkType]));
|
|
1294
1318
|
}
|
|
1295
1319
|
function recordFeedback(type, options) {
|
|
1296
|
-
const eventAttributes = { [
|
|
1297
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1298
|
-
eventAttributes[
|
|
1320
|
+
const eventAttributes = { [_chunk77UGZGMPcjs.FEEDBACK_TYPE]: type };
|
|
1321
|
+
if (_optionalChain([options, 'optionalAccess', _48 => _48.score]) !== void 0) {
|
|
1322
|
+
eventAttributes[_chunk77UGZGMPcjs.FEEDBACK_SCORE] = options.score;
|
|
1299
1323
|
}
|
|
1300
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1301
|
-
eventAttributes[
|
|
1324
|
+
if (_optionalChain([options, 'optionalAccess', _49 => _49.reason]) !== void 0) {
|
|
1325
|
+
eventAttributes[_chunk77UGZGMPcjs.FEEDBACK_REASON] = options.reason;
|
|
1302
1326
|
}
|
|
1303
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1304
|
-
eventAttributes[
|
|
1327
|
+
if (_optionalChain([options, 'optionalAccess', _50 => _50.comment]) !== void 0) {
|
|
1328
|
+
eventAttributes[_chunk77UGZGMPcjs.FEEDBACK_COMMENT] = options.comment;
|
|
1305
1329
|
}
|
|
1306
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1307
|
-
eventAttributes[
|
|
1330
|
+
if (_optionalChain([options, 'optionalAccess', _51 => _51.source]) !== void 0) {
|
|
1331
|
+
eventAttributes[_chunk77UGZGMPcjs.FEEDBACK_SOURCE] = options.source;
|
|
1308
1332
|
}
|
|
1309
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1333
|
+
if (_optionalChain([options, 'optionalAccess', _52 => _52.attributes])) {
|
|
1310
1334
|
for (const [key, value] of Object.entries(options.attributes)) {
|
|
1311
|
-
const k = `${
|
|
1335
|
+
const k = `${_chunk77UGZGMPcjs.FEEDBACK_ATTR_PREFIX}${key}`;
|
|
1312
1336
|
if (eventAttributes[k] === void 0) {
|
|
1313
1337
|
eventAttributes[k] = value;
|
|
1314
1338
|
}
|
|
1315
1339
|
}
|
|
1316
1340
|
}
|
|
1317
|
-
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1318
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1341
|
+
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.messageId]), () => ( resolveMessageIdFromContext()));
|
|
1342
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1319
1343
|
if (messageId === void 0 && sessionId === void 0) {
|
|
1320
1344
|
_chunkWC573FCIcjs.logger.warn(
|
|
1321
1345
|
"recordFeedback called with no resolvable message id or session id; the feedback cannot be attributed to a message or conversation. Pass options.messageId / options.sessionId or call inside a startSession/callWithMessageId scope."
|
|
@@ -1323,16 +1347,16 @@ function recordFeedback(type, options) {
|
|
|
1323
1347
|
}
|
|
1324
1348
|
const anchor = {};
|
|
1325
1349
|
if (messageId !== void 0) {
|
|
1326
|
-
anchor[
|
|
1350
|
+
anchor[_chunk77UGZGMPcjs.MESSAGE_ID] = messageId;
|
|
1327
1351
|
}
|
|
1328
1352
|
if (sessionId !== void 0) {
|
|
1329
|
-
anchor[
|
|
1353
|
+
anchor[_chunk77UGZGMPcjs.SESSION_ID] = sessionId;
|
|
1330
1354
|
}
|
|
1331
1355
|
try {
|
|
1332
1356
|
if (Object.keys(anchor).length === 0) {
|
|
1333
|
-
emitEvent(
|
|
1357
|
+
emitEvent(_chunk77UGZGMPcjs.FEEDBACK_EVENT_NAME, eventAttributes);
|
|
1334
1358
|
} else {
|
|
1335
|
-
callWithProperties(anchor, () => emitEvent(
|
|
1359
|
+
callWithProperties(anchor, () => emitEvent(_chunk77UGZGMPcjs.FEEDBACK_EVENT_NAME, eventAttributes));
|
|
1336
1360
|
}
|
|
1337
1361
|
} catch (error) {
|
|
1338
1362
|
_chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
|
|
@@ -1346,7 +1370,7 @@ function recordMetric(options) {
|
|
|
1346
1370
|
try {
|
|
1347
1371
|
recordMetricImpl(options);
|
|
1348
1372
|
} catch (error) {
|
|
1349
|
-
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess',
|
|
1373
|
+
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _55 => _55.name]))}) failed; metric dropped.`, error);
|
|
1350
1374
|
}
|
|
1351
1375
|
}
|
|
1352
1376
|
function recordMetricImpl(options) {
|
|
@@ -1357,7 +1381,7 @@ function recordMetricImpl(options) {
|
|
|
1357
1381
|
);
|
|
1358
1382
|
return;
|
|
1359
1383
|
}
|
|
1360
|
-
if (
|
|
1384
|
+
if (_chunk77UGZGMPcjs.RESERVED_METRIC_NAMES.has(name)) {
|
|
1361
1385
|
_chunkWC573FCIcjs.logger.warn(
|
|
1362
1386
|
`recordMetric called with the reserved name ${JSON.stringify(name)}; metric dropped. Brizz computes this metric itself \u2014 pick a different name.`
|
|
1363
1387
|
);
|
|
@@ -1376,17 +1400,17 @@ function recordMetricImpl(options) {
|
|
|
1376
1400
|
return;
|
|
1377
1401
|
}
|
|
1378
1402
|
const eventAttributes = {
|
|
1379
|
-
[
|
|
1380
|
-
[
|
|
1403
|
+
[_chunk77UGZGMPcjs.METRIC_NAME]: name,
|
|
1404
|
+
[_chunk77UGZGMPcjs.METRIC_VALUE]: numericValue
|
|
1381
1405
|
};
|
|
1382
1406
|
if (options.unit !== void 0) {
|
|
1383
|
-
eventAttributes[
|
|
1407
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_UNIT] = options.unit;
|
|
1384
1408
|
}
|
|
1385
1409
|
if (options.minValue !== void 0) {
|
|
1386
|
-
eventAttributes[
|
|
1410
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_MIN] = options.minValue;
|
|
1387
1411
|
}
|
|
1388
1412
|
if (options.maxValue !== void 0) {
|
|
1389
|
-
eventAttributes[
|
|
1413
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_MAX] = options.maxValue;
|
|
1390
1414
|
}
|
|
1391
1415
|
if (options.comment !== void 0) {
|
|
1392
1416
|
let comment = options.comment;
|
|
@@ -1396,21 +1420,21 @@ function recordMetricImpl(options) {
|
|
|
1396
1420
|
);
|
|
1397
1421
|
comment = comment.slice(0, METRIC_COMMENT_MAX_LEN);
|
|
1398
1422
|
}
|
|
1399
|
-
eventAttributes[
|
|
1423
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_COMMENT] = comment;
|
|
1400
1424
|
}
|
|
1401
1425
|
if (options.polarity !== void 0) {
|
|
1402
1426
|
const polarity = options.polarity;
|
|
1403
|
-
if (polarity ===
|
|
1404
|
-
eventAttributes[
|
|
1427
|
+
if (polarity === _chunk77UGZGMPcjs.METRIC_POLARITY_POSITIVE || polarity === _chunk77UGZGMPcjs.METRIC_POLARITY_NEGATIVE) {
|
|
1428
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_POLARITY] = polarity;
|
|
1405
1429
|
} else {
|
|
1406
1430
|
_chunkWC573FCIcjs.logger.warn(
|
|
1407
|
-
`recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${
|
|
1431
|
+
`recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${_chunk77UGZGMPcjs.METRIC_POLARITY_POSITIVE}' or '${_chunk77UGZGMPcjs.METRIC_POLARITY_NEGATIVE}'. Emitting the metric without it.`
|
|
1408
1432
|
);
|
|
1409
1433
|
}
|
|
1410
1434
|
}
|
|
1411
1435
|
if (options.timestamp !== void 0) {
|
|
1412
1436
|
if (Number.isFinite(options.timestamp.getTime())) {
|
|
1413
|
-
eventAttributes[
|
|
1437
|
+
eventAttributes[_chunk77UGZGMPcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
|
|
1414
1438
|
} else {
|
|
1415
1439
|
_chunkWC573FCIcjs.logger.warn(
|
|
1416
1440
|
`recordMetric(${name}) called with an invalid timestamp; emitting the metric without it.`
|
|
@@ -1440,7 +1464,7 @@ function recordMetricImpl(options) {
|
|
|
1440
1464
|
);
|
|
1441
1465
|
text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
|
|
1442
1466
|
}
|
|
1443
|
-
eventAttributes[`${
|
|
1467
|
+
eventAttributes[`${_chunk77UGZGMPcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
|
|
1444
1468
|
accepted += 1;
|
|
1445
1469
|
}
|
|
1446
1470
|
}
|
|
@@ -1453,28 +1477,28 @@ function recordMetricImpl(options) {
|
|
|
1453
1477
|
}
|
|
1454
1478
|
try {
|
|
1455
1479
|
callWithProperties(
|
|
1456
|
-
{ [
|
|
1457
|
-
() => emitEvent(
|
|
1480
|
+
{ [_chunk77UGZGMPcjs.SESSION_ID]: sessionId },
|
|
1481
|
+
() => emitEvent(_chunk77UGZGMPcjs.METRIC_EVENT_NAME, eventAttributes)
|
|
1458
1482
|
);
|
|
1459
1483
|
} catch (error) {
|
|
1460
1484
|
_chunkWC573FCIcjs.logger.warn("recordMetric: failed to emit metric event", error);
|
|
1461
1485
|
}
|
|
1462
1486
|
}
|
|
1463
1487
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1464
|
-
const isTitle = _optionalChain([options, 'optionalAccess',
|
|
1465
|
-
const spanName = isTitle ?
|
|
1488
|
+
const isTitle = _optionalChain([options, 'optionalAccess', _56 => _56.mode]) === "title";
|
|
1489
|
+
const spanName = isTitle ? _chunk77UGZGMPcjs.SESSION_TITLE_SPAN_NAME : _chunk77UGZGMPcjs.SESSION_SPAN_NAME;
|
|
1466
1490
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1467
1491
|
return tracer.startActiveSpan(spanName, (span) => {
|
|
1468
|
-
span.setAttribute(`${
|
|
1492
|
+
span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.SESSION_ID}`, sessionId);
|
|
1469
1493
|
if (extraProperties) {
|
|
1470
1494
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
1471
|
-
span.setAttribute(`${
|
|
1495
|
+
span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
1472
1496
|
}
|
|
1473
1497
|
}
|
|
1474
1498
|
const session = new Session(sessionId, span);
|
|
1475
|
-
const contextProperties = { [
|
|
1499
|
+
const contextProperties = { [_chunk77UGZGMPcjs.SESSION_ID]: sessionId };
|
|
1476
1500
|
if (isTitle) {
|
|
1477
|
-
contextProperties[
|
|
1501
|
+
contextProperties[_chunk77UGZGMPcjs.SESSION_TITLE_GENERATION] = "true";
|
|
1478
1502
|
}
|
|
1479
1503
|
if (extraProperties) {
|
|
1480
1504
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
@@ -1482,7 +1506,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1482
1506
|
}
|
|
1483
1507
|
}
|
|
1484
1508
|
return callWithProperties(contextProperties, () => {
|
|
1485
|
-
const sessionCtx = _api.context.active().setValue(
|
|
1509
|
+
const sessionCtx = _api.context.active().setValue(_chunk77UGZGMPcjs.SESSION_OBJECT_CONTEXT_KEY, session);
|
|
1486
1510
|
return _api.context.with(sessionCtx, () => {
|
|
1487
1511
|
try {
|
|
1488
1512
|
const result = callback(session);
|
|
@@ -1510,16 +1534,16 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1510
1534
|
});
|
|
1511
1535
|
}
|
|
1512
1536
|
function startSessionTitle(callback, options) {
|
|
1513
|
-
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1537
|
+
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _57 => _57.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _58 => _58(), 'optionalAccess', _59 => _59.sessionId])));
|
|
1514
1538
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1515
|
-
return tracer.startActiveSpan(
|
|
1539
|
+
return tracer.startActiveSpan(_chunk77UGZGMPcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1516
1540
|
if (resolvedSessionId) {
|
|
1517
|
-
span.setAttribute(`${
|
|
1541
|
+
span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.SESSION_ID}`, resolvedSessionId);
|
|
1518
1542
|
}
|
|
1519
1543
|
const sessionTitle = new SessionTitle(span);
|
|
1520
|
-
const properties = { [
|
|
1544
|
+
const properties = { [_chunk77UGZGMPcjs.SESSION_TITLE_GENERATION]: "true" };
|
|
1521
1545
|
if (resolvedSessionId) {
|
|
1522
|
-
properties[
|
|
1546
|
+
properties[_chunk77UGZGMPcjs.SESSION_ID] = resolvedSessionId;
|
|
1523
1547
|
}
|
|
1524
1548
|
return callWithProperties(properties, () => {
|
|
1525
1549
|
try {
|
|
@@ -1664,7 +1688,7 @@ var BrizzSpanExporter = class {
|
|
|
1664
1688
|
const resourceAttrs = {
|
|
1665
1689
|
...config.resourceAttributes,
|
|
1666
1690
|
"service.name": config.appName,
|
|
1667
|
-
[BRIZZ_SDK_VERSION]:
|
|
1691
|
+
[BRIZZ_SDK_VERSION]: _chunk2DSTZTDAcjs.getSDKVersion.call(void 0, ),
|
|
1668
1692
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1669
1693
|
};
|
|
1670
1694
|
if (config.environment) {
|
|
@@ -1716,7 +1740,7 @@ var BrizzSpanExporter = class {
|
|
|
1716
1740
|
return this._delegate.shutdown();
|
|
1717
1741
|
}
|
|
1718
1742
|
async forceFlush() {
|
|
1719
|
-
return _optionalChain([this, 'access',
|
|
1743
|
+
return _optionalChain([this, 'access', _60 => _60._delegate, 'access', _61 => _61.forceFlush, 'optionalCall', _62 => _62()]);
|
|
1720
1744
|
}
|
|
1721
1745
|
};
|
|
1722
1746
|
|
|
@@ -1727,10 +1751,10 @@ var BrizzSpanExporter = class {
|
|
|
1727
1751
|
|
|
1728
1752
|
var _sdktracebase = require('@opentelemetry/sdk-trace-base');
|
|
1729
1753
|
function applyContextAttributes(span) {
|
|
1730
|
-
const sessionProperties = _api.context.active().getValue(
|
|
1754
|
+
const sessionProperties = _api.context.active().getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
1731
1755
|
if (sessionProperties) {
|
|
1732
1756
|
for (const [key, value] of Object.entries(sessionProperties)) {
|
|
1733
|
-
span.setAttribute(`${
|
|
1757
|
+
span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${key}`, value);
|
|
1734
1758
|
}
|
|
1735
1759
|
}
|
|
1736
1760
|
}
|
|
@@ -1751,7 +1775,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
1751
1775
|
super.onStart(span, parentContext);
|
|
1752
1776
|
}
|
|
1753
1777
|
onEnd(span) {
|
|
1754
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1778
|
+
const maskingConfig = _optionalChain([this, 'access', _63 => _63.config, 'access', _64 => _64.masking, 'optionalAccess', _65 => _65.spanMasking]);
|
|
1755
1779
|
if (maskingConfig) {
|
|
1756
1780
|
maskReadableSpan(span, maskingConfig);
|
|
1757
1781
|
}
|
|
@@ -1769,7 +1793,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
1769
1793
|
super.onStart(span, parentContext);
|
|
1770
1794
|
}
|
|
1771
1795
|
onEnd(span) {
|
|
1772
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1796
|
+
const maskingConfig = _optionalChain([this, 'access', _66 => _66.config, 'access', _67 => _67.masking, 'optionalAccess', _68 => _68.spanMasking]);
|
|
1773
1797
|
if (maskingConfig) {
|
|
1774
1798
|
maskReadableSpan(span, maskingConfig);
|
|
1775
1799
|
}
|
|
@@ -1849,7 +1873,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1849
1873
|
}
|
|
1850
1874
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
1851
1875
|
disableBatch: config.disableBatch,
|
|
1852
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
1876
|
+
hasMasking: !!_optionalChain([config, 'access', _69 => _69.masking, 'optionalAccess', _70 => _70.spanMasking])
|
|
1853
1877
|
});
|
|
1854
1878
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
1855
1879
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -1929,7 +1953,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
|
1929
1953
|
|
|
1930
1954
|
// src/internal/config.ts
|
|
1931
1955
|
function resolveConfig(options) {
|
|
1932
|
-
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access',
|
|
1956
|
+
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _71 => _71.logLevel, 'optionalAccess', _72 => _72.toString, 'call', _73 => _73()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
1933
1957
|
let resolvedLogLevel;
|
|
1934
1958
|
if (envLogLevel) {
|
|
1935
1959
|
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
|
|
@@ -2100,7 +2124,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2100
2124
|
const resourceAttributes = {
|
|
2101
2125
|
...resolvedConfig.resourceAttributes,
|
|
2102
2126
|
"service.name": resolvedConfig.appName,
|
|
2103
|
-
[BRIZZ_SDK_VERSION]:
|
|
2127
|
+
[BRIZZ_SDK_VERSION]: _chunk2DSTZTDAcjs.getSDKVersion.call(void 0, ),
|
|
2104
2128
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2105
2129
|
};
|
|
2106
2130
|
if (resolvedConfig.environment) {
|
|
@@ -2112,7 +2136,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2112
2136
|
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));
|
|
2113
2137
|
this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
|
|
2114
2138
|
resource,
|
|
2115
|
-
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0,
|
|
2139
|
+
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkEVRCHF74cjs.InterruptPropagator)(), getSpanProcessor()]
|
|
2116
2140
|
});
|
|
2117
2141
|
this._tracerProvider.register();
|
|
2118
2142
|
this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
|
|
@@ -2248,10 +2272,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2248
2272
|
}
|
|
2249
2273
|
try {
|
|
2250
2274
|
await this.shutdownModules();
|
|
2251
|
-
await _optionalChain([this, 'access',
|
|
2252
|
-
await _optionalChain([this, 'access',
|
|
2253
|
-
await _optionalChain([this, 'access',
|
|
2254
|
-
await _optionalChain([this, 'access',
|
|
2275
|
+
await _optionalChain([this, 'access', _74 => _74._tracerProvider, 'optionalAccess', _75 => _75.forceFlush, 'call', _76 => _76()]);
|
|
2276
|
+
await _optionalChain([this, 'access', _77 => _77._tracerProvider, 'optionalAccess', _78 => _78.shutdown, 'call', _79 => _79()]);
|
|
2277
|
+
await _optionalChain([this, 'access', _80 => _80._meterProvider, 'optionalAccess', _81 => _81.forceFlush, 'call', _82 => _82()]);
|
|
2278
|
+
await _optionalChain([this, 'access', _83 => _83._meterProvider, 'optionalAccess', _84 => _84.shutdown, 'call', _85 => _85()]);
|
|
2255
2279
|
this._initialized = false;
|
|
2256
2280
|
this._tracerProvider = null;
|
|
2257
2281
|
this._meterProvider = null;
|
|
@@ -2280,7 +2304,7 @@ function detectRuntime() {
|
|
|
2280
2304
|
const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
|
|
2281
2305
|
const supportsRegister = (
|
|
2282
2306
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2283
|
-
!!_optionalChain([process, 'access',
|
|
2307
|
+
!!_optionalChain([process, 'access', _86 => _86.features, 'optionalAccess', _87 => _87.typescript]) || !!_optionalChain([globalThis, 'access', _88 => _88.module, 'optionalAccess', _89 => _89.register])
|
|
2284
2308
|
);
|
|
2285
2309
|
_chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
|
|
2286
2310
|
nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
|