o11y 248.9.0 → 248.11.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 (57) hide show
  1. package/dist/modules/o11y/client/client.js +153 -54
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/console-collector/ConsoleCollector.d.ts +8 -0
  4. package/dist/modules/o11y/client/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  5. package/dist/modules/o11y/client/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
  6. package/dist/modules/o11y/client/library/Tracing.d.ts +1 -1
  7. package/dist/modules/o11y/client/shared/PayloadUtility.d.ts +1 -0
  8. package/dist/modules/o11y/client/shared/SchemaUtil.d.ts +2 -0
  9. package/dist/modules/o11y/client/types/TypeDefinitions-Private.d.ts +14 -1
  10. package/dist/modules/o11y/client/version.d.ts +1 -1
  11. package/dist/modules/o11y/collectors/console-collector/ConsoleCollector.d.ts +8 -0
  12. package/dist/modules/o11y/collectors/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  13. package/dist/modules/o11y/collectors/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
  14. package/dist/modules/o11y/collectors/library/Tracing.d.ts +1 -1
  15. package/dist/modules/o11y/collectors/shared/PayloadUtility.d.ts +1 -0
  16. package/dist/modules/o11y/collectors/shared/SchemaUtil.d.ts +2 -0
  17. package/dist/modules/o11y/collectors/types/TypeDefinitions-Private.d.ts +14 -1
  18. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  19. package/dist/modules/o11y/core_envelope/console-collector/ConsoleCollector.d.ts +8 -0
  20. package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
  21. package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
  22. package/dist/modules/o11y/core_envelope/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  23. package/dist/modules/o11y/core_envelope/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
  24. package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +1 -1
  25. package/dist/modules/o11y/core_envelope/shared/PayloadUtility.d.ts +1 -0
  26. package/dist/modules/o11y/core_envelope/shared/SchemaUtil.d.ts +2 -0
  27. package/dist/modules/o11y/core_envelope/types/TypeDefinitions-Private.d.ts +14 -1
  28. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  29. package/dist/modules/o11y/shared/console-collector/ConsoleCollector.d.ts +8 -0
  30. package/dist/modules/o11y/shared/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  31. package/dist/modules/o11y/shared/library/{PerformanceOfResources.d.ts → PerformanceObservability.d.ts} +11 -7
  32. package/dist/modules/o11y/shared/library/Tracing.d.ts +1 -1
  33. package/dist/modules/o11y/shared/shared/PayloadUtility.d.ts +1 -0
  34. package/dist/modules/o11y/shared/shared/SchemaUtil.d.ts +2 -0
  35. package/dist/modules/o11y/shared/shared.js +23 -0
  36. package/dist/modules/o11y/shared/shared.js.map +1 -1
  37. package/dist/modules/o11y/shared/types/TypeDefinitions-Private.d.ts +14 -1
  38. package/dist/modules/o11y/shared/version.d.ts +1 -1
  39. package/dist/modules/o11y/simple_collector/console-collector/ConsoleCollector.d.ts +8 -0
  40. package/dist/modules/o11y/simple_collector/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  41. package/dist/modules/o11y/simple_collector/library/PerformanceObservability.d.ts +31 -0
  42. package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +1 -1
  43. package/dist/modules/o11y/simple_collector/shared/PayloadUtility.d.ts +1 -0
  44. package/dist/modules/o11y/simple_collector/shared/SchemaUtil.d.ts +2 -0
  45. package/dist/modules/o11y/simple_collector/types/TypeDefinitions-Private.d.ts +14 -1
  46. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  47. package/dist/modules/o11y/web_vitals/console-collector/ConsoleCollector.d.ts +8 -0
  48. package/dist/modules/o11y/web_vitals/interfaces/NetworkInstrumentationOptions.d.ts +2 -2
  49. package/dist/modules/o11y/web_vitals/library/PerformanceObservability.d.ts +31 -0
  50. package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +1 -1
  51. package/dist/modules/o11y/web_vitals/shared/PayloadUtility.d.ts +1 -0
  52. package/dist/modules/o11y/web_vitals/shared/SchemaUtil.d.ts +2 -0
  53. package/dist/modules/o11y/web_vitals/types/TypeDefinitions-Private.d.ts +14 -1
  54. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  55. package/package.json +2 -2
  56. package/dist/modules/o11y/simple_collector/library/PerformanceOfResources.d.ts +0 -27
  57. package/dist/modules/o11y/web_vitals/library/PerformanceOfResources.d.ts +0 -27
