o11y 254.3.0 → 254.4.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.
Files changed (25) hide show
  1. package/dist/modules/o11y/client/client.js +70 -37
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/library/PerformanceObservability.d.ts +8 -2
  4. package/dist/modules/o11y/client/types/TypeDefinitions-Private.d.ts +1 -0
  5. package/dist/modules/o11y/client/version.d.ts +1 -1
  6. package/dist/modules/o11y/collectors/library/PerformanceObservability.d.ts +8 -2
  7. package/dist/modules/o11y/collectors/types/TypeDefinitions-Private.d.ts +1 -0
  8. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  9. package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
  10. package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
  11. package/dist/modules/o11y/core_envelope/library/PerformanceObservability.d.ts +8 -2
  12. package/dist/modules/o11y/core_envelope/types/TypeDefinitions-Private.d.ts +1 -0
  13. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  14. package/dist/modules/o11y/shared/library/PerformanceObservability.d.ts +8 -2
  15. package/dist/modules/o11y/shared/types/TypeDefinitions-Private.d.ts +1 -0
  16. package/dist/modules/o11y/shared/version.d.ts +1 -1
  17. package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +8 -2
  18. package/dist/modules/o11y/simple_collector/types/TypeDefinitions-Private.d.ts +1 -0
  19. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  20. package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +8 -2
  21. package/dist/modules/o11y/web_vitals/types/TypeDefinitions-Private.d.ts +1 -0
  22. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  23. package/dist/modules/o11y/web_vitals/web_vitals.js +1 -1
  24. package/dist/modules/o11y/web_vitals/web_vitals.js.map +1 -1
  25. package/package.json +2 -2
@@ -247,16 +247,18 @@ class IdleDetectorImpl {
247
247
  }
248
248
  }
249
249
 
