@safaricom-mxl/web-sdk 0.0.13 → 0.0.15
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/api-logs/api/LogAPI/LogAPI.cjs.map +1 -1
- package/dist/api-logs/api/LogAPI/LogAPI.js.map +1 -1
- package/dist/api-logs/logAPI.cjs.map +1 -1
- package/dist/api-logs/logAPI.js.map +1 -1
- package/dist/api-logs/manager/NoOpLogManager/NoOpLogManager.cjs.map +1 -1
- package/dist/api-logs/manager/NoOpLogManager/NoOpLogManager.js.map +1 -1
- package/dist/api-logs/manager/ProxyLogManager/ProxyLogManager.cjs.map +1 -1
- package/dist/api-logs/manager/ProxyLogManager/ProxyLogManager.js.map +1 -1
- package/dist/api-page/api/PageAPI/PageAPI.cjs.map +1 -1
- package/dist/api-page/api/PageAPI/PageAPI.js.map +1 -1
- package/dist/api-page/manager/NoOpPageManager/NoOpPageManager.cjs.map +1 -1
- package/dist/api-page/manager/NoOpPageManager/NoOpPageManager.js.map +1 -1
- package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.cjs.map +1 -1
- package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.js.map +1 -1
- package/dist/api-page/pageAPI.cjs.map +1 -1
- package/dist/api-page/pageAPI.js.map +1 -1
- package/dist/api-sessions/api/SessionAPI/SessionAPI.cjs.map +1 -1
- package/dist/api-sessions/api/SessionAPI/SessionAPI.d.cts.map +1 -1
- package/dist/api-sessions/api/SessionAPI/SessionAPI.d.ts.map +1 -1
- package/dist/api-sessions/api/SessionAPI/SessionAPI.js.map +1 -1
- package/dist/api-sessions/manager/NoOpSpanSessionManager/NoOpSpanSessionManager.cjs.map +1 -1
- package/dist/api-sessions/manager/NoOpSpanSessionManager/NoOpSpanSessionManager.js.map +1 -1
- package/dist/api-sessions/manager/ProxySpanSessionManager/ProxySpanSessionManager.cjs.map +1 -1
- package/dist/api-sessions/manager/ProxySpanSessionManager/ProxySpanSessionManager.js.map +1 -1
- package/dist/api-sessions/sessionAPI.cjs.map +1 -1
- package/dist/api-sessions/sessionAPI.js.map +1 -1
- package/dist/api-traces/api/TraceAPI/TraceAPI.cjs.map +1 -1
- package/dist/api-traces/api/TraceAPI/TraceAPI.js.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NoOpTraceManager.cjs.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NoOpTraceManager.js.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NonRecordingExtendedSpan.cjs.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NonRecordingExtendedSpan.d.cts.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NonRecordingExtendedSpan.d.ts.map +1 -1
- package/dist/api-traces/manager/NoOpTraceManager/NonRecordingExtendedSpan.js.map +1 -1
- package/dist/api-traces/manager/ProxyTraceManager/ProxyTraceManager.cjs.map +1 -1
- package/dist/api-traces/manager/ProxyTraceManager/ProxyTraceManager.js.map +1 -1
- package/dist/api-traces/traceAPI.cjs.map +1 -1
- package/dist/api-traces/traceAPI.js.map +1 -1
- package/dist/api-users/api/UserAPI/UserAPI.cjs.map +1 -1
- package/dist/api-users/api/UserAPI/UserAPI.js.map +1 -1
- package/dist/api-users/manager/NoOpUserManager/NoOpUserManager.cjs.map +1 -1
- package/dist/api-users/manager/NoOpUserManager/NoOpUserManager.js.map +1 -1
- package/dist/api-users/manager/ProxyUserManager/ProxyUserManager.cjs.map +1 -1
- package/dist/api-users/manager/ProxyUserManager/ProxyUserManager.js.map +1 -1
- package/dist/api-users/userAPI.cjs.map +1 -1
- package/dist/api-users/userAPI.js.map +1 -1
- package/dist/common/attributes.cjs.map +1 -1
- package/dist/common/attributes.js.map +1 -1
- package/dist/exporters/MXLLogExporter/MXLLogExporter.cjs.map +1 -1
- package/dist/exporters/MXLLogExporter/MXLLogExporter.js.map +1 -1
- package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.cjs.map +1 -1
- package/dist/exporters/MXLLogExporter/OTLPFetchLogExporter.js.map +1 -1
- package/dist/exporters/MXLLogExporter/utils.cjs.map +1 -1
- package/dist/exporters/MXLLogExporter/utils.js.map +1 -1
- package/dist/exporters/MXLTraceExporter/MXLTraceExporter.cjs.map +1 -1
- package/dist/exporters/MXLTraceExporter/MXLTraceExporter.js.map +1 -1
- package/dist/exporters/MXLTraceExporter/OTLPFetchTraceExporter.cjs.map +1 -1
- package/dist/exporters/MXLTraceExporter/OTLPFetchTraceExporter.js.map +1 -1
- package/dist/exporters/MXLTraceExporter/utils.cjs.map +1 -1
- package/dist/exporters/MXLTraceExporter/utils.js.map +1 -1
- package/dist/exporters/otlpBrowserFetchExportDelegate.cjs.map +1 -1
- package/dist/exporters/otlpBrowserFetchExportDelegate.d.cts.map +1 -1
- package/dist/exporters/otlpBrowserFetchExportDelegate.d.ts.map +1 -1
- package/dist/exporters/otlpBrowserFetchExportDelegate.js.map +1 -1
- package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.cjs.map +1 -1
- package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.js.map +1 -1
- package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.js.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.cts.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.ts.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs.map +1 -1
- package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js.map +1 -1
- package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.js.map +1 -1
- package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.js.map +1 -1
- package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.js.map +1 -1
- package/dist/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.cjs.map +1 -1
- package/dist/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.js.map +1 -1
- package/dist/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.js.map +1 -1
- package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/instance.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/instance.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.d.cts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.d.ts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.js.map +1 -1
- package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.js.map +1 -1
- package/dist/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.js.map +1 -1
- package/dist/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.js.map +1 -1
- package/dist/instrumentations/session/SpanSessionTimeoutInstrumentation/SpanSessionTimeoutInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/session/SpanSessionTimeoutInstrumentation/SpanSessionTimeoutInstrumentation.js.map +1 -1
- package/dist/instrumentations/session/SpanSessionVisibilityInstrumentation/SpanSessionVisibilityInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/session/SpanSessionVisibilityInstrumentation/SpanSessionVisibilityInstrumentation.js.map +1 -1
- package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.js.map +1 -1
- package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.cts.map +1 -1
- package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.ts.map +1 -1
- package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.js.map +1 -1
- package/dist/instrumentations/xhr/MXLXHRInstrumentation/MXLXHRInstrumentation.cjs.map +1 -1
- package/dist/instrumentations/xhr/MXLXHRInstrumentation/MXLXHRInstrumentation.js.map +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.cjs +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.cjs.map +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.cts.map +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.ts.map +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.js +1 -1
- package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.js.map +1 -1
- package/dist/managers/MXLConfigManager/constants.cjs.map +1 -1
- package/dist/managers/MXLConfigManager/constants.js.map +1 -1
- package/dist/managers/MXLConfigManager/utils.cjs.map +1 -1
- package/dist/managers/MXLConfigManager/utils.js.map +1 -1
- package/dist/managers/MXLLimitManager/MXLLimitManager.cjs.map +1 -1
- package/dist/managers/MXLLimitManager/MXLLimitManager.js.map +1 -1
- package/dist/managers/MXLLimitManager/constants.cjs.map +1 -1
- package/dist/managers/MXLLimitManager/constants.js.map +1 -1
- package/dist/managers/MXLLogManager/MXLLogManager.cjs.map +1 -1
- package/dist/managers/MXLLogManager/MXLLogManager.d.cts.map +1 -1
- package/dist/managers/MXLLogManager/MXLLogManager.d.ts.map +1 -1
- package/dist/managers/MXLLogManager/MXLLogManager.js.map +1 -1
- package/dist/managers/MXLPageManager/MXLPageManager.cjs.map +1 -1
- package/dist/managers/MXLPageManager/MXLPageManager.js.map +1 -1
- package/dist/managers/MXLSDKFeaturesManager/MXLSDKFeaturesManager.cjs.map +1 -1
- package/dist/managers/MXLSDKFeaturesManager/MXLSDKFeaturesManager.js.map +1 -1
- package/dist/managers/MXLSpanSessionManager/MXLSpanSessionManager.cjs.map +1 -1
- package/dist/managers/MXLSpanSessionManager/MXLSpanSessionManager.d.cts.map +1 -1
- package/dist/managers/MXLSpanSessionManager/MXLSpanSessionManager.d.ts.map +1 -1
- package/dist/managers/MXLSpanSessionManager/MXLSpanSessionManager.js.map +1 -1
- package/dist/managers/MXLTraceManager/MXLExtendedSpan.cjs.map +1 -1
- package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.cts.map +1 -1
- package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.ts.map +1 -1
- package/dist/managers/MXLTraceManager/MXLExtendedSpan.js.map +1 -1
- package/dist/managers/MXLTraceManager/MXLTraceManager.cjs.map +1 -1
- package/dist/managers/MXLTraceManager/MXLTraceManager.js.map +1 -1
- package/dist/managers/MXLUserManager/MXLUserManager.cjs.map +1 -1
- package/dist/managers/MXLUserManager/MXLUserManager.js.map +1 -1
- package/dist/managers/MXLUserManager/types.cjs.map +1 -1
- package/dist/managers/MXLUserManager/types.js.map +1 -1
- package/dist/mxl-web-sdk.js +24 -4
- package/dist/mxl-web-sdk.js.map +1 -1
- package/dist/packages/otlp-transformer/dist/index.cjs +26 -26
- package/dist/packages/otlp-transformer/dist/index.cjs.map +1 -1
- package/dist/packages/otlp-transformer/dist/index.d.cts +8 -0
- package/dist/packages/otlp-transformer/dist/index.d.cts.map +1 -1
- package/dist/packages/otlp-transformer/dist/index.d.ts +8 -0
- package/dist/packages/otlp-transformer/dist/index.d.ts.map +1 -1
- package/dist/packages/otlp-transformer/dist/index.js +26 -26
- package/dist/packages/otlp-transformer/dist/index.js.map +1 -1
- package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.cjs.map +1 -1
- package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.js.map +1 -1
- package/dist/processors/BrowserSpanProcessor/BrowserSpanProcessor.cjs.map +1 -1
- package/dist/processors/BrowserSpanProcessor/BrowserSpanProcessor.js.map +1 -1
- package/dist/processors/IdentifiableSessionLogRecordProcessor/IdentifiableSessionLogRecordProcessor.cjs.map +1 -1
- package/dist/processors/IdentifiableSessionLogRecordProcessor/IdentifiableSessionLogRecordProcessor.js.map +1 -1
- package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.cjs.map +1 -1
- package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.js.map +1 -1
- package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.cjs.map +1 -1
- package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.js.map +1 -1
- package/dist/processors/MXLNetworkSpanProcessor/MXLNetworkSpanProcessor.cjs.map +1 -1
- package/dist/processors/MXLNetworkSpanProcessor/MXLNetworkSpanProcessor.js.map +1 -1
- package/dist/processors/MXLSessionBatchedSpanProcessor/MXLSessionBatchedSpanProcessor.cjs.map +1 -1
- package/dist/processors/MXLSessionBatchedSpanProcessor/MXLSessionBatchedSpanProcessor.js.map +1 -1
- package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.cjs.map +1 -1
- package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.js.map +1 -1
- package/dist/processors/PageSpanProcessor/PageSpanProcessor.cjs.map +1 -1
- package/dist/processors/PageSpanProcessor/PageSpanProcessor.js.map +1 -1
- package/dist/processors/SpanScrubProcessor/SpanScrubProcessor.cjs.map +1 -1
- package/dist/processors/SpanScrubProcessor/SpanScrubProcessor.js.map +1 -1
- package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.cjs.map +1 -1
- package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.js.map +1 -1
- package/dist/processors/UserSpanProcessor/UserSpanProcessor.cjs.map +1 -1
- package/dist/processors/UserSpanProcessor/UserSpanProcessor.js.map +1 -1
- package/dist/propagators/MXLW3CTraceContextPropagator/MXLW3CTraceContextPropagator.cjs.map +1 -1
- package/dist/propagators/MXLW3CTraceContextPropagator/MXLW3CTraceContextPropagator.js.map +1 -1
- package/dist/resources/appInstanceId.cjs.map +1 -1
- package/dist/resources/appInstanceId.js.map +1 -1
- package/dist/resources/constants/index.cjs +1 -1
- package/dist/resources/constants/index.cjs.map +1 -1
- package/dist/resources/constants/index.d.cts +1 -1
- package/dist/resources/constants/index.d.ts +1 -1
- package/dist/resources/constants/index.js +1 -1
- package/dist/resources/constants/index.js.map +1 -1
- package/dist/resources/webSdkResource.cjs.map +1 -1
- package/dist/resources/webSdkResource.d.cts.map +1 -1
- package/dist/resources/webSdkResource.d.ts.map +1 -1
- package/dist/resources/webSdkResource.js.map +1 -1
- package/dist/sdk/defaultAttributeScrubbers.cjs.map +1 -1
- package/dist/sdk/defaultAttributeScrubbers.js.map +1 -1
- package/dist/sdk/initSDK.cjs +1 -1
- 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 -1
- package/dist/sdk/initSDK.js.map +1 -1
- package/dist/sdk/registry.cjs.map +1 -1
- package/dist/sdk/registry.js.map +1 -1
- package/dist/sdk/setupDefaultInstrumentations.cjs.map +1 -1
- package/dist/sdk/setupDefaultInstrumentations.js.map +1 -1
- package/dist/sdk/setupSessionRecorder.cjs.map +1 -1
- package/dist/sdk/setupSessionRecorder.js.map +1 -1
- package/dist/sdk/types.d.cts.map +1 -1
- package/dist/sdk/types.d.ts +1 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/sdk/utils.cjs.map +1 -1
- package/dist/sdk/utils.js.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.cjs.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.js.map +1 -1
- package/dist/transport/FetchTransport/createFetchTransport.cjs.map +1 -1
- package/dist/transport/FetchTransport/createFetchTransport.js.map +1 -1
- package/dist/transport/RetryingTransport/RetryingTransport.cjs.map +1 -1
- package/dist/transport/RetryingTransport/RetryingTransport.js.map +1 -1
- package/dist/transport/RetryingTransport/createRetryingTransport.cjs.map +1 -1
- package/dist/transport/RetryingTransport/createRetryingTransport.js.map +1 -1
- package/dist/utils/MXLSpanStorage/MXLSpanStorage.cjs.map +1 -1
- package/dist/utils/MXLSpanStorage/MXLSpanStorage.js.map +1 -1
- package/dist/utils/PerformanceManager/OTelPerformanceManager.cjs.map +1 -1
- package/dist/utils/PerformanceManager/OTelPerformanceManager.js.map +1 -1
- package/dist/utils/bulkAddEventListener/bulkAddEventListener.cjs.map +1 -1
- package/dist/utils/bulkAddEventListener/bulkAddEventListener.js.map +1 -1
- package/dist/utils/bulkRemoveEventListener/bulkRemoveEventListener.cjs.map +1 -1
- package/dist/utils/bulkRemoveEventListener/bulkRemoveEventListener.js.map +1 -1
- package/dist/utils/getVisibilityState.cjs.map +1 -1
- package/dist/utils/getVisibilityState.js.map +1 -1
- package/dist/utils/nsfConfigValidation.cjs.map +1 -1
- package/dist/utils/nsfConfigValidation.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MXLErrorBoundary.cjs","names":["React","log","KEY_MXL_INSTRUMENTATION"],"sources":["../../../../../src/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.ts"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport * as React from 'react';\nimport type { LogManager } from '../../../../api-logs
|
|
1
|
+
{"version":3,"file":"MXLErrorBoundary.cjs","names":["React","log","KEY_MXL_INSTRUMENTATION"],"sources":["../../../../../src/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.ts"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport * as React from 'react';\nimport type { LogManager } from '../../../../api-logs';\nimport { log } from '../../../../api-logs';\nimport {\n KEY_MXL_INSTRUMENTATION,\n MXL_ERROR_INSTRUMENTATIONS,\n} from '../../../../constants';\n\ntype MXLErrorBoundaryProps = {\n fallback: () => React.ReactNode;\n};\n\ntype MXLErrorBoundaryState = {\n hasError: boolean;\n};\n\nexport class MXLErrorBoundary<\n P extends PropsWithChildren<MXLErrorBoundaryProps>,\n> extends React.Component<P, MXLErrorBoundaryState> {\n private readonly _logManager: LogManager;\n\n public constructor(props: P) {\n super(props);\n\n this._logManager = log.getLogManager();\n this.state = {\n hasError: false,\n };\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n public override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n this._logManager.logException(error, {\n handled: false,\n attributes: {\n 'react.component_stack': errorInfo.componentStack ?? undefined,\n [KEY_MXL_INSTRUMENTATION]:\n MXL_ERROR_INSTRUMENTATIONS.ReactErrorBoundary,\n },\n });\n }\n\n public override render() {\n if (this.state.hasError) {\n return this.props.fallback();\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;;AAiBA,IAAa,mBAAb,cAEUA,MAAM,UAAoC;CAClD;CAEA,YAAmB,OAAU;AAC3B,QAAM,MAAM;AAEZ,OAAK,cAAcC,wBAAAA,IAAI,eAAe;AACtC,OAAK,QAAQ,EACX,UAAU,OACX;;CAGH,OAAc,2BAA2B;AACvC,SAAO,EAAE,UAAU,MAAM;;CAG3B,kBAAkC,OAAc,WAA4B;AAC1E,OAAK,YAAY,aAAa,OAAO;GACnC,SAAS;GACT,YAAY;IACV,yBAAyB,UAAU,kBAAkB,KAAA;KACpDC,6BAAAA,0BAAAA;IAEF;GACF,CAAC;;CAGJ,SAAyB;AACvB,MAAI,KAAK,MAAM,SACb,QAAO,KAAK,MAAM,UAAU;AAG9B,SAAO,KAAK,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MXLErrorBoundary.js","names":["React"],"sources":["../../../../../src/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.ts"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport * as React from 'react';\nimport type { LogManager } from '../../../../api-logs
|
|
1
|
+
{"version":3,"file":"MXLErrorBoundary.js","names":["React"],"sources":["../../../../../src/instrumentations/exceptions/react/MXLErrorBoundary/MXLErrorBoundary.ts"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport * as React from 'react';\nimport type { LogManager } from '../../../../api-logs';\nimport { log } from '../../../../api-logs';\nimport {\n KEY_MXL_INSTRUMENTATION,\n MXL_ERROR_INSTRUMENTATIONS,\n} from '../../../../constants';\n\ntype MXLErrorBoundaryProps = {\n fallback: () => React.ReactNode;\n};\n\ntype MXLErrorBoundaryState = {\n hasError: boolean;\n};\n\nexport class MXLErrorBoundary<\n P extends PropsWithChildren<MXLErrorBoundaryProps>,\n> extends React.Component<P, MXLErrorBoundaryState> {\n private readonly _logManager: LogManager;\n\n public constructor(props: P) {\n super(props);\n\n this._logManager = log.getLogManager();\n this.state = {\n hasError: false,\n };\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n public override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n this._logManager.logException(error, {\n handled: false,\n attributes: {\n 'react.component_stack': errorInfo.componentStack ?? undefined,\n [KEY_MXL_INSTRUMENTATION]:\n MXL_ERROR_INSTRUMENTATIONS.ReactErrorBoundary,\n },\n });\n }\n\n public override render() {\n if (this.state.hasError) {\n return this.props.fallback();\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;AAiBA,IAAa,mBAAb,cAEUA,QAAM,UAAoC;CAClD;CAEA,YAAmB,OAAU;AAC3B,QAAM,MAAM;AAEZ,OAAK,cAAc,IAAI,eAAe;AACtC,OAAK,QAAQ,EACX,UAAU,OACX;;CAGH,OAAc,2BAA2B;AACvC,SAAO,EAAE,UAAU,MAAM;;CAG3B,kBAAkC,OAAc,WAA4B;AAC1E,OAAK,YAAY,aAAa,OAAO;GACnC,SAAS;GACT,YAAY;IACV,yBAAyB,UAAU,kBAAkB,KAAA;KACpD,0BAAA;IAEF;GACF,CAAC;;CAGJ,SAAyB;AACvB,MAAI,KAAK,MAAM,SACb,QAAO,KAAK,MAAM,UAAU;AAG9B,SAAO,KAAK,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MXLFetchInstrumentation.cjs","names":["FetchInstrumentation"],"sources":["../../../../src/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/instrumentation';\n\nimport { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';\nimport type { MXLFetchInstrumentationArgs } from './types
|
|
1
|
+
{"version":3,"file":"MXLFetchInstrumentation.cjs","names":["FetchInstrumentation"],"sources":["../../../../src/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/instrumentation';\n\nimport { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';\nimport type { MXLFetchInstrumentationArgs } from './types';\n\nexport class MXLFetchInstrumentation extends FetchInstrumentation {\n private readonly _omitIfAlreadyPatched?: boolean;\n\n public constructor({\n omitIfAlreadyPatched,\n ...rest\n }: MXLFetchInstrumentationArgs = {}) {\n // Base constructor automatically calls this.enable() if enabled is true, but we need to run our overridden constructor\n // first so force enabled false here and call it ourselves later\n super({ ...rest, enabled: false });\n\n this._omitIfAlreadyPatched = omitIfAlreadyPatched;\n\n if (rest.enabled) {\n this.enable();\n }\n }\n\n public override enable(): void {\n // The base implementation always removes and then re-patches, this means the last instrumentation to run \"wins\":\n // https://github.com/open-telemetry/opentelemetry-js/blob/2d7eecbb19aec17bf2d8b9a4e4b2d84dc92c2d88/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L604\n // Exposing an option in this class to allow leaving the existing patch in place and letting a previous instrumentation\n // control the global\n if (this._omitIfAlreadyPatched && isWrapped(fetch)) {\n this._diag.debug(\n 'fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation',\n );\n return;\n }\n\n super.enable();\n }\n}\n"],"mappings":";;;;;AAKA,IAAa,0BAAb,cAA6CA,qCAAAA,qBAAqB;CAChE;CAEA,YAAmB,EACjB,sBACA,GAAG,SAC4B,EAAE,EAAE;AAGnC,QAAM;GAAE,GAAG;GAAM,SAAS;GAAO,CAAC;AAElC,OAAK,wBAAwB;AAE7B,MAAI,KAAK,QACP,MAAK,QAAQ;;CAIjB,SAA+B;AAK7B,MAAI,KAAK,0BAAA,GAAA,+BAAA,WAAmC,MAAM,EAAE;AAClD,QAAK,MAAM,MACT,qGACD;AACD;;AAGF,QAAM,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MXLFetchInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/instrumentation';\n\nimport { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';\nimport type { MXLFetchInstrumentationArgs } from './types
|
|
1
|
+
{"version":3,"file":"MXLFetchInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/fetch/MXLFetchInstrumentation/MXLFetchInstrumentation.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/instrumentation';\n\nimport { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';\nimport type { MXLFetchInstrumentationArgs } from './types';\n\nexport class MXLFetchInstrumentation extends FetchInstrumentation {\n private readonly _omitIfAlreadyPatched?: boolean;\n\n public constructor({\n omitIfAlreadyPatched,\n ...rest\n }: MXLFetchInstrumentationArgs = {}) {\n // Base constructor automatically calls this.enable() if enabled is true, but we need to run our overridden constructor\n // first so force enabled false here and call it ourselves later\n super({ ...rest, enabled: false });\n\n this._omitIfAlreadyPatched = omitIfAlreadyPatched;\n\n if (rest.enabled) {\n this.enable();\n }\n }\n\n public override enable(): void {\n // The base implementation always removes and then re-patches, this means the last instrumentation to run \"wins\":\n // https://github.com/open-telemetry/opentelemetry-js/blob/2d7eecbb19aec17bf2d8b9a4e4b2d84dc92c2d88/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L604\n // Exposing an option in this class to allow leaving the existing patch in place and letting a previous instrumentation\n // control the global\n if (this._omitIfAlreadyPatched && isWrapped(fetch)) {\n this._diag.debug(\n 'fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation',\n );\n return;\n }\n\n super.enable();\n }\n}\n"],"mappings":";;;AAKA,IAAa,0BAAb,cAA6C,qBAAqB;CAChE;CAEA,YAAmB,EACjB,sBACA,GAAG,SAC4B,EAAE,EAAE;AAGnC,QAAM;GAAE,GAAG;GAAM,SAAS;GAAO,CAAC;AAElC,OAAK,wBAAwB;AAE7B,MAAI,KAAK,QACP,MAAK,QAAQ;;CAIjB,SAA+B;AAK7B,MAAI,KAAK,yBAAyB,UAAU,MAAM,EAAE;AAClD,QAAK,MAAM,MACT,qGACD;AACD;;AAGF,QAAM,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoafInstrumentation.cjs","names":["MXLInstrumentationBase","isEntryTypeSupported","createPerformanceObserver","MAX_SCRIPT_URL_LENGTH","KEY_MXL_TYPE","generateWebVitalID","ATTR_TBD_LOAF_TOTAL_DURATION","ATTR_TBD_LOAF_WORK_DURATION","ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION","ATTR_TBD_LOAF_COUNT","ATTR_TBD_LOAF_LONGEST_DURATION","ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST","LOAF_EVENT_NAME","SeverityNumber","LOAF_SCRIPTS_EVENT_NAME"],"sources":["../../../../src/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.ts"],"sourcesContent":["/* eslint-disable baseline-js/use-baseline */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { Metric } from 'web-vitals';\nimport type { SpanSessionManager } from '../../../api-sessions/index.ts';\nimport { MXL_TYPES, KEY_MXL_TYPE } from '../../../constants/index.ts';\nimport { generateWebVitalID } from '../../../utils/generateWebVitalID.ts';\nimport {\n createPerformanceObserver,\n isEntryTypeSupported,\n} from '../../../utils/index.ts';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase/index.ts';\nimport {\n ATTR_TBD_LOAF_COUNT,\n ATTR_TBD_LOAF_LONGEST_DURATION,\n ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST,\n ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION,\n ATTR_TBD_LOAF_TOTAL_DURATION,\n ATTR_TBD_LOAF_WORK_DURATION,\n BLOCKING_DURATION_GOOD_THRESHOLD,\n BLOCKING_DURATION_POOR_THRESHOLD,\n LOAF_EVENT_NAME,\n LOAF_SCRIPTS_EVENT_NAME,\n MAX_SCRIPT_ENTRIES,\n MAX_SCRIPT_URL_LENGTH,\n} from './constants.ts';\nimport type { LoafInstrumentationArgs } from './types.ts';\n\ntype ScriptSummaryValue = {\n totalDuration: number;\n styleAndLayoutDuration: number;\n count: number;\n};\n\ntype ScriptSummaries = Map<string, ScriptSummaryValue>;\n\nexport class LoafInstrumentation extends MXLInstrumentationBase {\n private _observer: PerformanceObserver | null = null;\n private _isFirstEntry = true;\n private _removeSessionEndListener: (() => void) | null = null;\n private _isEnabled = false;\n\n private _totalDuration = 0;\n private _workDuration = 0;\n private _styleLayoutDuration = 0;\n private _count = 0;\n private _longestDuration = 0;\n private _longestDurationExcludingFirst = 0;\n private _totalBlockingDuration = 0;\n private _scriptSummaries: ScriptSummaries = new Map();\n\n public constructor({ diag, perf }: LoafInstrumentationArgs = {}) {\n super({\n instrumentationName: 'LoafInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n config: {},\n });\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n if (this._isEnabled) {\n return;\n }\n\n if (!isEntryTypeSupported('long-animation-frame')) {\n this._diag.debug('long-animation-frame not supported, skipping');\n return;\n }\n\n this._isEnabled = true;\n\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer =\n createPerformanceObserver<PerformanceLongAnimationFrameTiming>(\n 'long-animation-frame',\n (entry) => this._processEntry(entry),\n { diag: this._diag },\n );\n\n if (!this._observer) {\n this._isEnabled = false;\n this._diag.error('failed to enable');\n return;\n }\n\n this._registerSessionEndListener();\n }\n\n private _registerSessionEndListener(): void {\n if (!this._isEnabled) {\n return;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n }\n\n this._removeSessionEndListener =\n this.sessionManager.addSessionEndedListener(() => {\n try {\n this._flushReport();\n } catch (e) {\n this._diag.error('error flushing report', e);\n }\n });\n }\n\n public override setSessionManager(sessionManager: SpanSessionManager): void {\n super.setSessionManager(sessionManager);\n this._registerSessionEndListener();\n }\n\n public disable(): void {\n this._isEnabled = false;\n this._resetAccumulators();\n\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n this._removeSessionEndListener = null;\n }\n }\n\n private _processEntry(entry: PerformanceLongAnimationFrameTiming): void {\n if (!this._isEnabled) {\n return;\n }\n\n this._count++;\n this._totalDuration += entry.duration;\n this._workDuration += entry.renderStart\n ? entry.renderStart - entry.startTime\n : entry.duration;\n\n if (entry.styleAndLayoutStart) {\n this._styleLayoutDuration += Math.max(\n 0,\n entry.startTime + entry.duration - entry.styleAndLayoutStart,\n );\n }\n\n this._longestDuration = Math.max(this._longestDuration, entry.duration);\n\n if (this._isFirstEntry && this._count === 1) {\n this._isFirstEntry = false;\n } else {\n this._longestDurationExcludingFirst = Math.max(\n this._longestDurationExcludingFirst,\n entry.duration,\n );\n if (entry.firstUIEventTimestamp === 0) {\n this._totalBlockingDuration += entry.blockingDuration;\n }\n }\n\n try {\n for (const script of entry.scripts) {\n // sourceURL is an empty string for inline scripts\n let url = script.sourceURL || '(inline)';\n if (url.length > MAX_SCRIPT_URL_LENGTH) {\n url = `${url.substring(0, MAX_SCRIPT_URL_LENGTH)}...`;\n }\n\n const existing = this._scriptSummaries.get(url);\n if (existing) {\n existing.totalDuration += script.duration;\n existing.styleAndLayoutDuration +=\n script.forcedStyleAndLayoutDuration;\n existing.count++;\n } else {\n this._scriptSummaries.set(url, {\n totalDuration: script.duration,\n styleAndLayoutDuration: script.forcedStyleAndLayoutDuration,\n count: 1,\n });\n }\n }\n } catch (e) {\n this._diag.error('error processing scripts for entry', e);\n }\n }\n\n private _flushReport(): void {\n if (this._count === 0) {\n return;\n }\n\n // use web-vitals Metric type for rating\n let rating: Metric['rating'];\n if (this._totalBlockingDuration <= BLOCKING_DURATION_GOOD_THRESHOLD) {\n rating = 'good';\n } else if (\n this._totalBlockingDuration <= BLOCKING_DURATION_POOR_THRESHOLD\n ) {\n rating = 'needs-improvement';\n } else {\n rating = 'poor';\n }\n\n const attrs: Record<string, string | number> = {\n [KEY_MXL_TYPE]: MXL_TYPES.WebVital,\n ['mxl.web_vital.id']: generateWebVitalID(),\n ['mxl.web_vital.name']: 'TBD',\n ['mxl.web_vital.value']: Math.round(this._totalBlockingDuration),\n ['mxl.web_vital.rating']: rating,\n [ATTR_TBD_LOAF_TOTAL_DURATION]: Math.round(this._totalDuration),\n [ATTR_TBD_LOAF_WORK_DURATION]: Math.round(this._workDuration),\n [ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION]: Math.round(\n this._styleLayoutDuration,\n ),\n [ATTR_TBD_LOAF_COUNT]: this._count,\n [ATTR_TBD_LOAF_LONGEST_DURATION]: Math.round(this._longestDuration),\n [ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST]: Math.round(\n this._longestDurationExcludingFirst,\n ),\n };\n\n try {\n this.logger.emit({\n eventName: LOAF_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: attrs,\n });\n } catch (e) {\n this._diag.error('error emitting loaf report', e);\n }\n\n try {\n if (this._scriptSummaries.size > 0) {\n const scripts = [...this._scriptSummaries]\n .sort((a, b) => b[1].totalDuration - a[1].totalDuration)\n .slice(0, MAX_SCRIPT_ENTRIES)\n .map(([url, script]) => [\n url,\n {\n total_duration: Math.round(script.totalDuration),\n style_and_layout_duration: Math.round(\n script.styleAndLayoutDuration,\n ),\n count: script.count,\n },\n ]);\n\n this.logger.emit({\n eventName: LOAF_SCRIPTS_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n body: JSON.stringify(Object.fromEntries(scripts)),\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.LoafScripts,\n },\n });\n }\n } catch (e) {\n this._diag.error('error emitting loaf script summary', e);\n }\n\n this._resetAccumulators();\n }\n\n private _resetAccumulators(): void {\n this._totalDuration = 0;\n this._workDuration = 0;\n this._styleLayoutDuration = 0;\n this._count = 0;\n this._longestDuration = 0;\n this._longestDurationExcludingFirst = 0;\n this._totalBlockingDuration = 0;\n this._scriptSummaries = new Map();\n }\n}\n"],"mappings":";;;;;;;;;AAmCA,IAAa,sBAAb,cAAyCA,uEAAAA,uBAAuB;CAC9D,YAAgD;CAChD,gBAAwB;CACxB,4BAAyD;CACzD,aAAqB;CAErB,iBAAyB;CACzB,gBAAwB;CACxB,uBAA+B;CAC/B,SAAiB;CACjB,mBAA2B;CAC3B,iCAAyC;CACzC,yBAAiC;CACjC,mCAA4C,IAAI,KAAK;CAErD,YAAmB,EAAE,MAAM,SAAkC,EAAE,EAAE;AAC/D,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,SAAsB;AACpB,MAAI,KAAK,WACP;AAGF,MAAI,CAACC,sDAAAA,qBAAqB,uBAAuB,EAAE;AACjD,QAAK,MAAM,MAAM,+CAA+C;AAChE;;AAGF,OAAK,aAAa;AAElB,MAAI,KAAK,UACP,MAAK,UAAU,YAAY;AAG7B,OAAK,YACHC,sDAAAA,0BACE,yBACC,UAAU,KAAK,cAAc,MAAM,EACpC,EAAE,MAAM,KAAK,OAAO,CACrB;AAEH,MAAI,CAAC,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;KAChD,2BAA2B,KAAK,MAC9B,OAAO,uBACR;KACD,OAAO,OAAO;KACf,CACF,CAAC;AAEJ,SAAK,OAAO,KAAK;KACf,WAAWC,4DAAAA;KACX,gBAAgBD,wBAAAA,eAAe;KAC/B,MAAM,KAAK,UAAU,OAAO,YAAY,QAAQ,CAAC;KACjD,YAAY,GACTT,6BAAAA,eAAAA,mBACF;KACF,CAAC;;WAEG,GAAG;AACV,QAAK,MAAM,MAAM,sCAAsC,EAAE;;AAG3D,OAAK,oBAAoB;;CAG3B,qBAAmC;AACjC,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;AACrB,OAAK,uBAAuB;AAC5B,OAAK,SAAS;AACd,OAAK,mBAAmB;AACxB,OAAK,iCAAiC;AACtC,OAAK,yBAAyB;AAC9B,OAAK,mCAAmB,IAAI,KAAK"}
|
|
1
|
+
{"version":3,"file":"LoafInstrumentation.cjs","names":["MXLInstrumentationBase","isEntryTypeSupported","createPerformanceObserver","MAX_SCRIPT_URL_LENGTH","KEY_MXL_TYPE","generateWebVitalID","ATTR_TBD_LOAF_TOTAL_DURATION","ATTR_TBD_LOAF_WORK_DURATION","ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION","ATTR_TBD_LOAF_COUNT","ATTR_TBD_LOAF_LONGEST_DURATION","ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST","LOAF_EVENT_NAME","SeverityNumber","LOAF_SCRIPTS_EVENT_NAME"],"sources":["../../../../src/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.ts"],"sourcesContent":["/* eslint-disable baseline-js/use-baseline */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { Metric } from 'web-vitals';\nimport type { SpanSessionManager } from '../../../api-sessions';\nimport { KEY_MXL_TYPE, MXL_TYPES } from '../../../constants';\nimport {\n createPerformanceObserver,\n isEntryTypeSupported,\n} from '../../../utils';\nimport { generateWebVitalID } from '../../../utils/generateWebVitalID';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n ATTR_TBD_LOAF_COUNT,\n ATTR_TBD_LOAF_LONGEST_DURATION,\n ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST,\n ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION,\n ATTR_TBD_LOAF_TOTAL_DURATION,\n ATTR_TBD_LOAF_WORK_DURATION,\n BLOCKING_DURATION_GOOD_THRESHOLD,\n BLOCKING_DURATION_POOR_THRESHOLD,\n LOAF_EVENT_NAME,\n LOAF_SCRIPTS_EVENT_NAME,\n MAX_SCRIPT_ENTRIES,\n MAX_SCRIPT_URL_LENGTH,\n} from './constants';\nimport type { LoafInstrumentationArgs } from './types';\n\ntype ScriptSummaryValue = {\n totalDuration: number;\n styleAndLayoutDuration: number;\n count: number;\n};\n\ntype ScriptSummaries = Map<string, ScriptSummaryValue>;\n\nexport class LoafInstrumentation extends MXLInstrumentationBase {\n private _observer: PerformanceObserver | null = null;\n private _isFirstEntry = true;\n private _removeSessionEndListener: (() => void) | null = null;\n private _isEnabled = false;\n\n private _totalDuration = 0;\n private _workDuration = 0;\n private _styleLayoutDuration = 0;\n private _count = 0;\n private _longestDuration = 0;\n private _longestDurationExcludingFirst = 0;\n private _totalBlockingDuration = 0;\n private _scriptSummaries: ScriptSummaries = new Map();\n\n public constructor({ diag, perf }: LoafInstrumentationArgs = {}) {\n super({\n instrumentationName: 'LoafInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n config: {},\n });\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n if (this._isEnabled) {\n return;\n }\n\n if (!isEntryTypeSupported('long-animation-frame')) {\n this._diag.debug('long-animation-frame not supported, skipping');\n return;\n }\n\n this._isEnabled = true;\n\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer =\n createPerformanceObserver<PerformanceLongAnimationFrameTiming>(\n 'long-animation-frame',\n (entry) => this._processEntry(entry),\n { diag: this._diag },\n );\n\n if (!this._observer) {\n this._isEnabled = false;\n this._diag.error('failed to enable');\n return;\n }\n\n this._registerSessionEndListener();\n }\n\n private _registerSessionEndListener(): void {\n if (!this._isEnabled) {\n return;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n }\n\n this._removeSessionEndListener =\n this.sessionManager.addSessionEndedListener(() => {\n try {\n this._flushReport();\n } catch (e) {\n this._diag.error('error flushing report', e);\n }\n });\n }\n\n public override setSessionManager(sessionManager: SpanSessionManager): void {\n super.setSessionManager(sessionManager);\n this._registerSessionEndListener();\n }\n\n public disable(): void {\n this._isEnabled = false;\n this._resetAccumulators();\n\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n this._removeSessionEndListener = null;\n }\n }\n\n private _processEntry(entry: PerformanceLongAnimationFrameTiming): void {\n if (!this._isEnabled) {\n return;\n }\n\n this._count++;\n this._totalDuration += entry.duration;\n this._workDuration += entry.renderStart\n ? entry.renderStart - entry.startTime\n : entry.duration;\n\n if (entry.styleAndLayoutStart) {\n this._styleLayoutDuration += Math.max(\n 0,\n entry.startTime + entry.duration - entry.styleAndLayoutStart,\n );\n }\n\n this._longestDuration = Math.max(this._longestDuration, entry.duration);\n\n if (this._isFirstEntry && this._count === 1) {\n this._isFirstEntry = false;\n } else {\n this._longestDurationExcludingFirst = Math.max(\n this._longestDurationExcludingFirst,\n entry.duration,\n );\n if (entry.firstUIEventTimestamp === 0) {\n this._totalBlockingDuration += entry.blockingDuration;\n }\n }\n\n try {\n for (const script of entry.scripts) {\n // sourceURL is an empty string for inline scripts\n let url = script.sourceURL || '(inline)';\n if (url.length > MAX_SCRIPT_URL_LENGTH) {\n url = `${url.substring(0, MAX_SCRIPT_URL_LENGTH)}...`;\n }\n\n const existing = this._scriptSummaries.get(url);\n if (existing) {\n existing.totalDuration += script.duration;\n existing.styleAndLayoutDuration +=\n script.forcedStyleAndLayoutDuration;\n existing.count++;\n } else {\n this._scriptSummaries.set(url, {\n totalDuration: script.duration,\n styleAndLayoutDuration: script.forcedStyleAndLayoutDuration,\n count: 1,\n });\n }\n }\n } catch (e) {\n this._diag.error('error processing scripts for entry', e);\n }\n }\n\n private _flushReport(): void {\n if (this._count === 0) {\n return;\n }\n\n // use web-vitals Metric type for rating\n let rating: Metric['rating'];\n if (this._totalBlockingDuration <= BLOCKING_DURATION_GOOD_THRESHOLD) {\n rating = 'good';\n } else if (\n this._totalBlockingDuration <= BLOCKING_DURATION_POOR_THRESHOLD\n ) {\n rating = 'needs-improvement';\n } else {\n rating = 'poor';\n }\n\n const attrs: Record<string, string | number> = {\n [KEY_MXL_TYPE]: MXL_TYPES.WebVital,\n ['mxl.web_vital.id']: generateWebVitalID(),\n ['mxl.web_vital.name']: 'TBD',\n ['mxl.web_vital.value']: Math.round(this._totalBlockingDuration),\n ['mxl.web_vital.rating']: rating,\n [ATTR_TBD_LOAF_TOTAL_DURATION]: Math.round(this._totalDuration),\n [ATTR_TBD_LOAF_WORK_DURATION]: Math.round(this._workDuration),\n [ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION]: Math.round(\n this._styleLayoutDuration,\n ),\n [ATTR_TBD_LOAF_COUNT]: this._count,\n [ATTR_TBD_LOAF_LONGEST_DURATION]: Math.round(this._longestDuration),\n [ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST]: Math.round(\n this._longestDurationExcludingFirst,\n ),\n };\n\n try {\n this.logger.emit({\n eventName: LOAF_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: attrs,\n });\n } catch (e) {\n this._diag.error('error emitting loaf report', e);\n }\n\n try {\n if (this._scriptSummaries.size > 0) {\n const scripts = [...this._scriptSummaries]\n .sort((a, b) => b[1].totalDuration - a[1].totalDuration)\n .slice(0, MAX_SCRIPT_ENTRIES)\n .map(([url, script]) => [\n url,\n {\n total_duration: Math.round(script.totalDuration),\n style_and_layout_duration: Math.round(\n script.styleAndLayoutDuration,\n ),\n count: script.count,\n },\n ]);\n\n this.logger.emit({\n eventName: LOAF_SCRIPTS_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n body: JSON.stringify(Object.fromEntries(scripts)),\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.LoafScripts,\n },\n });\n }\n } catch (e) {\n this._diag.error('error emitting loaf script summary', e);\n }\n\n this._resetAccumulators();\n }\n\n private _resetAccumulators(): void {\n this._totalDuration = 0;\n this._workDuration = 0;\n this._styleLayoutDuration = 0;\n this._count = 0;\n this._longestDuration = 0;\n this._longestDurationExcludingFirst = 0;\n this._totalBlockingDuration = 0;\n this._scriptSummaries = new Map();\n }\n}\n"],"mappings":";;;;;;;;;AAmCA,IAAa,sBAAb,cAAyCA,uEAAAA,uBAAuB;CAC9D,YAAgD;CAChD,gBAAwB;CACxB,4BAAyD;CACzD,aAAqB;CAErB,iBAAyB;CACzB,gBAAwB;CACxB,uBAA+B;CAC/B,SAAiB;CACjB,mBAA2B;CAC3B,iCAAyC;CACzC,yBAAiC;CACjC,mCAA4C,IAAI,KAAK;CAErD,YAAmB,EAAE,MAAM,SAAkC,EAAE,EAAE;AAC/D,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,SAAsB;AACpB,MAAI,KAAK,WACP;AAGF,MAAI,CAACC,sDAAAA,qBAAqB,uBAAuB,EAAE;AACjD,QAAK,MAAM,MAAM,+CAA+C;AAChE;;AAGF,OAAK,aAAa;AAElB,MAAI,KAAK,UACP,MAAK,UAAU,YAAY;AAG7B,OAAK,YACHC,sDAAAA,0BACE,yBACC,UAAU,KAAK,cAAc,MAAM,EACpC,EAAE,MAAM,KAAK,OAAO,CACrB;AAEH,MAAI,CAAC,KAAK,WAAW;AACnB,QAAK,aAAa;AAClB,QAAK,MAAM,MAAM,mBAAmB;AACpC;;AAGF,OAAK,6BAA6B;;CAGpC,8BAA4C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AWC,4DAAAA;KACX,gBAAgBD,wBAAAA,eAAe;KAC/B,MAAM,KAAK,UAAU,OAAO,YAAY,QAAQ,CAAC;KACjD,YAAY,GACTT,6BAAAA,eAAAA,mBACF;KACF,CAAC;;WAEG,GAAG;AACV,QAAK,MAAM,MAAM,sCAAsC,EAAE;;AAG3D,OAAK,oBAAoB;;CAG3B,qBAAmC;AACjC,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;AACrB,OAAK,uBAAuB;AAC5B,OAAK,SAAS;AACd,OAAK,mBAAmB;AACxB,OAAK,iCAAiC;AACtC,OAAK,yBAAyB;AAC9B,OAAK,mCAAmB,IAAI,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoafInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.ts"],"sourcesContent":["/* eslint-disable baseline-js/use-baseline */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { Metric } from 'web-vitals';\nimport type { SpanSessionManager } from '../../../api-sessions/index.ts';\nimport { MXL_TYPES, KEY_MXL_TYPE } from '../../../constants/index.ts';\nimport { generateWebVitalID } from '../../../utils/generateWebVitalID.ts';\nimport {\n createPerformanceObserver,\n isEntryTypeSupported,\n} from '../../../utils/index.ts';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase/index.ts';\nimport {\n ATTR_TBD_LOAF_COUNT,\n ATTR_TBD_LOAF_LONGEST_DURATION,\n ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST,\n ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION,\n ATTR_TBD_LOAF_TOTAL_DURATION,\n ATTR_TBD_LOAF_WORK_DURATION,\n BLOCKING_DURATION_GOOD_THRESHOLD,\n BLOCKING_DURATION_POOR_THRESHOLD,\n LOAF_EVENT_NAME,\n LOAF_SCRIPTS_EVENT_NAME,\n MAX_SCRIPT_ENTRIES,\n MAX_SCRIPT_URL_LENGTH,\n} from './constants.ts';\nimport type { LoafInstrumentationArgs } from './types.ts';\n\ntype ScriptSummaryValue = {\n totalDuration: number;\n styleAndLayoutDuration: number;\n count: number;\n};\n\ntype ScriptSummaries = Map<string, ScriptSummaryValue>;\n\nexport class LoafInstrumentation extends MXLInstrumentationBase {\n private _observer: PerformanceObserver | null = null;\n private _isFirstEntry = true;\n private _removeSessionEndListener: (() => void) | null = null;\n private _isEnabled = false;\n\n private _totalDuration = 0;\n private _workDuration = 0;\n private _styleLayoutDuration = 0;\n private _count = 0;\n private _longestDuration = 0;\n private _longestDurationExcludingFirst = 0;\n private _totalBlockingDuration = 0;\n private _scriptSummaries: ScriptSummaries = new Map();\n\n public constructor({ diag, perf }: LoafInstrumentationArgs = {}) {\n super({\n instrumentationName: 'LoafInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n config: {},\n });\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n if (this._isEnabled) {\n return;\n }\n\n if (!isEntryTypeSupported('long-animation-frame')) {\n this._diag.debug('long-animation-frame not supported, skipping');\n return;\n }\n\n this._isEnabled = true;\n\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer =\n createPerformanceObserver<PerformanceLongAnimationFrameTiming>(\n 'long-animation-frame',\n (entry) => this._processEntry(entry),\n { diag: this._diag },\n );\n\n if (!this._observer) {\n this._isEnabled = false;\n this._diag.error('failed to enable');\n return;\n }\n\n this._registerSessionEndListener();\n }\n\n private _registerSessionEndListener(): void {\n if (!this._isEnabled) {\n return;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n }\n\n this._removeSessionEndListener =\n this.sessionManager.addSessionEndedListener(() => {\n try {\n this._flushReport();\n } catch (e) {\n this._diag.error('error flushing report', e);\n }\n });\n }\n\n public override setSessionManager(sessionManager: SpanSessionManager): void {\n super.setSessionManager(sessionManager);\n this._registerSessionEndListener();\n }\n\n public disable(): void {\n this._isEnabled = false;\n this._resetAccumulators();\n\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n this._removeSessionEndListener = null;\n }\n }\n\n private _processEntry(entry: PerformanceLongAnimationFrameTiming): void {\n if (!this._isEnabled) {\n return;\n }\n\n this._count++;\n this._totalDuration += entry.duration;\n this._workDuration += entry.renderStart\n ? entry.renderStart - entry.startTime\n : entry.duration;\n\n if (entry.styleAndLayoutStart) {\n this._styleLayoutDuration += Math.max(\n 0,\n entry.startTime + entry.duration - entry.styleAndLayoutStart,\n );\n }\n\n this._longestDuration = Math.max(this._longestDuration, entry.duration);\n\n if (this._isFirstEntry && this._count === 1) {\n this._isFirstEntry = false;\n } else {\n this._longestDurationExcludingFirst = Math.max(\n this._longestDurationExcludingFirst,\n entry.duration,\n );\n if (entry.firstUIEventTimestamp === 0) {\n this._totalBlockingDuration += entry.blockingDuration;\n }\n }\n\n try {\n for (const script of entry.scripts) {\n // sourceURL is an empty string for inline scripts\n let url = script.sourceURL || '(inline)';\n if (url.length > MAX_SCRIPT_URL_LENGTH) {\n url = `${url.substring(0, MAX_SCRIPT_URL_LENGTH)}...`;\n }\n\n const existing = this._scriptSummaries.get(url);\n if (existing) {\n existing.totalDuration += script.duration;\n existing.styleAndLayoutDuration +=\n script.forcedStyleAndLayoutDuration;\n existing.count++;\n } else {\n this._scriptSummaries.set(url, {\n totalDuration: script.duration,\n styleAndLayoutDuration: script.forcedStyleAndLayoutDuration,\n count: 1,\n });\n }\n }\n } catch (e) {\n this._diag.error('error processing scripts for entry', e);\n }\n }\n\n private _flushReport(): void {\n if (this._count === 0) {\n return;\n }\n\n // use web-vitals Metric type for rating\n let rating: Metric['rating'];\n if (this._totalBlockingDuration <= BLOCKING_DURATION_GOOD_THRESHOLD) {\n rating = 'good';\n } else if (\n this._totalBlockingDuration <= BLOCKING_DURATION_POOR_THRESHOLD\n ) {\n rating = 'needs-improvement';\n } else {\n rating = 'poor';\n }\n\n const attrs: Record<string, string | number> = {\n [KEY_MXL_TYPE]: MXL_TYPES.WebVital,\n ['mxl.web_vital.id']: generateWebVitalID(),\n ['mxl.web_vital.name']: 'TBD',\n ['mxl.web_vital.value']: Math.round(this._totalBlockingDuration),\n ['mxl.web_vital.rating']: rating,\n [ATTR_TBD_LOAF_TOTAL_DURATION]: Math.round(this._totalDuration),\n [ATTR_TBD_LOAF_WORK_DURATION]: Math.round(this._workDuration),\n [ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION]: Math.round(\n this._styleLayoutDuration,\n ),\n [ATTR_TBD_LOAF_COUNT]: this._count,\n [ATTR_TBD_LOAF_LONGEST_DURATION]: Math.round(this._longestDuration),\n [ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST]: Math.round(\n this._longestDurationExcludingFirst,\n ),\n };\n\n try {\n this.logger.emit({\n eventName: LOAF_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: attrs,\n });\n } catch (e) {\n this._diag.error('error emitting loaf report', e);\n }\n\n try {\n if (this._scriptSummaries.size > 0) {\n const scripts = [...this._scriptSummaries]\n .sort((a, b) => b[1].totalDuration - a[1].totalDuration)\n .slice(0, MAX_SCRIPT_ENTRIES)\n .map(([url, script]) => [\n url,\n {\n total_duration: Math.round(script.totalDuration),\n style_and_layout_duration: Math.round(\n script.styleAndLayoutDuration,\n ),\n count: script.count,\n },\n ]);\n\n this.logger.emit({\n eventName: LOAF_SCRIPTS_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n body: JSON.stringify(Object.fromEntries(scripts)),\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.LoafScripts,\n },\n });\n }\n } catch (e) {\n this._diag.error('error emitting loaf script summary', e);\n }\n\n this._resetAccumulators();\n }\n\n private _resetAccumulators(): void {\n this._totalDuration = 0;\n this._workDuration = 0;\n this._styleLayoutDuration = 0;\n this._count = 0;\n this._longestDuration = 0;\n this._longestDurationExcludingFirst = 0;\n this._totalBlockingDuration = 0;\n this._scriptSummaries = new Map();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,KAAK,eAAe;IAC9D,8BAA8B,KAAK,MAAM,KAAK,cAAc;IAC5D,0CAA0C,KAAK,MAC9C,KAAK,qBACN;IACA,sBAAsB,KAAK;IAC3B,iCAAiC,KAAK,MAAM,KAAK,iBAAiB;IAClE,iDAAiD,KAAK,MACrD,KAAK,+BACN;GACF;AAED,MAAI;AACF,QAAK,OAAO,KAAK;IACf,WAAW;IACX,gBAAgB,eAAe;IAC/B,YAAY;IACb,CAAC;WACK,GAAG;AACV,QAAK,MAAM,MAAM,8BAA8B,EAAE;;AAGnD,MAAI;AACF,OAAI,KAAK,iBAAiB,OAAO,GAAG;IAClC,MAAM,UAAU,CAAC,GAAG,KAAK,iBAAiB,CACvC,MAAM,GAAG,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,cAAc,CACvD,MAAM,GAAA,IAAsB,CAC5B,KAAK,CAAC,KAAK,YAAY,CACtB,KACA;KACE,gBAAgB,KAAK,MAAM,OAAO,cAAc;KAChD,2BAA2B,KAAK,MAC9B,OAAO,uBACR;KACD,OAAO,OAAO;KACf,CACF,CAAC;AAEJ,SAAK,OAAO,KAAK;KACf,WAAW;KACX,gBAAgB,eAAe;KAC/B,MAAM,KAAK,UAAU,OAAO,YAAY,QAAQ,CAAC;KACjD,YAAY,GACT,eAAA,mBACF;KACF,CAAC;;WAEG,GAAG;AACV,QAAK,MAAM,MAAM,sCAAsC,EAAE;;AAG3D,OAAK,oBAAoB;;CAG3B,qBAAmC;AACjC,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;AACrB,OAAK,uBAAuB;AAC5B,OAAK,SAAS;AACd,OAAK,mBAAmB;AACxB,OAAK,iCAAiC;AACtC,OAAK,yBAAyB;AAC9B,OAAK,mCAAmB,IAAI,KAAK"}
|
|
1
|
+
{"version":3,"file":"LoafInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.ts"],"sourcesContent":["/* eslint-disable baseline-js/use-baseline */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport type { Metric } from 'web-vitals';\nimport type { SpanSessionManager } from '../../../api-sessions';\nimport { KEY_MXL_TYPE, MXL_TYPES } from '../../../constants';\nimport {\n createPerformanceObserver,\n isEntryTypeSupported,\n} from '../../../utils';\nimport { generateWebVitalID } from '../../../utils/generateWebVitalID';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n ATTR_TBD_LOAF_COUNT,\n ATTR_TBD_LOAF_LONGEST_DURATION,\n ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST,\n ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION,\n ATTR_TBD_LOAF_TOTAL_DURATION,\n ATTR_TBD_LOAF_WORK_DURATION,\n BLOCKING_DURATION_GOOD_THRESHOLD,\n BLOCKING_DURATION_POOR_THRESHOLD,\n LOAF_EVENT_NAME,\n LOAF_SCRIPTS_EVENT_NAME,\n MAX_SCRIPT_ENTRIES,\n MAX_SCRIPT_URL_LENGTH,\n} from './constants';\nimport type { LoafInstrumentationArgs } from './types';\n\ntype ScriptSummaryValue = {\n totalDuration: number;\n styleAndLayoutDuration: number;\n count: number;\n};\n\ntype ScriptSummaries = Map<string, ScriptSummaryValue>;\n\nexport class LoafInstrumentation extends MXLInstrumentationBase {\n private _observer: PerformanceObserver | null = null;\n private _isFirstEntry = true;\n private _removeSessionEndListener: (() => void) | null = null;\n private _isEnabled = false;\n\n private _totalDuration = 0;\n private _workDuration = 0;\n private _styleLayoutDuration = 0;\n private _count = 0;\n private _longestDuration = 0;\n private _longestDurationExcludingFirst = 0;\n private _totalBlockingDuration = 0;\n private _scriptSummaries: ScriptSummaries = new Map();\n\n public constructor({ diag, perf }: LoafInstrumentationArgs = {}) {\n super({\n instrumentationName: 'LoafInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n config: {},\n });\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n if (this._isEnabled) {\n return;\n }\n\n if (!isEntryTypeSupported('long-animation-frame')) {\n this._diag.debug('long-animation-frame not supported, skipping');\n return;\n }\n\n this._isEnabled = true;\n\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer =\n createPerformanceObserver<PerformanceLongAnimationFrameTiming>(\n 'long-animation-frame',\n (entry) => this._processEntry(entry),\n { diag: this._diag },\n );\n\n if (!this._observer) {\n this._isEnabled = false;\n this._diag.error('failed to enable');\n return;\n }\n\n this._registerSessionEndListener();\n }\n\n private _registerSessionEndListener(): void {\n if (!this._isEnabled) {\n return;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n }\n\n this._removeSessionEndListener =\n this.sessionManager.addSessionEndedListener(() => {\n try {\n this._flushReport();\n } catch (e) {\n this._diag.error('error flushing report', e);\n }\n });\n }\n\n public override setSessionManager(sessionManager: SpanSessionManager): void {\n super.setSessionManager(sessionManager);\n this._registerSessionEndListener();\n }\n\n public disable(): void {\n this._isEnabled = false;\n this._resetAccumulators();\n\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n\n if (this._removeSessionEndListener) {\n this._removeSessionEndListener();\n this._removeSessionEndListener = null;\n }\n }\n\n private _processEntry(entry: PerformanceLongAnimationFrameTiming): void {\n if (!this._isEnabled) {\n return;\n }\n\n this._count++;\n this._totalDuration += entry.duration;\n this._workDuration += entry.renderStart\n ? entry.renderStart - entry.startTime\n : entry.duration;\n\n if (entry.styleAndLayoutStart) {\n this._styleLayoutDuration += Math.max(\n 0,\n entry.startTime + entry.duration - entry.styleAndLayoutStart,\n );\n }\n\n this._longestDuration = Math.max(this._longestDuration, entry.duration);\n\n if (this._isFirstEntry && this._count === 1) {\n this._isFirstEntry = false;\n } else {\n this._longestDurationExcludingFirst = Math.max(\n this._longestDurationExcludingFirst,\n entry.duration,\n );\n if (entry.firstUIEventTimestamp === 0) {\n this._totalBlockingDuration += entry.blockingDuration;\n }\n }\n\n try {\n for (const script of entry.scripts) {\n // sourceURL is an empty string for inline scripts\n let url = script.sourceURL || '(inline)';\n if (url.length > MAX_SCRIPT_URL_LENGTH) {\n url = `${url.substring(0, MAX_SCRIPT_URL_LENGTH)}...`;\n }\n\n const existing = this._scriptSummaries.get(url);\n if (existing) {\n existing.totalDuration += script.duration;\n existing.styleAndLayoutDuration +=\n script.forcedStyleAndLayoutDuration;\n existing.count++;\n } else {\n this._scriptSummaries.set(url, {\n totalDuration: script.duration,\n styleAndLayoutDuration: script.forcedStyleAndLayoutDuration,\n count: 1,\n });\n }\n }\n } catch (e) {\n this._diag.error('error processing scripts for entry', e);\n }\n }\n\n private _flushReport(): void {\n if (this._count === 0) {\n return;\n }\n\n // use web-vitals Metric type for rating\n let rating: Metric['rating'];\n if (this._totalBlockingDuration <= BLOCKING_DURATION_GOOD_THRESHOLD) {\n rating = 'good';\n } else if (\n this._totalBlockingDuration <= BLOCKING_DURATION_POOR_THRESHOLD\n ) {\n rating = 'needs-improvement';\n } else {\n rating = 'poor';\n }\n\n const attrs: Record<string, string | number> = {\n [KEY_MXL_TYPE]: MXL_TYPES.WebVital,\n ['mxl.web_vital.id']: generateWebVitalID(),\n ['mxl.web_vital.name']: 'TBD',\n ['mxl.web_vital.value']: Math.round(this._totalBlockingDuration),\n ['mxl.web_vital.rating']: rating,\n [ATTR_TBD_LOAF_TOTAL_DURATION]: Math.round(this._totalDuration),\n [ATTR_TBD_LOAF_WORK_DURATION]: Math.round(this._workDuration),\n [ATTR_TBD_LOAF_STYLE_AND_LAYOUT_DURATION]: Math.round(\n this._styleLayoutDuration,\n ),\n [ATTR_TBD_LOAF_COUNT]: this._count,\n [ATTR_TBD_LOAF_LONGEST_DURATION]: Math.round(this._longestDuration),\n [ATTR_TBD_LOAF_LONGEST_DURATION_EXCLUDING_FIRST]: Math.round(\n this._longestDurationExcludingFirst,\n ),\n };\n\n try {\n this.logger.emit({\n eventName: LOAF_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: attrs,\n });\n } catch (e) {\n this._diag.error('error emitting loaf report', e);\n }\n\n try {\n if (this._scriptSummaries.size > 0) {\n const scripts = [...this._scriptSummaries]\n .sort((a, b) => b[1].totalDuration - a[1].totalDuration)\n .slice(0, MAX_SCRIPT_ENTRIES)\n .map(([url, script]) => [\n url,\n {\n total_duration: Math.round(script.totalDuration),\n style_and_layout_duration: Math.round(\n script.styleAndLayoutDuration,\n ),\n count: script.count,\n },\n ]);\n\n this.logger.emit({\n eventName: LOAF_SCRIPTS_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n body: JSON.stringify(Object.fromEntries(scripts)),\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.LoafScripts,\n },\n });\n }\n } catch (e) {\n this._diag.error('error emitting loaf script summary', e);\n }\n\n this._resetAccumulators();\n }\n\n private _resetAccumulators(): void {\n this._totalDuration = 0;\n this._workDuration = 0;\n this._styleLayoutDuration = 0;\n this._count = 0;\n this._longestDuration = 0;\n this._longestDurationExcludingFirst = 0;\n this._totalBlockingDuration = 0;\n this._scriptSummaries = new Map();\n }\n}\n"],"mappings":";;;;;;;AAmCA,IAAa,sBAAb,cAAyC,uBAAuB;CAC9D,YAAgD;CAChD,gBAAwB;CACxB,4BAAyD;CACzD,aAAqB;CAErB,iBAAyB;CACzB,gBAAwB;CACxB,uBAA+B;CAC/B,SAAiB;CACjB,mBAA2B;CAC3B,iCAAyC;CACzC,yBAAiC;CACjC,mCAA4C,IAAI,KAAK;CAErD,YAAmB,EAAE,MAAM,SAAkC,EAAE,EAAE;AAC/D,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,SAAsB;AACpB,MAAI,KAAK,WACP;AAGF,MAAI,CAAC,qBAAqB,uBAAuB,EAAE;AACjD,QAAK,MAAM,MAAM,+CAA+C;AAChE;;AAGF,OAAK,aAAa;AAElB,MAAI,KAAK,UACP,MAAK,UAAU,YAAY;AAG7B,OAAK,YACH,0B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K,MAC9B,OAAO,uBACR;KACD,OAAO,OAAO;KACf,CACF,CAAC;AAEJ,SAAK,OAAO,KAAK;KACf,WAAW;KACX,gBAAgB,eAAe;KAC/B,MAAM,KAAK,UAAU,OAAO,YAAY,QAAQ,CAAC;KACjD,YAAY,GACT,eAAA,mBACF;KACF,CAAC;;WAEG,GAAG;AACV,QAAK,MAAM,MAAM,sCAAsC,EAAE;;AAG3D,OAAK,oBAAoB;;CAG3B,qBAAmC;AACjC,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;AACrB,OAAK,uBAAuB;AAC5B,OAAK,SAAS;AACd,OAAK,mBAAmB;AACxB,OAAK,iCAAiC;AACtC,OAAK,yBAAyB;AAC9B,OAAK,mCAAmB,IAAI,KAAK"}
|
package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationInstrumentation.cjs","names":["MXLInstrumentationBase","page","KEY_MXL_TYPE","KEY_MXL_PAGE_PATH","KEY_MXL_PAGE_ID","KEY_MXL_INSTRUMENTATION"],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Route } from '../../../api-page
|
|
1
|
+
{"version":3,"file":"NavigationInstrumentation.cjs","names":["MXLInstrumentationBase","page","KEY_MXL_TYPE","KEY_MXL_PAGE_PATH","KEY_MXL_PAGE_ID","KEY_MXL_INSTRUMENTATION"],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Route } from '../../../api-page';\nimport { page } from '../../../api-page';\nimport {\n KEY_MXL_INSTRUMENTATION,\n KEY_MXL_PAGE_ID,\n KEY_MXL_PAGE_PATH,\n KEY_MXL_TYPE,\n MXL_NAVIGATION_INSTRUMENTATIONS,\n MXL_TYPES,\n} from '../../../constants';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport type { NavigationInstrumentationArgs } from './types';\n\n// Regular expression to match path options in the format \"(option)\"\n// Used to clean up paths that are like \"/order/:orderState(pending|shipped|delivered)/type:(sale|normal)\" to \"/order/:orderState/:type\"\n// Could be simplified but done this way to prevent: https://javascript.info/regexp-catastrophic-backtracking\nconst PATH_OPTIONS_RE = /\\([^()]+\\)/g;\n\nexport class NavigationInstrumentation extends MXLInstrumentationBase {\n private readonly _shouldCleanupPathOptionsFromRouteName: boolean = true;\n private _currentRouteSpan: Span | null = null;\n private _instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS =\n MXL_NAVIGATION_INSTRUMENTATIONS.Manual;\n private _removeSessionStartedFn: (() => void) | null = null;\n private _removeSessionEndedFn: (() => void) | null = null;\n\n public constructor({\n diag,\n shouldCleanupPathOptionsFromRouteName = true,\n }: NavigationInstrumentationArgs) {\n super({\n instrumentationName: 'NavigationInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n\n this._shouldCleanupPathOptionsFromRouteName =\n shouldCleanupPathOptionsFromRouteName;\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public setInstrumentationType = (\n instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS,\n ) => {\n this._instrumentationType = instrumentationType;\n };\n\n public setCurrentRoute = (route: Route) => {\n if (!this._config.enabled) {\n return;\n }\n\n const currentRoute = page.getCurrentRoute();\n\n if (route.url !== currentRoute?.url) {\n page.setCurrentRoute(route);\n\n this._endRouteSpan(currentRoute);\n this._startRouteSpan(route);\n }\n };\n\n private readonly _setupSessionListeners = () => {\n if (!this._removeSessionStartedFn) {\n this._removeSessionStartedFn =\n this.sessionManager.addSessionStartedListener(() => {\n const currentRoute = page.getCurrentRoute();\n\n if (currentRoute && !this._currentRouteSpan) {\n this._diag.debug('Session started, starting route span.');\n\n this._startRouteSpan(currentRoute);\n }\n });\n }\n\n if (!this._removeSessionEndedFn) {\n this._removeSessionEndedFn = this.sessionManager.addSessionEndedListener(\n () => {\n if (this._currentRouteSpan) {\n this._diag.debug('Session ended, ending route span.');\n\n this._endRouteSpan(page.getCurrentRoute());\n }\n },\n );\n }\n };\n\n private readonly _cleanUpSessionListeners = () => {\n if (this._removeSessionStartedFn) {\n this._removeSessionStartedFn();\n this._removeSessionStartedFn = null;\n }\n\n if (this._removeSessionEndedFn) {\n this._removeSessionEndedFn();\n this._removeSessionEndedFn = null;\n }\n };\n\n private readonly _startRouteSpan = (route: Route): Span => {\n this._diag.debug(`Starting route span for url: ${route.url}`);\n this._setupSessionListeners();\n\n const pathName = this._shouldCleanupPathOptionsFromRouteName\n ? route.path.replace(PATH_OPTIONS_RE, '')\n : route.path;\n this._currentRouteSpan = this.tracer.startSpan(pathName, {\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.Surface,\n [KEY_MXL_PAGE_PATH]: pathName,\n [KEY_MXL_PAGE_ID]: page.getCurrentPageId() || undefined,\n },\n });\n\n this._currentRouteSpan.setAttribute(\n KEY_MXL_INSTRUMENTATION,\n this._instrumentationType,\n );\n\n return this._currentRouteSpan;\n };\n\n private readonly _endRouteSpan = (currentRoute: Route | null) => {\n if (this._currentRouteSpan) {\n if (currentRoute) {\n this._diag.debug(`Ending route span for url: ${currentRoute.url}`);\n }\n\n this._currentRouteSpan.end();\n this._currentRouteSpan = null;\n }\n };\n\n public enable = () => {\n this.setConfig({\n enabled: true,\n });\n this._diag.debug(\n 'NavigationInstrumentation enabled, listening for navigation events.',\n );\n };\n\n public disable = () => {\n this._cleanUpSessionListeners();\n this.setConfig({\n enabled: false,\n });\n this._diag.debug(\n 'NavigationInstrumentation disabled, stopped listening for navigation events.',\n );\n };\n}\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AAExB,IAAa,4BAAb,cAA+CA,uEAAAA,uBAAuB;CACpE,yCAAmE;CACnE,oBAAyC;CACzC,uBAAQ;CAER,0BAAuD;CACvD,wBAAqD;CAErD,YAAmB,EACjB,MACA,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AAA;IACAC,6BAAAA,oBAAoB;IACpBC,6BAAAA,kBAAkBH,yBAAAA,KAAK,kBAAkB,IAAI,KAAA;GAC/C,EACF,CAAC;AAEF,OAAK,kBAAkB,aACrBI,6BAAAA,yBACA,KAAK,qBACN;AAED,SAAO,KAAK;;CAGd,iBAAkC,iBAA+B;AAC/D,MAAI,KAAK,mBAAmB;AAC1B,OAAI,aACF,MAAK,MAAM,MAAM,8BAA8B,aAAa,MAAM;AAGpE,QAAK,kBAAkB,KAAK;AAC5B,QAAK,oBAAoB;;;CAI7B,eAAsB;AACpB,OAAK,UAAU,EACb,SAAS,MACV,CAAC;AACF,OAAK,MAAM,MACT,sEACD;;CAGH,gBAAuB;AACrB,OAAK,0BAA0B;AAC/B,OAAK,UAAU,EACb,SAAS,OACV,CAAC;AACF,OAAK,MAAM,MACT,+EACD"}
|
package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Route } from '../../../api-page
|
|
1
|
+
{"version":3,"file":"NavigationInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { Route } from '../../../api-page';\nimport { page } from '../../../api-page';\nimport {\n KEY_MXL_INSTRUMENTATION,\n KEY_MXL_PAGE_ID,\n KEY_MXL_PAGE_PATH,\n KEY_MXL_TYPE,\n MXL_NAVIGATION_INSTRUMENTATIONS,\n MXL_TYPES,\n} from '../../../constants';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport type { NavigationInstrumentationArgs } from './types';\n\n// Regular expression to match path options in the format \"(option)\"\n// Used to clean up paths that are like \"/order/:orderState(pending|shipped|delivered)/type:(sale|normal)\" to \"/order/:orderState/:type\"\n// Could be simplified but done this way to prevent: https://javascript.info/regexp-catastrophic-backtracking\nconst PATH_OPTIONS_RE = /\\([^()]+\\)/g;\n\nexport class NavigationInstrumentation extends MXLInstrumentationBase {\n private readonly _shouldCleanupPathOptionsFromRouteName: boolean = true;\n private _currentRouteSpan: Span | null = null;\n private _instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS =\n MXL_NAVIGATION_INSTRUMENTATIONS.Manual;\n private _removeSessionStartedFn: (() => void) | null = null;\n private _removeSessionEndedFn: (() => void) | null = null;\n\n public constructor({\n diag,\n shouldCleanupPathOptionsFromRouteName = true,\n }: NavigationInstrumentationArgs) {\n super({\n instrumentationName: 'NavigationInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n\n this._shouldCleanupPathOptionsFromRouteName =\n shouldCleanupPathOptionsFromRouteName;\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public setInstrumentationType = (\n instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS,\n ) => {\n this._instrumentationType = instrumentationType;\n };\n\n public setCurrentRoute = (route: Route) => {\n if (!this._config.enabled) {\n return;\n }\n\n const currentRoute = page.getCurrentRoute();\n\n if (route.url !== currentRoute?.url) {\n page.setCurrentRoute(route);\n\n this._endRouteSpan(currentRoute);\n this._startRouteSpan(route);\n }\n };\n\n private readonly _setupSessionListeners = () => {\n if (!this._removeSessionStartedFn) {\n this._removeSessionStartedFn =\n this.sessionManager.addSessionStartedListener(() => {\n const currentRoute = page.getCurrentRoute();\n\n if (currentRoute && !this._currentRouteSpan) {\n this._diag.debug('Session started, starting route span.');\n\n this._startRouteSpan(currentRoute);\n }\n });\n }\n\n if (!this._removeSessionEndedFn) {\n this._removeSessionEndedFn = this.sessionManager.addSessionEndedListener(\n () => {\n if (this._currentRouteSpan) {\n this._diag.debug('Session ended, ending route span.');\n\n this._endRouteSpan(page.getCurrentRoute());\n }\n },\n );\n }\n };\n\n private readonly _cleanUpSessionListeners = () => {\n if (this._removeSessionStartedFn) {\n this._removeSessionStartedFn();\n this._removeSessionStartedFn = null;\n }\n\n if (this._removeSessionEndedFn) {\n this._removeSessionEndedFn();\n this._removeSessionEndedFn = null;\n }\n };\n\n private readonly _startRouteSpan = (route: Route): Span => {\n this._diag.debug(`Starting route span for url: ${route.url}`);\n this._setupSessionListeners();\n\n const pathName = this._shouldCleanupPathOptionsFromRouteName\n ? route.path.replace(PATH_OPTIONS_RE, '')\n : route.path;\n this._currentRouteSpan = this.tracer.startSpan(pathName, {\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.Surface,\n [KEY_MXL_PAGE_PATH]: pathName,\n [KEY_MXL_PAGE_ID]: page.getCurrentPageId() || undefined,\n },\n });\n\n this._currentRouteSpan.setAttribute(\n KEY_MXL_INSTRUMENTATION,\n this._instrumentationType,\n );\n\n return this._currentRouteSpan;\n };\n\n private readonly _endRouteSpan = (currentRoute: Route | null) => {\n if (this._currentRouteSpan) {\n if (currentRoute) {\n this._diag.debug(`Ending route span for url: ${currentRoute.url}`);\n }\n\n this._currentRouteSpan.end();\n this._currentRouteSpan = null;\n }\n };\n\n public enable = () => {\n this.setConfig({\n enabled: true,\n });\n this._diag.debug(\n 'NavigationInstrumentation enabled, listening for navigation events.',\n );\n };\n\n public disable = () => {\n this._cleanUpSessionListeners();\n this.setConfig({\n enabled: false,\n });\n this._diag.debug(\n 'NavigationInstrumentation disabled, stopped listening for navigation events.',\n );\n };\n}\n"],"mappings":";;;;AAiBA,MAAM,kBAAkB;AAExB,IAAa,4BAAb,cAA+C,uBAAuB;CACpE,yCAAmE;CACnE,oBAAyC;CACzC,uBAAQ;CAER,0BAAuD;CACvD,wBAAqD;CAErD,YAAmB,EACjB,MACA,wCAAwC,QACR;AAChC,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,OAAK,yCACH;AAEF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ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,OAAI,aACF,MAAK,MAAM,MAAM,8BAA8B,aAAa,MAAM;AAGpE,QAAK,kBAAkB,KAAK;AAC5B,QAAK,oBAAoB;;;CAI7B,eAAsB;AACpB,OAAK,UAAU,EACb,SAAS,MACV,CAAC;AACF,OAAK,MAAM,MACT,sEACD;;CAGH,gBAAuB;AACrB,OAAK,0BAA0B;AAC/B,OAAK,UAAU,EACb,SAAS,OACV,CAAC;AACF,OAAK,MAAM,MACT,+EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.cjs","names":["NavigationInstrumentation"],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/instance.ts"],"sourcesContent":["import { NavigationInstrumentation } from './NavigationInstrumentation
|
|
1
|
+
{"version":3,"file":"instance.cjs","names":["NavigationInstrumentation"],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/instance.ts"],"sourcesContent":["import { NavigationInstrumentation } from './NavigationInstrumentation';\nimport type { NavigationInstrumentationArgs } from './types';\n\nlet navigationInstrumentation: NavigationInstrumentation | undefined;\n\nexport const getNavigationInstrumentation = (\n config: NavigationInstrumentationArgs = {},\n): NavigationInstrumentation => {\n if (!navigationInstrumentation) {\n navigationInstrumentation = new NavigationInstrumentation(config);\n }\n\n return navigationInstrumentation;\n};\n"],"mappings":";;;AAGA,IAAI;AAEJ,MAAa,gCACX,SAAwC,EAAE,KACZ;AAC9B,KAAI,CAAC,0BACH,6BAA4B,IAAIA,wFAAAA,0BAA0B,OAAO;AAGnE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/instance.ts"],"sourcesContent":["import { NavigationInstrumentation } from './NavigationInstrumentation
|
|
1
|
+
{"version":3,"file":"instance.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/instance.ts"],"sourcesContent":["import { NavigationInstrumentation } from './NavigationInstrumentation';\nimport type { NavigationInstrumentationArgs } from './types';\n\nlet navigationInstrumentation: NavigationInstrumentation | undefined;\n\nexport const getNavigationInstrumentation = (\n config: NavigationInstrumentationArgs = {},\n): NavigationInstrumentation => {\n if (!navigationInstrumentation) {\n navigationInstrumentation = new NavigationInstrumentation(config);\n }\n\n return navigationInstrumentation;\n};\n"],"mappings":";;AAGA,IAAI;AAEJ,MAAa,gCACX,SAAwC,EAAE,KACZ;AAC9B,KAAI,CAAC,0BACH,6BAA4B,IAAI,0BAA0B,OAAO;AAGnE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReactRouterNavigationInstrumentation.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.ts"],"sourcesContent":["import type { NavigationInstrumentationArgs } from '../index
|
|
1
|
+
{"version":3,"file":"createReactRouterNavigationInstrumentation.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.ts"],"sourcesContent":["import type { NavigationInstrumentationArgs } from '../index';\nimport { getNavigationInstrumentation } from '../index';\n\nexport const createReactRouterNavigationInstrumentation = (\n config: NavigationInstrumentationArgs = {},\n) => getNavigationInstrumentation(config);\n"],"mappings":";;;AAGA,MAAa,8CACX,SAAwC,EAAE,KACvCA,uEAAAA,6BAA6B,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReactRouterNavigationInstrumentation.js","names":[],"sources":["../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.ts"],"sourcesContent":["import type { NavigationInstrumentationArgs } from '../index
|
|
1
|
+
{"version":3,"file":"createReactRouterNavigationInstrumentation.js","names":[],"sources":["../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/createReactRouterNavigationInstrumentation.ts"],"sourcesContent":["import type { NavigationInstrumentationArgs } from '../index';\nimport { getNavigationInstrumentation } from '../index';\n\nexport const createReactRouterNavigationInstrumentation = (\n config: NavigationInstrumentationArgs = {},\n) => getNavigationInstrumentation(config);\n"],"mappings":";;AAGA,MAAa,8CACX,SAAwC,EAAE,KACvC,6BAA6B,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRoutingLegacy.cjs","names":["getNavigationInstrumentation","React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants
|
|
1
|
+
{"version":3,"file":"withMXLRoutingLegacy.cjs","names":["getNavigationInstrumentation","React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/remix-run/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n navigationInstrumentation.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,wBACX,qBACG;CACH,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,2BAA0B,gBAAgB;IACxC,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOC,MAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,EAAA,GAAA,wBAAA,SAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRoutingLegacy.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"withMXLRoutingLegacy.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAMa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRoutingLegacy.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"withMXLRoutingLegacy.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAMa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRoutingLegacy.js","names":["React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants
|
|
1
|
+
{"version":3,"file":"withMXLRoutingLegacy.js","names":["React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/remix-run/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n navigationInstrumentation.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;AAMA,MAAa,wBACX,qBACG;CACH,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,2BAA0B,gBAAgB;IACxC,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOA,QAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,sBAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listenToRouterChanges.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page
|
|
1
|
+
{"version":3,"file":"listenToRouterChanges.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * getRouteFromMatches goes through all the matches routes to build the full path\n * nested routes contain only the partial match, so we need to go through all of them\n * in order to build the full path.\n *\n * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n const currentMatchIndex = matches.findIndex(\n (match) => match.pathname === currentPathname,\n );\n\n if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) {\n return null;\n }\n\n // Build full absolute path by reducing all matches up to the current one.\n // Absolute child paths reset the accumulation; relative paths are appended.\n return matches\n .slice(0, currentMatchIndex + 1)\n .reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: matches[currentMatchIndex].pathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n navigationInstrumentation.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n navigationInstrumentation.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;CACjB,MAAM,oBAAoB,QAAQ,WAC/B,UAAU,MAAM,aAAa,gBAC/B;AAED,KAAI,sBAAsB,MAAM,CAAC,QAAQ,mBAAmB,MAAM,KAChE,QAAO;AAKT,QAAO,QACJ,MAAM,GAAG,oBAAoB,EAAE,CAC/B,QAAsB,KAAK,UAAU;EACpC,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK,QAAQ,mBAAmB;GAAU;IACxD,KAAK;;AAGZ,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;CAC/B,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,2BAA0B,gBAAgB,aAAa;AAGzD,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,2BAA0B,gBAAgB,aAAa;GAEzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listenToRouterChanges.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page
|
|
1
|
+
{"version":3,"file":"listenToRouterChanges.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * getRouteFromMatches goes through all the matches routes to build the full path\n * nested routes contain only the partial match, so we need to go through all of them\n * in order to build the full path.\n *\n * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n const currentMatchIndex = matches.findIndex(\n (match) => match.pathname === currentPathname,\n );\n\n if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) {\n return null;\n }\n\n // Build full absolute path by reducing all matches up to the current one.\n // Absolute child paths reset the accumulation; relative paths are appended.\n return matches\n .slice(0, currentMatchIndex + 1)\n .reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: matches[currentMatchIndex].pathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n navigationInstrumentation.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n navigationInstrumentation.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;CACjB,MAAM,oBAAoB,QAAQ,WAC/B,UAAU,MAAM,aAAa,gBAC/B;AAED,KAAI,sBAAsB,MAAM,CAAC,QAAQ,mBAAmB,MAAM,KAChE,QAAO;AAKT,QAAO,QACJ,MAAM,GAAG,oBAAoB,EAAE,CAC/B,QAAsB,KAAK,UAAU;EACpC,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK,QAAQ,mBAAmB;GAAU;IACxD,KAAK;;AAGZ,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;CAC/B,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,2BAA0B,gBAAgB,aAAa;AAGzD,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,2BAA0B,gBAAgB,aAAa;GAEzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRouting.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page
|
|
1
|
+
{"version":3,"file":"withMXLRouting.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n const path =\n lastRoute && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n navigationInstrumentation.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;;;;AASA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;CACrD,MAAM,OACJ,aAAa,CAAC,UAAU,WAAW,IAAI,GACnC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;CACH,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,2BAA0B,gBAAgB,UAAU;;AAIxD,UAAA,GAAA,MAAA,eAAwB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,EAAA,GAAA,wBAAA,SAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMXLRouting.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page
|
|
1
|
+
{"version":3,"file":"withMXLRouting.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants';\nimport { getNavigationInstrumentation } from '../..';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n const path =\n lastRoute && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n navigationInstrumentation.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;AASA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;CACrD,MAAM,OACJ,aAAa,CAAC,UAAU,WAAW,IAAI,GACnC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;CACH,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,2BAA0B,gBAAgB,UAAU;;AAIxD,SAAO,cAAiB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,sBAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTimingInstrumentation.cjs","names":["MXLInstrumentationBase","SERVER_TIMING_EVENT_NAME","SeverityNumber","KEY_MXL_TYPE","KEY_MXL_SERVER_TIMING_NAME","KEY_MXL_SERVER_TIMING_DURATION","KEY_MXL_SERVER_TIMING_DESCRIPTION"],"sources":["../../../../src/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.ts"],"sourcesContent":["import { SeverityNumber } from '@opentelemetry/api-logs';\nimport {
|
|
1
|
+
{"version":3,"file":"ServerTimingInstrumentation.cjs","names":["MXLInstrumentationBase","SERVER_TIMING_EVENT_NAME","SeverityNumber","KEY_MXL_TYPE","KEY_MXL_SERVER_TIMING_NAME","KEY_MXL_SERVER_TIMING_DURATION","KEY_MXL_SERVER_TIMING_DESCRIPTION"],"sources":["../../../../src/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.ts"],"sourcesContent":["import { SeverityNumber } from '@opentelemetry/api-logs';\nimport { KEY_MXL_TYPE, MXL_TYPES } from '../../../constants';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n KEY_MXL_SERVER_TIMING_DESCRIPTION,\n KEY_MXL_SERVER_TIMING_DURATION,\n KEY_MXL_SERVER_TIMING_NAME,\n SERVER_TIMING_EVENT_NAME,\n} from './constants';\nimport type { ServerTimingInstrumentationArgs } from './types';\n\nexport class ServerTimingInstrumentation extends MXLInstrumentationBase {\n private readonly _onLoad: () => void;\n private _performanceCollected = false;\n\n public constructor({\n diag,\n perf,\n limitManager,\n }: ServerTimingInstrumentationArgs = {}) {\n super({\n instrumentationName: 'ServerTimingInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n limitManager,\n config: {},\n });\n\n this._onLoad = () => {\n this._readServerTiming();\n };\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n window.removeEventListener('load', this._onLoad);\n\n if (window.document.readyState === 'complete') {\n this._readServerTiming();\n return;\n }\n\n window.addEventListener('load', this._onLoad);\n }\n\n public disable(): void {\n window.removeEventListener('load', this._onLoad);\n }\n\n private _readServerTiming(): void {\n if (this._performanceCollected) {\n return;\n }\n this._performanceCollected = true;\n\n const navEntries = performance.getEntriesByType(\n 'navigation',\n ) as PerformanceNavigationTiming[];\n const serverTiming = navEntries[0]?.serverTiming;\n\n if (!serverTiming?.length) {\n return;\n }\n\n for (const entry of serverTiming) {\n if (this.limitManager?.limitServerTimingEntry()) {\n return;\n }\n\n this.logger.emit({\n eventName: SERVER_TIMING_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.ServerTiming,\n [KEY_MXL_SERVER_TIMING_NAME]: entry.name,\n [KEY_MXL_SERVER_TIMING_DURATION]: entry.duration,\n [KEY_MXL_SERVER_TIMING_DESCRIPTION]: entry.description,\n },\n });\n }\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAa,8BAAb,cAAiDA,uEAAAA,uBAAuB;CACtE;CACA,wBAAgC;CAEhC,YAAmB,EACjB,MACA,MACA,iBACmC,EAAE,EAAE;AACvC,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,OAAK,gBAAgB;AACnB,QAAK,mBAAmB;;AAG1B,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,SAAsB;AACpB,SAAO,oBAAoB,QAAQ,KAAK,QAAQ;AAEhD,MAAI,OAAO,SAAS,eAAe,YAAY;AAC7C,QAAK,mBAAmB;AACxB;;AAGF,SAAO,iBAAiB,QAAQ,KAAK,QAAQ;;CAG/C,UAAuB;AACrB,SAAO,oBAAoB,QAAQ,KAAK,QAAQ;;CAGlD,oBAAkC;AAChC,MAAI,KAAK,sBACP;AAEF,OAAK,wBAAwB;EAK7B,MAAM,eAHa,YAAY,iBAC7B,aAE6B,CAAC,IAAI;AAEpC,MAAI,CAAC,cAAc,OACjB;AAGF,OAAK,MAAM,SAAS,cAAc;AAChC,OAAI,KAAK,cAAc,wBAAwB,CAC7C;AAGF,QAAK,OAAO,KAAK;IACf,WAAWC,6EAAAA;IACX,gBAAgBC,wBAAAA,eAAe;IAC/B,YAAY;MACTC,6BAAAA,eAAAA;MACAC,6EAAAA,6BAA6B,MAAM;MACnCC,6EAAAA,iCAAiC,MAAM;MACvCC,6EAAAA,oCAAoC,MAAM;KAC5C;IACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTimingInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.ts"],"sourcesContent":["import { SeverityNumber } from '@opentelemetry/api-logs';\nimport {
|
|
1
|
+
{"version":3,"file":"ServerTimingInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.ts"],"sourcesContent":["import { SeverityNumber } from '@opentelemetry/api-logs';\nimport { KEY_MXL_TYPE, MXL_TYPES } from '../../../constants';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n KEY_MXL_SERVER_TIMING_DESCRIPTION,\n KEY_MXL_SERVER_TIMING_DURATION,\n KEY_MXL_SERVER_TIMING_NAME,\n SERVER_TIMING_EVENT_NAME,\n} from './constants';\nimport type { ServerTimingInstrumentationArgs } from './types';\n\nexport class ServerTimingInstrumentation extends MXLInstrumentationBase {\n private readonly _onLoad: () => void;\n private _performanceCollected = false;\n\n public constructor({\n diag,\n perf,\n limitManager,\n }: ServerTimingInstrumentationArgs = {}) {\n super({\n instrumentationName: 'ServerTimingInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n limitManager,\n config: {},\n });\n\n this._onLoad = () => {\n this._readServerTiming();\n };\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public enable(): void {\n window.removeEventListener('load', this._onLoad);\n\n if (window.document.readyState === 'complete') {\n this._readServerTiming();\n return;\n }\n\n window.addEventListener('load', this._onLoad);\n }\n\n public disable(): void {\n window.removeEventListener('load', this._onLoad);\n }\n\n private _readServerTiming(): void {\n if (this._performanceCollected) {\n return;\n }\n this._performanceCollected = true;\n\n const navEntries = performance.getEntriesByType(\n 'navigation',\n ) as PerformanceNavigationTiming[];\n const serverTiming = navEntries[0]?.serverTiming;\n\n if (!serverTiming?.length) {\n return;\n }\n\n for (const entry of serverTiming) {\n if (this.limitManager?.limitServerTimingEntry()) {\n return;\n }\n\n this.logger.emit({\n eventName: SERVER_TIMING_EVENT_NAME,\n severityNumber: SeverityNumber.INFO,\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.ServerTiming,\n [KEY_MXL_SERVER_TIMING_NAME]: entry.name,\n [KEY_MXL_SERVER_TIMING_DURATION]: entry.duration,\n [KEY_MXL_SERVER_TIMING_DESCRIPTION]: entry.description,\n },\n });\n }\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,8BAAb,cAAiD,uBAAuB;CACtE;CACA,wBAAgC;CAEhC,YAAmB,EACjB,MACA,MACA,iBACmC,EAAE,EAAE;AACvC,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AAEF,OAAK,gBAAgB;AACnB,QAAK,mBAAmB;;AAG1B,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,SAAsB;AACpB,SAAO,oBAAoB,QAAQ,KAAK,QAAQ;AAEhD,MAAI,OAAO,SAAS,eAAe,YAAY;AAC7C,QAAK,mBAAmB;AACxB;;AAGF,SAAO,iBAAiB,QAAQ,KAAK,QAAQ;;CAG/C,UAAuB;AACrB,SAAO,oBAAoB,QAAQ,KAAK,QAAQ;;CAGlD,oBAAkC;AAChC,MAAI,KAAK,sBACP;AAEF,OAAK,wBAAwB;EAK7B,MAAM,eAHa,YAAY,iBAC7B,aAE6B,CAAC,IAAI;AAEpC,MAAI,CAAC,cAAc,OACjB;AAGF,OAAK,MAAM,SAAS,cAAc;AAChC,OAAI,KAAK,cAAc,wBAAwB,CAC7C;AAGF,QAAK,OAAO,KAAK;IACf,WAAW;IACX,gBAAgB,eAAe;IAC/B,YAAY;MACT,eAAA;MACA,6BAA6B,MAAM;MACnC,iCAAiC,MAAM;MACvC,oCAAoC,MAAM;KAC5C;IACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanSessionBrowserActivityInstrumentation.cjs","names":["MXLInstrumentationBase","throttle","EVENT_THROTTLING_TIME_WINDOW","WINDOW_USER_EVENTS","TIMEOUT_TIME"],"sources":["../../../../src/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils
|
|
1
|
+
{"version":3,"file":"SpanSessionBrowserActivityInstrumentation.cjs","names":["MXLInstrumentationBase","throttle","EVENT_THROTTLING_TIME_WINDOW","WINDOW_USER_EVENTS","TIMEOUT_TIME"],"sources":["../../../../src/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils';\nimport {\n bulkAddEventListener,\n bulkRemoveEventListener,\n throttle,\n} from '../../../utils';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n EVENT_THROTTLING_TIME_WINDOW,\n TIMEOUT_TIME,\n WINDOW_USER_EVENTS,\n} from './constants';\nimport type { SpanSessionBrowserActivityInstrumentationArgs } from './types';\n\n/**\n * SpanSessionBrowserActivityInstrumentation will track the user activity and end the session span if there is no\n * activity for a certain amount of time.\n * SpanSessionBrowserActivityInstrumentation will initialize new sessions if new activity is detected and there is no\n * active session.\n * */\nexport class SpanSessionBrowserActivityInstrumentation extends MXLInstrumentationBase {\n private readonly _onActivityThrottled: () => void;\n private _activityTimeout: TimeoutRef | null;\n\n public constructor({\n diag,\n }: SpanSessionBrowserActivityInstrumentationArgs = {}) {\n super({\n instrumentationName: 'SpanSessionBrowserActivityInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n this._activityTimeout = null;\n this._onActivityThrottled = throttle(\n this._onActivity,\n EVENT_THROTTLING_TIME_WINDOW,\n );\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public disable = () => {\n bulkRemoveEventListener({\n target: window,\n events: WINDOW_USER_EVENTS,\n callback: this._onActivityThrottled,\n });\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n this._activityTimeout = null;\n };\n\n public enable = () => {\n bulkAddEventListener({\n target: window,\n events: WINDOW_USER_EVENTS,\n callback: this._onActivityThrottled,\n });\n };\n\n private readonly _onInactivity = () => {\n this._diag.debug('Inactivity detected');\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n this._activityTimeout = null;\n this.sessionManager.endSessionSpanInternal('inactivity');\n };\n\n private readonly _onActivity = () => {\n this._diag.debug('Activity detected');\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n // if there was no active session, start one\n if (!this.sessionManager.getSessionId()) {\n this.sessionManager.startSessionSpan({ reason: 'activity' });\n }\n this._activityTimeout = setTimeout(this._onInactivity, TIMEOUT_TIME);\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,IAAa,4CAAb,cAA+DA,uEAAAA,uBAAuB;CACpF;CACA;CAEA,YAAmB,EACjB,SACiD,EAAE,EAAE;AACrD,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA,QAAQ,EAAE;GACX,CAAC;AACF,OAAK,mBAAmB;AACxB,OAAK,uBAAuBC,uBAAAA,SAC1B,KAAK,aACLC,qFAAAA,6BACD;AACD,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,gBAAuB;AACrB,gEAAA,wBAAwB;GACtB,QAAQ;GACR,QAAQC,qFAAAA;GACR,UAAU,KAAK;GAChB,CAAC;AACF,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAErC,OAAK,mBAAmB;;CAG1B,eAAsB;AACpB,0DAAA,qBAAqB;GACnB,QAAQ;GACR,QAAQA,qFAAAA;GACR,UAAU,KAAK;GAChB,CAAC;;CAGJ,sBAAuC;AACrC,OAAK,MAAM,MAAM,sBAAsB;AACvC,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAErC,OAAK,mBAAmB;AACxB,OAAK,eAAe,uBAAuB,aAAa;;CAG1D,oBAAqC;AACnC,OAAK,MAAM,MAAM,oBAAoB;AACrC,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAGrC,MAAI,CAAC,KAAK,eAAe,cAAc,CACrC,MAAK,eAAe,iBAAiB,EAAE,QAAQ,YAAY,CAAC;AAE9D,OAAK,mBAAmB,WAAW,KAAK,eAAeC,qFAAAA,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanSessionBrowserActivityInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils
|
|
1
|
+
{"version":3,"file":"SpanSessionBrowserActivityInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/session/SpanSessionBrowserActivityInstrumentation/SpanSessionBrowserActivityInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils';\nimport {\n bulkAddEventListener,\n bulkRemoveEventListener,\n throttle,\n} from '../../../utils';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport {\n EVENT_THROTTLING_TIME_WINDOW,\n TIMEOUT_TIME,\n WINDOW_USER_EVENTS,\n} from './constants';\nimport type { SpanSessionBrowserActivityInstrumentationArgs } from './types';\n\n/**\n * SpanSessionBrowserActivityInstrumentation will track the user activity and end the session span if there is no\n * activity for a certain amount of time.\n * SpanSessionBrowserActivityInstrumentation will initialize new sessions if new activity is detected and there is no\n * active session.\n * */\nexport class SpanSessionBrowserActivityInstrumentation extends MXLInstrumentationBase {\n private readonly _onActivityThrottled: () => void;\n private _activityTimeout: TimeoutRef | null;\n\n public constructor({\n diag,\n }: SpanSessionBrowserActivityInstrumentationArgs = {}) {\n super({\n instrumentationName: 'SpanSessionBrowserActivityInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n this._activityTimeout = null;\n this._onActivityThrottled = throttle(\n this._onActivity,\n EVENT_THROTTLING_TIME_WINDOW,\n );\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public disable = () => {\n bulkRemoveEventListener({\n target: window,\n events: WINDOW_USER_EVENTS,\n callback: this._onActivityThrottled,\n });\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n this._activityTimeout = null;\n };\n\n public enable = () => {\n bulkAddEventListener({\n target: window,\n events: WINDOW_USER_EVENTS,\n callback: this._onActivityThrottled,\n });\n };\n\n private readonly _onInactivity = () => {\n this._diag.debug('Inactivity detected');\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n this._activityTimeout = null;\n this.sessionManager.endSessionSpanInternal('inactivity');\n };\n\n private readonly _onActivity = () => {\n this._diag.debug('Activity detected');\n if (this._activityTimeout) {\n clearTimeout(this._activityTimeout);\n }\n // if there was no active session, start one\n if (!this.sessionManager.getSessionId()) {\n this.sessionManager.startSessionSpan({ reason: 'activity' });\n }\n this._activityTimeout = setTimeout(this._onInactivity, TIMEOUT_TIME);\n };\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAa,4CAAb,cAA+D,uBAAuB;CACpF;CACA;CAEA,YAAmB,EACjB,SACiD,EAAE,EAAE;AACrD,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA,QAAQ,EAAE;GACX,CAAC;AACF,OAAK,mBAAmB;AACxB,OAAK,uBAAuB,SAC1B,KAAK,aACL,6BACD;AACD,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,gBAAuB;AACrB,0BAAwB;GACtB,QAAQ;GACR,QAAQ;GACR,UAAU,KAAK;GAChB,CAAC;AACF,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAErC,OAAK,mBAAmB;;CAG1B,eAAsB;AACpB,uBAAqB;GACnB,QAAQ;GACR,QAAQ;GACR,UAAU,KAAK;GAChB,CAAC;;CAGJ,sBAAuC;AACrC,OAAK,MAAM,MAAM,sBAAsB;AACvC,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAErC,OAAK,mBAAmB;AACxB,OAAK,eAAe,uBAAuB,aAAa;;CAG1D,oBAAqC;AACnC,OAAK,MAAM,MAAM,oBAAoB;AACrC,MAAI,KAAK,iBACP,cAAa,KAAK,iBAAiB;AAGrC,MAAI,CAAC,KAAK,eAAe,cAAc,CACrC,MAAK,eAAe,iBAAiB,EAAE,QAAQ,YAAY,CAAC;AAE9D,OAAK,mBAAmB,WAAW,KAAK,eAAe,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanSessionOnLoadInstrumentation.cjs","names":["MXLInstrumentationBase"],"sources":["../../../../src/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.ts"],"sourcesContent":["import { MXLInstrumentationBase } from '../../MXLInstrumentationBase
|
|
1
|
+
{"version":3,"file":"SpanSessionOnLoadInstrumentation.cjs","names":["MXLInstrumentationBase"],"sources":["../../../../src/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.ts"],"sourcesContent":["import { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport type { SpanSessionOnLoadInstrumentationArgs } from './types';\n\nexport class SpanSessionOnLoadInstrumentation extends MXLInstrumentationBase {\n public constructor({ diag }: SpanSessionOnLoadInstrumentationArgs = {}) {\n super({\n instrumentationName: 'SpanSessionOnLoadInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public disable(): void {\n this.sessionManager.endSessionSpanInternal('unknown');\n }\n\n public enable(): void {\n this.sessionManager.startSessionSpan({ reason: 'init' });\n }\n}\n"],"mappings":";;;AAGA,IAAa,mCAAb,cAAsDA,uEAAAA,uBAAuB;CAC3E,YAAmB,EAAE,SAA+C,EAAE,EAAE;AACtE,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA,QAAQ,EAAE;GACX,CAAC;AACF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,UAAuB;AACrB,OAAK,eAAe,uBAAuB,UAAU;;CAGvD,SAAsB;AACpB,OAAK,eAAe,iBAAiB,EAAE,QAAQ,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanSessionOnLoadInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.ts"],"sourcesContent":["import { MXLInstrumentationBase } from '../../MXLInstrumentationBase
|
|
1
|
+
{"version":3,"file":"SpanSessionOnLoadInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/session/SpanSessionOnLoadInstrumentation/SpanSessionOnLoadInstrumentation.ts"],"sourcesContent":["import { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport type { SpanSessionOnLoadInstrumentationArgs } from './types';\n\nexport class SpanSessionOnLoadInstrumentation extends MXLInstrumentationBase {\n public constructor({ diag }: SpanSessionOnLoadInstrumentationArgs = {}) {\n super({\n instrumentationName: 'SpanSessionOnLoadInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n config: {},\n });\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public disable(): void {\n this.sessionManager.endSessionSpanInternal('unknown');\n }\n\n public enable(): void {\n this.sessionManager.startSessionSpan({ reason: 'init' });\n }\n}\n"],"mappings":";;AAGA,IAAa,mCAAb,cAAsD,uBAAuB;CAC3E,YAAmB,EAAE,SAA+C,EAAE,EAAE;AACtE,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA,QAAQ,EAAE;GACX,CAAC;AACF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,UAAuB;AACrB,OAAK,eAAe,uBAAuB,UAAU;;CAGvD,SAAsB;AACpB,OAAK,eAAe,iBAAiB,EAAE,QAAQ,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanSessionTimeoutInstrumentation.cjs","names":["MXLInstrumentationBase","TIMEOUT_TIME"],"sources":["../../../../src/instrumentations/session/SpanSessionTimeoutInstrumentation/SpanSessionTimeoutInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils
|
|
1
|
+
{"version":3,"file":"SpanSessionTimeoutInstrumentation.cjs","names":["MXLInstrumentationBase","TIMEOUT_TIME"],"sources":["../../../../src/instrumentations/session/SpanSessionTimeoutInstrumentation/SpanSessionTimeoutInstrumentation.ts"],"sourcesContent":["import type { TimeoutRef } from '../../../utils';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase';\nimport { TIMEOUT_TIME } from './constants';\nimport type { SpanSessionTimeoutInstrumentationArgs } from './types';\n\n/**\n * SpanSessionTimeoutInstrumentation will track how long has a session been active and end it after a certain amount of time.\n * It will immediately start a new session after the previous one ends.\n **/\nexport class SpanSessionTimeoutInstrumentation extends MXLInstrumentationBase {\n private _sessionTimeout: TimeoutRef | null;\n\n public constructor({\n diag,\n perf,\n }: SpanSessionTimeoutInstrumentationArgs = {}) {\n super({\n instrumentationName: 'SpanSessionTimeoutInstrumentation',\n instrumentationVersion: '1.0.0',\n diag,\n perf,\n config: {},\n });\n this._sessionTimeout = null;\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public disable = () => {\n if (this._sessionTimeout) {\n clearTimeout(this._sessionTimeout);\n }\n this._sessionTimeout = null;\n };\n\n public enable = () => {\n this._checkTimeout();\n };\n\n private readonly _onTimeout = () => {\n this._diag.debug('Timeout detected');\n // clear existing timeout\n if (this._sessionTimeout) {\n clearTimeout(this._sessionTimeout);\n }\n this.sessionManager.endSessionSpanInternal('timer');\n this.sessionManager.startSessionSpan({ reason: 'timer' });\n // set a new check in TIMEOUT_TIME for the session we just started\n this._sessionTimeout = setTimeout(this._checkTimeout, TIMEOUT_TIME);\n };\n\n private readonly _checkTimeout = () => {\n const currentSessionStartTime = this.sessionManager.getSessionStartTime();\n // validate that there is an active session, as it may already been finished for other reasons.\n if (currentSessionStartTime) {\n // check how much time has passed since the session started\n const timePassed = this.perf.millisSinceHRTime(currentSessionStartTime);\n const remainingTime = TIMEOUT_TIME - timePassed;\n // if the remaining time is 0 or less, the session has already timed out.\n if (remainingTime <= 0) {\n // the session has already timed out.\n this._onTimeout();\n return;\n }\n // if there is time remaining, set a new timeout for check again after it\n if (this._sessionTimeout) {\n clearTimeout(this._sessionTimeout);\n }\n this._sessionTimeout = setTimeout(this._checkTimeout, remainingTime);\n return;\n }\n // if there is no currentSessionStartTime then there is no active session,\n // check again in TIMEOUT_TIME in case a new one is started.\n if (this._sessionTimeout) {\n clearTimeout(this._sessionTimeout);\n }\n this._sessionTimeout = setTimeout(this._checkTimeout, TIMEOUT_TIME);\n };\n}\n"],"mappings":";;;;;;;;AASA,IAAa,oCAAb,cAAuDA,uEAAAA,uBAAuB;CAC5E;CAEA,YAAmB,EACjB,MACA,SACyC,EAAE,EAAE;AAC7C,QAAM;GACJ,qBAAqB;GACrB,wBAAwB;GACxB;GACA;GACA,QAAQ,EAAE;GACX,CAAC;AACF,OAAK,kBAAkB;AACvB,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,gBAAuB;AACrB,MAAI,KAAK,gBACP,cAAa,KAAK,gBAAgB;AAEpC,OAAK,kBAAkB;;CAGzB,eAAsB;AACpB,OAAK,eAAe;;CAGtB,mBAAoC;AAClC,OAAK,MAAM,MAAM,mBAAmB;AAEpC,MAAI,KAAK,gBACP,cAAa,KAAK,gBAAgB;AAEpC,OAAK,eAAe,uBAAuB,QAAQ;AACnD,OAAK,eAAe,iBAAiB,EAAE,QAAQ,SAAS,CAAC;AAEzD,OAAK,kBAAkB,WAAW,KAAK,eAAeC,6EAAAA,aAAa;;CAGrE,sBAAuC;EACrC,MAAM,0BAA0B,KAAK,eAAe,qBAAqB;AAEzE,MAAI,yBAAyB;GAG3B,MAAM,gBAAgBA,6EAAAA,eADH,KAAK,KAAK,kBAAkB,wBACA;AAE/C,OAAI,iBAAiB,GAAG;AAEtB,SAAK,YAAY;AACjB;;AAGF,OAAI,KAAK,gBACP,cAAa,KAAK,gBAAgB;AAEpC,QAAK,kBAAkB,WAAW,KAAK,eAAe,cAAc;AACpE;;AAIF,MAAI,KAAK,gBACP,cAAa,KAAK,gBAAgB;AAEpC,OAAK,kBAAkB,WAAW,KAAK,eAAeA,6EAAAA,aAAa"}
|