o11y 248.9.0 → 248.10.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/dist/modules/o11y/client/client.js +92 -49
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/client/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
- package/dist/modules/o11y/client/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/client/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/collectors/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
- package/dist/modules/o11y/collectors/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/collectors/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/collectors/version.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
- package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
- package/dist/modules/o11y/core_envelope/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/core_envelope/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
- package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/shared/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
- package/dist/modules/o11y/shared/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/shared/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +31 -0
- package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
- package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +31 -0
- package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/types/TypeDefinitions-Private.d.ts +14 -1
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/modules/o11y/simple_collector/library/PerformanceOfResources.d.ts +0 -27
- package/dist/modules/o11y/web_vitals/library/PerformanceOfResources.d.ts +0 -27
|
@@ -247,10 +247,16 @@ class IdleDetectorImpl {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
const
|
|
251
|
-
"
|
|
252
|
-
"type":"double"},"
|
|
253
|
-
"type":"
|
|
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"}}}}}}}}}};
|
|
255
|
+
|
|
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"}}}}}}}}}};
|
|
254
260
|
|
|
255
261
|
class FuzzyMapper {
|
|
256
262
|
constructor(_fuzzyKeyRange) {
|
|
@@ -296,15 +302,15 @@ class FuzzyMapper {
|
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
const basicInitiatorTypes = ['fetch', 'xmlhttprequest'];
|
|
299
|
-
class
|
|
300
|
-
constructor(_instr,
|
|
305
|
+
class PerformanceObservability {
|
|
306
|
+
constructor(_instr, _logPerformanceActivityName, logLevel) {
|
|
301
307
|
this._instr = _instr;
|
|
302
|
-
this.
|
|
308
|
+
this._logPerformanceActivityName = _logPerformanceActivityName;
|
|
303
309
|
this._fuzzyMapper = new FuzzyMapper(50);
|
|
304
310
|
this._isStarted = false;
|
|
305
311
|
this._hasPerf =
|
|
306
312
|
typeof performance !== 'undefined' && typeof PerformanceObserver === 'function';
|
|
307
|
-
this.
|
|
313
|
+
this._boundOobserverCallback = this._logPerformanceEntries.bind(this);
|
|
308
314
|
if (!logLevel || logLevel.toLowerCase() === 'full') {
|
|
309
315
|
this._logLevel = 1;
|
|
310
316
|
}
|
|
@@ -318,20 +324,29 @@ class PerformanceOfResources {
|
|
|
318
324
|
get isStarted() {
|
|
319
325
|
return this._isStarted;
|
|
320
326
|
}
|
|
327
|
+
get logLevel() {
|
|
328
|
+
return this._logLevel;
|
|
329
|
+
}
|
|
321
330
|
start() {
|
|
322
331
|
if (!this._hasPerf) {
|
|
323
332
|
return;
|
|
324
333
|
}
|
|
325
334
|
if (!this._isStarted) {
|
|
326
335
|
this._isStarted = true;
|
|
327
|
-
this.
|
|
328
|
-
this.
|
|
336
|
+
this._navigationObserver = new PerformanceObserver(this._boundOobserverCallback);
|
|
337
|
+
this._navigationObserver.observe({ type: 'navigation', buffered: true });
|
|
338
|
+
this._resourceObserver = new PerformanceObserver(this._boundOobserverCallback);
|
|
339
|
+
this._resourceObserver.observe({ type: 'resource', buffered: true });
|
|
329
340
|
}
|
|
330
341
|
}
|
|
331
342
|
stop() {
|
|
332
|
-
if (this.
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
343
|
+
if (this._resourceObserver) {
|
|
344
|
+
this._resourceObserver.disconnect();
|
|
345
|
+
this._resourceObserver = undefined;
|
|
346
|
+
}
|
|
347
|
+
if (this._navigationObserver) {
|
|
348
|
+
this._navigationObserver.disconnect();
|
|
349
|
+
this._navigationObserver = undefined;
|
|
335
350
|
}
|
|
336
351
|
this._fuzzyMapper.clear();
|
|
337
352
|
this._isStarted = false;
|
|
@@ -339,10 +354,9 @@ class PerformanceOfResources {
|
|
|
339
354
|
addEntry(url, perfTime, data) {
|
|
340
355
|
this._fuzzyMapper.add(url, perfTime, data);
|
|
341
356
|
}
|
|
342
|
-
|
|
357
|
+
_resourceEntryToResourceTiming(prt) {
|
|
343
358
|
var _a, _b;
|
|
344
|
-
const
|
|
345
|
-
const nr = {
|
|
359
|
+
const rt = {
|
|
346
360
|
name: prt.name,
|
|
347
361
|
startTime: prt.startTime,
|
|
348
362
|
duration: prt.duration,
|
|
@@ -365,36 +379,65 @@ class PerformanceOfResources {
|
|
|
365
379
|
transferSize: prt.transferSize,
|
|
366
380
|
encodedBodySize: prt.encodedBodySize,
|
|
367
381
|
decodedBodySize: prt.decodedBodySize,
|
|
368
|
-
responseStatus: prt.responseStatus
|
|
369
|
-
srvReqId: requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.requestId,
|
|
370
|
-
xhrDelay: requestInfo
|
|
371
|
-
? requestInfo.activityDuration - (prt.startTime + prt.duration)
|
|
372
|
-
: undefined
|
|
382
|
+
responseStatus: prt.responseStatus
|
|
373
383
|
};
|
|
374
384
|
const sts = prt.serverTiming;
|
|
375
385
|
if (Array.isArray(sts)) {
|
|
376
|
-
|
|
377
|
-
|
|
386
|
+
rt.dbDuration = (_a = sts.find((st) => st.name === 'db')) === null || _a === void 0 ? void 0 : _a.duration;
|
|
387
|
+
rt.srvDuration = (_b = sts.find((st) => st.name === 'Total')) === null || _b === void 0 ? void 0 : _b.duration;
|
|
378
388
|
}
|
|
379
|
-
return
|
|
389
|
+
return rt;
|
|
380
390
|
}
|
|
381
391
|
_shouldInclude(entry) {
|
|
382
392
|
if (this._logLevel === 1) {
|
|
383
393
|
return true;
|
|
384
394
|
}
|
|
385
|
-
return basicInitiatorTypes.indexOf(entry.initiatorType) >= 0
|
|
395
|
+
return (basicInitiatorTypes.indexOf(entry.initiatorType) >= 0 ||
|
|
396
|
+
entry.entryType === 'navigation');
|
|
386
397
|
}
|
|
387
|
-
|
|
398
|
+
_logActivity(schema, payload) {
|
|
399
|
+
const options = {
|
|
400
|
+
perfStartOverride: payload.startTime,
|
|
401
|
+
perfStopOverride: payload.startTime + payload.duration
|
|
402
|
+
};
|
|
403
|
+
this._instr.startActivity(this._logPerformanceActivityName).stop(schema, payload, options);
|
|
404
|
+
}
|
|
405
|
+
_logPerformanceEntries(list) {
|
|
406
|
+
for (const entry of list.getEntriesByType('navigation')) {
|
|
407
|
+
const nt = entry;
|
|
408
|
+
if (this._shouldInclude(nt)) {
|
|
409
|
+
if (nt !== this._navTiming) {
|
|
410
|
+
this._navTiming = nt;
|
|
411
|
+
const payload = this._resourceEntryToResourceTiming(nt);
|
|
412
|
+
const navOnly = {
|
|
413
|
+
domComplete: nt.domComplete,
|
|
414
|
+
domContentLoadedEventStart: nt.domContentLoadedEventStart,
|
|
415
|
+
domContentLoadedEventEnd: nt.domContentLoadedEventEnd,
|
|
416
|
+
domInteractive: nt.domInteractive,
|
|
417
|
+
loadEventStart: nt.loadEventStart,
|
|
418
|
+
loadEventEnd: nt.loadEventEnd,
|
|
419
|
+
redirectCount: nt.redirectCount,
|
|
420
|
+
type: nt.type,
|
|
421
|
+
unloadEventStart: nt.unloadEventStart,
|
|
422
|
+
unloadEventEnd: nt.unloadEventEnd
|
|
423
|
+
};
|
|
424
|
+
this._logActivity(navigation_timing, Object.assign(payload, navOnly));
|
|
425
|
+
}
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
388
429
|
for (const entry of list.getEntriesByType('resource')) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
430
|
+
const rt = entry;
|
|
431
|
+
if (this._shouldInclude(rt)) {
|
|
432
|
+
const payload = this._resourceEntryToResourceTiming(rt);
|
|
433
|
+
const requestInfo = this._fuzzyMapper.pop(rt.name, rt.startTime);
|
|
434
|
+
Object.assign(payload, {
|
|
435
|
+
srvReqId: requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.requestId,
|
|
436
|
+
xhrDelay: requestInfo
|
|
437
|
+
? requestInfo.activityDuration - (rt.startTime + rt.duration)
|
|
438
|
+
: undefined
|
|
439
|
+
});
|
|
440
|
+
this._logActivity(resource_timing, payload);
|
|
398
441
|
}
|
|
399
442
|
}
|
|
400
443
|
}
|
|
@@ -503,14 +546,14 @@ class Tracing {
|
|
|
503
546
|
Tracing._global.XMLHttpRequest.prototype.send = Tracing._originalXhrSend;
|
|
504
547
|
Tracing._originalXhrSend = undefined;
|
|
505
548
|
}
|
|
506
|
-
if (Tracing.
|
|
507
|
-
Tracing.
|
|
508
|
-
Tracing.
|
|
549
|
+
if (Tracing._performanceObservability) {
|
|
550
|
+
Tracing._performanceObservability.stop();
|
|
551
|
+
Tracing._performanceObservability = undefined;
|
|
509
552
|
}
|
|
510
553
|
Tracing._isNetworkInstrumentationEnabled = false;
|
|
511
554
|
}
|
|
512
555
|
}
|
|
513
|
-
_enableNetworkInstrumentation(instr, logErrors, activityName, useTracing, options, tasker,
|
|
556
|
+
_enableNetworkInstrumentation(instr, logErrors, activityName, useTracing, options, tasker, logPerformance, logPerformanceActivityName) {
|
|
514
557
|
if (typeof Tracing._global.fetch === 'function') {
|
|
515
558
|
this._overrideFetch(instr, logErrors, activityName, useTracing, options, tasker);
|
|
516
559
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
@@ -519,9 +562,9 @@ class Tracing {
|
|
|
519
562
|
this._overrideXhr(instr, logErrors, activityName, useTracing, options, tasker);
|
|
520
563
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
521
564
|
}
|
|
522
|
-
if (
|
|
523
|
-
Tracing.
|
|
524
|
-
Tracing.
|
|
565
|
+
if (logPerformance) {
|
|
566
|
+
Tracing._performanceObservability = new PerformanceObservability(instr, logPerformanceActivityName, logPerformance === true ? 'full' : logPerformance);
|
|
567
|
+
Tracing._performanceObservability.start();
|
|
525
568
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
526
569
|
}
|
|
527
570
|
}
|
|
@@ -627,9 +670,9 @@ class Tracing {
|
|
|
627
670
|
finally {
|
|
628
671
|
try {
|
|
629
672
|
const activityDuration = Tracing._endActivity(activity, url, method);
|
|
630
|
-
if ((_a = Tracing.
|
|
673
|
+
if ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) {
|
|
631
674
|
const requestId = Tracing._extractHeader(headerRequestId, resource, options);
|
|
632
|
-
Tracing.
|
|
675
|
+
Tracing._performanceObservability.addEntry(url, fetchTime, {
|
|
633
676
|
requestId,
|
|
634
677
|
activityDuration
|
|
635
678
|
});
|
|
@@ -645,7 +688,7 @@ class Tracing {
|
|
|
645
688
|
static _endActivity(activity, url, method) {
|
|
646
689
|
var _a;
|
|
647
690
|
if (activity) {
|
|
648
|
-
if (activity.getErrorCount() == 0 || ((_a = Tracing.
|
|
691
|
+
if (activity.getErrorCount() == 0 || ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
|
|
649
692
|
activity.discard();
|
|
650
693
|
}
|
|
651
694
|
else {
|
|
@@ -666,9 +709,9 @@ class Tracing {
|
|
|
666
709
|
var _a;
|
|
667
710
|
if (xhr._o11y) {
|
|
668
711
|
const activityDuration = Tracing._endActivity(xhr._o11y.activity, xhr._o11y.url, xhr._o11y.method);
|
|
669
|
-
if (!failedAtInit && ((_a = Tracing.
|
|
712
|
+
if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
|
|
670
713
|
const requestId = xhr.getResponseHeader(headerRequestId);
|
|
671
|
-
Tracing.
|
|
714
|
+
Tracing._performanceObservability.addEntry(xhr._o11y.url, xhr._o11y.sendTime, {
|
|
672
715
|
requestId,
|
|
673
716
|
activityDuration
|
|
674
717
|
});
|
|
@@ -758,7 +801,7 @@ class Tracing {
|
|
|
758
801
|
if (utility.definedValueOrDefault(tracingOptions.useTasker, true)) {
|
|
759
802
|
tasker = (_a = this._idleDetector) === null || _a === void 0 ? void 0 : _a.declareNotifierTaskMulti('o11y network');
|
|
760
803
|
}
|
|
761
|
-
this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this._instr), utility.definedValueOrDefault(tracingOptions.logErrors, true), tracingOptions.activityName, utility.definedValueOrDefault(tracingOptions.useTracing, true), tracingOptions.tracingHeadersOptions, tasker, utility.definedValueOrDefault(tracingOptions.
|
|
804
|
+
this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this._instr), utility.definedValueOrDefault(tracingOptions.logErrors, true), tracingOptions.activityName, utility.definedValueOrDefault(tracingOptions.useTracing, true), tracingOptions.tracingHeadersOptions, tasker, utility.definedValueOrDefault(tracingOptions.logPerformance, true), utility.definedValueOrDefault(tracingOptions.logPerformanceActivityName, 'perf-timing'));
|
|
762
805
|
}
|
|
763
806
|
}
|
|
764
807
|
resetRequestCounter() {
|
|
@@ -2396,7 +2439,7 @@ class ConsoleCollector {
|
|
|
2396
2439
|
}
|
|
2397
2440
|
}
|
|
2398
2441
|
|
|
2399
|
-
const version = '248.
|
|
2442
|
+
const version = '248.10.0';
|
|
2400
2443
|
|
|
2401
2444
|
const idleDetector = new IdleDetectorImpl({
|
|
2402
2445
|
logThreshold: 300,
|