@microsoft/applicationinsights-common 2.8.0-nightly.2204-04 → 2.8.0-nightly.2204-07

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 (118) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +566 -504
  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 +1206 -399
  7. package/dist/applicationinsights-common.api.md +105 -28
  8. package/dist/applicationinsights-common.d.ts +169 -31
  9. package/dist/applicationinsights-common.js +566 -504
  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 +169 -31
  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 +9 -10
  51. package/dist-esm/Interfaces/Contracts/SeverityLevel.js.map +1 -1
  52. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  53. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  54. package/dist-esm/Interfaces/IConfig.js +1 -1
  55. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  56. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  57. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  58. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  59. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  60. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  61. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  62. package/dist-esm/Interfaces/IPartC.js +1 -1
  63. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  64. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  65. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  66. package/dist-esm/Interfaces/ITraceParent.js +8 -0
  67. package/dist-esm/Interfaces/ITraceParent.js.map +1 -0
  68. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  69. package/dist-esm/Interfaces/PartAExtensions.js +1 -1
  70. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  71. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  72. package/dist-esm/RequestResponseHeaders.js +13 -12
  73. package/dist-esm/RequestResponseHeaders.js.map +1 -1
  74. package/dist-esm/StorageHelperFuncs.js +12 -12
  75. package/dist-esm/StorageHelperFuncs.js.map +1 -1
  76. package/dist-esm/Telemetry/Common/Data.js +1 -1
  77. package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
  78. package/dist-esm/Telemetry/Common/DataSanitizer.js +9 -9
  79. package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
  80. package/dist-esm/Telemetry/Common/Envelope.js +1 -1
  81. package/dist-esm/Telemetry/Event.js +1 -1
  82. package/dist-esm/Telemetry/Exception.js +1 -1
  83. package/dist-esm/Telemetry/Metric.js +1 -1
  84. package/dist-esm/Telemetry/PageView.js +1 -1
  85. package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
  86. package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
  87. package/dist-esm/Telemetry/Trace.js +1 -1
  88. package/dist-esm/TelemetryItemCreator.js +42 -32
  89. package/dist-esm/TelemetryItemCreator.js.map +1 -1
  90. package/dist-esm/UrlHelperFuncs.js +1 -1
  91. package/dist-esm/Util.js +2 -2
  92. package/dist-esm/Util.js.map +1 -1
  93. package/dist-esm/W3cTraceParent.js +192 -0
  94. package/dist-esm/W3cTraceParent.js.map +1 -0
  95. package/dist-esm/applicationinsights-common.js +3 -2
  96. package/dist-esm/applicationinsights-common.js.map +1 -1
  97. package/package.json +2 -2
  98. package/src/Enums.ts +2 -3
  99. package/src/Interfaces/Contracts/SeverityLevel.ts +15 -2
  100. package/src/Interfaces/IConfig.ts +2 -9
  101. package/src/Interfaces/ITraceParent.ts +38 -0
  102. package/src/RequestResponseHeaders.ts +38 -2
  103. package/src/StorageHelperFuncs.ts +11 -11
  104. package/src/Telemetry/Common/DataSanitizer.ts +10 -10
  105. package/src/Telemetry/PageViewPerformance.ts +1 -1
  106. package/src/TelemetryItemCreator.ts +56 -44
  107. package/src/Util.ts +3 -3
  108. package/src/W3cTraceParent.ts +219 -0
  109. package/src/applicationinsights-common.ts +8 -3
  110. package/types/Enums.d.ts +2 -9
  111. package/types/Interfaces/Contracts/SeverityLevel.d.ts +6 -1
  112. package/types/Interfaces/IConfig.d.ts +3 -9
  113. package/types/Interfaces/ITraceParent.d.ts +32 -0
  114. package/types/RequestResponseHeaders.d.ts +31 -1
  115. package/types/Telemetry/Common/DataSanitizer.d.ts +3 -3
  116. package/types/TelemetryItemCreator.d.ts +15 -5
  117. package/types/W3cTraceParent.d.ts +59 -0
  118. package/types/applicationinsights-common.d.ts +5 -3
