o11y 252.6.0 → 252.7.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 (56) hide show
  1. package/dist/modules/o11y/client/client.js +30 -70
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/interfaces/Co11y.d.ts +5 -0
  4. package/dist/modules/o11y/client/interfaces/index.d.ts +1 -0
  5. package/dist/modules/o11y/client/library/MetricsImpl.d.ts +2 -2
  6. package/dist/modules/o11y/client/shared/Co11yImpl.d.ts +13 -0
  7. package/dist/modules/o11y/client/shared/PublicSafety.d.ts +6 -2
  8. package/dist/modules/o11y/client/{library → shared}/UpCounterImpl.d.ts +1 -1
  9. package/dist/modules/o11y/client/shared/index.d.ts +2 -0
  10. package/dist/modules/o11y/client/version.d.ts +1 -1
  11. package/dist/modules/o11y/collectors/interfaces/Co11y.d.ts +5 -0
  12. package/dist/modules/o11y/collectors/interfaces/index.d.ts +1 -0
  13. package/dist/modules/o11y/collectors/library/MetricsImpl.d.ts +2 -2
  14. package/dist/modules/o11y/collectors/shared/Co11yImpl.d.ts +13 -0
  15. package/dist/modules/o11y/collectors/shared/PublicSafety.d.ts +6 -2
  16. package/dist/modules/o11y/collectors/{library → shared}/UpCounterImpl.d.ts +1 -1
  17. package/dist/modules/o11y/collectors/shared/index.d.ts +2 -0
  18. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  19. package/dist/modules/o11y/core_envelope/interfaces/Co11y.d.ts +5 -0
  20. package/dist/modules/o11y/core_envelope/interfaces/index.d.ts +1 -0
  21. package/dist/modules/o11y/core_envelope/library/MetricsImpl.d.ts +2 -2
  22. package/dist/modules/o11y/core_envelope/shared/Co11yImpl.d.ts +13 -0
  23. package/dist/modules/o11y/core_envelope/shared/PublicSafety.d.ts +6 -2
  24. package/dist/modules/o11y/core_envelope/{library → shared}/UpCounterImpl.d.ts +1 -1
  25. package/dist/modules/o11y/core_envelope/shared/index.d.ts +2 -0
  26. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  27. package/dist/modules/o11y/shared/interfaces/Co11y.d.ts +5 -0
  28. package/dist/modules/o11y/shared/interfaces/index.d.ts +1 -0
  29. package/dist/modules/o11y/shared/library/MetricsImpl.d.ts +2 -2
  30. package/dist/modules/o11y/shared/shared/Co11yImpl.d.ts +13 -0
  31. package/dist/modules/o11y/shared/shared/PublicSafety.d.ts +6 -2
  32. package/dist/modules/o11y/shared/{library → shared}/UpCounterImpl.d.ts +1 -1
  33. package/dist/modules/o11y/shared/shared/index.d.ts +2 -0
  34. package/dist/modules/o11y/shared/shared.js +172 -63
  35. package/dist/modules/o11y/shared/shared.js.map +1 -1
  36. package/dist/modules/o11y/shared/version.d.ts +1 -1
  37. package/dist/modules/o11y/simple_collector/interfaces/Co11y.d.ts +5 -0
  38. package/dist/modules/o11y/simple_collector/interfaces/index.d.ts +1 -0
  39. package/dist/modules/o11y/simple_collector/library/MetricsImpl.d.ts +2 -2
  40. package/dist/modules/o11y/simple_collector/shared/Co11yImpl.d.ts +13 -0
  41. package/dist/modules/o11y/simple_collector/shared/PublicSafety.d.ts +6 -2
  42. package/dist/modules/o11y/simple_collector/shared/UpCounterImpl.d.ts +22 -0
  43. package/dist/modules/o11y/simple_collector/shared/index.d.ts +2 -0
  44. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  45. package/dist/modules/o11y/web_vitals/interfaces/Co11y.d.ts +5 -0
  46. package/dist/modules/o11y/web_vitals/interfaces/index.d.ts +1 -0
  47. package/dist/modules/o11y/web_vitals/library/MetricsImpl.d.ts +2 -2
  48. package/dist/modules/o11y/web_vitals/shared/Co11yImpl.d.ts +13 -0
  49. package/dist/modules/o11y/web_vitals/shared/PublicSafety.d.ts +6 -2
  50. package/dist/modules/o11y/web_vitals/shared/UpCounterImpl.d.ts +22 -0
  51. package/dist/modules/o11y/web_vitals/shared/index.d.ts +2 -0
  52. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  53. package/dist/modules/o11y/web_vitals/web_vitals.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/modules/o11y/simple_collector/library/UpCounterImpl.d.ts +0 -22
  56. package/dist/modules/o11y/web_vitals/library/UpCounterImpl.d.ts +0 -22
