@atlaskit/react-ufo 5.5.4 → 5.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 5.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`165ad4e461379`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/165ad4e461379) -
|
|
8
|
+
Allow sending custom.interaction-extra-metrics payload when 3P-inclusive VC is dirty behind
|
|
9
|
+
platform_ufo_send_extra_metrics_on_dirty_vc feature gate. Adds vcClean and vcAbortReason fields to
|
|
10
|
+
the payload properties.
|
|
11
|
+
|
|
3
12
|
## 5.5.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -36,8 +36,8 @@ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
|
|
|
36
36
|
}
|
|
37
37
|
function _createInteractionExtraLogPayload() {
|
|
38
38
|
_createInteractionExtraLogPayload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
39
|
-
var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
40
|
-
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
39
|
+
var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
40
|
+
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, hasMinorInteractions, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, isVCCleanFor3p, vcAbortReasonFor3p, allowDirtyVC, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, _effectiveVCRevisionP3, _effectiveVCRevisionP4, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
41
41
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
@@ -70,19 +70,26 @@ function _createInteractionExtraLogPayload() {
|
|
|
70
70
|
case 12:
|
|
71
71
|
pageVisibilityAtTTAI = (0, _getPageVisibilityUpToTtai.default)(interaction);
|
|
72
72
|
isPageLoad = type === 'page_load' || type === 'transition';
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
|
|
74
|
+
if (isPageLoad) {
|
|
75
|
+
_context.next = 17;
|
|
75
76
|
break;
|
|
76
77
|
}
|
|
77
78
|
return _context.abrupt("return", null);
|
|
78
|
-
case
|
|
79
|
+
case 17:
|
|
80
|
+
if (!(hasMinorInteractions && !(0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
|
|
81
|
+
_context.next = 19;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return _context.abrupt("return", null);
|
|
85
|
+
case 19:
|
|
79
86
|
calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
80
87
|
moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? (0, _getMoreAccuratePageVisibilityUpToTtai.getMoreAccuratePageVisibilityUpToTTAI)(interaction) : null;
|
|
81
88
|
extraTTAI = (_getTTAI = (0, _getTtai.default)(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
|
|
82
89
|
newUFOName = (0, _utils.sanitizeUfoName)(ufoName);
|
|
83
|
-
_context.next =
|
|
90
|
+
_context.next = 25;
|
|
84
91
|
return (0, _getVcMetrics.default)(interaction, true);
|
|
85
|
-
case
|
|
92
|
+
case 25:
|
|
86
93
|
finalVCMetrics = _context.sent;
|
|
87
94
|
// Check if VC is clean and has valid metric
|
|
88
95
|
vcRevisionPayload = finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev'];
|
|
@@ -91,25 +98,53 @@ function _createInteractionExtraLogPayload() {
|
|
|
91
98
|
var revision = _ref.revision;
|
|
92
99
|
return revision === effectiveRevision;
|
|
93
100
|
});
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
|
|
102
|
+
vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
|
|
103
|
+
allowDirtyVC = (0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'); // Always require valid TTAI
|
|
104
|
+
if (!(extraTTAI === undefined || typeof extraTTAI !== 'number')) {
|
|
105
|
+
_context.next = 34;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return _context.abrupt("return", null);
|
|
109
|
+
case 34:
|
|
110
|
+
if (!(interaction.errors.length > 0 && !(0, _platformFeatureFlags.fg)('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
|
|
111
|
+
_context.next = 36;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
return _context.abrupt("return", null);
|
|
115
|
+
case 36:
|
|
116
|
+
if (!isVCCleanFor3p) {
|
|
117
|
+
_context.next = 41;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
if (!((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number')) {
|
|
121
|
+
_context.next = 39;
|
|
96
122
|
break;
|
|
97
123
|
}
|
|
98
124
|
return _context.abrupt("return", null);
|
|
99
|
-
case
|
|
125
|
+
case 39:
|
|
126
|
+
_context.next = 43;
|
|
127
|
+
break;
|
|
128
|
+
case 41:
|
|
129
|
+
if (allowDirtyVC) {
|
|
130
|
+
_context.next = 43;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return _context.abrupt("return", null);
|
|
134
|
+
case 43:
|
|
100
135
|
if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
|
|
101
|
-
_context.next =
|
|
136
|
+
_context.next = 45;
|
|
102
137
|
break;
|
|
103
138
|
}
|
|
104
139
|
return _context.abrupt("return", null);
|
|
105
|
-
case
|
|
140
|
+
case 45:
|
|
106
141
|
normalTTAI = (_getTTAI2 = (0, _getTtai.default)(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
|
|
107
142
|
lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
|
|
108
143
|
lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
|
|
109
144
|
lastInteractionFinishVC90 = null;
|
|
110
145
|
lastInteractionFinishVCClean = false;
|
|
111
146
|
if (!lastInteractionFinishVCResult) {
|
|
112
|
-
_context.next =
|
|
147
|
+
_context.next = 62;
|
|
113
148
|
break;
|
|
114
149
|
}
|
|
115
150
|
lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
@@ -118,25 +153,29 @@ function _createInteractionExtraLogPayload() {
|
|
|
118
153
|
return revision === effectiveRevision;
|
|
119
154
|
});
|
|
120
155
|
if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
|
|
121
|
-
_context.next =
|
|
156
|
+
_context.next = 58;
|
|
122
157
|
break;
|
|
123
158
|
}
|
|
124
159
|
lastInteractionFinishVCClean = true;
|
|
125
160
|
lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
|
|
126
|
-
_context.next =
|
|
161
|
+
_context.next = 60;
|
|
127
162
|
break;
|
|
128
|
-
case
|
|
163
|
+
case 58:
|
|
164
|
+
if (allowDirtyVC) {
|
|
165
|
+
_context.next = 60;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
129
168
|
return _context.abrupt("return", null);
|
|
130
|
-
case
|
|
131
|
-
_context.next =
|
|
169
|
+
case 60:
|
|
170
|
+
_context.next = 63;
|
|
132
171
|
break;
|
|
133
|
-
case
|
|
172
|
+
case 62:
|
|
134
173
|
if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
|
|
135
174
|
// Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
|
|
136
|
-
lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
|
|
137
|
-
lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
|
|
175
|
+
lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
|
|
176
|
+
lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
|
|
138
177
|
}
|
|
139
|
-
case
|
|
178
|
+
case 63:
|
|
140
179
|
// Helper function to check if labelStack contains third-party type
|
|
141
180
|
isThirdParty = function isThirdParty(labelStack) {
|
|
142
181
|
var _labelStack$some;
|
|
@@ -204,7 +243,7 @@ function _createInteractionExtraLogPayload() {
|
|
|
204
243
|
source: 'measured',
|
|
205
244
|
tags: ['observability'],
|
|
206
245
|
attributes: {
|
|
207
|
-
properties: {
|
|
246
|
+
properties: _objectSpread(_objectSpread({
|
|
208
247
|
// basic
|
|
209
248
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
210
249
|
'event:product': config.product,
|
|
@@ -242,6 +281,12 @@ function _createInteractionExtraLogPayload() {
|
|
|
242
281
|
reactProfilerTimings: (0, _optimizeReactProfilerTimings.optimizeReactProfilerTimings)(filteredData.reactProfilerTimings, start, (0, _getReactUfoPayloadVersion.getReactUFOPayloadVersion)(interaction.type)),
|
|
243
282
|
customData: filteredData.customData
|
|
244
283
|
}, getDetailedInteractionMetrics()),
|
|
284
|
+
vcClean: isVCCleanFor3p
|
|
285
|
+
}, vcAbortReasonFor3p !== undefined && {
|
|
286
|
+
vcAbortReason: vcAbortReasonFor3p
|
|
287
|
+
}), {}, {
|
|
288
|
+
hasMinorInteractions: hasMinorInteractions,
|
|
289
|
+
hasErrors: interaction.errors.length > 0,
|
|
245
290
|
'vc:effective:revision': effectiveRevision,
|
|
246
291
|
lastInteractionFinish: {
|
|
247
292
|
start: lastInteractionFinishStart,
|
|
@@ -250,12 +295,12 @@ function _createInteractionExtraLogPayload() {
|
|
|
250
295
|
vc90: lastInteractionFinishVC90,
|
|
251
296
|
vcClean: lastInteractionFinishVCClean
|
|
252
297
|
}
|
|
253
|
-
}
|
|
298
|
+
})
|
|
254
299
|
}
|
|
255
300
|
};
|
|
256
301
|
payload.attributes.properties['event:sizeInKb'] = (0, _getPayloadSize.default)(payload.attributes.properties);
|
|
257
302
|
return _context.abrupt("return", payload);
|
|
258
|
-
case
|
|
303
|
+
case 72:
|
|
259
304
|
case "end":
|
|
260
305
|
return _context.stop();
|
|
261
306
|
}
|
|
@@ -17,7 +17,7 @@ import { optimizeRequestInfo } from '../create-payload/utils/optimize-request-in
|
|
|
17
17
|
import { optimizeSpans } from '../create-payload/utils/optimize-spans';
|
|
18
18
|
import { interactionSpans as atlaskitInteractionSpans } from '../interaction-metrics';
|
|
19
19
|
async function createInteractionExtraLogPayload(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
20
|
-
var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
20
|
+
var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
21
21
|
const config = getConfig();
|
|
22
22
|
if (!config) {
|
|
23
23
|
throw Error('UFO Configuration not provided');
|
|
@@ -49,9 +49,13 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
|
|
|
49
49
|
}
|
|
50
50
|
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
51
51
|
const isPageLoad = type === 'page_load' || type === 'transition';
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// Only create payload for page load
|
|
52
|
+
const hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
|
|
53
|
+
if (!isPageLoad) {
|
|
54
|
+
// Only create payload for page load or transition
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (hasMinorInteractions && !fg('platform_ufo_send_extra_metrics_on_dirty_vc')) {
|
|
58
|
+
// Not send if aborted by minor interaction, unless feature gate is on
|
|
55
59
|
return null;
|
|
56
60
|
}
|
|
57
61
|
const calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
@@ -66,9 +70,29 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
|
|
|
66
70
|
const effectiveVCRevisionPayload = vcRevisionPayload === null || vcRevisionPayload === void 0 ? void 0 : vcRevisionPayload.find(({
|
|
67
71
|
revision
|
|
68
72
|
}) => revision === effectiveRevision);
|
|
69
|
-
|
|
73
|
+
const isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
|
|
74
|
+
const vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
|
|
75
|
+
const allowDirtyVC = fg('platform_ufo_send_extra_metrics_on_dirty_vc');
|
|
76
|
+
|
|
77
|
+
// Always require valid TTAI
|
|
78
|
+
if (extraTTAI === undefined || typeof extraTTAI !== 'number') {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// When feature gate is off, require no errors; when on, allow errors through
|
|
83
|
+
if (interaction.errors.length > 0 && !fg('platform_ufo_send_extra_metrics_on_dirty_vc')) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (isVCCleanFor3p) {
|
|
87
|
+
// When VC is clean, require a valid vc90 metric
|
|
88
|
+
if ((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number') {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
} else if (!allowDirtyVC) {
|
|
92
|
+
// When VC is dirty and feature gate is off, preserve existing behavior
|
|
70
93
|
return null;
|
|
71
94
|
}
|
|
95
|
+
// When VC is dirty and feature gate is on, continue to send payload
|
|
72
96
|
|
|
73
97
|
// Get normal TTAI & VC90 for last finished interaction (without 3p)
|
|
74
98
|
if (!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length) {
|
|
@@ -87,13 +111,14 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
|
|
|
87
111
|
if (lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean) {
|
|
88
112
|
lastInteractionFinishVCClean = true;
|
|
89
113
|
lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
|
|
90
|
-
} else {
|
|
114
|
+
} else if (!allowDirtyVC) {
|
|
91
115
|
return null;
|
|
92
116
|
}
|
|
93
117
|
} else if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
|
|
118
|
+
var _effectiveVCRevisionP3, _effectiveVCRevisionP4;
|
|
94
119
|
// Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
|
|
95
|
-
lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
|
|
96
|
-
lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
|
|
120
|
+
lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
|
|
121
|
+
lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
|
|
97
122
|
}
|
|
98
123
|
|
|
99
124
|
// Helper function to check if labelStack contains third-party type
|
|
@@ -183,6 +208,12 @@ async function createInteractionExtraLogPayload(interactionId, interaction, last
|
|
|
183
208
|
customData: filteredData.customData,
|
|
184
209
|
...getDetailedInteractionMetrics()
|
|
185
210
|
},
|
|
211
|
+
vcClean: isVCCleanFor3p,
|
|
212
|
+
...(vcAbortReasonFor3p !== undefined && {
|
|
213
|
+
vcAbortReason: vcAbortReasonFor3p
|
|
214
|
+
}),
|
|
215
|
+
hasMinorInteractions,
|
|
216
|
+
hasErrors: interaction.errors.length > 0,
|
|
186
217
|
'vc:effective:revision': effectiveRevision,
|
|
187
218
|
lastInteractionFinish: {
|
|
188
219
|
start: lastInteractionFinishStart,
|
|
@@ -29,8 +29,8 @@ function createInteractionExtraLogPayload(_x, _x2, _x3, _x4) {
|
|
|
29
29
|
}
|
|
30
30
|
function _createInteractionExtraLogPayload() {
|
|
31
31
|
_createInteractionExtraLogPayload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(interactionId, interaction, lastInteractionFinish, lastInteractionFinishVCResult) {
|
|
32
|
-
var _getTTAI, _getMostRecentVCRevis, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
33
|
-
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
32
|
+
var _getTTAI, _getMostRecentVCRevis, _effectiveVCRevisionP, _effectiveVCRevisionP2, _lastInteractionFinis, _getTTAI2, _window$location;
|
|
33
|
+
var config, end, start, ufoName, rate, type, abortReason, routeName, previousInteractionName, isPreviousInteractionAborted, abortedByInteractionName, knownSegments, minorInteractions, sanitisedUfoName, configRate, _config, pageVisibilityAtTTAI, isPageLoad, hasMinorInteractions, calculatePageVisibilityFromTheStartOfPageLoad, moreAccuratePageVisibilityAtTTAI, extraTTAI, newUFOName, finalVCMetrics, vcRevisionPayload, effectiveRevision, effectiveVCRevisionPayload, isVCCleanFor3p, vcAbortReasonFor3p, allowDirtyVC, normalTTAI, lastInteractionFinishStart, lastInteractionFinishEnd, lastInteractionFinishVC90, lastInteractionFinishVCClean, lastInteractionFinishVCRev, lastInteractionFinishRevision, _effectiveVCRevisionP3, _effectiveVCRevisionP4, isThirdParty, filteredData, getDetailedInteractionMetrics, segments3p, segmentTree, payload;
|
|
34
34
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
35
|
while (1) switch (_context.prev = _context.next) {
|
|
36
36
|
case 0:
|
|
@@ -63,19 +63,26 @@ function _createInteractionExtraLogPayload() {
|
|
|
63
63
|
case 12:
|
|
64
64
|
pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
65
65
|
isPageLoad = type === 'page_load' || type === 'transition';
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
hasMinorInteractions = minorInteractions !== undefined && minorInteractions.length > 0;
|
|
67
|
+
if (isPageLoad) {
|
|
68
|
+
_context.next = 17;
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
70
71
|
return _context.abrupt("return", null);
|
|
71
|
-
case
|
|
72
|
+
case 17:
|
|
73
|
+
if (!(hasMinorInteractions && !fg('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
|
|
74
|
+
_context.next = 19;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return _context.abrupt("return", null);
|
|
78
|
+
case 19:
|
|
72
79
|
calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
73
80
|
moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
|
|
74
81
|
extraTTAI = (_getTTAI = getTTAI(interaction)) !== null && _getTTAI !== void 0 ? _getTTAI : undefined;
|
|
75
82
|
newUFOName = sanitizeUfoName(ufoName);
|
|
76
|
-
_context.next =
|
|
83
|
+
_context.next = 25;
|
|
77
84
|
return getVCMetrics(interaction, true);
|
|
78
|
-
case
|
|
85
|
+
case 25:
|
|
79
86
|
finalVCMetrics = _context.sent;
|
|
80
87
|
// Check if VC is clean and has valid metric
|
|
81
88
|
vcRevisionPayload = finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev'];
|
|
@@ -84,25 +91,53 @@ function _createInteractionExtraLogPayload() {
|
|
|
84
91
|
var revision = _ref.revision;
|
|
85
92
|
return revision === effectiveRevision;
|
|
86
93
|
});
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
isVCCleanFor3p = (_effectiveVCRevisionP = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP !== void 0 ? _effectiveVCRevisionP : false;
|
|
95
|
+
vcAbortReasonFor3p = (_effectiveVCRevisionP2 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.abortReason) !== null && _effectiveVCRevisionP2 !== void 0 ? _effectiveVCRevisionP2 : undefined;
|
|
96
|
+
allowDirtyVC = fg('platform_ufo_send_extra_metrics_on_dirty_vc'); // Always require valid TTAI
|
|
97
|
+
if (!(extraTTAI === undefined || typeof extraTTAI !== 'number')) {
|
|
98
|
+
_context.next = 34;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
return _context.abrupt("return", null);
|
|
102
|
+
case 34:
|
|
103
|
+
if (!(interaction.errors.length > 0 && !fg('platform_ufo_send_extra_metrics_on_dirty_vc'))) {
|
|
104
|
+
_context.next = 36;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
return _context.abrupt("return", null);
|
|
108
|
+
case 36:
|
|
109
|
+
if (!isVCCleanFor3p) {
|
|
110
|
+
_context.next = 41;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (!((effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) === undefined || typeof (effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== 'number')) {
|
|
114
|
+
_context.next = 39;
|
|
89
115
|
break;
|
|
90
116
|
}
|
|
91
117
|
return _context.abrupt("return", null);
|
|
92
|
-
case
|
|
118
|
+
case 39:
|
|
119
|
+
_context.next = 43;
|
|
120
|
+
break;
|
|
121
|
+
case 41:
|
|
122
|
+
if (allowDirtyVC) {
|
|
123
|
+
_context.next = 43;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return _context.abrupt("return", null);
|
|
127
|
+
case 43:
|
|
93
128
|
if (!(!lastInteractionFinish || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && lastInteractionFinish.abortReason || lastInteractionFinish !== null && lastInteractionFinish !== void 0 && (_lastInteractionFinis = lastInteractionFinish.errors) !== null && _lastInteractionFinis !== void 0 && _lastInteractionFinis.length)) {
|
|
94
|
-
_context.next =
|
|
129
|
+
_context.next = 45;
|
|
95
130
|
break;
|
|
96
131
|
}
|
|
97
132
|
return _context.abrupt("return", null);
|
|
98
|
-
case
|
|
133
|
+
case 45:
|
|
99
134
|
normalTTAI = (_getTTAI2 = getTTAI(lastInteractionFinish)) !== null && _getTTAI2 !== void 0 ? _getTTAI2 : undefined;
|
|
100
135
|
lastInteractionFinishStart = typeof lastInteractionFinish.start === 'number' ? Math.round(lastInteractionFinish.start) : undefined;
|
|
101
136
|
lastInteractionFinishEnd = typeof lastInteractionFinish.end === 'number' ? Math.round(lastInteractionFinish.end) : undefined;
|
|
102
137
|
lastInteractionFinishVC90 = null;
|
|
103
138
|
lastInteractionFinishVCClean = false;
|
|
104
139
|
if (!lastInteractionFinishVCResult) {
|
|
105
|
-
_context.next =
|
|
140
|
+
_context.next = 62;
|
|
106
141
|
break;
|
|
107
142
|
}
|
|
108
143
|
lastInteractionFinishVCRev = lastInteractionFinishVCResult['ufo:vc:rev'];
|
|
@@ -111,25 +146,29 @@ function _createInteractionExtraLogPayload() {
|
|
|
111
146
|
return revision === effectiveRevision;
|
|
112
147
|
});
|
|
113
148
|
if (!(lastInteractionFinishRevision !== null && lastInteractionFinishRevision !== void 0 && lastInteractionFinishRevision.clean)) {
|
|
114
|
-
_context.next =
|
|
149
|
+
_context.next = 58;
|
|
115
150
|
break;
|
|
116
151
|
}
|
|
117
152
|
lastInteractionFinishVCClean = true;
|
|
118
153
|
lastInteractionFinishVC90 = lastInteractionFinishRevision['metric:vc90'];
|
|
119
|
-
_context.next =
|
|
154
|
+
_context.next = 60;
|
|
120
155
|
break;
|
|
121
|
-
case
|
|
156
|
+
case 58:
|
|
157
|
+
if (allowDirtyVC) {
|
|
158
|
+
_context.next = 60;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
122
161
|
return _context.abrupt("return", null);
|
|
123
|
-
case
|
|
124
|
-
_context.next =
|
|
162
|
+
case 60:
|
|
163
|
+
_context.next = 63;
|
|
125
164
|
break;
|
|
126
|
-
case
|
|
165
|
+
case 62:
|
|
127
166
|
if (normalTTAI !== undefined && typeof normalTTAI === 'number' && normalTTAI === extraTTAI) {
|
|
128
167
|
// Because TTAI is equal between with and without 3p, we can assume VC90 is also equal
|
|
129
|
-
lastInteractionFinishVC90 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90'];
|
|
130
|
-
lastInteractionFinishVCClean = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean;
|
|
168
|
+
lastInteractionFinishVC90 = (_effectiveVCRevisionP3 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload['metric:vc90']) !== null && _effectiveVCRevisionP3 !== void 0 ? _effectiveVCRevisionP3 : null;
|
|
169
|
+
lastInteractionFinishVCClean = (_effectiveVCRevisionP4 = effectiveVCRevisionPayload === null || effectiveVCRevisionPayload === void 0 ? void 0 : effectiveVCRevisionPayload.clean) !== null && _effectiveVCRevisionP4 !== void 0 ? _effectiveVCRevisionP4 : false;
|
|
131
170
|
}
|
|
132
|
-
case
|
|
171
|
+
case 63:
|
|
133
172
|
// Helper function to check if labelStack contains third-party type
|
|
134
173
|
isThirdParty = function isThirdParty(labelStack) {
|
|
135
174
|
var _labelStack$some;
|
|
@@ -197,7 +236,7 @@ function _createInteractionExtraLogPayload() {
|
|
|
197
236
|
source: 'measured',
|
|
198
237
|
tags: ['observability'],
|
|
199
238
|
attributes: {
|
|
200
|
-
properties: {
|
|
239
|
+
properties: _objectSpread(_objectSpread({
|
|
201
240
|
// basic
|
|
202
241
|
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
203
242
|
'event:product': config.product,
|
|
@@ -235,6 +274,12 @@ function _createInteractionExtraLogPayload() {
|
|
|
235
274
|
reactProfilerTimings: optimizeReactProfilerTimings(filteredData.reactProfilerTimings, start, getReactUFOPayloadVersion(interaction.type)),
|
|
236
275
|
customData: filteredData.customData
|
|
237
276
|
}, getDetailedInteractionMetrics()),
|
|
277
|
+
vcClean: isVCCleanFor3p
|
|
278
|
+
}, vcAbortReasonFor3p !== undefined && {
|
|
279
|
+
vcAbortReason: vcAbortReasonFor3p
|
|
280
|
+
}), {}, {
|
|
281
|
+
hasMinorInteractions: hasMinorInteractions,
|
|
282
|
+
hasErrors: interaction.errors.length > 0,
|
|
238
283
|
'vc:effective:revision': effectiveRevision,
|
|
239
284
|
lastInteractionFinish: {
|
|
240
285
|
start: lastInteractionFinishStart,
|
|
@@ -243,12 +288,12 @@ function _createInteractionExtraLogPayload() {
|
|
|
243
288
|
vc90: lastInteractionFinishVC90,
|
|
244
289
|
vcClean: lastInteractionFinishVCClean
|
|
245
290
|
}
|
|
246
|
-
}
|
|
291
|
+
})
|
|
247
292
|
}
|
|
248
293
|
};
|
|
249
294
|
payload.attributes.properties['event:sizeInKb'] = getPayloadSize(payload.attributes.properties);
|
|
250
295
|
return _context.abrupt("return", payload);
|
|
251
|
-
case
|
|
296
|
+
case 72:
|
|
252
297
|
case "end":
|
|
253
298
|
return _context.stop();
|
|
254
299
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -199,6 +199,9 @@
|
|
|
199
199
|
},
|
|
200
200
|
"platform_ufo_fix_abort_timestamp_raw_data": {
|
|
201
201
|
"type": "boolean"
|
|
202
|
+
},
|
|
203
|
+
"platform_ufo_send_extra_metrics_on_dirty_vc": {
|
|
204
|
+
"type": "boolean"
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
207
|
}
|