250
- const navigation_timing={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{"nested":{"sfcore":{"nested":{"performance":{"nested":{"NavigationTiming":{"oneofs":{"_xhrDelay":{"oneof":["xhrDelay"]},"_renderBlockingStatus":{"oneof":["renderBlockingStatus"]},"_firstInterimResponseStart":{"oneof":["firstInterimResponseStart"]},"_srvDuration":{"oneof":["srvDuration"]},"_isCdnCached":{"oneof":["isCdnCached"]},"_dbDuration":{"oneof":["dbDuration"]},"_reqBatchCount":{"oneof":["reqBatchCount"]}},
251
- "fields":{"redirectCount":{"id":37,"type":"uint32"},"encodedBodySize":{"id":21,"type":"uint32"},"reqActionNames":{"rule":"repeated","id":28,"type":"string"},"unloadEventEnd":{"id":40,"type":"double"},"responseEnd":{"id":19,"type":"double"},"domainLookupEnd":{"id":12,"type":"double"},"unloadEventStart":{"id":39,"type":"double"},"domContentLoadedEventStart":{"id":32,"type":"double"},"type":{"id":38,"type":"string"},"firstInterimResponseStart":{"options":{"proto3_optional":true},"id":18,"type":"double"},
252
- "duration":{"id":3,"type":"double"},"decodedBodySize":{"id":22,"type":"uint32"},"redirectStart":{"id":8,"type":"double"},"connectEnd":{"id":15,"type":"double"},"isCdnCached":{"options":{"proto3_optional":true},"id":24,"type":"bool"},"requestStart":{"id":16,"type":"double"},"startTime":{"id":2,"type":"double"},"fetchStart":{"id":10,"type":"double"},"domContentLoadedEventEnd":{"id":33,"type":"double"},"srvReqId":{"id":29,"type":"string"},"reqBatchCount":{"options":{"proto3_optional":true},"id":27,"type":"uint32"},
253
- "renderBlockingStatus":{"options":{"proto3_optional":true},"id":6,"type":"string"},"workerStart":{"id":7,"type":"double"},"responseStart":{"id":17,"type":"double"},"xhrDelay":{"options":{"proto3_optional":true},"id":30,"type":"double"},"domInteractive":{"id":34,"type":"double"},"domComplete":{"id":31,"type":"double"},"domainLookupStart":{"id":11,"type":"double"},"responseStatus":{"id":23,"type":"uint32"},"redirectEnd":{"id":9,"type":"double"},"transferSize":{"id":20,"type":"uint32"},"srvDuration":{"options":{"proto3_optional":true},
254
- "id":26,"type":"double"},"dbDuration":{"options":{"proto3_optional":true},"id":25,"type":"double"},"connectStart":{"id":13,"type":"double"},"loadEventStart":{"id":35,"type":"double"},"secureConnectionStart":{"id":14,"type":"double"},"name":{"id":1,"type":"string"},"nextHopProtocol":{"id":5,"type":"string"},"initiatorType":{"id":4,"type":"string"},"loadEventEnd":{"id":36,"type":"double"}}}}}}}}}};
250
+ const navigation_timing={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{"nested":{"sfcore":{"nested":{"performance":{"nested":{"NavigationTiming":{"oneofs":{"_xhrDelay":{"oneof":["xhrDelay"]},"_renderBlockingStatus":{"oneof":["renderBlockingStatus"]},"_firstInterimResponseStart":{"oneof":["firstInterimResponseStart"]},"_srvDuration":{"oneof":["srvDuration"]},"_isCdnCached":{"oneof":["isCdnCached"]},"_responseStatus":{"oneof":["responseStatus"]},"_dbDuration":{"oneof":["dbDuration"]},
251
+ "_reqBatchCount":{"oneof":["reqBatchCount"]}},"fields":{"redirectCount":{"id":37,"type":"uint32"},"encodedBodySize":{"id":21,"type":"uint32"},"reqActionNames":{"rule":"repeated","id":28,"type":"string"},"unloadEventEnd":{"id":40,"type":"double"},"responseEnd":{"id":19,"type":"double"},"domainLookupEnd":{"id":12,"type":"double"},"unloadEventStart":{"id":39,"type":"double"},"domContentLoadedEventStart":{"id":32,"type":"double"},"type":{"id":38,"type":"string"},"firstInterimResponseStart":{"options":{"proto3_optional":true},
252
+ "id":18,"type":"double"},"duration":{"id":3,"type":"double"},"decodedBodySize":{"id":22,"type":"uint32"},"redirectStart":{"id":8,"type":"double"},"connectEnd":{"id":15,"type":"double"},"isCdnCached":{"options":{"proto3_optional":true},"id":24,"type":"bool"},"requestStart":{"id":16,"type":"double"},"startTime":{"id":2,"type":"double"},"fetchStart":{"id":10,"type":"double"},"domContentLoadedEventEnd":{"id":33,"type":"double"},"srvReqId":{"id":29,"type":"string"},"reqBatchCount":{"options":{"proto3_optional":true},
253
+ "id":27,"type":"uint32"},"renderBlockingStatus":{"options":{"proto3_optional":true},"id":6,"type":"string"},"workerStart":{"id":7,"type":"double"},"responseStart":{"id":17,"type":"double"},"xhrDelay":{"options":{"proto3_optional":true},"id":30,"type":"double"},"domInteractive":{"id":34,"type":"double"},"domComplete":{"id":31,"type":"double"},"domainLookupStart":{"id":11,"type":"double"},"responseStatus":{"options":{"proto3_optional":true},"id":23,"type":"uint32"},"redirectEnd":{"id":9,"type":"double"},
254
+ "logEvent":{"id":41,"type":"string"},"transferSize":{"id":20,"type":"uint32"},"srvDuration":{"options":{"proto3_optional":true},"id":26,"type":"double"},"dbDuration":{"options":{"proto3_optional":true},"id":25,"type":"double"},"connectStart":{"id":13,"type":"double"},"loadEventStart":{"id":35,"type":"double"},"secureConnectionStart":{"id":14,"type":"double"},"name":{"id":1,"type":"string"},"nextHopProtocol":{"id":5,"type":"string"},"initiatorType":{"id":4,"type":"string"},"loadEventEnd":{"id":36,
255
+ "type":"double"}}}}}}}}}};
255
256
 
