@brizz/sdk 0.1.33 → 0.1.34
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 +40 -1
- package/dist/{chunk-N4X2B6BC.js → chunk-24CEDVD2.js} +1 -1
- package/dist/{chunk-WXHBHJRJ.cjs → chunk-3LR22M4E.cjs} +245 -109
- package/dist/{chunk-PY6FJBVY.js → chunk-64STNQKL.js} +1 -1
- package/dist/{chunk-KDFV63CU.js → chunk-F3O3MTQ4.js} +151 -15
- package/dist/{chunk-LFLYWZ6D.cjs → chunk-M3UGFLH7.cjs} +4 -4
- package/dist/{chunk-LIFLVFK6.cjs → chunk-NEF2O7HF.cjs} +38 -1
- package/dist/{chunk-GRRKMMG6.js → chunk-QY4VADPP.js} +38 -1
- package/dist/{chunk-3ITCDKTJ.cjs → chunk-VU5YDLUD.cjs} +1 -1
- package/dist/index.cjs +9 -7
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +8 -6
- package/dist/interrupt-7MWQCOY3.cjs +12 -0
- package/dist/{interrupt-AOYNN5AB.js → interrupt-KADNA6WK.js} +2 -2
- package/dist/{mcp-OKSS2R56.cjs → mcp-WCMY6ED6.cjs} +7 -7
- package/dist/{mcp-XIHWT2AU.js → mcp-ZP6AY3FE.js} +2 -2
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +12 -10
- package/dist/interrupt-EMUUN3ER.cjs +0 -12
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkVU5YDLUDcjs = require('./chunk-VU5YDLUD.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ var _chunk3ITCDKTJcjs = require('./chunk-3ITCDKTJ.cjs');
|
|
|
13
13
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkM3UGFLH7cjs = require('./chunk-M3UGFLH7.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -51,7 +51,20 @@ var _chunkLFLYWZ6Dcjs = require('./chunk-LFLYWZ6D.cjs');
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var _chunkNEF2O7HFcjs = require('./chunk-NEF2O7HF.cjs');
|
|
55
68
|
|
|
56
69
|
|
|
57
70
|
var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
|
|
@@ -161,7 +174,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
161
174
|
const mcpModules = this.manualModules.mcp;
|
|
162
175
|
void (async () => {
|
|
163
176
|
try {
|
|
164
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
177
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-WCMY6ED6.cjs")));
|
|
165
178
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
166
179
|
instrumentation.manuallyInstrument(mcpModules);
|
|
167
180
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -652,10 +665,10 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
652
665
|
if (maskingConfig) {
|
|
653
666
|
maskLog(logRecord, maskingConfig);
|
|
654
667
|
}
|
|
655
|
-
const associationProperties = _api.context.active().getValue(
|
|
668
|
+
const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
656
669
|
if (associationProperties) {
|
|
657
670
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
658
|
-
logRecord.setAttribute(`${
|
|
671
|
+
logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
659
672
|
}
|
|
660
673
|
}
|
|
661
674
|
super.onEmit(logRecord);
|
|
@@ -672,10 +685,10 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
672
685
|
if (maskingConfig) {
|
|
673
686
|
maskLog(logRecord, maskingConfig);
|
|
674
687
|
}
|
|
675
|
-
const associationProperties = _api.context.active().getValue(
|
|
688
|
+
const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
676
689
|
if (associationProperties) {
|
|
677
690
|
for (const [key, value] of Object.entries(associationProperties)) {
|
|
678
|
-
logRecord.setAttribute(`${
|
|
691
|
+
logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
679
692
|
}
|
|
680
693
|
}
|
|
681
694
|
super.onEmit(logRecord);
|
|
@@ -702,7 +715,7 @@ function maskLog(logRecord, config) {
|
|
|
702
715
|
newAttributes[key] = value;
|
|
703
716
|
}
|
|
704
717
|
for (const [key, value] of Object.entries(logRecord.attributes)) {
|
|
705
|
-
if (key.startsWith(
|
|
718
|
+
if (key.startsWith(_chunkNEF2O7HFcjs.INTERNAL_EVENT_PREFIX)) {
|
|
706
719
|
newAttributes[key] = value;
|
|
707
720
|
}
|
|
708
721
|
}
|
|
@@ -793,7 +806,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
793
806
|
const resourceAttributes = {
|
|
794
807
|
...config.resourceAttributes,
|
|
795
808
|
"service.name": config.appName,
|
|
796
|
-
[BRIZZ_SDK_VERSION]:
|
|
809
|
+
[BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
|
|
797
810
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
798
811
|
};
|
|
799
812
|
if (config.environment) {
|
|
@@ -909,16 +922,16 @@ function setCurrentSpanCustomProperties(properties) {
|
|
|
909
922
|
}
|
|
910
923
|
for (const [key, value] of Object.entries(properties)) {
|
|
911
924
|
try {
|
|
912
|
-
current.setAttribute(`${
|
|
925
|
+
current.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
913
926
|
} catch (e) {
|
|
914
927
|
}
|
|
915
928
|
}
|
|
916
929
|
}
|
|
917
930
|
function callWithProperties(properties, fn, thisArg, ...args) {
|
|
918
931
|
const base = _api.context.active();
|
|
919
|
-
const prev = base.getValue(
|
|
932
|
+
const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
920
933
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
921
|
-
const next = base.setValue(
|
|
934
|
+
const next = base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged);
|
|
922
935
|
return _api.context.with(next, fn, thisArg, ...args);
|
|
923
936
|
}
|
|
924
937
|
function withProperties(properties, fn, thisArg) {
|
|
@@ -940,25 +953,25 @@ function propagatePropertiesImperatively(properties) {
|
|
|
940
953
|
return;
|
|
941
954
|
}
|
|
942
955
|
const base = _api.context.active();
|
|
943
|
-
const prev = base.getValue(
|
|
956
|
+
const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
944
957
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
945
|
-
store.enterWith(base.setValue(
|
|
958
|
+
store.enterWith(base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged));
|
|
946
959
|
} catch (e2) {
|
|
947
960
|
}
|
|
948
961
|
}
|
|
949
962
|
function setUser(user) {
|
|
950
|
-
const properties = { [
|
|
963
|
+
const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
|
|
951
964
|
if (user.email !== void 0) {
|
|
952
|
-
properties[
|
|
965
|
+
properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
|
|
953
966
|
}
|
|
954
967
|
if (user.name !== void 0) {
|
|
955
|
-
properties[
|
|
968
|
+
properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
|
|
956
969
|
}
|
|
957
970
|
if (user.role !== void 0) {
|
|
958
|
-
properties[
|
|
971
|
+
properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
|
|
959
972
|
}
|
|
960
973
|
if (user.plan !== void 0) {
|
|
961
|
-
properties[
|
|
974
|
+
properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
|
|
962
975
|
}
|
|
963
976
|
if (user.traits) {
|
|
964
977
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
@@ -972,15 +985,15 @@ function setUser(user) {
|
|
|
972
985
|
propagatePropertiesImperatively(properties);
|
|
973
986
|
}
|
|
974
987
|
function setOrganization(org) {
|
|
975
|
-
const properties = { [
|
|
988
|
+
const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
|
|
976
989
|
if (org.name !== void 0) {
|
|
977
|
-
properties[
|
|
990
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
|
|
978
991
|
}
|
|
979
992
|
if (org.plan !== void 0) {
|
|
980
|
-
properties[
|
|
993
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
|
|
981
994
|
}
|
|
982
995
|
if (org.domain !== void 0) {
|
|
983
|
-
properties[
|
|
996
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
|
|
984
997
|
}
|
|
985
998
|
if (org.traits) {
|
|
986
999
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
@@ -994,23 +1007,23 @@ function setOrganization(org) {
|
|
|
994
1007
|
propagatePropertiesImperatively(properties);
|
|
995
1008
|
}
|
|
996
1009
|
function setMessageId(id) {
|
|
997
|
-
const properties = { [
|
|
1010
|
+
const properties = { [_chunkNEF2O7HFcjs.MESSAGE_ID]: id };
|
|
998
1011
|
setCurrentSpanCustomProperties(properties);
|
|
999
1012
|
propagatePropertiesImperatively(properties);
|
|
1000
1013
|
}
|
|
1001
1014
|
function userProperties(user) {
|
|
1002
|
-
const properties = { [
|
|
1015
|
+
const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
|
|
1003
1016
|
if (user.email !== void 0) {
|
|
1004
|
-
properties[
|
|
1017
|
+
properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
|
|
1005
1018
|
}
|
|
1006
1019
|
if (user.name !== void 0) {
|
|
1007
|
-
properties[
|
|
1020
|
+
properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
|
|
1008
1021
|
}
|
|
1009
1022
|
if (user.role !== void 0) {
|
|
1010
|
-
properties[
|
|
1023
|
+
properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
|
|
1011
1024
|
}
|
|
1012
1025
|
if (user.plan !== void 0) {
|
|
1013
|
-
properties[
|
|
1026
|
+
properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
|
|
1014
1027
|
}
|
|
1015
1028
|
if (user.traits) {
|
|
1016
1029
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
@@ -1023,15 +1036,15 @@ function userProperties(user) {
|
|
|
1023
1036
|
return properties;
|
|
1024
1037
|
}
|
|
1025
1038
|
function organizationProperties(org) {
|
|
1026
|
-
const properties = { [
|
|
1039
|
+
const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
|
|
1027
1040
|
if (org.name !== void 0) {
|
|
1028
|
-
properties[
|
|
1041
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
|
|
1029
1042
|
}
|
|
1030
1043
|
if (org.plan !== void 0) {
|
|
1031
|
-
properties[
|
|
1044
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
|
|
1032
1045
|
}
|
|
1033
1046
|
if (org.domain !== void 0) {
|
|
1034
|
-
properties[
|
|
1047
|
+
properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
|
|
1035
1048
|
}
|
|
1036
1049
|
if (org.traits) {
|
|
1037
1050
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
@@ -1056,19 +1069,19 @@ function withOrganization(org, fn, thisArg) {
|
|
|
1056
1069
|
return withProperties(organizationProperties(org), fn, thisArg);
|
|
1057
1070
|
}
|
|
1058
1071
|
function callWithMessageId(id, fn, thisArg, ...args) {
|
|
1059
|
-
return callWithProperties({ [
|
|
1072
|
+
return callWithProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
|
|
1060
1073
|
}
|
|
1061
1074
|
function withMessageId(id, fn, thisArg) {
|
|
1062
|
-
return withProperties({ [
|
|
1075
|
+
return withProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg);
|
|
1063
1076
|
}
|
|
1064
1077
|
function muteProperties(options) {
|
|
1065
1078
|
const { input = true, output = true } = options;
|
|
1066
1079
|
const properties = {};
|
|
1067
1080
|
if (input) {
|
|
1068
|
-
properties[
|
|
1081
|
+
properties[_chunkNEF2O7HFcjs.MUTE_INPUT] = "true";
|
|
1069
1082
|
}
|
|
1070
1083
|
if (output) {
|
|
1071
|
-
properties[
|
|
1084
|
+
properties[_chunkNEF2O7HFcjs.MUTE_OUTPUT] = "true";
|
|
1072
1085
|
}
|
|
1073
1086
|
return properties;
|
|
1074
1087
|
}
|
|
@@ -1079,11 +1092,11 @@ function withMute(options, fn, thisArg) {
|
|
|
1079
1092
|
return withProperties(muteProperties(options), fn, thisArg);
|
|
1080
1093
|
}
|
|
1081
1094
|
function withSessionId(sessionId, fn, thisArg, extraProperties) {
|
|
1082
|
-
const properties = { [
|
|
1095
|
+
const properties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId, ...extraProperties };
|
|
1083
1096
|
return withProperties(properties, fn, thisArg);
|
|
1084
1097
|
}
|
|
1085
1098
|
function callWithSessionId(sessionId, fn, thisArg, ...args) {
|
|
1086
|
-
return callWithProperties({ [
|
|
1099
|
+
return callWithProperties({ [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
|
|
1087
1100
|
}
|
|
1088
1101
|
var Session = (_class3 = class {
|
|
1089
1102
|
|
|
@@ -1111,8 +1124,8 @@ var Session = (_class3 = class {
|
|
|
1111
1124
|
setInput(text, context4) {
|
|
1112
1125
|
this.inputs.push(text);
|
|
1113
1126
|
this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
1114
|
-
this.span.setAttribute(
|
|
1115
|
-
this.span.setAttribute(
|
|
1127
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT, JSON.stringify(this.inputs));
|
|
1128
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
|
|
1116
1129
|
}
|
|
1117
1130
|
/**
|
|
1118
1131
|
* Append an assistant turn to session output tracking.
|
|
@@ -1127,8 +1140,8 @@ var Session = (_class3 = class {
|
|
|
1127
1140
|
setOutput(text, context4) {
|
|
1128
1141
|
this.outputs.push(text);
|
|
1129
1142
|
this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
|
|
1130
|
-
this.span.setAttribute(
|
|
1131
|
-
this.span.setAttribute(
|
|
1143
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
|
|
1144
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
|
|
1132
1145
|
}
|
|
1133
1146
|
/**
|
|
1134
1147
|
* Set the session title on the span.
|
|
@@ -1136,7 +1149,7 @@ var Session = (_class3 = class {
|
|
|
1136
1149
|
* @param title - The generated title string
|
|
1137
1150
|
*/
|
|
1138
1151
|
setTitle(title) {
|
|
1139
|
-
this.span.setAttribute(
|
|
1152
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
|
|
1140
1153
|
}
|
|
1141
1154
|
/**
|
|
1142
1155
|
* Update custom properties on the session span.
|
|
@@ -1146,7 +1159,7 @@ var Session = (_class3 = class {
|
|
|
1146
1159
|
*/
|
|
1147
1160
|
updateProperties(properties) {
|
|
1148
1161
|
for (const [key, value] of Object.entries(properties)) {
|
|
1149
|
-
this.span.setAttribute(`${
|
|
1162
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
1150
1163
|
}
|
|
1151
1164
|
}
|
|
1152
1165
|
/**
|
|
@@ -1158,21 +1171,21 @@ var Session = (_class3 = class {
|
|
|
1158
1171
|
setUser(user) {
|
|
1159
1172
|
if (user.traits) {
|
|
1160
1173
|
for (const [key, value] of Object.entries(user.traits)) {
|
|
1161
|
-
this.span.setAttribute(`${
|
|
1174
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.user.${key}`, value);
|
|
1162
1175
|
}
|
|
1163
1176
|
}
|
|
1164
|
-
this.span.setAttribute(`${
|
|
1177
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ID}`, user.id);
|
|
1165
1178
|
if (user.email !== void 0) {
|
|
1166
|
-
this.span.setAttribute(`${
|
|
1179
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_EMAIL}`, user.email);
|
|
1167
1180
|
}
|
|
1168
1181
|
if (user.name !== void 0) {
|
|
1169
|
-
this.span.setAttribute(`${
|
|
1182
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_NAME}`, user.name);
|
|
1170
1183
|
}
|
|
1171
1184
|
if (user.role !== void 0) {
|
|
1172
|
-
this.span.setAttribute(`${
|
|
1185
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ROLE}`, user.role);
|
|
1173
1186
|
}
|
|
1174
1187
|
if (user.plan !== void 0) {
|
|
1175
|
-
this.span.setAttribute(`${
|
|
1188
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_PLAN}`, user.plan);
|
|
1176
1189
|
}
|
|
1177
1190
|
}
|
|
1178
1191
|
/**
|
|
@@ -1184,18 +1197,18 @@ var Session = (_class3 = class {
|
|
|
1184
1197
|
setOrganization(org) {
|
|
1185
1198
|
if (org.traits) {
|
|
1186
1199
|
for (const [key, value] of Object.entries(org.traits)) {
|
|
1187
|
-
this.span.setAttribute(`${
|
|
1200
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.organization.${key}`, value);
|
|
1188
1201
|
}
|
|
1189
1202
|
}
|
|
1190
|
-
this.span.setAttribute(`${
|
|
1203
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_ID}`, org.id);
|
|
1191
1204
|
if (org.name !== void 0) {
|
|
1192
|
-
this.span.setAttribute(`${
|
|
1205
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_NAME}`, org.name);
|
|
1193
1206
|
}
|
|
1194
1207
|
if (org.plan !== void 0) {
|
|
1195
|
-
this.span.setAttribute(`${
|
|
1208
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_PLAN}`, org.plan);
|
|
1196
1209
|
}
|
|
1197
1210
|
if (org.domain !== void 0) {
|
|
1198
|
-
this.span.setAttribute(`${
|
|
1211
|
+
this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN}`, org.domain);
|
|
1199
1212
|
}
|
|
1200
1213
|
}
|
|
1201
1214
|
/**
|
|
@@ -1225,30 +1238,30 @@ var SessionTitle = class {
|
|
|
1225
1238
|
* @param title - The generated title string
|
|
1226
1239
|
*/
|
|
1227
1240
|
setTitle(title) {
|
|
1228
|
-
this.span.setAttribute(
|
|
1241
|
+
this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
|
|
1229
1242
|
}
|
|
1230
1243
|
};
|
|
1231
1244
|
function getActiveSession() {
|
|
1232
|
-
return _api.context.active().getValue(
|
|
1245
|
+
return _api.context.active().getValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY);
|
|
1233
1246
|
}
|
|
1234
1247
|
function resolveSessionIdFromContext() {
|
|
1235
1248
|
const active = getActiveSession();
|
|
1236
1249
|
if (active) {
|
|
1237
1250
|
return active.sessionId;
|
|
1238
1251
|
}
|
|
1239
|
-
const props = _api.context.active().getValue(
|
|
1240
|
-
return _optionalChain([props, 'optionalAccess', _40 => _40[
|
|
1252
|
+
const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
1253
|
+
return _optionalChain([props, 'optionalAccess', _40 => _40[_chunkNEF2O7HFcjs.SESSION_ID]]);
|
|
1241
1254
|
}
|
|
1242
1255
|
function resolveMessageIdFromContext() {
|
|
1243
|
-
const props = _api.context.active().getValue(
|
|
1244
|
-
return _optionalChain([props, 'optionalAccess', _41 => _41[
|
|
1256
|
+
const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
1257
|
+
return _optionalChain([props, 'optionalAccess', _41 => _41[_chunkNEF2O7HFcjs.MESSAGE_ID]]);
|
|
1245
1258
|
}
|
|
1246
1259
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1247
1260
|
try {
|
|
1248
|
-
emitEventWithSessionId(sessionId,
|
|
1249
|
-
[
|
|
1250
|
-
[
|
|
1251
|
-
[
|
|
1261
|
+
emitEventWithSessionId(sessionId, _chunkNEF2O7HFcjs.EXTERNAL_LINK_EVENT_NAME, {
|
|
1262
|
+
[_chunkNEF2O7HFcjs.EXTERNAL_LINK_URL]: url,
|
|
1263
|
+
[_chunkNEF2O7HFcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
|
|
1264
|
+
[_chunkNEF2O7HFcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
|
|
1252
1265
|
});
|
|
1253
1266
|
} catch (error) {
|
|
1254
1267
|
_chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
|
|
@@ -1265,24 +1278,24 @@ function addExternalLink(url, options) {
|
|
|
1265
1278
|
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _43 => _43.title]), _optionalChain([options, 'optionalAccess', _44 => _44.linkType]));
|
|
1266
1279
|
}
|
|
1267
1280
|
function recordFeedback(type, options) {
|
|
1268
|
-
const
|
|
1281
|
+
const eventAttributes = { [_chunkNEF2O7HFcjs.FEEDBACK_TYPE]: type };
|
|
1269
1282
|
if (_optionalChain([options, 'optionalAccess', _45 => _45.score]) !== void 0) {
|
|
1270
|
-
|
|
1283
|
+
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SCORE] = options.score;
|
|
1271
1284
|
}
|
|
1272
1285
|
if (_optionalChain([options, 'optionalAccess', _46 => _46.reason]) !== void 0) {
|
|
1273
|
-
|
|
1286
|
+
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_REASON] = options.reason;
|
|
1274
1287
|
}
|
|
1275
1288
|
if (_optionalChain([options, 'optionalAccess', _47 => _47.comment]) !== void 0) {
|
|
1276
|
-
|
|
1289
|
+
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_COMMENT] = options.comment;
|
|
1277
1290
|
}
|
|
1278
1291
|
if (_optionalChain([options, 'optionalAccess', _48 => _48.source]) !== void 0) {
|
|
1279
|
-
|
|
1292
|
+
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SOURCE] = options.source;
|
|
1280
1293
|
}
|
|
1281
|
-
if (_optionalChain([options, 'optionalAccess', _49 => _49.
|
|
1282
|
-
for (const [key, value] of Object.entries(options.
|
|
1283
|
-
const k = `${
|
|
1284
|
-
if (
|
|
1285
|
-
|
|
1294
|
+
if (_optionalChain([options, 'optionalAccess', _49 => _49.attributes])) {
|
|
1295
|
+
for (const [key, value] of Object.entries(options.attributes)) {
|
|
1296
|
+
const k = `${_chunkNEF2O7HFcjs.FEEDBACK_ATTR_PREFIX}${key}`;
|
|
1297
|
+
if (eventAttributes[k] === void 0) {
|
|
1298
|
+
eventAttributes[k] = value;
|
|
1286
1299
|
}
|
|
1287
1300
|
}
|
|
1288
1301
|
}
|
|
@@ -1295,36 +1308,158 @@ function recordFeedback(type, options) {
|
|
|
1295
1308
|
}
|
|
1296
1309
|
const anchor = {};
|
|
1297
1310
|
if (messageId !== void 0) {
|
|
1298
|
-
anchor[
|
|
1311
|
+
anchor[_chunkNEF2O7HFcjs.MESSAGE_ID] = messageId;
|
|
1299
1312
|
}
|
|
1300
1313
|
if (sessionId !== void 0) {
|
|
1301
|
-
anchor[
|
|
1314
|
+
anchor[_chunkNEF2O7HFcjs.SESSION_ID] = sessionId;
|
|
1302
1315
|
}
|
|
1303
1316
|
try {
|
|
1304
1317
|
if (Object.keys(anchor).length === 0) {
|
|
1305
|
-
emitEvent(
|
|
1318
|
+
emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes);
|
|
1306
1319
|
} else {
|
|
1307
|
-
callWithProperties(anchor, () => emitEvent(
|
|
1320
|
+
callWithProperties(anchor, () => emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes));
|
|
1308
1321
|
}
|
|
1309
1322
|
} catch (error) {
|
|
1310
1323
|
_chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
|
|
1311
1324
|
}
|
|
1312
1325
|
}
|
|
1326
|
+
var METRIC_NAME_PATTERN = /^[a-z][a-z0-9_.-]{0,63}$/;
|
|
1327
|
+
var METRIC_COMMENT_MAX_LEN = 4096;
|
|
1328
|
+
var METRIC_ATTRIBUTES_MAX = 20;
|
|
1329
|
+
var METRIC_ATTRIBUTE_VALUE_MAX_LEN = 256;
|
|
1330
|
+
function recordMetric(options) {
|
|
1331
|
+
try {
|
|
1332
|
+
recordMetricImpl(options);
|
|
1333
|
+
} catch (error) {
|
|
1334
|
+
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _52 => _52.name]))}) failed; metric dropped.`, error);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function recordMetricImpl(options) {
|
|
1338
|
+
const name = typeof options.name === "string" ? options.name.toLowerCase() : "";
|
|
1339
|
+
if (!METRIC_NAME_PATTERN.test(name)) {
|
|
1340
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1341
|
+
`recordMetric called with an invalid name ${JSON.stringify(options.name)}; metric dropped. Names must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
|
|
1342
|
+
);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (_chunkNEF2O7HFcjs.RESERVED_METRIC_NAMES.has(name)) {
|
|
1346
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1347
|
+
`recordMetric called with the reserved name ${JSON.stringify(name)}; metric dropped. Brizz computes this metric itself \u2014 pick a different name.`
|
|
1348
|
+
);
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
const { value } = options;
|
|
1352
|
+
let numericValue;
|
|
1353
|
+
if (typeof value === "boolean") {
|
|
1354
|
+
numericValue = value ? 1 : 0;
|
|
1355
|
+
} else if (typeof value === "number" && Number.isFinite(value)) {
|
|
1356
|
+
numericValue = value;
|
|
1357
|
+
} else {
|
|
1358
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1359
|
+
`recordMetric(${name}) called with a non-finite or non-numeric value ${JSON.stringify(value)}; metric dropped.`
|
|
1360
|
+
);
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
const eventAttributes = {
|
|
1364
|
+
[_chunkNEF2O7HFcjs.METRIC_NAME]: name,
|
|
1365
|
+
[_chunkNEF2O7HFcjs.METRIC_VALUE]: numericValue
|
|
1366
|
+
};
|
|
1367
|
+
if (options.unit !== void 0) {
|
|
1368
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_UNIT] = options.unit;
|
|
1369
|
+
}
|
|
1370
|
+
if (options.minValue !== void 0) {
|
|
1371
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_MIN] = options.minValue;
|
|
1372
|
+
}
|
|
1373
|
+
if (options.maxValue !== void 0) {
|
|
1374
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_MAX] = options.maxValue;
|
|
1375
|
+
}
|
|
1376
|
+
if (options.comment !== void 0) {
|
|
1377
|
+
let comment = options.comment;
|
|
1378
|
+
if (comment.length > METRIC_COMMENT_MAX_LEN) {
|
|
1379
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1380
|
+
`recordMetric(${name}) comment exceeds ${METRIC_COMMENT_MAX_LEN} characters; truncated.`
|
|
1381
|
+
);
|
|
1382
|
+
comment = comment.slice(0, METRIC_COMMENT_MAX_LEN);
|
|
1383
|
+
}
|
|
1384
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_COMMENT] = comment;
|
|
1385
|
+
}
|
|
1386
|
+
if (options.polarity !== void 0) {
|
|
1387
|
+
const polarity = options.polarity;
|
|
1388
|
+
if (polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_POSITIVE || polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_NEGATIVE) {
|
|
1389
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_POLARITY] = polarity;
|
|
1390
|
+
} else {
|
|
1391
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1392
|
+
`recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${_chunkNEF2O7HFcjs.METRIC_POLARITY_POSITIVE}' or '${_chunkNEF2O7HFcjs.METRIC_POLARITY_NEGATIVE}'. Emitting the metric without it.`
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
if (options.timestamp !== void 0) {
|
|
1397
|
+
if (Number.isFinite(options.timestamp.getTime())) {
|
|
1398
|
+
eventAttributes[_chunkNEF2O7HFcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
|
|
1399
|
+
} else {
|
|
1400
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1401
|
+
`recordMetric(${name}) called with an invalid timestamp; emitting the metric without it.`
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
if (options.attributes) {
|
|
1406
|
+
let accepted = 0;
|
|
1407
|
+
for (const [key, attrValue] of Object.entries(options.attributes)) {
|
|
1408
|
+
if (accepted >= METRIC_ATTRIBUTES_MAX) {
|
|
1409
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1410
|
+
`recordMetric(${name}) called with more than ${METRIC_ATTRIBUTES_MAX} attributes; the excess was dropped.`
|
|
1411
|
+
);
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
const normalizedKey = key.toLowerCase();
|
|
1415
|
+
if (!METRIC_NAME_PATTERN.test(normalizedKey)) {
|
|
1416
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1417
|
+
`recordMetric(${name}) called with an invalid attribute key ${JSON.stringify(key)}; that attribute was dropped. Keys must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
|
|
1418
|
+
);
|
|
1419
|
+
continue;
|
|
1420
|
+
}
|
|
1421
|
+
let text = typeof attrValue === "string" ? attrValue : String(attrValue);
|
|
1422
|
+
if (text.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
|
|
1423
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1424
|
+
`recordMetric(${name}) attribute ${JSON.stringify(normalizedKey)} exceeds ${METRIC_ATTRIBUTE_VALUE_MAX_LEN} characters; truncated.`
|
|
1425
|
+
);
|
|
1426
|
+
text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
|
|
1427
|
+
}
|
|
1428
|
+
eventAttributes[`${_chunkNEF2O7HFcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
|
|
1429
|
+
accepted += 1;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
const sessionId = _nullishCoalesce(options.sessionId, () => ( resolveSessionIdFromContext()));
|
|
1433
|
+
if (sessionId === void 0) {
|
|
1434
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
1435
|
+
`recordMetric(${name}) called with no resolvable session id; the metric cannot be attributed to a conversation and is dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope.`
|
|
1436
|
+
);
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
try {
|
|
1440
|
+
callWithProperties(
|
|
1441
|
+
{ [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId },
|
|
1442
|
+
() => emitEvent(_chunkNEF2O7HFcjs.METRIC_EVENT_NAME, eventAttributes)
|
|
1443
|
+
);
|
|
1444
|
+
} catch (error) {
|
|
1445
|
+
_chunkWC573FCIcjs.logger.warn("recordMetric: failed to emit metric event", error);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1313
1448
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1314
|
-
const isTitle = _optionalChain([options, 'optionalAccess',
|
|
1315
|
-
const spanName = isTitle ?
|
|
1449
|
+
const isTitle = _optionalChain([options, 'optionalAccess', _53 => _53.mode]) === "title";
|
|
1450
|
+
const spanName = isTitle ? _chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME : _chunkNEF2O7HFcjs.SESSION_SPAN_NAME;
|
|
1316
1451
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1317
1452
|
return tracer.startActiveSpan(spanName, (span) => {
|
|
1318
|
-
span.setAttribute(`${
|
|
1453
|
+
span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, sessionId);
|
|
1319
1454
|
if (extraProperties) {
|
|
1320
1455
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
1321
|
-
span.setAttribute(`${
|
|
1456
|
+
span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
1322
1457
|
}
|
|
1323
1458
|
}
|
|
1324
1459
|
const session = new Session(sessionId, span);
|
|
1325
|
-
const contextProperties = { [
|
|
1460
|
+
const contextProperties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId };
|
|
1326
1461
|
if (isTitle) {
|
|
1327
|
-
contextProperties[
|
|
1462
|
+
contextProperties[_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION] = "true";
|
|
1328
1463
|
}
|
|
1329
1464
|
if (extraProperties) {
|
|
1330
1465
|
for (const [key, value] of Object.entries(extraProperties)) {
|
|
@@ -1332,7 +1467,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1332
1467
|
}
|
|
1333
1468
|
}
|
|
1334
1469
|
return callWithProperties(contextProperties, () => {
|
|
1335
|
-
const sessionCtx = _api.context.active().setValue(
|
|
1470
|
+
const sessionCtx = _api.context.active().setValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY, session);
|
|
1336
1471
|
return _api.context.with(sessionCtx, () => {
|
|
1337
1472
|
try {
|
|
1338
1473
|
const result = callback(session);
|
|
@@ -1360,16 +1495,16 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1360
1495
|
});
|
|
1361
1496
|
}
|
|
1362
1497
|
function startSessionTitle(callback, options) {
|
|
1363
|
-
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1498
|
+
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _55 => _55(), 'optionalAccess', _56 => _56.sessionId])));
|
|
1364
1499
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1365
|
-
return tracer.startActiveSpan(
|
|
1500
|
+
return tracer.startActiveSpan(_chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1366
1501
|
if (resolvedSessionId) {
|
|
1367
|
-
span.setAttribute(`${
|
|
1502
|
+
span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, resolvedSessionId);
|
|
1368
1503
|
}
|
|
1369
1504
|
const sessionTitle = new SessionTitle(span);
|
|
1370
|
-
const properties = { [
|
|
1505
|
+
const properties = { [_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION]: "true" };
|
|
1371
1506
|
if (resolvedSessionId) {
|
|
1372
|
-
properties[
|
|
1507
|
+
properties[_chunkNEF2O7HFcjs.SESSION_ID] = resolvedSessionId;
|
|
1373
1508
|
}
|
|
1374
1509
|
return callWithProperties(properties, () => {
|
|
1375
1510
|
try {
|
|
@@ -1514,7 +1649,7 @@ var BrizzSpanExporter = class {
|
|
|
1514
1649
|
const resourceAttrs = {
|
|
1515
1650
|
...config.resourceAttributes,
|
|
1516
1651
|
"service.name": config.appName,
|
|
1517
|
-
[BRIZZ_SDK_VERSION]:
|
|
1652
|
+
[BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
|
|
1518
1653
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1519
1654
|
};
|
|
1520
1655
|
if (config.environment) {
|
|
@@ -1566,7 +1701,7 @@ var BrizzSpanExporter = class {
|
|
|
1566
1701
|
return this._delegate.shutdown();
|
|
1567
1702
|
}
|
|
1568
1703
|
async forceFlush() {
|
|
1569
|
-
return _optionalChain([this, 'access',
|
|
1704
|
+
return _optionalChain([this, 'access', _57 => _57._delegate, 'access', _58 => _58.forceFlush, 'optionalCall', _59 => _59()]);
|
|
1570
1705
|
}
|
|
1571
1706
|
};
|
|
1572
1707
|
|
|
@@ -1577,10 +1712,10 @@ var BrizzSpanExporter = class {
|
|
|
1577
1712
|
|
|
1578
1713
|
var _sdktracebase = require('@opentelemetry/sdk-trace-base');
|
|
1579
1714
|
function applyContextAttributes(span) {
|
|
1580
|
-
const sessionProperties = _api.context.active().getValue(
|
|
1715
|
+
const sessionProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
1581
1716
|
if (sessionProperties) {
|
|
1582
1717
|
for (const [key, value] of Object.entries(sessionProperties)) {
|
|
1583
|
-
span.setAttribute(`${
|
|
1718
|
+
span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
|
|
1584
1719
|
}
|
|
1585
1720
|
}
|
|
1586
1721
|
}
|
|
@@ -1601,7 +1736,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
1601
1736
|
super.onStart(span, parentContext);
|
|
1602
1737
|
}
|
|
1603
1738
|
onEnd(span) {
|
|
1604
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1739
|
+
const maskingConfig = _optionalChain([this, 'access', _60 => _60.config, 'access', _61 => _61.masking, 'optionalAccess', _62 => _62.spanMasking]);
|
|
1605
1740
|
if (maskingConfig) {
|
|
1606
1741
|
maskReadableSpan(span, maskingConfig);
|
|
1607
1742
|
}
|
|
@@ -1619,7 +1754,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
1619
1754
|
super.onStart(span, parentContext);
|
|
1620
1755
|
}
|
|
1621
1756
|
onEnd(span) {
|
|
1622
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1757
|
+
const maskingConfig = _optionalChain([this, 'access', _63 => _63.config, 'access', _64 => _64.masking, 'optionalAccess', _65 => _65.spanMasking]);
|
|
1623
1758
|
if (maskingConfig) {
|
|
1624
1759
|
maskReadableSpan(span, maskingConfig);
|
|
1625
1760
|
}
|
|
@@ -1699,7 +1834,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1699
1834
|
}
|
|
1700
1835
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
1701
1836
|
disableBatch: config.disableBatch,
|
|
1702
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
1837
|
+
hasMasking: !!_optionalChain([config, 'access', _66 => _66.masking, 'optionalAccess', _67 => _67.spanMasking])
|
|
1703
1838
|
});
|
|
1704
1839
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
1705
1840
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -1779,7 +1914,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
|
1779
1914
|
|
|
1780
1915
|
// src/internal/config.ts
|
|
1781
1916
|
function resolveConfig(options) {
|
|
1782
|
-
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access',
|
|
1917
|
+
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _68 => _68.logLevel, 'optionalAccess', _69 => _69.toString, 'call', _70 => _70()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
1783
1918
|
let resolvedLogLevel;
|
|
1784
1919
|
if (envLogLevel) {
|
|
1785
1920
|
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
|
|
@@ -1950,7 +2085,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1950
2085
|
const resourceAttributes = {
|
|
1951
2086
|
...resolvedConfig.resourceAttributes,
|
|
1952
2087
|
"service.name": resolvedConfig.appName,
|
|
1953
|
-
[BRIZZ_SDK_VERSION]:
|
|
2088
|
+
[BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
|
|
1954
2089
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1955
2090
|
};
|
|
1956
2091
|
if (resolvedConfig.environment) {
|
|
@@ -1962,7 +2097,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
1962
2097
|
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));
|
|
1963
2098
|
this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
|
|
1964
2099
|
resource,
|
|
1965
|
-
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0,
|
|
2100
|
+
spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkM3UGFLH7cjs.InterruptPropagator)(), getSpanProcessor()]
|
|
1966
2101
|
});
|
|
1967
2102
|
this._tracerProvider.register();
|
|
1968
2103
|
this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
|
|
@@ -2098,10 +2233,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2098
2233
|
}
|
|
2099
2234
|
try {
|
|
2100
2235
|
await this.shutdownModules();
|
|
2101
|
-
await _optionalChain([this, 'access',
|
|
2102
|
-
await _optionalChain([this, 'access',
|
|
2103
|
-
await _optionalChain([this, 'access',
|
|
2104
|
-
await _optionalChain([this, 'access',
|
|
2236
|
+
await _optionalChain([this, 'access', _71 => _71._tracerProvider, 'optionalAccess', _72 => _72.forceFlush, 'call', _73 => _73()]);
|
|
2237
|
+
await _optionalChain([this, 'access', _74 => _74._tracerProvider, 'optionalAccess', _75 => _75.shutdown, 'call', _76 => _76()]);
|
|
2238
|
+
await _optionalChain([this, 'access', _77 => _77._meterProvider, 'optionalAccess', _78 => _78.forceFlush, 'call', _79 => _79()]);
|
|
2239
|
+
await _optionalChain([this, 'access', _80 => _80._meterProvider, 'optionalAccess', _81 => _81.shutdown, 'call', _82 => _82()]);
|
|
2105
2240
|
this._initialized = false;
|
|
2106
2241
|
this._tracerProvider = null;
|
|
2107
2242
|
this._meterProvider = null;
|
|
@@ -2130,7 +2265,7 @@ function detectRuntime() {
|
|
|
2130
2265
|
const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
|
|
2131
2266
|
const supportsRegister = (
|
|
2132
2267
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2133
|
-
!!_optionalChain([process, 'access',
|
|
2268
|
+
!!_optionalChain([process, 'access', _83 => _83.features, 'optionalAccess', _84 => _84.typescript]) || !!_optionalChain([globalThis, 'access', _85 => _85.module, 'optionalAccess', _86 => _86.register])
|
|
2134
2269
|
);
|
|
2135
2270
|
_chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
|
|
2136
2271
|
nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
|
|
@@ -2199,4 +2334,5 @@ function detectRuntime() {
|
|
|
2199
2334
|
|
|
2200
2335
|
|
|
2201
2336
|
|
|
2202
|
-
|
|
2337
|
+
|
|
2338
|
+
exports.setCurrentSpanCustomProperties = setCurrentSpanCustomProperties; exports.callWithProperties = callWithProperties; exports.withProperties = withProperties; exports.setUser = setUser; exports.setOrganization = setOrganization; exports.setMessageId = setMessageId; exports.callWithUser = callWithUser; exports.withUser = withUser; exports.callWithOrganization = callWithOrganization; exports.withOrganization = withOrganization; exports.callWithMessageId = callWithMessageId; exports.withMessageId = withMessageId; exports.callWithMute = callWithMute; exports.withMute = withMute; exports.withSessionId = withSessionId; exports.callWithSessionId = callWithSessionId; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.getActiveSession = getActiveSession; exports.addExternalLink = addExternalLink; exports.recordFeedback = recordFeedback; exports.recordMetric = recordMetric; exports.startSession = startSession; exports.startSessionTitle = startSessionTitle; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.maskValue = maskValue; exports.maskAttributes = maskAttributes; exports.emitEvent = emitEvent; exports.emitEventWithSessionId = emitEventWithSessionId; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.Brizz = Brizz; exports.detectRuntime = detectRuntime;
|