@grafana/faro-web-sdk 1.10.2 → 1.12.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/bundle/faro-web-sdk.iife.js +1 -1
- package/dist/bundle/types/index.d.ts +1 -0
- package/dist/bundle/types/instrumentations/console/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/console/types.d.ts +6 -4
- package/dist/bundle/types/instrumentations/errors/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/performance/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/performance/types.d.ts +2 -2
- package/dist/bundle/types/instrumentations/session/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/view/instrumentation.d.ts +1 -1
- package/dist/bundle/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
- package/dist/bundle/types/transports/console/transport.d.ts +1 -1
- package/dist/bundle/types/transports/fetch/transport.d.ts +1 -1
- package/dist/bundle/types/utils/index.d.ts +2 -0
- package/dist/bundle/types/utils/json.d.ts +2 -0
- package/dist/bundle/types/utils/url.d.ts +4 -0
- package/dist/cjs/config/makeCoreConfig.js +1 -0
- package/dist/cjs/config/makeCoreConfig.js.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instrumentations/console/instrumentation.js +22 -2
- package/dist/cjs/instrumentations/console/instrumentation.js.map +1 -1
- package/dist/cjs/instrumentations/console/types.js.map +1 -1
- package/dist/cjs/instrumentations/performance/performanceUtils.js +5 -2
- package/dist/cjs/instrumentations/performance/performanceUtils.js.map +1 -1
- package/dist/cjs/instrumentations/performance/types.js.map +1 -1
- package/dist/cjs/instrumentations/session/sessionManager/PersistentSessionsManager.js +1 -1
- package/dist/cjs/instrumentations/session/sessionManager/PersistentSessionsManager.js.map +1 -1
- package/dist/cjs/instrumentations/session/sessionManager/VolatileSessionManager.js +2 -1
- package/dist/cjs/instrumentations/session/sessionManager/VolatileSessionManager.js.map +1 -1
- package/dist/cjs/utils/index.js +6 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/json.js +22 -0
- package/dist/cjs/utils/json.js.map +1 -0
- package/dist/cjs/utils/url.js +12 -0
- package/dist/cjs/utils/url.js.map +1 -0
- package/dist/esm/config/makeCoreConfig.js +1 -0
- package/dist/esm/config/makeCoreConfig.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instrumentations/console/instrumentation.js +12 -3
- package/dist/esm/instrumentations/console/instrumentation.js.map +1 -1
- package/dist/esm/instrumentations/console/types.js.map +1 -1
- package/dist/esm/instrumentations/performance/performanceUtils.js +5 -2
- package/dist/esm/instrumentations/performance/performanceUtils.js.map +1 -1
- package/dist/esm/instrumentations/performance/types.js.map +1 -1
- package/dist/esm/instrumentations/session/sessionManager/PersistentSessionsManager.js +2 -2
- package/dist/esm/instrumentations/session/sessionManager/PersistentSessionsManager.js.map +1 -1
- package/dist/esm/instrumentations/session/sessionManager/VolatileSessionManager.js +2 -1
- package/dist/esm/instrumentations/session/sessionManager/VolatileSessionManager.js.map +1 -1
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/json.js +16 -0
- package/dist/esm/utils/json.js.map +1 -0
- package/dist/esm/utils/url.js +8 -0
- package/dist/esm/utils/url.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/console/types.d.ts +6 -4
- package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/performance/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/performance/types.d.ts +2 -2
- package/dist/types/instrumentations/session/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/view/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
- package/dist/types/transports/console/transport.d.ts +1 -1
- package/dist/types/transports/fetch/transport.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/json.d.ts +2 -0
- package/dist/types/utils/url.d.ts +4 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performanceUtils.js","sourceRoot":"","sources":["../../../../src/instrumentations/performance/performanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAyB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInF,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAIzE,oDAAoD;AACpD,MAAM,UAAU,8BAA8B,CAAC,gBAA2C,EAAE;IAC1F,KAAK,MAAM,WAAW,IAAI,aAAa,EAAE;QACvC,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE;YACtC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE;gBACvD,SAAS;aACV;YAED,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE;gBACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;aAC5B;YAED,MAAM;SACP;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,OAAO,qBAAqB,IAAI,MAAM,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,cAAsC,EAAE,EAAE,SAAiB;IAC3F,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAuB;IACrD,IAAI,QAAQ,CAAC,U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I,IAAI,EAAE;QACb,OAAO,aAAa,CAAC;KACtB;IAED,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;KACjC;IAED,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC","sourcesContent":["import { isArray, type PushEventOptions, unknownString } from '@grafana/faro-core';\n\nimport type { CacheType, FaroNavigationTiming, FaroResourceTiming } from './types';\n\nconst w3cTraceparentFormat = /^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;\n\ntype SpanContext = PushEventOptions['spanContext'];\n\n// Extract traceparent from serverTiming, if present\nexport function getSpanContextFromServerTiming(serverTimings: PerformanceServerTiming[] = []): SpanContext | undefined {\n for (const serverEntry of serverTimings) {\n if (serverEntry.name === 'traceparent') {\n if (!w3cTraceparentFormat.test(serverEntry.description)) {\n continue;\n }\n\n const [, traceId, spanId] = serverEntry.description.split('-');\n if (traceId != null && spanId != null) {\n return { traceId, spanId };\n }\n\n break;\n }\n }\n\n return undefined;\n}\n\nexport function performanceObserverSupported(): boolean {\n return 'PerformanceObserver' in window;\n}\n\nexport function entryUrlIsIgnored(ignoredUrls: Array<string | RegExp> = [], entryName: string): boolean {\n return ignoredUrls.some((url) => url && entryName.match(url) != null);\n}\n\nexport function onDocumentReady(handleReady: () => void) {\n if (document.readyState === 'complete') {\n handleReady();\n } else {\n const readyStateCompleteHandler = () => {\n if (document.readyState === 'complete') {\n handleReady();\n document.removeEventListener('readystatechange', readyStateCompleteHandler);\n }\n };\n\n document.addEventListener('readystatechange', readyStateCompleteHandler);\n }\n}\n\ntype PerformanceEntryAllowProperties = Record<string, Array<string | number> | string | number>;\n\nexport function includePerformanceEntry(\n performanceEntryJSON: Record<string, any>,\n allowProps: PerformanceEntryAllowProperties = {}\n): boolean {\n for (const [allowPropKey, allowPropValue] of Object.entries(allowProps)) {\n const perfEntryPropVal = performanceEntryJSON[allowPropKey];\n\n if (perfEntryPropVal == null) {\n return false;\n }\n\n if (isArray(allowPropValue)) {\n return allowPropValue.includes(perfEntryPropVal);\n }\n\n return perfEntryPropVal === allowPropValue;\n }\n\n // empty object allows all\n return true;\n}\n\nexport function createFaroResourceTiming(resourceEntryRaw: PerformanceResourceTiming): FaroResourceTiming {\n const {\n connectEnd,\n connectStart,\n decodedBodySize,\n domainLookupEnd,\n domainLookupStart,\n duration,\n encodedBodySize,\n fetchStart,\n initiatorType,\n name,\n nextHopProtocol,\n redirectEnd,\n redirectStart,\n // @ts-expect-error the renderBlockingStatus property is not available in all browsers\n renderBlockingStatus: rbs,\n requestStart,\n responseEnd,\n responseStart,\n // @ts-expect-error the renderBlockingStatus property is not available in all browsers\n responseStatus,\n secureConnectionStart,\n transferSize,\n workerStart,\n } = resourceEntryRaw;\n\n return {\n name: name,\n duration: toFaroPerformanceTimingString(duration),\n tcpHandshakeTime: toFaroPerformanceTimingString(connectEnd - connectStart),\n dnsLookupTime: toFaroPerformanceTimingString(domainLookupEnd - domainLookupStart),\n tlsNegotiationTime: toFaroPerformanceTimingString(requestStart - secureConnectionStart),\n responseStatus: toFaroPerformanceTimingString(responseStatus),\n redirectTime: toFaroPerformanceTimingString(redirectEnd - redirectStart),\n requestTime: toFaroPerformanceTimingString(responseStart - requestStart),\n responseTime: toFaroPerformanceTimingString(responseEnd - responseStart),\n fetchTime: toFaroPerformanceTimingString(responseEnd - fetchStart),\n serviceWorkerTime: toFaroPerformanceTimingString(fetchStart - workerStart),\n decodedBodySize: toFaroPerformanceTimingString(decodedBodySize),\n encodedBodySize: toFaroPerformanceTimingString(encodedBodySize),\n cacheHitStatus: getCacheType(),\n renderBlockingStatus: toFaroPerformanceTimingString(rbs) as FaroResourceTiming['renderBlockingStatus'],\n protocol: nextHopProtocol,\n initiatorType: initiatorType,\n\n // TODO: add in future iteration, ideally after nested objects are supported by the collector.\n // serverTiming: resourceEntryRaw.serverTiming,\n };\n\n function getCacheType(): CacheType {\n let cacheType: CacheType = 'fullLoad';\n if (transferSize === 0) {\n if (decodedBodySize > 0) {\n cacheType = 'cache';\n }\n } else {\n if (responseStatus != null) {\n if (responseStatus === 304) {\n cacheType = 'conditionalFetch';\n }\n } else if (encodedBodySize > 0 && transferSize < encodedBodySize) {\n cacheType = 'conditionalFetch';\n }\n }\n return cacheType;\n }\n}\n\nexport function createFaroNavigationTiming(navigationEntryRaw: PerformanceNavigationTiming): FaroNavigationTiming {\n const {\n activationStart,\n domComplete,\n domContentLoadedEventEnd,\n domContentLoadedEventStart,\n domInteractive,\n fetchStart,\n loadEventEnd,\n loadEventStart,\n responseStart,\n type,\n } = navigationEntryRaw;\n\n const parserStart = getDocumentParsingTime();\n\n return {\n visibilityState: document.visibilityState,\n pageLoadTime: toFaroPerformanceTimingString(domComplete - fetchStart),\n documentParsingTime: toFaroPerformanceTimingString(parserStart ? domInteractive - parserStart : null),\n domProcessingTime: toFaroPerformanceTimingString(domComplete - domInteractive),\n domContentLoadHandlerTime: toFaroPerformanceTimingString(domContentLoadedEventEnd - domContentLoadedEventStart),\n onLoadTime: toFaroPerformanceTimingString(loadEventEnd - loadEventStart),\n\n // For more accuracy on prerendered pages page we calculate relative top the activationStart instead of the start of the navigation.\n // clamp to 0 if activationStart occurs after first byte is received.\n ttfb: toFaroPerformanceTimingString(Math.max(responseStart - (activationStart ?? 0), 0)),\n\n type: type,\n\n ...createFaroResourceTiming(navigationEntryRaw),\n };\n}\n\nfunction getDocumentParsingTime(): number | null {\n if (performance.timing?.domLoading != null) {\n // the browser is about to start parsing the first received bytes of the HTML document.\n // This property is deprecated but there isn't a really good alternative atm.\n // For now we stick with domLoading and keep researching a better alternative.\n return performance.timing.domLoading - performance.timeOrigin;\n }\n\n return null;\n}\n\nfunction toFaroPerformanceTimingString(v: unknown): string {\n if (v == null) {\n return unknownString;\n }\n\n if (typeof v === 'number') {\n return Math.round(v).toString();\n }\n\n return v.toString();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"performanceUtils.js","sourceRoot":"","sources":["../../../../src/instrumentations/performance/performanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAyB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInF,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAIzE,oDAAoD;AACpD,MAAM,UAAU,8BAA8B,CAAC,gBAA2C,EAAE;IAC1F,KAAK,MAAM,WAAW,IAAI,aAAa,EAAE;QACvC,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE;YACtC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE;gBACvD,SAAS;aACV;YAED,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE;gBACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;aAC5B;YAED,MAAM;SACP;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,OAAO,qBAAqB,IAAI,MAAM,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,cAAsC,EAAE,EAAE,SAAiB;IAC3F,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAuB;IACrD,IAAI,QAAQ,CAAC,UAAU,KAAK,UAAU,EAAE;QACtC,WAAW,EAAE,CAAC;KACf;SAAM;QACL,MAAM,yBAAyB,GAAG,GAAG,EAAE;YACrC,IAAI,QAAQ,CAAC,UAAU,KAAK,UAAU,EAAE;gBACtC,WAAW,EAAE,CAAC;gBACd,QAAQ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KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;KACjC;IAED,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC","sourcesContent":["import { isArray, type PushEventOptions, unknownString } from '@grafana/faro-core';\n\nimport type { CacheType, FaroNavigationTiming, FaroResourceTiming } from './types';\n\nconst w3cTraceparentFormat = /^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;\n\ntype SpanContext = PushEventOptions['spanContext'];\n\n// Extract traceparent from serverTiming, if present\nexport function getSpanContextFromServerTiming(serverTimings: PerformanceServerTiming[] = []): SpanContext | undefined {\n for (const serverEntry of serverTimings) {\n if (serverEntry.name === 'traceparent') {\n if (!w3cTraceparentFormat.test(serverEntry.description)) {\n continue;\n }\n\n const [, traceId, spanId] = serverEntry.description.split('-');\n if (traceId != null && spanId != null) {\n return { traceId, spanId };\n }\n\n break;\n }\n }\n\n return undefined;\n}\n\nexport function performanceObserverSupported(): boolean {\n return 'PerformanceObserver' in window;\n}\n\nexport function entryUrlIsIgnored(ignoredUrls: Array<string | RegExp> = [], entryName: string): boolean {\n return ignoredUrls.some((url) => url && entryName.match(url) != null);\n}\n\nexport function onDocumentReady(handleReady: () => void) {\n if (document.readyState === 'complete') {\n handleReady();\n } else {\n const readyStateCompleteHandler = () => {\n if (document.readyState === 'complete') {\n handleReady();\n document.removeEventListener('readystatechange', readyStateCompleteHandler);\n }\n };\n\n document.addEventListener('readystatechange', readyStateCompleteHandler);\n }\n}\n\ntype PerformanceEntryAllowProperties = Record<string, Array<string | number> | string | number>;\n\nexport function includePerformanceEntry(\n performanceEntryJSON: Record<string, any>,\n allowProps: PerformanceEntryAllowProperties = {}\n): boolean {\n for (const [allowPropKey, allowPropValue] of Object.entries(allowProps)) {\n const perfEntryPropVal = performanceEntryJSON[allowPropKey];\n\n if (perfEntryPropVal == null) {\n return false;\n }\n\n if (isArray(allowPropValue)) {\n return allowPropValue.includes(perfEntryPropVal);\n }\n\n return perfEntryPropVal === allowPropValue;\n }\n\n // empty object allows all\n return true;\n}\n\nexport function createFaroResourceTiming(resourceEntryRaw: PerformanceResourceTiming): FaroResourceTiming {\n const {\n connectEnd,\n connectStart,\n decodedBodySize,\n domainLookupEnd,\n domainLookupStart,\n duration,\n encodedBodySize,\n fetchStart,\n initiatorType,\n name,\n nextHopProtocol,\n redirectEnd,\n redirectStart,\n // @ts-expect-error the renderBlockingStatus property is not available in all browsers\n renderBlockingStatus: rbs,\n requestStart,\n responseEnd,\n responseStart,\n // @ts-expect-error the renderBlockingStatus property is not available in all browsers\n responseStatus,\n secureConnectionStart,\n transferSize,\n workerStart,\n } = resourceEntryRaw;\n\n return {\n name: name,\n duration: toFaroPerformanceTimingString(duration),\n tcpHandshakeTime: toFaroPerformanceTimingString(connectEnd - connectStart),\n dnsLookupTime: toFaroPerformanceTimingString(domainLookupEnd - domainLookupStart),\n tlsNegotiationTime: toFaroPerformanceTimingString(requestStart - secureConnectionStart),\n responseStatus: toFaroPerformanceTimingString(responseStatus),\n redirectTime: toFaroPerformanceTimingString(redirectEnd - redirectStart),\n requestTime: toFaroPerformanceTimingString(responseStart - requestStart),\n responseTime: toFaroPerformanceTimingString(responseEnd - responseStart),\n fetchTime: toFaroPerformanceTimingString(responseEnd - fetchStart),\n serviceWorkerTime: toFaroPerformanceTimingString(fetchStart - workerStart),\n decodedBodySize: toFaroPerformanceTimingString(decodedBodySize),\n encodedBodySize: toFaroPerformanceTimingString(encodedBodySize),\n cacheHitStatus: getCacheType(),\n renderBlockingStatus: toFaroPerformanceTimingString(rbs) as FaroResourceTiming['renderBlockingStatus'],\n protocol: nextHopProtocol,\n initiatorType: initiatorType,\n visibilityState: document.visibilityState,\n ttfb: toFaroPerformanceTimingString(responseStart - requestStart),\n\n // TODO: add in future iteration, ideally after nested objects are supported by the collector.\n // serverTiming: resourceEntryRaw.serverTiming,\n };\n\n function getCacheType(): CacheType {\n let cacheType: CacheType = 'fullLoad';\n if (transferSize === 0) {\n if (decodedBodySize > 0) {\n cacheType = 'cache';\n }\n } else {\n if (responseStatus != null) {\n if (responseStatus === 304) {\n cacheType = 'conditionalFetch';\n }\n } else if (encodedBodySize > 0 && transferSize < encodedBodySize) {\n cacheType = 'conditionalFetch';\n }\n }\n return cacheType;\n }\n}\n\nexport function createFaroNavigationTiming(navigationEntryRaw: PerformanceNavigationTiming): FaroNavigationTiming {\n const {\n activationStart,\n domComplete,\n domContentLoadedEventEnd,\n domContentLoadedEventStart,\n domInteractive,\n fetchStart,\n loadEventEnd,\n loadEventStart,\n responseStart,\n type,\n } = navigationEntryRaw;\n\n const parserStart = getDocumentParsingTime();\n\n return {\n ...createFaroResourceTiming(navigationEntryRaw),\n pageLoadTime: toFaroPerformanceTimingString(domComplete - fetchStart),\n documentParsingTime: toFaroPerformanceTimingString(parserStart ? domInteractive - parserStart : null),\n domProcessingTime: toFaroPerformanceTimingString(domComplete - domInteractive),\n domContentLoadHandlerTime: toFaroPerformanceTimingString(domContentLoadedEventEnd - domContentLoadedEventStart),\n onLoadTime: toFaroPerformanceTimingString(loadEventEnd - loadEventStart),\n\n // For navigation entries we can calculate the TTFB based on activationStart. We overwrite the TTFB value coming with the resource entry.\n // For more accuracy on prerendered pages page we calculate relative top the activationStart instead of the start of the navigation.\n // clamp to 0 if activationStart occurs after first byte is received.\n ttfb: toFaroPerformanceTimingString(Math.max(responseStart - (activationStart ?? 0), 0)),\n type: type,\n };\n}\n\nfunction getDocumentParsingTime(): number | null {\n if (performance.timing?.domLoading != null) {\n // the browser is about to start parsing the first received bytes of the HTML document.\n // This property is deprecated but there isn't a really good alternative atm.\n // For now we stick with domLoading and keep researching a better alternative.\n return performance.timing.domLoading - performance.timeOrigin;\n }\n\n return null;\n}\n\nfunction toFaroPerformanceTimingString(v: unknown): string {\n if (v == null) {\n return unknownString;\n }\n\n if (typeof v === 'number') {\n return Math.round(v).toString();\n }\n\n return v.toString();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instrumentations/performance/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { unknownString } from '@grafana/faro-core';\n\nexport type FaroNavigationTiming = Readonly<\n {\n duration: string;\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instrumentations/performance/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { unknownString } from '@grafana/faro-core';\n\nexport type FaroNavigationTiming = Readonly<\n {\n duration: string;\n documentParsingTime: string;\n domProcessingTime: string;\n pageLoadTime: string;\n domContentLoadHandlerTime: string;\n onLoadTime: string;\n type: NavigationTimingType;\n } & FaroResourceTiming\n>;\n\nexport type FaroResourceTiming = Readonly<{\n name: string;\n duration: string;\n protocol: string;\n tcpHandshakeTime: string;\n dnsLookupTime: string;\n tlsNegotiationTime: string;\n responseStatus: string;\n redirectTime: string;\n requestTime: string;\n fetchTime: string;\n responseTime: string;\n serviceWorkerTime: string;\n decodedBodySize: string;\n encodedBodySize: string;\n cacheHitStatus: 'cache' | 'conditionalFetch' | 'fullLoad';\n renderBlockingStatus: 'blocking' | 'non-blocking' | typeof unknownString;\n initiatorType: string;\n // serverTiming: PerformanceServerTiming[];\n visibilityState: DocumentVisibilityState;\n ttfb: string;\n}>;\n\nexport type FaroNavigationItem = {\n faroNavigationId: string;\n faroPreviousNavigationId: string;\n} & FaroNavigationTiming &\n FaroResourceTiming;\n\nexport type FaroResourceItem = {\n faroNavigationId: string;\n faroResourceId: string;\n} & FaroResourceTiming;\n\nexport type CacheType = 'cache' | 'conditionalFetch' | 'fullLoad';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { faro } from '@grafana/faro-core';
|
|
2
|
-
import { throttle } from '../../../utils';
|
|
2
|
+
import { stringifyExternalJson, throttle } from '../../../utils';
|
|
3
3
|
import { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage';
|
|
4
4
|
import { isSampled } from './sampling';
|
|
5
5
|
import { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants';
|
|
@@ -17,7 +17,7 @@ export class PersistentSessionsManager {
|
|
|
17
17
|
removeItem(STORAGE_KEY, PersistentSessionsManager.storageTypeLocal);
|
|
18
18
|
}
|
|
19
19
|
static storeUserSession(session) {
|
|
20
|
-
setItem(STORAGE_KEY,
|
|
20
|
+
setItem(STORAGE_KEY, stringifyExternalJson(session), PersistentSessionsManager.storageTypeLocal);
|
|
21
21
|
}
|
|
22
22
|
static fetchUserSession() {
|
|
23
23
|
const storedSession = getItem(STORAGE_KEY, PersistentSessionsManager.storageTypeLocal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentSessionsManager.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/PersistentSessionsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PersistentSessionsManager.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/PersistentSessionsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGxH,MAAM,OAAO,yBAAyB;IAIpC;QA2BA,kBAAa,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EA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AA+B,CACjD,uBAAuB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,uBAAuB,CACxB,CAAC;gBAEF,yBAAyB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACxD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;aAC9C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AAtDc,0CAAgB,GAAG,cAAc,CAAC,KAAK,CAAC","sourcesContent":["import { faro } from '@grafana/faro-core';\nimport type { Meta } from '@grafana/faro-core';\n\nimport { stringifyExternalJson, throttle } from '../../../utils';\nimport { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage';\n\nimport { isSampled } from './sampling';\nimport { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants';\nimport { addSessionMetadataToNextSession, createUserSessionObject, getUserSessionUpdater } from './sessionManagerUtils';\nimport type { FaroUserSession } from './types';\n\nexport class PersistentSessionsManager {\n private static storageTypeLocal = webStorageType.local;\n private updateUserSession: ReturnType<typeof getUserSessionUpdater>;\n\n constructor() {\n this.updateUserSession = getUserSessionUpdater({\n fetchUserSession: PersistentSessionsManager.fetchUserSession,\n storeUserSession: PersistentSessionsManager.storeUserSession,\n });\n\n this.init();\n }\n\n static removeUserSession() {\n removeItem(STORAGE_KEY, PersistentSessionsManager.storageTypeLocal);\n }\n\n static storeUserSession(session: FaroUserSession): void {\n setItem(STORAGE_KEY, stringifyExternalJson(session), PersistentSessionsManager.storageTypeLocal);\n }\n\n static fetchUserSession(): FaroUserSession | null {\n const storedSession = getItem(STORAGE_KEY, PersistentSessionsManager.storageTypeLocal);\n\n if (storedSession) {\n return JSON.parse(storedSession) as FaroUserSession;\n }\n\n return null;\n }\n\n updateSession = throttle(() => this.updateUserSession(), STORAGE_UPDATE_DELAY);\n\n private init(): void {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n this.updateSession();\n }\n });\n\n // Users can call the setSession() method, so we need to sync this with the local storage session\n faro.metas.addListener(function syncSessionIfChangedExternally(meta: Meta) {\n const session = meta.session;\n const sessionFromLocalStorage = PersistentSessionsManager.fetchUserSession();\n\n if (session && session.id !== sessionFromLocalStorage?.sessionId) {\n const userSession = addSessionMetadataToNextSession(\n createUserSessionObject({ sessionId: session.id, isSampled: isSampled() }),\n sessionFromLocalStorage\n );\n\n PersistentSessionsManager.storeUserSession(userSession);\n faro.api.setSession(userSession.sessionMeta);\n }\n });\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { faro } from '@grafana/faro-core';
|
|
2
2
|
import { throttle } from '../../../utils';
|
|
3
|
+
import { stringifyExternalJson } from '../../../utils/json';
|
|
3
4
|
import { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage';
|
|
4
5
|
import { isSampled } from './sampling';
|
|
5
6
|
import { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants';
|
|
@@ -17,7 +18,7 @@ export class VolatileSessionsManager {
|
|
|
17
18
|
removeItem(STORAGE_KEY, VolatileSessionsManager.storageTypeSession);
|
|
18
19
|
}
|
|
19
20
|
static storeUserSession(session) {
|
|
20
|
-
setItem(STORAGE_KEY,
|
|
21
|
+
setItem(STORAGE_KEY, stringifyExternalJson(session), VolatileSessionsManager.storageTypeSession);
|
|
21
22
|
}
|
|
22
23
|
static fetchUserSession() {
|
|
23
24
|
const storedSession = getItem(STORAGE_KEY, VolatileSessionsManager.storageTypeSession);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolatileSessionManager.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/VolatileSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGxH,MAAM,OAAO,uBAAuB;IAIlC;QA2BA,kBAAa,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,oBAAoB,CAAC,CAAC;QA1B7E,IAAI,CAAC,iBAAiB,GAAG,qBAAqB,CAAC;YAC7C,gBAAgB,EAAE,uBAAuB,CAAC,gBAAgB;YAC1D,gBAAgB,EAAE,uBAAuB,CAAC,gBAAgB;SAC3D,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,iBAAiB;QACtB,UAAU,CAAC,WAAW,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,OAAwB;QAC9C,OAAO,CAAC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"VolatileSessionManager.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/VolatileSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBA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AC;YAC7B,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,gBAAgB,EAAE,CAAC;YAE7E,IAAI,OAAO,IAAI,OAAO,CAAC,EAAE,MAAK,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,SAAS,CAAA,EAAE;gBAClE,MAAM,WAAW,GAAG,+BAA+B,CACjD,uBAAuB,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,yBAAyB,CAC1B,CAAC;gBAEF,uBAAuB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACtD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;aAC9C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AAtDc,0CAAkB,GAAG,cAAc,CAAC,OAAO,CAAC","sourcesContent":["import { faro } from '@grafana/faro-core';\nimport type { Meta } from '@grafana/faro-core';\n\nimport { throttle } from '../../../utils';\nimport { stringifyExternalJson } from '../../../utils/json';\nimport { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage';\n\nimport { isSampled } from './sampling';\nimport { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants';\nimport { addSessionMetadataToNextSession, createUserSessionObject, getUserSessionUpdater } from './sessionManagerUtils';\nimport type { FaroUserSession } from './types';\n\nexport class VolatileSessionsManager {\n private static storageTypeSession = webStorageType.session;\n private updateUserSession: ReturnType<typeof getUserSessionUpdater>;\n\n constructor() {\n this.updateUserSession = getUserSessionUpdater({\n fetchUserSession: VolatileSessionsManager.fetchUserSession,\n storeUserSession: VolatileSessionsManager.storeUserSession,\n });\n\n this.init();\n }\n\n static removeUserSession() {\n removeItem(STORAGE_KEY, VolatileSessionsManager.storageTypeSession);\n }\n\n static storeUserSession(session: FaroUserSession): void {\n setItem(STORAGE_KEY, stringifyExternalJson(session), VolatileSessionsManager.storageTypeSession);\n }\n\n static fetchUserSession(): FaroUserSession | null {\n const storedSession = getItem(STORAGE_KEY, VolatileSessionsManager.storageTypeSession);\n\n if (storedSession) {\n return JSON.parse(storedSession) as FaroUserSession;\n }\n\n return null;\n }\n\n updateSession = throttle(() => this.updateUserSession(), STORAGE_UPDATE_DELAY);\n\n private init(): void {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'visible') {\n this.updateSession();\n }\n });\n\n // Users can call the setSession() method, so we need to sync this with the local storage session\n faro.metas.addListener(function syncSessionIfChangedExternally(meta: Meta) {\n const session = meta.session;\n const sessionFromSessionStorage = VolatileSessionsManager.fetchUserSession();\n\n if (session && session.id !== sessionFromSessionStorage?.sessionId) {\n const userSession = addSessionMetadataToNextSession(\n createUserSessionObject({ sessionId: session.id, isSampled: isSampled() }),\n sessionFromSessionStorage\n );\n\n VolatileSessionsManager.storeUserSession(userSession);\n faro.api.setSession(userSession.sessionMeta);\n }\n });\n }\n}\n"]}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { isLocalStorageAvailable, isSessionStorageAvailable, webStorageType, getItem, isWebStorageAvailable, removeItem, setItem, } from './webStorage';
|
|
2
2
|
export { throttle } from './throttle';
|
|
3
|
+
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
4
|
+
export { getIgnoreUrls } from './url';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,qBAAqB,EACrB,UAAU,EACV,OAAO,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export {\n isLocalStorageAvailable,\n isSessionStorageAvailable,\n webStorageType,\n getItem,\n isWebStorageAvailable,\n removeItem,\n setItem,\n} from './webStorage';\n\nexport { throttle } from './throttle';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,qBAAqB,EACrB,UAAU,EACV,OAAO,GACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC","sourcesContent":["export {\n isLocalStorageAvailable,\n isSessionStorageAvailable,\n webStorageType,\n getItem,\n isWebStorageAvailable,\n removeItem,\n setItem,\n} from './webStorage';\n\nexport { throttle } from './throttle';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson } from './json';\n\nexport { getIgnoreUrls } from './url';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getCircularDependencyReplacer() {
|
|
2
|
+
const valueSeen = new WeakSet();
|
|
3
|
+
return function (_key, value) {
|
|
4
|
+
if (typeof value === 'object' && value !== null) {
|
|
5
|
+
if (valueSeen.has(value)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
valueSeen.add(value);
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function stringifyExternalJson(json = {}) {
|
|
14
|
+
return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,6BAA6B;IAC3C,MAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;YAC/C,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC;aACb;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,qBAAqB,CAAC,OAAY,EAAE;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,6BAA6B,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["export function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (typeof value === 'object' && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import { faro } from '@grafana/faro-core';\nimport type { Transport } from '@grafana/faro-core';\n\n/**\n * Get all configured ignore URLs.\n */\nexport function getIgnoreUrls() {\n return faro.transports.transports.flatMap((transport: Transport) => transport.getIgnoreUrls());\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export type { ClockFn, ConsoleTransportOptions, FetchTransportOptions, FetchTran
|
|
|
10
10
|
export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, } from '@grafana/faro-core';
|
|
11
11
|
export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-core';
|
|
12
12
|
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session';
|
|
13
|
+
export { getIgnoreUrls } from './utils/url';
|
|
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
|
|
|
3
3
|
export declare class ConsoleInstrumentation extends BaseInstrumentation {
|
|
4
4
|
private options;
|
|
5
5
|
readonly name = "@grafana/faro-web-sdk:instrumentation-console";
|
|
6
|
-
readonly version = "1.
|
|
6
|
+
readonly version = "1.12.0";
|
|
7
7
|
static defaultDisabledLevels: LogLevel[];
|
|
8
8
|
constructor(options?: ConsoleInstrumentationOptions);
|
|
9
9
|
initialize(): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Config } from '@grafana/faro-core';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Configure console instrumentation using the `consoleInstrumentation` object in the
|
|
4
|
+
* Faro config.
|
|
5
|
+
*/
|
|
6
|
+
export type ConsoleInstrumentationOptions = Config['consoleInstrumentation'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class ErrorsInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
|
|
4
|
-
readonly version = "1.
|
|
4
|
+
readonly version = "1.12.0";
|
|
5
5
|
initialize(): void;
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class PerformanceInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-performance";
|
|
4
|
-
readonly version = "1.
|
|
4
|
+
readonly version = "1.12.0";
|
|
5
5
|
initialize(): void;
|
|
6
6
|
private getIgnoreUrls;
|
|
7
7
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { unknownString } from '@grafana/faro-core';
|
|
2
2
|
export type FaroNavigationTiming = Readonly<{
|
|
3
3
|
duration: string;
|
|
4
|
-
visibilityState: DocumentVisibilityState;
|
|
5
4
|
documentParsingTime: string;
|
|
6
5
|
domProcessingTime: string;
|
|
7
6
|
pageLoadTime: string;
|
|
8
7
|
domContentLoadHandlerTime: string;
|
|
9
8
|
onLoadTime: string;
|
|
10
|
-
ttfb: string;
|
|
11
9
|
type: NavigationTimingType;
|
|
12
10
|
} & FaroResourceTiming>;
|
|
13
11
|
export type FaroResourceTiming = Readonly<{
|
|
@@ -28,6 +26,8 @@ export type FaroResourceTiming = Readonly<{
|
|
|
28
26
|
cacheHitStatus: 'cache' | 'conditionalFetch' | 'fullLoad';
|
|
29
27
|
renderBlockingStatus: 'blocking' | 'non-blocking' | typeof unknownString;
|
|
30
28
|
initiatorType: string;
|
|
29
|
+
visibilityState: DocumentVisibilityState;
|
|
30
|
+
ttfb: string;
|
|
31
31
|
}>;
|
|
32
32
|
export type FaroNavigationItem = {
|
|
33
33
|
faroNavigationId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class SessionInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-session";
|
|
4
|
-
readonly version = "1.
|
|
4
|
+
readonly version = "1.12.0";
|
|
5
5
|
private notifiedSession;
|
|
6
6
|
private sendSessionStartEvent;
|
|
7
7
|
private createInitialSession;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class ViewInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-view";
|
|
4
|
-
readonly version = "1.
|
|
4
|
+
readonly version = "1.12.0";
|
|
5
5
|
private notifiedView;
|
|
6
6
|
private sendViewChangedEvent;
|
|
7
7
|
initialize(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseInstrumentation } from '@grafana/faro-core';
|
|
2
2
|
export declare class WebVitalsInstrumentation extends BaseInstrumentation {
|
|
3
3
|
readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
|
|
4
|
-
readonly version = "1.
|
|
4
|
+
readonly version = "1.12.0";
|
|
5
5
|
initialize(): void;
|
|
6
6
|
private intializeWebVitalsInstrumentation;
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
|
|
|
4
4
|
export declare class ConsoleTransport extends BaseTransport {
|
|
5
5
|
private options;
|
|
6
6
|
readonly name = "@grafana/faro-web-sdk:transport-console";
|
|
7
|
-
readonly version = "1.
|
|
7
|
+
readonly version = "1.12.0";
|
|
8
8
|
constructor(options?: ConsoleTransportOptions);
|
|
9
9
|
send(item: TransportItem): void;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
|
|
|
4
4
|
export declare class FetchTransport extends BaseTransport {
|
|
5
5
|
private options;
|
|
6
6
|
readonly name = "@grafana/faro-web-sdk:transport-fetch";
|
|
7
|
-
readonly version = "1.
|
|
7
|
+
readonly version = "1.12.0";
|
|
8
8
|
promiseBuffer: PromiseBuffer<Response | void>;
|
|
9
9
|
private readonly rateLimitBackoffMs;
|
|
10
10
|
private readonly getNow;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { isLocalStorageAvailable, isSessionStorageAvailable, webStorageType, getItem, isWebStorageAvailable, removeItem, setItem, } from './webStorage';
|
|
2
2
|
export { throttle } from './throttle';
|
|
3
|
+
export { getCircularDependencyReplacer, stringifyExternalJson } from './json';
|
|
4
|
+
export { getIgnoreUrls } from './url';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/faro-web-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Faro instrumentations, metas, transports for web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"observability",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"quality:circular-deps": "madge --circular ."
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@grafana/faro-core": "^1.
|
|
55
|
+
"@grafana/faro-core": "^1.12.0",
|
|
56
56
|
"ua-parser-js": "^1.0.32",
|
|
57
57
|
"web-vitals": "^4.0.1"
|
|
58
58
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f8209d591f250148b55ccc191059972e8e579784"
|
|
67
67
|
}
|