o11y 242.3.3 → 242.8.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 +201 -159
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/interfaces/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/client/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/client/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/client/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/client/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/client/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/client/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/client/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/client/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/client/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/client/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/client/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/client/test/TestEnvironment.d.ts +7 -0
- package/dist/modules/o11y/client/version.d.ts +1 -1
- package/dist/modules/o11y/collectors/collectors.js +4 -1
- package/dist/modules/o11y/collectors/collectors.js.map +1 -1
- package/dist/modules/o11y/collectors/interfaces/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/collectors/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/collectors/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/collectors/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/collectors/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/collectors/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/collectors/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/collectors/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/collectors/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/collectors/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/collectors/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/collectors/test/TestEnvironment.d.ts +7 -0
- 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/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/core_envelope/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/core_envelope/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/core_envelope/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/core_envelope/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/core_envelope/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/core_envelope/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/core_envelope/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/core_envelope/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/core_envelope/test/TestEnvironment.d.ts +7 -0
- package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
- package/dist/modules/o11y/shared/interfaces/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/shared/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/shared/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/shared/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/shared/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/shared/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/shared/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/shared/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/shared/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/shared/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/shared/shared.js +11 -15
- package/dist/modules/o11y/shared/shared.js.map +1 -1
- package/dist/modules/o11y/shared/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/shared/test/TestEnvironment.d.ts +7 -0
- package/dist/modules/o11y/shared/version.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/interfaces/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/simple_collector/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/simple_collector/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/simple_collector/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/simple_collector/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/simple_collector/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/simple_collector/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/simple_collector/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/simple_collector/simple_collector.js +2 -1
- package/dist/modules/o11y/simple_collector/simple_collector.js.map +1 -1
- package/dist/modules/o11y/simple_collector/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/simple_collector/test/TestEnvironment.d.ts +7 -0
- package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/interfaces/InstrumentationContext.d.ts +1 -0
- package/dist/modules/o11y/web_vitals/library/AppInstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/library/AutomaticClickTracker.d.ts +7 -7
- package/dist/modules/o11y/web_vitals/library/IdleDetectorImpl.d.ts +8 -8
- package/dist/modules/o11y/web_vitals/library/InstrumentationImpl.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/library/LogValidator.d.ts +5 -5
- package/dist/modules/o11y/web_vitals/library/MockObj.d.ts +3 -0
- package/dist/modules/o11y/web_vitals/library/NextgenImpl.d.ts +3 -3
- package/dist/modules/o11y/web_vitals/library/Tracing.d.ts +2 -2
- package/dist/modules/o11y/web_vitals/shared/SchemaUtil.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +1 -1
- package/dist/modules/o11y/web_vitals/test/MockMouseEvent.d.ts +47 -0
- package/dist/modules/o11y/web_vitals/test/TestEnvironment.d.ts +7 -0
- package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/modules/o11y/client/library/MockEvent.d.ts +0 -7
- package/dist/modules/o11y/collectors/library/MockEvent.d.ts +0 -7
- package/dist/modules/o11y/core_envelope/library/MockEvent.d.ts +0 -7
- package/dist/modules/o11y/shared/library/MockEvent.d.ts +0 -7
- package/dist/modules/o11y/simple_collector/library/MockEvent.d.ts +0 -7
- package/dist/modules/o11y/web_vitals/library/MockEvent.d.ts +0 -7
|
@@ -12,9 +12,9 @@ const headerParentSpanId = 'X-B3-ParentSpanId';
|
|
|
12
12
|
const defaultActivityNameForFetch = 'fetch';
|
|
13
13
|
const defaultActivityNameForXhrSend = 'xhr_send';
|
|
14
14
|
class Tracing {
|
|
15
|
-
constructor(
|
|
16
|
-
this.
|
|
17
|
-
utility.requireArgument(
|
|
15
|
+
constructor(_instr) {
|
|
16
|
+
this._instr = _instr;
|
|
17
|
+
utility.requireArgument(_instr, '_instr', 'object');
|
|
18
18
|
}
|
|
19
19
|
static _getB3CompactFormat(traceId, spanId, isSampled, parentSpanId) {
|
|
20
20
|
let b3 = `${traceId}-${spanId}`;
|
|
@@ -49,8 +49,8 @@ class Tracing {
|
|
|
49
49
|
static getHeaders(traceId, spanId, isSampled, options) {
|
|
50
50
|
utility.requireArgument(traceId, 'traceId', 'string');
|
|
51
51
|
utility.requireArgument(spanId, 'spanId', 'string');
|
|
52
|
-
const useB3Headers = options
|
|
53
|
-
traceId = this._conformTextAsId(traceId, options
|
|
52
|
+
const useB3Headers = options === null || options === void 0 ? void 0 : options.useB3Headers;
|
|
53
|
+
traceId = this._conformTextAsId(traceId, (options === null || options === void 0 ? void 0 : options.traceIdEffectiveLength) !== undefined
|
|
54
54
|
? options.traceIdEffectiveLength
|
|
55
55
|
: useB3Headers
|
|
56
56
|
? defaultTraceIdLengthB3
|
|
@@ -62,7 +62,7 @@ class Tracing {
|
|
|
62
62
|
undefined;
|
|
63
63
|
const headers = {};
|
|
64
64
|
if (useB3Headers) {
|
|
65
|
-
const isCompact = options
|
|
65
|
+
const isCompact = options === null || options === void 0 ? void 0 : options.useCompactHeader;
|
|
66
66
|
if (isCompact) {
|
|
67
67
|
headers[headerB3] = this._getB3CompactFormat(traceId, spanId, isSampled, parentSpanId);
|
|
68
68
|
}
|
|
@@ -210,7 +210,7 @@ class Tracing {
|
|
|
210
210
|
if (options) {
|
|
211
211
|
this._disableNetworkInstrumentation();
|
|
212
212
|
const tracingOptions = typeof options === 'object' ? options : {};
|
|
213
|
-
this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this.
|
|
213
|
+
this._enableNetworkInstrumentation(utility.definedValueOrDefault(tracingOptions.instrumentation, this._instr), utility.definedValueOrDefault(tracingOptions.logErrors, true), tracingOptions.activityName, utility.definedValueOrDefault(tracingOptions.useTracing, true), tracingOptions.tracingHeadersOptions);
|
|
214
214
|
}
|
|
215
215
|
else {
|
|
216
216
|
this._disableNetworkInstrumentation();
|
|
@@ -466,9 +466,10 @@ const activityNoOp = Object.freeze(new ActivityNoOp());
|
|
|
466
466
|
|
|
467
467
|
class DomEventHelpers {
|
|
468
468
|
getInstrumentedEventData(eventData, handledBy, userPayload) {
|
|
469
|
+
var _a;
|
|
469
470
|
const instrumentedEvent = {
|
|
470
471
|
ownerComponent: handledBy.tagName,
|
|
471
|
-
parentComponent: (handledBy.parentElement
|
|
472
|
+
parentComponent: ((_a = handledBy.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) || undefined,
|
|
472
473
|
event: eventData,
|
|
473
474
|
simplePath: utility.getXpath(handledBy)
|
|
474
475
|
};
|
|
@@ -554,6 +555,12 @@ class ValidationEntry {
|
|
|
554
555
|
case 7:
|
|
555
556
|
msg = 'Exceeded app limit for item count';
|
|
556
557
|
break;
|
|
558
|
+
case 12:
|
|
559
|
+
msg = 'Value must be an integer';
|
|
560
|
+
break;
|
|
561
|
+
case 13:
|
|
562
|
+
msg = 'Values like null or undefined are not allowed for items in repeated fields';
|
|
563
|
+
break;
|
|
557
564
|
default:
|
|
558
565
|
msg = `Unknown error code: ${this.errorCode}`;
|
|
559
566
|
break;
|
|
@@ -568,113 +575,146 @@ class LogValidator {
|
|
|
568
575
|
const schemaId = schemaUtil.getSchemaId(schema);
|
|
569
576
|
const errorInfos = new Array();
|
|
570
577
|
const nestedSchema = schemaUtil.getTypes(schema);
|
|
571
|
-
this.
|
|
578
|
+
this._validateFields(errorInfos, [], data, nestedSchema[schemaTokens.message], nestedSchema, schemaId);
|
|
572
579
|
if (errorInfos.length && !noThrow) {
|
|
573
580
|
throw new Error(errorInfos[0].asMessage(schemaId));
|
|
574
581
|
}
|
|
575
582
|
return errorInfos;
|
|
576
583
|
}
|
|
577
|
-
|
|
584
|
+
_validateFields(errorInfos, fieldNames, data, message, descriptor, schemaId) {
|
|
578
585
|
const oneofs = message.oneofs || {};
|
|
579
586
|
const fields = message.fields || {};
|
|
580
587
|
for (const key in data) {
|
|
581
588
|
const value = data[key];
|
|
582
|
-
if (
|
|
583
|
-
const mft = (fieldType,
|
|
589
|
+
if (value !== undefined && value !== null) {
|
|
590
|
+
const mft = (fieldType, isRepeated, isItem) => this._matchFieldTypes(errorInfos, [...fieldNames, key], value, fieldType, descriptor, schemaId, key, isRepeated, isItem);
|
|
584
591
|
if (oneofs[key]) {
|
|
585
592
|
mft(fields[oneofs[key].oneof[0]].type);
|
|
586
593
|
}
|
|
587
594
|
else if (fields[key]) {
|
|
588
|
-
mft(fields[key].type, fields[key].rule);
|
|
595
|
+
mft(fields[key].type, fields[key].rule === 'repeated');
|
|
589
596
|
}
|
|
590
597
|
}
|
|
591
598
|
}
|
|
592
599
|
}
|
|
593
|
-
|
|
594
|
-
return val === undefined || val === null || val === '';
|
|
595
|
-
}
|
|
596
|
-
matchFieldTypes(errorInfos, fieldNames, fieldDataValue, protobufType, descriptor, schemaId, key, rule) {
|
|
600
|
+
_matchFieldTypes(errorInfos, fieldNames, fieldDataValue, protobufType, descriptor, schemaId, key, isRepeated, isItem) {
|
|
597
601
|
let errorCode;
|
|
598
|
-
if (
|
|
602
|
+
if (isRepeated) {
|
|
599
603
|
if (Array.isArray(fieldDataValue)) {
|
|
600
604
|
if (fieldDataValue.length > maxItemCountAppLimit) {
|
|
601
605
|
errorCode = 7;
|
|
602
606
|
}
|
|
603
607
|
fieldDataValue.forEach((value, index) => {
|
|
604
|
-
this.
|
|
608
|
+
this._matchFieldTypes(errorInfos, [...fieldNames, index.toString()], value, protobufType, descriptor, schemaId, key, undefined, true);
|
|
605
609
|
});
|
|
606
610
|
}
|
|
607
611
|
else {
|
|
608
612
|
errorCode = 1;
|
|
609
613
|
}
|
|
610
|
-
|
|
611
|
-
|
|
614
|
+
}
|
|
615
|
+
else if (fieldDataValue == null || fieldDataValue === undefined) {
|
|
616
|
+
if (isItem) {
|
|
617
|
+
errorCode = 13;
|
|
612
618
|
}
|
|
613
|
-
return;
|
|
614
619
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
620
|
+
else {
|
|
621
|
+
let numOpts;
|
|
622
|
+
let javaScriptType;
|
|
623
|
+
switch (protobufType) {
|
|
624
|
+
case 'string':
|
|
625
|
+
javaScriptType = 'string';
|
|
626
|
+
if (fieldDataValue.length > maxStringLengthAppLimit) {
|
|
627
|
+
errorCode = 6;
|
|
628
|
+
}
|
|
629
|
+
break;
|
|
630
|
+
case 'bytes':
|
|
631
|
+
javaScriptType = 'object';
|
|
632
|
+
if (!(fieldDataValue instanceof Uint8Array)) {
|
|
633
|
+
errorCode = 5;
|
|
634
|
+
}
|
|
635
|
+
break;
|
|
636
|
+
case 'bool':
|
|
637
|
+
javaScriptType = 'boolean';
|
|
638
|
+
break;
|
|
639
|
+
case 'uint32':
|
|
640
|
+
javaScriptType = 'number';
|
|
641
|
+
numOpts = {
|
|
642
|
+
min: minUnsigned,
|
|
643
|
+
max: maxFourBytesUnsigned,
|
|
644
|
+
isInt: true,
|
|
645
|
+
isItem
|
|
646
|
+
};
|
|
647
|
+
break;
|
|
648
|
+
case 'int32':
|
|
649
|
+
case 'sint32':
|
|
650
|
+
case 'fixed32':
|
|
651
|
+
case 'sfixed32':
|
|
652
|
+
javaScriptType = 'number';
|
|
653
|
+
numOpts = {
|
|
654
|
+
min: minFourBytes,
|
|
655
|
+
max: maxFourBytes,
|
|
656
|
+
isInt: true,
|
|
657
|
+
isItem
|
|
658
|
+
};
|
|
659
|
+
break;
|
|
660
|
+
case 'uint64':
|
|
661
|
+
javaScriptType = 'number';
|
|
662
|
+
numOpts = {
|
|
663
|
+
min: minUnsigned,
|
|
664
|
+
max: maxEightBytesUnsigned,
|
|
665
|
+
isInt: true,
|
|
666
|
+
isItem
|
|
667
|
+
};
|
|
668
|
+
break;
|
|
669
|
+
case 'fixed64':
|
|
670
|
+
case 'sfixed64':
|
|
671
|
+
case 'int64':
|
|
672
|
+
case 'sint64':
|
|
673
|
+
javaScriptType = 'number';
|
|
674
|
+
numOpts = {
|
|
675
|
+
min: minEightBytes,
|
|
676
|
+
max: maxEightBytes,
|
|
677
|
+
isInt: true,
|
|
678
|
+
isItem
|
|
679
|
+
};
|
|
680
|
+
break;
|
|
681
|
+
case 'double':
|
|
682
|
+
case 'float':
|
|
683
|
+
javaScriptType = 'number';
|
|
684
|
+
numOpts = {
|
|
685
|
+
min: Number.NEGATIVE_INFINITY,
|
|
686
|
+
max: Number.POSITIVE_INFINITY,
|
|
687
|
+
isInt: false,
|
|
688
|
+
isItem
|
|
689
|
+
};
|
|
690
|
+
break;
|
|
691
|
+
default:
|
|
692
|
+
if (new Set(Object.keys(descriptor)).has(protobufType)) {
|
|
693
|
+
this._validateFields(errorInfos, fieldNames, fieldDataValue, descriptor[protobufType], descriptor, schemaId);
|
|
694
|
+
javaScriptType = 'object';
|
|
695
|
+
}
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
if (typeof fieldDataValue !== javaScriptType) {
|
|
699
|
+
errorInfos.push(new ValidationEntry(2, fieldNames, protobufType, typeof fieldDataValue));
|
|
700
|
+
}
|
|
701
|
+
else if (numOpts) {
|
|
702
|
+
if (numOpts.isInt && !Number.isFinite(fieldDataValue)) {
|
|
658
703
|
errorCode = 3;
|
|
659
704
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (new Set(Object.keys(descriptor)).has(protobufType)) {
|
|
663
|
-
this.validateFields(errorInfos, fieldNames, fieldDataValue, descriptor[protobufType], descriptor, schemaId);
|
|
664
|
-
javaScriptType = 'object';
|
|
705
|
+
else if (numOpts.isInt && !Number.isInteger(fieldDataValue)) {
|
|
706
|
+
errorCode = 12;
|
|
665
707
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
708
|
+
else if (!(!numOpts.isInt && Number.isNaN(fieldDataValue)) &&
|
|
709
|
+
!(fieldDataValue >= numOpts.min && fieldDataValue <= numOpts.max)) {
|
|
710
|
+
errorCode = 4;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
670
713
|
}
|
|
671
714
|
if (errorCode) {
|
|
672
715
|
errorInfos.push(new ValidationEntry(errorCode, fieldNames));
|
|
673
716
|
}
|
|
674
717
|
}
|
|
675
|
-
checkNumberRange(value, min, max) {
|
|
676
|
-
return value > max || value < min ? 4 : undefined;
|
|
677
|
-
}
|
|
678
718
|
}
|
|
679
719
|
const logValidator = new LogValidator();
|
|
680
720
|
|
|
@@ -945,14 +985,9 @@ class MetricsImpl {
|
|
|
945
985
|
}
|
|
946
986
|
}
|
|
947
987
|
|
|
948
|
-
class
|
|
949
|
-
constructor(
|
|
950
|
-
this.
|
|
951
|
-
this.composed = composed;
|
|
952
|
-
this._composedPaths = _composedPaths;
|
|
953
|
-
}
|
|
954
|
-
composedPath() {
|
|
955
|
-
return this._composedPaths;
|
|
988
|
+
class MockBase {
|
|
989
|
+
constructor() {
|
|
990
|
+
this.isMock = true;
|
|
956
991
|
}
|
|
957
992
|
}
|
|
958
993
|
|
|
@@ -1009,7 +1044,7 @@ class InstrumentationImpl {
|
|
|
1009
1044
|
}
|
|
1010
1045
|
return schemaUtil.makePayload(userSchema, userData, onlyIfBoth);
|
|
1011
1046
|
}
|
|
1012
|
-
|
|
1047
|
+
_getEffectiveRootId(options) {
|
|
1013
1048
|
var _a, _b;
|
|
1014
1049
|
return ((_b = (_a = options === null || options === void 0 ? void 0 : options.instrumentationContext) === null || _a === void 0 ? void 0 : _a.rootId) !== null && _b !== void 0 ? _b : this._nextGen.getDefaultInstrumentationContext().rootId);
|
|
1015
1050
|
}
|
|
@@ -1021,7 +1056,7 @@ class InstrumentationImpl {
|
|
|
1021
1056
|
utility.requireArgumentIfDefined(options, 'options', 'object');
|
|
1022
1057
|
const userPayload = this._wrapUserPayload(userSchemaOrText, userData);
|
|
1023
1058
|
if (userPayload === null || userPayload === void 0 ? void 0 : userPayload.payload) {
|
|
1024
|
-
this._logInternal(this.name, userPayload.schema, userPayload.payload, timestamp, this.
|
|
1059
|
+
this._logInternal(this.name, userPayload.schema, userPayload.payload, timestamp, this._getEffectiveRootId(options));
|
|
1025
1060
|
}
|
|
1026
1061
|
});
|
|
1027
1062
|
}
|
|
@@ -1039,7 +1074,7 @@ class InstrumentationImpl {
|
|
|
1039
1074
|
]);
|
|
1040
1075
|
utility.requireArgumentIfDefined(userData, 'userData', 'object');
|
|
1041
1076
|
utility.requireArgumentIfDefined(options, 'options', 'object');
|
|
1042
|
-
const rootId = this.
|
|
1077
|
+
const rootId = this._getEffectiveRootId(options);
|
|
1043
1078
|
this._errorInternal(error, userSchemaOrText, userData, undefined, rootId);
|
|
1044
1079
|
});
|
|
1045
1080
|
}
|
|
@@ -1124,8 +1159,9 @@ class InstrumentationImpl {
|
|
|
1124
1159
|
}
|
|
1125
1160
|
domEvent(event, handledBy, userSchemaOrText, userData, options) {
|
|
1126
1161
|
this._safety.tryCatch(() => {
|
|
1162
|
+
var _a;
|
|
1127
1163
|
const tsNow = utility.time().tsNow;
|
|
1128
|
-
utility.requireArgument(event, 'event', [Event,
|
|
1164
|
+
utility.requireArgument(event, 'event', [Event, MockBase]);
|
|
1129
1165
|
utility.requireArgument(handledBy, 'handledBy', [HTMLElement, 'object']);
|
|
1130
1166
|
let htmlElement;
|
|
1131
1167
|
if (handledBy instanceof HTMLElement) {
|
|
@@ -1133,7 +1169,7 @@ class InstrumentationImpl {
|
|
|
1133
1169
|
}
|
|
1134
1170
|
else {
|
|
1135
1171
|
handledBy = handledBy;
|
|
1136
|
-
if (handledBy.template
|
|
1172
|
+
if (((_a = handledBy.template) === null || _a === void 0 ? void 0 : _a.host) instanceof HTMLElement) {
|
|
1137
1173
|
htmlElement = handledBy.template.host;
|
|
1138
1174
|
}
|
|
1139
1175
|
else {
|
|
@@ -1141,7 +1177,7 @@ class InstrumentationImpl {
|
|
|
1141
1177
|
}
|
|
1142
1178
|
}
|
|
1143
1179
|
const userPayload = this._wrapUserPayload(userSchemaOrText, userData, true);
|
|
1144
|
-
const rootId = this.
|
|
1180
|
+
const rootId = this._getEffectiveRootId(options);
|
|
1145
1181
|
switch (event.type) {
|
|
1146
1182
|
case 'click': {
|
|
1147
1183
|
const mouseEvent = event;
|
|
@@ -1151,7 +1187,7 @@ class InstrumentationImpl {
|
|
|
1151
1187
|
}
|
|
1152
1188
|
const mouseEventData = domEventHelpers.getMouseEventData(mouseEvent);
|
|
1153
1189
|
const instrumentedEvent = domEventHelpers.getInstrumentedEventData(mouseEventData, htmlElement, userPayload);
|
|
1154
|
-
instrumentedEvent.auto = options
|
|
1190
|
+
instrumentedEvent.auto = options === null || options === void 0 ? void 0 : options._auto;
|
|
1155
1191
|
this._logInternal(this.name, instrumented_event, instrumentedEvent, tsNow, rootId);
|
|
1156
1192
|
break;
|
|
1157
1193
|
}
|
|
@@ -1357,7 +1393,7 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1357
1393
|
constructor(_nextGen, _name, _allowMulti) {
|
|
1358
1394
|
super(_nextGen, _name);
|
|
1359
1395
|
this._allowMulti = _allowMulti;
|
|
1360
|
-
this._onRootActivityStoppedCallback = this.
|
|
1396
|
+
this._onRootActivityStoppedCallback = this._handleRootActivityStop.bind(this);
|
|
1361
1397
|
}
|
|
1362
1398
|
startRootActivity(name, rootId, isSampled) {
|
|
1363
1399
|
return this._safety.tryCatchReturn(() => {
|
|
@@ -1374,7 +1410,7 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1374
1410
|
return newRootActivity;
|
|
1375
1411
|
}, rootActivityNoOp);
|
|
1376
1412
|
}
|
|
1377
|
-
|
|
1413
|
+
_handleRootActivityStop(detail) {
|
|
1378
1414
|
if (detail.stopReason === discarded) {
|
|
1379
1415
|
return;
|
|
1380
1416
|
}
|
|
@@ -1403,56 +1439,58 @@ class AppInstrumentationImpl extends InstrumentationImpl {
|
|
|
1403
1439
|
|
|
1404
1440
|
const pathLimit = 5;
|
|
1405
1441
|
class AutomaticClickTracker {
|
|
1406
|
-
constructor(
|
|
1407
|
-
this.
|
|
1408
|
-
this.
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1442
|
+
constructor(_instr, _doc) {
|
|
1443
|
+
this._instr = _instr;
|
|
1444
|
+
this._doc = _doc;
|
|
1445
|
+
this._isActive = false;
|
|
1446
|
+
this._boundClickListener = this._clickListener.bind(this);
|
|
1447
|
+
utility.requireArgument(_instr, '_instr');
|
|
1448
|
+
utility.requireArgument(_doc, '_doc');
|
|
1413
1449
|
}
|
|
1414
1450
|
activate() {
|
|
1415
|
-
if (!this.
|
|
1416
|
-
this.
|
|
1417
|
-
this.
|
|
1451
|
+
if (!this._isActive) {
|
|
1452
|
+
this._doc.addEventListener('click', this._boundClickListener, true);
|
|
1453
|
+
this._isActive = true;
|
|
1418
1454
|
}
|
|
1419
1455
|
}
|
|
1420
1456
|
deactivate() {
|
|
1421
|
-
if (this.
|
|
1422
|
-
this.
|
|
1423
|
-
this.
|
|
1457
|
+
if (this._isActive) {
|
|
1458
|
+
this._doc.removeEventListener('click', this._boundClickListener, true);
|
|
1459
|
+
this._isActive = false;
|
|
1424
1460
|
}
|
|
1425
1461
|
}
|
|
1426
1462
|
markEventHandled(event) {
|
|
1427
|
-
this.
|
|
1463
|
+
this._ignoredEvent = event;
|
|
1428
1464
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1465
|
+
_clickListener(event) {
|
|
1466
|
+
var _a;
|
|
1467
|
+
let eventTargets = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event);
|
|
1431
1468
|
if (!eventTargets || !eventTargets.length) {
|
|
1432
1469
|
eventTargets = event.path;
|
|
1433
1470
|
}
|
|
1434
|
-
const handledBy = this.
|
|
1471
|
+
const handledBy = this._getClickableElement(eventTargets);
|
|
1435
1472
|
if (handledBy) {
|
|
1436
1473
|
setTimeout(() => {
|
|
1437
|
-
if (event !== this.
|
|
1438
|
-
this.
|
|
1474
|
+
if (event !== this._ignoredEvent) {
|
|
1475
|
+
this._instr.domEvent(event, handledBy, undefined, undefined, {
|
|
1439
1476
|
_auto: true
|
|
1440
1477
|
});
|
|
1441
1478
|
}
|
|
1442
1479
|
});
|
|
1443
1480
|
}
|
|
1444
1481
|
}
|
|
1445
|
-
|
|
1482
|
+
_getClickableElement(path) {
|
|
1483
|
+
var _a, _b;
|
|
1446
1484
|
const limit = path ? Math.min(path.length, pathLimit) : 0;
|
|
1447
1485
|
for (let x = 0; x < limit; x += 1) {
|
|
1448
1486
|
const currentElement = path[x];
|
|
1449
|
-
const tagName = currentElement.tagName
|
|
1487
|
+
const tagName = (_a = currentElement.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
1450
1488
|
if (tagName === 'a' || tagName === 'button') {
|
|
1451
1489
|
return currentElement;
|
|
1452
1490
|
}
|
|
1453
1491
|
if (tagName === 'input') {
|
|
1454
1492
|
const inputElement = currentElement;
|
|
1455
|
-
if (inputElement.type
|
|
1493
|
+
if (((_b = inputElement.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'button') {
|
|
1456
1494
|
return inputElement;
|
|
1457
1495
|
}
|
|
1458
1496
|
}
|
|
@@ -1497,9 +1535,9 @@ class NextgenImpl {
|
|
|
1497
1535
|
if (instr) {
|
|
1498
1536
|
throw new Error(`The instrumentation name ${name} is already taken`);
|
|
1499
1537
|
}
|
|
1500
|
-
this._appInstr = new AppInstrumentationImpl(this, name, options
|
|
1538
|
+
this._appInstr = new AppInstrumentationImpl(this, name, options === null || options === void 0 ? void 0 : options.allowMultipleRootActivities);
|
|
1501
1539
|
this._instruments.set(name, this._appInstr);
|
|
1502
|
-
this._isBufferingEnabled = options
|
|
1540
|
+
this._isBufferingEnabled = options === null || options === void 0 ? void 0 : options.enableBuffering;
|
|
1503
1541
|
const tracing = new Tracing(this._appInstr);
|
|
1504
1542
|
return {
|
|
1505
1543
|
log: this._appInstr.log.bind(this._appInstr),
|
|
@@ -1538,7 +1576,8 @@ class NextgenImpl {
|
|
|
1538
1576
|
return instr;
|
|
1539
1577
|
}
|
|
1540
1578
|
get appName() {
|
|
1541
|
-
|
|
1579
|
+
var _a;
|
|
1580
|
+
return (_a = this._appInstr) === null || _a === void 0 ? void 0 : _a.name;
|
|
1542
1581
|
}
|
|
1543
1582
|
addLog(loggerName, schema, data, timestamp, rootId, pagePayload, appPayload) {
|
|
1544
1583
|
this._sequence += 1;
|
|
@@ -1560,8 +1599,11 @@ class NextgenImpl {
|
|
|
1560
1599
|
if (this._isBufferingEnabled) {
|
|
1561
1600
|
this._buffer.push({ schema, data: utility.clone(data), logMeta });
|
|
1562
1601
|
}
|
|
1563
|
-
const eligibleCollectors = Array.from(this._logCollectors).filter((collector) =>
|
|
1564
|
-
|
|
1602
|
+
const eligibleCollectors = Array.from(this._logCollectors).filter((collector) => {
|
|
1603
|
+
var _a;
|
|
1604
|
+
return !this._forceDisabledLogCollectors.has(collector) &&
|
|
1605
|
+
!((_a = collector.getIsCollectDisabled) === null || _a === void 0 ? void 0 : _a.call(collector));
|
|
1606
|
+
});
|
|
1565
1607
|
if (eligibleCollectors.length > 0) {
|
|
1566
1608
|
for (const collector of eligibleCollectors) {
|
|
1567
1609
|
const dataClone = utility.clone(data);
|
|
@@ -1606,10 +1648,12 @@ class NextgenImpl {
|
|
|
1606
1648
|
};
|
|
1607
1649
|
}
|
|
1608
1650
|
activateClickTracker() {
|
|
1609
|
-
if (
|
|
1610
|
-
|
|
1651
|
+
if (typeof document !== 'undefined') {
|
|
1652
|
+
if (!this._autoClickTracker) {
|
|
1653
|
+
this._autoClickTracker = new AutomaticClickTracker(this._appInstr, document);
|
|
1654
|
+
}
|
|
1655
|
+
this._autoClickTracker.activate();
|
|
1611
1656
|
}
|
|
1612
|
-
this._autoClickTracker.activate();
|
|
1613
1657
|
}
|
|
1614
1658
|
deactivateClickTracker() {
|
|
1615
1659
|
if (this._autoClickTracker) {
|
|
@@ -1639,20 +1683,20 @@ class NextgenImpl {
|
|
|
1639
1683
|
}
|
|
1640
1684
|
this._metricsCollector = collector;
|
|
1641
1685
|
this._metricsCollector.receiveMetricsExtractors({
|
|
1642
|
-
getAllUpCounters: this.
|
|
1643
|
-
getAllValueRecorders: this.
|
|
1644
|
-
getAllBucketHistograms: this.
|
|
1686
|
+
getAllUpCounters: this._getAllUpCounters.bind(this),
|
|
1687
|
+
getAllValueRecorders: this._getAllValueRecorders.bind(this),
|
|
1688
|
+
getAllBucketHistograms: this._getAllBucketHistograms.bind(this)
|
|
1645
1689
|
});
|
|
1646
1690
|
}
|
|
1647
|
-
|
|
1691
|
+
_getAllUpCounters() {
|
|
1648
1692
|
const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getUpCounters());
|
|
1649
1693
|
return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
|
|
1650
1694
|
}
|
|
1651
|
-
|
|
1695
|
+
_getAllValueRecorders() {
|
|
1652
1696
|
const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getValueRecorders());
|
|
1653
1697
|
return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
|
|
1654
1698
|
}
|
|
1655
|
-
|
|
1699
|
+
_getAllBucketHistograms() {
|
|
1656
1700
|
const arrOfArrs = Array.from(this._instruments.values()).map((instr) => instr.getBucketHistograms());
|
|
1657
1701
|
return arrOfArrs.reduce((pv, cv) => pv.concat(cv), []);
|
|
1658
1702
|
}
|
|
@@ -1744,7 +1788,6 @@ class IdleDetectorImpl {
|
|
|
1744
1788
|
this._logThreshold = defaultLogThreshold;
|
|
1745
1789
|
this._endedTasks = new Array();
|
|
1746
1790
|
this._pollableReport = new Array();
|
|
1747
|
-
this._timerCheckQueued = 0;
|
|
1748
1791
|
if (utility.requireArgumentIfDefined(options === null || options === void 0 ? void 0 : options.logThreshold, 'options.logThreshold', 'number')) {
|
|
1749
1792
|
this._logThreshold = options.logThreshold;
|
|
1750
1793
|
}
|
|
@@ -1755,9 +1798,9 @@ class IdleDetectorImpl {
|
|
|
1755
1798
|
this._firstCallbackTime = utility.time().perfNow;
|
|
1756
1799
|
}
|
|
1757
1800
|
this._listeners.add(callback);
|
|
1758
|
-
this.
|
|
1801
|
+
this._checkIfLoaded();
|
|
1759
1802
|
}
|
|
1760
|
-
|
|
1803
|
+
_reportTaskEnded(tasker) {
|
|
1761
1804
|
if (this._listeners.size) {
|
|
1762
1805
|
const snapshot = Object.assign({}, this._taskers.get(tasker));
|
|
1763
1806
|
this._endedTasks.push(snapshot);
|
|
@@ -1765,7 +1808,7 @@ class IdleDetectorImpl {
|
|
|
1765
1808
|
}
|
|
1766
1809
|
declareNotifierTaskSingle(name) {
|
|
1767
1810
|
utility.requireArgument(name, 'name', 'string');
|
|
1768
|
-
const tasker = this.
|
|
1811
|
+
const tasker = this._addTasker(name, 1);
|
|
1769
1812
|
const retVal = {
|
|
1770
1813
|
get isBusy() {
|
|
1771
1814
|
return tasker.isBusy;
|
|
@@ -1781,12 +1824,11 @@ class IdleDetectorImpl {
|
|
|
1781
1824
|
utility.requireArgument(name, 'name', 'string');
|
|
1782
1825
|
if (existingBusyCount !== undefined) {
|
|
1783
1826
|
utility.requireArgument(existingBusyCount, 'existingBusyCount', 'number');
|
|
1784
|
-
if (existingBusyCount < 0
|
|
1785
|
-
parseInt(existingBusyCount.toString(), 10) !== existingBusyCount) {
|
|
1827
|
+
if (!Number.isInteger(existingBusyCount) || existingBusyCount < 0) {
|
|
1786
1828
|
throw new Error('existingBusyCount accepts only non-negative integers');
|
|
1787
1829
|
}
|
|
1788
1830
|
}
|
|
1789
|
-
const tasker = this.
|
|
1831
|
+
const tasker = this._addTasker(name, existingBusyCount);
|
|
1790
1832
|
const retVal = {
|
|
1791
1833
|
get isBusy() {
|
|
1792
1834
|
return tasker.isBusy;
|
|
@@ -1808,11 +1850,11 @@ class IdleDetectorImpl {
|
|
|
1808
1850
|
utility.requireArgument(isBusyChecker, 'isBusyChecker', 'function');
|
|
1809
1851
|
this._busyCheckers.set(isBusyChecker, name);
|
|
1810
1852
|
}
|
|
1811
|
-
|
|
1853
|
+
_addTasker(name, existingBusyCount) {
|
|
1812
1854
|
const tasker = new TaskerImpl(name, existingBusyCount, () => {
|
|
1813
1855
|
this._taskers.get(tasker).end = utility.time().perfNow;
|
|
1814
|
-
this.
|
|
1815
|
-
this.
|
|
1856
|
+
this._reportTaskEnded(tasker);
|
|
1857
|
+
this._checkIfLoaded();
|
|
1816
1858
|
}, () => {
|
|
1817
1859
|
this._instr.error(`Overdone: ${tasker.name}`);
|
|
1818
1860
|
utility.noProdThrow(`Tasker '${tasker.name}' is done too many times.`);
|
|
@@ -1824,10 +1866,10 @@ class IdleDetectorImpl {
|
|
|
1824
1866
|
});
|
|
1825
1867
|
return tasker;
|
|
1826
1868
|
}
|
|
1827
|
-
|
|
1869
|
+
_areAllNotifiersIdle() {
|
|
1828
1870
|
return !Array.from(this._taskers.keys()).some((t) => t.isBusy);
|
|
1829
1871
|
}
|
|
1830
|
-
|
|
1872
|
+
_getFirstBusyPollable() {
|
|
1831
1873
|
const entry = Array.from(this._busyCheckers).find((entry) => {
|
|
1832
1874
|
const isBusyChecker = entry[0];
|
|
1833
1875
|
const name = entry[1];
|
|
@@ -1842,29 +1884,29 @@ class IdleDetectorImpl {
|
|
|
1842
1884
|
});
|
|
1843
1885
|
return entry ? entry[1] : undefined;
|
|
1844
1886
|
}
|
|
1845
|
-
|
|
1887
|
+
_checkIfLoaded() {
|
|
1846
1888
|
if (!this._listeners.size) {
|
|
1847
1889
|
return;
|
|
1848
1890
|
}
|
|
1849
1891
|
if (this._timerCheckQueued) {
|
|
1850
|
-
|
|
1892
|
+
clearTimeout(this._timerCheckQueued);
|
|
1851
1893
|
}
|
|
1852
|
-
if (this.
|
|
1853
|
-
this._timerCheckQueued =
|
|
1854
|
-
this._timerCheckQueued =
|
|
1855
|
-
this.
|
|
1894
|
+
if (this._areAllNotifiersIdle()) {
|
|
1895
|
+
this._timerCheckQueued = setTimeout(() => {
|
|
1896
|
+
this._timerCheckQueued = setTimeout(() => {
|
|
1897
|
+
this._doubleCheck();
|
|
1856
1898
|
}, 40);
|
|
1857
1899
|
}, 0);
|
|
1858
1900
|
}
|
|
1859
1901
|
}
|
|
1860
|
-
|
|
1861
|
-
this._timerCheckQueued =
|
|
1862
|
-
if (this.
|
|
1863
|
-
const pollableName = this.
|
|
1902
|
+
_doubleCheck() {
|
|
1903
|
+
this._timerCheckQueued = undefined;
|
|
1904
|
+
if (this._areAllNotifiersIdle()) {
|
|
1905
|
+
const pollableName = this._getFirstBusyPollable();
|
|
1864
1906
|
if (pollableName !== undefined) {
|
|
1865
|
-
this.
|
|
1866
|
-
this._timerCheckQueued =
|
|
1867
|
-
this.
|
|
1907
|
+
this._addToPollableReport(pollableName);
|
|
1908
|
+
this._timerCheckQueued = setTimeout(() => {
|
|
1909
|
+
this._doubleCheck();
|
|
1868
1910
|
}, 15);
|
|
1869
1911
|
}
|
|
1870
1912
|
else {
|
|
@@ -1874,11 +1916,11 @@ class IdleDetectorImpl {
|
|
|
1874
1916
|
this._firstCallbackTime = undefined;
|
|
1875
1917
|
const endedTasks = this._endedTasks.splice(0);
|
|
1876
1918
|
const pollableReport = this._pollableReport.splice(0);
|
|
1877
|
-
this.
|
|
1919
|
+
this._notify(listeners, maxDuration, endedTasks, pollableReport);
|
|
1878
1920
|
}
|
|
1879
1921
|
}
|
|
1880
1922
|
}
|
|
1881
|
-
|
|
1923
|
+
_addToPollableReport(name) {
|
|
1882
1924
|
const lastEntry = this._pollableReport.length
|
|
1883
1925
|
? this._pollableReport[this._pollableReport.length - 1]
|
|
1884
1926
|
: undefined;
|
|
@@ -1892,7 +1934,7 @@ class IdleDetectorImpl {
|
|
|
1892
1934
|
});
|
|
1893
1935
|
}
|
|
1894
1936
|
}
|
|
1895
|
-
|
|
1937
|
+
_notify(listeners, maxDuration, taskReport, pollableReport) {
|
|
1896
1938
|
if (maxDuration >= this._logThreshold) {
|
|
1897
1939
|
const logData = this._getReport(maxDuration, listeners.length, taskReport, pollableReport);
|
|
1898
1940
|
this._instr.log(idle_detector_report, logData);
|
|
@@ -1978,7 +2020,7 @@ class ConsoleCollector {
|
|
|
1978
2020
|
}
|
|
1979
2021
|
}
|
|
1980
2022
|
|
|
1981
|
-
const version = '242.
|
|
2023
|
+
const version = '242.8.0';
|
|
1982
2024
|
|
|
1983
2025
|
const idleDetector = new IdleDetectorImpl({
|
|
1984
2026
|
logThreshold: 300
|