@@ -1,5 +1,5 @@
1
- import { networkSchema, simpleSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
2
- import { utility, PublicSafety, schemaUtil, maxStringLengthAppLimit, metricsUtility, payloadUtility } from 'o11y/shared';
1
+ import { networkSchema, simpleSchema, payloadDiagsSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
2
+ import { utility, PublicSafety, schemaUtil, maxStringLengthAppLimit, payloadUtility, metricsUtility } from 'o11y/shared';
3
3
 
4
4
  class TaskerImpl {
5
5
  get isBusy() {
@@ -247,10 +247,16 @@ class IdleDetectorImpl {
247
247
  }
248
248
  }
249
249
 
250
- const network_request={namespace:"sfcore.network",name:"NetworkRequest",pbjsSchema:{"nested":{"sfcore":{"nested":{"network":{"nested":{"NetworkRequest":{"oneofs":{"_xhrDelay":{"oneof":["xhrDelay"]},"_renderBlockingStatus":{"oneof":["renderBlockingStatus"]},"_firstInterimResponseStart":{"oneof":["firstInterimResponseStart"]},"_srvDuration":{"oneof":["srvDuration"]},"_isCdnCached":{"oneof":["isCdnCached"]},"_dbDuration":{"oneof":["dbDuration"]},"_reqBatchCount":{"oneof":["reqBatchCount"]}},"fields":{"encodedBodySize":{"id":21,
251
- "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,"type":"bool"},"requestStart":{"id":16,
252
- "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,"type":"double"},"responseStatus":{"id":23,
253
- "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"}}}}}}}}}};
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 PerformanceOfResources {
300
- constructor(_instr, _logResourceTimingActivityName, logLevel) {
305
+ class PerformanceObservability {
306
+ constructor(_instr, _logPerformanceActivityName, logLevel) {
301
307
  this._instr = _instr;
302
- this._logResourceTimingActivityName = _logResourceTimingActivityName;
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._observerCallback = this._logResourceTimingEntries.bind(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._observer = new PerformanceObserver(this._observerCallback);
328
- this._observer.observe({ entryTypes: ['resource'], buffered: true });
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._observer) {
333
- this._observer.disconnect();
334
- this._observer = undefined;
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
- _resourceEntryToNetworkType(prt) {
357
+ _resourceEntryToResourceTiming(prt) {
343
358
  var _a, _b;
344
- const requestInfo = this._fuzzyMapper.pop(prt.name, prt.startTime);
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
- nr.dbDuration = (_a = sts.find((st) => st.name === 'db')) === null || _a === void 0 ? void 0 : _a.duration;
377
- nr.srvDuration = (_b = sts.find((st) => st.name === 'Total')) === null || _b === void 0 ? void 0 : _b.duration;
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 nr;
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
- _logResourceTimingEntries(list) {
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
- if (this._shouldInclude(entry)) {
390
- const payload = this._resourceEntryToNetworkType(entry);
391
- const options = {
392
- perfStartOverride: payload.startTime,
393
- perfStopOverride: payload.startTime + payload.duration
394
- };
395
- this._instr
396
- .startActivity(this._logResourceTimingActivityName)
397
- .stop(network_request, payload, options);
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._performanceOfResources) {
507
- Tracing._performanceOfResources.stop();
508
- Tracing._performanceOfResources = undefined;
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, logResourceTiming, logResourceTimingActivityName) {
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 (logResourceTiming) {
523
- Tracing._performanceOfResources = new PerformanceOfResources(instr, logResourceTimingActivityName, logResourceTiming === true ? 'full' : logResourceTiming);
524
- Tracing._performanceOfResources.start();
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._performanceOfResources) === null || _a === void 0 ? void 0 : _a.isStarted) {
673
+ if ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted) {
631
674
  const requestId = Tracing._extractHeader(headerRequestId, resource, options);
632
- Tracing._performanceOfResources.addEntry(url, fetchTime, {
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._performanceOfResources) === null || _a === void 0 ? void 0 : _a.isStarted)) {
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._performanceOfResources) === null || _a === void 0 ? void 0 : _a.isStarted)) {
712
+ if (!failedAtInit && ((_a = Tracing._performanceObservability) === null || _a === void 0 ? void 0 : _a.isStarted)) {
670
713
  const requestId = xhr.getResponseHeader(headerRequestId);
671
- Tracing._performanceOfResources.addEntry(xhr._o11y.url, xhr._o11y.sendTime, {
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.logResourceTiming, true), utility.definedValueOrDefault(tracingOptions.logResourceTimingActivityName, 'perf-res-timing'));
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() {
@@ -1454,7 +1497,16 @@ class InstrumentationImpl {
1454
1497
  });
1455
1498
  }
1456
1499
  _logInternal(loggerName, schema, data, timestamp, rootId) {
1457
- return this._nextGen.addLog(loggerName, schema, data, timestamp, rootId);
1500
+ const sequence = this._nextGen.addLog(loggerName, schema, data, timestamp, rootId);
1501
+ if (!utility.isProduction) {
1502
+ const extraFields = payloadUtility.getExtraFields(schema, data);
1503
+ if (!utility.isProduction && extraFields.length > 0) {
1504
+ this.error('Extra fields', payloadDiagsSchema, {
1505
+ extras: extraFields
1506
+ });
1507
+ }
1508
+ }
1509
+ return sequence;
1458
1510
  }
1459
1511
  error(error, userSchemaOrText, userData, options) {
1460
1512
  return this._safety.tryCatch(() => {
@@ -2358,6 +2410,7 @@ class Index {
2358
2410
  }
2359
2411
  const time = utility.time.bind(utility);
2360
2412
 
2413
+ const lightningLoggerSchemaId = 'sfcore.customCmp.CustomComponentLog';
2361
2414
  const bgColorMap = {
2362
2415
  Error: 'Crimson',
2363
2416
  Activity: 'CadetBlue',
@@ -2374,29 +2427,75 @@ const defaultColor = 'black';
2374
2427
  const defaultBgColor = 'Gainsboro';
2375
2428
  class ConsoleCollector {
2376
2429
  constructor(environment) {
2430
+ this._simpleFilters = new Set();
2431
+ this._regexFilters = [];
2377
2432
  if (environment) {
2378
2433
  this._log('ConsoleCollector', environment);
2379
2434
  }
2380
2435
  }
2381
2436
  collect(schema, data, logMeta) {
2437
+ const id = schemaUtil.getSchemaId(schema);
2438
+ if (!this._shouldLog(id)) {
2439
+ return;
2440
+ }
2441
+ if (id === lightningLoggerSchemaId) {
2442
+ this._logCustom(data);
2443
+ return;
2444
+ }
2382
2445
  let label, color, bgColor;
2383
- if (schema.namespace === 'sf.instrumentation') {
2446
+ if (schemaUtil.isInternal(schema)) {
2384
2447
  label = schema.name;
2385
2448
  color = colorMap[schema.name] || defaultColor;
2386
2449
  bgColor = bgColorMap[schema.name] || defaultBgColor;
2387
2450
  }
2388
2451
  else {
2389
- label = schemaUtil.getSchemaId(schema);
2452
+ label = id;
2390
2453
  }
2391
2454
  this._log(label, data, logMeta, color, bgColor);
2392
2455
  }
2456
+ _shouldLog(schemaId) {
2457
+ if (this._simpleFilters.size == 0 && this._regexFilters.length == 0) {
2458
+ return true;
2459
+ }
2460
+ return (this._simpleFilters.has(schemaId) || this._regexFilters.some((r) => r.test(schemaId)));
2461
+ }
2462
+ addFilter(filter) {
2463
+ if (filter instanceof RegExp) {
2464
+ this._regexFilters.push(filter);
2465
+ }
2466
+ else {
2467
+ this._simpleFilters.add(filter);
2468
+ }
2469
+ }
2470
+ removeFilter(filter) {
2471
+ if (filter instanceof RegExp) {
2472
+ const index = this._regexFilters.findIndex((r) => r.source === filter.source);
2473
+ if (index >= 0) {
2474
+ this._regexFilters.splice(index, 1);
2475
+ }
2476
+ }
2477
+ else {
2478
+ this._simpleFilters.delete(filter);
2479
+ }
2480
+ }
2481
+ clearFilters() {
2482
+ this._simpleFilters.clear();
2483
+ this._regexFilters.splice(0, this._regexFilters.length);
2484
+ }
2485
+ getFilters() {
2486
+ const filters = Array.from(this._simpleFilters);
2487
+ return filters.concat(this._regexFilters).sort();
2488
+ }
2393
2489
  _log(label, first, second, color = defaultColor, bgColor = defaultBgColor) {
2394
2490
  const css = `color:${color};background-color:${bgColor}`;
2395
2491
  console.log(`%cO11Y%c ${label}`, 'color:white;background-color:#FF6600;font-weight:bold', css, first || '', second || '');
2396
2492
  }
2493
+ _logCustom(data) {
2494
+ console.log('%clightning/logger', 'color:white;background-color:#00a1e0;font-weight:bold', data || '');
2495
+ }
2397
2496
  }
2398
2497
 
2399
- const version = '248.9.0';
2498
+ const version = '248.11.0';
2400
2499
 
2401
2500
  const idleDetector = new IdleDetectorImpl({
2402
2501
  logThreshold: 300,