@@ -1,5 +1,5 @@
1
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';
2
+ import { utility, PublicSafety, schemaUtil, UpCounterImpl, maxStringLengthAppLimit, payloadUtility, metricsUtility, co11y } from 'o11y/shared';
3
3
 
4
4
  class TaskerImpl {
5
5
  get isBusy() {
@@ -961,7 +961,7 @@ class ActivityImpl {
961
961
  error = new Error(error);
962
962
  }
963
963
  this._onError(error, this._getDetail(userSchemaOrText, userData));
964
- });
964
+ }, { op: 'activity.error' });
965
965
  }
966
966
  stop(userSchemaOrText, userData, options) {
967
967
  this._safety.tryCatch(() => {
@@ -990,7 +990,7 @@ class ActivityImpl {
990
990
  }
991
991
  }
992
992
  this._stopInternal(userSchemaOrText, userData, options);
993
- });
993
+ }, { op: 'activity.stop' });
994
994
  }
995
995
  _overrideTimer(perfStartTime, perfStopTime) {
996
996
  if (perfStartTime !== undefined) {
@@ -1049,13 +1049,13 @@ class ActivityImpl {
1049
1049
  this._safety.tryCatch(() => {
1050
1050
  this._stopReason = this._stopReason || stopReason.discarded;
1051
1051
  this.stop();
1052
- });
1052
+ }, { op: 'activity.discard' });
1053
1053
  }
1054
1054
  terminate(userSchemaOrText, userData, options) {
1055
1055
  this._safety.tryCatch(() => {
1056
1056
  this._stopReason = this._stopReason || stopReason.terminated;
1057
1057
  this.stop(userSchemaOrText, userData, options);
1058
- });
1058
+ }, { op: 'activity.terminate' });
1059
1059
  }
1060
1060
  getIsSampled() {
1061
1061
  return this._isSampled || false;
@@ -1249,56 +1249,6 @@ class BucketHistogramImpl {
1249
1249
  }
1250
1250
  }
1251
1251
 
