@microsoft/applicationinsights-common 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
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/applicationinsights-common.integrity.json +9 -9
- package/browser/applicationinsights-common.js +926 -539
- package/browser/applicationinsights-common.js.map +1 -1
- package/browser/applicationinsights-common.min.js +2 -2
- package/browser/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.api.json +2625 -945
- package/dist/applicationinsights-common.api.md +103 -46
- package/dist/applicationinsights-common.d.ts +520 -286
- package/dist/applicationinsights-common.js +926 -539
- package/dist/applicationinsights-common.js.map +1 -1
- package/dist/applicationinsights-common.min.js +2 -2
- package/dist/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.rollup.d.ts +520 -286
- package/dist-esm/ConnectionStringParser.js +1 -1
- package/dist-esm/Constants.js +1 -1
- package/dist-esm/DomHelperFuncs.js +1 -1
- package/dist-esm/Enums.js +11 -24
- package/dist-esm/Enums.js.map +1 -1
- package/dist-esm/HelperFuncs.js +7 -6
- package/dist-esm/HelperFuncs.js.map +1 -1
- package/dist-esm/Interfaces/ConnectionString.js +1 -1
- package/dist-esm/Interfaces/Context/IApplication.js +1 -1
- package/dist-esm/Interfaces/Context/IDevice.js +1 -1
- package/dist-esm/Interfaces/Context/IInternal.js +1 -1
- package/dist-esm/Interfaces/Context/ILocation.js +1 -1
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
- package/dist-esm/Interfaces/Context/ISample.js +1 -1
- package/dist-esm/Interfaces/Context/ISession.js +1 -1
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
- package/dist-esm/Interfaces/Context/IUser.js +1 -1
- package/dist-esm/Interfaces/Context/IWeb.js +1 -1
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js +52 -0
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/{Generated/ContextTagKeys.js → ContextTagKeys.js} +1 -1
- package/dist-esm/Interfaces/Contracts/{Generated/ContextTagKeys.js.map → ContextTagKeys.js.map} +0 -0
- package/dist-esm/Interfaces/Contracts/DataPointType.js +8 -0
- package/dist-esm/Interfaces/Contracts/DataPointType.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +8 -0
- package/dist-esm/Interfaces/Contracts/DependencyKind.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +8 -0
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/{Generated/Domain.js → IBase.js} +2 -2
- package/dist-esm/Interfaces/Contracts/IBase.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +6 -0
- package/dist-esm/Interfaces/Contracts/IDataPoint.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IDomain.js +8 -0
- package/dist-esm/Interfaces/Contracts/IDomain.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +46 -0
- package/dist-esm/Interfaces/Contracts/IEnvelope.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IEventData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IEventData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IExceptionData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +8 -0
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IMessageData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IMessageData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IMetricData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IMetricData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IPageViewData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +8 -0
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +8 -0
- package/dist-esm/Interfaces/Contracts/IStackFrame.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/RequestData.js +46 -0
- package/dist-esm/Interfaces/Contracts/RequestData.js.map +1 -0
- package/dist-esm/Interfaces/Contracts/{Generated/SeverityLevel.js → SeverityLevel.js} +1 -1
- package/dist-esm/Interfaces/Contracts/{Generated/SeverityLevel.js.map → SeverityLevel.js.map} +0 -0
- package/dist-esm/Interfaces/IAppInsights.js +1 -1
- package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
- package/dist-esm/Interfaces/IConfig.js +1 -1
- package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
- package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
- package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
- package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
- package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPartC.js +1 -1
- package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
- package/dist-esm/Interfaces/IRequestContext.js +1 -1
- package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
- package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
- package/dist-esm/Interfaces/PartAExtensions.js +2 -2
- package/dist-esm/Interfaces/PartAExtensions.js.map +1 -1
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
- package/dist-esm/RequestResponseHeaders.js +1 -1
- package/dist-esm/StorageHelperFuncs.js +27 -12
- package/dist-esm/StorageHelperFuncs.js.map +1 -1
- package/dist-esm/Telemetry/Common/Data.js +6 -11
- package/dist-esm/Telemetry/Common/Data.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataPoint.js +8 -9
- package/dist-esm/Telemetry/Common/DataPoint.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataSanitizer.js +10 -10
- package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
- package/dist-esm/Telemetry/Common/Envelope.js +12 -12
- package/dist-esm/Telemetry/Common/Envelope.js.map +1 -1
- package/dist-esm/Telemetry/Event.js +9 -12
- package/dist-esm/Telemetry/Event.js.map +1 -1
- package/dist-esm/Telemetry/Exception.js +74 -81
- package/dist-esm/Telemetry/Exception.js.map +1 -1
- package/dist-esm/Telemetry/Metric.js +9 -12
- package/dist-esm/Telemetry/Metric.js.map +1 -1
- package/dist-esm/Telemetry/PageView.js +12 -15
- package/dist-esm/Telemetry/PageView.js.map +1 -1
- package/dist-esm/Telemetry/PageViewPerformance.js +16 -19
- package/dist-esm/Telemetry/PageViewPerformance.js.map +1 -1
- package/dist-esm/Telemetry/RemoteDependencyData.js +17 -20
- package/dist-esm/Telemetry/RemoteDependencyData.js.map +1 -1
- package/dist-esm/Telemetry/Trace.js +10 -13
- package/dist-esm/Telemetry/Trace.js.map +1 -1
- package/dist-esm/TelemetryItemCreator.js +1 -1
- package/dist-esm/UrlHelperFuncs.js +1 -1
- package/dist-esm/Util.js +1 -1
- package/dist-esm/applicationinsights-common.js +4 -7
- package/dist-esm/applicationinsights-common.js.map +1 -1
- package/package.json +3 -3
- package/src/Enums.ts +19 -3
- package/src/HelperFuncs.ts +7 -5
- package/src/Interfaces/Contracts/AvailabilityData.ts +57 -0
- package/src/Interfaces/Contracts/{Generated/ContextTagKeys.ts → ContextTagKeys.ts} +0 -0
- package/src/Interfaces/Contracts/{Generated/DataPointType.ts → DataPointType.ts} +2 -3
- package/src/Interfaces/Contracts/{Generated/DependencyKind.ts → DependencyKind.ts} +2 -3
- package/src/Interfaces/Contracts/{Generated/DependencySourceType.ts → DependencySourceType.ts} +2 -3
- package/src/Interfaces/Contracts/{Generated/Base.ts → IBase.ts} +2 -7
- package/src/Interfaces/Contracts/{Generated/Data.ts → IData.ts} +5 -12
- package/src/Interfaces/Contracts/{Generated/DataPoint.ts → IDataPoint.ts} +8 -8
- package/src/Interfaces/Contracts/{Generated/Domain.ts → IDomain.ts} +1 -3
- package/src/Interfaces/Contracts/IEnvelope.ts +50 -0
- package/src/Interfaces/Contracts/{Generated/EventData.ts → IEventData.ts} +7 -10
- package/src/Interfaces/Contracts/{Generated/ExceptionData.ts → IExceptionData.ts} +8 -11
- package/src/Interfaces/Contracts/{Generated/ExceptionDetails.ts → IExceptionDetails.ts} +9 -10
- package/src/Interfaces/Contracts/{Generated/MessageData.ts → IMessageData.ts} +7 -10
- package/src/Interfaces/Contracts/{Generated/MetricData.ts → IMetricData.ts} +7 -10
- package/{types/Interfaces/Contracts/Generated/PageViewData.d.ts → src/Interfaces/Contracts/IPageViewData.ts} +10 -19
- package/src/Interfaces/Contracts/IPageViewPerfData.ts +35 -0
- package/src/Interfaces/Contracts/{Generated/RemoteDependencyData.ts → IRemoteDependencyData.ts} +13 -16
- package/src/Interfaces/Contracts/{Generated/StackFrame.ts → IStackFrame.ts} +6 -7
- package/src/Interfaces/Contracts/RequestData.ts +50 -0
- package/src/Interfaces/Contracts/{Generated/SeverityLevel.ts → SeverityLevel.ts} +0 -0
- package/src/Interfaces/IExceptionTelemetry.ts +1 -1
- package/src/Interfaces/ITraceTelemetry.ts +1 -1
- package/src/Interfaces/PartAExtensions.ts +1 -1
- package/src/Interfaces/Telemetry/IEnvelope.ts +35 -3
- package/src/StorageHelperFuncs.ts +40 -23
- package/src/Telemetry/Common/Data.ts +12 -4
- package/src/Telemetry/Common/DataPoint.ts +38 -2
- package/src/Telemetry/Common/DataSanitizer.ts +19 -19
- package/src/Telemetry/Common/Envelope.ts +51 -10
- package/src/Telemetry/Event.ts +30 -12
- package/src/Telemetry/Exception.ts +179 -80
- package/src/Telemetry/Metric.ts +27 -7
- package/src/Telemetry/PageView.ts +45 -10
- package/src/Telemetry/PageViewPerformance.ts +76 -14
- package/src/Telemetry/RemoteDependencyData.ts +70 -15
- package/src/Telemetry/Trace.ts +34 -8
- package/src/TelemetryItemCreator.ts +1 -1
- package/src/applicationinsights-common.ts +7 -7
- package/types/Enums.d.ts +13 -2
- package/types/Interfaces/Contracts/AvailabilityData.d.ts +0 -0
- package/types/Interfaces/Contracts/{Generated/ContextTagKeys.d.ts → ContextTagKeys.d.ts} +0 -0
- package/types/Interfaces/Contracts/{Generated/DataPointType.d.ts → DataPointType.d.ts} +1 -1
- package/types/Interfaces/Contracts/{Generated/DependencyKind.d.ts → DependencyKind.d.ts} +1 -1
- package/types/Interfaces/Contracts/{Generated/DependencySourceType.d.ts → DependencySourceType.d.ts} +1 -1
- package/types/Interfaces/Contracts/{Generated/Base.d.ts → IBase.d.ts} +1 -2
- package/types/Interfaces/Contracts/{Generated/Data.d.ts → IData.d.ts} +2 -3
- package/types/Interfaces/Contracts/{Generated/DataPoint.d.ts → IDataPoint.d.ts} +1 -1
- package/types/Interfaces/Contracts/{Generated/Domain.d.ts → IDomain.d.ts} +1 -1
- package/types/Interfaces/Contracts/IEnvelope.d.ts +0 -0
- package/types/Interfaces/Contracts/{Generated/EventData.d.ts → IEventData.d.ts} +2 -3
- package/types/Interfaces/Contracts/{Generated/ExceptionData.d.ts → IExceptionData.d.ts} +4 -5
- package/types/Interfaces/Contracts/{Generated/ExceptionDetails.d.ts → IExceptionDetails.d.ts} +3 -3
- package/types/Interfaces/Contracts/{Generated/MessageData.d.ts → IMessageData.d.ts} +2 -3
- package/types/Interfaces/Contracts/{Generated/MetricData.d.ts → IMetricData.d.ts} +4 -5
- package/types/Interfaces/Contracts/IPageViewData.d.ts +18 -0
- package/types/Interfaces/Contracts/IPageViewPerfData.d.ts +26 -0
- package/types/Interfaces/Contracts/{Generated/RemoteDependencyData.d.ts → IRemoteDependencyData.d.ts} +2 -3
- package/types/Interfaces/Contracts/{Generated/StackFrame.d.ts → IStackFrame.d.ts} +1 -1
- package/types/Interfaces/Contracts/RequestData.d.ts +0 -0
- package/types/Interfaces/Contracts/{Generated/SeverityLevel.d.ts → SeverityLevel.d.ts} +0 -0
- package/types/Interfaces/IExceptionTelemetry.d.ts +1 -1
- package/types/Interfaces/ITraceTelemetry.d.ts +1 -1
- package/types/Interfaces/PartAExtensions.d.ts +1 -1
- package/types/Interfaces/Telemetry/IEnvelope.d.ts +24 -0
- package/types/StorageHelperFuncs.d.ts +14 -2
- package/types/Telemetry/Common/Data.d.ts +10 -2
- package/types/Telemetry/Common/DataPoint.d.ts +31 -2
- package/types/Telemetry/Common/DataSanitizer.d.ts +3 -3
- package/types/Telemetry/Common/Envelope.d.ts +35 -4
- package/types/Telemetry/Event.d.ts +19 -3
- package/types/Telemetry/Exception.d.ts +75 -7
- package/types/Telemetry/Metric.d.ts +19 -2
- package/types/Telemetry/PageView.d.ts +30 -2
- package/types/Telemetry/PageViewPerformance.d.ts +50 -2
- package/types/Telemetry/RemoteDependencyData.d.ts +46 -2
- package/types/Telemetry/Trace.d.ts +23 -3
- package/types/applicationinsights-common.d.ts +7 -7
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +0 -27
- package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Base.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/Base.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Data.js +0 -21
- package/dist-esm/Interfaces/Contracts/Generated/Data.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +0 -21
- package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +0 -16
- package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Domain.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/Envelope.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/EventData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/EventData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +0 -24
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/MessageData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/MetricData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +0 -34
- package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +0 -34
- package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/RequestData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js.map +0 -1
- package/dist-esm/Telemetry/Common/Base.js +0 -22
- package/dist-esm/Telemetry/Common/Base.js.map +0 -1
- package/src/Interfaces/Contracts/Generated/AvailabilityData.ts +0 -57
- package/src/Interfaces/Contracts/Generated/Envelope.ts +0 -50
- package/src/Interfaces/Contracts/Generated/PageViewData.ts +0 -50
- package/src/Interfaces/Contracts/Generated/PageViewPerfData.ts +0 -70
- package/src/Interfaces/Contracts/Generated/RequestData.ts +0 -50
- package/src/Telemetry/Common/Base.ts +0 -14
- package/types/Interfaces/Contracts/Generated/AvailabilityData.d.ts +0 -42
- package/types/Interfaces/Contracts/Generated/Envelope.d.ts +0 -38
- package/types/Interfaces/Contracts/Generated/PageViewPerfData.d.ts +0 -51
- package/types/Interfaces/Contracts/Generated/RequestData.d.ts +0 -38
- package/types/Telemetry/Common/Base.d.ts +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { dumpObj, getExceptionName, getGlobal, getGlobalInst, IDiagnosticLogger, isNullOrUndefined,
|
|
4
|
+
import { dumpObj, getExceptionName, getGlobal, getGlobalInst, IDiagnosticLogger, isNullOrUndefined, eLoggingSeverity, objForEachKey, _eInternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
|
|
5
5
|
import { StorageType } from "./Enums";
|
|
6
6
|
|
|
7
7
|
let _canUseLocalStorage: boolean = undefined;
|
|
@@ -57,13 +57,29 @@ function _getSessionStorageObject(): Storage {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Disables the global SDK usage of local or session storage if available
|
|
62
|
+
*/
|
|
60
63
|
export function utlDisableStorage() {
|
|
61
64
|
_canUseLocalStorage = false;
|
|
62
65
|
_canUseSessionStorage = false;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Re-enables the global SDK usage of local or session storage if available
|
|
70
|
+
*/
|
|
71
|
+
export function utlEnableStorage() {
|
|
72
|
+
_canUseLocalStorage = utlCanUseLocalStorage(true);
|
|
73
|
+
_canUseSessionStorage = utlCanUseSessionStorage(true);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns whether LocalStorage can be used, if the reset parameter is passed a true this will override
|
|
78
|
+
* any previous disable calls.
|
|
79
|
+
* @param reset - Should the usage be reset and determined only based on whether LocalStorage is available
|
|
80
|
+
*/
|
|
81
|
+
export function utlCanUseLocalStorage(reset?: boolean): boolean {
|
|
82
|
+
if (reset || _canUseLocalStorage === undefined) {
|
|
67
83
|
_canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
|
|
68
84
|
}
|
|
69
85
|
|
|
@@ -78,9 +94,9 @@ export function utlGetLocalStorage(logger: IDiagnosticLogger, name: string): str
|
|
|
78
94
|
} catch (e) {
|
|
79
95
|
_canUseLocalStorage = false;
|
|
80
96
|
|
|
81
|
-
logger
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
_throwInternal(logger,
|
|
98
|
+
eLoggingSeverity.WARNING,
|
|
99
|
+
_eInternalMessageId.BrowserCannotReadLocalStorage,
|
|
84
100
|
"Browser failed read of local storage. " + getExceptionName(e),
|
|
85
101
|
{ exception: dumpObj(e) });
|
|
86
102
|
}
|
|
@@ -97,9 +113,9 @@ export function utlSetLocalStorage(logger: IDiagnosticLogger, name: string, data
|
|
|
97
113
|
} catch (e) {
|
|
98
114
|
_canUseLocalStorage = false;
|
|
99
115
|
|
|
100
|
-
logger
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
_throwInternal(logger,
|
|
117
|
+
eLoggingSeverity.WARNING,
|
|
118
|
+
_eInternalMessageId.BrowserCannotWriteLocalStorage,
|
|
103
119
|
"Browser failed write to local storage. " + getExceptionName(e),
|
|
104
120
|
{ exception: dumpObj(e) });
|
|
105
121
|
}
|
|
@@ -116,9 +132,9 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
|
|
|
116
132
|
} catch (e) {
|
|
117
133
|
_canUseLocalStorage = false;
|
|
118
134
|
|
|
119
|
-
logger
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
_throwInternal(logger,
|
|
136
|
+
eLoggingSeverity.WARNING,
|
|
137
|
+
_eInternalMessageId.BrowserFailedRemovalFromLocalStorage,
|
|
122
138
|
"Browser failed removal of local storage item. " + getExceptionName(e),
|
|
123
139
|
{ exception: dumpObj(e) });
|
|
124
140
|
}
|
|
@@ -126,8 +142,8 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
|
|
|
126
142
|
return false;
|
|
127
143
|
}
|
|
128
144
|
|
|
129
|
-
export function utlCanUseSessionStorage(): boolean {
|
|
130
|
-
if (_canUseSessionStorage === undefined) {
|
|
145
|
+
export function utlCanUseSessionStorage(reset?: boolean): boolean {
|
|
146
|
+
if (reset || _canUseSessionStorage === undefined) {
|
|
131
147
|
_canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
|
|
132
148
|
}
|
|
133
149
|
|
|
@@ -154,9 +170,9 @@ export function utlGetSessionStorage(logger: IDiagnosticLogger, name: string): s
|
|
|
154
170
|
} catch (e) {
|
|
155
171
|
_canUseSessionStorage = false;
|
|
156
172
|
|
|
157
|
-
logger
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
_throwInternal(logger,
|
|
174
|
+
eLoggingSeverity.WARNING,
|
|
175
|
+
_eInternalMessageId.BrowserCannotReadSessionStorage,
|
|
160
176
|
"Browser failed read of session storage. " + getExceptionName(e),
|
|
161
177
|
{ exception: dumpObj(e) });
|
|
162
178
|
}
|
|
@@ -173,9 +189,9 @@ export function utlSetSessionStorage(logger: IDiagnosticLogger, name: string, da
|
|
|
173
189
|
} catch (e) {
|
|
174
190
|
_canUseSessionStorage = false;
|
|
175
191
|
|
|
176
|
-
logger
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
_throwInternal(logger,
|
|
193
|
+
eLoggingSeverity.WARNING,
|
|
194
|
+
_eInternalMessageId.BrowserCannotWriteSessionStorage,
|
|
179
195
|
"Browser failed write to session storage. " + getExceptionName(e),
|
|
180
196
|
{ exception: dumpObj(e) });
|
|
181
197
|
}
|
|
@@ -192,12 +208,13 @@ export function utlRemoveSessionStorage(logger: IDiagnosticLogger, name: string)
|
|
|
192
208
|
} catch (e) {
|
|
193
209
|
_canUseSessionStorage = false;
|
|
194
210
|
|
|
195
|
-
logger
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
_throwInternal(logger,
|
|
212
|
+
eLoggingSeverity.WARNING,
|
|
213
|
+
_eInternalMessageId.BrowserFailedRemovalFromSessionStorage,
|
|
198
214
|
"Browser failed removal of session storage item. " + getExceptionName(e),
|
|
199
215
|
{ exception: dumpObj(e) });
|
|
200
216
|
}
|
|
201
217
|
}
|
|
218
|
+
|
|
202
219
|
return false;
|
|
203
220
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IData } from "../../Interfaces/Contracts/IData";
|
|
5
5
|
import { ISerializable } from "../../Interfaces/Telemetry/ISerializable";
|
|
6
6
|
import { FieldType } from "../../Enums";
|
|
7
7
|
|
|
8
|
-
export class Data<TDomain>
|
|
8
|
+
export class Data<TDomain> implements IData<TDomain>, ISerializable {
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The data contract for serializing this object.
|
|
@@ -15,12 +15,20 @@ export class Data<TDomain> extends AIData<TDomain> implements ISerializable {
|
|
|
15
15
|
baseData: FieldType.Required
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Name of item (B section) if any. If telemetry data is derived straight from this, this should be null.
|
|
20
|
+
*/
|
|
21
|
+
public baseType: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Container for data item (B section).
|
|
25
|
+
*/
|
|
26
|
+
public baseData: TDomain;
|
|
27
|
+
|
|
18
28
|
/**
|
|
19
29
|
* Constructs a new instance of telemetry data.
|
|
20
30
|
*/
|
|
21
31
|
constructor(baseType: string, data: TDomain) {
|
|
22
|
-
super();
|
|
23
|
-
|
|
24
32
|
this.baseType = baseType;
|
|
25
33
|
this.baseData = data;
|
|
26
34
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IDataPoint } from "../../Interfaces/Contracts/IDataPoint";
|
|
5
5
|
import { ISerializable } from "../../Interfaces/Telemetry/ISerializable";
|
|
6
6
|
import { FieldType } from "../../Enums";
|
|
7
|
+
import { DataPointType } from "../../Interfaces/Contracts/DataPointType";
|
|
7
8
|
|
|
8
|
-
export class DataPoint
|
|
9
|
+
export class DataPoint implements IDataPoint, ISerializable {
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* The data contract for serializing this object.
|
|
@@ -19,4 +20,39 @@ export class DataPoint extends AIDataPoint implements ISerializable {
|
|
|
19
20
|
max: FieldType.Default,
|
|
20
21
|
stdDev: FieldType.Default
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Name of the metric.
|
|
26
|
+
*/
|
|
27
|
+
public name: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Metric type. Single measurement or the aggregated value.
|
|
31
|
+
*/
|
|
32
|
+
public kind: DataPointType = DataPointType.Measurement;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Single value for measurement. Sum of individual measurements for the aggregation.
|
|
36
|
+
*/
|
|
37
|
+
public value: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Metric weight of the aggregated metric. Should not be set for a measurement.
|
|
41
|
+
*/
|
|
42
|
+
public count: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Minimum value of the aggregated metric. Should not be set for a measurement.
|
|
46
|
+
*/
|
|
47
|
+
public min: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Maximum value of the aggregated metric. Should not be set for a measurement.
|
|
51
|
+
*/
|
|
52
|
+
public max: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Standard deviation of the aggregated metric. Should not be set for a measurement.
|
|
56
|
+
*/
|
|
57
|
+
public stdDev: number;
|
|
22
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { IDiagnosticLogger,
|
|
4
|
+
import { IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim, _throwInternal } from "@microsoft/applicationinsights-core-js";
|
|
5
5
|
|
|
6
6
|
export const enum DataSanitizerValues {
|
|
7
7
|
/**
|
|
@@ -66,9 +66,9 @@ export function dataSanitizeKey(logger: IDiagnosticLogger, name: any) {
|
|
|
66
66
|
// truncate the string to 150 chars
|
|
67
67
|
if (name.length > DataSanitizerValues.MAX_NAME_LENGTH) {
|
|
68
68
|
nameTrunc = name.substring(0, DataSanitizerValues.MAX_NAME_LENGTH);
|
|
69
|
-
logger
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
_throwInternal(logger,
|
|
70
|
+
eLoggingSeverity.WARNING,
|
|
71
|
+
_eInternalMessageId.NameTooLong,
|
|
72
72
|
"name is too long. It has been truncated to " + DataSanitizerValues.MAX_NAME_LENGTH + " characters.",
|
|
73
73
|
{ name }, true);
|
|
74
74
|
}
|
|
@@ -84,9 +84,9 @@ export function dataSanitizeString(logger: IDiagnosticLogger, value: any, maxLen
|
|
|
84
84
|
value = strTrim(value);
|
|
85
85
|
if (value.toString().length > maxLength) {
|
|
86
86
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
87
|
-
logger
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
_throwInternal(logger,
|
|
88
|
+
eLoggingSeverity.WARNING,
|
|
89
|
+
_eInternalMessageId.StringValueTooLong,
|
|
90
90
|
"string value is too long. It has been truncated to " + maxLength + " characters.",
|
|
91
91
|
{ value }, true);
|
|
92
92
|
}
|
|
@@ -96,7 +96,7 @@ export function dataSanitizeString(logger: IDiagnosticLogger, value: any, maxLen
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export function dataSanitizeUrl(logger: IDiagnosticLogger, url: any) {
|
|
99
|
-
return dataSanitizeInput(logger, url, DataSanitizerValues.MAX_URL_LENGTH,
|
|
99
|
+
return dataSanitizeInput(logger, url, DataSanitizerValues.MAX_URL_LENGTH, _eInternalMessageId.UrlTooLong);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export function dataSanitizeMessage(logger: IDiagnosticLogger, message: any) {
|
|
@@ -104,8 +104,8 @@ export function dataSanitizeMessage(logger: IDiagnosticLogger, message: any) {
|
|
|
104
104
|
if (message) {
|
|
105
105
|
if (message.length > DataSanitizerValues.MAX_MESSAGE_LENGTH) {
|
|
106
106
|
messageTrunc = message.substring(0, DataSanitizerValues.MAX_MESSAGE_LENGTH);
|
|
107
|
-
logger
|
|
108
|
-
|
|
107
|
+
_throwInternal(logger,
|
|
108
|
+
eLoggingSeverity.WARNING, _eInternalMessageId.MessageTruncated,
|
|
109
109
|
"message is too long, it has been truncated to " + DataSanitizerValues.MAX_MESSAGE_LENGTH + " characters.",
|
|
110
110
|
{ message },
|
|
111
111
|
true);
|
|
@@ -122,8 +122,8 @@ export function dataSanitizeException(logger: IDiagnosticLogger, exception: any)
|
|
|
122
122
|
let value:string = "" + exception;
|
|
123
123
|
if (value.length > DataSanitizerValues.MAX_EXCEPTION_LENGTH) {
|
|
124
124
|
exceptionTrunc = value.substring(0, DataSanitizerValues.MAX_EXCEPTION_LENGTH);
|
|
125
|
-
logger
|
|
126
|
-
|
|
125
|
+
_throwInternal(logger,
|
|
126
|
+
eLoggingSeverity.WARNING, _eInternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + DataSanitizerValues.MAX_EXCEPTION_LENGTH + " characters.",
|
|
127
127
|
{ exception }, true);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -140,7 +140,7 @@ export function dataSanitizeProperties(logger: IDiagnosticLogger, properties: an
|
|
|
140
140
|
try {
|
|
141
141
|
value = getJSON().stringify(value);
|
|
142
142
|
} catch (e) {
|
|
143
|
-
logger
|
|
143
|
+
_throwInternal(logger,eLoggingSeverity.WARNING, _eInternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e}, true);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
value = dataSanitizeString(logger, value, DataSanitizerValues.MAX_PROPERTY_LENGTH);
|
|
@@ -168,17 +168,17 @@ export function dataSanitizeMeasurements(logger: IDiagnosticLogger, measurements
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export function dataSanitizeId(logger: IDiagnosticLogger, id: string): string {
|
|
171
|
-
return id ? dataSanitizeInput(logger, id, DataSanitizerValues.MAX_ID_LENGTH,
|
|
171
|
+
return id ? dataSanitizeInput(logger, id, DataSanitizerValues.MAX_ID_LENGTH, _eInternalMessageId.IdTooLong).toString() : id;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId:
|
|
174
|
+
export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) {
|
|
175
175
|
let inputTrunc : String;
|
|
176
176
|
if (input) {
|
|
177
177
|
input = strTrim(input);
|
|
178
178
|
if (input.length > maxLength) {
|
|
179
179
|
inputTrunc = input.substring(0, maxLength);
|
|
180
|
-
logger
|
|
181
|
-
|
|
180
|
+
_throwInternal(logger,
|
|
181
|
+
eLoggingSeverity.WARNING,
|
|
182
182
|
_msgId,
|
|
183
183
|
"input is too long, it has been truncated to " + maxLength + " characters.",
|
|
184
184
|
{ data: input },
|
|
@@ -248,7 +248,7 @@ export interface IDataSanitizer {
|
|
|
248
248
|
|
|
249
249
|
sanitizeId: (logger: IDiagnosticLogger, id: string) => string;
|
|
250
250
|
|
|
251
|
-
sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId:
|
|
251
|
+
sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) => any;
|
|
252
252
|
|
|
253
253
|
padNumber: (num: number) => string;
|
|
254
254
|
|
|
@@ -282,4 +282,4 @@ export const DataSanitizer: IDataSanitizer = {
|
|
|
282
282
|
sanitizeInput: dataSanitizeInput,
|
|
283
283
|
padNumber: dsPadNumber,
|
|
284
284
|
trim: strTrim
|
|
285
|
-
};
|
|
285
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { Base } from "../../Interfaces/Contracts/Generated/Base";
|
|
4
|
+
import { IBase } from "../../Interfaces/Contracts/IBase";
|
|
6
5
|
import { IEnvelope } from "../../Interfaces/Telemetry/IEnvelope";
|
|
7
6
|
import { dataSanitizeString } from "./DataSanitizer";
|
|
8
7
|
import { FieldType } from "../../Enums";
|
|
9
8
|
import { IDiagnosticLogger, toISOString } from "@microsoft/applicationinsights-core-js";
|
|
10
9
|
import { strNotSpecified } from "../../Constants";
|
|
11
10
|
|
|
12
|
-
export class Envelope
|
|
11
|
+
export class Envelope implements IEnvelope {
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* The data contract for serializing this object.
|
|
@@ -17,16 +16,58 @@ export class Envelope extends AIEnvelope implements IEnvelope {
|
|
|
17
16
|
public aiDataContract: any;
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
19
|
+
* Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1.
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
|
-
super();
|
|
21
|
+
public ver: number; /* 1 */
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Type name of telemetry data item.
|
|
25
|
+
*/
|
|
26
|
+
public name: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z.
|
|
30
|
+
*/
|
|
31
|
+
public time: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
|
|
35
|
+
*/
|
|
36
|
+
public sampleRate: number; /* 100.0 */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sequence field used to track absolute order of uploaded events.
|
|
40
|
+
*/
|
|
41
|
+
public seq: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The application's instrumentation key. The key is typically represented as a GUID, but there are cases when it is not a guid. No code should rely on iKey being a GUID. Instrumentation key is case insensitive.
|
|
45
|
+
*/
|
|
46
|
+
public iKey: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Key/value collection of context properties. See ContextTagKeys for information on available properties.
|
|
50
|
+
*/
|
|
51
|
+
public tags: any; /* {} */
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Telemetry data item.
|
|
55
|
+
*/
|
|
56
|
+
public data: IBase;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Constructs a new instance of telemetry data.
|
|
60
|
+
*/
|
|
61
|
+
constructor(logger: IDiagnosticLogger, data: IBase, name: string) {
|
|
62
|
+
let _self = this;
|
|
63
|
+
_self.ver = 1;
|
|
64
|
+
_self.sampleRate = 100.0;
|
|
65
|
+
_self.tags = {};
|
|
66
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
67
|
+
_self.data = data;
|
|
68
|
+
_self.time = toISOString(new Date());
|
|
28
69
|
|
|
29
|
-
|
|
70
|
+
_self.aiDataContract = {
|
|
30
71
|
time: FieldType.Required,
|
|
31
72
|
iKey: FieldType.Required,
|
|
32
73
|
name: FieldType.Required,
|
package/src/Telemetry/Event.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { EventData } from "../Interfaces/Contracts/Generated/EventData";
|
|
4
|
+
import { IEventData } from "../Interfaces/Contracts/IEventData";
|
|
6
5
|
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
7
6
|
import { dataSanitizeString, dataSanitizeProperties, dataSanitizeMeasurements } from "./Common/DataSanitizer";
|
|
8
7
|
import { FieldType } from "../Enums";
|
|
9
8
|
import { strNotSpecified } from "../Constants";
|
|
9
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
10
10
|
|
|
11
|
-
export class Event
|
|
12
|
-
|
|
11
|
+
export class Event implements IEventData, ISerializable {
|
|
13
12
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
14
13
|
public static dataType = "EventData";
|
|
15
14
|
|
|
@@ -18,17 +17,36 @@ export class Event extends EventData implements ISerializable {
|
|
|
18
17
|
name: FieldType.Required,
|
|
19
18
|
properties: FieldType.Default,
|
|
20
19
|
measurements: FieldType.Default
|
|
21
|
-
}
|
|
20
|
+
};
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
|
-
*
|
|
23
|
+
* Schema version
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
public ver: number; /* 2 */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Event name. Keep it low cardinality to allow proper grouping and useful metrics.
|
|
29
|
+
*/
|
|
30
|
+
public name: string;
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Collection of custom properties.
|
|
34
|
+
*/
|
|
35
|
+
public properties: any; /* {} */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Collection of custom measurements.
|
|
39
|
+
*/
|
|
40
|
+
public measurements: any; /* {} */
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Constructs a new instance of the EventTelemetry object
|
|
44
|
+
*/
|
|
45
|
+
constructor(logger: IDiagnosticLogger, name: string, properties?: any, measurements?: any) {
|
|
46
|
+
let _self = this;
|
|
47
|
+
_self.ver = 2;
|
|
48
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
49
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
50
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
33
51
|
}
|
|
34
|
-
}
|
|
52
|
+
}
|