@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.
Files changed (223) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +521 -743
  3. package/browser/applicationinsights-common.js.map +1 -1
  4. package/browser/applicationinsights-common.min.js +2 -2
  5. package/browser/applicationinsights-common.min.js.map +1 -1
  6. package/dist/applicationinsights-common.api.json +2816 -1246
  7. package/dist/applicationinsights-common.api.md +87 -43
  8. package/dist/applicationinsights-common.d.ts +503 -290
  9. package/dist/applicationinsights-common.js +521 -743
  10. package/dist/applicationinsights-common.js.map +1 -1
  11. package/dist/applicationinsights-common.min.js +2 -2
  12. package/dist/applicationinsights-common.min.js.map +1 -1
  13. package/dist/applicationinsights-common.rollup.d.ts +503 -290
  14. package/dist-esm/ConnectionStringParser.js +1 -1
  15. package/dist-esm/Constants.js +1 -1
  16. package/dist-esm/DomHelperFuncs.js +1 -1
  17. package/dist-esm/Enums.js +1 -1
  18. package/dist-esm/HelperFuncs.js +1 -1
  19. package/dist-esm/Interfaces/ConnectionString.js +1 -1
  20. package/dist-esm/Interfaces/Context/IApplication.js +1 -1
  21. package/dist-esm/Interfaces/Context/IDevice.js +1 -1
  22. package/dist-esm/Interfaces/Context/IInternal.js +1 -1
  23. package/dist-esm/Interfaces/Context/ILocation.js +1 -1
  24. package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
  25. package/dist-esm/Interfaces/Context/ISample.js +1 -1
  26. package/dist-esm/Interfaces/Context/ISession.js +1 -1
  27. package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
  28. package/dist-esm/Interfaces/Context/IUser.js +1 -1
  29. package/dist-esm/Interfaces/Context/IWeb.js +1 -1
  30. package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
  31. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
  32. package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
  33. package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
  34. package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
  35. package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
  36. package/dist-esm/Interfaces/Contracts/IData.js +1 -1
  37. package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
  38. package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
  39. package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
  40. package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
  41. package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
  42. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
  43. package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
  44. package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
  45. package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
  46. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
  47. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
  48. package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
  49. package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
  50. package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
  51. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  52. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  53. package/dist-esm/Interfaces/IConfig.js +1 -1
  54. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  55. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  56. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  57. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  58. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  59. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  60. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  61. package/dist-esm/Interfaces/IPartC.js +1 -1
  62. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  63. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  64. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  65. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  66. package/dist-esm/Interfaces/PartAExtensions.js +2 -2
  67. package/dist-esm/Interfaces/PartAExtensions.js.map +1 -1
  68. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  69. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  70. package/dist-esm/RequestResponseHeaders.js +1 -1
  71. package/dist-esm/StorageHelperFuncs.js +8 -8
  72. package/dist-esm/StorageHelperFuncs.js.map +1 -1
  73. package/dist-esm/Telemetry/Common/Data.js +6 -11
  74. package/dist-esm/Telemetry/Common/Data.js.map +1 -1
  75. package/dist-esm/Telemetry/Common/DataPoint.js +8 -9
  76. package/dist-esm/Telemetry/Common/DataPoint.js.map +1 -1
  77. package/dist-esm/Telemetry/Common/DataSanitizer.js +9 -9
  78. package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
  79. package/dist-esm/Telemetry/Common/Envelope.js +12 -12
  80. package/dist-esm/Telemetry/Common/Envelope.js.map +1 -1
  81. package/dist-esm/Telemetry/Event.js +9 -12
  82. package/dist-esm/Telemetry/Event.js.map +1 -1
  83. package/dist-esm/Telemetry/Exception.js +74 -81
  84. package/dist-esm/Telemetry/Exception.js.map +1 -1
  85. package/dist-esm/Telemetry/Metric.js +9 -12
  86. package/dist-esm/Telemetry/Metric.js.map +1 -1
  87. package/dist-esm/Telemetry/PageView.js +12 -15
  88. package/dist-esm/Telemetry/PageView.js.map +1 -1
  89. package/dist-esm/Telemetry/PageViewPerformance.js +16 -19
  90. package/dist-esm/Telemetry/PageViewPerformance.js.map +1 -1
  91. package/dist-esm/Telemetry/RemoteDependencyData.js +17 -20
  92. package/dist-esm/Telemetry/RemoteDependencyData.js.map +1 -1
  93. package/dist-esm/Telemetry/Trace.js +10 -13
  94. package/dist-esm/Telemetry/Trace.js.map +1 -1
  95. package/dist-esm/TelemetryItemCreator.js +1 -1
  96. package/dist-esm/UrlHelperFuncs.js +1 -1
  97. package/dist-esm/Util.js +1 -1
  98. package/dist-esm/applicationinsights-common.js +3 -6
  99. package/dist-esm/applicationinsights-common.js.map +1 -1
  100. package/package.json +3 -3
  101. package/src/Interfaces/IExceptionTelemetry.ts +1 -1
  102. package/src/Interfaces/ITraceTelemetry.ts +1 -1
  103. package/src/Interfaces/PartAExtensions.ts +1 -1
  104. package/src/Interfaces/Telemetry/IEnvelope.ts +35 -3
  105. package/src/StorageHelperFuncs.ts +7 -7
  106. package/src/Telemetry/Common/Data.ts +12 -4
  107. package/src/Telemetry/Common/DataPoint.ts +38 -2
  108. package/src/Telemetry/Common/DataSanitizer.ts +10 -10
  109. package/src/Telemetry/Common/Envelope.ts +51 -10
  110. package/src/Telemetry/Event.ts +30 -12
  111. package/src/Telemetry/Exception.ts +158 -71
  112. package/src/Telemetry/Metric.ts +27 -7
  113. package/src/Telemetry/PageView.ts +45 -10
  114. package/src/Telemetry/PageViewPerformance.ts +76 -14
  115. package/src/Telemetry/RemoteDependencyData.ts +70 -15
  116. package/src/Telemetry/Trace.ts +34 -8
  117. package/src/applicationinsights-common.ts +5 -5
  118. package/types/Enums.d.ts +4 -4
  119. package/types/Interfaces/IExceptionTelemetry.d.ts +1 -1
  120. package/types/Interfaces/ITraceTelemetry.d.ts +1 -1
  121. package/types/Interfaces/PartAExtensions.d.ts +1 -1
  122. package/types/Interfaces/Telemetry/IEnvelope.d.ts +24 -0
  123. package/types/Telemetry/Common/Data.d.ts +10 -2
  124. package/types/Telemetry/Common/DataPoint.d.ts +31 -2
  125. package/types/Telemetry/Common/DataSanitizer.d.ts +3 -3
  126. package/types/Telemetry/Common/Envelope.d.ts +35 -4
  127. package/types/Telemetry/Event.d.ts +19 -3
  128. package/types/Telemetry/Exception.d.ts +75 -7
  129. package/types/Telemetry/Metric.d.ts +19 -2
  130. package/types/Telemetry/PageView.d.ts +30 -2
  131. package/types/Telemetry/PageViewPerformance.d.ts +50 -2
  132. package/types/Telemetry/RemoteDependencyData.d.ts +46 -2
  133. package/types/Telemetry/Trace.d.ts +23 -3
  134. package/types/applicationinsights-common.d.ts +5 -5
  135. package/types/tsdoc-metadata.json +1 -1
  136. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +0 -27
  137. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js.map +0 -1
  138. package/dist-esm/Interfaces/Contracts/Generated/Base.js +0 -17
  139. package/dist-esm/Interfaces/Contracts/Generated/Base.js.map +0 -1
  140. package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js +0 -89
  141. package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js.map +0 -1
  142. package/dist-esm/Interfaces/Contracts/Generated/Data.js +0 -21
  143. package/dist-esm/Interfaces/Contracts/Generated/Data.js.map +0 -1
  144. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +0 -21
  145. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js.map +0 -1
  146. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +0 -16
  147. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js.map +0 -1
  148. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +0 -17
  149. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js.map +0 -1
  150. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +0 -17
  151. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js.map +0 -1
  152. package/dist-esm/Interfaces/Contracts/Generated/Domain.js +0 -8
  153. package/dist-esm/Interfaces/Contracts/Generated/Domain.js.map +0 -1
  154. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +0 -28
  155. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js.map +0 -1
  156. package/dist-esm/Interfaces/Contracts/Generated/EventData.js +0 -28
  157. package/dist-esm/Interfaces/Contracts/Generated/EventData.js.map +0 -1
  158. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +0 -32
  159. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js.map +0 -1
  160. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +0 -24
  161. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js.map +0 -1
  162. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +0 -28
  163. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js.map +0 -1
  164. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +0 -32
  165. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js.map +0 -1
  166. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +0 -34
  167. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js.map +0 -1
  168. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +0 -34
  169. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js.map +0 -1
  170. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +0 -32
  171. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js.map +0 -1
  172. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +0 -28
  173. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js.map +0 -1
  174. package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js +0 -19
  175. package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js.map +0 -1
  176. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +0 -17
  177. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js.map +0 -1
  178. package/dist-esm/Telemetry/Common/Base.js +0 -22
  179. package/dist-esm/Telemetry/Common/Base.js.map +0 -1
  180. package/src/Interfaces/Contracts/Generated/AvailabilityData.ts +0 -57
  181. package/src/Interfaces/Contracts/Generated/Base.ts +0 -18
  182. package/src/Interfaces/Contracts/Generated/ContextTagKeys.ts +0 -299
  183. package/src/Interfaces/Contracts/Generated/Data.ts +0 -26
  184. package/src/Interfaces/Contracts/Generated/DataPoint.ts +0 -44
  185. package/src/Interfaces/Contracts/Generated/DataPointType.ts +0 -11
  186. package/src/Interfaces/Contracts/Generated/DependencyKind.ts +0 -12
  187. package/src/Interfaces/Contracts/Generated/DependencySourceType.ts +0 -12
  188. package/src/Interfaces/Contracts/Generated/Domain.ts +0 -10
  189. package/src/Interfaces/Contracts/Generated/Envelope.ts +0 -50
  190. package/src/Interfaces/Contracts/Generated/EventData.ts +0 -33
  191. package/src/Interfaces/Contracts/Generated/ExceptionData.ts +0 -40
  192. package/src/Interfaces/Contracts/Generated/ExceptionDetails.ts +0 -46
  193. package/src/Interfaces/Contracts/Generated/MessageData.ts +0 -39
  194. package/src/Interfaces/Contracts/Generated/MetricData.ts +0 -34
  195. package/src/Interfaces/Contracts/Generated/PageViewData.ts +0 -50
  196. package/src/Interfaces/Contracts/Generated/PageViewPerfData.ts +0 -70
  197. package/src/Interfaces/Contracts/Generated/RemoteDependencyData.ts +0 -68
  198. package/src/Interfaces/Contracts/Generated/RequestData.ts +0 -50
  199. package/src/Interfaces/Contracts/Generated/SeverityLevel.ts +0 -15
  200. package/src/Interfaces/Contracts/Generated/StackFrame.ts +0 -34
  201. package/src/Telemetry/Common/Base.ts +0 -14
  202. package/types/Interfaces/Contracts/Generated/AvailabilityData.d.ts +0 -42
  203. package/types/Interfaces/Contracts/Generated/Base.d.ts +0 -10
  204. package/types/Interfaces/Contracts/Generated/ContextTagKeys.d.ts +0 -175
  205. package/types/Interfaces/Contracts/Generated/Data.d.ts +0 -15
  206. package/types/Interfaces/Contracts/Generated/DataPoint.d.ts +0 -34
  207. package/types/Interfaces/Contracts/Generated/DataPointType.d.ts +0 -7
  208. package/types/Interfaces/Contracts/Generated/DependencyKind.d.ts +0 -8
  209. package/types/Interfaces/Contracts/Generated/DependencySourceType.d.ts +0 -8
  210. package/types/Interfaces/Contracts/Generated/Domain.d.ts +0 -5
  211. package/types/Interfaces/Contracts/Generated/Envelope.d.ts +0 -38
  212. package/types/Interfaces/Contracts/Generated/EventData.d.ts +0 -23
  213. package/types/Interfaces/Contracts/Generated/ExceptionData.d.ts +0 -29
  214. package/types/Interfaces/Contracts/Generated/ExceptionDetails.d.ts +0 -34
  215. package/types/Interfaces/Contracts/Generated/MessageData.d.ts +0 -28
  216. package/types/Interfaces/Contracts/Generated/MetricData.d.ts +0 -24
  217. package/types/Interfaces/Contracts/Generated/PageViewData.d.ts +0 -35
  218. package/types/Interfaces/Contracts/Generated/PageViewPerfData.d.ts +0 -51
  219. package/types/Interfaces/Contracts/Generated/RemoteDependencyData.d.ts +0 -51
  220. package/types/Interfaces/Contracts/Generated/RequestData.d.ts +0 -38
  221. package/types/Interfaces/Contracts/Generated/SeverityLevel.d.ts +0 -10
  222. package/types/Interfaces/Contracts/Generated/StackFrame.d.ts +0 -25
  223. package/types/Telemetry/Common/Base.d.ts +0 -8
