o11y 246.5.0 → 248.1.2
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 +43 -31
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/client/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/client/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/client/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/client/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/client/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/client/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/client/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/client/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/client/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/client/types/TypeDefinitions-Private.d.ts +6 -2
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/interfaces/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/collectors/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/collectors/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/collectors/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/collectors/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/collectors/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/collectors/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/collectors/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/collectors/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/collectors/types/TypeDefinitions-Private.d.ts +6 -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/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/core_envelope/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/core_envelope/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/core_envelope/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/core_envelope/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/core_envelope/types/TypeDefinitions-Private.d.ts +6 -2
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/shared/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/shared/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/shared/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/shared/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/shared/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/shared/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/shared/shared.js +13 -0
- package/dist/modules/o11y/shared/shared.js.map +1 -1
- package/dist/modules/o11y/shared/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/shared/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/shared/types/TypeDefinitions-Private.d.ts +6 -2
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/simple_collector/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/simple_collector/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/simple_collector/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/simple_collector/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/simple_collector/types/TypeDefinitions-Private.d.ts +6 -2
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/DomEventApiOptions.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/interfaces/InstrumentedAppOptions.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/interfaces-private/EventData.d.ts +4 -0
- package/dist/modules/o11y/web_vitals/interfaces-private/InstrumentedEventData.d.ts +3 -2
- package/dist/modules/o11y/web_vitals/interfaces-private/index.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/library/DomEventHelpers.d.ts +4 -3
- package/dist/modules/o11y/web_vitals/library/NextgenImpl.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/test/MockMouseEvent.d.ts +4 -27
- package/dist/modules/o11y/web_vitals/test/MockUiEvent.d.ts +31 -0
- package/dist/modules/o11y/web_vitals/types/TypeDefinitions-Private.d.ts +6 -2
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -1,19 +1,6 @@
|
|
|
1
|
+
import { simpleSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
|
|
1
2
|
import { utility, PublicSafety, schemaUtil, metricsUtility } from 'o11y/shared';
|
|
2
3
|
|
|
3
|
-
const activity={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Activity":{"reserved":[[5,5],[7,7]],"fields":{"duration":{"id":3,"type":"double"},"stopReason":{"id":6,"type":"string"},"isRoot":{"id":8,"type":"bool"},"timerOverridden":{"id":12,"type":"uint32"},"name":{"options":{"(meta.max_length)":25},"id":2,"type":"string"},"isSampled":{"id":11,"type":"bool"},"preRootId":{"id":9,"type":"string"},"id":{"id":1,"type":"string"},
|
|
4
|
-
"userPayload":{"id":4,"type":"Payload"},"errorCount":{"id":10,"type":"uint32"},"parentId":{"id":13,"type":"string"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
|
|
5
|
-
|
|
6
|
-
const error={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Error":{"reserved":[[5,5],[7,7]],"fields":{"activityId":{"id":6,"type":"string"},"stack":{"id":3,"type":"string"},"name":{"id":1,"type":"string"},"message":{"options":{"(meta.max_length)":200},"id":2,"type":"string"},"userPayload":{"id":4,"type":"Payload"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
|
|
7
|
-
|
|
8
|
-
const idle_detector_report={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"IdleDetectorReport":{"fields":{"listenerCount":{"id":3,"type":"uint32"},"busyTasks":{"rule":"repeated","id":5,"type":"string"},"busyDurations":{"rule":"repeated","id":6,"type":"double"},"pollableCount":{"id":4,"type":"uint32"},"pollCounts":{"rule":"repeated","id":8,"type":"double"},"logThreshold":{"id":2,"type":"double"},"maxDuration":{"id":1,
|
|
9
|
-
"type":"double"},"pollables":{"rule":"repeated","id":7,"type":"string"}}}}}}}}}};
|
|
10
|
-
|
|
11
|
-
const instrumented_event={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"MouseEvent":{"fields":{"cancelable":{"id":5,"type":"bool"},"ctrlKey":{"id":9,"type":"bool"},"type":{"id":25,"type":"string"},"button":{"id":3,"type":"uint32"},"offsetX":{"id":17,"type":"uint32"},"eventPhase":{"id":12,"type":"uint32"},"shiftKey":{"id":23,"type":"bool"},"offsetY":{"id":18,"type":"uint32"},"composed":{"id":8,"type":"bool"},"altKey":{"id":1,
|
|
12
|
-
"type":"bool"},"isTrusted":{"id":13,"type":"bool"},"buttons":{"id":4,"type":"uint32"},"movementY":{"id":16,"type":"uint32"},"clientY":{"id":7,"type":"uint32"},"clientX":{"id":6,"type":"uint32"},"movementX":{"id":15,"type":"uint32"},"defaultPrevented":{"id":10,"type":"bool"},"metaKey":{"id":14,"type":"bool"},"timeStamp":{"id":24,"type":"double"},"bubbles":{"id":2,"type":"bool"},"detail":{"id":11,"type":"int64"},"pageY":{"id":20,"type":"uint32"},"pageX":{"id":19,"type":"uint32"},"screenX":{"id":21,
|
|
13
|
-
"type":"uint32"},"screenY":{"id":22,"type":"uint32"}}},"InstrumentedEvent":{"oneofs":{"event":{"oneof":["mouseEvent"]}},"reserved":[[4,4],"xpath",[6,6],[8,8]],"fields":{"mouseEvent":{"id":7,"type":"MouseEvent"},"auto":{"id":3,"type":"bool"},"parentComponent":{"id":2,"type":"string"},"ownerComponent":{"id":1,"type":"string"},"userPayload":{"id":5,"type":"Payload"},"simplePath":{"id":9,"type":"string"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
|
|
14
|
-
|
|
15
|
-
const simple={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Simple":{"fields":{"text":{"options":{"(meta.max_length)":25},"id":1,"type":"string"}}}}}}}}}};
|
|
16
|
-
|
|
17
4
|
class TaskerImpl {
|
|
18
5
|
get isBusy() {
|
|
19
6
|
return this._isOk ? this._busyCount > 0 : undefined;
|
|
@@ -814,19 +801,31 @@ class ActivityNoOp {
|
|
|
814
801
|
const activityNoOp = Object.freeze(new ActivityNoOp());
|
|
815
802
|
|
|
816
803
|
class DomEventHelpers {
|
|
817
|
-
getInstrumentedEventData(
|
|
804
|
+
getInstrumentedEventData(domEventDataField, domEventData, handledBy, userPayload) {
|
|
818
805
|
var _a;
|
|
819
806
|
const instrumentedEvent = {
|
|
820
807
|
ownerComponent: handledBy.tagName,
|
|
821
808
|
parentComponent: ((_a = handledBy.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) || undefined,
|
|
822
|
-
event: eventData,
|
|
823
809
|
simplePath: utility.getXpath(handledBy)
|
|
824
810
|
};
|
|
811
|
+
switch (domEventDataField) {
|
|
812
|
+
case 0:
|
|
813
|
+
instrumentedEvent.baseEvent = domEventData;
|
|
814
|
+
break;
|
|
815
|
+
case 1:
|
|
816
|
+
instrumentedEvent.mouseEvent = domEventData;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
825
819
|
if (userPayload) {
|
|
826
820
|
instrumentedEvent.userPayload = schemaUtil.makePayload(userPayload.schema, userPayload.payload, true);
|
|
827
821
|
}
|
|
828
822
|
return instrumentedEvent;
|
|
829
823
|
}
|
|
824
|
+
getEventData(e) {
|
|
825
|
+
return {
|
|
826
|
+
type: e.type
|
|
827
|
+
};
|
|
828
|
+
}
|
|
830
829
|
getMouseEventData(e) {
|
|
831
830
|
return {
|
|
832
831
|
altKey: e.altKey,
|
|
@@ -1379,7 +1378,7 @@ class InstrumentationImpl {
|
|
|
1379
1378
|
increment: (increment) => this._incrementError(increment)
|
|
1380
1379
|
});
|
|
1381
1380
|
this._metrics = this._initMetrics();
|
|
1382
|
-
const simpleTextOptions = schemaUtil.getOptions(
|
|
1381
|
+
const simpleTextOptions = schemaUtil.getOptions(simpleSchema, 'Simple', 'text');
|
|
1383
1382
|
this._simpleTextMaxLength = simpleTextOptions
|
|
1384
1383
|
? simpleTextOptions['(meta.max_length)']
|
|
1385
1384
|
: maxStringLengthAppLimit;
|
|
@@ -1396,7 +1395,7 @@ class InstrumentationImpl {
|
|
|
1396
1395
|
_wrapUserPayload(userSchemaOrText, userData, onlyIfBoth = false) {
|
|
1397
1396
|
let userSchema;
|
|
1398
1397
|
if (typeof userSchemaOrText === 'string') {
|
|
1399
|
-
userSchema =
|
|
1398
|
+
userSchema = simpleSchema;
|
|
1400
1399
|
if (userSchemaOrText) {
|
|
1401
1400
|
userData = {
|
|
1402
1401
|
text: userSchemaOrText.substring(0, this._simpleTextMaxLength)
|
|
@@ -1447,9 +1446,9 @@ class InstrumentationImpl {
|
|
|
1447
1446
|
}
|
|
1448
1447
|
_errorInternal(err, userSchemaOrText, userData, activityId, rootActivityId) {
|
|
1449
1448
|
const loggedTimestamp = utility.time().tsNow;
|
|
1450
|
-
let error
|
|
1449
|
+
let error;
|
|
1451
1450
|
if (err instanceof Error) {
|
|
1452
|
-
error
|
|
1451
|
+
error = err;
|
|
1453
1452
|
}
|
|
1454
1453
|
else {
|
|
1455
1454
|
let msg;
|
|
@@ -1459,17 +1458,17 @@ class InstrumentationImpl {
|
|
|
1459
1458
|
else {
|
|
1460
1459
|
msg = err.toString();
|
|
1461
1460
|
}
|
|
1462
|
-
error
|
|
1461
|
+
error = new Error(msg);
|
|
1463
1462
|
}
|
|
1464
1463
|
const userPayload = this._wrapUserPayload(userSchemaOrText, userData, true);
|
|
1465
1464
|
const errorData = {
|
|
1466
|
-
name: error
|
|
1467
|
-
message: error
|
|
1468
|
-
stack: error
|
|
1465
|
+
name: error.name,
|
|
1466
|
+
message: error.message,
|
|
1467
|
+
stack: error.stack,
|
|
1469
1468
|
userPayload,
|
|
1470
1469
|
activityId
|
|
1471
1470
|
};
|
|
1472
|
-
return this._logInternal(this.name,
|
|
1471
|
+
return this._logInternal(this.name, errorSchema, errorData, loggedTimestamp, rootActivityId);
|
|
1473
1472
|
}
|
|
1474
1473
|
startActivity(name, options) {
|
|
1475
1474
|
return this._safety.tryCatchReturn(() => {
|
|
@@ -1512,7 +1511,7 @@ class InstrumentationImpl {
|
|
|
1512
1511
|
this._logActivity(activityData, detail.startTimestamp, detail.rootId);
|
|
1513
1512
|
}
|
|
1514
1513
|
_logActivity(activityData, startTimestamp, rootId) {
|
|
1515
|
-
this._logInternal(this.name,
|
|
1514
|
+
this._logInternal(this.name, activitySchema, activityData, startTimestamp, rootId);
|
|
1516
1515
|
}
|
|
1517
1516
|
_handleActivityError(error, detail) {
|
|
1518
1517
|
this._errorInternal(error, detail.userSchemaOrText, detail.userData, detail.id, detail.rootId);
|
|
@@ -1552,10 +1551,14 @@ class InstrumentationImpl {
|
|
|
1552
1551
|
if (acd) {
|
|
1553
1552
|
acd.markEventHandled(mouseEvent);
|
|
1554
1553
|
}
|
|
1555
|
-
const
|
|
1556
|
-
const instrumentedEvent = domEventHelpers.getInstrumentedEventData(
|
|
1554
|
+
const captureMouse = options === null || options === void 0 ? void 0 : options.captureMouseData;
|
|
1555
|
+
const instrumentedEvent = domEventHelpers.getInstrumentedEventData(captureMouse
|
|
1556
|
+
? 1
|
|
1557
|
+
: 0, captureMouse
|
|
1558
|
+
? domEventHelpers.getMouseEventData(mouseEvent)
|
|
1559
|
+
: domEventHelpers.getEventData(mouseEvent), htmlElement, userPayload);
|
|
1557
1560
|
instrumentedEvent.auto = options === null || options === void 0 ? void 0 : options._auto;
|
|
1558
|
-
this._logInternal(this.name,
|
|
1561
|
+
this._logInternal(this.name, instrumentedEventSchema, instrumentedEvent, tsNow, rootId);
|
|
1559
1562
|
break;
|
|
1560
1563
|
}
|
|
1561
1564
|
default:
|
|
@@ -2077,6 +2080,7 @@ class NextgenImpl {
|
|
|
2077
2080
|
this._opMode = 'default';
|
|
2078
2081
|
this._isSender = false;
|
|
2079
2082
|
this._isReceiver = false;
|
|
2083
|
+
this._decimalPoints = 2;
|
|
2080
2084
|
}
|
|
2081
2085
|
registerApp(name, options) {
|
|
2082
2086
|
var _a;
|
|
@@ -2091,6 +2095,9 @@ class NextgenImpl {
|
|
|
2091
2095
|
this._initOpMode(options === null || options === void 0 ? void 0 : options.operationMode);
|
|
2092
2096
|
this._isSender = this._opMode === 'sender';
|
|
2093
2097
|
this._isReceiver = this._opMode === 'receiver';
|
|
2098
|
+
if ((options === null || options === void 0 ? void 0 : options.decimalPoints) !== undefined) {
|
|
2099
|
+
this._decimalPoints = options.decimalPoints;
|
|
2100
|
+
}
|
|
2094
2101
|
this._clientSessionId = ((_a = options === null || options === void 0 ? void 0 : options.clientSessionId) === null || _a === void 0 ? void 0 : _a.toString()) || utility.generateUniqueId();
|
|
2095
2102
|
this._appInstr = new AppInstrumentationImpl(this, name, options === null || options === void 0 ? void 0 : options.allowMultipleRootActivities);
|
|
2096
2103
|
this._instruments.set(name, this._appInstr);
|
|
@@ -2173,6 +2180,11 @@ class NextgenImpl {
|
|
|
2173
2180
|
if (!this._isSender) {
|
|
2174
2181
|
data = utility.clone(data);
|
|
2175
2182
|
}
|
|
2183
|
+
if (typeof this._decimalPoints === 'number') {
|
|
2184
|
+
utility.roundNumbersInObject(data, this._decimalPoints);
|
|
2185
|
+
utility.roundNumbersInObject(pagePayload === null || pagePayload === void 0 ? void 0 : pagePayload.payload, this._decimalPoints);
|
|
2186
|
+
utility.roundNumbersInObject(appPayload === null || appPayload === void 0 ? void 0 : appPayload.payload, this._decimalPoints);
|
|
2187
|
+
}
|
|
2176
2188
|
const logMeta = {
|
|
2177
2189
|
timestamp,
|
|
2178
2190
|
rootId,
|
|
@@ -2398,12 +2410,12 @@ class ConsoleCollector {
|
|
|
2398
2410
|
}
|
|
2399
2411
|
}
|
|
2400
2412
|
|
|
2401
|
-
const version = '
|
|
2413
|
+
const version = '248.1.2';
|
|
2402
2414
|
|
|
2403
2415
|
const idleDetector = new IdleDetectorImpl({
|
|
2404
2416
|
logThreshold: 300,
|
|
2405
2417
|
reportListener: (report) => {
|
|
2406
|
-
idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.log(
|
|
2418
|
+
idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.log(idleDetectorReportSchema, report);
|
|
2407
2419
|
},
|
|
2408
2420
|
errorListener: (e, text) => {
|
|
2409
2421
|
idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.error(e, text);
|