@atlaskit/react-ufo 4.2.6 → 4.3.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/CHANGELOG.md +7 -0
- package/additional-payload/package.json +1 -1
- package/bundle-eval-timing/package.json +1 -1
- package/coinflip/package.json +1 -1
- package/common/package.json +1 -1
- package/config/package.json +1 -1
- package/create-experimental-interaction-metrics-payload/package.json +1 -1
- package/create-payload/package.json +1 -1
- package/create-post-interaction-log-payload/package.json +1 -1
- package/custom-cohort-data/package.json +1 -1
- package/custom-data/package.json +1 -1
- package/custom-mark/package.json +1 -1
- package/custom-spans/package.json +1 -1
- package/custom-timings/package.json +1 -1
- package/dist/cjs/config/index.js +39 -24
- package/dist/cjs/create-payload/index.js +13 -5
- package/dist/cjs/interaction-metrics/index.js +1 -0
- package/dist/es2019/config/index.js +14 -0
- package/dist/es2019/create-payload/index.js +11 -1
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/esm/config/index.js +38 -24
- package/dist/esm/create-payload/index.js +13 -5
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/types/common/common/types.d.ts +2 -0
- package/dist/types/config/index.d.ts +24 -0
- package/dist/types/create-payload/index.d.ts +25346 -146
- package/dist/types-ts4.5/common/common/types.d.ts +2 -0
- package/dist/types-ts4.5/config/index.d.ts +24 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +25346 -146
- package/experience-trace-id-context/package.json +1 -1
- package/feature-flags-accessed/package.json +1 -1
- package/generate-id/package.json +1 -1
- package/global-error-handler/package.json +1 -1
- package/hidden-timing/package.json +1 -1
- package/initial-page-load-extra-timing/package.json +1 -1
- package/interaction-context/package.json +1 -1
- package/interaction-id-context/package.json +1 -1
- package/interaction-ignore/package.json +1 -1
- package/interaction-metrics/package.json +1 -1
- package/interaction-metrics-init/package.json +1 -1
- package/label/package.json +1 -1
- package/load-hold/package.json +1 -1
- package/package.json +1 -1
- package/placeholder/package.json +1 -1
- package/resource-timing/package.json +1 -1
- package/round-number/package.json +1 -1
- package/route-name/package.json +1 -1
- package/route-name-context/package.json +1 -1
- package/segment/package.json +1 -1
- package/set-interaction-error/package.json +1 -1
- package/short-id/package.json +1 -1
- package/ssr/package.json +1 -1
- package/ssr-scripts/package.json +1 -1
- package/suspense/package.json +1 -1
- package/trace-interaction/package.json +1 -1
- package/trace-pageload/package.json +1 -1
- package/trace-press/package.json +1 -1
- package/trace-redirect/package.json +1 -1
- package/trace-transition/package.json +1 -1
- package/typing-performance-tracing/package.json +1 -1
- package/use-press-tracing/package.json +1 -1
- package/vc/package.json +1 -1
- package/vc-media/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`45299e3f3ebab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/45299e3f3ebab) -
|
|
8
|
+
Add React hydration property to UFO metrics for initial page load
|
|
9
|
+
|
|
3
10
|
## 4.2.6
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/coinflip/package.json
CHANGED
package/common/package.json
CHANGED
package/config/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"types": "../dist/types/create-experimental-interaction-metrics-payload/index.d.ts",
|
|
8
8
|
"typesVersions": {
|
|
9
|
-
">=4.5 <5.
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
10
|
"*": [
|
|
11
11
|
"../dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts"
|
|
12
12
|
]
|
package/custom-data/package.json
CHANGED
package/custom-mark/package.json
CHANGED
package/dist/cjs/config/index.js
CHANGED
|
@@ -16,6 +16,7 @@ exports.getInteractionRate = getInteractionRate;
|
|
|
16
16
|
exports.getInteractionTimeout = getInteractionTimeout;
|
|
17
17
|
exports.getMostRecentVCRevision = getMostRecentVCRevision;
|
|
18
18
|
exports.getPostInteractionRate = getPostInteractionRate;
|
|
19
|
+
exports.getReactHydrationStats = getReactHydrationStats;
|
|
19
20
|
exports.getTypingPerformanceTracingMethod = getTypingPerformanceTracingMethod;
|
|
20
21
|
exports.getUfoNameOverrides = getUfoNameOverrides;
|
|
21
22
|
exports.isVCRevisionEnabled = isVCRevisionEnabled;
|
|
@@ -90,17 +91,31 @@ function getMostRecentVCRevision() {
|
|
|
90
91
|
var enabledVCRevisions = getEnabledVCRevisions(experienceKey);
|
|
91
92
|
return enabledVCRevisions[enabledVCRevisions.length - 1];
|
|
92
93
|
}
|
|
94
|
+
function getReactHydrationStats() {
|
|
95
|
+
if (!config) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
var _config, _config$getReactHydra;
|
|
100
|
+
var stats = (_config = config) === null || _config === void 0 || (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
|
|
101
|
+
return stats !== null && stats !== void 0 ? stats : undefined;
|
|
102
|
+
} catch (e) {
|
|
103
|
+
// eslint-disable-next-line no-console
|
|
104
|
+
console.error('getReactHydrationStats threw an error: ', e);
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
93
108
|
function getInteractionRate(name, interactionKind) {
|
|
94
109
|
try {
|
|
95
110
|
if (!config) {
|
|
96
111
|
return 0;
|
|
97
112
|
}
|
|
98
|
-
var
|
|
99
|
-
killswitch =
|
|
100
|
-
rates =
|
|
101
|
-
rules =
|
|
102
|
-
kind =
|
|
103
|
-
autoGeneratedRate =
|
|
113
|
+
var _config2 = config,
|
|
114
|
+
killswitch = _config2.killswitch,
|
|
115
|
+
rates = _config2.rates,
|
|
116
|
+
rules = _config2.rules,
|
|
117
|
+
kind = _config2.kind,
|
|
118
|
+
autoGeneratedRate = _config2.autoGeneratedRate;
|
|
104
119
|
if (killswitch != null) {
|
|
105
120
|
// Specifically kill certain events
|
|
106
121
|
if (killswitch.includes(name)) {
|
|
@@ -150,8 +165,8 @@ function getExperimentalInteractionRate(name, interactionType) {
|
|
|
150
165
|
if (!config) {
|
|
151
166
|
return 0;
|
|
152
167
|
}
|
|
153
|
-
var
|
|
154
|
-
experimentalInteractionMetrics =
|
|
168
|
+
var _config3 = config,
|
|
169
|
+
experimentalInteractionMetrics = _config3.experimentalInteractionMetrics;
|
|
155
170
|
if (!(experimentalInteractionMetrics !== null && experimentalInteractionMetrics !== void 0 && experimentalInteractionMetrics.enabled)) {
|
|
156
171
|
return 0;
|
|
157
172
|
}
|
|
@@ -171,8 +186,8 @@ function getPostInteractionRate(name, interactionType) {
|
|
|
171
186
|
if (!config) {
|
|
172
187
|
return 0;
|
|
173
188
|
}
|
|
174
|
-
var
|
|
175
|
-
postInteractionLog =
|
|
189
|
+
var _config4 = config,
|
|
190
|
+
postInteractionLog = _config4.postInteractionLog;
|
|
176
191
|
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
177
192
|
return 0;
|
|
178
193
|
}
|
|
@@ -198,8 +213,8 @@ function getCapabilityRate(capability) {
|
|
|
198
213
|
if (!config) {
|
|
199
214
|
return 0;
|
|
200
215
|
}
|
|
201
|
-
var
|
|
202
|
-
capabilityRate =
|
|
216
|
+
var _config5 = config,
|
|
217
|
+
capabilityRate = _config5.capability;
|
|
203
218
|
if (capabilityRate != null) {
|
|
204
219
|
var rate = capabilityRate[capability];
|
|
205
220
|
if (rate != null) {
|
|
@@ -218,8 +233,8 @@ function getTypingPerformanceTracingMethod() {
|
|
|
218
233
|
if (!config) {
|
|
219
234
|
return defaultMethod;
|
|
220
235
|
}
|
|
221
|
-
var
|
|
222
|
-
typingMethod =
|
|
236
|
+
var _config6 = config,
|
|
237
|
+
typingMethod = _config6.typingMethod;
|
|
223
238
|
if (typingMethod != null && validTypingMethods.find(function (m) {
|
|
224
239
|
return m === typingMethod;
|
|
225
240
|
})) {
|
|
@@ -238,8 +253,8 @@ function getAwaitBM3TTIList() {
|
|
|
238
253
|
if (!config) {
|
|
239
254
|
return [];
|
|
240
255
|
}
|
|
241
|
-
var
|
|
242
|
-
awaitBM3TTI =
|
|
256
|
+
var _config7 = config,
|
|
257
|
+
awaitBM3TTI = _config7.awaitBM3TTI;
|
|
243
258
|
if (awaitBM3TTI != null) {
|
|
244
259
|
return awaitBM3TTI;
|
|
245
260
|
} else {
|
|
@@ -259,8 +274,8 @@ function getUfoNameOverrides() {
|
|
|
259
274
|
if (!config) {
|
|
260
275
|
return undefined;
|
|
261
276
|
}
|
|
262
|
-
var
|
|
263
|
-
ufoNameOverrides =
|
|
277
|
+
var _config8 = config,
|
|
278
|
+
ufoNameOverrides = _config8.ufoNameOverrides;
|
|
264
279
|
if (ufoNameOverrides != null) {
|
|
265
280
|
return ufoNameOverrides;
|
|
266
281
|
}
|
|
@@ -276,8 +291,8 @@ function getDoNotAbortActivePressInteraction() {
|
|
|
276
291
|
if (!config) {
|
|
277
292
|
return undefined;
|
|
278
293
|
}
|
|
279
|
-
var
|
|
280
|
-
doNotAbortActivePressInteraction =
|
|
294
|
+
var _config9 = config,
|
|
295
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
281
296
|
return doNotAbortActivePressInteraction;
|
|
282
297
|
} catch (e) {
|
|
283
298
|
return undefined;
|
|
@@ -290,8 +305,8 @@ function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
290
305
|
if (!config) {
|
|
291
306
|
return undefined;
|
|
292
307
|
}
|
|
293
|
-
var
|
|
294
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
308
|
+
var _config0 = config,
|
|
309
|
+
doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
|
|
295
310
|
return doNotAbortActivePressInteractionOnTransition;
|
|
296
311
|
} catch (e) {
|
|
297
312
|
return undefined;
|
|
@@ -303,8 +318,8 @@ function getInteractionTimeout(ufoName) {
|
|
|
303
318
|
if (!config) {
|
|
304
319
|
return CLEANUP_TIMEOUT;
|
|
305
320
|
}
|
|
306
|
-
var
|
|
307
|
-
interactionTimeout =
|
|
321
|
+
var _config1 = config,
|
|
322
|
+
interactionTimeout = _config1.interactionTimeout;
|
|
308
323
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
309
324
|
return interactionTimeout[ufoName];
|
|
310
325
|
}
|
|
@@ -582,7 +582,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
|
|
|
582
582
|
function _createInteractionMetricsPayload() {
|
|
583
583
|
_createInteractionMetricsPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
|
|
584
584
|
var _window$location, _config$additionalPay;
|
|
585
|
-
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, payload;
|
|
585
|
+
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
|
|
586
586
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
587
587
|
while (1) switch (_context.prev = _context.next) {
|
|
588
588
|
case 0:
|
|
@@ -594,7 +594,7 @@ function _createInteractionMetricsPayload() {
|
|
|
594
594
|
}
|
|
595
595
|
throw Error('UFO Configuration not provided');
|
|
596
596
|
case 4:
|
|
597
|
-
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy;
|
|
597
|
+
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy, hydration = interaction.hydration;
|
|
598
598
|
pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
599
599
|
pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
600
600
|
segments = !(0, _platformFeatureFlags.fg)('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments;
|
|
@@ -707,6 +707,14 @@ function _createInteractionMetricsPayload() {
|
|
|
707
707
|
if (!experimental) {
|
|
708
708
|
(0, _platformFeatureFlags.fg)('ufo_chrome_devtools_uplift') && (0, _addPerformanceMeasures.addPerformanceMeasures)(interaction.start, (0, _toConsumableArray2.default)((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
709
709
|
}
|
|
710
|
+
getReactHydrationStats = function getReactHydrationStats() {
|
|
711
|
+
if (!isPageLoad || !hydration) {
|
|
712
|
+
return {};
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
hydration: hydration
|
|
716
|
+
};
|
|
717
|
+
};
|
|
710
718
|
payload = {
|
|
711
719
|
actionSubject: 'experience',
|
|
712
720
|
action: 'measured',
|
|
@@ -714,7 +722,7 @@ function _createInteractionMetricsPayload() {
|
|
|
714
722
|
source: 'measured',
|
|
715
723
|
tags: ['observability'],
|
|
716
724
|
attributes: {
|
|
717
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
725
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
718
726
|
// basic
|
|
719
727
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
720
728
|
'event:product': config.product,
|
|
@@ -733,7 +741,7 @@ function _createInteractionMetricsPayload() {
|
|
|
733
741
|
}, criticalPayloadCount !== undefined ? {
|
|
734
742
|
'ufo:multipayload': true,
|
|
735
743
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
736
|
-
} : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
|
|
744
|
+
} : {}), (0, _getBrowserMetadata.getBrowserMetadataToLegacyFormat)()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), (0, _getNavigationMetrics.getNavigationMetricsToLegacyFormat)(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
737
745
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
738
746
|
namePrefix: config.namePrefix || '',
|
|
739
747
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -779,7 +787,7 @@ function _createInteractionMetricsPayload() {
|
|
|
779
787
|
}
|
|
780
788
|
payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
|
|
781
789
|
return _context.abrupt("return", payload);
|
|
782
|
-
case
|
|
790
|
+
case 45:
|
|
783
791
|
case "end":
|
|
784
792
|
return _context.stop();
|
|
785
793
|
}
|
|
@@ -663,6 +663,7 @@ function finishInteraction(id, data) {
|
|
|
663
663
|
data.vc = observer.getVCRawData();
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
+
data.hydration = (0, _config.getReactHydrationStats)();
|
|
666
667
|
|
|
667
668
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
668
669
|
if ((0, _platformFeatureFlags.fg)('platform_ufo_post_interaction_check_name')) {
|
|
@@ -67,6 +67,20 @@ export function getMostRecentVCRevision(experienceKey = '') {
|
|
|
67
67
|
const enabledVCRevisions = getEnabledVCRevisions(experienceKey);
|
|
68
68
|
return enabledVCRevisions[enabledVCRevisions.length - 1];
|
|
69
69
|
}
|
|
70
|
+
export function getReactHydrationStats() {
|
|
71
|
+
if (!config) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
var _config, _config$getReactHydra;
|
|
76
|
+
const stats = (_config = config) === null || _config === void 0 ? void 0 : (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
|
|
77
|
+
return stats !== null && stats !== void 0 ? stats : undefined;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.error('getReactHydrationStats threw an error: ', e);
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
70
84
|
export function getInteractionRate(name, interactionKind) {
|
|
71
85
|
try {
|
|
72
86
|
if (!config) {
|
|
@@ -598,7 +598,8 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
598
598
|
abortedByInteractionName,
|
|
599
599
|
responsiveness,
|
|
600
600
|
unknownElementName,
|
|
601
|
-
unknownElementHierarchy
|
|
601
|
+
unknownElementHierarchy,
|
|
602
|
+
hydration
|
|
602
603
|
} = interaction;
|
|
603
604
|
const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
604
605
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
@@ -693,6 +694,14 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
693
694
|
if (!experimental) {
|
|
694
695
|
fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, [...((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || [])]);
|
|
695
696
|
}
|
|
697
|
+
const getReactHydrationStats = () => {
|
|
698
|
+
if (!isPageLoad || !hydration) {
|
|
699
|
+
return {};
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
hydration
|
|
703
|
+
};
|
|
704
|
+
};
|
|
696
705
|
const payload = {
|
|
697
706
|
actionSubject: 'experience',
|
|
698
707
|
action: 'measured',
|
|
@@ -733,6 +742,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
733
742
|
...getTracingContextData(interaction),
|
|
734
743
|
...getStylesheetMetrics(),
|
|
735
744
|
...getErrorCounts(interaction),
|
|
745
|
+
...getReactHydrationStats(),
|
|
736
746
|
interactionMetrics: {
|
|
737
747
|
namePrefix: config.namePrefix || '',
|
|
738
748
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v4 as createUUID } from 'uuid';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import coinflip from '../coinflip';
|
|
4
|
-
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate } from '../config';
|
|
4
|
+
import { getAwaitBM3TTIList, getCapabilityRate, getConfig, getExperimentalInteractionRate, getInteractionTimeout, getPostInteractionRate, getReactHydrationStats } from '../config';
|
|
5
5
|
import { experimentalVC, getExperimentalVCMetrics, onExperimentalInteractionComplete } from '../create-experimental-interaction-metrics-payload';
|
|
6
6
|
import { sanitizeUfoName } from '../create-payload/common/utils';
|
|
7
7
|
import { clearActiveTrace } from '../experience-trace-id-context';
|
|
@@ -581,6 +581,7 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
581
581
|
data.vc = observer.getVCRawData();
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
+
data.hydration = getReactHydrationStats();
|
|
584
585
|
|
|
585
586
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
586
587
|
if (fg('platform_ufo_post_interaction_check_name')) {
|
package/dist/esm/config/index.js
CHANGED
|
@@ -68,17 +68,31 @@ export function getMostRecentVCRevision() {
|
|
|
68
68
|
var enabledVCRevisions = getEnabledVCRevisions(experienceKey);
|
|
69
69
|
return enabledVCRevisions[enabledVCRevisions.length - 1];
|
|
70
70
|
}
|
|
71
|
+
export function getReactHydrationStats() {
|
|
72
|
+
if (!config) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
var _config, _config$getReactHydra;
|
|
77
|
+
var stats = (_config = config) === null || _config === void 0 || (_config$getReactHydra = _config.getReactHydrationStats) === null || _config$getReactHydra === void 0 ? void 0 : _config$getReactHydra.call(_config);
|
|
78
|
+
return stats !== null && stats !== void 0 ? stats : undefined;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.error('getReactHydrationStats threw an error: ', e);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
71
85
|
export function getInteractionRate(name, interactionKind) {
|
|
72
86
|
try {
|
|
73
87
|
if (!config) {
|
|
74
88
|
return 0;
|
|
75
89
|
}
|
|
76
|
-
var
|
|
77
|
-
killswitch =
|
|
78
|
-
rates =
|
|
79
|
-
rules =
|
|
80
|
-
kind =
|
|
81
|
-
autoGeneratedRate =
|
|
90
|
+
var _config2 = config,
|
|
91
|
+
killswitch = _config2.killswitch,
|
|
92
|
+
rates = _config2.rates,
|
|
93
|
+
rules = _config2.rules,
|
|
94
|
+
kind = _config2.kind,
|
|
95
|
+
autoGeneratedRate = _config2.autoGeneratedRate;
|
|
82
96
|
if (killswitch != null) {
|
|
83
97
|
// Specifically kill certain events
|
|
84
98
|
if (killswitch.includes(name)) {
|
|
@@ -128,8 +142,8 @@ export function getExperimentalInteractionRate(name, interactionType) {
|
|
|
128
142
|
if (!config) {
|
|
129
143
|
return 0;
|
|
130
144
|
}
|
|
131
|
-
var
|
|
132
|
-
experimentalInteractionMetrics =
|
|
145
|
+
var _config3 = config,
|
|
146
|
+
experimentalInteractionMetrics = _config3.experimentalInteractionMetrics;
|
|
133
147
|
if (!(experimentalInteractionMetrics !== null && experimentalInteractionMetrics !== void 0 && experimentalInteractionMetrics.enabled)) {
|
|
134
148
|
return 0;
|
|
135
149
|
}
|
|
@@ -149,8 +163,8 @@ export function getPostInteractionRate(name, interactionType) {
|
|
|
149
163
|
if (!config) {
|
|
150
164
|
return 0;
|
|
151
165
|
}
|
|
152
|
-
var
|
|
153
|
-
postInteractionLog =
|
|
166
|
+
var _config4 = config,
|
|
167
|
+
postInteractionLog = _config4.postInteractionLog;
|
|
154
168
|
if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
|
|
155
169
|
return 0;
|
|
156
170
|
}
|
|
@@ -176,8 +190,8 @@ export function getCapabilityRate(capability) {
|
|
|
176
190
|
if (!config) {
|
|
177
191
|
return 0;
|
|
178
192
|
}
|
|
179
|
-
var
|
|
180
|
-
capabilityRate =
|
|
193
|
+
var _config5 = config,
|
|
194
|
+
capabilityRate = _config5.capability;
|
|
181
195
|
if (capabilityRate != null) {
|
|
182
196
|
var rate = capabilityRate[capability];
|
|
183
197
|
if (rate != null) {
|
|
@@ -196,8 +210,8 @@ export function getTypingPerformanceTracingMethod() {
|
|
|
196
210
|
if (!config) {
|
|
197
211
|
return defaultMethod;
|
|
198
212
|
}
|
|
199
|
-
var
|
|
200
|
-
typingMethod =
|
|
213
|
+
var _config6 = config,
|
|
214
|
+
typingMethod = _config6.typingMethod;
|
|
201
215
|
if (typingMethod != null && validTypingMethods.find(function (m) {
|
|
202
216
|
return m === typingMethod;
|
|
203
217
|
})) {
|
|
@@ -216,8 +230,8 @@ export function getAwaitBM3TTIList() {
|
|
|
216
230
|
if (!config) {
|
|
217
231
|
return [];
|
|
218
232
|
}
|
|
219
|
-
var
|
|
220
|
-
awaitBM3TTI =
|
|
233
|
+
var _config7 = config,
|
|
234
|
+
awaitBM3TTI = _config7.awaitBM3TTI;
|
|
221
235
|
if (awaitBM3TTI != null) {
|
|
222
236
|
return awaitBM3TTI;
|
|
223
237
|
} else {
|
|
@@ -237,8 +251,8 @@ export function getUfoNameOverrides() {
|
|
|
237
251
|
if (!config) {
|
|
238
252
|
return undefined;
|
|
239
253
|
}
|
|
240
|
-
var
|
|
241
|
-
ufoNameOverrides =
|
|
254
|
+
var _config8 = config,
|
|
255
|
+
ufoNameOverrides = _config8.ufoNameOverrides;
|
|
242
256
|
if (ufoNameOverrides != null) {
|
|
243
257
|
return ufoNameOverrides;
|
|
244
258
|
}
|
|
@@ -254,8 +268,8 @@ export function getDoNotAbortActivePressInteraction() {
|
|
|
254
268
|
if (!config) {
|
|
255
269
|
return undefined;
|
|
256
270
|
}
|
|
257
|
-
var
|
|
258
|
-
doNotAbortActivePressInteraction =
|
|
271
|
+
var _config9 = config,
|
|
272
|
+
doNotAbortActivePressInteraction = _config9.doNotAbortActivePressInteraction;
|
|
259
273
|
return doNotAbortActivePressInteraction;
|
|
260
274
|
} catch (e) {
|
|
261
275
|
return undefined;
|
|
@@ -268,8 +282,8 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
|
|
|
268
282
|
if (!config) {
|
|
269
283
|
return undefined;
|
|
270
284
|
}
|
|
271
|
-
var
|
|
272
|
-
doNotAbortActivePressInteractionOnTransition =
|
|
285
|
+
var _config0 = config,
|
|
286
|
+
doNotAbortActivePressInteractionOnTransition = _config0.doNotAbortActivePressInteractionOnTransition;
|
|
273
287
|
return doNotAbortActivePressInteractionOnTransition;
|
|
274
288
|
} catch (e) {
|
|
275
289
|
return undefined;
|
|
@@ -281,8 +295,8 @@ export function getInteractionTimeout(ufoName) {
|
|
|
281
295
|
if (!config) {
|
|
282
296
|
return CLEANUP_TIMEOUT;
|
|
283
297
|
}
|
|
284
|
-
var
|
|
285
|
-
interactionTimeout =
|
|
298
|
+
var _config1 = config,
|
|
299
|
+
interactionTimeout = _config1.interactionTimeout;
|
|
286
300
|
if (interactionTimeout != null && interactionTimeout[ufoName] != null) {
|
|
287
301
|
return interactionTimeout[ufoName];
|
|
288
302
|
}
|
|
@@ -575,7 +575,7 @@ function createInteractionMetricsPayload(_x, _x2, _x3, _x4, _x5) {
|
|
|
575
575
|
function _createInteractionMetricsPayload() {
|
|
576
576
|
_createInteractionMetricsPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interaction, interactionId, experimental, criticalPayloadCount, vcMetrics) {
|
|
577
577
|
var _window$location, _config$additionalPay;
|
|
578
|
-
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, payload;
|
|
578
|
+
var interactionPayloadStart, config, end, start, ufoName, knownSegments, rate, type, abortReason, routeName, featureFlags, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, responsiveness, unknownElementName, unknownElementHierarchy, hydration, pageVisibilityAtTTI, pageVisibilityAtTTAI, segments, segmentTree, isDetailedPayload, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTI, moreAccuratePageVisibilityAtTTAI, labelStack, getInitialPageLoadSSRMetrics, pageLoadInteractionMetrics, getDetailedInteractionMetrics, getPageLoadDetailedInteractionMetrics, newUFOName, resourceTimings, _yield$Promise$all, _yield$Promise$all2, finalVCMetrics, experimentalMetrics, paintMetrics, getReactHydrationStats, payload;
|
|
579
579
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
580
580
|
while (1) switch (_context.prev = _context.next) {
|
|
581
581
|
case 0:
|
|
@@ -587,7 +587,7 @@ function _createInteractionMetricsPayload() {
|
|
|
587
587
|
}
|
|
588
588
|
throw Error('UFO Configuration not provided');
|
|
589
589
|
case 4:
|
|
590
|
-
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy;
|
|
590
|
+
end = interaction.end, start = interaction.start, ufoName = interaction.ufoName, knownSegments = interaction.knownSegments, rate = interaction.rate, type = interaction.type, abortReason = interaction.abortReason, routeName = interaction.routeName, featureFlags = interaction.featureFlags, previousInteractionName = interaction.previousInteractionName, isPreviousInteractionAborted = interaction.isPreviousInteractionAborted, abortedByInteractionName = interaction.abortedByInteractionName, responsiveness = interaction.responsiveness, unknownElementName = interaction.unknownElementName, unknownElementHierarchy = interaction.unknownElementHierarchy, hydration = interaction.hydration;
|
|
591
591
|
pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
592
592
|
pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
593
593
|
segments = !fg('platform_ufo_remove_deprecated_config_fields') && config.killswitchNestedSegments ? [] : knownSegments;
|
|
@@ -700,6 +700,14 @@ function _createInteractionMetricsPayload() {
|
|
|
700
700
|
if (!experimental) {
|
|
701
701
|
fg('ufo_chrome_devtools_uplift') && addPerformanceMeasures(interaction.start, _toConsumableArray((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
702
702
|
}
|
|
703
|
+
getReactHydrationStats = function getReactHydrationStats() {
|
|
704
|
+
if (!isPageLoad || !hydration) {
|
|
705
|
+
return {};
|
|
706
|
+
}
|
|
707
|
+
return {
|
|
708
|
+
hydration: hydration
|
|
709
|
+
};
|
|
710
|
+
};
|
|
703
711
|
payload = {
|
|
704
712
|
actionSubject: 'experience',
|
|
705
713
|
action: 'measured',
|
|
@@ -707,7 +715,7 @@ function _createInteractionMetricsPayload() {
|
|
|
707
715
|
source: 'measured',
|
|
708
716
|
tags: ['observability'],
|
|
709
717
|
attributes: {
|
|
710
|
-
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
718
|
+
properties: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
711
719
|
// basic
|
|
712
720
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
713
721
|
'event:product': config.product,
|
|
@@ -726,7 +734,7 @@ function _createInteractionMetricsPayload() {
|
|
|
726
734
|
}, criticalPayloadCount !== undefined ? {
|
|
727
735
|
'ufo:multipayload': true,
|
|
728
736
|
'ufo:criticalPayloadCount': criticalPayloadCount
|
|
729
|
-
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), {}, {
|
|
737
|
+
} : {}), getBrowserMetadataToLegacyFormat()), getSSRProperties(type)), getAssetsMetrics(interaction, pageLoadInteractionMetrics === null || pageLoadInteractionMetrics === void 0 ? void 0 : pageLoadInteractionMetrics.SSRDoneTime)), getPPSMetrics(interaction)), paintMetrics), getNavigationMetricsToLegacyFormat(type)), finalVCMetrics), experimentalMetrics), (_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)), getTracingContextData(interaction)), getStylesheetMetrics()), getErrorCounts(interaction)), getReactHydrationStats()), {}, {
|
|
730
738
|
interactionMetrics: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
731
739
|
namePrefix: config.namePrefix || '',
|
|
732
740
|
segmentPrefix: config.segmentPrefix || '',
|
|
@@ -772,7 +780,7 @@ function _createInteractionMetricsPayload() {
|
|
|
772
780
|
}
|
|
773
781
|
payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
|
|
774
782
|
return _context.abrupt("return", payload);
|
|
775
|
-
case
|
|
783
|
+
case 45:
|
|
776
784
|
case "end":
|
|
777
785
|
return _context.stop();
|
|
778
786
|
}
|