@microsoft/applicationinsights-common 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28
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/browser/es5/applicationinsights-common.cjs.js +3965 -0
- package/browser/es5/applicationinsights-common.cjs.js.map +1 -0
- package/browser/es5/applicationinsights-common.cjs.min.js +6 -0
- package/browser/es5/applicationinsights-common.cjs.min.js.map +1 -0
- package/browser/es5/applicationinsights-common.gbl.js +3969 -0
- package/browser/es5/applicationinsights-common.gbl.js.map +1 -0
- package/browser/es5/applicationinsights-common.gbl.min.js +6 -0
- package/browser/es5/applicationinsights-common.gbl.min.js.map +1 -0
- package/browser/es5/applicationinsights-common.integrity.json +66 -0
- package/browser/{applicationinsights-common.js → es5/applicationinsights-common.js} +194 -167
- package/browser/es5/applicationinsights-common.js.map +1 -0
- package/browser/es5/applicationinsights-common.min.js +6 -0
- package/browser/es5/applicationinsights-common.min.js.map +1 -0
- package/dist/{applicationinsights-common.js → es5/applicationinsights-common.js} +194 -167
- package/dist/es5/applicationinsights-common.js.map +1 -0
- package/dist/es5/applicationinsights-common.min.js +6 -0
- package/dist/es5/applicationinsights-common.min.js.map +1 -0
- package/{dist-esm → dist-es5}/ConnectionStringParser.js +1 -1
- package/{dist-esm → dist-es5}/Constants.js +1 -1
- package/{dist-esm → dist-es5}/DomHelperFuncs.js +1 -1
- package/{dist-esm → dist-es5}/Enums.js +1 -1
- package/{dist-esm → dist-es5}/HelperFuncs.js +1 -1
- package/dist-es5/Interfaces/ConnectionString.js +6 -0
- package/dist-es5/Interfaces/Context/IApplication.js +8 -0
- package/dist-es5/Interfaces/Context/IDevice.js +8 -0
- package/dist-es5/Interfaces/Context/IInternal.js +8 -0
- package/dist-es5/Interfaces/Context/ILocation.js +8 -0
- package/dist-es5/Interfaces/Context/IOperatingSystem.js +8 -0
- package/dist-es5/Interfaces/Context/ISample.js +8 -0
- package/dist-es5/Interfaces/Context/ISession.js +8 -0
- package/dist-es5/Interfaces/Context/ITelemetryTrace.js +8 -0
- package/dist-es5/Interfaces/Context/IUser.js +8 -0
- package/dist-es5/Interfaces/Context/IWeb.js +8 -0
- package/{dist-esm → dist-es5}/Interfaces/Contracts/AvailabilityData.js +1 -1
- package/{dist-esm → dist-es5}/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-es5/Interfaces/Contracts/DataPointType.js +8 -0
- package/dist-es5/Interfaces/Contracts/DependencyKind.js +8 -0
- package/dist-es5/Interfaces/Contracts/DependencySourceType.js +8 -0
- package/dist-es5/Interfaces/Contracts/IBase.js +8 -0
- package/dist-es5/Interfaces/Contracts/IData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IDataPoint.js +6 -0
- package/dist-es5/Interfaces/Contracts/IDomain.js +8 -0
- package/{dist-esm → dist-es5}/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-es5/Interfaces/Contracts/IEventData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IExceptionData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IExceptionDetails.js +8 -0
- package/dist-es5/Interfaces/Contracts/IMessageData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IMetricData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IPageViewData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IPageViewPerfData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IRemoteDependencyData.js +8 -0
- package/dist-es5/Interfaces/Contracts/IStackFrame.js +8 -0
- package/{dist-esm → dist-es5}/Interfaces/Contracts/RequestData.js +1 -1
- package/{dist-esm → dist-es5}/Interfaces/Contracts/SeverityLevel.js +1 -1
- package/dist-es5/Interfaces/IAppInsights.js +8 -0
- package/{dist-esm → dist-es5}/Interfaces/IConfig.js +1 -1
- package/dist-es5/Interfaces/ICorrelationConfig.js +8 -0
- package/dist-es5/Interfaces/IDependencyTelemetry.js +8 -0
- package/dist-es5/Interfaces/IEventTelemetry.js +6 -0
- package/dist-es5/Interfaces/IExceptionTelemetry.js +8 -0
- package/dist-es5/Interfaces/IMetricTelemetry.js +6 -0
- package/dist-es5/Interfaces/IPageViewPerformanceTelemetry.js +6 -0
- package/dist-es5/Interfaces/IPageViewTelemetry.js +6 -0
- package/dist-es5/Interfaces/IPartC.js +8 -0
- package/dist-es5/Interfaces/IPropertiesPlugin.js +8 -0
- package/dist-es5/Interfaces/IRequestContext.js +6 -0
- package/dist-es5/Interfaces/ITelemetryContext.js +8 -0
- package/dist-es5/Interfaces/IThrottleMgr.js +6 -0
- package/dist-es5/Interfaces/ITraceTelemetry.js +8 -0
- package/{dist-esm → dist-es5}/Interfaces/PartAExtensions.js +1 -1
- package/dist-es5/Interfaces/Telemetry/IEnvelope.js +8 -0
- package/dist-es5/Interfaces/Telemetry/ISerializable.js +8 -0
- package/{dist-esm → dist-es5}/RequestResponseHeaders.js +1 -1
- package/{dist-esm → dist-es5}/StorageHelperFuncs.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Common/Data.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Common/DataPoint.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Common/DataSanitizer.js +3 -2
- package/dist-es5/Telemetry/Common/DataSanitizer.js.map +1 -0
- package/{dist-esm → dist-es5}/Telemetry/Common/Envelope.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Event.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Exception.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Metric.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/PageView.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/PageViewPerformance.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/RemoteDependencyData.js +1 -1
- package/{dist-esm → dist-es5}/Telemetry/Trace.js +1 -1
- package/{dist-esm → dist-es5}/TelemetryItemCreator.js +1 -1
- package/{dist-esm → dist-es5}/ThrottleMgr.js +1 -1
- package/{dist-esm → dist-es5}/UrlHelperFuncs.js +1 -1
- package/{dist-esm → dist-es5}/Util.js +1 -1
- package/{dist-esm → dist-es5}/__DynamicConstants.js +1 -1
- package/{dist-esm → dist-es5}/applicationinsights-common.js +1 -1
- package/package.json +18 -17
- package/tsconfig.json +4 -3
- package/types/applicationinsights-common.d.ts +2561 -58
- package/{dist/applicationinsights-common.d.ts → types/applicationinsights-common.namespaced.d.ts} +1 -1
- package/browser/applicationinsights-common.integrity.json +0 -26
- package/browser/applicationinsights-common.js.map +0 -1
- package/browser/applicationinsights-common.min.js +0 -6
- package/browser/applicationinsights-common.min.js.map +0 -1
- package/dist/applicationinsights-common.api.json +0 -19540
- package/dist/applicationinsights-common.api.md +0 -1224
- package/dist/applicationinsights-common.js.map +0 -1
- package/dist/applicationinsights-common.min.js +0 -6
- package/dist/applicationinsights-common.min.js.map +0 -1
- package/dist/applicationinsights-common.rollup.d.ts +0 -2562
- package/dist-esm/Interfaces/ConnectionString.js +0 -6
- package/dist-esm/Interfaces/Context/IApplication.js +0 -8
- package/dist-esm/Interfaces/Context/IDevice.js +0 -8
- package/dist-esm/Interfaces/Context/IInternal.js +0 -8
- package/dist-esm/Interfaces/Context/ILocation.js +0 -8
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +0 -8
- package/dist-esm/Interfaces/Context/ISample.js +0 -8
- package/dist-esm/Interfaces/Context/ISession.js +0 -8
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +0 -8
- package/dist-esm/Interfaces/Context/IUser.js +0 -8
- package/dist-esm/Interfaces/Context/IWeb.js +0 -8
- package/dist-esm/Interfaces/Contracts/DataPointType.js +0 -8
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +0 -8
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +0 -8
- package/dist-esm/Interfaces/Contracts/IBase.js +0 -8
- package/dist-esm/Interfaces/Contracts/IData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +0 -6
- package/dist-esm/Interfaces/Contracts/IDomain.js +0 -8
- package/dist-esm/Interfaces/Contracts/IEventData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +0 -8
- package/dist-esm/Interfaces/Contracts/IMessageData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IMetricData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +0 -8
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +0 -8
- package/dist-esm/Interfaces/IAppInsights.js +0 -8
- package/dist-esm/Interfaces/ICorrelationConfig.js +0 -8
- package/dist-esm/Interfaces/IDependencyTelemetry.js +0 -8
- package/dist-esm/Interfaces/IEventTelemetry.js +0 -6
- package/dist-esm/Interfaces/IExceptionTelemetry.js +0 -8
- package/dist-esm/Interfaces/IMetricTelemetry.js +0 -6
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +0 -6
- package/dist-esm/Interfaces/IPageViewTelemetry.js +0 -6
- package/dist-esm/Interfaces/IPartC.js +0 -8
- package/dist-esm/Interfaces/IPropertiesPlugin.js +0 -8
- package/dist-esm/Interfaces/IRequestContext.js +0 -6
- package/dist-esm/Interfaces/ITelemetryContext.js +0 -8
- package/dist-esm/Interfaces/IThrottleMgr.js +0 -6
- package/dist-esm/Interfaces/ITraceTelemetry.js +0 -8
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +0 -8
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +0 -8
- package/dist-esm/Telemetry/Common/DataSanitizer.js.map +0 -1
- package/src/ConnectionStringParser.ts +0 -47
- package/src/Constants.ts +0 -18
- package/src/DomHelperFuncs.ts +0 -19
- package/src/Enums.ts +0 -65
- package/src/HelperFuncs.ts +0 -54
- package/src/Interfaces/ConnectionString.ts +0 -3
- package/src/Interfaces/Context/IApplication.ts +0 -14
- package/src/Interfaces/Context/IDevice.ts +0 -28
- package/src/Interfaces/Context/IInternal.ts +0 -29
- package/src/Interfaces/Context/ILocation.ts +0 -9
- package/src/Interfaces/Context/IOperatingSystem.ts +0 -7
- package/src/Interfaces/Context/ISample.ts +0 -13
- package/src/Interfaces/Context/ISession.ts +0 -22
- package/src/Interfaces/Context/ITelemetryTrace.ts +0 -33
- package/src/Interfaces/Context/IUser.ts +0 -50
- package/src/Interfaces/Context/IWeb.ts +0 -39
- package/src/Interfaces/Contracts/AvailabilityData.ts +0 -57
- package/src/Interfaces/Contracts/ContextTagKeys.ts +0 -299
- package/src/Interfaces/Contracts/DataPointType.ts +0 -10
- package/src/Interfaces/Contracts/DependencyKind.ts +0 -11
- package/src/Interfaces/Contracts/DependencySourceType.ts +0 -11
- package/src/Interfaces/Contracts/IBase.ts +0 -13
- package/src/Interfaces/Contracts/IData.ts +0 -19
- package/src/Interfaces/Contracts/IDataPoint.ts +0 -44
- package/src/Interfaces/Contracts/IDomain.ts +0 -8
- package/src/Interfaces/Contracts/IEnvelope.ts +0 -50
- package/src/Interfaces/Contracts/IEventData.ts +0 -30
- package/src/Interfaces/Contracts/IExceptionData.ts +0 -37
- package/src/Interfaces/Contracts/IExceptionDetails.ts +0 -45
- package/src/Interfaces/Contracts/IMessageData.ts +0 -36
- package/src/Interfaces/Contracts/IMetricData.ts +0 -31
- package/src/Interfaces/Contracts/IPageViewData.ts +0 -26
- package/src/Interfaces/Contracts/IPageViewPerfData.ts +0 -35
- package/src/Interfaces/Contracts/IRemoteDependencyData.ts +0 -65
- package/src/Interfaces/Contracts/IStackFrame.ts +0 -33
- package/src/Interfaces/Contracts/RequestData.ts +0 -50
- package/src/Interfaces/Contracts/SeverityLevel.ts +0 -28
- package/src/Interfaces/IAppInsights.ts +0 -31
- package/src/Interfaces/IConfig.ts +0 -396
- package/src/Interfaces/ICorrelationConfig.ts +0 -71
- package/src/Interfaces/IDependencyTelemetry.ts +0 -22
- package/src/Interfaces/IEventTelemetry.ts +0 -20
- package/src/Interfaces/IExceptionTelemetry.ts +0 -143
- package/src/Interfaces/IMetricTelemetry.ts +0 -56
- package/src/Interfaces/IPageViewPerformanceTelemetry.ts +0 -61
- package/src/Interfaces/IPageViewTelemetry.ts +0 -65
- package/src/Interfaces/IPartC.ts +0 -18
- package/src/Interfaces/IPropertiesPlugin.ts +0 -8
- package/src/Interfaces/IRequestContext.ts +0 -6
- package/src/Interfaces/ITelemetryContext.ts +0 -69
- package/src/Interfaces/IThrottleMgr.ts +0 -111
- package/src/Interfaces/ITraceTelemetry.ts +0 -28
- package/src/Interfaces/PartAExtensions.ts +0 -14
- package/src/Interfaces/Telemetry/IEnvelope.ts +0 -47
- package/src/Interfaces/Telemetry/ISerializable.ts +0 -11
- package/src/RequestResponseHeaders.ts +0 -96
- package/src/StorageHelperFuncs.ts +0 -223
- package/src/Telemetry/Common/Data.ts +0 -35
- package/src/Telemetry/Common/DataPoint.ts +0 -58
- package/src/Telemetry/Common/DataSanitizer.ts +0 -197
- package/src/Telemetry/Common/Envelope.ts +0 -81
- package/src/Telemetry/Event.ts +0 -52
- package/src/Telemetry/Exception.ts +0 -681
- package/src/Telemetry/Metric.ts +0 -61
- package/src/Telemetry/PageView.ts +0 -79
- package/src/Telemetry/PageViewPerformance.ts +0 -113
- package/src/Telemetry/RemoteDependencyData.ts +0 -122
- package/src/Telemetry/Trace.ts +0 -64
- package/src/TelemetryItemCreator.ts +0 -75
- package/src/ThrottleMgr.ts +0 -345
- package/src/UrlHelperFuncs.ts +0 -101
- package/src/Util.ts +0 -221
- package/src/__DynamicConstants.ts +0 -50
- package/src/applicationinsights-common.ts +0 -76
- package/types/ConnectionStringParser.d.ts +0 -5
- package/types/Constants.d.ts +0 -15
- package/types/DomHelperFuncs.d.ts +0 -1
- package/types/Enums.d.ts +0 -49
- package/types/HelperFuncs.d.ts +0 -8
- package/types/Interfaces/ConnectionString.d.ts +0 -4
- package/types/Interfaces/Context/IApplication.d.ts +0 -10
- package/types/Interfaces/Context/IDevice.d.ts +0 -22
- package/types/Interfaces/Context/IInternal.d.ts +0 -23
- package/types/Interfaces/Context/ILocation.d.ts +0 -6
- package/types/Interfaces/Context/IOperatingSystem.d.ts +0 -3
- package/types/Interfaces/Context/ISample.d.ts +0 -8
- package/types/Interfaces/Context/ISession.d.ts +0 -17
- package/types/Interfaces/Context/ITelemetryTrace.d.ts +0 -25
- package/types/Interfaces/Context/IUser.d.ts +0 -39
- package/types/Interfaces/Context/IWeb.d.ts +0 -30
- package/types/Interfaces/Contracts/AvailabilityData.d.ts +0 -0
- package/types/Interfaces/Contracts/ContextTagKeys.d.ts +0 -175
- package/types/Interfaces/Contracts/DataPointType.d.ts +0 -7
- package/types/Interfaces/Contracts/DependencyKind.d.ts +0 -8
- package/types/Interfaces/Contracts/DependencySourceType.d.ts +0 -8
- package/types/Interfaces/Contracts/IBase.d.ts +0 -9
- package/types/Interfaces/Contracts/IData.d.ts +0 -14
- package/types/Interfaces/Contracts/IDataPoint.d.ts +0 -34
- package/types/Interfaces/Contracts/IDomain.d.ts +0 -5
- package/types/Interfaces/Contracts/IEnvelope.d.ts +0 -0
- package/types/Interfaces/Contracts/IEventData.d.ts +0 -22
- package/types/Interfaces/Contracts/IExceptionData.d.ts +0 -28
- package/types/Interfaces/Contracts/IExceptionDetails.d.ts +0 -34
- package/types/Interfaces/Contracts/IMessageData.d.ts +0 -27
- package/types/Interfaces/Contracts/IMetricData.d.ts +0 -23
- package/types/Interfaces/Contracts/IPageViewData.d.ts +0 -18
- package/types/Interfaces/Contracts/IPageViewPerfData.d.ts +0 -26
- package/types/Interfaces/Contracts/IRemoteDependencyData.d.ts +0 -50
- package/types/Interfaces/Contracts/IStackFrame.d.ts +0 -25
- package/types/Interfaces/Contracts/RequestData.d.ts +0 -0
- package/types/Interfaces/Contracts/SeverityLevel.d.ts +0 -15
- package/types/Interfaces/IAppInsights.d.ts +0 -37
- package/types/Interfaces/IConfig.d.ts +0 -323
- package/types/Interfaces/ICorrelationConfig.d.ts +0 -59
- package/types/Interfaces/IDependencyTelemetry.d.ts +0 -17
- package/types/Interfaces/IEventTelemetry.d.ts +0 -15
- package/types/Interfaces/IExceptionTelemetry.d.ts +0 -123
- package/types/Interfaces/IMetricTelemetry.d.ts +0 -46
- package/types/Interfaces/IPageViewPerformanceTelemetry.d.ts +0 -55
- package/types/Interfaces/IPageViewTelemetry.d.ts +0 -52
- package/types/Interfaces/IPartC.d.ts +0 -18
- package/types/Interfaces/IPropertiesPlugin.d.ts +0 -4
- package/types/Interfaces/IRequestContext.d.ts +0 -6
- package/types/Interfaces/ITelemetryContext.d.ts +0 -55
- package/types/Interfaces/IThrottleMgr.d.ts +0 -96
- package/types/Interfaces/ITraceTelemetry.d.ts +0 -22
- package/types/Interfaces/PartAExtensions.d.ts +0 -12
- package/types/Interfaces/Telemetry/IEnvelope.d.ts +0 -37
- package/types/Interfaces/Telemetry/ISerializable.d.ts +0 -8
- package/types/RequestResponseHeaders.d.ts +0 -68
- package/types/StorageHelperFuncs.d.ts +0 -23
- package/types/Telemetry/Common/Data.d.ts +0 -24
- package/types/Telemetry/Common/DataPoint.d.ts +0 -46
- package/types/Telemetry/Common/DataSanitizer.d.ts +0 -42
- package/types/Telemetry/Common/Envelope.d.ts +0 -45
- package/types/Telemetry/Event.d.ts +0 -34
- package/types/Telemetry/Exception.d.ts +0 -150
- package/types/Telemetry/Metric.d.ts +0 -36
- package/types/Telemetry/PageView.d.ts +0 -53
- package/types/Telemetry/PageViewPerformance.d.ts +0 -78
- package/types/Telemetry/RemoteDependencyData.d.ts +0 -79
- package/types/Telemetry/Trace.d.ts +0 -41
- package/types/TelemetryItemCreator.d.ts +0 -27
- package/types/ThrottleMgr.d.ts +0 -13
- package/types/UrlHelperFuncs.d.ts +0 -6
- package/types/Util.d.ts +0 -36
- package/types/__DynamicConstants.d.ts +0 -38
- package/types/tsdoc-metadata.json +0 -11
- /package/{dist-esm → dist-es5}/ConnectionStringParser.js.map +0 -0
- /package/{dist-esm → dist-es5}/Constants.js.map +0 -0
- /package/{dist-esm → dist-es5}/DomHelperFuncs.js.map +0 -0
- /package/{dist-esm → dist-es5}/Enums.js.map +0 -0
- /package/{dist-esm → dist-es5}/HelperFuncs.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/ConnectionString.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IApplication.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IDevice.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IInternal.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/ILocation.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IOperatingSystem.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/ISample.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/ISession.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/ITelemetryTrace.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IUser.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Context/IWeb.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/AvailabilityData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/ContextTagKeys.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/DataPointType.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/DependencyKind.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/DependencySourceType.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IBase.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IDataPoint.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IDomain.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IEnvelope.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IEventData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IExceptionData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IExceptionDetails.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IMessageData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IMetricData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IPageViewData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IPageViewPerfData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IRemoteDependencyData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/IStackFrame.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/RequestData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Contracts/SeverityLevel.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IAppInsights.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IConfig.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/ICorrelationConfig.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IDependencyTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IEventTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IExceptionTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IMetricTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IPageViewPerformanceTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IPageViewTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IPartC.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IPropertiesPlugin.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IRequestContext.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/ITelemetryContext.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/IThrottleMgr.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/ITraceTelemetry.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/PartAExtensions.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Telemetry/IEnvelope.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Telemetry/ISerializable.js.map +0 -0
- /package/{dist-esm → dist-es5}/RequestResponseHeaders.js.map +0 -0
- /package/{dist-esm → dist-es5}/StorageHelperFuncs.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Common/Data.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Common/DataPoint.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Common/Envelope.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Event.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Exception.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Metric.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/PageView.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/PageViewPerformance.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/RemoteDependencyData.js.map +0 -0
- /package/{dist-esm → dist-es5}/Telemetry/Trace.js.map +0 -0
- /package/{dist-esm → dist-es5}/TelemetryItemCreator.js.map +0 -0
- /package/{dist-esm → dist-es5}/ThrottleMgr.js.map +0 -0
- /package/{dist-esm → dist-es5}/UrlHelperFuncs.js.map +0 -0
- /package/{dist-esm → dist-es5}/Util.js.map +0 -0
- /package/{dist-esm → dist-es5}/__DynamicConstants.js.map +0 -0
- /package/{dist-esm → dist-es5}/applicationinsights-common.js.map +0 -0
package/src/ThrottleMgr.ts
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IAppInsightsCore, IDiagnosticLogger, IUnloadHookContainer, _eInternalMessageId, _throwInternal, arrForEach, arrIndexOf,
|
|
3
|
-
createDynamicConfig, createUnloadHookContainer, eLoggingSeverity, isNotNullOrUndefined, isNullOrUndefined, onConfigChange, randomValue,
|
|
4
|
-
safeGetLogger, strTrim
|
|
5
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
6
|
-
import { IThrottleMsgKey } from "./Enums";
|
|
7
|
-
import { IThrottleInterval, IThrottleLocalStorageObj, IThrottleMgrConfig, IThrottleResult } from "./Interfaces/IThrottleMgr";
|
|
8
|
-
import { utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage } from "./StorageHelperFuncs";
|
|
9
|
-
|
|
10
|
-
const THROTTLE_STORAGE_PREFIX = "appInsightsThrottle";
|
|
11
|
-
|
|
12
|
-
interface SendMsgParameter {
|
|
13
|
-
msgID: _eInternalMessageId,
|
|
14
|
-
message: string,
|
|
15
|
-
severity?: eLoggingSeverity
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class ThrottleMgr {
|
|
19
|
-
public canThrottle: () => boolean;
|
|
20
|
-
public sendMessage: (msgID: _eInternalMessageId, message: string, severity?: eLoggingSeverity) => IThrottleResult | null;
|
|
21
|
-
public getConfig: () => IThrottleMgrConfig;
|
|
22
|
-
public isTriggered: () => boolean; // this function is to get previous triggered status
|
|
23
|
-
public isReady: () => boolean
|
|
24
|
-
public onReadyState: (isReady?: boolean) => boolean;
|
|
25
|
-
public flush: () => boolean;
|
|
26
|
-
public config: IThrottleMgrConfig;
|
|
27
|
-
|
|
28
|
-
constructor(config?: IThrottleMgrConfig, core?: IAppInsightsCore, namePrefix?: string, unloadHookContainer?: IUnloadHookContainer) {
|
|
29
|
-
let _self = this;
|
|
30
|
-
let _canUseLocalStorage: boolean;
|
|
31
|
-
let _logger: IDiagnosticLogger | null | undefined;
|
|
32
|
-
let _config: IThrottleMgrConfig;
|
|
33
|
-
let _localStorageName: string | null;
|
|
34
|
-
let _localStorageObj: IThrottleLocalStorageObj | null | undefined;
|
|
35
|
-
let _isTriggered: boolean; //_isTriggered is to make sure that we only trigger throttle once a day
|
|
36
|
-
let _namePrefix: string;
|
|
37
|
-
let _queue: Array<SendMsgParameter>;
|
|
38
|
-
let _isReady: boolean = false;
|
|
39
|
-
let _isSpecificDaysGiven: boolean = false;
|
|
40
|
-
|
|
41
|
-
_initConfig();
|
|
42
|
-
|
|
43
|
-
// Special internal method to allow the unit tests and DebugPlugin to hook embedded objects
|
|
44
|
-
_self["_getDbgPlgTargets"] = () => {
|
|
45
|
-
return [_queue];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
_self.getConfig = (): IThrottleMgrConfig => {
|
|
49
|
-
return _config;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Check if it is the correct day to send message.
|
|
54
|
-
* If _isTriggered is true, even if canThrottle returns true, message will not be sent,
|
|
55
|
-
* because we only allow triggering sendMessage() once a day.
|
|
56
|
-
* @returns if the current date is the valid date to send message
|
|
57
|
-
*/
|
|
58
|
-
_self.canThrottle = (): boolean => {
|
|
59
|
-
return _canThrottle(_config, _canUseLocalStorage, _localStorageObj);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Check if throttle is triggered on current day(UTC)
|
|
64
|
-
* if canThrottle returns false, isTriggered will return false
|
|
65
|
-
* @returns if throttle is triggered on current day(UTC)
|
|
66
|
-
*/
|
|
67
|
-
_self.isTriggered = (): boolean => {
|
|
68
|
-
return _isTriggered;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Before isReady set to true, all message will be stored in queue.
|
|
73
|
-
* Message will only be sent out after isReady set to true.
|
|
74
|
-
* Initial and default value: false
|
|
75
|
-
* @returns isReady state
|
|
76
|
-
*/
|
|
77
|
-
_self.isReady = (): boolean => {
|
|
78
|
-
return _isReady;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Flush all message in queue with isReady state set to true.
|
|
83
|
-
* @returns if message queue is flushed
|
|
84
|
-
*/
|
|
85
|
-
_self.flush = (): boolean => {
|
|
86
|
-
try {
|
|
87
|
-
if (_isReady && _queue.length > 0) {
|
|
88
|
-
let items = _queue.slice(0);
|
|
89
|
-
_queue = [];
|
|
90
|
-
arrForEach(items, (item: SendMsgParameter) => {
|
|
91
|
-
_flushMessage(item.msgID, item.message, item.severity, false);
|
|
92
|
-
});
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
} catch(err) {
|
|
96
|
-
// eslint-disable-next-line no-empty
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Set isReady State
|
|
103
|
-
* if isReady set to true, message queue will be flushed automatically.
|
|
104
|
-
* @param isReady isReady State
|
|
105
|
-
* @returns if message queue is flushed
|
|
106
|
-
*/
|
|
107
|
-
_self.onReadyState = (isReady?: boolean): boolean => {
|
|
108
|
-
_isReady = isNullOrUndefined(isReady)? true : isReady;
|
|
109
|
-
return _self.flush();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
_self.sendMessage = (msgID: _eInternalMessageId, message: string, severity?: eLoggingSeverity): IThrottleResult | null => {
|
|
113
|
-
return _flushMessage(msgID, message, severity, true);
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function _flushMessage(msgID: _eInternalMessageId, message: string, severity?: eLoggingSeverity, saveUnsentMsg?: boolean) {
|
|
118
|
-
if (_isReady) {
|
|
119
|
-
let isSampledIn = _canSampledIn();
|
|
120
|
-
if (!isSampledIn) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
let canThrottle = _canThrottle(_config, _canUseLocalStorage, _localStorageObj);
|
|
124
|
-
let throttled = false;
|
|
125
|
-
let number = 0;
|
|
126
|
-
try {
|
|
127
|
-
if (canThrottle && !_isTriggered) {
|
|
128
|
-
number = Math.min(_config.limit.maxSendNumber, _localStorageObj.count + 1);
|
|
129
|
-
_localStorageObj.count = 0;
|
|
130
|
-
throttled = true;
|
|
131
|
-
_isTriggered = true;
|
|
132
|
-
_localStorageObj.preTriggerDate = new Date();
|
|
133
|
-
} else {
|
|
134
|
-
_isTriggered = canThrottle;
|
|
135
|
-
_localStorageObj.count += 1;
|
|
136
|
-
}
|
|
137
|
-
_resetLocalStorage(_logger, _localStorageName, _localStorageObj);
|
|
138
|
-
for (let i = 0; i < number; i++) {
|
|
139
|
-
_sendMessage(msgID, _logger, message, severity);
|
|
140
|
-
}
|
|
141
|
-
} catch(e) {
|
|
142
|
-
// eslint-disable-next-line no-empty
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
isThrottled: throttled,
|
|
146
|
-
throttleNum: number
|
|
147
|
-
} as IThrottleResult;
|
|
148
|
-
} else {
|
|
149
|
-
if (!!saveUnsentMsg) {
|
|
150
|
-
_queue.push({
|
|
151
|
-
msgID: msgID,
|
|
152
|
-
message: message,
|
|
153
|
-
severity: severity
|
|
154
|
-
} as SendMsgParameter);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function _initConfig() {
|
|
161
|
-
_logger = safeGetLogger(core);
|
|
162
|
-
_isTriggered = false;
|
|
163
|
-
_queue = [];
|
|
164
|
-
_namePrefix = isNotNullOrUndefined(namePrefix)? namePrefix : "";
|
|
165
|
-
unloadHookContainer = unloadHookContainer || createUnloadHookContainer();
|
|
166
|
-
// Make sure the root config is dynamic as it may be the global config
|
|
167
|
-
config = createDynamicConfig(config as any || {}, null, _logger).cfg;
|
|
168
|
-
|
|
169
|
-
let unloadHook = onConfigChange((config), () => {
|
|
170
|
-
_canUseLocalStorage = utlCanUseLocalStorage();
|
|
171
|
-
|
|
172
|
-
let configMgr = config || {};
|
|
173
|
-
_config = {} as any;
|
|
174
|
-
_config.disabled = !!configMgr.disabled;
|
|
175
|
-
|
|
176
|
-
_config.msgKey = configMgr.msgKey || IThrottleMsgKey.default;
|
|
177
|
-
|
|
178
|
-
let configInterval = configMgr.interval || {};
|
|
179
|
-
_isSpecificDaysGiven = configInterval?.daysOfMonth && configInterval?.daysOfMonth.length > 0;
|
|
180
|
-
_config.interval = _getIntervalConfig(configInterval);
|
|
181
|
-
|
|
182
|
-
let limit = {
|
|
183
|
-
samplingRate: configMgr.limit?.samplingRate || 100,
|
|
184
|
-
// dafault: every time sent only 1 event
|
|
185
|
-
maxSendNumber: configMgr.limit?.maxSendNumber || 1
|
|
186
|
-
};
|
|
187
|
-
_config.limit = limit;
|
|
188
|
-
_localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);
|
|
189
|
-
|
|
190
|
-
if (_canUseLocalStorage && _localStorageName) {
|
|
191
|
-
_localStorageObj = _getLocalStorageObj(utlGetLocalStorage(_logger, _localStorageName), _logger, _localStorageName);
|
|
192
|
-
}
|
|
193
|
-
if (_localStorageObj) {
|
|
194
|
-
_isTriggered = _isTriggeredOnCurDate(_localStorageObj.preTriggerDate);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
unloadHookContainer && unloadHookContainer.add(unloadHook);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function _getIntervalConfig(interval: IThrottleInterval) {
|
|
201
|
-
interval = interval || {};
|
|
202
|
-
let monthInterval = interval?.monthInterval;
|
|
203
|
-
let dayInterval = interval?.dayInterval;
|
|
204
|
-
|
|
205
|
-
// default: send data every 3 month each year
|
|
206
|
-
if (isNullOrUndefined(monthInterval) && isNullOrUndefined(dayInterval)) {
|
|
207
|
-
interval.monthInterval = 3;
|
|
208
|
-
if (!_isSpecificDaysGiven) {
|
|
209
|
-
// default: send data on 28th
|
|
210
|
-
interval.daysOfMonth = [28];
|
|
211
|
-
_isSpecificDaysGiven = true;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
interval = {
|
|
215
|
-
// dafault: sent every three months
|
|
216
|
-
monthInterval: interval?.monthInterval,
|
|
217
|
-
dayInterval: interval?.dayInterval,
|
|
218
|
-
daysOfMonth: interval?.daysOfMonth
|
|
219
|
-
} as IThrottleInterval;
|
|
220
|
-
return interval;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function _canThrottle(config: IThrottleMgrConfig, canUseLocalStorage: boolean, localStorageObj: IThrottleLocalStorageObj) {
|
|
224
|
-
if (!config.disabled && canUseLocalStorage && isNotNullOrUndefined(localStorageObj)) {
|
|
225
|
-
let curDate = _getThrottleDate();
|
|
226
|
-
let date = localStorageObj.date;
|
|
227
|
-
let interval = config.interval;
|
|
228
|
-
let monthCheck = 1;
|
|
229
|
-
if (interval?.monthInterval) {
|
|
230
|
-
let monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth();
|
|
231
|
-
monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
let dayCheck = 1;
|
|
235
|
-
if (_isSpecificDaysGiven) {
|
|
236
|
-
dayCheck = arrIndexOf(interval.daysOfMonth, curDate.getUTCDate());
|
|
237
|
-
} else if (interval?.dayInterval) {
|
|
238
|
-
let daySpan = Math.floor((curDate.getTime() - date.getTime()) / 86400000);
|
|
239
|
-
dayCheck = _checkInterval(interval.dayInterval, 0, daySpan);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return monthCheck >= 0 && dayCheck >= 0;
|
|
243
|
-
}
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function _getLocalStorageName(msgKey: IThrottleMsgKey, prefix?: string) {
|
|
248
|
-
let fix = isNotNullOrUndefined(prefix)? prefix : "";
|
|
249
|
-
if (msgKey) {
|
|
250
|
-
return THROTTLE_STORAGE_PREFIX + fix + "-" + msgKey;
|
|
251
|
-
}
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// returns if throttle is triggered on current Date
|
|
256
|
-
function _isTriggeredOnCurDate(preTriggerDate?: Date) {
|
|
257
|
-
try {
|
|
258
|
-
if(preTriggerDate) {
|
|
259
|
-
let curDate = new Date();
|
|
260
|
-
return preTriggerDate.getUTCFullYear() === curDate.getUTCFullYear() &&
|
|
261
|
-
preTriggerDate.getUTCMonth() === curDate.getUTCMonth() &&
|
|
262
|
-
preTriggerDate.getUTCDate() === curDate.getUTCDate();
|
|
263
|
-
}
|
|
264
|
-
} catch (e) {
|
|
265
|
-
// eslint-disable-next-line no-empty
|
|
266
|
-
}
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// transfer local storage string value to object that identifies start date, current count and preTriggerDate
|
|
271
|
-
function _getLocalStorageObj(value: string, logger: IDiagnosticLogger, storageName: string) {
|
|
272
|
-
try {
|
|
273
|
-
let storageObj = {
|
|
274
|
-
date: _getThrottleDate(),
|
|
275
|
-
count: 0
|
|
276
|
-
} as IThrottleLocalStorageObj;
|
|
277
|
-
if (value) {
|
|
278
|
-
let obj = JSON.parse(value);
|
|
279
|
-
return {
|
|
280
|
-
date: _getThrottleDate(obj.date) || storageObj.date,
|
|
281
|
-
count: obj.count || storageObj.count,
|
|
282
|
-
preTriggerDate: obj.preTriggerDate? _getThrottleDate(obj.preTriggerDate) : undefined
|
|
283
|
-
} as IThrottleLocalStorageObj;
|
|
284
|
-
} else {
|
|
285
|
-
_resetLocalStorage(logger, storageName, storageObj);
|
|
286
|
-
return storageObj;
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
} catch(e) {
|
|
290
|
-
// eslint-disable-next-line no-empty
|
|
291
|
-
}
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// if datestr is not defined, current date will be returned
|
|
296
|
-
function _getThrottleDate(dateStr?: string) {
|
|
297
|
-
// if new Date() can't be created through the provided dateStr, null will be returned.
|
|
298
|
-
try {
|
|
299
|
-
if (dateStr) {
|
|
300
|
-
let date = new Date(dateStr);
|
|
301
|
-
//make sure it is a valid Date Object
|
|
302
|
-
if (!isNaN(date.getDate())) {
|
|
303
|
-
return date;
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
return new Date();
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
} catch (e) {
|
|
310
|
-
// eslint-disable-next-line no-empty
|
|
311
|
-
}
|
|
312
|
-
return null;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
function _resetLocalStorage(logger: IDiagnosticLogger, storageName: string, obj: IThrottleLocalStorageObj) {
|
|
316
|
-
try {
|
|
317
|
-
return utlSetLocalStorage(logger, storageName, strTrim(JSON.stringify(obj)));
|
|
318
|
-
} catch (e) {
|
|
319
|
-
// // eslint-disable-next-line no-empty
|
|
320
|
-
}
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function _checkInterval(interval: number, start: number, current: number) {
|
|
325
|
-
if (interval <= 0) {
|
|
326
|
-
return 1;
|
|
327
|
-
}
|
|
328
|
-
// count from start year
|
|
329
|
-
return (current >= start) && (current - start) % interval == 0 ? Math.floor((current - start) / interval) + 1 : -1;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function _sendMessage(msgID: _eInternalMessageId, logger: IDiagnosticLogger, message: string, severity?: eLoggingSeverity) {
|
|
333
|
-
_throwInternal(logger,
|
|
334
|
-
severity || eLoggingSeverity.CRITICAL,
|
|
335
|
-
msgID,
|
|
336
|
-
message);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// NOTE: config.limit.samplingRate is set to 4 decimal places,
|
|
340
|
-
// so config.limit.samplingRate = 1 means 0.0001%
|
|
341
|
-
function _canSampledIn() {
|
|
342
|
-
return randomValue(1000000) <= _config.limit.samplingRate;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
package/src/UrlHelperFuncs.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { getDocument, isString } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
|
|
6
|
-
let _document: any = getDocument() || {};
|
|
7
|
-
|
|
8
|
-
let _htmlAnchorIdx: number = 0;
|
|
9
|
-
// Use an array of temporary values as it's possible for multiple calls to parseUrl() will be called with different URLs
|
|
10
|
-
// Using a cache size of 5 for now as it current depth usage is at least 2, so adding a minor buffer to handle future updates
|
|
11
|
-
let _htmlAnchorElement: HTMLAnchorElement[] = [null, null, null, null, null];
|
|
12
|
-
|
|
13
|
-
export function urlParseUrl(url: string): HTMLAnchorElement {
|
|
14
|
-
let anchorIdx = _htmlAnchorIdx;
|
|
15
|
-
let anchorCache = _htmlAnchorElement;
|
|
16
|
-
let tempAnchor = anchorCache[anchorIdx];
|
|
17
|
-
if (!_document.createElement) {
|
|
18
|
-
// Always create the temp instance if createElement is not available
|
|
19
|
-
tempAnchor = { host: urlParseHost(url, true) } as HTMLAnchorElement;
|
|
20
|
-
} else if (!anchorCache[anchorIdx]) {
|
|
21
|
-
// Create and cache the unattached anchor instance
|
|
22
|
-
tempAnchor = anchorCache[anchorIdx] = _document.createElement("a");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
tempAnchor.href = url;
|
|
26
|
-
|
|
27
|
-
// Move the cache index forward
|
|
28
|
-
anchorIdx++;
|
|
29
|
-
if (anchorIdx >= anchorCache.length) {
|
|
30
|
-
anchorIdx = 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_htmlAnchorIdx = anchorIdx;
|
|
34
|
-
|
|
35
|
-
return tempAnchor;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function urlGetAbsoluteUrl(url: string): string {
|
|
39
|
-
let result: string;
|
|
40
|
-
const a = urlParseUrl(url);
|
|
41
|
-
if (a) {
|
|
42
|
-
result = a.href;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function urlGetPathName(url: string): string {
|
|
49
|
-
let result: string;
|
|
50
|
-
const a = urlParseUrl(url);
|
|
51
|
-
if (a) {
|
|
52
|
-
result = a.pathname;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function urlGetCompleteUrl(method: string, absoluteUrl: string) {
|
|
59
|
-
if (method) {
|
|
60
|
-
return method.toUpperCase() + " " + absoluteUrl;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return absoluteUrl;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Fallback method to grab host from url if document.createElement method is not available
|
|
67
|
-
export function urlParseHost(url: string, inclPort?: boolean) {
|
|
68
|
-
let fullHost = urlParseFullHost(url, inclPort) || "";
|
|
69
|
-
if (fullHost) {
|
|
70
|
-
const match = fullHost.match(/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i);
|
|
71
|
-
if (match != null && match.length > 3 && isString(match[2]) && match[2].length > 0) {
|
|
72
|
-
return match[2] + (match[3] || "");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return fullHost;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function urlParseFullHost(url: string, inclPort?: boolean) {
|
|
80
|
-
let result = null;
|
|
81
|
-
if (url) {
|
|
82
|
-
const match = url.match(/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i);
|
|
83
|
-
if (match != null && match.length > 2 && isString(match[2]) && match[2].length > 0) {
|
|
84
|
-
result = match[2] || "";
|
|
85
|
-
if (inclPort && match.length > 2) {
|
|
86
|
-
const protocol = (match[1] || "").toLowerCase();
|
|
87
|
-
let port = match[3] || "";
|
|
88
|
-
// IE includes the standard port so pass it off if it's the same as the protocol
|
|
89
|
-
if (protocol === "http" && port === ":80") {
|
|
90
|
-
port = "";
|
|
91
|
-
} else if (protocol === "https" && port === ":443") {
|
|
92
|
-
port = "";
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
result += port;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return result;
|
|
101
|
-
}
|
package/src/Util.ts
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
IDiagnosticLogger, IDistributedTraceContext, arrForEach, arrIndexOf, dateNow, getPerformance, isNullOrUndefined, isValidSpanId,
|
|
6
|
-
isValidTraceId
|
|
7
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
8
|
-
import { strIndexOf } from "@nevware21/ts-utils";
|
|
9
|
-
import { DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH } from "./Constants";
|
|
10
|
-
import { ITelemetryTrace } from "./Interfaces/Context/ITelemetryTrace";
|
|
11
|
-
import { ICorrelationConfig } from "./Interfaces/ICorrelationConfig";
|
|
12
|
-
import { RequestHeaders, eRequestHeaders } from "./RequestResponseHeaders";
|
|
13
|
-
import { dataSanitizeString } from "./Telemetry/Common/DataSanitizer";
|
|
14
|
-
import { urlParseFullHost, urlParseUrl } from "./UrlHelperFuncs";
|
|
15
|
-
|
|
16
|
-
// listing only non-geo specific locations
|
|
17
|
-
const _internalEndpoints: string[] = [
|
|
18
|
-
DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH,
|
|
19
|
-
"https://breeze.aimon.applicationinsights.io" + DEFAULT_BREEZE_PATH,
|
|
20
|
-
"https://dc-int.services.visualstudio.com" + DEFAULT_BREEZE_PATH
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
let _correlationIdPrefix: string = "cid-v1:";
|
|
24
|
-
|
|
25
|
-
export function isInternalApplicationInsightsEndpoint(endpointUrl: string): boolean {
|
|
26
|
-
return arrIndexOf(_internalEndpoints, endpointUrl.toLowerCase()) !== -1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function correlationIdSetPrefix(prefix: string) {
|
|
30
|
-
_correlationIdPrefix = prefix;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function correlationIdGetPrefix() {
|
|
34
|
-
return _correlationIdPrefix;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.
|
|
39
|
-
* Headers are always included if the current domain matches the request domain. If they do not match (CORS),
|
|
40
|
-
* they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.
|
|
41
|
-
* Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must
|
|
42
|
-
* manually supply domains to include correlation headers on. Else, no headers will be included at all.
|
|
43
|
-
*/
|
|
44
|
-
export function correlationIdCanIncludeCorrelationHeader(config: ICorrelationConfig, requestUrl: string, currentHost?: string) {
|
|
45
|
-
if (!requestUrl || (config && config.disableCorrelationHeaders)) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (config && config.correlationHeaderExcludePatterns) {
|
|
50
|
-
for (let i = 0; i < config.correlationHeaderExcludePatterns.length; i++) {
|
|
51
|
-
if (config.correlationHeaderExcludePatterns[i].test(requestUrl)) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let requestHost = urlParseUrl(requestUrl).host.toLowerCase();
|
|
58
|
-
if (requestHost && (strIndexOf(requestHost, ":443") !== -1 || strIndexOf(requestHost, ":80") !== -1)) {
|
|
59
|
-
// [Bug #1260] IE can include the port even for http and https URLs so if present
|
|
60
|
-
// try and parse it to remove if it matches the default protocol port
|
|
61
|
-
requestHost = (urlParseFullHost(requestUrl, true) || "").toLowerCase();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const includedDomains = config && config.correlationHeaderDomains;
|
|
69
|
-
if (includedDomains) {
|
|
70
|
-
let matchExists: boolean;
|
|
71
|
-
arrForEach(includedDomains, (domain) => {
|
|
72
|
-
const regex = new RegExp(domain.toLowerCase().replace(/\\/g, "\\\\").replace(/\./g, "\\.").replace(/\*/g, ".*"));
|
|
73
|
-
matchExists = matchExists || regex.test(requestHost);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
if (!matchExists) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const excludedDomains = config && config.correlationHeaderExcludedDomains;
|
|
82
|
-
if (!excludedDomains || excludedDomains.length === 0) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (let i = 0; i < excludedDomains.length; i++) {
|
|
87
|
-
const regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\/g, "\\\\").replace(/\./g, "\\.").replace(/\*/g, ".*"));
|
|
88
|
-
if (regex.test(requestHost)) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// if we don't know anything about the requestHost, require the user to use included/excludedDomains.
|
|
94
|
-
// Previously we always returned false for a falsy requestHost
|
|
95
|
-
return requestHost && requestHost.length > 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Combines target appId and target role name from response header.
|
|
100
|
-
*/
|
|
101
|
-
export function correlationIdGetCorrelationContext(responseHeader: string) {
|
|
102
|
-
if (responseHeader) {
|
|
103
|
-
const correlationId = correlationIdGetCorrelationContextValue(responseHeader, RequestHeaders[eRequestHeaders.requestContextTargetKey]);
|
|
104
|
-
if (correlationId && correlationId !== _correlationIdPrefix) {
|
|
105
|
-
return correlationId;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Gets key from correlation response header
|
|
112
|
-
*/
|
|
113
|
-
export function correlationIdGetCorrelationContextValue(responseHeader: string, key: string) {
|
|
114
|
-
if (responseHeader) {
|
|
115
|
-
const keyValues = responseHeader.split(",");
|
|
116
|
-
for (let i = 0; i < keyValues.length; ++i) {
|
|
117
|
-
const keyValue = keyValues[i].split("=");
|
|
118
|
-
if (keyValue.length === 2 && keyValue[0] === key) {
|
|
119
|
-
return keyValue[1];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function AjaxHelperParseDependencyPath(logger: IDiagnosticLogger, absoluteUrl: string, method: string, commandName: string) {
|
|
126
|
-
let target, name = commandName, data = commandName;
|
|
127
|
-
|
|
128
|
-
if (absoluteUrl && absoluteUrl.length > 0) {
|
|
129
|
-
const parsedUrl: HTMLAnchorElement = urlParseUrl(absoluteUrl);
|
|
130
|
-
target = parsedUrl.host;
|
|
131
|
-
if (!name) {
|
|
132
|
-
if (parsedUrl.pathname != null) {
|
|
133
|
-
let pathName: string = (parsedUrl.pathname.length === 0) ? "/" : parsedUrl.pathname;
|
|
134
|
-
if (pathName.charAt(0) !== "/") {
|
|
135
|
-
pathName = "/" + pathName;
|
|
136
|
-
}
|
|
137
|
-
data = parsedUrl.pathname;
|
|
138
|
-
name = dataSanitizeString(logger, method ? method + " " + pathName : pathName);
|
|
139
|
-
} else {
|
|
140
|
-
name = dataSanitizeString(logger, absoluteUrl);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
target = commandName;
|
|
145
|
-
name = commandName;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
target,
|
|
150
|
-
name,
|
|
151
|
-
data
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function dateTimeUtilsNow() {
|
|
156
|
-
// returns the window or webworker performance object
|
|
157
|
-
let perf = getPerformance();
|
|
158
|
-
if (perf && perf.now && perf.timing) {
|
|
159
|
-
let now = perf.now() + perf.timing.navigationStart;
|
|
160
|
-
// Known issue with IE where this calculation can be negative, so if it is then ignore and fallback
|
|
161
|
-
if (now > 0) {
|
|
162
|
-
return now;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return dateNow();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function dateTimeUtilsDuration(start: number, end: number): number {
|
|
170
|
-
let result = null;
|
|
171
|
-
if (start !== 0 && end !== 0 && !isNullOrUndefined(start) && !isNullOrUndefined(end)) {
|
|
172
|
-
result = end - start;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Creates a IDistributedTraceContext from an optional telemetryTrace
|
|
180
|
-
* @param telemetryTrace - The telemetryTrace instance that is being wrapped
|
|
181
|
-
* @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
|
|
182
|
-
* @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
|
|
183
|
-
*/
|
|
184
|
-
export function createDistributedTraceContextFromTrace(telemetryTrace?: ITelemetryTrace, parentCtx?: IDistributedTraceContext): IDistributedTraceContext {
|
|
185
|
-
let trace: ITelemetryTrace = telemetryTrace || {};
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
getName: (): string => {
|
|
189
|
-
return trace.name;
|
|
190
|
-
},
|
|
191
|
-
setName: (newValue: string): void => {
|
|
192
|
-
parentCtx && parentCtx.setName(newValue);
|
|
193
|
-
trace.name = newValue;
|
|
194
|
-
},
|
|
195
|
-
getTraceId: (): string => {
|
|
196
|
-
return trace.traceID;
|
|
197
|
-
},
|
|
198
|
-
setTraceId: (newValue: string): void => {
|
|
199
|
-
parentCtx && parentCtx.setTraceId(newValue);
|
|
200
|
-
if (isValidTraceId(newValue)) {
|
|
201
|
-
trace.traceID = newValue
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
getSpanId: (): string => {
|
|
205
|
-
return trace.parentID;
|
|
206
|
-
},
|
|
207
|
-
setSpanId: (newValue: string): void => {
|
|
208
|
-
parentCtx && parentCtx.setSpanId(newValue);
|
|
209
|
-
if (isValidSpanId(newValue)) {
|
|
210
|
-
trace.parentID = newValue
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
getTraceFlags: (): number => {
|
|
214
|
-
return trace.traceFlags;
|
|
215
|
-
},
|
|
216
|
-
setTraceFlags: (newTraceFlags?: number): void => {
|
|
217
|
-
parentCtx && parentCtx.setTraceFlags(newTraceFlags);
|
|
218
|
-
trace.traceFlags = newTraceFlags
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|