1252
- class UpCounterImpl {
1253
- constructor(_name, _ownerName, _ownerAppName, _tags, createdOn, lastUpdatedOn, value) {
1254
- this._name = _name;
1255
- this._ownerName = _ownerName;
1256
- this._ownerAppName = _ownerAppName;
1257
- this._tags = _tags;
1258
- this._value = 0;
1259
- this._createdOn = createdOn === undefined ? utility.time().tsNow : createdOn;
1260
- if (lastUpdatedOn !== undefined) {
1261
- this._lastUpdatedOn = lastUpdatedOn;
1262
- }
1263
- if (value !== undefined) {
1264
- this._value = value;
1265
- }
1266
- }
1267
- getName() {
1268
- return this._name;
1269
- }
1270
- getCreatedOn() {
1271
- return this._createdOn;
1272
- }
1273
- getLastUpdatedOn() {
1274
- return this._lastUpdatedOn;
1275
- }
1276
- getData() {
1277
- return this._value;
1278
- }
1279
- increment(value = 1) {
1280
- if (typeof value === 'number' && value > 0) {
1281
- this._value += Math.round(value);
1282
- this._lastUpdatedOn = utility.time().tsNow;
1283
- return;
1284
- }
1285
- throw new Error('UpCounter can only increment positive numbers.');
1286
- }
1287
- reset() {
1288
- this._lastUpdatedOn = undefined;
1289
- this._value = 0;
1290
- }
1291
- getOwnerName() {
1292
- return this._ownerName;
1293
- }
1294
- getOwnerAppName() {
1295
- return this._ownerAppName;
1296
- }
1297
- getTags() {
1298
- return this._tags;
1299
- }
1300
- }
1301
-
1302
1252
  class ValueRecorderImpl {
1303
1253
  constructor(_name, _ownerName, _ownerAppName, _tags, createdOn, lastUpdatedOn, values) {
1304
1254
  this._name = _name;
@@ -1547,7 +1497,7 @@ class InstrumentationImpl {
1547
1497
  if (userPayload === null || userPayload === void 0 ? void 0 : userPayload.payload) {
1548
1498
  this._logInternal(this.name, userPayload.schema, userPayload.payload, timestamp, this._getEffectiveRootId(options));
1549
1499
  }
1550
- });
1500
+ }, { op: 'log' });
1551
1501
  }
1552
1502
  _logInternal(loggerName, schema, data, timestamp, rootId) {
1553
1503
  const sequence = this._nextGen.addLog(loggerName, schema, data, timestamp, rootId);
@@ -1571,7 +1521,7 @@ class InstrumentationImpl {
1571
1521
  utility.requireArgumentIfDefined(options, 'options', 'object');
1572
1522
  const rootId = this._getEffectiveRootId(options);
1573
1523
  this._errorInternal(error, userSchemaOrText, userData, undefined, rootId);
1574
- });
1524
+ }, { op: 'error' });
1575
1525
  }
1576
1526
  _errorInternal(err, userSchemaOrText, userData, activityId, rootActivityId) {
1577
1527
  const loggedTimestamp = utility.time().tsNow;
@@ -1619,7 +1569,7 @@ class InstrumentationImpl {
1619
1569
  }
1620
1570
  const activity = new ActivityImpl(name, context.rootId, this._onActivityStoppedCallback, this._onActivityErrorCallback, maxActivityDurationMsecs, options === null || options === void 0 ? void 0 : options.id, context.isRootActivitySampled, options === null || options === void 0 ? void 0 : options.perfStartOverride, noRerooting);
1621
1571
  return activity;
1622
- }, activityNoOp);
1572
+ }, activityNoOp, { op: 'startActivity' });
1623
1573
  }
1624
1574
  _getActivityData(detail) {
1625
1575
  const userPayload = this._wrapUserPayload(detail.userSchemaOrText, detail.userData, true);
@@ -1697,7 +1647,7 @@ class InstrumentationImpl {
1697
1647
  default:
1698
1648
  throw new Error(utility.notImplemented);
1699
1649
  }
1700
- });
1650
+ }, { op: 'domEvent' });
1701
1651
  }
1702
1652
  incrementCounter(operation, increment = 1, hasError = false, tags = {}) {
1703
1653
  this._safety.tryCatch(() => {
@@ -1715,7 +1665,7 @@ class InstrumentationImpl {
1715
1665
  ]);
1716
1666
  });
1717
1667
  this._metrics.incrementCounter(operation, increment, hasError, tags);
1718
- });
1668
+ }, { op: 'incrementCounter' });
1719
1669
  }
1720
1670
  trackValue(operation, value, hasError = false, tags = {}) {
1721
1671
  this._safety.tryCatch(() => {
@@ -1733,7 +1683,7 @@ class InstrumentationImpl {
1733
1683
  ]);
1734
1684
  });
1735
1685
  this._metrics.trackValue(operation, value, hasError, tags);
