o11y 250.4.0 → 250.6.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 +120 -21
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/client/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/client/interfaces/ActivityStartApiOptions.d.ts +4 -0
- package/dist/modules/o11y/client/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/client/interfaces/Instrumentation.d.ts +2 -1
- package/dist/modules/o11y/client/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/client/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/client/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/client/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/client/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/client/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/client/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/client/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/client/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/client/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/client/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/client/types/RootActivityHistoryEntry.d.ts +7 -0
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/interfaces/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/collectors/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/collectors/interfaces/ActivityStartApiOptions.d.ts +4 -0
- package/dist/modules/o11y/collectors/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/collectors/interfaces/Instrumentation.d.ts +2 -1
- package/dist/modules/o11y/collectors/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/collectors/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/collectors/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/collectors/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/collectors/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/collectors/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/collectors/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/collectors/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/collectors/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/collectors/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/collectors/types/RootActivityHistoryEntry.d.ts +7 -0
- 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/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/core_envelope/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/interfaces/ActivityStartApiOptions.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 +2 -1
- package/dist/modules/o11y/core_envelope/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/core_envelope/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/core_envelope/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/core_envelope/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/core_envelope/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/core_envelope/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/core_envelope/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/types/RootActivityHistoryEntry.d.ts +7 -0
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/shared/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/shared/interfaces/ActivityStartApiOptions.d.ts +4 -0
- package/dist/modules/o11y/shared/interfaces/ActivityStartOptions.d.ts +3 -0
- package/dist/modules/o11y/shared/interfaces/Instrumentation.d.ts +2 -1
- package/dist/modules/o11y/shared/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/shared/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/shared/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/shared/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/shared/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/shared/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/shared/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/shared/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/shared/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/shared/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/shared/shared.js +6 -0
- package/dist/modules/o11y/shared/shared.js.map +1 -1
- package/dist/modules/o11y/shared/types/RootActivityHistoryEntry.d.ts +7 -0
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/simple_collector/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/interfaces/ActivityStartApiOptions.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 +2 -1
- package/dist/modules/o11y/simple_collector/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/simple_collector/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/simple_collector/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/simple_collector/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/simple_collector/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/simple_collector/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/types/RootActivityHistoryEntry.d.ts +7 -0
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/ActivityApiOptions.d.ts +4 -0
- package/dist/modules/o11y/web_vitals/interfaces/ActivityDetail.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/interfaces/ActivityStartApiOptions.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 +2 -1
- package/dist/modules/o11y/web_vitals/interfaces/InstrumentedAppMethods.d.ts +2 -1
- package/dist/modules/o11y/web_vitals/interfaces/index.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/interfaces-private/ActivityData.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/library/ActivityImpl.d.ts +2 -1
- package/dist/modules/o11y/web_vitals/library/AppInstrumentationImpl.d.ts +5 -2
- package/dist/modules/o11y/web_vitals/library/InstrumentationImpl.d.ts +3 -1
- package/dist/modules/o11y/web_vitals/library/NextgenImpl.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/library/RootActivityHistoryImpl.d.ts +12 -0
- package/dist/modules/o11y/web_vitals/library/RootActivityImpl.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/types/RootActivityHistoryEntry.d.ts +7 -0
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -357,8 +357,8 @@ class PerformanceObservability {
|
|
|
357
357
|
this._fuzzyMapper.clear();
|
|
358
358
|
this._isStarted = false;
|
|
359
359
|
}
|
|
360
|
-
addEntry(
|
|
361
|
-
this._fuzzyMapper.add(
|
|
360
|
+
addEntry(absoluteUrl, perfTime, data) {
|
|
361
|
+
this._fuzzyMapper.add(absoluteUrl, perfTime, data);
|
|
362
362
|
}
|
|
363
363
|
_resourceEntryToResourceTiming(prt) {
|
|
364
364
|
var _a, _b;
|
|
@@ -637,6 +637,7 @@ class Tracing {
|
|
|
637
637
|
var _a;
|
|
638
638
|
let activity;
|
|
639
639
|
let url;
|
|
640
|
+
let absoluteUrl;
|
|
640
641
|
let method;
|
|
641
642
|
let fetchTime;
|
|
642
643
|
try {
|
|
@@ -663,14 +664,16 @@ class Tracing {
|
|
|
663
664
|
}
|
|
664
665
|
options === null || options === void 0 ? true : delete options.o11y;
|
|
665
666
|
url = resource === null || resource === void 0 ? void 0 : resource.toString();
|
|
667
|
+
absoluteUrl = utility.tryGetAbsoluteUrl(url);
|
|
666
668
|
if (useTracing) {
|
|
667
669
|
if (resource instanceof Request) {
|
|
668
670
|
if (!method) {
|
|
669
671
|
method = resource.method;
|
|
670
672
|
}
|
|
671
673
|
url = resource.url;
|
|
674
|
+
absoluteUrl = utility.tryGetAbsoluteUrl(url);
|
|
672
675
|
}
|
|
673
|
-
const traceHeaders = Tracing._getTraceHeaders(activity, tracingHeadersOptions, method,
|
|
676
|
+
const traceHeaders = Tracing._getTraceHeaders(activity, tracingHeadersOptions, method, absoluteUrl);
|
|
674
677
|
if (!this._applyTraceHeaders(resource, options, traceHeaders) &&
|
|
675
678
|
options === undefined) {
|
|
676
679
|
options = {
|
|
@@ -697,7 +700,7 @@ class Tracing {
|
|
|
697
700
|
const activityDuration = Tracing._endActivity(activity, url, method);
|
|
698
701
|
if ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) {
|
|
699
702
|
const requestId = Tracing._extractHeader(headerRequestId, resource, options);
|
|
700
|
-
Tracing._performanceObservability.addEntry(
|
|
703
|
+
Tracing._performanceObservability.addEntry(absoluteUrl, fetchTime, {
|
|
701
704
|
requestId,
|
|
702
705
|
activityDuration
|
|
703
706
|
});
|
|
@@ -736,7 +739,7 @@ class Tracing {
|
|
|
736
739
|
if (xhr._o11y) {
|
|
737
740
|
const activityDuration = Tracing._endActivity(xhr._o11y.activity, xhr._o11y.url, xhr._o11y.method);
|
|
738
741
|
if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
|
|
739
|
-
Tracing._performanceObservability.addEntry(xhr._o11y.
|
|
742
|
+
Tracing._performanceObservability.addEntry(xhr._o11y.absoluteUrl, xhr._o11y.sendTime, {
|
|
740
743
|
requestId: xhr._o11y.requestId,
|
|
741
744
|
activityDuration
|
|
742
745
|
});
|
|
@@ -748,6 +751,7 @@ class Tracing {
|
|
|
748
751
|
method,
|
|
749
752
|
url: url === null || url === void 0 ? void 0 : url.toString()
|
|
750
753
|
};
|
|
754
|
+
this._o11y.absoluteUrl = utility.tryGetAbsoluteUrl(this._o11y.url);
|
|
751
755
|
Tracing._originalXhrOpen.call(this, method, url, async, username, password);
|
|
752
756
|
};
|
|
753
757
|
Tracing._originalXhr.prototype.setRequestHeader = function (name, value) {
|
|
@@ -765,7 +769,7 @@ class Tracing {
|
|
|
765
769
|
xhr._o11y = xhr._o11y || {};
|
|
766
770
|
xhr._o11y.activity = activity = instr.startActivity(activityName || defaultActivityNameForXhrSend);
|
|
767
771
|
if (useTracing) {
|
|
768
|
-
const traceHeaders = Tracing._getTraceHeaders(activity, options, xhr._o11y.method, xhr._o11y.
|
|
772
|
+
const traceHeaders = Tracing._getTraceHeaders(activity, options, xhr._o11y.method, xhr._o11y.absoluteUrl);
|
|
769
773
|
Object.entries(traceHeaders).forEach((entry) => {
|
|
770
774
|
xhr.setRequestHeader(entry[0], entry[1]);
|
|
771
775
|
});
|
|
@@ -892,12 +896,13 @@ const stopReason = {
|
|
|
892
896
|
discarded
|
|
893
897
|
};
|
|
894
898
|
class ActivityImpl {
|
|
895
|
-
constructor(_name, _rootId, _onStopped, _onError, timeout, id, _isSampled) {
|
|
899
|
+
constructor(_name, _rootId, _onStopped, _onError, timeout, id, _isSampled, _startPerfTime, _noRerooting) {
|
|
896
900
|
this._name = _name;
|
|
897
901
|
this._rootId = _rootId;
|
|
898
902
|
this._onStopped = _onStopped;
|
|
899
903
|
this._onError = _onError;
|
|
900
904
|
this._isSampled = _isSampled;
|
|
905
|
+
this._noRerooting = _noRerooting;
|
|
901
906
|
this._errorCount = 0;
|
|
902
907
|
this._timerOverridden = TimerOverride.none;
|
|
903
908
|
const { tsNow, perfNow } = utility.time();
|
|
@@ -919,6 +924,7 @@ class ActivityImpl {
|
|
|
919
924
|
}
|
|
920
925
|
this._startTimestamp = tsNow;
|
|
921
926
|
this._startPerfTime = perfNow;
|
|
927
|
+
this._overrideTimer(_startPerfTime);
|
|
922
928
|
if (timeout > 0) {
|
|
923
929
|
this._timer = setTimeout(() => {
|
|
924
930
|
this._stopReason = this._stopReason || stopReason.timedout;
|
|
@@ -965,8 +971,9 @@ class ActivityImpl {
|
|
|
965
971
|
}
|
|
966
972
|
if (isStopTimeDefined &&
|
|
967
973
|
(perfStop < 0 ||
|
|
968
|
-
perfStop < (isStartTimeDefined ? perfStart : this._startPerfTime)
|
|
969
|
-
|
|
974
|
+
perfStop < (isStartTimeDefined ? perfStart : this._startPerfTime) ||
|
|
975
|
+
perfStop > utility.time().perfNow + 100)) {
|
|
976
|
+
throw new Error('perfStopOverride, if defined, must be >= 0 and >= startTime and <= now');
|
|
970
977
|
}
|
|
971
978
|
}
|
|
972
979
|
this._stopInternal(userSchemaOrText, userData, options);
|
|
@@ -1053,7 +1060,8 @@ class ActivityImpl {
|
|
|
1053
1060
|
stopPerfTime: this._stopPerfTime,
|
|
1054
1061
|
errorCount: this._errorCount,
|
|
1055
1062
|
isSampled: this.getIsSampled(),
|
|
1056
|
-
timerOverridden: this._timerOverridden
|
|
1063
|
+
timerOverridden: this._timerOverridden,
|
|
1064
|
+
noRerooting: this._noRerooting
|
|
1057
1065
|
};
|
|
1058
1066
|
}
|
|
1059
1067
|
getTraceHeaders(options) {
|
|
@@ -1584,8 +1592,10 @@ class InstrumentationImpl {
|
|
|
1584
1592
|
utility.requireArgument(name, 'name');
|
|
1585
1593
|
utility.requireArgumentIfDefined(options, 'options', 'object');
|
|
1586
1594
|
let context;
|
|
1595
|
+
let noRerooting = (options === null || options === void 0 ? void 0 : options.perfStartOverride) !== undefined;
|
|
1587
1596
|
const rootId = (_a = options === null || options === void 0 ? void 0 : options.instrumentationContext) === null || _a === void 0 ? void 0 : _a.rootId;
|
|
1588
1597
|
if (rootId) {
|
|
1598
|
+
noRerooting = true;
|
|
1589
1599
|
context = {
|
|
1590
1600
|
rootId,
|
|
1591
1601
|
isRootActivitySampled: options.instrumentationContext.isRootActivitySampled
|
|
@@ -1594,7 +1604,7 @@ class InstrumentationImpl {
|
|
|
1594
1604
|
else {
|
|
1595
1605
|
context = this._nextGen.getDefaultInstrumentationContext();
|
|
1596
1606
|
}
|
|
1597
|
-
const activity = new ActivityImpl(name, context.rootId, this._onActivityStoppedCallback, this._onActivityErrorCallback, maxActivityDurationMsecs, undefined, context.isRootActivitySampled);
|
|
1607
|
+
const activity = new ActivityImpl(name, context.rootId, this._onActivityStoppedCallback, this._onActivityErrorCallback, maxActivityDurationMsecs, undefined, context.isRootActivitySampled, options === null || options === void 0 ? void 0 : options.perfStartOverride, noRerooting);
|
|
1598
1608
|
return activity;
|
|
1599
1609
|
}, activityNoOp);
|
|
1600
1610
|
}
|
|
@@ -1608,13 +1618,22 @@ class InstrumentationImpl {
|
|
|
1608
1618
|
userPayload,
|
|
1609
1619
|
errorCount: detail.errorCount,
|
|
1610
1620
|
isSampled: detail.isSampled,
|
|
1611
|
-
timerOverridden: detail.timerOverridden
|
|
1621
|
+
timerOverridden: detail.timerOverridden,
|
|
1622
|
+
isRerooted: detail.isRerooted
|
|
1612
1623
|
};
|
|
1613
1624
|
}
|
|
1614
1625
|
_handleActivityStop(detail) {
|
|
1615
1626
|
if (detail.stopReason === discarded) {
|
|
1616
1627
|
return;
|
|
1617
1628
|
}
|
|
1629
|
+
if (!detail.isRoot && !detail.noRerooting) {
|
|
1630
|
+
const rahe = this._nextGen.getRootActivityHistoryEntryByTime(detail.startPerfTime);
|
|
1631
|
+
if ((!rahe && detail.rootId !== undefined) || (rahe && detail.rootId !== rahe.id)) {
|
|
1632
|
+
detail.rootId = rahe === null || rahe === void 0 ? void 0 : rahe.id;
|
|
1633
|
+
detail.isSampled = (rahe === null || rahe === void 0 ? void 0 : rahe.isSampled) || false;
|
|
1634
|
+
detail.isRerooted = true;
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1618
1637
|
const activityData = this._getActivityData(detail);
|
|
1619
1638
|
this._logActivity(activityData, detail.startTimestamp, detail.rootId);
|
|
1620
1639
|
}
|
|
@@ -1738,9 +1757,17 @@ class InstrumentationImpl {
|
|
|
1738
1757
|
utility.requireArgument(listener, 'listener', 'function');
|
|
1739
1758
|
this._nextGen.registerForLogPrompt(listener);
|
|
1740
1759
|
}
|
|
1760
|
+
_getAsaOptions(options) {
|
|
1761
|
+
return options
|
|
1762
|
+
? Object.assign({
|
|
1763
|
+
instrumentationContext: options === null || options === void 0 ? void 0 : options.instrumentationContext
|
|
1764
|
+
}, options.startOptions)
|
|
1765
|
+
: undefined;
|
|
1766
|
+
}
|
|
1741
1767
|
activity(name, execute, options) {
|
|
1742
1768
|
var _a, _b, _c, _d;
|
|
1743
|
-
const
|
|
1769
|
+
const asaOptions = this._getAsaOptions(options);
|
|
1770
|
+
const act = this.startActivity(name, asaOptions);
|
|
1744
1771
|
try {
|
|
1745
1772
|
return execute(act);
|
|
1746
1773
|
}
|
|
@@ -1749,12 +1776,13 @@ class InstrumentationImpl {
|
|
|
1749
1776
|
throw err;
|
|
1750
1777
|
}
|
|
1751
1778
|
finally {
|
|
1752
|
-
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);
|
|
1779
|
+
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);
|
|
1753
1780
|
}
|
|
1754
1781
|
}
|
|
1755
1782
|
async activityAsync(name, execute, options) {
|
|
1756
1783
|
var _a, _b, _c, _d;
|
|
1757
|
-
const
|
|
1784
|
+
const asaOptions = this._getAsaOptions(options);
|
|
1785
|
+
const act = this.startActivity(name, asaOptions);
|
|
1758
1786
|
try {
|
|
1759
1787
|
return await execute(act);
|
|
1760
1788
|
}
|
|
@@ -1763,15 +1791,66 @@ class InstrumentationImpl {
|
|
|
1763
1791
|
throw err;
|
|
1764
1792
|
}
|
|
1765
1793
|
finally {
|
|
1766
|
-
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);
|
|
1794
|
+
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);
|
|
1767
1795
|
}
|
|
1768
1796
|
}
|
|
1769
1797
|
}
|
|
1770
1798
|
InstrumentationImpl.defaultAppName = 'APP_NOT_REGISTERED';
|
|
1771
1799
|
|
|
1800
|
+
const GRACE = 0.1;
|
|
1801
|
+
const DEFAULT_LIMIT = 20;
|
|
1802
|
+
class RootActivityHistoryImpl {
|
|
1803
|
+
constructor(limit) {
|
|
1804
|
+
this._historyMap = new Map();
|
|
1805
|
+
this._historyList = new Array();
|
|
1806
|
+
if (utility.requireArgumentIfDefined(limit, 'limit', 'number')) {
|
|
1807
|
+
limit = Math.ceil(limit);
|
|
1808
|
+
if (limit <= 0) {
|
|
1809
|
+
throw new Error('Limit must be a positive number');
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
else {
|
|
1813
|
+
limit = DEFAULT_LIMIT;
|
|
1814
|
+
}
|
|
1815
|
+
this._graceCount = Math.max(1, Math.floor(limit * GRACE));
|
|
1816
|
+
this._realLimit = 1 + limit + this._graceCount;
|
|
1817
|
+
}
|
|
1818
|
+
add(entry) {
|
|
1819
|
+
if (this._historyMap.has(entry.id)) {
|
|
1820
|
+
throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${entry.id}`);
|
|
1821
|
+
}
|
|
1822
|
+
this._historyMap.set(entry.id, entry);
|
|
1823
|
+
this._historyList.push(entry);
|
|
1824
|
+
if (this._historyList.length === this._realLimit) {
|
|
1825
|
+
const removed = this._historyList.splice(1, this._graceCount);
|
|
1826
|
+
removed.forEach((e) => this._historyMap.delete(e.id));
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
get count() {
|
|
1830
|
+
return this._historyList.length;
|
|
1831
|
+
}
|
|
1832
|
+
findById(rootId) {
|
|
1833
|
+
return this._historyMap.get(rootId);
|
|
1834
|
+
}
|
|
1835
|
+
findByTime(atTime) {
|
|
1836
|
+
let closest;
|
|
1837
|
+
let closestDiff = Number.MAX_VALUE;
|
|
1838
|
+
for (const entry of this._historyList) {
|
|
1839
|
+
const startDelta = atTime - entry.startPerfTime;
|
|
1840
|
+
const isDuringRoot = startDelta >= 0 &&
|
|
1841
|
+
(entry.stopPerfTime === undefined || atTime < entry.stopPerfTime);
|
|
1842
|
+
if (isDuringRoot && startDelta < closestDiff) {
|
|
1843
|
+
closest = entry;
|
|
1844
|
+
closestDiff = startDelta;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
return closest;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1772
1851
|
class RootActivityImpl extends ActivityImpl {
|
|
1773
|
-
constructor(name, onStopped, onError, rootId,
|
|
1774
|
-
super(name, undefined, onStopped, onError, undefined, rootId || utility.generateUniqueId(32),
|
|
1852
|
+
constructor(name, onStopped, onError, rootId, isSampled, startPerfTime) {
|
|
1853
|
+
super(name, undefined, onStopped, onError, undefined, rootId || utility.generateUniqueId(32), isSampled, startPerfTime);
|
|
1775
1854
|
}
|
|
1776
1855
|
get preRootId() {
|
|
1777
1856
|
return this._preRootId;
|
|
@@ -1824,13 +1903,21 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1824
1903
|
constructor(_nextGen, _name, _allowMulti) {
|
|
1825
1904
|
super(_nextGen, _name);
|
|
1826
1905
|
this._allowMulti = _allowMulti;
|
|
1906
|
+
this._rootActivityHistory = new RootActivityHistoryImpl();
|
|
1827
1907
|
this._onRootActivityStoppedCallback = this._handleRootActivityStop.bind(this);
|
|
1828
1908
|
}
|
|
1829
|
-
startRootActivity(name, rootId, isSampled) {
|
|
1909
|
+
startRootActivity(name, rootId, isSampled, options) {
|
|
1830
1910
|
return this._safety.tryCatchReturn(() => {
|
|
1831
1911
|
utility.requireArgument(name, 'name');
|
|
1832
|
-
const newRootActivity = new RootActivityImpl(name, this._onRootActivityStoppedCallback, this._onActivityErrorCallback, rootId, isSampled);
|
|
1912
|
+
const newRootActivity = new RootActivityImpl(name, this._onRootActivityStoppedCallback, this._onActivityErrorCallback, rootId, isSampled, options === null || options === void 0 ? void 0 : options.perfStartOverride);
|
|
1833
1913
|
if (!this._allowMulti) {
|
|
1914
|
+
const entry = {
|
|
1915
|
+
id: newRootActivity.getId(),
|
|
1916
|
+
name,
|
|
1917
|
+
startPerfTime: newRootActivity.getStartPerfTime(),
|
|
1918
|
+
isSampled: newRootActivity.getIsSampled()
|
|
1919
|
+
};
|
|
1920
|
+
this._rootActivityHistory.add(entry);
|
|
1834
1921
|
if (this._singleRootActivity && !this._singleRootActivity.isStopped) {
|
|
1835
1922
|
const preRootId = this._singleRootActivity.getId();
|
|
1836
1923
|
this._singleRootActivity.terminate();
|
|
@@ -1842,6 +1929,11 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1842
1929
|
}, rootActivityNoOp);
|
|
1843
1930
|
}
|
|
1844
1931
|
_handleRootActivityStop(detail) {
|
|
1932
|
+
const historyEntry = this._rootActivityHistory.findById(detail.id);
|
|
1933
|
+
if (historyEntry) {
|
|
1934
|
+
historyEntry.stopPerfTime = detail.stopPerfTime;
|
|
1935
|
+
historyEntry.startPerfTime = detail.startPerfTime;
|
|
1936
|
+
}
|
|
1845
1937
|
if (detail.stopReason === discarded) {
|
|
1846
1938
|
return;
|
|
1847
1939
|
}
|
|
@@ -1866,6 +1958,9 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1866
1958
|
_initMetrics() {
|
|
1867
1959
|
return new MetricsImpl(this.name, () => this.name);
|
|
1868
1960
|
}
|
|
1961
|
+
getRootActivityHistoryEntry(atTime) {
|
|
1962
|
+
return this._rootActivityHistory.findByTime(atTime);
|
|
1963
|
+
}
|
|
1869
1964
|
}
|
|
1870
1965
|
|
|
1871
1966
|
const pathLimit = 5;
|
|
@@ -2231,6 +2326,10 @@ class NextgenImpl {
|
|
|
2231
2326
|
var _a;
|
|
2232
2327
|
return (_a = this._appInstr) === null || _a === void 0 ? void 0 : _a.name;
|
|
2233
2328
|
}
|
|
2329
|
+
getRootActivityHistoryEntryByTime(atTime) {
|
|
2330
|
+
var _a;
|
|
2331
|
+
return (_a = this._appInstr) === null || _a === void 0 ? void 0 : _a.getRootActivityHistoryEntry(atTime);
|
|
2332
|
+
}
|
|
2234
2333
|
addLog(loggerName, schema, data, timestamp, rootId) {
|
|
2235
2334
|
var _a, _b, _c;
|
|
2236
2335
|
payloadUtility.checkInputs(schema, data);
|
|
@@ -2531,7 +2630,7 @@ class ConsoleCollector {
|
|
|
2531
2630
|
}
|
|
2532
2631
|
}
|
|
2533
2632
|
|
|
2534
|
-
const version = '250.
|
|
2633
|
+
const version = '250.6.0';
|
|
2535
2634
|
|
|
2536
2635
|
const idleDetector = new IdleDetectorImpl({
|
|
2537
2636
|
logThreshold: 300,
|