o11y 248.14.0 → 248.16.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 +30 -10
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/NetworkInstrumentationOptions.d.ts +2 -0
- package/dist/modules/o11y/client/library/PerformanceObservability.d.ts +3 -2
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/interfaces/NetworkInstrumentationOptions.d.ts +2 -0
- package/dist/modules/o11y/collectors/library/PerformanceObservability.d.ts +3 -2
- 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 -0
- package/dist/modules/o11y/core_envelope/library/PerformanceObservability.d.ts +3 -2
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/NetworkInstrumentationOptions.d.ts +2 -0
- package/dist/modules/o11y/shared/library/PerformanceObservability.d.ts +3 -2
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/NetworkInstrumentationOptions.d.ts +2 -0
- package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +3 -2
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/NetworkInstrumentationOptions.d.ts +2 -0
- package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +3 -2
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +2 -3
|
@@ -303,14 +303,19 @@ class FuzzyMapper {
|
|
|
303
303
|
|
|
304
304
|
const basicInitiatorTypes = ['fetch', 'xmlhttprequest'];
|
|
305
305
|
class PerformanceObservability {
|
|
306
|
-
constructor(_instr, _logPerformanceActivityName, logLevel) {
|
|
306
|
+
constructor(_instr, fuzzyMapRange, _skipUrls, _logPerformanceActivityName, logLevel) {
|
|
307
307
|
this._instr = _instr;
|
|
308
|
+
this._skipUrls = _skipUrls;
|
|
308
309
|
this._logPerformanceActivityName = _logPerformanceActivityName;
|
|
309
|
-
this._fuzzyMapper = new FuzzyMapper(50);
|
|
310
310
|
this._isStarted = false;
|
|
311
|
+
utility.requireArgument(_instr, '_instr', 'object');
|
|
312
|
+
utility.requireArgument(fuzzyMapRange, 'fuzzyMapRange', 'number');
|
|
313
|
+
utility.requireArgumentIfDefined(_skipUrls, '_skipUrls', Array);
|
|
314
|
+
utility.requireArgumentIfDefined(_logPerformanceActivityName, '_logPerformanceActivityName', 'string');
|
|
315
|
+
utility.requireArgumentIfDefined(logLevel, 'logLevel', 'string');
|
|
311
316
|
this._hasPerf =
|
|
312
317
|
typeof performance !== 'undefined' && typeof PerformanceObserver === 'function';
|
|
313
|
-
this.
|
|
318
|
+
this._boundObserverCallback = this._logPerformanceEntries.bind(this);
|
|
314
319
|
if (!logLevel || logLevel.toLowerCase() === 'full') {
|
|
315
320
|
this._logLevel = 1;
|
|
316
321
|
}
|
|
@@ -320,6 +325,7 @@ class PerformanceObservability {
|
|
|
320
325
|
else {
|
|
321
326
|
throw new Error(`Invalid log level: ${logLevel}`);
|
|
322
327
|
}
|
|
328
|
+
this._fuzzyMapper = new FuzzyMapper(fuzzyMapRange);
|
|
323
329
|
}
|
|
324
330
|
get isStarted() {
|
|
325
331
|
return this._isStarted;
|
|
@@ -333,9 +339,9 @@ class PerformanceObservability {
|
|
|
333
339
|
}
|
|
334
340
|
if (!this._isStarted) {
|
|
335
341
|
this._isStarted = true;
|
|
336
|
-
this._navigationObserver = new PerformanceObserver(this.
|
|
342
|
+
this._navigationObserver = new PerformanceObserver(this._boundObserverCallback);
|
|
337
343
|
this._navigationObserver.observe({ type: 'navigation', buffered: true });
|
|
338
|
-
this._resourceObserver = new PerformanceObserver(this.
|
|
344
|
+
this._resourceObserver = new PerformanceObserver(this._boundObserverCallback);
|
|
339
345
|
this._resourceObserver.observe({ type: 'resource', buffered: true });
|
|
340
346
|
}
|
|
341
347
|
}
|
|
@@ -389,6 +395,18 @@ class PerformanceObservability {
|
|
|
389
395
|
return rt;
|
|
390
396
|
}
|
|
391
397
|
_shouldInclude(entry) {
|
|
398
|
+
var _a;
|
|
399
|
+
const isFiltered = (_a = this._skipUrls) === null || _a === void 0 ? void 0 : _a.some((skipUrl) => {
|
|
400
|
+
if (skipUrl instanceof RegExp) {
|
|
401
|
+
return skipUrl.test(entry.name);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
return entry.name === skipUrl;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
if (isFiltered) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
392
410
|
if (this._logLevel === 1) {
|
|
393
411
|
return true;
|
|
394
412
|
}
|
|
@@ -428,9 +446,9 @@ class PerformanceObservability {
|
|
|
428
446
|
}
|
|
429
447
|
for (const entry of list.getEntriesByType('resource')) {
|
|
430
448
|
const rt = entry;
|
|
449
|
+
const requestInfo = this._fuzzyMapper.pop(rt.name, rt.startTime);
|
|
431
450
|
if (this._shouldInclude(rt)) {
|
|
432
451
|
const payload = this._resourceEntryToResourceTiming(rt);
|
|
433
|
-
const requestInfo = this._fuzzyMapper.pop(rt.name, rt.startTime);
|
|
434
452
|
Object.assign(payload, {
|
|
435
453
|
srvReqId: requestInfo === null || requestInfo === void 0 ? void 0 : requestInfo.requestId,
|
|
436
454
|
xhrDelay: requestInfo
|
|
@@ -455,6 +473,8 @@ const headerParentSpanId = 'X-B3-ParentSpanId';
|
|
|
455
473
|
const headerRequestId = 'X-SFDC-Request-Id';
|
|
456
474
|
const defaultActivityNameForFetch = 'fetch';
|
|
457
475
|
const defaultActivityNameForXhrSend = 'xhr_send';
|
|
476
|
+
const defaultTimingActivityName = 'perf-timing';
|
|
477
|
+
const defaultFuzzyMapRange = 50;
|
|
458
478
|
class Tracing {
|
|
459
479
|
constructor(_instr, _idleDetector) {
|
|
460
480
|
this._instr = _instr;
|
|
@@ -553,7 +573,7 @@ class Tracing {
|
|
|
553
573
|
Tracing._isNetworkInstrumentationEnabled = false;
|
|
554
574
|
}
|
|
555
575
|
}
|
|
556
|
-
_enableNetworkInstrumentation(instr, logErrors, activityName, useTracing, options, tasker, logPerformance, logPerformanceActivityName) {
|
|
576
|
+
_enableNetworkInstrumentation(instr, logErrors, activityName, useTracing, options, tasker, logPerformance, logPerformanceActivityName, skipUrls, fuzzyMapRange) {
|
|
557
577
|
if (typeof Tracing._global.fetch === 'function') {
|
|
558
578
|
this._overrideFetch(instr, logErrors, activityName, useTracing, options, tasker);
|
|
559
579
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
@@ -563,7 +583,7 @@ class Tracing {
|
|
|
563
583
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
564
584
|
}
|
|
565
585
|
if (logPerformance) {
|
|
566
|
-
Tracing._performanceObservability = new PerformanceObservability(instr, logPerformanceActivityName, logPerformance === true ? 'full' : logPerformance);
|
|
586
|
+
Tracing._performanceObservability = new PerformanceObservability(instr, fuzzyMapRange, skipUrls, logPerformanceActivityName, logPerformance === true ? 'full' : logPerformance);
|
|
567
587
|
Tracing._performanceObservability.start();
|
|
568
588
|
Tracing._isNetworkInstrumentationEnabled = true;
|
|
569
589
|
}
|
|
@@ -801,7 +821,7 @@ class Tracing {
|
|
|
801
821
|
if (utility.definedValueOrDefault(tracingOptions.useTasker, true)) {
|
|
802
822
|
tasker = (_a = this._idleDetector) === null || _a === void 0 ? void 0 : _a.declareNotifierTaskMulti('o11y network');
|
|
803
823
|
}
|
|
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,
|
|
824
|
+
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, defaultTimingActivityName), utility.definedValueOrDefault(tracingOptions.skipUrls, []), utility.definedValueOrDefault(tracingOptions.fuzzyMapRange, defaultFuzzyMapRange));
|
|
805
825
|
}
|
|
806
826
|
}
|
|
807
827
|
resetRequestCounter() {
|
|
@@ -2499,7 +2519,7 @@ class ConsoleCollector {
|
|
|
2499
2519
|
}
|
|
2500
2520
|
}
|
|
2501
2521
|
|
|
2502
|
-
const version = '248.
|
|
2522
|
+
const version = '248.16.0';
|
|
2503
2523
|
|
|
2504
2524
|
const idleDetector = new IdleDetectorImpl({
|
|
2505
2525
|
logThreshold: 300,
|