@microsoft/applicationinsights-common 2.8.0-beta.2203-16 → 2.8.0-nightly.2204-05
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 +521 -743
- 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 +2816 -1246
- package/dist/applicationinsights-common.api.md +87 -43
- package/dist/applicationinsights-common.d.ts +503 -290
- package/dist/applicationinsights-common.js +521 -743
- 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 +503 -290
- 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 +1 -1
- package/dist-esm/HelperFuncs.js +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 +1 -1
- package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
- package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
- package/dist-esm/Interfaces/Contracts/IData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
- package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
- 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 +8 -8
- 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 +9 -9
- 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 +3 -6
- package/dist-esm/applicationinsights-common.js.map +1 -1
- package/package.json +3 -3
- 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 +7 -7
- package/src/Telemetry/Common/Data.ts +12 -4
- package/src/Telemetry/Common/DataPoint.ts +38 -2
- package/src/Telemetry/Common/DataSanitizer.ts +10 -10
- package/src/Telemetry/Common/Envelope.ts +51 -10
- package/src/Telemetry/Event.ts +30 -12
- package/src/Telemetry/Exception.ts +158 -71
- 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/applicationinsights-common.ts +5 -5
- package/types/Enums.d.ts +4 -4
- 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/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 +5 -5
- 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/ContextTagKeys.js +0 -89
- package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.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 +0 -8
- 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/SeverityLevel.js +0 -19
- package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.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/Base.ts +0 -18
- package/src/Interfaces/Contracts/Generated/ContextTagKeys.ts +0 -299
- package/src/Interfaces/Contracts/Generated/Data.ts +0 -26
- package/src/Interfaces/Contracts/Generated/DataPoint.ts +0 -44
- package/src/Interfaces/Contracts/Generated/DataPointType.ts +0 -11
- package/src/Interfaces/Contracts/Generated/DependencyKind.ts +0 -12
- package/src/Interfaces/Contracts/Generated/DependencySourceType.ts +0 -12
- package/src/Interfaces/Contracts/Generated/Domain.ts +0 -10
- package/src/Interfaces/Contracts/Generated/Envelope.ts +0 -50
- package/src/Interfaces/Contracts/Generated/EventData.ts +0 -33
- package/src/Interfaces/Contracts/Generated/ExceptionData.ts +0 -40
- package/src/Interfaces/Contracts/Generated/ExceptionDetails.ts +0 -46
- package/src/Interfaces/Contracts/Generated/MessageData.ts +0 -39
- package/src/Interfaces/Contracts/Generated/MetricData.ts +0 -34
- package/src/Interfaces/Contracts/Generated/PageViewData.ts +0 -50
- package/src/Interfaces/Contracts/Generated/PageViewPerfData.ts +0 -70
- package/src/Interfaces/Contracts/Generated/RemoteDependencyData.ts +0 -68
- package/src/Interfaces/Contracts/Generated/RequestData.ts +0 -50
- package/src/Interfaces/Contracts/Generated/SeverityLevel.ts +0 -15
- package/src/Interfaces/Contracts/Generated/StackFrame.ts +0 -34
- package/src/Telemetry/Common/Base.ts +0 -14
- package/types/Interfaces/Contracts/Generated/AvailabilityData.d.ts +0 -42
- package/types/Interfaces/Contracts/Generated/Base.d.ts +0 -10
- package/types/Interfaces/Contracts/Generated/ContextTagKeys.d.ts +0 -175
- package/types/Interfaces/Contracts/Generated/Data.d.ts +0 -15
- package/types/Interfaces/Contracts/Generated/DataPoint.d.ts +0 -34
- package/types/Interfaces/Contracts/Generated/DataPointType.d.ts +0 -7
- package/types/Interfaces/Contracts/Generated/DependencyKind.d.ts +0 -8
- package/types/Interfaces/Contracts/Generated/DependencySourceType.d.ts +0 -8
- package/types/Interfaces/Contracts/Generated/Domain.d.ts +0 -5
- package/types/Interfaces/Contracts/Generated/Envelope.d.ts +0 -38
- package/types/Interfaces/Contracts/Generated/EventData.d.ts +0 -23
- package/types/Interfaces/Contracts/Generated/ExceptionData.d.ts +0 -29
- package/types/Interfaces/Contracts/Generated/ExceptionDetails.d.ts +0 -34
- package/types/Interfaces/Contracts/Generated/MessageData.d.ts +0 -28
- package/types/Interfaces/Contracts/Generated/MetricData.d.ts +0 -24
- package/types/Interfaces/Contracts/Generated/PageViewData.d.ts +0 -35
- package/types/Interfaces/Contracts/Generated/PageViewPerfData.d.ts +0 -51
- package/types/Interfaces/Contracts/Generated/RemoteDependencyData.d.ts +0 -51
- package/types/Interfaces/Contracts/Generated/RequestData.d.ts +0 -38
- package/types/Interfaces/Contracts/Generated/SeverityLevel.d.ts +0 -10
- package/types/Interfaces/Contracts/Generated/StackFrame.d.ts +0 -25
- package/types/Telemetry/Common/Base.d.ts +0 -8
|
@@ -4,12 +4,44 @@
|
|
|
4
4
|
import { ISerializable } from "./ISerializable";
|
|
5
5
|
|
|
6
6
|
export interface IEnvelope extends ISerializable {
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 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.
|
|
10
|
+
*/
|
|
11
|
+
ver: number; /* 1 */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Type name of telemetry data item.
|
|
15
|
+
*/
|
|
8
16
|
name: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 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.
|
|
20
|
+
*/
|
|
9
21
|
time: string;
|
|
10
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
|
|
25
|
+
*/
|
|
26
|
+
sampleRate: number; /* 100.0 */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sequence field used to track absolute order of uploaded events.
|
|
30
|
+
*/
|
|
11
31
|
seq: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 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.
|
|
35
|
+
*/
|
|
12
36
|
iKey: string;
|
|
13
|
-
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Key/value collection of context properties. See ContextTagKeys for information on available properties.
|
|
40
|
+
*/
|
|
41
|
+
tags: { [name: string]: any }; /* {} */
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Telemetry data item.
|
|
45
|
+
*/
|
|
14
46
|
data: any;
|
|
15
47
|
}
|
|
@@ -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, eLoggingSeverity, objForEachKey,
|
|
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;
|
|
@@ -96,7 +96,7 @@ export function utlGetLocalStorage(logger: IDiagnosticLogger, name: string): str
|
|
|
96
96
|
|
|
97
97
|
_throwInternal(logger,
|
|
98
98
|
eLoggingSeverity.WARNING,
|
|
99
|
-
|
|
99
|
+
_eInternalMessageId.BrowserCannotReadLocalStorage,
|
|
100
100
|
"Browser failed read of local storage. " + getExceptionName(e),
|
|
101
101
|
{ exception: dumpObj(e) });
|
|
102
102
|
}
|
|
@@ -115,7 +115,7 @@ export function utlSetLocalStorage(logger: IDiagnosticLogger, name: string, data
|
|
|
115
115
|
|
|
116
116
|
_throwInternal(logger,
|
|
117
117
|
eLoggingSeverity.WARNING,
|
|
118
|
-
|
|
118
|
+
_eInternalMessageId.BrowserCannotWriteLocalStorage,
|
|
119
119
|
"Browser failed write to local storage. " + getExceptionName(e),
|
|
120
120
|
{ exception: dumpObj(e) });
|
|
121
121
|
}
|
|
@@ -134,7 +134,7 @@ export function utlRemoveStorage(logger: IDiagnosticLogger, name: string): boole
|
|
|
134
134
|
|
|
135
135
|
_throwInternal(logger,
|
|
136
136
|
eLoggingSeverity.WARNING,
|
|
137
|
-
|
|
137
|
+
_eInternalMessageId.BrowserFailedRemovalFromLocalStorage,
|
|
138
138
|
"Browser failed removal of local storage item. " + getExceptionName(e),
|
|
139
139
|
{ exception: dumpObj(e) });
|
|
140
140
|
}
|
|
@@ -172,7 +172,7 @@ export function utlGetSessionStorage(logger: IDiagnosticLogger, name: string): s
|
|
|
172
172
|
|
|
173
173
|
_throwInternal(logger,
|
|
174
174
|
eLoggingSeverity.WARNING,
|
|
175
|
-
|
|
175
|
+
_eInternalMessageId.BrowserCannotReadSessionStorage,
|
|
176
176
|
"Browser failed read of session storage. " + getExceptionName(e),
|
|
177
177
|
{ exception: dumpObj(e) });
|
|
178
178
|
}
|
|
@@ -191,7 +191,7 @@ export function utlSetSessionStorage(logger: IDiagnosticLogger, name: string, da
|
|
|
191
191
|
|
|
192
192
|
_throwInternal(logger,
|
|
193
193
|
eLoggingSeverity.WARNING,
|
|
194
|
-
|
|
194
|
+
_eInternalMessageId.BrowserCannotWriteSessionStorage,
|
|
195
195
|
"Browser failed write to session storage. " + getExceptionName(e),
|
|
196
196
|
{ exception: dumpObj(e) });
|
|
197
197
|
}
|
|
@@ -210,7 +210,7 @@ export function utlRemoveSessionStorage(logger: IDiagnosticLogger, name: string)
|
|
|
210
210
|
|
|
211
211
|
_throwInternal(logger,
|
|
212
212
|
eLoggingSeverity.WARNING,
|
|
213
|
-
|
|
213
|
+
_eInternalMessageId.BrowserFailedRemovalFromSessionStorage,
|
|
214
214
|
"Browser failed removal of session storage item. " + getExceptionName(e),
|
|
215
215
|
{ exception: dumpObj(e) });
|
|
216
216
|
}
|
|
@@ -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, eLoggingSeverity,
|
|
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
|
/**
|
|
@@ -68,7 +68,7 @@ export function dataSanitizeKey(logger: IDiagnosticLogger, name: any) {
|
|
|
68
68
|
nameTrunc = name.substring(0, DataSanitizerValues.MAX_NAME_LENGTH);
|
|
69
69
|
_throwInternal(logger,
|
|
70
70
|
eLoggingSeverity.WARNING,
|
|
71
|
-
|
|
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
|
}
|
|
@@ -86,7 +86,7 @@ export function dataSanitizeString(logger: IDiagnosticLogger, value: any, maxLen
|
|
|
86
86
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
87
87
|
_throwInternal(logger,
|
|
88
88
|
eLoggingSeverity.WARNING,
|
|
89
|
-
|
|
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) {
|
|
@@ -105,7 +105,7 @@ export function dataSanitizeMessage(logger: IDiagnosticLogger, message: any) {
|
|
|
105
105
|
if (message.length > DataSanitizerValues.MAX_MESSAGE_LENGTH) {
|
|
106
106
|
messageTrunc = message.substring(0, DataSanitizerValues.MAX_MESSAGE_LENGTH);
|
|
107
107
|
_throwInternal(logger,
|
|
108
|
-
eLoggingSeverity.WARNING,
|
|
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);
|
|
@@ -123,7 +123,7 @@ export function dataSanitizeException(logger: IDiagnosticLogger, exception: any)
|
|
|
123
123
|
if (value.length > DataSanitizerValues.MAX_EXCEPTION_LENGTH) {
|
|
124
124
|
exceptionTrunc = value.substring(0, DataSanitizerValues.MAX_EXCEPTION_LENGTH);
|
|
125
125
|
_throwInternal(logger,
|
|
126
|
-
eLoggingSeverity.WARNING,
|
|
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
|
-
_throwInternal(logger,eLoggingSeverity.WARNING,
|
|
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,10 +168,10 @@ 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);
|
|
@@ -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
|
|
|
@@ -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
|
+
}
|