o11y 260.3.0 → 260.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/o11y/client/client.js +80 -6
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/client/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/client/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/client/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/client/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/client/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/client/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/client/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/client/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/client/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/client/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/collectors/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/collectors/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/collectors/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/collectors/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/collectors/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/collectors/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/collectors/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/collectors/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/collectors/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/collectors/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/collectors/version.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
- package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
- package/dist/modules/o11y/core_envelope/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/core_envelope/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/core_envelope/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/shared/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/shared/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/shared/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/shared/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/shared/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/shared/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/shared/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/shared/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/shared/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/shared/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/shared/shared.js +15 -0
- package/dist/modules/o11y/shared/shared.js.map +1 -1
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/simple_collector/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/simple_collector/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/Activity.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/interfaces/ActivityDetail.d.ts +4 -0
- package/dist/modules/o11y/web_vitals/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/interfaces/Instrumentation.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/interfaces-private/ActivityData.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/library/ActivityImpl.d.ts +7 -1
- package/dist/modules/o11y/web_vitals/library/ActivityNoOp.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/library/InstrumentationImpl.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/library/RootActivityNoOp.d.ts +4 -1
- package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +2 -1
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/web_vitals.js +79 -5
- package/dist/modules/o11y/web_vitals/web_vitals.js.map +1 -1
- package/package.json +2 -2
|
@@ -511,10 +511,18 @@ const headerSpanId = 'X-B3-SpanId';
|
|
|
511
511
|
const headerSampled = 'X-B3-Sampled';
|
|
512
512
|
const headerParentSpanId = 'X-B3-ParentSpanId';
|
|
513
513
|
const headerRequestId = 'X-SFDC-Request-Id';
|
|
514
|
+
const headerBaggage = 'baggage';
|
|
514
515
|
const defaultActivityNameForFetch = 'fetch';
|
|
515
516
|
const defaultActivityNameForXhrSend = 'xhr_send';
|
|
516
517
|
const defaultTimingActivityName = 'perf-timing';
|
|
517
518
|
const defaultFuzzyMapRange = 50;
|
|
519
|
+
const userSettableHeaders = [
|
|
520
|
+
headerBaggage,
|
|
521
|
+
headerTraceId,
|
|
522
|
+
headerSpanId,
|
|
523
|
+
headerParentSpanId,
|
|
524
|
+
headerSampled
|
|
525
|
+
];
|
|
518
526
|
const o11yInfoForXHR = new WeakMap();
|
|
519
527
|
class Tracing {
|
|
520
528
|
constructor(_instr, _idleDetector) {
|
|
@@ -553,6 +561,18 @@ class Tracing {
|
|
|
553
561
|
}
|
|
554
562
|
return text;
|
|
555
563
|
}
|
|
564
|
+
static setHeaders(headers) {
|
|
565
|
+
if (headers === undefined) {
|
|
566
|
+
Tracing._userHeaders = {};
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
Object.entries(headers).forEach(([key]) => {
|
|
570
|
+
if (!userSettableHeaders.includes(key)) {
|
|
571
|
+
delete headers[key];
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
Tracing._userHeaders = headers;
|
|
575
|
+
}
|
|
556
576
|
static getHeaders(traceId, spanId, isSampled, options) {
|
|
557
577
|
utility.requireArgument(spanId, 'spanId', 'string');
|
|
558
578
|
const useB3Headers = options === null || options === void 0 ? void 0 : options.useB3Headers;
|
|
@@ -668,6 +688,13 @@ class Tracing {
|
|
|
668
688
|
traceHeaders = undefined;
|
|
669
689
|
}
|
|
670
690
|
}
|
|
691
|
+
if (Tracing._userHeaders && Object.keys(Tracing._userHeaders).length > 0) {
|
|
692
|
+
traceHeaders = { ...traceHeaders };
|
|
693
|
+
Object.entries(Tracing._userHeaders).forEach(([key, value]) => {
|
|
694
|
+
traceHeaders[key] = value;
|
|
695
|
+
});
|
|
696
|
+
Tracing._userHeaders = undefined;
|
|
697
|
+
}
|
|
671
698
|
return traceHeaders || {};
|
|
672
699
|
}
|
|
673
700
|
static _extractHeader(headerName, input, init) {
|
|
@@ -995,13 +1022,16 @@ const stopReason = {
|
|
|
995
1022
|
discarded
|
|
996
1023
|
};
|
|
997
1024
|
class ActivityImpl {
|
|
998
|
-
constructor(_name, _rootId, _onStopped, _onError, timeout, id, _isSampled, _startPerfTime, _noRerooting) {
|
|
1025
|
+
constructor(_name, _rootId, _onStopped, _onError, timeout, id, _isSampled, _startPerfTime, _noRerooting, _isExternal, _parentActivity) {
|
|
1026
|
+
var _a, _b;
|
|
999
1027
|
this._name = _name;
|
|
1000
1028
|
this._rootId = _rootId;
|
|
1001
1029
|
this._onStopped = _onStopped;
|
|
1002
1030
|
this._onError = _onError;
|
|
1003
1031
|
this._isSampled = _isSampled;
|
|
1004
1032
|
this._noRerooting = _noRerooting;
|
|
1033
|
+
this._isExternal = _isExternal;
|
|
1034
|
+
this._parentActivity = _parentActivity;
|
|
1005
1035
|
this._isRoot = false;
|
|
1006
1036
|
this._errorCount = 0;
|
|
1007
1037
|
this._timerOverridden = TimerOverride.none;
|
|
@@ -1018,7 +1048,7 @@ class ActivityImpl {
|
|
|
1018
1048
|
try {
|
|
1019
1049
|
performance.mark(this._perfId);
|
|
1020
1050
|
}
|
|
1021
|
-
catch (
|
|
1051
|
+
catch (_c) {
|
|
1022
1052
|
this._usePerf = false;
|
|
1023
1053
|
}
|
|
1024
1054
|
}
|
|
@@ -1032,6 +1062,9 @@ class ActivityImpl {
|
|
|
1032
1062
|
}, timeout);
|
|
1033
1063
|
}
|
|
1034
1064
|
this._safety = new PublicSafety();
|
|
1065
|
+
this._externalParentActivity = ((_a = this._parentActivity) === null || _a === void 0 ? void 0 : _a.isExternal())
|
|
1066
|
+
? this._parentActivity
|
|
1067
|
+
: (_b = this._parentActivity) === null || _b === void 0 ? void 0 : _b.getExternalParentActivity();
|
|
1035
1068
|
}
|
|
1036
1069
|
get id() {
|
|
1037
1070
|
return this._id;
|
|
@@ -1045,6 +1078,16 @@ class ActivityImpl {
|
|
|
1045
1078
|
get stopReason() {
|
|
1046
1079
|
return this._stopReason;
|
|
1047
1080
|
}
|
|
1081
|
+
getParentActivity() {
|
|
1082
|
+
return this._parentActivity;
|
|
1083
|
+
}
|
|
1084
|
+
isExternal() {
|
|
1085
|
+
var _a;
|
|
1086
|
+
return (_a = this._isExternal) !== null && _a !== void 0 ? _a : false;
|
|
1087
|
+
}
|
|
1088
|
+
getExternalParentActivity() {
|
|
1089
|
+
return this._externalParentActivity;
|
|
1090
|
+
}
|
|
1048
1091
|
error(error, userSchemaOrText, userData) {
|
|
1049
1092
|
this._safety.tryCatch(() => {
|
|
1050
1093
|
this._errorCount += 1;
|
|
@@ -1165,7 +1208,10 @@ class ActivityImpl {
|
|
|
1165
1208
|
errorCount: this._errorCount,
|
|
1166
1209
|
isSampled: this.getIsSampled(),
|
|
1167
1210
|
timerOverridden: this._timerOverridden,
|
|
1168
|
-
noRerooting: this._noRerooting
|
|
1211
|
+
noRerooting: this._noRerooting,
|
|
1212
|
+
isExternal: this._isExternal,
|
|
1213
|
+
parentActivity: this._parentActivity,
|
|
1214
|
+
externalParentActivity: this._externalParentActivity
|
|
1169
1215
|
};
|
|
1170
1216
|
}
|
|
1171
1217
|
getTraceHeaders(options) {
|
|
@@ -1218,6 +1264,15 @@ class ActivityNoOp {
|
|
|
1218
1264
|
getErrorCount() {
|
|
1219
1265
|
return 0;
|
|
1220
1266
|
}
|
|
1267
|
+
getParentActivity() {
|
|
1268
|
+
return undefined;
|
|
1269
|
+
}
|
|
1270
|
+
isExternal() {
|
|
1271
|
+
return false;
|
|
1272
|
+
}
|
|
1273
|
+
getExternalParentActivity() {
|
|
1274
|
+
return undefined;
|
|
1275
|
+
}
|
|
1221
1276
|
}
|
|
1222
1277
|
const activityNoOp = Object.freeze(new ActivityNoOp());
|
|
1223
1278
|
|
|
@@ -1648,6 +1703,7 @@ class InstrumentationImpl {
|
|
|
1648
1703
|
var _a;
|
|
1649
1704
|
utility.requireArgument(name, 'name');
|
|
1650
1705
|
utility.requireArgumentIfDefined(options, 'options', 'object');
|
|
1706
|
+
const parentActivity = utility.validateParentActivityType(options === null || options === void 0 ? void 0 : options.isExternal, options === null || options === void 0 ? void 0 : options.parentActivity);
|
|
1651
1707
|
let context;
|
|
1652
1708
|
let noRerooting = (options === null || options === void 0 ? void 0 : options.perfStartOverride) !== undefined;
|
|
1653
1709
|
const rootId = (_a = options === null || options === void 0 ? void 0 : options.instrumentationContext) === null || _a === void 0 ? void 0 : _a.rootId;
|
|
@@ -1661,11 +1717,12 @@ class InstrumentationImpl {
|
|
|
1661
1717
|
else {
|
|
1662
1718
|
context = this._nextGen.getDefaultInstrumentationContext();
|
|
1663
1719
|
}
|
|
1664
|
-
const activity = new ActivityImpl(name, context.rootId, this._onActivityStoppedCallback, this._onActivityErrorCallback, maxActivityDurationMsecs, options === null || options === void 0 ? void 0 : options.id, context.isRootActivitySampled, options === null || options === void 0 ? void 0 : options.perfStartOverride, noRerooting);
|
|
1720
|
+
const activity = new ActivityImpl(name, context.rootId, this._onActivityStoppedCallback, this._onActivityErrorCallback, maxActivityDurationMsecs, options === null || options === void 0 ? void 0 : options.id, context.isRootActivitySampled, options === null || options === void 0 ? void 0 : options.perfStartOverride, noRerooting, options === null || options === void 0 ? void 0 : options.isExternal, parentActivity);
|
|
1665
1721
|
return activity;
|
|
1666
1722
|
}, activityNoOp, { op: 'startActivity' });
|
|
1667
1723
|
}
|
|
1668
1724
|
_getActivityData(detail) {
|
|
1725
|
+
var _a, _b;
|
|
1669
1726
|
const userPayload = this._wrapUserPayload(detail.userSchemaOrText, detail.userData, true);
|
|
1670
1727
|
return {
|
|
1671
1728
|
id: detail.id,
|
|
@@ -1676,7 +1733,10 @@ class InstrumentationImpl {
|
|
|
1676
1733
|
errorCount: detail.errorCount,
|
|
1677
1734
|
isSampled: detail.isSampled,
|
|
1678
1735
|
timerOverridden: detail.timerOverridden,
|
|
1679
|
-
isRerooted: detail.isRerooted
|
|
1736
|
+
isRerooted: detail.isRerooted,
|
|
1737
|
+
isExternal: detail.isExternal,
|
|
1738
|
+
parentId: (_a = detail.parentActivity) === null || _a === void 0 ? void 0 : _a.getId(),
|
|
1739
|
+
externalParentId: (_b = detail.externalParentActivity) === null || _b === void 0 ? void 0 : _b.getId()
|
|
1680
1740
|
};
|
|
1681
1741
|
}
|
|
1682
1742
|
_handleActivityStop(detail) {
|
|
@@ -1851,6 +1911,10 @@ class InstrumentationImpl {
|
|
|
1851
1911
|
act.stop((_c = options === null || options === void 0 ? void 0 : options.stopPayload) === null || _c === void 0 ? void 0 : _c.schema, (_d = options === null || options === void 0 ? void 0 : options.stopPayload) === null || _d === void 0 ? void 0 : _d.payload, options === null || options === void 0 ? void 0 : options.stopOptions);
|
|
1852
1912
|
}
|
|
1853
1913
|
}
|
|
1914
|
+
invokeNetworkCallWithHeaders(apiCall, params, headers) {
|
|
1915
|
+
Tracing.setHeaders(headers);
|
|
1916
|
+
return apiCall(...params);
|
|
1917
|
+
}
|
|
1854
1918
|
}
|
|
1855
1919
|
InstrumentationImpl.defaultAppName = 'APP_NOT_REGISTERED';
|
|
1856
1920
|
|
|
@@ -1954,6 +2018,15 @@ class RootActivityNoOp {
|
|
|
1954
2018
|
getErrorCount() {
|
|
1955
2019
|
return 0;
|
|
1956
2020
|
}
|
|
2021
|
+
getParentActivity() {
|
|
2022
|
+
return undefined;
|
|
2023
|
+
}
|
|
2024
|
+
isExternal() {
|
|
2025
|
+
return false;
|
|
2026
|
+
}
|
|
2027
|
+
getExternalParentActivity() {
|
|
2028
|
+
return undefined;
|
|
2029
|
+
}
|
|
1957
2030
|
}
|
|
1958
2031
|
const rootActivityNoOp = Object.freeze(new RootActivityNoOp());
|
|
1959
2032
|
|
|
@@ -2355,6 +2428,7 @@ class NextgenImpl {
|
|
|
2355
2428
|
registerForLogPrompt: this._appInstr.registerForLogPrompt.bind(this._appInstr),
|
|
2356
2429
|
activity: this._appInstr.activity.bind(this._appInstr),
|
|
2357
2430
|
activityAsync: this._appInstr.activityAsync.bind(this._appInstr),
|
|
2431
|
+
invokeNetworkCallWithHeaders: this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),
|
|
2358
2432
|
startRootActivity: this._appInstr.startRootActivity.bind(this._appInstr),
|
|
2359
2433
|
registerLogCollector: this._isSender ? noOpFunc : this.registerLogCollector.bind(this),
|
|
2360
2434
|
registerMetricsCollector: this._isSender
|
|
@@ -2709,7 +2783,7 @@ class ConsoleCollector {
|
|
|
2709
2783
|
}
|
|
2710
2784
|
}
|
|
2711
2785
|
|
|
2712
|
-
const version = '260.
|
|
2786
|
+
const version = '260.5.0';
|
|
2713
2787
|
|
|
2714
2788
|
const idleDetector = new IdleDetectorImpl({
|
|
2715
2789
|
logThreshold: 300,
|