@atlaskit/react-ufo 4.4.3 → 4.4.5
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 +20 -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 +313 -259
- 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/vc/index.js +4 -3
- package/dist/cjs/vc/vc-observer/index.js +31 -51
- 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 +7 -5
- package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +15 -6
- 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 +317 -260
- 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/vc/index.js +4 -2
- package/dist/es2019/vc/vc-observer/index.js +41 -61
- 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 +7 -3
- package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +12 -5
- 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 +312 -258
- 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/vc/index.js +4 -3
- package/dist/esm/vc/vc-observer/index.js +31 -51
- 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 +7 -5
- package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +15 -6
- package/dist/types/common/common/types.d.ts +2 -0
- package/dist/types/common/vc/types.d.ts +1 -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/getVCRevisionDebugDetails.d.ts +1 -0
- package/dist/types/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +3 -2
- package/dist/types/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
- 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/common/vc/types.d.ts +1 -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/getVCRevisionDebugDetails.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.d.ts +3 -2
- package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/fy25_03/index.d.ts +2 -2
- 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 +7 -10
|
@@ -20,12 +20,14 @@ import { allFeatureFlagsAccessed, currentFeatureFlagsAccessed } from '../feature
|
|
|
20
20
|
import { getInteractionId } from '../interaction-id-context';
|
|
21
21
|
import { newVCObserver } from '../vc';
|
|
22
22
|
import { interactions } from './common/constants';
|
|
23
|
+
import InteractionExtraMetrics from './interaction-extra-metrics';
|
|
23
24
|
import PostInteractionLog from './post-interaction-log';
|
|
24
25
|
var PreviousInteractionLog = {
|
|
25
26
|
name: undefined,
|
|
26
27
|
isAborted: undefined
|
|
27
28
|
};
|
|
28
29
|
export var postInteractionLog = new PostInteractionLog();
|
|
30
|
+
export var interactionExtraMetrics = new InteractionExtraMetrics();
|
|
29
31
|
var interactionQueue = [];
|
|
30
32
|
var segmentCache = new Map();
|
|
31
33
|
export var segmentUnmountCache = new Map(); // Temporarily store segment unmount counts
|
|
@@ -192,23 +194,16 @@ export function addCustomTiming(interactionId, labelStack, data) {
|
|
|
192
194
|
endTime = timingData.endTime;
|
|
193
195
|
try {
|
|
194
196
|
// for Firefox 102 and older
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
color: 'tertiary-light'
|
|
203
|
-
}
|
|
197
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, key), " [custom_timing]"), {
|
|
198
|
+
start: startTime,
|
|
199
|
+
end: endTime,
|
|
200
|
+
detail: {
|
|
201
|
+
devtools: {
|
|
202
|
+
track: '🛸 reactUFO detailed timings',
|
|
203
|
+
color: 'tertiary-light'
|
|
204
204
|
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, key), " [custom_timing]"), {
|
|
208
|
-
start: startTime,
|
|
209
|
-
end: endTime
|
|
210
|
-
});
|
|
211
|
-
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
212
207
|
} catch (e) {
|
|
213
208
|
// do nothing
|
|
214
209
|
}
|
|
@@ -265,23 +260,16 @@ export function addSpan(interactionId, type, name, labelStack, start) {
|
|
|
265
260
|
if (isPerformanceTracingEnabled()) {
|
|
266
261
|
try {
|
|
267
262
|
// for Firefox 102 and older
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
color: 'secondary'
|
|
276
|
-
}
|
|
263
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
264
|
+
start: start,
|
|
265
|
+
end: end,
|
|
266
|
+
detail: {
|
|
267
|
+
devtools: {
|
|
268
|
+
track: '🛸 reactUFO detailed timings',
|
|
269
|
+
color: 'secondary'
|
|
277
270
|
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
281
|
-
start: start,
|
|
282
|
-
end: end
|
|
283
|
-
});
|
|
284
|
-
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
285
273
|
} catch (e) {
|
|
286
274
|
// do nothing
|
|
287
275
|
}
|
|
@@ -304,23 +292,16 @@ export function addSpanToAll(type, name, labelStack, start) {
|
|
|
304
292
|
if (isPerformanceTracingEnabled()) {
|
|
305
293
|
try {
|
|
306
294
|
// for Firefox 102 and older
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
color: 'secondary'
|
|
315
|
-
}
|
|
295
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
296
|
+
start: start,
|
|
297
|
+
end: end,
|
|
298
|
+
detail: {
|
|
299
|
+
devtools: {
|
|
300
|
+
track: '🛸 reactUFO detailed timings',
|
|
301
|
+
color: 'secondary'
|
|
316
302
|
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [").concat(type, "]"), {
|
|
320
|
-
start: start,
|
|
321
|
-
end: end
|
|
322
|
-
});
|
|
323
|
-
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
324
305
|
} catch (e) {
|
|
325
306
|
// do nothing
|
|
326
307
|
}
|
|
@@ -358,46 +339,58 @@ export function addHold(interactionId, labelStack, name, experimental) {
|
|
|
358
339
|
var interaction = interactions.get(interactionId);
|
|
359
340
|
var id = createUUID();
|
|
360
341
|
if (interaction != null) {
|
|
361
|
-
var _getConfig2;
|
|
362
342
|
var start = performance.now();
|
|
363
343
|
var holdActive = {
|
|
364
344
|
labelStack: labelStack,
|
|
365
345
|
name: name,
|
|
366
346
|
start: start
|
|
367
347
|
};
|
|
368
|
-
if ((
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
348
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
349
|
+
var is3pHold = labelStack.some(function (l) {
|
|
350
|
+
return 'type' in l && l.type === 'third-party';
|
|
351
|
+
});
|
|
352
|
+
if (is3pHold) {
|
|
353
|
+
if (!interaction.hold3pActive) {
|
|
354
|
+
interaction.hold3pActive = new Map();
|
|
355
|
+
}
|
|
356
|
+
interaction.hold3pActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
|
|
357
|
+
start: start
|
|
358
|
+
}));
|
|
359
|
+
} else {
|
|
360
|
+
interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
|
|
361
|
+
start: start
|
|
362
|
+
}));
|
|
363
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
var _getConfig2;
|
|
367
|
+
if ((_getConfig2 = getConfig()) !== null && _getConfig2 !== void 0 && (_getConfig2 = _getConfig2.experimentalInteractionMetrics) !== null && _getConfig2 !== void 0 && _getConfig2.enabled && experimental) {
|
|
368
|
+
interaction.holdExpActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
|
|
369
|
+
start: start
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
if (!experimental) {
|
|
373
|
+
interaction.holdActive.set(id, _objectSpread(_objectSpread({}, holdActive), {}, {
|
|
374
|
+
start: start
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
377
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
377
378
|
}
|
|
378
|
-
addHoldCriterion(id, labelStack, name, start);
|
|
379
379
|
return function () {
|
|
380
380
|
var end = performance.now();
|
|
381
381
|
if (isPerformanceTracingEnabled()) {
|
|
382
382
|
try {
|
|
383
383
|
// for Firefox 102 and older
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
color: 'secondary-light'
|
|
392
|
-
}
|
|
384
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
|
|
385
|
+
start: start,
|
|
386
|
+
end: end,
|
|
387
|
+
detail: {
|
|
388
|
+
devtools: {
|
|
389
|
+
track: '🛸 reactUFO detailed timings',
|
|
390
|
+
color: 'secondary-light'
|
|
393
391
|
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack, name), " [hold]"), {
|
|
397
|
-
start: start,
|
|
398
|
-
end: end
|
|
399
|
-
});
|
|
400
|
-
}
|
|
392
|
+
}
|
|
393
|
+
});
|
|
401
394
|
} catch (e) {
|
|
402
395
|
// do nothing
|
|
403
396
|
}
|
|
@@ -419,6 +412,20 @@ export function addHold(interactionId, labelStack, name, experimental) {
|
|
|
419
412
|
}));
|
|
420
413
|
interaction.holdExpActive.delete(id);
|
|
421
414
|
}
|
|
415
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
416
|
+
if (interaction.hold3pActive) {
|
|
417
|
+
var current3pHold = interaction.hold3pActive.get(id);
|
|
418
|
+
if (current3pHold != null) {
|
|
419
|
+
if (!currentInteraction.hold3pInfo) {
|
|
420
|
+
currentInteraction.hold3pInfo = [];
|
|
421
|
+
}
|
|
422
|
+
currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
|
|
423
|
+
end: end
|
|
424
|
+
}));
|
|
425
|
+
interaction.hold3pActive.delete(id);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
422
429
|
}
|
|
423
430
|
};
|
|
424
431
|
}
|
|
@@ -428,13 +435,38 @@ export function addHoldByID(interactionId, labelStack, name, id, ignoreOnSubmit)
|
|
|
428
435
|
var interaction = interactions.get(interactionId);
|
|
429
436
|
if (interaction != null) {
|
|
430
437
|
var start = performance.now();
|
|
431
|
-
|
|
432
|
-
labelStack
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
439
|
+
var is3pHold = labelStack.some(function (l) {
|
|
440
|
+
return 'type' in l && l.type === 'third-party';
|
|
441
|
+
});
|
|
442
|
+
if (is3pHold) {
|
|
443
|
+
if (!interaction.hold3pActive) {
|
|
444
|
+
interaction.hold3pActive = new Map();
|
|
445
|
+
}
|
|
446
|
+
interaction.hold3pActive.set(id, {
|
|
447
|
+
labelStack: labelStack,
|
|
448
|
+
name: name,
|
|
449
|
+
start: start,
|
|
450
|
+
ignoreOnSubmit: ignoreOnSubmit
|
|
451
|
+
});
|
|
452
|
+
} else {
|
|
453
|
+
interaction.holdActive.set(id, {
|
|
454
|
+
labelStack: labelStack,
|
|
455
|
+
name: name,
|
|
456
|
+
start: start,
|
|
457
|
+
ignoreOnSubmit: ignoreOnSubmit
|
|
458
|
+
});
|
|
459
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
460
|
+
}
|
|
461
|
+
} else {
|
|
462
|
+
interaction.holdActive.set(id, {
|
|
463
|
+
labelStack: labelStack,
|
|
464
|
+
name: name,
|
|
465
|
+
start: start,
|
|
466
|
+
ignoreOnSubmit: ignoreOnSubmit
|
|
467
|
+
});
|
|
468
|
+
addHoldCriterion(id, labelStack, name, start);
|
|
469
|
+
}
|
|
438
470
|
}
|
|
439
471
|
return function () {};
|
|
440
472
|
}
|
|
@@ -451,6 +483,20 @@ export function removeHoldByID(interactionId, id) {
|
|
|
451
483
|
interaction.holdActive.delete(id);
|
|
452
484
|
removeHoldCriterion(id);
|
|
453
485
|
}
|
|
486
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
487
|
+
if (interaction.hold3pActive) {
|
|
488
|
+
var current3pHold = interaction.hold3pActive.get(id);
|
|
489
|
+
if (currentInteraction != null && current3pHold != null) {
|
|
490
|
+
if (!currentInteraction.hold3pInfo) {
|
|
491
|
+
currentInteraction.hold3pInfo = [];
|
|
492
|
+
}
|
|
493
|
+
currentInteraction.hold3pInfo.push(_objectSpread(_objectSpread({}, current3pHold), {}, {
|
|
494
|
+
end: end
|
|
495
|
+
}));
|
|
496
|
+
interaction.hold3pActive.delete(id);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
454
500
|
}
|
|
455
501
|
}
|
|
456
502
|
export function getCurrentInteractionType(interactionId) {
|
|
@@ -524,23 +570,16 @@ export function addProfilerTimings(interactionId, labelStack, type, actualDurati
|
|
|
524
570
|
if (isPerformanceTracingEnabled()) {
|
|
525
571
|
try {
|
|
526
572
|
// for Firefox 102 and older
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
color: 'secondary-dark'
|
|
535
|
-
}
|
|
573
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
|
|
574
|
+
start: startTime,
|
|
575
|
+
duration: actualDuration,
|
|
576
|
+
detail: {
|
|
577
|
+
devtools: {
|
|
578
|
+
track: '🛸 reactUFO detailed timings',
|
|
579
|
+
color: 'secondary-dark'
|
|
536
580
|
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [react-profiler] ").concat(type), {
|
|
540
|
-
start: startTime,
|
|
541
|
-
duration: actualDuration
|
|
542
|
-
});
|
|
543
|
-
}
|
|
581
|
+
}
|
|
582
|
+
});
|
|
544
583
|
} catch (e) {
|
|
545
584
|
// do nothing
|
|
546
585
|
}
|
|
@@ -572,38 +611,30 @@ function callCleanUpCallbacks(interaction) {
|
|
|
572
611
|
});
|
|
573
612
|
}
|
|
574
613
|
function finishInteraction(id, data) {
|
|
575
|
-
var _getConfig4
|
|
614
|
+
var _getConfig4;
|
|
576
615
|
var endTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
|
|
577
616
|
data.end = endTime;
|
|
578
617
|
try {
|
|
579
618
|
// for Firefox 102 and older
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
589
|
-
color: 'tertiary'
|
|
590
|
-
}
|
|
619
|
+
performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
|
|
620
|
+
start: data.start,
|
|
621
|
+
end: data.end,
|
|
622
|
+
detail: {
|
|
623
|
+
devtools: {
|
|
624
|
+
track: 'main metrics',
|
|
625
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
626
|
+
color: 'tertiary'
|
|
591
627
|
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
performance.mark("TTAI", {
|
|
631
|
+
startTime: data.end,
|
|
632
|
+
detail: {
|
|
633
|
+
devtools: {
|
|
634
|
+
dataType: 'marker'
|
|
599
635
|
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
performance.measure("\uD83D\uDEF8 [".concat(data.type, "] ").concat(data.ufoName, " [ttai]"), {
|
|
603
|
-
start: data.start,
|
|
604
|
-
end: data.end
|
|
605
|
-
});
|
|
606
|
-
}
|
|
636
|
+
}
|
|
637
|
+
});
|
|
607
638
|
} catch (e) {
|
|
608
639
|
// do nothing
|
|
609
640
|
}
|
|
@@ -622,23 +653,35 @@ function finishInteraction(id, data) {
|
|
|
622
653
|
data.hydration = getReactHydrationStats();
|
|
623
654
|
|
|
624
655
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
656
|
+
var sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
657
|
+
if (!coinflip(getPostInteractionRate(sanitisedUfoName, data.type))) {
|
|
658
|
+
postInteractionLog.stopVCObserver();
|
|
659
|
+
}
|
|
660
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
661
|
+
if (!data.hold3pActive || data.hold3pActive.size === 0) {
|
|
662
|
+
var _getConfig5;
|
|
663
|
+
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
|
|
664
|
+
remove(id);
|
|
665
|
+
}
|
|
666
|
+
interactionExtraMetrics.stopVCObserver();
|
|
629
667
|
}
|
|
630
668
|
} else {
|
|
631
|
-
|
|
632
|
-
|
|
669
|
+
var _getConfig6;
|
|
670
|
+
if (!((_getConfig6 = getConfig()) !== null && _getConfig6 !== void 0 && (_getConfig6 = _getConfig6.experimentalInteractionMetrics) !== null && _getConfig6 !== void 0 && _getConfig6.enabled)) {
|
|
671
|
+
remove(id);
|
|
633
672
|
}
|
|
634
673
|
}
|
|
635
|
-
if (!((_getConfig5 = getConfig()) !== null && _getConfig5 !== void 0 && (_getConfig5 = _getConfig5.experimentalInteractionMetrics) !== null && _getConfig5 !== void 0 && _getConfig5.enabled)) {
|
|
636
|
-
remove(id);
|
|
637
|
-
}
|
|
638
674
|
PreviousInteractionLog.name = data.ufoName || 'unknown';
|
|
639
675
|
PreviousInteractionLog.isAborted = data.abortReason != null;
|
|
640
676
|
if (data.ufoName) {
|
|
641
|
-
|
|
677
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
678
|
+
if (interactionExtraMetrics.finishedInteractionId !== id) {
|
|
679
|
+
// If this same interaction was not already handled, handle it
|
|
680
|
+
handleInteraction(id, data);
|
|
681
|
+
}
|
|
682
|
+
} else {
|
|
683
|
+
handleInteraction(id, data);
|
|
684
|
+
}
|
|
642
685
|
}
|
|
643
686
|
if (isPerformanceTracingEnabled()) {
|
|
644
687
|
var profilerTimingMap = new Map();
|
|
@@ -665,23 +708,16 @@ function finishInteraction(id, data) {
|
|
|
665
708
|
labelStack = _step3$value$.labelStack,
|
|
666
709
|
start = _step3$value$.start,
|
|
667
710
|
end = _step3$value$.end;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
color: 'secondary-dark'
|
|
676
|
-
}
|
|
711
|
+
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [segment_ttai]"), {
|
|
712
|
+
start: start,
|
|
713
|
+
end: end,
|
|
714
|
+
detail: {
|
|
715
|
+
devtools: {
|
|
716
|
+
track: '🛸 reactUFO detailed timings',
|
|
717
|
+
color: 'secondary-dark'
|
|
677
718
|
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
performance.measure("\uD83D\uDEF8 ".concat(labelStackToString(labelStack), " [segment_ttai]"), {
|
|
681
|
-
start: start,
|
|
682
|
-
end: end
|
|
683
|
-
});
|
|
684
|
-
}
|
|
719
|
+
}
|
|
720
|
+
});
|
|
685
721
|
}
|
|
686
722
|
} catch (err) {
|
|
687
723
|
_iterator3.e(err);
|
|
@@ -723,16 +759,16 @@ export function tryComplete(interactionId, endTime) {
|
|
|
723
759
|
var noMoreExpHolds = interaction.holdExpActive.size === 0;
|
|
724
760
|
var postInteraction = /*#__PURE__*/function () {
|
|
725
761
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
726
|
-
var
|
|
727
|
-
var
|
|
762
|
+
var _getConfig7;
|
|
763
|
+
var _getConfig8, experimentalVC90, experimentalTTAI, _yield$getExperimenta, start, end, _getConfig9, _getConfig0;
|
|
728
764
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
729
765
|
while (1) switch (_context.prev = _context.next) {
|
|
730
766
|
case 0:
|
|
731
|
-
if (!((
|
|
767
|
+
if (!((_getConfig7 = getConfig()) !== null && _getConfig7 !== void 0 && (_getConfig7 = _getConfig7.postInteractionLog) !== null && _getConfig7 !== void 0 && _getConfig7.enabled)) {
|
|
732
768
|
_context.next = 17;
|
|
733
769
|
break;
|
|
734
770
|
}
|
|
735
|
-
if (!((
|
|
771
|
+
if (!((_getConfig8 = getConfig()) !== null && _getConfig8 !== void 0 && (_getConfig8 = _getConfig8.experimentalInteractionMetrics) !== null && _getConfig8 !== void 0 && _getConfig8.enabled)) {
|
|
736
772
|
_context.next = 16;
|
|
737
773
|
break;
|
|
738
774
|
}
|
|
@@ -766,8 +802,17 @@ export function tryComplete(interactionId, endTime) {
|
|
|
766
802
|
experimentalVC90: experimentalVC90
|
|
767
803
|
}));
|
|
768
804
|
case 17:
|
|
769
|
-
if ((
|
|
770
|
-
|
|
805
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
806
|
+
if (interactionExtraMetrics.finishedInteractionId !== interactionId) {
|
|
807
|
+
// If interactionExtraMetrics is not waiting for measuring this interaction
|
|
808
|
+
if ((_getConfig9 = getConfig()) !== null && _getConfig9 !== void 0 && (_getConfig9 = _getConfig9.experimentalInteractionMetrics) !== null && _getConfig9 !== void 0 && _getConfig9.enabled) {
|
|
809
|
+
remove(interactionId);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
} else {
|
|
813
|
+
if ((_getConfig0 = getConfig()) !== null && _getConfig0 !== void 0 && (_getConfig0 = _getConfig0.experimentalInteractionMetrics) !== null && _getConfig0 !== void 0 && _getConfig0.enabled) {
|
|
814
|
+
remove(interactionId);
|
|
815
|
+
}
|
|
771
816
|
}
|
|
772
817
|
activeSubmitted = false;
|
|
773
818
|
case 19:
|
|
@@ -780,17 +825,42 @@ export function tryComplete(interactionId, endTime) {
|
|
|
780
825
|
return _ref.apply(this, arguments);
|
|
781
826
|
};
|
|
782
827
|
}();
|
|
783
|
-
if (
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
828
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
829
|
+
var _interaction$hold3pAc;
|
|
830
|
+
var noMoreActive3pHolds = ((_interaction$hold3pAc = interaction.hold3pActive) === null || _interaction$hold3pAc === void 0 ? void 0 : _interaction$hold3pAc.size) === 0 || interaction.hold3pActive === undefined;
|
|
831
|
+
if (noMoreActiveHolds) {
|
|
832
|
+
if (!activeSubmitted) {
|
|
833
|
+
finishInteraction(interactionId, interaction, endTime);
|
|
834
|
+
interactionExtraMetrics.updateFinishedInteractionId(interactionId);
|
|
835
|
+
activeSubmitted = true;
|
|
836
|
+
}
|
|
837
|
+
if (noMoreExpHolds) {
|
|
838
|
+
var _getConfig1;
|
|
839
|
+
if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.experimentalInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
|
|
840
|
+
onExperimentalInteractionComplete(interactionId, interaction, endTime);
|
|
841
|
+
}
|
|
842
|
+
postInteraction();
|
|
843
|
+
}
|
|
844
|
+
if (noMoreActive3pHolds) {
|
|
845
|
+
var data = _objectSpread(_objectSpread({}, interaction), {}, {
|
|
846
|
+
end: endTime
|
|
847
|
+
});
|
|
848
|
+
interactionExtraMetrics.onInteractionComplete(interactionId, data);
|
|
849
|
+
}
|
|
787
850
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
if (
|
|
791
|
-
|
|
851
|
+
} else {
|
|
852
|
+
if (noMoreActiveHolds) {
|
|
853
|
+
if (!activeSubmitted) {
|
|
854
|
+
finishInteraction(interactionId, interaction, endTime);
|
|
855
|
+
activeSubmitted = true;
|
|
856
|
+
}
|
|
857
|
+
if (noMoreExpHolds) {
|
|
858
|
+
var _getConfig10;
|
|
859
|
+
if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.experimentalInteractionMetrics) !== null && _getConfig10 !== void 0 && _getConfig10.enabled) {
|
|
860
|
+
onExperimentalInteractionComplete(interactionId, interaction, endTime);
|
|
861
|
+
}
|
|
862
|
+
postInteraction();
|
|
792
863
|
}
|
|
793
|
-
postInteraction();
|
|
794
864
|
}
|
|
795
865
|
}
|
|
796
866
|
}
|
|
@@ -818,6 +888,11 @@ export function abort(interactionId, abortReason) {
|
|
|
818
888
|
finishInteraction(interactionId, interaction);
|
|
819
889
|
postInteractionLog.reset();
|
|
820
890
|
postInteractionLog.stopVCObserver();
|
|
891
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
892
|
+
interactionExtraMetrics.stopVCObserver();
|
|
893
|
+
interactionExtraMetrics.reset();
|
|
894
|
+
remove(interactionId);
|
|
895
|
+
}
|
|
821
896
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
822
897
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
823
898
|
remove(interactionId);
|
|
@@ -843,6 +918,11 @@ export function abortByNewInteraction(interactionId, interactionName) {
|
|
|
843
918
|
finishInteraction(interactionId, interaction);
|
|
844
919
|
postInteractionLog.reset();
|
|
845
920
|
postInteractionLog.stopVCObserver();
|
|
921
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
922
|
+
interactionExtraMetrics.stopVCObserver();
|
|
923
|
+
interactionExtraMetrics.reset();
|
|
924
|
+
remove(interactionId);
|
|
925
|
+
}
|
|
846
926
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
847
927
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
848
928
|
remove(interactionId);
|
|
@@ -872,6 +952,11 @@ export function abortAll(abortReason, abortedByInteractionName) {
|
|
|
872
952
|
finishInteraction(interactionId, interaction);
|
|
873
953
|
postInteractionLog.reset();
|
|
874
954
|
postInteractionLog.stopVCObserver();
|
|
955
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
956
|
+
interactionExtraMetrics.stopVCObserver();
|
|
957
|
+
interactionExtraMetrics.reset();
|
|
958
|
+
remove(interactionId);
|
|
959
|
+
}
|
|
875
960
|
if (coinflip(getExperimentalInteractionRate(interaction.ufoName, interaction.type))) {
|
|
876
961
|
onExperimentalInteractionComplete(interactionId, interaction);
|
|
877
962
|
remove(interactionId);
|
|
@@ -884,13 +969,7 @@ export function addOnCancelCallback(id, cancelCallback) {
|
|
|
884
969
|
}
|
|
885
970
|
export function addNewInteraction(interactionId, ufoName, type, startTime, rate, labelStack, routeName) {
|
|
886
971
|
var trace = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
887
|
-
|
|
888
|
-
postInteractionLog.reset();
|
|
889
|
-
} else {
|
|
890
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
891
|
-
postInteractionLog.reset();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
972
|
+
postInteractionLog.reset();
|
|
894
973
|
var vcObserver;
|
|
895
974
|
var previousTime = startTime;
|
|
896
975
|
var timeoutTime = fg('platform_ufo_enable_timeout_config') ? getInteractionTimeout(ufoName) : CLEANUP_TIMEOUT;
|
|
@@ -969,7 +1048,9 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
969
1048
|
timerID: timerID,
|
|
970
1049
|
changeTimeout: changeTimeout,
|
|
971
1050
|
trace: trace,
|
|
972
|
-
vcObserver: vcObserver
|
|
1051
|
+
vcObserver: vcObserver,
|
|
1052
|
+
hold3pActive: new Map(),
|
|
1053
|
+
hold3pInfo: []
|
|
973
1054
|
};
|
|
974
1055
|
if (addFeatureFlagsToInteraction) {
|
|
975
1056
|
currentFeatureFlagsAccessed.clear();
|
|
@@ -999,6 +1080,7 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
999
1080
|
addHoldByID(interactionId, [], ufoName, ufoName, true);
|
|
1000
1081
|
}
|
|
1001
1082
|
if (type === 'transition' || type === 'page_load') {
|
|
1083
|
+
var _getConfig11;
|
|
1002
1084
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
1003
1085
|
var observer = vcObserver;
|
|
1004
1086
|
if (observer) {
|
|
@@ -1007,27 +1089,23 @@ export function addNewInteraction(interactionId, ufoName, type, startTime, rate,
|
|
|
1007
1089
|
experienceKey: ufoName
|
|
1008
1090
|
});
|
|
1009
1091
|
}
|
|
1010
|
-
if
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
startTime: startTime
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
} else {
|
|
1020
|
-
if (coinflip(getPostInteractionRate(routeName || ufoName, type))) {
|
|
1021
|
-
postInteractionLog.startVCObserver({
|
|
1022
|
-
startTime: startTime
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1092
|
+
// Start post interaction observer for all if config is enabled
|
|
1093
|
+
// in case ufoName is updated at later time
|
|
1094
|
+
if ((_getConfig11 = getConfig()) !== null && _getConfig11 !== void 0 && (_getConfig11 = _getConfig11.postInteractionLog) !== null && _getConfig11 !== void 0 && _getConfig11.enabled) {
|
|
1095
|
+
postInteractionLog.startVCObserver({
|
|
1096
|
+
startTime: startTime
|
|
1097
|
+
});
|
|
1025
1098
|
}
|
|
1026
1099
|
if (coinflip(getExperimentalInteractionRate(ufoName, type))) {
|
|
1027
1100
|
experimentalVC.start({
|
|
1028
1101
|
startTime: startTime
|
|
1029
1102
|
});
|
|
1030
1103
|
}
|
|
1104
|
+
if (fg('platform_ufo_enable_ttai_with_3p')) {
|
|
1105
|
+
interactionExtraMetrics.startVCObserver({
|
|
1106
|
+
startTime: startTime
|
|
1107
|
+
}, interactionId);
|
|
1108
|
+
}
|
|
1031
1109
|
}
|
|
1032
1110
|
if (type === 'press' && fg('platform_ufo_enable_vc_press_interactions')) {
|
|
1033
1111
|
// Use per-interaction VC observer if available, otherwise fall back to global
|
|
@@ -1055,35 +1133,27 @@ export function addApdexToAll(apdex) {
|
|
|
1055
1133
|
interactions.forEach(function (interaction, key) {
|
|
1056
1134
|
interaction.apdex.push(apdex);
|
|
1057
1135
|
try {
|
|
1136
|
+
var _apdex$startTime;
|
|
1058
1137
|
// for Firefox 102 and older
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
1068
|
-
color: 'primary-dark'
|
|
1069
|
-
}
|
|
1138
|
+
performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
|
|
1139
|
+
start: (_apdex$startTime = apdex.startTime) !== null && _apdex$startTime !== void 0 ? _apdex$startTime : interaction.start,
|
|
1140
|
+
end: apdex.stopTime,
|
|
1141
|
+
detail: {
|
|
1142
|
+
devtools: {
|
|
1143
|
+
track: 'main metrics',
|
|
1144
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
1145
|
+
color: 'primary-dark'
|
|
1070
1146
|
}
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
performance.mark("[bm3] TTI", {
|
|
1150
|
+
startTime: apdex.stopTime,
|
|
1151
|
+
detail: {
|
|
1152
|
+
devtools: {
|
|
1153
|
+
dataType: 'marker'
|
|
1078
1154
|
}
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
var _apdex$startTime2;
|
|
1082
|
-
performance.measure("\uD83D\uDEF8 ".concat(apdex.key, " [bm3_tti]"), {
|
|
1083
|
-
start: (_apdex$startTime2 = apdex.startTime) !== null && _apdex$startTime2 !== void 0 ? _apdex$startTime2 : interaction.start,
|
|
1084
|
-
end: apdex.stopTime
|
|
1085
|
-
});
|
|
1086
|
-
}
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1087
1157
|
} catch (e) {
|
|
1088
1158
|
// do nothing
|
|
1089
1159
|
}
|
|
@@ -1097,35 +1167,27 @@ export function addApdex(interactionId, apdexInfo) {
|
|
|
1097
1167
|
if (interaction != null) {
|
|
1098
1168
|
interaction.apdex.push(apdexInfo);
|
|
1099
1169
|
try {
|
|
1170
|
+
var _apdexInfo$startTime;
|
|
1100
1171
|
// for Firefox 102 and older
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
trackGroup: '🛸 reactUFO metrics',
|
|
1110
|
-
color: 'primary-dark'
|
|
1111
|
-
}
|
|
1172
|
+
performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
|
|
1173
|
+
start: (_apdexInfo$startTime = apdexInfo.startTime) !== null && _apdexInfo$startTime !== void 0 ? _apdexInfo$startTime : interaction.start,
|
|
1174
|
+
end: apdexInfo.stopTime,
|
|
1175
|
+
detail: {
|
|
1176
|
+
devtools: {
|
|
1177
|
+
track: 'main metrics',
|
|
1178
|
+
trackGroup: '🛸 reactUFO metrics',
|
|
1179
|
+
color: 'primary-dark'
|
|
1112
1180
|
}
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
performance.mark("[bm3] TTI", {
|
|
1184
|
+
startTime: apdexInfo.stopTime,
|
|
1185
|
+
detail: {
|
|
1186
|
+
devtools: {
|
|
1187
|
+
dataType: 'marker'
|
|
1120
1188
|
}
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
var _apdexInfo$startTime2;
|
|
1124
|
-
performance.measure("\uD83D\uDEF8 ".concat(apdexInfo.key, " [bm3_tti]"), {
|
|
1125
|
-
start: (_apdexInfo$startTime2 = apdexInfo.startTime) !== null && _apdexInfo$startTime2 !== void 0 ? _apdexInfo$startTime2 : interaction.start,
|
|
1126
|
-
end: apdexInfo.stopTime
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1129
1191
|
} catch (e) {
|
|
1130
1192
|
// do nothing
|
|
1131
1193
|
}
|
|
@@ -1192,26 +1254,18 @@ export function addRedirect(interactionId, fromUfoName, nextUfoName, nextRouteNa
|
|
|
1192
1254
|
if (isPerformanceTracingEnabled()) {
|
|
1193
1255
|
var prevRedirect = interaction.redirects.at(-2);
|
|
1194
1256
|
try {
|
|
1257
|
+
var _prevRedirect$time;
|
|
1195
1258
|
// for Firefox 102 and older
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
track: '🛸 reactUFO detailed timings',
|
|
1204
|
-
color: 'tertiary'
|
|
1205
|
-
}
|
|
1259
|
+
performance.measure("\uD83D\uDEF8 ".concat(nextUfoName, " [redirect]"), {
|
|
1260
|
+
start: (_prevRedirect$time = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time !== void 0 ? _prevRedirect$time : interaction.start,
|
|
1261
|
+
end: time,
|
|
1262
|
+
detail: {
|
|
1263
|
+
devtools: {
|
|
1264
|
+
track: '🛸 reactUFO detailed timings',
|
|
1265
|
+
color: 'tertiary'
|
|
1206
1266
|
}
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
var _prevRedirect$time2;
|
|
1210
|
-
performance.measure("\uD83D\uDEF8 ".concat(nextUfoName, " [redirect]"), {
|
|
1211
|
-
start: (_prevRedirect$time2 = prevRedirect === null || prevRedirect === void 0 ? void 0 : prevRedirect.time) !== null && _prevRedirect$time2 !== void 0 ? _prevRedirect$time2 : interaction.start,
|
|
1212
|
-
end: time
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1215
1269
|
} catch (e) {
|
|
1216
1270
|
// do nothing
|
|
1217
1271
|
}
|