@@ -4,13 +4,13 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ import { _eInternalMessageId } from '@microsoft/applicationinsights-core-js';
8
+ import { EnumValue } from '@microsoft/applicationinsights-core-js';
7
9
  import { IChannelControls } from '@microsoft/applicationinsights-core-js';
8
10
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
9
11
  import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
10
- import { ICookieMgrConfig } from '@microsoft/applicationinsights-core-js';
11
12
  import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
12
13
  import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
13
- import { _InternalMessageId } from '@microsoft/applicationinsights-core-js';
14
14
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
15
15
  import { isBeaconsSupported as isBeaconApiSupported } from '@microsoft/applicationinsights-core-js';
16
16
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
@@ -56,6 +56,16 @@ export const CorrelationIdHelper: ICorrelationIdHelper;
56
56
  // @public (undocumented)
57
57
  export function createDomEvent(eventName: string): Event;
58
58
 
59
+ // @public
60
+ export function createTelemetryItem<T>(item: T, baseType: string, envelopeName: string, logger: IDiagnosticLogger, customProperties?: {
61
+ [key: string]: any;
62
+ }, systemProperties?: {
63
+ [key: string]: any;
64
+ }): ITelemetryItem;
65
+
66
+ // @public
67
+ export function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent;
68
+
59
69
  // @public (undocumented)
60
70
  export let CtxTagKeys: ContextTagKeys;
61
71
 
@@ -77,7 +87,7 @@ export function dataSanitizeException(logger: IDiagnosticLogger, exception: any)
77
87
  export function dataSanitizeId(logger: IDiagnosticLogger, id: string): string;
78
88
 
79
89
  // @public (undocumented)
80
- export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId): any;
90
+ export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId): any;
81
91
 
82
92
  // @public (undocumented)
83
93
  export function dataSanitizeKey(logger: IDiagnosticLogger, name: any): any;
@@ -130,11 +140,7 @@ export const DEFAULT_BREEZE_ENDPOINT = "https://dc.services.visualstudio.com";
130
140
  export const DisabledPropertyName: string;
131
141
 
132
142
  // @public (undocumented)
133
- export const DistributedTracingModes: {
134
- AI: number;
135
- AI_AND_W3C: number;
136
- W3C: number;
137
- };
143
+ export const DistributedTracingModes: EnumValue<typeof eDistributedTracingModes>;
138
144
 
139
145
  // @public (undocumented)
140
146
  export type DistributedTracingModes = number | eDistributedTracingModes;
@@ -163,6 +169,42 @@ export class Envelope implements IEnvelope {
163
169
  ver: number;
164
170
  }
165
171
 
172
+ // @public (undocumented)
173
+ export const enum eRequestHeaders {
174
+ // (undocumented)
175
+ requestContextAppIdFormat = 2,
176
+ // (undocumented)
177
+ requestContextHeader = 0,
178
+ // (undocumented)
179
+ requestContextHeaderLowerCase = 8,
180
+ // (undocumented)
181
+ requestContextTargetKey = 1,
182
+ // (undocumented)
183
+ requestIdHeader = 3,
184
+ // (undocumented)
185
+ sdkContextHeader = 6,
186
+ // (undocumented)
187
+ sdkContextHeaderAppIdRequest = 7,
188
+ // (undocumented)
189
+ traceParentHeader = 4,
190
+ // (undocumented)
191
+ traceStateHeader = 5
192
+ }
193
+
194
+ // @public
195
+ export const enum eSeverityLevel {
196
+ // (undocumented)
197
+ Critical = 4,
198
+ // (undocumented)
199
+ Error = 3,
200
+ // (undocumented)
201
+ Information = 1,
202
+ // (undocumented)
203
+ Verbose = 0,
204
+ // (undocumented)
205
+ Warning = 2
206
+ }
207
+
166
208
  // Warning: (ae-forgotten-export) The symbol "IEventData" needs to be exported by the entry point applicationinsights-common.d.ts
167
209
  //
168
210
  // @public (undocumented)
@@ -258,6 +300,12 @@ export const enum FieldType {
258
300
  Required = 1
259
301
  }
260
302
 