256
- const resource_timing={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{"nested":{"sfcore":{"nested":{"performance":{"nested":{"ResourceTiming":{"oneofs":{"_xhrDelay":{"oneof":["xhrDelay"]},"_renderBlockingStatus":{"oneof":["renderBlockingStatus"]},"_firstInterimResponseStart":{"oneof":["firstInterimResponseStart"]},"_srvDuration":{"oneof":["srvDuration"]},"_isCdnCached":{"oneof":["isCdnCached"]},"_dbDuration":{"oneof":["dbDuration"]},"_reqBatchCount":{"oneof":["reqBatchCount"]}},
257
- "fields":{"encodedBodySize":{"id":21,"type":"uint32"},"reqActionNames":{"rule":"repeated","id":28,"type":"string"},"responseEnd":{"id":19,"type":"double"},"domainLookupEnd":{"id":12,"type":"double"},"firstInterimResponseStart":{"options":{"proto3_optional":true},"id":18,"type":"double"},"duration":{"id":3,"type":"double"},"decodedBodySize":{"id":22,"type":"uint32"},"redirectStart":{"id":8,"type":"double"},"connectEnd":{"id":15,"type":"double"},"isCdnCached":{"options":{"proto3_optional":true},"id":24,
258
- "type":"bool"},"requestStart":{"id":16,"type":"double"},"startTime":{"id":2,"type":"double"},"fetchStart":{"id":10,"type":"double"},"srvReqId":{"id":29,"type":"string"},"reqBatchCount":{"options":{"proto3_optional":true},"id":27,"type":"uint32"},"renderBlockingStatus":{"options":{"proto3_optional":true},"id":6,"type":"string"},"workerStart":{"id":7,"type":"double"},"responseStart":{"id":17,"type":"double"},"xhrDelay":{"options":{"proto3_optional":true},"id":30,"type":"double"},"domainLookupStart":{"id":11,
259
- "type":"double"},"responseStatus":{"id":23,"type":"uint32"},"redirectEnd":{"id":9,"type":"double"},"transferSize":{"id":20,"type":"uint32"},"srvDuration":{"options":{"proto3_optional":true},"id":26,"type":"double"},"dbDuration":{"options":{"proto3_optional":true},"id":25,"type":"double"},"connectStart":{"id":13,"type":"double"},"secureConnectionStart":{"id":14,"type":"double"},"name":{"id":1,"type":"string"},"nextHopProtocol":{"id":5,"type":"string"},"initiatorType":{"id":4,"type":"string"}}}}}}}}}};
257
+ const resource_timing={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{"nested":{"sfcore":{"nested":{"performance":{"nested":{"ResourceTiming":{"oneofs":{"_xhrDelay":{"oneof":["xhrDelay"]},"_renderBlockingStatus":{"oneof":["renderBlockingStatus"]},"_firstInterimResponseStart":{"oneof":["firstInterimResponseStart"]},"_srvDuration":{"oneof":["srvDuration"]},"_isCdnCached":{"oneof":["isCdnCached"]},"_responseStatus":{"oneof":["responseStatus"]},"_dbDuration":{"oneof":["dbDuration"]},
258
+ "_reqBatchCount":{"oneof":["reqBatchCount"]}},"fields":{"encodedBodySize":{"id":21,"type":"uint32"},"reqActionNames":{"rule":"repeated","id":28,"type":"string"},"responseEnd":{"id":19,"type":"double"},"domainLookupEnd":{"id":12,"type":"double"},"firstInterimResponseStart":{"options":{"proto3_optional":true},"id":18,"type":"double"},"duration":{"id":3,"type":"double"},"decodedBodySize":{"id":22,"type":"uint32"},"redirectStart":{"id":8,"type":"double"},"connectEnd":{"id":15,"type":"double"},"isCdnCached":{"options":{"proto3_optional":true},
259
+ "id":24,"type":"bool"},"requestStart":{"id":16,"type":"double"},"startTime":{"id":2,"type":"double"},"fetchStart":{"id":10,"type":"double"},"srvReqId":{"id":29,"type":"string"},"reqBatchCount":{"options":{"proto3_optional":true},"id":27,"type":"uint32"},"renderBlockingStatus":{"options":{"proto3_optional":true},"id":6,"type":"string"},"workerStart":{"id":7,"type":"double"},"responseStart":{"id":17,"type":"double"},"xhrDelay":{"options":{"proto3_optional":true},"id":30,"type":"double"},"domainLookupStart":{"id":11,
260
+ "type":"double"},"responseStatus":{"options":{"proto3_optional":true},"id":23,"type":"uint32"},"redirectEnd":{"id":9,"type":"double"},"transferSize":{"id":20,"type":"uint32"},"srvDuration":{"options":{"proto3_optional":true},"id":26,"type":"double"},"dbDuration":{"options":{"proto3_optional":true},"id":25,"type":"double"},"connectStart":{"id":13,"type":"double"},"secureConnectionStart":{"id":14,"type":"double"},"name":{"id":1,"type":"string"},"nextHopProtocol":{"id":5,"type":"string"},"initiatorType":{"id":4,
261
+ "type":"string"}}}}}}}}}};
260
262
 
