@safaricom-mxl/web-sdk 0.1.1 → 0.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/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs +21 -20
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js +17 -16
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.cjs +32 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.cjs.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.cts +29 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.cts.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.ts +29 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.d.ts.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.js +31 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/enums/PerformanceTimingNames.js.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs +34 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts +34 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts +34 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js +31 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js.map +1 -0
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs +5 -5
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.cts +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.cts.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js +2 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js.map +1 -1
- package/dist/mxl-web-sdk.js +2 -2
- package/dist/mxl-web-sdk.js.map +1 -1
- package/dist/resources/sdkConstants.cjs +1 -1
- package/dist/resources/sdkConstants.cjs.map +1 -1
- package/dist/resources/sdkConstants.d.cts +1 -1
- package/dist/resources/sdkConstants.d.ts +1 -1
- package/dist/resources/sdkConstants.js +1 -1
- package/dist/resources/sdkConstants.js.map +1 -1
- package/dist/sdk/initSDK.cjs +1 -2
- package/dist/sdk/initSDK.cjs.map +1 -1
- package/dist/sdk/initSDK.d.cts.map +1 -1
- package/dist/sdk/initSDK.d.ts.map +1 -1
- package/dist/sdk/initSDK.js +1 -2
- package/dist/sdk/initSDK.js.map +1 -1
- package/package.json +14 -15
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./enums/PerformanceTimingNames.cjs");
|
|
3
|
+
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts
|
|
4
|
+
const ATTR_HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length";
|
|
5
|
+
const ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = "http.response_content_length_uncompressed";
|
|
6
|
+
function hasKey(obj, key) {
|
|
7
|
+
return key in obj;
|
|
8
|
+
}
|
|
9
|
+
function addSpanNetworkEvent(span, performanceName, entries, ignoreZeros = true) {
|
|
10
|
+
if (hasKey(entries, performanceName) && typeof entries[performanceName] === "number" && !(ignoreZeros && entries[performanceName] === 0)) return span.addEvent(performanceName, entries[performanceName]);
|
|
11
|
+
}
|
|
12
|
+
function addSpanNetworkEvents(span, resource, ignoreNetworkEvents = false, ignoreZeros = resource["startTime"] !== 0) {
|
|
13
|
+
if (!ignoreNetworkEvents) {
|
|
14
|
+
addSpanNetworkEvent(span, "fetchStart", resource, ignoreZeros);
|
|
15
|
+
addSpanNetworkEvent(span, "domainLookupStart", resource, ignoreZeros);
|
|
16
|
+
addSpanNetworkEvent(span, "domainLookupEnd", resource, ignoreZeros);
|
|
17
|
+
addSpanNetworkEvent(span, "connectStart", resource, ignoreZeros);
|
|
18
|
+
addSpanNetworkEvent(span, "secureConnectionStart", resource, ignoreZeros);
|
|
19
|
+
addSpanNetworkEvent(span, "connectEnd", resource, ignoreZeros);
|
|
20
|
+
addSpanNetworkEvent(span, "requestStart", resource, ignoreZeros);
|
|
21
|
+
addSpanNetworkEvent(span, "responseStart", resource, ignoreZeros);
|
|
22
|
+
addSpanNetworkEvent(span, "responseEnd", resource, ignoreZeros);
|
|
23
|
+
}
|
|
24
|
+
const encodedLength = resource["encodedBodySize"];
|
|
25
|
+
if (encodedLength !== void 0) span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH, encodedLength);
|
|
26
|
+
const decodedLength = resource["decodedBodySize"];
|
|
27
|
+
if (decodedLength !== void 0 && encodedLength !== decodedLength) span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, decodedLength);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.addSpanNetworkEvent = addSpanNetworkEvent;
|
|
31
|
+
exports.addSpanNetworkEvents = addSpanNetworkEvents;
|
|
32
|
+
exports.hasKey = hasKey;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=networkEvents.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkEvents.cjs","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts"],"sourcesContent":["/*\n * Adapted from @opentelemetry/sdk-trace-web@2.12.0\n * https://github.com/open-telemetry/opentelemetry-js/blob/v2.12.0/packages/opentelemetry-sdk-trace-web/src/utils.ts\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport { PerformanceTimingNames as PTN } from './enums/PerformanceTimingNames';\n\n// Old HTTP semconv (v1.7.0) keys, kept so existing span attributes don't change.\nconst ATTR_HTTP_RESPONSE_CONTENT_LENGTH = 'http.response_content_length';\nconst ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED =\n 'http.response_content_length_uncompressed';\n\nexport type PerformanceEntries = {\n [PTN.CONNECT_END]?: number;\n [PTN.CONNECT_START]?: number;\n [PTN.DECODED_BODY_SIZE]?: number;\n [PTN.DOM_COMPLETE]?: number;\n [PTN.DOM_CONTENT_LOADED_EVENT_END]?: number;\n [PTN.DOM_CONTENT_LOADED_EVENT_START]?: number;\n [PTN.DOM_INTERACTIVE]?: number;\n [PTN.DOMAIN_LOOKUP_END]?: number;\n [PTN.DOMAIN_LOOKUP_START]?: number;\n [PTN.ENCODED_BODY_SIZE]?: number;\n [PTN.FETCH_START]?: number;\n [PTN.LOAD_EVENT_END]?: number;\n [PTN.LOAD_EVENT_START]?: number;\n [PTN.REDIRECT_END]?: number;\n [PTN.REDIRECT_START]?: number;\n [PTN.REQUEST_START]?: number;\n [PTN.RESPONSE_END]?: number;\n [PTN.RESPONSE_START]?: number;\n [PTN.SECURE_CONNECTION_START]?: number;\n [PTN.START_TIME]?: number;\n [PTN.UNLOAD_EVENT_END]?: number;\n [PTN.UNLOAD_EVENT_START]?: number;\n};\n\nexport function hasKey<O extends object>(\n obj: O,\n key: PropertyKey,\n): key is keyof O {\n return key in obj;\n}\n\nexport function addSpanNetworkEvent(\n span: Span,\n performanceName: string,\n entries: PerformanceEntries,\n ignoreZeros = true,\n): Span | undefined {\n if (\n hasKey(entries, performanceName) &&\n typeof entries[performanceName] === 'number' &&\n !(ignoreZeros && entries[performanceName] === 0)\n ) {\n return span.addEvent(performanceName, entries[performanceName]);\n }\n return undefined;\n}\n\nexport function addSpanNetworkEvents(\n span: Span,\n resource: PerformanceEntries,\n ignoreNetworkEvents = false,\n ignoreZeros = resource[PTN.START_TIME] !== 0,\n): void {\n if (!ignoreNetworkEvents) {\n addSpanNetworkEvent(span, PTN.FETCH_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_END, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.CONNECT_START, resource, ignoreZeros);\n addSpanNetworkEvent(\n span,\n PTN.SECURE_CONNECTION_START,\n resource,\n ignoreZeros,\n );\n addSpanNetworkEvent(span, PTN.CONNECT_END, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.REQUEST_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.RESPONSE_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.RESPONSE_END, resource, ignoreZeros);\n }\n\n const encodedLength = resource[PTN.ENCODED_BODY_SIZE];\n if (encodedLength !== undefined) {\n span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH, encodedLength);\n }\n\n const decodedLength = resource[PTN.DECODED_BODY_SIZE];\n if (decodedLength !== undefined && encodedLength !== decodedLength) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,\n decodedLength,\n );\n }\n}\n"],"mappings":";;;AASA,MAAM,oCAAoC;AAC1C,MAAM,iDACJ;AA2BF,SAAgB,OACd,KACA,KACgB;AAChB,QAAO,OAAO;;AAGhB,SAAgB,oBACd,MACA,iBACA,SACA,cAAc,MACI;AAClB,KACE,OAAO,SAAS,gBAAgB,IAChC,OAAO,QAAQ,qBAAqB,YACpC,EAAE,eAAe,QAAQ,qBAAqB,GAE9C,QAAO,KAAK,SAAS,iBAAiB,QAAQ,iBAAiB;;AAKnE,SAAgB,qBACd,MACA,UACA,sBAAsB,OACtB,cAAc,SAAA,iBAA6B,GACrC;AACN,KAAI,CAAC,qBAAqB;AACxB,sBAAoB,MAAA,cAAuB,UAAU,YAAY;AACjE,sBAAoB,MAAA,qBAA+B,UAAU,YAAY;AACzE,sBAAoB,MAAA,mBAA6B,UAAU,YAAY;AACvE,sBAAoB,MAAA,gBAAyB,UAAU,YAAY;AACnE,sBACE,MAAA,yBAEA,UACA,YACD;AACD,sBAAoB,MAAA,cAAuB,UAAU,YAAY;AACjE,sBAAoB,MAAA,gBAAyB,UAAU,YAAY;AACnE,sBAAoB,MAAA,iBAA0B,UAAU,YAAY;AACpE,sBAAoB,MAAA,eAAwB,UAAU,YAAY;;CAGpE,MAAM,gBAAgB,SAAA;AACtB,KAAI,kBAAkB,KAAA,EACpB,MAAK,aAAa,mCAAmC,cAAc;CAGrE,MAAM,gBAAgB,SAAA;AACtB,KAAI,kBAAkB,KAAA,KAAa,kBAAkB,cACnD,MAAK,aACH,gDACA,cACD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PerformanceTimingNames } from "./enums/PerformanceTimingNames.cjs";
|
|
2
|
+
import { Span } from "@opentelemetry/api";
|
|
3
|
+
|
|
4
|
+
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts
|
|
5
|
+
type PerformanceEntries = {
|
|
6
|
+
[PerformanceTimingNames.CONNECT_END]?: number;
|
|
7
|
+
[PerformanceTimingNames.CONNECT_START]?: number;
|
|
8
|
+
[PerformanceTimingNames.DECODED_BODY_SIZE]?: number;
|
|
9
|
+
[PerformanceTimingNames.DOM_COMPLETE]?: number;
|
|
10
|
+
[PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;
|
|
11
|
+
[PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;
|
|
12
|
+
[PerformanceTimingNames.DOM_INTERACTIVE]?: number;
|
|
13
|
+
[PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;
|
|
14
|
+
[PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;
|
|
15
|
+
[PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;
|
|
16
|
+
[PerformanceTimingNames.FETCH_START]?: number;
|
|
17
|
+
[PerformanceTimingNames.LOAD_EVENT_END]?: number;
|
|
18
|
+
[PerformanceTimingNames.LOAD_EVENT_START]?: number;
|
|
19
|
+
[PerformanceTimingNames.REDIRECT_END]?: number;
|
|
20
|
+
[PerformanceTimingNames.REDIRECT_START]?: number;
|
|
21
|
+
[PerformanceTimingNames.REQUEST_START]?: number;
|
|
22
|
+
[PerformanceTimingNames.RESPONSE_END]?: number;
|
|
23
|
+
[PerformanceTimingNames.RESPONSE_START]?: number;
|
|
24
|
+
[PerformanceTimingNames.SECURE_CONNECTION_START]?: number;
|
|
25
|
+
[PerformanceTimingNames.START_TIME]?: number;
|
|
26
|
+
[PerformanceTimingNames.UNLOAD_EVENT_END]?: number;
|
|
27
|
+
[PerformanceTimingNames.UNLOAD_EVENT_START]?: number;
|
|
28
|
+
};
|
|
29
|
+
declare function hasKey<O extends object>(obj: O, key: PropertyKey): key is keyof O;
|
|
30
|
+
declare function addSpanNetworkEvent(span: Span, performanceName: string, entries: PerformanceEntries, ignoreZeros?: boolean): Span | undefined;
|
|
31
|
+
declare function addSpanNetworkEvents(span: Span, resource: PerformanceEntries, ignoreNetworkEvents?: boolean, ignoreZeros?: boolean): void;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { PerformanceEntries, addSpanNetworkEvent, addSpanNetworkEvents, hasKey };
|
|
34
|
+
//# sourceMappingURL=networkEvents.d.cts.map
|
package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkEvents.d.cts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts"],"mappings":";;;;KAaY,kBAAA;EAAA,CACT,sBAAA,CAAI,WAAA;EAAA,CACJ,sBAAA,CAAI,aAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,4BAAA;EAAA,CACJ,sBAAA,CAAI,8BAAA;EAAA,CACJ,sBAAA,CAAI,eAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,mBAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,WAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,gBAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,aAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,uBAAA;EAAA,CACJ,sBAAA,CAAI,UAAA;EAAA,CACJ,sBAAA,CAAI,gBAAA;EAAA,CACJ,sBAAA,CAAI,kBAAA;AAAA;AAAA,iBAGS,MAAA,kBAAA,CACd,GAAA,EAAK,CAAA,EACL,GAAA,EAAK,WAAA,GACJ,GAAA,UAAa,CAAA;AAAA,iBAIA,mBAAA,CACd,IAAA,EAAM,IAAA,EACN,eAAA,UACA,OAAA,EAAS,kBAAA,EACT,WAAA,aACC,IAAA;AAAA,iBAWa,oBAAA,CACd,IAAA,EAAM,IAAA,EACN,QAAA,EAAU,kBAAA,EACV,mBAAA,YACA,WAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PerformanceTimingNames } from "./enums/PerformanceTimingNames.js";
|
|
2
|
+
import { Span } from "@opentelemetry/api";
|
|
3
|
+
|
|
4
|
+
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts
|
|
5
|
+
type PerformanceEntries = {
|
|
6
|
+
[PerformanceTimingNames.CONNECT_END]?: number;
|
|
7
|
+
[PerformanceTimingNames.CONNECT_START]?: number;
|
|
8
|
+
[PerformanceTimingNames.DECODED_BODY_SIZE]?: number;
|
|
9
|
+
[PerformanceTimingNames.DOM_COMPLETE]?: number;
|
|
10
|
+
[PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;
|
|
11
|
+
[PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;
|
|
12
|
+
[PerformanceTimingNames.DOM_INTERACTIVE]?: number;
|
|
13
|
+
[PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;
|
|
14
|
+
[PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;
|
|
15
|
+
[PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;
|
|
16
|
+
[PerformanceTimingNames.FETCH_START]?: number;
|
|
17
|
+
[PerformanceTimingNames.LOAD_EVENT_END]?: number;
|
|
18
|
+
[PerformanceTimingNames.LOAD_EVENT_START]?: number;
|
|
19
|
+
[PerformanceTimingNames.REDIRECT_END]?: number;
|
|
20
|
+
[PerformanceTimingNames.REDIRECT_START]?: number;
|
|
21
|
+
[PerformanceTimingNames.REQUEST_START]?: number;
|
|
22
|
+
[PerformanceTimingNames.RESPONSE_END]?: number;
|
|
23
|
+
[PerformanceTimingNames.RESPONSE_START]?: number;
|
|
24
|
+
[PerformanceTimingNames.SECURE_CONNECTION_START]?: number;
|
|
25
|
+
[PerformanceTimingNames.START_TIME]?: number;
|
|
26
|
+
[PerformanceTimingNames.UNLOAD_EVENT_END]?: number;
|
|
27
|
+
[PerformanceTimingNames.UNLOAD_EVENT_START]?: number;
|
|
28
|
+
};
|
|
29
|
+
declare function hasKey<O extends object>(obj: O, key: PropertyKey): key is keyof O;
|
|
30
|
+
declare function addSpanNetworkEvent(span: Span, performanceName: string, entries: PerformanceEntries, ignoreZeros?: boolean): Span | undefined;
|
|
31
|
+
declare function addSpanNetworkEvents(span: Span, resource: PerformanceEntries, ignoreNetworkEvents?: boolean, ignoreZeros?: boolean): void;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { PerformanceEntries, addSpanNetworkEvent, addSpanNetworkEvents, hasKey };
|
|
34
|
+
//# sourceMappingURL=networkEvents.d.ts.map
|
package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkEvents.d.ts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts"],"mappings":";;;;KAaY,kBAAA;EAAA,CACT,sBAAA,CAAI,WAAA;EAAA,CACJ,sBAAA,CAAI,aAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,4BAAA;EAAA,CACJ,sBAAA,CAAI,8BAAA;EAAA,CACJ,sBAAA,CAAI,eAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,mBAAA;EAAA,CACJ,sBAAA,CAAI,iBAAA;EAAA,CACJ,sBAAA,CAAI,WAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,gBAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,aAAA;EAAA,CACJ,sBAAA,CAAI,YAAA;EAAA,CACJ,sBAAA,CAAI,cAAA;EAAA,CACJ,sBAAA,CAAI,uBAAA;EAAA,CACJ,sBAAA,CAAI,UAAA;EAAA,CACJ,sBAAA,CAAI,gBAAA;EAAA,CACJ,sBAAA,CAAI,kBAAA;AAAA;AAAA,iBAGS,MAAA,kBAAA,CACd,GAAA,EAAK,CAAA,EACL,GAAA,EAAK,WAAA,GACJ,GAAA,UAAa,CAAA;AAAA,iBAIA,mBAAA,CACd,IAAA,EAAM,IAAA,EACN,eAAA,UACA,OAAA,EAAS,kBAAA,EACT,WAAA,aACC,IAAA;AAAA,iBAWa,oBAAA,CACd,IAAA,EAAM,IAAA,EACN,QAAA,EAAU,kBAAA,EACV,mBAAA,YACA,WAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "./enums/PerformanceTimingNames.js";
|
|
2
|
+
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts
|
|
3
|
+
const ATTR_HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length";
|
|
4
|
+
const ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = "http.response_content_length_uncompressed";
|
|
5
|
+
function hasKey(obj, key) {
|
|
6
|
+
return key in obj;
|
|
7
|
+
}
|
|
8
|
+
function addSpanNetworkEvent(span, performanceName, entries, ignoreZeros = true) {
|
|
9
|
+
if (hasKey(entries, performanceName) && typeof entries[performanceName] === "number" && !(ignoreZeros && entries[performanceName] === 0)) return span.addEvent(performanceName, entries[performanceName]);
|
|
10
|
+
}
|
|
11
|
+
function addSpanNetworkEvents(span, resource, ignoreNetworkEvents = false, ignoreZeros = resource["startTime"] !== 0) {
|
|
12
|
+
if (!ignoreNetworkEvents) {
|
|
13
|
+
addSpanNetworkEvent(span, "fetchStart", resource, ignoreZeros);
|
|
14
|
+
addSpanNetworkEvent(span, "domainLookupStart", resource, ignoreZeros);
|
|
15
|
+
addSpanNetworkEvent(span, "domainLookupEnd", resource, ignoreZeros);
|
|
16
|
+
addSpanNetworkEvent(span, "connectStart", resource, ignoreZeros);
|
|
17
|
+
addSpanNetworkEvent(span, "secureConnectionStart", resource, ignoreZeros);
|
|
18
|
+
addSpanNetworkEvent(span, "connectEnd", resource, ignoreZeros);
|
|
19
|
+
addSpanNetworkEvent(span, "requestStart", resource, ignoreZeros);
|
|
20
|
+
addSpanNetworkEvent(span, "responseStart", resource, ignoreZeros);
|
|
21
|
+
addSpanNetworkEvent(span, "responseEnd", resource, ignoreZeros);
|
|
22
|
+
}
|
|
23
|
+
const encodedLength = resource["encodedBodySize"];
|
|
24
|
+
if (encodedLength !== void 0) span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH, encodedLength);
|
|
25
|
+
const decodedLength = resource["decodedBodySize"];
|
|
26
|
+
if (decodedLength !== void 0 && encodedLength !== decodedLength) span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, decodedLength);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { addSpanNetworkEvent, addSpanNetworkEvents, hasKey };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=networkEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkEvents.js","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.ts"],"sourcesContent":["/*\n * Adapted from @opentelemetry/sdk-trace-web@2.12.0\n * https://github.com/open-telemetry/opentelemetry-js/blob/v2.12.0/packages/opentelemetry-sdk-trace-web/src/utils.ts\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport { PerformanceTimingNames as PTN } from './enums/PerformanceTimingNames';\n\n// Old HTTP semconv (v1.7.0) keys, kept so existing span attributes don't change.\nconst ATTR_HTTP_RESPONSE_CONTENT_LENGTH = 'http.response_content_length';\nconst ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED =\n 'http.response_content_length_uncompressed';\n\nexport type PerformanceEntries = {\n [PTN.CONNECT_END]?: number;\n [PTN.CONNECT_START]?: number;\n [PTN.DECODED_BODY_SIZE]?: number;\n [PTN.DOM_COMPLETE]?: number;\n [PTN.DOM_CONTENT_LOADED_EVENT_END]?: number;\n [PTN.DOM_CONTENT_LOADED_EVENT_START]?: number;\n [PTN.DOM_INTERACTIVE]?: number;\n [PTN.DOMAIN_LOOKUP_END]?: number;\n [PTN.DOMAIN_LOOKUP_START]?: number;\n [PTN.ENCODED_BODY_SIZE]?: number;\n [PTN.FETCH_START]?: number;\n [PTN.LOAD_EVENT_END]?: number;\n [PTN.LOAD_EVENT_START]?: number;\n [PTN.REDIRECT_END]?: number;\n [PTN.REDIRECT_START]?: number;\n [PTN.REQUEST_START]?: number;\n [PTN.RESPONSE_END]?: number;\n [PTN.RESPONSE_START]?: number;\n [PTN.SECURE_CONNECTION_START]?: number;\n [PTN.START_TIME]?: number;\n [PTN.UNLOAD_EVENT_END]?: number;\n [PTN.UNLOAD_EVENT_START]?: number;\n};\n\nexport function hasKey<O extends object>(\n obj: O,\n key: PropertyKey,\n): key is keyof O {\n return key in obj;\n}\n\nexport function addSpanNetworkEvent(\n span: Span,\n performanceName: string,\n entries: PerformanceEntries,\n ignoreZeros = true,\n): Span | undefined {\n if (\n hasKey(entries, performanceName) &&\n typeof entries[performanceName] === 'number' &&\n !(ignoreZeros && entries[performanceName] === 0)\n ) {\n return span.addEvent(performanceName, entries[performanceName]);\n }\n return undefined;\n}\n\nexport function addSpanNetworkEvents(\n span: Span,\n resource: PerformanceEntries,\n ignoreNetworkEvents = false,\n ignoreZeros = resource[PTN.START_TIME] !== 0,\n): void {\n if (!ignoreNetworkEvents) {\n addSpanNetworkEvent(span, PTN.FETCH_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_END, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.CONNECT_START, resource, ignoreZeros);\n addSpanNetworkEvent(\n span,\n PTN.SECURE_CONNECTION_START,\n resource,\n ignoreZeros,\n );\n addSpanNetworkEvent(span, PTN.CONNECT_END, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.REQUEST_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.RESPONSE_START, resource, ignoreZeros);\n addSpanNetworkEvent(span, PTN.RESPONSE_END, resource, ignoreZeros);\n }\n\n const encodedLength = resource[PTN.ENCODED_BODY_SIZE];\n if (encodedLength !== undefined) {\n span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH, encodedLength);\n }\n\n const decodedLength = resource[PTN.DECODED_BODY_SIZE];\n if (decodedLength !== undefined && encodedLength !== decodedLength) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,\n decodedLength,\n );\n }\n}\n"],"mappings":";;AASA,MAAM,oCAAoC;AAC1C,MAAM,iDACJ;AA2BF,SAAgB,OACd,KACA,KACgB;AAChB,QAAO,OAAO;;AAGhB,SAAgB,oBACd,MACA,iBACA,SACA,cAAc,MACI;AAClB,KACE,OAAO,SAAS,gBAAgB,IAChC,OAAO,QAAQ,qBAAqB,YACpC,EAAE,eAAe,QAAQ,qBAAqB,GAE9C,QAAO,KAAK,SAAS,iBAAiB,QAAQ,iBAAiB;;AAKnE,SAAgB,qBACd,MACA,UACA,sBAAsB,OACtB,cAAc,SAAA,iBAA6B,GACrC;AACN,KAAI,CAAC,qBAAqB;AACxB,sBAAoB,MAAA,cAAuB,UAAU,YAAY;AACjE,sBAAoB,MAAA,qBAA+B,UAAU,YAAY;AACzE,sBAAoB,MAAA,mBAA6B,UAAU,YAAY;AACvE,sBAAoB,MAAA,gBAAyB,UAAU,YAAY;AACnE,sBACE,MAAA,yBAEA,UACA,YACD;AACD,sBAAoB,MAAA,cAAuB,UAAU,YAAY;AACjE,sBAAoB,MAAA,gBAAyB,UAAU,YAAY;AACnE,sBAAoB,MAAA,iBAA0B,UAAU,YAAY;AACpE,sBAAoB,MAAA,eAAwB,UAAU,YAAY;;CAGpE,MAAM,gBAAgB,SAAA;AACtB,KAAI,kBAAkB,KAAA,EACpB,MAAK,aAAa,mCAAmC,cAAc;CAGrE,MAAM,gBAAgB,SAAA;AACtB,KAAI,kBAAkB,KAAA,KAAa,kBAAkB,cACnD,MAAK,aACH,gDACA,cACD"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("
|
|
2
|
+
const require_instrumentations_document_load_DocumentLoadInstrumentation_enums_PerformanceTimingNames = require("./enums/PerformanceTimingNames.cjs");
|
|
3
|
+
const require_instrumentations_document_load_DocumentLoadInstrumentation_networkEvents = require("./networkEvents.cjs");
|
|
3
4
|
const require_utils_getNonBaselineNavigationTiming = require("../../../utils/getNonBaselineNavigationTiming.cjs");
|
|
4
5
|
const require_utils_getBfcacheNotRestoredReasons = require("../../../utils/getBfcacheNotRestoredReasons.cjs");
|
|
5
6
|
require("./enums/EventNames.cjs");
|
|
6
|
-
let _opentelemetry_sdk_trace_web = require("@opentelemetry/sdk-trace-web");
|
|
7
7
|
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts
|
|
8
8
|
const getPerformanceNavigationEntries = () => {
|
|
9
9
|
const entries = {};
|
|
10
10
|
const performanceNavigationTiming = require_utils_getNonBaselineNavigationTiming.getNonBaselineNavigationTiming();
|
|
11
11
|
if (!performanceNavigationTiming) return entries;
|
|
12
|
-
Object.values(
|
|
13
|
-
if (
|
|
12
|
+
Object.values(require_instrumentations_document_load_DocumentLoadInstrumentation_enums_PerformanceTimingNames.PerformanceTimingNames).forEach((key) => {
|
|
13
|
+
if (require_instrumentations_document_load_DocumentLoadInstrumentation_networkEvents.hasKey(performanceNavigationTiming, key)) {
|
|
14
14
|
const value = performanceNavigationTiming[key];
|
|
15
15
|
if (typeof value === "number") entries[key] = value;
|
|
16
16
|
}
|
|
@@ -30,7 +30,7 @@ const performancePaintNames = {
|
|
|
30
30
|
};
|
|
31
31
|
const addSpanPerformancePaintEvents = (span, perf) => {
|
|
32
32
|
window.performance.getEntriesByType("paint").forEach(({ name, startTime }) => {
|
|
33
|
-
if (
|
|
33
|
+
if (require_instrumentations_document_load_DocumentLoadInstrumentation_networkEvents.hasKey(performancePaintNames, name)) span.addEvent(performancePaintNames[name], perf.epochMillisFromOriginOffset(startTime));
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["getNonBaselineNavigationTiming","PerformanceTimingNames","getBfcacheNotRestoredReasons"],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"sourcesContent":["/*\n * Adapted from OpenTelemetry document-load instrumentation\n * https://github.com/open-telemetry/opentelemetry-js-contrib/tree/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-document-load\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["getNonBaselineNavigationTiming","PerformanceTimingNames","hasKey","getBfcacheNotRestoredReasons"],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"sourcesContent":["/*\n * Adapted from OpenTelemetry document-load instrumentation\n * https://github.com/open-telemetry/opentelemetry-js-contrib/tree/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-document-load\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport { getBfcacheNotRestoredReasons } from '../../../utils/getBfcacheNotRestoredReasons';\nimport type { MXLPerformanceNavigationTiming } from '../../../utils/getNonBaselineNavigationTiming';\nimport { getNonBaselineNavigationTiming } from '../../../utils/getNonBaselineNavigationTiming';\nimport type { PerformanceManager } from '../../../utils/PerformanceManager/types';\nimport { EventNames } from './enums/EventNames';\nimport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\nimport type { PerformanceEntries } from './networkEvents';\nimport { hasKey } from './networkEvents';\n\nexport type MXLPerformanceResourceTiming = PerformanceResourceTiming & {\n deliveryType?: 'cache' | '';\n renderBlockingStatus?: 'blocking' | 'non-blocking';\n};\n\nexport type MXLPerformanceNavigationEntries = PerformanceEntries & {\n transferSize?: number;\n initiatorType?: string;\n responseStatus?: number;\n deliveryType?: 'cache' | '';\n renderBlockingStatus?: 'blocking' | 'non-blocking';\n type?: NavigationTimingType;\n notRestoredReasons?: string[];\n};\n\nexport const getPerformanceNavigationEntries =\n (): MXLPerformanceNavigationEntries => {\n const entries: MXLPerformanceNavigationEntries = {};\n const performanceNavigationTiming:\n | MXLPerformanceNavigationTiming\n | undefined = getNonBaselineNavigationTiming();\n if (!performanceNavigationTiming) {\n return entries;\n }\n\n const keys = Object.values(PerformanceTimingNames);\n keys.forEach((key: PerformanceTimingNames) => {\n if (hasKey(performanceNavigationTiming, key)) {\n const value = performanceNavigationTiming[key];\n if (typeof value === 'number') {\n entries[key] = value;\n }\n }\n });\n\n entries.transferSize = performanceNavigationTiming.transferSize;\n entries.initiatorType = performanceNavigationTiming.initiatorType;\n entries.responseStatus = performanceNavigationTiming.responseStatus;\n entries.deliveryType = performanceNavigationTiming.deliveryType;\n entries.renderBlockingStatus =\n performanceNavigationTiming.renderBlockingStatus;\n entries.type = performanceNavigationTiming.type;\n entries.notRestoredReasons = getBfcacheNotRestoredReasons(\n performanceNavigationTiming,\n );\n\n return entries;\n };\n\nconst performancePaintNames = {\n 'first-contentful-paint': EventNames.FIRST_CONTENTFUL_PAINT,\n 'first-paint': EventNames.FIRST_PAINT,\n};\n\nexport const addSpanPerformancePaintEvents = (\n span: Span,\n perf: PerformanceManager,\n) => {\n const performancePaintTiming = window.performance.getEntriesByType('paint');\n performancePaintTiming.forEach(({ name, startTime }) => {\n if (hasKey(performancePaintNames, name)) {\n span.addEvent(\n performancePaintNames[name],\n perf.epochMillisFromOriginOffset(startTime),\n );\n }\n });\n};\n"],"mappings":";;;;;;;AA8BA,MAAa,wCAC4B;CACrC,MAAM,UAA2C,EAAE;CACnD,MAAM,8BAEUA,6CAAAA,gCAAgC;AAChD,KAAI,CAAC,4BACH,QAAO;AAGI,QAAO,OAAOC,gGAAAA,uBACvB,CAAC,SAAS,QAAgC;AAC5C,MAAIC,iFAAAA,OAAO,6BAA6B,IAAI,EAAE;GAC5C,MAAM,QAAQ,4BAA4B;AAC1C,OAAI,OAAO,UAAU,SACnB,SAAQ,OAAO;;GAGnB;AAEF,SAAQ,eAAe,4BAA4B;AACnD,SAAQ,gBAAgB,4BAA4B;AACpD,SAAQ,iBAAiB,4BAA4B;AACrD,SAAQ,eAAe,4BAA4B;AACnD,SAAQ,uBACN,4BAA4B;AAC9B,SAAQ,OAAO,4BAA4B;AAC3C,SAAQ,qBAAqBC,2CAAAA,6BAC3B,4BACD;AAED,QAAO;;AAGX,MAAM,wBAAwB;CAC5B,0BAAA;CACA,eAAA;CACD;AAED,MAAa,iCACX,MACA,SACG;AAC4B,QAAO,YAAY,iBAAiB,QAC7C,CAAC,SAAS,EAAE,MAAM,gBAAgB;AACtD,MAAID,iFAAAA,OAAO,uBAAuB,KAAK,CACrC,MAAK,SACH,sBAAsB,OACtB,KAAK,4BAA4B,UAAU,CAC5C;GAEH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PerformanceManager } from "../../../utils/PerformanceManager/types.cjs";
|
|
2
|
+
import { PerformanceEntries } from "./networkEvents.cjs";
|
|
2
3
|
import { Span } from "@opentelemetry/api";
|
|
3
|
-
import { PerformanceEntries } from "@opentelemetry/sdk-trace-web";
|
|
4
4
|
|
|
5
5
|
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts
|
|
6
6
|
type MXLPerformanceResourceTiming = PerformanceResourceTiming & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"mappings":";;;;;KAeY,4BAAA,GAA+B,yBAAA;EACzC,YAAA;EACA,oBAAA;AAAA;AAAA,KAGU,+BAAA,GAAkC,kBAAA;EAC5C,YAAA;EACA,aAAA;EACA,cAAA;EACA,YAAA;EACA,oBAAA;EACA,IAAA,GAAO,oBAAA;EACP,kBAAA;AAAA;AAAA,cAGW,+BAAA,QACP,+BAAA;AAAA,cAsCO,6BAAA,GACX,IAAA,EAAM,IAAA,EACN,IAAA,EAAM,kBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PerformanceManager } from "../../../utils/PerformanceManager/types.js";
|
|
2
|
+
import { PerformanceEntries } from "./networkEvents.js";
|
|
2
3
|
import { Span } from "@opentelemetry/api";
|
|
3
|
-
import { PerformanceEntries } from "@opentelemetry/sdk-trace-web";
|
|
4
4
|
|
|
5
5
|
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/utils.d.ts
|
|
6
6
|
type MXLPerformanceResourceTiming = PerformanceResourceTiming & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"mappings":";;;;;KAeY,4BAAA,GAA+B,yBAAA;EACzC,YAAA;EACA,oBAAA;AAAA;AAAA,KAGU,+BAAA,GAAkC,kBAAA;EAC5C,YAAA;EACA,aAAA;EACA,cAAA;EACA,YAAA;EACA,oBAAA;EACA,IAAA,GAAO,oBAAA;EACP,kBAAA;AAAA;AAAA,cAGW,+BAAA,QACP,+BAAA;AAAA,cAsCO,6BAAA,GACX,IAAA,EAAM,IAAA,EACN,IAAA,EAAM,kBAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { PerformanceTimingNames } from "./enums/PerformanceTimingNames.js";
|
|
2
|
+
import { hasKey } from "./networkEvents.js";
|
|
1
3
|
import { getNonBaselineNavigationTiming } from "../../../utils/getNonBaselineNavigationTiming.js";
|
|
2
4
|
import { getBfcacheNotRestoredReasons } from "../../../utils/getBfcacheNotRestoredReasons.js";
|
|
3
5
|
import "./enums/EventNames.js";
|
|
4
|
-
import { PerformanceTimingNames, hasKey } from "@opentelemetry/sdk-trace-web";
|
|
5
6
|
//#region src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts
|
|
6
7
|
const getPerformanceNavigationEntries = () => {
|
|
7
8
|
const entries = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"sourcesContent":["/*\n * Adapted from OpenTelemetry document-load instrumentation\n * https://github.com/open-telemetry/opentelemetry-js-contrib/tree/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-document-load\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/utils.ts"],"sourcesContent":["/*\n * Adapted from OpenTelemetry document-load instrumentation\n * https://github.com/open-telemetry/opentelemetry-js-contrib/tree/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-document-load\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport { getBfcacheNotRestoredReasons } from '../../../utils/getBfcacheNotRestoredReasons';\nimport type { MXLPerformanceNavigationTiming } from '../../../utils/getNonBaselineNavigationTiming';\nimport { getNonBaselineNavigationTiming } from '../../../utils/getNonBaselineNavigationTiming';\nimport type { PerformanceManager } from '../../../utils/PerformanceManager/types';\nimport { EventNames } from './enums/EventNames';\nimport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\nimport type { PerformanceEntries } from './networkEvents';\nimport { hasKey } from './networkEvents';\n\nexport type MXLPerformanceResourceTiming = PerformanceResourceTiming & {\n deliveryType?: 'cache' | '';\n renderBlockingStatus?: 'blocking' | 'non-blocking';\n};\n\nexport type MXLPerformanceNavigationEntries = PerformanceEntries & {\n transferSize?: number;\n initiatorType?: string;\n responseStatus?: number;\n deliveryType?: 'cache' | '';\n renderBlockingStatus?: 'blocking' | 'non-blocking';\n type?: NavigationTimingType;\n notRestoredReasons?: string[];\n};\n\nexport const getPerformanceNavigationEntries =\n (): MXLPerformanceNavigationEntries => {\n const entries: MXLPerformanceNavigationEntries = {};\n const performanceNavigationTiming:\n | MXLPerformanceNavigationTiming\n | undefined = getNonBaselineNavigationTiming();\n if (!performanceNavigationTiming) {\n return entries;\n }\n\n const keys = Object.values(PerformanceTimingNames);\n keys.forEach((key: PerformanceTimingNames) => {\n if (hasKey(performanceNavigationTiming, key)) {\n const value = performanceNavigationTiming[key];\n if (typeof value === 'number') {\n entries[key] = value;\n }\n }\n });\n\n entries.transferSize = performanceNavigationTiming.transferSize;\n entries.initiatorType = performanceNavigationTiming.initiatorType;\n entries.responseStatus = performanceNavigationTiming.responseStatus;\n entries.deliveryType = performanceNavigationTiming.deliveryType;\n entries.renderBlockingStatus =\n performanceNavigationTiming.renderBlockingStatus;\n entries.type = performanceNavigationTiming.type;\n entries.notRestoredReasons = getBfcacheNotRestoredReasons(\n performanceNavigationTiming,\n );\n\n return entries;\n };\n\nconst performancePaintNames = {\n 'first-contentful-paint': EventNames.FIRST_CONTENTFUL_PAINT,\n 'first-paint': EventNames.FIRST_PAINT,\n};\n\nexport const addSpanPerformancePaintEvents = (\n span: Span,\n perf: PerformanceManager,\n) => {\n const performancePaintTiming = window.performance.getEntriesByType('paint');\n performancePaintTiming.forEach(({ name, startTime }) => {\n if (hasKey(performancePaintNames, name)) {\n span.addEvent(\n performancePaintNames[name],\n perf.epochMillisFromOriginOffset(startTime),\n );\n }\n });\n};\n"],"mappings":";;;;;;AA8BA,MAAa,wCAC4B;CACrC,MAAM,UAA2C,EAAE;CACnD,MAAM,8BAEU,gCAAgC;AAChD,KAAI,CAAC,4BACH,QAAO;AAGI,QAAO,OAAO,uBACvB,CAAC,SAAS,QAAgC;AAC5C,MAAI,OAAO,6BAA6B,IAAI,EAAE;GAC5C,MAAM,QAAQ,4BAA4B;AAC1C,OAAI,OAAO,UAAU,SACnB,SAAQ,OAAO;;GAGnB;AAEF,SAAQ,eAAe,4BAA4B;AACnD,SAAQ,gBAAgB,4BAA4B;AACpD,SAAQ,iBAAiB,4BAA4B;AACrD,SAAQ,eAAe,4BAA4B;AACnD,SAAQ,uBACN,4BAA4B;AAC9B,SAAQ,OAAO,4BAA4B;AAC3C,SAAQ,qBAAqB,6BAC3B,4BACD;AAED,QAAO;;AAGX,MAAM,wBAAwB;CAC5B,0BAAA;CACA,eAAA;CACD;AAED,MAAa,iCACX,MACA,SACG;AAC4B,QAAO,YAAY,iBAAiB,QAC7C,CAAC,SAAS,EAAE,MAAM,gBAAgB;AACtD,MAAI,OAAO,uBAAuB,KAAK,CACrC,MAAK,SACH,sBAAsB,OACtB,KAAK,4BAA4B,UAAU,CAC5C;GAEH"}
|