@atlaskit/react-ufo 4.4.2 → 4.4.4
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 +18 -0
- package/dist/cjs/create-interaction-extra-metrics-payload/index.js +116 -0
- package/dist/cjs/create-payload/index.js +3 -2
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +37 -21
- package/dist/cjs/interaction-metrics/index.js +306 -232
- package/dist/cjs/interaction-metrics/interaction-extra-metrics.js +89 -0
- package/dist/cjs/interaction-metrics-init/index.js +51 -7
- package/dist/cjs/segment/third-party-segment.js +3 -1
- package/dist/cjs/ssr/index.js +3 -2
- package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +3 -8
- package/dist/cjs/vc/index.js +4 -3
- package/dist/cjs/vc/vc-observer/index.js +3 -46
- package/dist/cjs/vc/vc-observer-new/index.js +4 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
- package/dist/es2019/create-interaction-extra-metrics-payload/index.js +93 -0
- package/dist/es2019/create-payload/index.js +3 -3
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +3 -2
- package/dist/es2019/interaction-metrics/index.js +310 -233
- package/dist/es2019/interaction-metrics/interaction-extra-metrics.js +63 -0
- package/dist/es2019/interaction-metrics-init/index.js +29 -2
- package/dist/es2019/segment/third-party-segment.js +3 -1
- package/dist/es2019/ssr/index.js +3 -2
- package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +3 -8
- package/dist/es2019/vc/index.js +4 -2
- package/dist/es2019/vc/vc-observer/index.js +0 -43
- package/dist/es2019/vc/vc-observer-new/index.js +4 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -2
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
- package/dist/esm/create-interaction-extra-metrics-payload/index.js +109 -0
- package/dist/esm/create-payload/index.js +3 -3
- package/dist/esm/create-payload/utils/get-vc-metrics.js +37 -21
- package/dist/esm/interaction-metrics/index.js +305 -231
- package/dist/esm/interaction-metrics/interaction-extra-metrics.js +83 -0
- package/dist/esm/interaction-metrics-init/index.js +48 -6
- package/dist/esm/segment/third-party-segment.js +3 -1
- package/dist/esm/ssr/index.js +3 -2
- package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +3 -8
- package/dist/esm/vc/index.js +4 -3
- package/dist/esm/vc/vc-observer/index.js +3 -46
- package/dist/esm/vc/vc-observer-new/index.js +4 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +3 -3
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +4 -4
- package/dist/types/common/common/types.d.ts +2 -0
- package/dist/types/create-interaction-extra-metrics-payload/index.d.ts +45 -0
- package/dist/types/create-payload/index.d.ts +1 -0
- package/dist/types/create-payload/utils/get-vc-metrics.d.ts +1 -1
- package/dist/types/interaction-metrics/index.d.ts +2 -0
- package/dist/types/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
- package/dist/types/vc/types.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/dist/types/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/types.d.ts +1 -0
- package/dist/types-ts4.5/common/common/types.d.ts +2 -0
- package/dist/types-ts4.5/create-interaction-extra-metrics-payload/index.d.ts +45 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +1 -0
- package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +1 -1
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +2 -0
- package/dist/types-ts4.5/interaction-metrics/interaction-extra-metrics.d.ts +17 -0
- package/dist/types-ts4.5/vc/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +2 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +1 -1
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/types.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +1 -0
- package/package.json +4 -10
|
@@ -10,12 +10,14 @@ import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature
|
|
|
10
10
|
import { getInteractionId } from '../interaction-id-context';
|
|
11
11
|
import { newVCObserver } from '../vc';
|
|
12
12
|
import { interactions } from './common/constants';
|
|
13
|
+
import InteractionExtraMetrics from './interaction-extra-metrics';
|
|
13
14
|
import PostInteractionLog from './post-interaction-log';
|
|
14
15
|
const PreviousInteractionLog = {
|
|
15
16
|
name: undefined,
|
|
16
17
|
isAborted: undefined
|
|
17
18
|
};
|
|
18
19
|
export const postInteractionLog = new PostInteractionLog();
|
|
20
|
+
export const interactionExtraMetrics = new InteractionExtraMetrics();
|
|
19
21
|
const interactionQueue = [];
|
|
20
22
|
const segmentCache = new Map();
|
|
21
23
|
export const segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
@@ -158,23 +160,16 @@ export function addCustomTiming(interactionId, labelStack, data) {
|
|
|
158
160
|
} = timingData;
|
|
159
161
|
try {
|
|
160
162
|
// for Firefox 102 and older
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
color: 'tertiary-light'
|
|
169
|
-
}
|
|
163
|
+
performance.measure(`🛸 ${labelStackToString(labelStack, key)} [custom_timing]`, {
|
|
164
|
+
start: startTime,
|
|
165
|
+
end: endTime,
|
|
166
|
+
detail: {
|
|
167
|
+
devtools: {
|
|
168
|
+
track: '🛸 reactUFO detailed timings',
|
|
169
|
+
color: 'tertiary-light'
|
|
170
170
|
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
performance.measure(`🛸 ${labelStackToString(labelStack, key)} [custom_timing]`, {
|
|
174
|
-
start: startTime,
|
|
175
|
-
end: endTime
|
|
176
|
-
});
|
|
177
|
-
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
178
173
|
} catch (e) {
|
|
179
174
|
// do nothing
|
|
180
175
|
}
|
|
@@ -227,23 +222,16 @@ export function addSpan(interactionId, type, name, labelStack, start, end = perf
|
|
|
227
222
|
if (isPerformanceTracingEnabled()) {
|
|
228
223
|
try {
|
|
229
224
|
// for Firefox 102 and older
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
color: 'secondary'
|
|
238
|
-
}
|
|
225
|
+
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
226
|
+
start,
|
|
227
|
+
end,
|
|
228
|
+
detail: {
|
|
229
|
+
devtools: {
|
|
230
|
+
track: '🛸 reactUFO detailed timings',
|
|
231
|
+
color: 'secondary'
|
|
239
232
|
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
243
|
-
start,
|
|
244
|
-
end
|
|
245
|
-
});
|
|
246
|
-
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
247
235
|
} catch (e) {
|
|
248
236
|
// do nothing
|
|
249
237
|
}
|
|
@@ -264,23 +252,16 @@ export function addSpanToAll(type, name, labelStack, start, end = performance.no
|
|
|
264
252
|
if (isPerformanceTracingEnabled()) {
|
|
265
253
|
try {
|
|
266
254
|
// for Firefox 102 and older
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
color: 'secondary'
|
|
275
|
-
}
|
|
255
|
+
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
256
|
+
start,
|
|
257
|
+
end,
|
|
258
|
+
detail: {
|
|
259
|
+
devtools: {
|
|
260
|
+
track: '🛸 reactUFO detailed timings',
|
|
261
|
+
color: 'secondary'
|
|
276
262
|
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [${type}]`, {
|
|
280
|
-
start,
|
|
281
|
-
end
|
|
282
|
-
});
|
|
283
|
-
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
284
265
|
} catch (e) {
|
|
285
266
|
// do nothing
|
|
286
267
|
}
|
|
@@ -318,48 +299,60 @@ export function addHold(interactionId, labelStack, name, experimental) {
|
|
|
318
299
|
const interaction = interactions.get(interactionId);
|
|
319
300
|
const id = createUUID();
|
|
320
301
|
if (interaction != null) {
|
|
321
|
-
var _getConfig2, _getConfig2$experimen;
|
|
322
302
|
const start = performance.now();
|
|
323
303
|
const holdActive = {
|
|
324
304
|
labelStack,
|
|
325
305
|
name,
|
|
326
306
|
start
|
|
327
307
|
};
|
|
328
|
-
if ((
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
308
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
309
|
+
const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
|
|
310
|
+
if (is3pHold) {
|
|
311
|
+
if (!interaction.hold3pActive) {
|
|
312
|
+
interaction.hold3pActive = new Map();
|
|
313
|
+
}
|
|
314
|
+
interaction.hold3pActive.set(id, {
|
|
315
|
+
...holdActive,
|
|
316
|
+
start
|
|
317
|
+
});
|
|
318
|
+
} else {
|
|
319
|
+
interaction.holdActive.set(id, {
|
|
320
|
+
...holdActive,
|
|
321
|
+
start
|
|
322
|
+
});
|
|
323
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
var _getConfig2, _getConfig2$experimen;
|
|
327
|
+
if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2$experimen = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2$experimen !== void 0 && _getConfig2$experimen.enabled && experimental) {
|
|
328
|
+
interaction.holdExpActive.set(id, {
|
|
329
|
+
...holdActive,
|
|
330
|
+
start
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (!experimental) {
|
|
334
|
+
interaction.holdActive.set(id, {
|
|
335
|
+
...holdActive,
|
|
336
|
+
start
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
339
340
|
}
|
|
340
|
-
addHoldCriterion(id, labelStack, name, start);
|
|
341
341
|
return () => {
|
|
342
342
|
const end = performance.now();
|
|
343
343
|
if (isPerformanceTracingEnabled()) {
|
|
344
344
|
try {
|
|
345
345
|
// for Firefox 102 and older
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
color: 'secondary-light'
|
|
354
|
-
}
|
|
346
|
+
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
|
|
347
|
+
start,
|
|
348
|
+
end,
|
|
349
|
+
detail: {
|
|
350
|
+
devtools: {
|
|
351
|
+
track: '🛸 reactUFO detailed timings',
|
|
352
|
+
color: 'secondary-light'
|
|
355
353
|
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
performance.measure(`🛸 ${labelStackToString(labelStack, name)} [hold]`, {
|
|
359
|
-
start,
|
|
360
|
-
end
|
|
361
|
-
});
|
|
362
|
-
}
|
|
354
|
+
}
|
|
355
|
+
});
|
|
363
356
|
} catch (e) {
|
|
364
357
|
// do nothing
|
|
365
358
|
}
|
|
@@ -383,6 +376,21 @@ export function addHold(interactionId, labelStack, name, experimental) {
|
|
|
383
376
|
});
|
|
384
377
|
interaction.holdExpActive.delete(id);
|
|
385
378
|
}
|
|
379
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
380
|
+
if (interaction.hold3pActive) {
|
|
381
|
+
const current3pHold = interaction.hold3pActive.get(id);
|
|
382
|
+
if (current3pHold != null) {
|
|
383
|
+
if (!currentInteraction.hold3pInfo) {
|
|
384
|
+
currentInteraction.hold3pInfo = [];
|
|
385
|
+
}
|
|
386
|
+
currentInteraction.hold3pInfo.push({
|
|
387
|
+
...current3pHold,
|
|
388
|
+
end
|
|
389
|
+
});
|
|
390
|
+
interaction.hold3pActive.delete(id);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
386
394
|
}
|
|
387
395
|
};
|
|
388
396
|
}
|
|
@@ -392,13 +400,36 @@ export function addHoldByID(interactionId, labelStack, name, id, ignoreOnSubmit)
|
|
|
392
400
|
const interaction = interactions.get(interactionId);
|
|
393
401
|
if (interaction != null) {
|
|
394
402
|
const start = performance.now();
|
|
395
|
-
|
|
396
|
-
labelStack
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
403
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
404
|
+
const is3pHold = labelStack.some(l => 'type' in l && l.type === 'third-party');
|
|
405
|
+
if (is3pHold) {
|
|
406
|
+
if (!interaction.hold3pActive) {
|
|
407
|
+
interaction.hold3pActive = new Map();
|
|
408
|
+
}
|
|
409
|
+
interaction.hold3pActive.set(id, {
|
|
410
|
+
labelStack,
|
|
411
|
+
name,
|
|
412
|
+
start,
|
|
413
|
+
ignoreOnSubmit
|
|
414
|
+
});
|
|
415
|
+
} else {
|
|
416
|
+
interaction.holdActive.set(id, {
|
|
417
|
+
labelStack,
|
|
418
|
+
name,
|
|
419
|
+
start,
|
|
420
|
+
ignoreOnSubmit
|
|
421
|
+
});
|
|
422
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
interaction.holdActive.set(id, {
|
|
426
|
+
labelStack,
|
|
427
|
+
name,
|
|
428
|
+
start,
|
|
429
|
+
ignoreOnSubmit
|
|
430
|
+
});
|
|
431
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
432
|
+
}
|
|
402
433
|
}
|
|
403
434
|
return () => {};
|
|
404
435
|
}
|
|
@@ -416,6 +447,21 @@ export function removeHoldByID(interactionId, id) {
|
|
|
416
447
|
interaction.holdActive.delete(id);
|
|
417
448
|
removeHoldCriterion(id);
|
|
418
449
|
}
|
|
450
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
451
|
+
if (interaction.hold3pActive) {
|
|
452
|
+
const current3pHold = interaction.hold3pActive.get(id);
|
|
453
|
+
if (currentInteraction != null && current3pHold != null) {
|
|
454
|
+
if (!currentInteraction.hold3pInfo) {
|
|
455
|
+
currentInteraction.hold3pInfo = [];
|
|
456
|
+
}
|
|
457
|
+
currentInteraction.hold3pInfo.push({
|
|
458
|
+
...current3pHold,
|
|
459
|
+
end
|
|
460
|
+
});
|
|
461
|
+
interaction.hold3pActive.delete(id);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
419
465
|
}
|
|
420
466
|
}
|
|
421
467
|
export function getCurrentInteractionType(interactionId) {
|
|
@@ -489,23 +535,16 @@ export function addProfilerTimings(interactionId, labelStack, type, actualDurati
|
|
|
489
535
|
if (isPerformanceTracingEnabled()) {
|
|
490
536
|
try {
|
|
491
537
|
// for Firefox 102 and older
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
color: 'secondary-dark'
|
|
500
|
-
}
|
|
538
|
+
performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
|
|
539
|
+
start: startTime,
|
|
540
|
+
duration: actualDuration,
|
|
541
|
+
detail: {
|
|
542
|
+
devtools: {
|
|
543
|
+
track: '🛸 reactUFO detailed timings',
|
|
544
|
+
color: 'secondary-dark'
|
|
501
545
|
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
performance.measure(`🛸 ${labelStackToString(labelStack)} [react-profiler] ${type}`, {
|
|
505
|
-
start: startTime,
|
|
506
|
-
duration: actualDuration
|
|
507
|
-
});
|
|
508
|
-
}
|
|
546
|
+
}
|
|
547
|
+
});
|
|
509
548
|
} catch (e) {
|
|
510
549
|
// do nothing
|
|
511
550
|
}
|
|
@@ -537,37 +576,29 @@ function callCleanUpCallbacks(interaction) {
|
|
|
537
576
|
});
|
|
538
577
|
}
|
|
539
578
|
function finishInteraction(id, data, endTime = performance.now()) {
|
|
540
|
-
var _getConfig4, _getConfig4$vc
|
|
579
|
+
var _getConfig4, _getConfig4$vc;
|
|
541
580
|
data.end = endTime;
|
|
542
581
|
try {
|
|
543
582
|
// for Firefox 102 and older
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
553
|
-
color: 'tertiary'
|
|
554
|
-
}
|
|
583
|
+
performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
|
|
584
|
+
start: data.start,
|
|
585
|
+
end: data.end,
|
|
586
|
+
detail: {
|
|
587
|
+
devtools: {
|
|
588
|
+
track: 'main metrics',
|
|
589
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
590
|
+
color: 'tertiary'
|
|
555
591
|
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
performance.mark(`TTAI`, {
|
|
595
|
+
startTime: data.end,
|
|
596
|
+
detail: {
|
|
597
|
+
devtools: {
|
|
598
|
+
dataType: 'marker'
|
|
563
599
|
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
performance.measure(`🛸 [${data.type}] ${data.ufoName} [ttai]`, {
|
|
567
|
-
start: data.start,
|
|
568
|
-
end: data.end
|
|
569
|
-
});
|
|
570
|
-
}
|
|
600
|
+
}
|
|
601
|
+
});
|
|
571
602
|
} catch (e) {
|
|
572
603
|
// do nothing
|
|
573
604
|
}
|
|
@@ -596,13 +627,31 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
596
627
|
postInteractionLog.stopVCObserver();
|
|
597
628
|
}
|
|
598
629
|
}
|
|
599
|
-
if (
|
|
600
|
-
|
|
630
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
631
|
+
if (!data.hold3pActive || data.hold3pActive.size === 0) {
|
|
632
|
+
var _getConfig5, _getConfig5$experimen;
|
|
633
|
+
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5$experimen = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5$experimen !== void 0 && _getConfig5$experimen.enabled)) {
|
|
634
|
+
remove(id);
|
|
635
|
+
}
|
|
636
|
+
interactionExtraMetrics.stopVCObserver();
|
|
637
|
+
}
|
|
638
|
+
} else {
|
|
639
|
+
var _getConfig6, _getConfig6$experimen;
|
|
640
|
+
if (!((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6$experimen = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6$experimen !== void 0 && _getConfig6$experimen.enabled)) {
|
|
641
|
+
remove(id);
|
|
642
|
+
}
|
|
601
643
|
}
|
|
602
644
|
PreviousInteractionLog.name = data.ufoName || 'unknown';
|
|
603
645
|
PreviousInteractionLog.isAborted = data.abortReason != null;
|
|
604
646
|
if (data.ufoName) {
|
|
605
|
-
|
|
647
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
648
|
+
if (interactionExtraMetrics.finishedInteractionId !== id) {
|
|
649
|
+
// If this same interaction was not already handled, handle it
|
|
650
|
+
handleInteraction(id, data);
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
653
|
+
handleInteraction(id, data);
|
|
654
|
+
}
|
|
606
655
|
}
|
|
607
656
|
if (isPerformanceTracingEnabled()) {
|
|
608
657
|
const profilerTimingMap = new Map();
|
|
@@ -625,23 +674,16 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
625
674
|
start,
|
|
626
675
|
end
|
|
627
676
|
}] of profilerTimingMap.entries()) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
color: 'secondary-dark'
|
|
636
|
-
}
|
|
677
|
+
performance.measure(`🛸 ${labelStackToString(labelStack)} [segment_ttai]`, {
|
|
678
|
+
start,
|
|
679
|
+
end,
|
|
680
|
+
detail: {
|
|
681
|
+
devtools: {
|
|
682
|
+
track: '🛸 reactUFO detailed timings',
|
|
683
|
+
color: 'secondary-dark'
|
|
637
684
|
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
performance.measure(`🛸 ${labelStackToString(labelStack)} [segment_ttai]`, {
|
|
641
|
-
start,
|
|
642
|
-
end
|
|
643
|
-
});
|
|
644
|
-
}
|
|
685
|
+
}
|
|
686
|
+
});
|
|
645
687
|
}
|
|
646
688
|
} catch (e) {
|
|
647
689
|
// do nothing
|
|
@@ -677,12 +719,12 @@ export function tryComplete(interactionId, endTime) {
|
|
|
677
719
|
const noMoreActiveHolds = interaction.holdActive.size === 0;
|
|
678
720
|
const noMoreExpHolds = interaction.holdExpActive.size === 0;
|
|
679
721
|
const postInteraction = async () => {
|
|
680
|
-
var
|
|
681
|
-
if ((
|
|
682
|
-
var
|
|
722
|
+
var _getConfig7, _getConfig7$postInter;
|
|
723
|
+
if ((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7$postInter = _getConfig7.postInteractionLog) !== null && _getConfig7$postInter !== void 0 && _getConfig7$postInter.enabled) {
|
|
724
|
+
var _getConfig8, _getConfig8$experimen;
|
|
683
725
|
let experimentalVC90;
|
|
684
726
|
let experimentalTTAI;
|
|
685
|
-
if ((
|
|
727
|
+
if ((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8$experimen = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8$experimen !== void 0 && _getConfig8$experimen.enabled) {
|
|
686
728
|
var _await$getExperimenta;
|
|
687
729
|
experimentalVC90 = (_await$getExperimenta = await getExperimentalVCMetrics(interaction)) === null || _await$getExperimenta === void 0 ? void 0 : _await$getExperimenta['metric:experimental:vc90'];
|
|
688
730
|
const {
|
|
@@ -697,22 +739,59 @@ export function tryComplete(interactionId, endTime) {
|
|
|
697
739
|
experimentalVC90
|
|
698
740
|
});
|
|
699
741
|
}
|
|
700
|
-
if ((
|
|
701
|
-
|
|
742
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
743
|
+
if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
|
|
744
|
+
var _getConfig9, _getConfig9$experimen;
|
|
745
|
+
// If interactionExtraMetrics is not waiting for measuring this interaction
|
|
746
|
+
if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9$experimen = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9$experimen !== void 0 && _getConfig9$experimen.enabled) {
|
|
747
|
+
remove(interactionId);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
var _getConfig0, _getConfig0$experimen;
|
|
752
|
+
if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0$experimen = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0$experimen !== void 0 && _getConfig0$experimen.enabled) {
|
|
753
|
+
remove(interactionId);
|
|
754
|
+
}
|
|
702
755
|
}
|
|
703
756
|
activeSubmitted = false;
|
|
704
757
|
};
|
|
705
|
-
if (
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
758
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
759
|
+
var _interaction$hold3pAc;
|
|
760
|
+
const noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
|
|
761
|
+
if (noMoreActiveHolds) {
|
|
762
|
+
if (!activeSubmitted) {
|
|
763
|
+
finishInteraction(interactionId, interaction, endTime);
|
|
764
|
+
interactionExtraMetrics.updateFinishedInteractionId(interactionId);
|
|
765
|
+
activeSubmitted = true;
|
|
766
|
+
}
|
|
767
|
+
if (noMoreExpHolds) {
|
|
768
|
+
var _getConfig1, _getConfig1$experimen;
|
|
769
|
+
if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1$experimen = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1$experimen !== void 0 && _getConfig1$experimen.enabled) {
|
|
770
|
+
onExperimentalInteractionComplete(interactionId, interaction, endTime);
|
|
771
|
+
}
|
|
772
|
+
postInteraction();
|
|
773
|
+
}
|
|
774
|
+
if (noMoreActive3pHolds) {
|
|
775
|
+
const data = {
|
|
776
|
+
...interaction,
|
|
777
|
+
end: endTime
|
|
778
|
+
};
|
|
779
|
+
interactionExtraMetrics.onInteractionComplete(interactionId, data);
|
|
780
|
+
}
|
|
709
781
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (
|
|
713
|
-
|
|
782
|
+
} else {
|
|
783
|
+
if (noMoreActiveHolds) {
|
|
784
|
+
if (!activeSubmitted) {
|
|
785
|
+
finishInteraction(interactionId, interaction, endTime);
|
|
786
|
+
activeSubmitted = true;
|
|
787
|
+
}
|
|
788
|
+
if (noMoreExpHolds) {
|
|
789
|
+
var _getConfig10, _getConfig10$experime;
|
|
790
|
+
if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10$experime = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10$experime !== void 0 && _getConfig10$experime.enabled) {
|
|
791
|
+
onExperimentalInteractionComplete(interactionId, interaction, endTime);
|
|
792
|
+
}
|
|
793
|
+
postInteraction();
|
|
714
794
|
}
|
|
715
|
-
postInteraction();
|
|
716
795
|
}
|
|
717
796
|
}
|
|
718
797
|
}
|
|
@@ -740,6 +819,11 @@ export function abort(interactionId, abortReason) {
|
|
|
740
819
|
finishInteraction(interactionId, interaction);
|
|
741
820
|
postInteractionLog.reset();
|
|
742
821
|
postInteractionLog.stopVCObserver();
|
|
822
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
823
|
+
interactionExtraMetrics.stopVCObserver();
|
|
824
|
+
interactionExtraMetrics.reset();
|
|
825
|
+
remove(interactionId);
|
|
826
|
+
}
|
|
743
827
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
744
828
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
745
829
|
remove(interactionId);
|
|
@@ -765,6 +849,11 @@ export function abortByNewInteraction(interactionId, interactionName) {
|
|
|
765
849
|
finishInteraction(interactionId, interaction);
|
|
766
850
|
postInteractionLog.reset();
|
|
767
851
|
postInteractionLog.stopVCObserver();
|
|
852
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
853
|
+
interactionExtraMetrics.stopVCObserver();
|
|
854
|
+
interactionExtraMetrics.reset();
|
|
855
|
+
remove(interactionId);
|
|
856
|
+
}
|
|
768
857
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
769
858
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
770
859
|
remove(interactionId);
|
|
@@ -794,6 +883,11 @@ export function abortAll(abortReason, abortedByInteractionName) {
|
|
|
794
883
|
finishInteraction(interactionId, interaction);
|
|
795
884
|
postInteractionLog.reset();
|
|
796
885
|
postInteractionLog.stopVCObserver();
|
|
886
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
887
|
+
interactionExtraMetrics.stopVCObserver();
|
|
888
|
+
interactionExtraMetrics.reset();
|
|
889
|
+
remove(interactionId);
|
|
890
|
+
}
|
|
797
891
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
798
892
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
799
893
|
remove(interactionId);
|
|
@@ -890,7 +984,9 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
890
984
|
timerID,
|
|
891
985
|
changeTimeout,
|
|
892
986
|
trace,
|
|
893
|
-
vcObserver
|
|
987
|
+
vcObserver,
|
|
988
|
+
hold3pActive: new Map(),
|
|
989
|
+
hold3pInfo: []
|
|
894
990
|
};
|
|
895
991
|
if (addFeatureFlagsToInteraction) {
|
|
896
992
|
currentFeatureFlagsAccessed.clear();
|
|
@@ -929,10 +1025,10 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
929
1025
|
});
|
|
930
1026
|
}
|
|
931
1027
|
if (fg('platform_ufo_post_interaction_check_name')) {
|
|
932
|
-
var
|
|
1028
|
+
var _getConfig11, _getConfig11$postInte;
|
|
933
1029
|
// Start post interaction observer for all if config is enabled
|
|
934
1030
|
// in case ufoName is updated at later time
|
|
935
|
-
if ((
|
|
1031
|
+
if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11$postInte = _getConfig11.postInteractionLog) !== null && _getConfig11$postInte !== void 0 && _getConfig11$postInte.enabled) {
|
|
936
1032
|
postInteractionLog.startVCObserver({
|
|
937
1033
|
startTime
|
|
938
1034
|
});
|
|
@@ -949,6 +1045,11 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
949
1045
|
startTime
|
|
950
1046
|
});
|
|
951
1047
|
}
|
|
1048
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
1049
|
+
interactionExtraMetrics.startVCObserver({
|
|
1050
|
+
startTime
|
|
1051
|
+
}, interactionId);
|
|
1052
|
+
}
|
|
952
1053
|
}
|
|
953
1054
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
954
1055
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
@@ -976,35 +1077,27 @@ export function addApdexToAll(apdex) {
|
|
|
976
1077
|
interactions.forEach((interaction, key) => {
|
|
977
1078
|
interaction.apdex.push(apdex);
|
|
978
1079
|
try {
|
|
1080
|
+
var _apdex$startTime;
|
|
979
1081
|
// for Firefox 102 and older
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
989
|
-
color: 'primary-dark'
|
|
990
|
-
}
|
|
1082
|
+
performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
|
|
1083
|
+
start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
|
|
1084
|
+
end: apdex.stopTime,
|
|
1085
|
+
detail: {
|
|
1086
|
+
devtools: {
|
|
1087
|
+
track: 'main metrics',
|
|
1088
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
1089
|
+
color: 'primary-dark'
|
|
991
1090
|
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
performance.mark(`[bm3] TTI`, {
|
|
1094
|
+
startTime: apdex.stopTime,
|
|
1095
|
+
detail: {
|
|
1096
|
+
devtools: {
|
|
1097
|
+
dataType: 'marker'
|
|
999
1098
|
}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
var _apdex$startTime2;
|
|
1003
|
-
performance.measure(`🛸 ${apdex.key} [bm3_tti]`, {
|
|
1004
|
-
start: (_apdex$startTime2 = apdex.startTime) !== null && _apdex$startTime2 !== void 0 ? _apdex$startTime2 : interaction.start,
|
|
1005
|
-
end: apdex.stopTime
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1008
1101
|
} catch (e) {
|
|
1009
1102
|
// do nothing
|
|
1010
1103
|
}
|
|
@@ -1018,35 +1111,27 @@ export function addApdex(interactionId, apdexInfo) {
|
|
|
1018
1111
|
if (interaction != null) {
|
|
1019
1112
|
interaction.apdex.push(apdexInfo);
|
|
1020
1113
|
try {
|
|
1114
|
+
var _apdexInfo$startTime;
|
|
1021
1115
|
// for Firefox 102 and older
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
1031
|
-
color: 'primary-dark'
|
|
1032
|
-
}
|
|
1116
|
+
performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
|
|
1117
|
+
start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
|
|
1118
|
+
end: apdexInfo.stopTime,
|
|
1119
|
+
detail: {
|
|
1120
|
+
devtools: {
|
|
1121
|
+
track: 'main metrics',
|
|
1122
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
1123
|
+
color: 'primary-dark'
|
|
1033
1124
|
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1125
|
+
}
|
|
1126
|
+
});
|
|
1127
|
+
performance.mark(`[bm3] TTI`, {
|
|
1128
|
+
startTime: apdexInfo.stopTime,
|
|
1129
|
+
detail: {
|
|
1130
|
+
devtools: {
|
|
1131
|
+
dataType: 'marker'
|
|
1041
1132
|
}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
var _apdexInfo$startTime2;
|
|
1045
|
-
performance.measure(`🛸 ${apdexInfo.key} [bm3_tti]`, {
|
|
1046
|
-
start: (_apdexInfo$startTime2 = apdexInfo.startTime) !== null && _apdexInfo$startTime2 !== void 0 ? _apdexInfo$startTime2 : interaction.start,
|
|
1047
|
-
end: apdexInfo.stopTime
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1050
1135
|
} catch (e) {
|
|
1051
1136
|
// do nothing
|
|
1052
1137
|
}
|
|
@@ -1114,26 +1199,18 @@ export function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteNa
|
|
|
1114
1199
|
if (isPerformanceTracingEnabled()) {
|
|
1115
1200
|
const prevRedirect = interaction.redirects.at(-2);
|
|
1116
1201
|
try {
|
|
1202
|
+
var _prevRedirect$time;
|
|
1117
1203
|
// for Firefox 102 and older
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
track: '🛸 reactUFO detailed timings',
|
|
1126
|
-
color: 'tertiary'
|
|
1127
|
-
}
|
|
1204
|
+
performance.measure(`🛸 ${nextUfoName} [redirect]`, {
|
|
1205
|
+
start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
|
|
1206
|
+
end: time,
|
|
1207
|
+
detail: {
|
|
1208
|
+
devtools: {
|
|
1209
|
+
track: '🛸 reactUFO detailed timings',
|
|
1210
|
+
color: 'tertiary'
|
|
1128
1211
|
}
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
var _prevRedirect$time2;
|
|
1132
|
-
performance.measure(`🛸 ${nextUfoName} [redirect]`, {
|
|
1133
|
-
start: (_prevRedirect$time2 = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time2 !== void 0 ? _prevRedirect$time2 : interaction.start,
|
|
1134
|
-
end: time
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1137
1214
|
} catch (e) {
|
|
1138
1215
|
// do nothing
|
|
1139
1216
|
}
|