261
263
  class FuzzyMapper {
262
264
  constructor(_fuzzyKeyRange) {
@@ -307,7 +309,22 @@ class PerformanceObservability {
307
309
  this._instr = _instr;
308
310
  this._skipUrls = _skipUrls;
309
311
  this._logPerformanceActivityName = _logPerformanceActivityName;
312
+ this._boundObserverCallback = this._logPerformanceEntries.bind(this);
313
+ this._boundNavigationTimingEventCallback = (event) => {
314
+ this._logNavigationEntries(event);
315
+ };
316
+ this._setTimeoutNavigationCallback = (event) => {
317
+ setTimeout(() => {
318
+ this._boundNavigationTimingEventCallback(event);
319
+ }, 0);
320
+ };
321
+ this._visibilityChangeNavigationCallback = (event) => {
322
+ if (document.visibilityState === 'hidden') {
323
+ this._boundNavigationTimingEventCallback(event);
324
+ }
325
+ };
310
326
  this._isStarted = false;
327
+ this._processedNavigationTiming = false;
311
328
  utility.requireArgument(_instr, '_instr', 'object');
312
329
  utility.requireArgument(fuzzyMapRange, 'fuzzyMapRange', 'number');
313
330
  utility.requireArgumentIfDefined(_skipUrls, '_skipUrls', Array);
@@ -315,7 +332,7 @@ class PerformanceObservability {
315
332
  utility.requireArgumentIfDefined(logLevel, 'logLevel', 'string');
316
333
  this._hasPerf =
317
334
  typeof performance !== 'undefined' && typeof PerformanceObserver === 'function';
318
- this._boundObserverCallback = this._logPerformanceEntries.bind(this);
335
+ this._hasWindow = typeof window !== 'undefined';
319
336
  if (!logLevel || logLevel.toLowerCase() === 'full') {
320
337
  this._logLevel = 1;
321
338
  }
@@ -339,10 +356,9 @@ class PerformanceObservability {
339
356
  }
340
357
  if (!this._isStarted) {
341
358
  this._isStarted = true;
342
- this._navigationObserver = new PerformanceObserver(this._boundObserverCallback);
343
- this._navigationObserver.observe({ type: 'navigation', buffered: true });
344
359
  this._resourceObserver = new PerformanceObserver(this._boundObserverCallback);
345
360
  this._resourceObserver.observe({ type: 'resource', buffered: true });
361
+ this._addNavigationListeners();
346
362
  }
347
363
  }
348
364
  stop() {
@@ -350,13 +366,26 @@ class PerformanceObservability {
350
366
  this._resourceObserver.disconnect();
351
367
  this._resourceObserver = undefined;
352
368
  }
353
- if (this._navigationObserver) {
354
- this._navigationObserver.disconnect();
355
- this._navigationObserver = undefined;
356
- }
369
+ this._removeNavigationListeners();
357
370
  this._fuzzyMapper.clear();
358
371
  this._isStarted = false;
359
372
  }
373
+ _addNavigationListeners() {
374
+ if (!this._hasWindow) {
375
+ return;
376
+ }
377
+ window.addEventListener('load', this._setTimeoutNavigationCallback);
378
+ window.addEventListener('pagehide', this._boundNavigationTimingEventCallback);
379
+ document.addEventListener('visibilitychange', this._visibilityChangeNavigationCallback);
380
+ }
381
+ _removeNavigationListeners() {
382
+ if (!this._hasWindow) {
383
+ return;
384
+ }
385
+ window.removeEventListener('load', this._setTimeoutNavigationCallback);
386
+ window.removeEventListener('pagehide', this._boundNavigationTimingEventCallback);
387
+ document.removeEventListener('visibilitychange', this._visibilityChangeNavigationCallback);
388
+ }
360
389
  addEntry(absoluteUrl, perfTime, data) {
361
390
  this._fuzzyMapper.add(absoluteUrl, perfTime, data);
362
391
  }
@@ -426,30 +455,34 @@ class PerformanceObservability {
426
455
  .startActivity(this._logPerformanceActivityName, startOptions)
427
456
  .stop(schema, payload, stopOptions);
428
457
  }
429
- _logPerformanceEntries(list) {
430
- for (const entry of list.getEntriesByType('navigation')) {
458
+ _logNavigationEntries(event) {
459
+ if (this._processedNavigationTiming) {
460
+ return;
461
+ }
462
+ for (const entry of performance.getEntriesByType('navigation')) {
431
463
  const nt = entry;
432
464
  if (this._shouldInclude(nt)) {
433
- if (nt !== this._navTiming) {
434
- this._navTiming = nt;
435
- const payload = this._resourceEntryToResourceTiming(nt);
436
- const navOnly = {
437
- domComplete: nt.domComplete,
438
- domContentLoadedEventStart: nt.domContentLoadedEventStart,
439
- domContentLoadedEventEnd: nt.domContentLoadedEventEnd,
440
- domInteractive: nt.domInteractive,
441
- loadEventStart: nt.loadEventStart,
442
- loadEventEnd: nt.loadEventEnd,
443
- redirectCount: nt.redirectCount,
444
- type: nt.type,
445
- unloadEventStart: nt.unloadEventStart,
446
- unloadEventEnd: nt.unloadEventEnd
447
- };
448
- this._logActivity(navigation_timing, Object.assign(payload, navOnly));
449
- }
450
- break;
465
+ this._processedNavigationTiming = true;
466
+ const payload = this._resourceEntryToResourceTiming(nt);
467
+ const navOnly = {
468
+ domComplete: nt.domComplete,
469
+ domContentLoadedEventStart: nt.domContentLoadedEventStart,
470
+ domContentLoadedEventEnd: nt.domContentLoadedEventEnd,
471
+ domInteractive: nt.domInteractive,
472
+ loadEventStart: nt.loadEventStart,
473
+ loadEventEnd: nt.loadEventEnd,
474
+ redirectCount: nt.redirectCount,
475
+ type: nt.type,
476
+ unloadEventStart: nt.unloadEventStart,
477
+ unloadEventEnd: nt.unloadEventEnd,
478
+ logEvent: event.type
479
+ };
480
+ this._logActivity(navigation_timing, Object.assign(payload, navOnly));
451
481
  }
482
+ break;
452
483
  }
484
+ }
485
+ _logPerformanceEntries(list) {
453
486
  for (const entry of list.getEntriesByType('resource')) {
454
487
  const rt = entry;
455
488
  const requestInfo = this._fuzzyMapper.pop(rt.name, rt.startTime);
@@ -2666,7 +2699,7 @@ class ConsoleCollector {
2666
2699
  }
2667
2700
  }
2668
2701
 
2669
- const version = '254.3.0';
2702
+ const version = '254.4.0';
2670
2703
 
2671
2704
  const idleDetector = new IdleDetectorImpl({
2672
2705
  logThreshold: 300,