@@ -1,4 +1,4 @@
1
- import { ContextTagKeys } from "./Contracts/Generated/ContextTagKeys";
1
+ import { ContextTagKeys } from "./Contracts/ContextTagKeys";
2
2
 
3
3
  export const Extensions = {
4
4
  UserExt: "user",
@@ -4,12 +4,44 @@
4
4
  import { ISerializable } from "./ISerializable";
5
5
 
6
6
  export interface IEnvelope extends ISerializable {
7
- ver: number;
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
- sampleRate: number;
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
- tags: { [name: string]: any };
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, _InternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
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
- _InternalMessageId.BrowserCannotReadLocalStorage,
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
- _InternalMessageId.BrowserCannotWriteLocalStorage,
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
- _InternalMessageId.BrowserFailedRemovalFromLocalStorage,
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
- _InternalMessageId.BrowserCannotReadSessionStorage,
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
- _InternalMessageId.BrowserCannotWriteSessionStorage,
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
- _InternalMessageId.BrowserFailedRemovalFromSessionStorage,
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 { Data as AIData } from "../../Interfaces/Contracts/Generated/Data";
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> extends AIData<TDomain> implements ISerializable {
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 { DataPoint as AIDataPoint } from "../../Interfaces/Contracts/Generated/DataPoint";
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 extends AIDataPoint implements ISerializable {
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, _InternalMessageId, hasJSON, getJSON, objForEachKey, isObject, strTrim, _throwInternal } from "@microsoft/applicationinsights-core-js";
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
- _InternalMessageId.NameTooLong,
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
- _InternalMessageId.StringValueTooLong,
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, _InternalMessageId.UrlTooLong);
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, _InternalMessageId.MessageTruncated,
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, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + DataSanitizerValues.MAX_EXCEPTION_LENGTH + " characters.",
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, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e}, true);
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, _InternalMessageId.IdTooLong).toString() : id;
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: _InternalMessageId) {
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: _InternalMessageId) => any;
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 { Envelope as AIEnvelope } from "../../Interfaces/Contracts/Generated/Envelope";
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 extends AIEnvelope implements IEnvelope {
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
- * Constructs a new instance of telemetry data.
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
- constructor(logger: IDiagnosticLogger, data: Base, name: string) {
23
- super();
21
+ public ver: number; /* 1 */
24
22
 
25
- this.name = dataSanitizeString(logger, name) || strNotSpecified;
26
- this.data = data;
27
- this.time = toISOString(new Date());
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
- this.aiDataContract = {
70
+ _self.aiDataContract = {
30
71
  time: FieldType.Required,
31
72
  iKey: FieldType.Required,
32
73
  name: FieldType.Required,
@@ -1,15 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
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 extends EventData implements ISerializable {
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
- * Constructs a new instance of the EventTelemetry object
23
+ * Schema version
25
24
  */
26
- constructor(logger: IDiagnosticLogger, name: string, properties?: any, measurements?: any) {
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
- super();
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
- this.name = dataSanitizeString(logger, name) || strNotSpecified;
31
- this.properties = dataSanitizeProperties(logger, properties);
32
- this.measurements = dataSanitizeMeasurements(logger, measurements);
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
+ }