303
+ // @public
304
+ export function findW3cTraceParent(): ITraceParent;
305
+
306
+ // @public
307
+ export function formatTraceParent(value: ITraceParent): string;
308
+
261
309
  // @public (undocumented)
262
310
  export function getExtensionByName(extensions: IPlugin[], identifier: string): IPlugin | null;
263
311
 
@@ -340,7 +388,6 @@ export interface IConfig {
340
388
  autoUnhandledPromiseInstrumented?: boolean;
341
389
  convertUndefined?: any;
342
390
  cookieDomain?: string;
343
- cookieMgrCfg?: ICookieMgrConfig;
344
391
  cookiePath?: string;
345
392
  // (undocumented)
346
393
  correlationHeaderDomains?: string[];
@@ -541,7 +588,7 @@ export interface IDataSanitizer {
541
588
  // (undocumented)
542
589
  sanitizeId: (logger: IDiagnosticLogger, id: string) => string;
543
590
  // (undocumented)
544
- sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId) => any;
591
+ sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) => any;
545
592
  // (undocumented)
546
593
  sanitizeKey: (logger: IDiagnosticLogger, name: any) => string;
547
594
  // (undocumented)
@@ -785,6 +832,18 @@ export interface ISession {
785
832
  // @public (undocumented)
786
833
  export function isInternalApplicationInsightsEndpoint(endpointUrl: string): boolean;
787
834
 
835
+ // @public
836
+ export function isSampledFlag(value: ITraceParent): boolean;
837
+
838
+ // @public
839
+ export function isValidSpanId(value: string): boolean;
840
+
841
+ // @public
842
+ export function isValidTraceId(value: string): boolean;
843
+
844
+ // @public
845
+ export function isValidTraceParent(value: ITraceParent): boolean;
846
+
788
847
  // @public (undocumented)
789
848
  export interface ITelemetryContext {
790
849
  appId: () => string;
@@ -808,6 +867,14 @@ export interface ITelemetryTrace {
808
867
  traceState?: ITraceState;
809
868
  }
810
869
 
870
+ // @public
871
+ export interface ITraceParent {
872
+ spanId: string;
873
+ traceFlags: number;
874
+ traceId: string;
875
+ version: string;
876
+ }
877
+
811
878
  // @public (undocumented)
812
879
  export interface ITraceState {
813
880
  }
@@ -1022,6 +1089,9 @@ export class PageViewPerformance implements IPageViewPerfData, ISerializable {
1022
1089
  // @public (undocumented)
1023
1090
  export function parseConnectionString(connectionString?: string): ConnectionString;
1024
1091
 
1092
+ // @public
1093
+ export function parseTraceParent(value: string): ITraceParent;
1094
+
1025
1095
  // @public (undocumented)
1026
1096
  export const ProcessLegacy = "ProcessLegacy";
1027
1097
 
@@ -1075,24 +1145,35 @@ export class RemoteDependencyData implements IRemoteDependencyData, ISerializabl
1075
1145
  }
1076
1146
 
1077
1147
  // @public (undocumented)
1078
- export const RequestHeaders: IRequestHeaders;
1148
+ export const RequestHeaders: IRequestHeaders & {
1149
+ requestContextHeader: "Request-Context";
1150
+ requestContextTargetKey: "appId";
1151
+ requestContextAppIdFormat: "appId=cid-v1:";
1152
+ requestIdHeader: "Request-Id";
1153
+ traceParentHeader: "traceparent";
1154
+ traceStateHeader: "tracestate";
1155
+ sdkContextHeader: "Sdk-Context";
1156
+ sdkContextHeaderAppIdRequest: "appId";
1157
+ requestContextHeaderLowerCase: "request-context";
1158
+ 0: "Request-Context";
1159
+ 1: "appId";
1160
+ 2: "appId=cid-v1:";
1161
+ 3: "Request-Id";
1162
+ 4: "traceparent";
1163
+ 5: "tracestate";
1164
+ 6: "Sdk-Context";
1165
+ 7: "appId";
1166
+ 8: "request-context";
1167
+ };
1079
1168
 
1080
1169
  // @public (undocumented)
1081
1170
  export const SampleRate = "sampleRate";
1082
1171
 
1083
1172
  // @public
1084
- export enum SeverityLevel {
1085
- // (undocumented)
1086
- Critical = 4,
1087
- // (undocumented)
1088
- Error = 3,
1089
- // (undocumented)
1090
- Information = 1,
1091
- // (undocumented)
1092
- Verbose = 0,
1093
- // (undocumented)
1094
- Warning = 2
1095
- }
1173
+ export const SeverityLevel: EnumValue<typeof eSeverityLevel>;
1174
+
1175
+ // @public (undocumented)
1176
+ export type SeverityLevel = number | eSeverityLevel;
1096
1177
 
1097
1178
  // @public (undocumented)
1098
1179
  export function stringToBoolOrDefault(str: any, defaultValue?: boolean): boolean;
@@ -1102,11 +1183,7 @@ export const strNotSpecified = "not_specified";
1102
1183
 
1103
1184
  // @public (undocumented)
1104
1185
  export class TelemetryItemCreator {
1105
- static create<T>(item: T, baseType: string, envelopeName: string, logger: IDiagnosticLogger, customProperties?: {
1106
- [key: string]: any;
1107
- }, systemProperties?: {
1108
- [key: string]: any;
1109
- }): ITelemetryItem;
1186
+ static create: typeof createTelemetryItem;
1110
1187
  }
1111
1188
 
1112
1189
  // Warning: (ae-forgotten-export) The symbol "IMessageData" needs to be exported by the entry point applicationinsights-common.d.ts
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Common JavaScript Library, 2.8.0-nightly.2204-04
2
+ * Microsoft Application Insights Common JavaScript Library, 2.8.0-nightly.2204-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -7,13 +7,13 @@
7
7
  */
8
8
 
9
9
  declare namespace ApplicationInsights {
10
+ import { _eInternalMessageId } from '@microsoft/applicationinsights-core-js';
11
+ import { EnumValue } from '@microsoft/applicationinsights-core-js';
10
12
  import { IChannelControls } from '@microsoft/applicationinsights-core-js';
11
13
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
12
14
  import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
13
- import { ICookieMgrConfig } from '@microsoft/applicationinsights-core-js';
14
15
  import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
15
16
  import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
16
- import { _InternalMessageId } from '@microsoft/applicationinsights-core-js';
17
17
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
18
18
  import { isBeaconsSupported as isBeaconApiSupported } from '@microsoft/applicationinsights-core-js';
19
19
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
@@ -70,6 +70,31 @@ declare namespace ApplicationInsights {
70
70
 
71
71
  function createDomEvent(eventName: string): Event;
72
72
 
73
+ /**
74
+ * Create a telemetry item that the 1DS channel understands
75
+ * @param item domain specific properties; part B
76
+ * @param baseType telemetry item type. ie PageViewData
77
+ * @param envelopeName name of the envelope. ie Microsoft.ApplicationInsights.<instrumentation key>.PageView
78
+ * @param customProperties user defined custom properties; part C
79
+ * @param systemProperties system properties that are added to the context; part A
80
+ * @returns ITelemetryItem that is sent to channel
81
+ */
82
+ function createTelemetryItem<T>(item: T, baseType: string, envelopeName: string, logger: IDiagnosticLogger, customProperties?: {
83
+ [key: string]: any;
84
+ }, systemProperties?: {
85
+ [key: string]: any;
86
+ }): ITelemetryItem;
87
+
88
+ /**
89
+ * Create a new ITraceParent instance using the provided values.
90
+ * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.
91
+ * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.
92
+ * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid
93
+ * @param version - The version to used, defaults to version "01" if not supplied or invalid.
94
+ * @returns
95
+ */
96
+ function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent;
97
+
73
98
  let CtxTagKeys: ContextTagKeys;
74
99
 
75
100
  class Data<TDomain> implements AIData<TDomain>, ISerializable {
@@ -149,7 +174,7 @@ declare namespace ApplicationInsights {
149
174
 
150
175
  function dataSanitizeId(logger: IDiagnosticLogger, id: string): string;
151
176
 
152
- function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId): any;
177
+ function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId): any;
153
178
 
154
179
  function dataSanitizeKey(logger: IDiagnosticLogger, name: any): any;
155
180
 
@@ -221,11 +246,7 @@ declare namespace ApplicationInsights {
221
246
  */
222
247
  const DisabledPropertyName: string;
223
248
 
224
- const DistributedTracingModes: {
225
- AI: number;
226
- AI_AND_W3C: number;
227
- W3C: number;
228
- };
249
+ const DistributedTracingModes: EnumValue<typeof eDistributedTracingModes>;
229
250
 
230
251
  type DistributedTracingModes = number | eDistributedTracingModes;
231
252
 
@@ -289,6 +310,29 @@ declare namespace ApplicationInsights {
289
310
  constructor(logger: IDiagnosticLogger, data: AIBase, name: string);
290
311
  }
291
312
 
313
+ const enum eRequestHeaders {
314
+ requestContextHeader = 0,
315
+ requestContextTargetKey = 1,
316
+ requestContextAppIdFormat = 2,
317
+ requestIdHeader = 3,
318
+ traceParentHeader = 4,
319
+ traceStateHeader = 5,
320
+ sdkContextHeader = 6,
321
+ sdkContextHeaderAppIdRequest = 7,
322
+ requestContextHeaderLowerCase = 8
323
+ }
324
+
325
+ /**
326
+ * Defines the level of severity for the event.
327
+ */
328
+ const enum eSeverityLevel {
329
+ Verbose = 0,
330
+ Information = 1,
331
+ Warning = 2,
332
+ Error = 3,
333
+ Critical = 4
334
+ }
335
+
292
336
  class Event_2 implements IEventData, ISerializable {
293
337
  static envelopeType: string;
294
338
  static dataType: string;
@@ -396,12 +440,28 @@ declare namespace ApplicationInsights {
396
440
  Hidden = 4
397
441
  }
398
442
 
443
+ /**
444
+ * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
445
+ * @returns
446
+ */
447
+ function findW3cTraceParent(): ITraceParent;
448
+
399
449
  /**
400
450
  * Formats the provided errorObj for display and reporting, it may be a String, Object, integer or undefined depending on the browser.
401
451
  * @param errorObj The supplied errorObj
402
452
  */
403
453
  function _formatErrorCode(errorObj: any): any;
404
454
 
455
+ /**
456
+ * Format the ITraceParent value as a string using the supported and know version formats.
457
+ * So even if the passed traceParent is a later version the string value returned from this
458
+ * function will convert it to only the known version formats.
459
+ * This currently only supports version "00" and invalid "ff"
460
+ * @param value - The parsed traceParent value
461
+ * @returns
462
+ */
463
+ function formatTraceParent(value: ITraceParent): string;
464
+
405
465
  function getExtensionByName(extensions: IPlugin[], identifier: string): IPlugin | null;
406
466
 
407
467
  const HttpMethod = "http.method";
@@ -652,7 +712,7 @@ declare namespace ApplicationInsights {
652
712
  */
653
713
  enableSessionStorageBuffer?: boolean;
654
714
  /**
655
- * @deprecated Use either disableCookiesUsage or specify a cookieMgrCfg with the enabled value set.
715
+ * @deprecated Use either disableCookiesUsage or specify a cookieCfg with the enabled value set.
656
716
  * If true, the SDK will not store or read any data from cookies. Default is false. As this field is being deprecated, when both
657
717
  * isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent.
658
718
  * @defaultValue false
@@ -660,7 +720,7 @@ declare namespace ApplicationInsights {
660
720
  isCookieUseDisabled?: boolean;
661
721
  /**
662
722
  * If true, the SDK will not store or read any data from cookies. Default is false.
663
- * If you have also specified a cookieMgrCfg then enabled property (if specified) will take precedent over this value.
723
+ * If you have also specified a cookieCfg then enabled property (if specified) will take precedent over this value.
664
724
  * @defaultValue false
665
725
  */
666
726
  disableCookiesUsage?: boolean;
@@ -674,12 +734,6 @@ declare namespace ApplicationInsights {
674
734
  * @defaultValue ""
675
735
  */
676
736
  cookiePath?: string;
677
- /**
678
- * [Optional] A Cookie Manager configuration which includes hooks to allow interception of the get, set and delete cookie
679
- * operations. If this configuration is specified any specified enabled and domain properties will take precedence over the
680
- * cookieDomain and disableCookiesUsage values.
681
- */
682
- cookieMgrCfg?: ICookieMgrConfig;
683
737
  /**
684
738
  * Default false. If false, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error), 503 (service unavailable), and 0 (offline, only if detected)
685
739
  * @description
@@ -1138,7 +1192,7 @@ declare namespace ApplicationInsights {
1138
1192
  sanitizeProperties: (logger: IDiagnosticLogger, properties: any) => any;
1139
1193
  sanitizeMeasurements: (logger: IDiagnosticLogger, measurements: any) => any;
1140
1194
  sanitizeId: (logger: IDiagnosticLogger, id: string) => string;
1141
- sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _InternalMessageId) => any;
1195
+ sanitizeInput: (logger: IDiagnosticLogger, input: any, maxLength: number, _msgId: _eInternalMessageId) => any;
1142
1196
  padNumber: (num: number) => string;
1143
1197
  /**
1144
1198
  * helper method to trim strings (IE8 does not implement String.prototype.trim)
@@ -1838,6 +1892,13 @@ declare namespace ApplicationInsights {
1838
1892
 
1839
1893
  function isInternalApplicationInsightsEndpoint(endpointUrl: string): boolean;
1840
1894
 
1895
+ /**
1896
+ * Is the parsed traceParent indicating that the trace is currently sampled.
1897
+ * @param value - The parsed traceParent value
1898
+ * @returns
1899
+ */
1900
+ function isSampledFlag(value: ITraceParent): boolean;
1901
+
1841
1902
  interface IStackDetails {
1842
1903
  src: string;
1843
1904
  obj: string[];
@@ -1869,6 +1930,31 @@ declare namespace ApplicationInsights {
1869
1930
  line: number;
1870
1931
  }
1871
1932
 
1933
+ /**
1934
+ * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character
1935
+ * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
1936
+ * If all characters are zero (0000000000000000) this is considered an invalid value.
1937
+ * @param value - The W3c span id to be validated
1938
+ * @returns true if valid otherwise false
1939
+ */
1940
+ function isValidSpanId(value: string): boolean;
1941
+
1942
+ /**
1943
+ * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string
1944
+ * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.
1945
+ * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.
1946
+ * @param value - The W3c trace Id to be validated
1947
+ * @returns true if valid otherwise false
1948
+ */
1949
+ function isValidTraceId(value: string): boolean;
1950
+
1951
+ /**
1952
+ * Validates that the provided ITraceParent instance conforms to the currently supported specifications
1953
+ * @param value
1954
+ * @returns
1955
+ */
1956
+ function isValidTraceParent(value: ITraceParent): boolean;
1957
+
1872
1958
  interface ITelemetryContext {
1873
1959
  /**
1874
1960
  * The object describing a component tracked by this object.
@@ -1935,6 +2021,39 @@ declare namespace ApplicationInsights {
1935
2021
  name?: string;
1936
2022
  }
1937
2023
 
2024
+ /**
2025
+ * This interface represents the components of a W3C traceparent header
2026
+ */
2027
+ interface ITraceParent {
2028
+ /**
2029
+ * The version of the definition, this MUST be a string with a length of 2 and only contain lowercase
2030
+ * hexadecimal characters. A value of 'ff' is considered to be an invalid version.
2031
+ */
2032
+ version: string;
2033
+ /**
2034
+ * This is the ID of the whole trace forest and is used to uniquely identify a distributed trace
2035
+ * through a system. It is represented as a 32-character string of lowercase hexadecimal characters,
2036
+ * for example, 4bf92f3577b34da6a3ce929d0e0e4736.
2037
+ * All characters as zero (00000000000000000000000000000000) is considered an invalid value.
2038
+ */
2039
+ traceId: string;
2040
+ /**
2041
+ * This is the ID of the current request as known by the caller (in some tracing systems, this is also
2042
+ * known as the parent-id, where a span is the execution of a client request). It is represented as an
2043
+ * 16-character string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
2044
+ * All bytes as zero (0000000000000000) is considered an invalid value.
2045
+ */
2046
+ spanId: string;
2047
+ /**
2048
+ * An 8-bit value of flags that controls tracing such as sampling, trace level, etc. These flags are
2049
+ * recommendations given by the caller rather than strict rules to follow.
2050
+ * As this is a bit field, you cannot interpret flags by decoding the hex value and looking at the resulting
2051
+ * number. For example, a flag 00000001 could be encoded as 01 in hex, or 09 in hex if present with the flag
2052
+ * 00001000. A common mistake in bit fields is forgetting to mask when interpreting flags.
2053
+ */
2054
+ traceFlags: number;
2055
+ }
2056
+
1938
2057
  interface ITraceState {
1939
2058
  }
1940
2059
 
@@ -2371,6 +2490,14 @@ declare namespace ApplicationInsights {
2371
2490
 
2372
2491
  function parseConnectionString(connectionString?: string): ConnectionString;
2373
2492
 
2493
+ /**
2494
+ * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)
2495
+ *
2496
+ * @param value
2497
+ * @returns
2498
+ */
2499
+ function parseTraceParent(value: string): ITraceParent;
2500
+
2374
2501
  const ProcessLegacy = "ProcessLegacy";
2375
2502
 
2376
2503
  const PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
@@ -2451,20 +2578,35 @@ declare namespace ApplicationInsights {
2451
2578
  constructor(logger: IDiagnosticLogger, id: string, absoluteUrl: string, commandName: string, value: number, success: boolean, resultCode: number, method?: string, requestAPI?: string, correlationContext?: string, properties?: Object, measurements?: Object);
2452
2579
  }
2453
2580
 
2454
- const RequestHeaders: IRequestHeaders;
2581
+ const RequestHeaders: IRequestHeaders & {
2582
+ requestContextHeader: "Request-Context";
2583
+ requestContextTargetKey: "appId";
2584
+ requestContextAppIdFormat: "appId=cid-v1:";
2585
+ requestIdHeader: "Request-Id";
2586
+ traceParentHeader: "traceparent";
2587
+ traceStateHeader: "tracestate";
2588
+ sdkContextHeader: "Sdk-Context";
2589
+ sdkContextHeaderAppIdRequest: "appId";
2590
+ requestContextHeaderLowerCase: "request-context";
2591
+ 0: "Request-Context";
2592
+ 1: "appId";
2593
+ 2: "appId=cid-v1:";
2594
+ 3: "Request-Id";
2595
+ 4: "traceparent";
2596
+ 5: "tracestate";
2597
+ 6: "Sdk-Context";
2598
+ 7: "appId";
2599
+ 8: "request-context";
2600
+ };
2455
2601
 
2456
2602
  const SampleRate = "sampleRate";
2457
2603
 
2458
2604
  /**
2459
2605
  * Defines the level of severity for the event.
2460
2606
  */
2461
- enum SeverityLevel {
2462
- Verbose = 0,
2463
- Information = 1,
2464
- Warning = 2,
2465
- Error = 3,
2466
- Critical = 4
2467
- }
2607
+ const SeverityLevel: EnumValue<typeof eSeverityLevel>;
2608
+
2609
+ type SeverityLevel = number | eSeverityLevel;
2468
2610
 
2469
2611
  function stringToBoolOrDefault(str: any, defaultValue?: boolean): boolean;
2470
2612
 
@@ -2480,11 +2622,7 @@ declare namespace ApplicationInsights {
2480
2622
  * @param systemProperties system properties that are added to the context; part A
2481
2623
  * @returns ITelemetryItem that is sent to channel
2482
2624
  */
2483
- static create<T>(item: T, baseType: string, envelopeName: string, logger: IDiagnosticLogger, customProperties?: {
2484
- [key: string]: any;
2485
- }, systemProperties?: {
2486
- [key: string]: any;
2487
- }): ITelemetryItem;
2625
+ static create: typeof createTelemetryItem;
2488
2626
  }
2489
2627
 
2490
2628
  class Trace implements IMessageData, ISerializable {