1736
- });
1686
+ }, { op: 'trackValue' });
1737
1687
  }
1738
1688
  bucketValue(operation, value, buckets = [], hasError = false, tags = {}) {
1739
1689
  this._safety.tryCatch(() => {
@@ -1755,7 +1705,7 @@ class InstrumentationImpl {
1755
1705
  ]);
1756
1706
  });
1757
1707
  this._metrics.bucketValue(operation, value, buckets, hasError, tags);
1758
- });
1708
+ }, { op: 'bucketValue' });
1759
1709
  }
1760
1710
  getUpCounters() {
1761
1711
  return this._metrics.getUpCounters().filter((m) => m.getLastUpdatedOn());
@@ -1942,7 +1892,7 @@ class AppInstrumentationImpl extends InstrumentationImpl {
1942
1892
  this._singleRootActivity = newRootActivity;
1943
1893
  }
1944
1894
  return newRootActivity;
1945
- }, rootActivityNoOp);
1895
+ }, rootActivityNoOp, { op: 'startRootActivity' });
1946
1896
  }
1947
1897
  _handleRootActivityStop(detail) {
1948
1898
  const historyEntry = this._rootActivityHistory.findById(detail.id);
@@ -2268,6 +2218,7 @@ class NextgenImpl {
2268
2218
  if (instr) {
2269
2219
  throw new Error(`The instrumentation name ${name} is already taken`);
2270
2220
  }
2221
+ co11y.setOwnerAppName(name);
2271
2222
  this._initOpMode(options === null || options === void 0 ? void 0 : options.operationMode);
2272
2223
  this._isSender = this._opMode === 'sender';
2273
2224
  this._isReceiver = this._opMode === 'receiver';
@@ -2492,18 +2443,27 @@ class NextgenImpl {
2492
2443
  }
2493
2444
  _getAllUpCounters() {
2494
2445
  var _a;
2495
- const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getUpCounters());
2496
- return arrOfArrs.reduce((pv, cv) => pv.concat(cv), ((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getUpCounters()) || []);
2446
+ return (((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getUpCounters()) || [])
2447
+ .concat(Array.from(this._instruments.values())
2448
+ .map((instr) => instr.getUpCounters())
2449
+ .flat())
2450
+ .concat(co11y.getUpCounters());
2497
2451
  }
2498
2452
  _getAllValueRecorders() {
2499
2453
  var _a;
2500
- const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getValueRecorders());
2501
- return arrOfArrs.reduce((pv, cv) => pv.concat(cv), ((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getValueRecorders()) || []);
2454
+ return (((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getValueRecorders()) || [])
2455
+ .concat(Array.from(this._instruments.values())
2456
+ .map((instr) => instr.getValueRecorders())
2457
+ .flat())
2458
+ .concat(co11y.getValueRecorders());
2502
2459
  }
2503
2460
  _getAllBucketHistograms() {
2504
2461
  var _a;
2505
- const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getBucketHistograms());
2506
- return arrOfArrs.reduce((pv, cv) => pv.concat(cv), ((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getBucketHistograms()) || []);
2462
+ return (((_a = this._metricsStore) === null || _a === void 0 ? void 0 : _a.getBucketHistograms()) || [])
2463
+ .concat(Array.from(this._instruments.values())
2464
+ .map((instr) => instr.getBucketHistograms())
2465
+ .flat())
2466
+ .concat(co11y.getBucketHistograms());
2507
2467
  }
2508
2468
  registerForLogPrompt(listener) {
2509
2469
  this._logCollectionListeners.add(listener);
@@ -2654,7 +2614,7 @@ class ConsoleCollector {
2654
2614
  }
2655
2615
  }
2656
2616
 
2657
- const version = '252.6.0';
2617
+ const version = '252.7.0';
2658
2618
 
2659
2619
  const idleDetector = new IdleDetectorImpl({
2660
2620
  logThreshold: 300,