@microsoft/applicationinsights-properties-js 3.4.0-nightlybeta3.2505-36 → 3.4.0-nightlybeta3.2507-23

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 (62) hide show
  1. package/browser/es5/{ai.props.3.4.0-nightlybeta3.2505-36.cjs.js → ai.props.3.4.0-nightlybeta3.2507-23.cjs.js} +310 -156
  2. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.cjs.js.map +1 -0
  3. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.cjs.min.js +6 -0
  4. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.cjs.min.js.map +1 -0
  5. package/browser/es5/{ai.props.3.4.0-nightlybeta3.2505-36.gbl.js → ai.props.3.4.0-nightlybeta3.2507-23.gbl.js} +312 -158
  6. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.gbl.js.map +1 -0
  7. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.gbl.min.js +6 -0
  8. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.gbl.min.js.map +1 -0
  9. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.integrity.json +66 -0
  10. package/browser/es5/{ai.props.3.4.0-nightlybeta3.2505-36.js → ai.props.3.4.0-nightlybeta3.2507-23.js} +312 -158
  11. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.js.map +1 -0
  12. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.min.js +6 -0
  13. package/browser/es5/ai.props.3.4.0-nightlybeta3.2507-23.min.js.map +1 -0
  14. package/browser/es5/ai.props.3.cjs.js +309 -155
  15. package/browser/es5/ai.props.3.cjs.js.map +1 -1
  16. package/browser/es5/ai.props.3.cjs.min.js +2 -2
  17. package/browser/es5/ai.props.3.cjs.min.js.map +1 -1
  18. package/browser/es5/ai.props.3.gbl.js +311 -157
  19. package/browser/es5/ai.props.3.gbl.js.map +1 -1
  20. package/browser/es5/ai.props.3.gbl.min.js +2 -2
  21. package/browser/es5/ai.props.3.gbl.min.js.map +1 -1
  22. package/browser/es5/ai.props.3.integrity.json +25 -25
  23. package/browser/es5/ai.props.3.js +311 -157
  24. package/browser/es5/ai.props.3.js.map +1 -1
  25. package/browser/es5/ai.props.3.min.js +2 -2
  26. package/browser/es5/ai.props.3.min.js.map +1 -1
  27. package/dist/es5/applicationinsights-properties-js.js +309 -155
  28. package/dist/es5/applicationinsights-properties-js.js.map +1 -1
  29. package/dist/es5/applicationinsights-properties-js.min.js +2 -2
  30. package/dist/es5/applicationinsights-properties-js.min.js.map +1 -1
  31. package/dist-es5/Context/Application.js +1 -1
  32. package/dist-es5/Context/Device.js +1 -1
  33. package/dist-es5/Context/Internal.js +2 -2
  34. package/dist-es5/Context/Internal.js.map +1 -1
  35. package/dist-es5/Context/Location.js +1 -1
  36. package/dist-es5/Context/Session.js +1 -1
  37. package/dist-es5/Context/User.js +1 -1
  38. package/dist-es5/Interfaces/IPropTelemetryContext.js +1 -1
  39. package/dist-es5/Interfaces/IPropertiesConfig.js +1 -1
  40. package/dist-es5/PropertiesPlugin.js +6 -20
  41. package/dist-es5/PropertiesPlugin.js.map +1 -1
  42. package/dist-es5/TelemetryContext.js +113 -14
  43. package/dist-es5/TelemetryContext.js.map +1 -1
  44. package/dist-es5/__DynamicConstants.js +2 -3
  45. package/dist-es5/__DynamicConstants.js.map +1 -1
  46. package/dist-es5/applicationinsights-properties-js.js +2 -4
  47. package/dist-es5/applicationinsights-properties-js.js.map +1 -1
  48. package/package.json +3 -3
  49. package/types/applicationinsights-properties-js.d.ts +3 -63
  50. package/types/applicationinsights-properties-js.namespaced.d.ts +290 -74
  51. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.cjs.js.map +0 -1
  52. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.cjs.min.js +0 -6
  53. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.cjs.min.js.map +0 -1
  54. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.gbl.js.map +0 -1
  55. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.gbl.min.js +0 -6
  56. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.gbl.min.js.map +0 -1
  57. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.integrity.json +0 -66
  58. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.js.map +0 -1
  59. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.min.js +0 -6
  60. package/browser/es5/ai.props.3.4.0-nightlybeta3.2505-36.min.js.map +0 -1
  61. package/dist-es5/Context/TelemetryTrace.js +0 -23
  62. package/dist-es5/Context/TelemetryTrace.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights properties plugin, 3.4.0-nightlybeta3.2505-36
2
+ * Microsoft Application Insights properties plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -29,9 +29,12 @@ declare namespace ApplicationInsights {
29
29
  */
30
30
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
31
31
  /**
32
- * Set next extension for telemetry processing
32
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
33
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
34
+ * now for backward compatibility only.
35
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
33
36
  */
34
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
37
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
35
38
  /**
36
39
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
37
40
  * assigned a new default one will be created and returned.
@@ -129,17 +132,78 @@ declare namespace ApplicationInsights {
129
132
 
130
133
  const enum eDistributedTracingModes {
131
134
  /**
132
- * (Default) Send Application Insights correlation headers
135
+ * Send only the legacy Application Insights correlation headers
136
+ *
137
+ * Headers Sent:
138
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
139
+ *
140
+ * Config Decimal Value: `0` (Zero)
133
141
  */
134
142
  AI = 0,
135
143
  /**
136
- * Send both W3C Trace Context headers and back-compatibility Application Insights headers
144
+ * (Default) Send both W3C Trace parent header and back-compatibility Application Insights headers
145
+ * - `Request-Id`
146
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
147
+ *
148
+ * Config Decimal Value: `1` (One)
137
149
  */
138
150
  AI_AND_W3C = 1,
139
151
  /**
140
- * Send W3C Trace Context headers
152
+ * Send Only the W3C Trace parent header
153
+ *
154
+ * Headers Sent:
155
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
156
+ *
157
+ * Config Decimal Value: `2` (Two)
158
+ */
159
+ W3C = 2,
160
+ /**
161
+ * @internal
162
+ * Bitwise mask used to separate the base distributed tracing mode from the additional optional
163
+ * tracing modes.
164
+ * @since 3.4.0
165
+ */
166
+ _BaseMask = 15,
167
+ /**
168
+ * @internal
169
+ * Enabling this bit will send the W3C Trace State header, it is not intended to be used directly
170
+ * or on its own. The code may assume that if this bit is set, then the W3C Trace Context headers
171
+ * will also be included.
172
+ *
173
+ * Config Decimal Value: `16` (Sixteen in decimal)
174
+ * @since 3.4.0
175
+ */
176
+ _W3CTraceState = 16,
177
+ /**
178
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers and back-compatibility
179
+ * Application Insights headers.
180
+ *
181
+ * Currently sent headers:
182
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
183
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
184
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
185
+ *
186
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
187
+ * to include additional headers.
188
+ *
189
+ * Config Decimal Value: `17` (Seventeen in decimal)
190
+ * @since 3.4.0
191
+ */
192
+ AI_AND_W3C_TRACE = 17,
193
+ /**
194
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers.
195
+ *
196
+ * Currently sent headers:
197
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
198
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
199
+ *
200
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
201
+ * to include additional headers.
202
+ *
203
+ * Config Decimal Value: `18` (Eighteen in decimal)
204
+ * @since 3.4.0
141
205
  */
142
- W3C = 2
206
+ W3C_TRACE = 18
143
207
  }
144
208
 
145
209
  const enum _eInternalMessageId {
@@ -272,6 +336,30 @@ declare namespace ApplicationInsights {
272
336
 
273
337
  type EnumValue<E = any> = EnumCls<E>;
274
338
 
339
+ /**
340
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
341
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
342
+ * @since 3.4.0
343
+ */
344
+ const enum eTraceHeadersMode {
345
+ /**
346
+ * Don't look for any trace headers
347
+ */
348
+ None = 0,
349
+ /**
350
+ * Look for traceparent header/meta tag
351
+ */
352
+ TraceParent = 1,
353
+ /**
354
+ * Look for tracestate header/meta tag
355
+ */
356
+ TraceState = 2,
357
+ /**
358
+ * Look for both traceparent and tracestate headers/meta tags
359
+ */
360
+ All = 3
361
+ }
362
+
275
363
  const enum FeatureOptInMode {
276
364
  /**
277
365
  * not set, completely depends on cdn cfg
@@ -414,7 +502,7 @@ declare namespace ApplicationInsights {
414
502
  */
415
503
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
416
504
  /**
417
- * Gets the current distributed trace context for this instance if available
505
+ * Gets the current distributed trace active context for this instance
418
506
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
419
507
  */
420
508
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -474,9 +562,12 @@ declare namespace ApplicationInsights {
474
562
  */
475
563
  getCfg: () => IConfiguration;
476
564
  /**
477
- * Gets the named extension config
565
+ * Gets the named extension configuration
566
+ * @param identifier - The named extension identifier
567
+ * @param defaultValue - The default value(s) to return if no defined config exists
568
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
478
569
  */
479
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
570
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
480
571
  /**
481
572
  * Gets the named config from either the named identifier extension or core config if neither exist then the
482
573
  * default value is returned
@@ -1097,7 +1188,7 @@ declare namespace ApplicationInsights {
1097
1188
  * }
1098
1189
  * ```
1099
1190
  *
1100
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1191
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1101
1192
  */
1102
1193
  disablePageUnloadEvents?: string[];
1103
1194
  /**
@@ -1112,7 +1203,7 @@ declare namespace ApplicationInsights {
1112
1203
  * }
1113
1204
  * ```
1114
1205
  *
1115
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1206
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1116
1207
  */
1117
1208
  disablePageShowEvents?: string[];
1118
1209
  /**
@@ -1154,6 +1245,25 @@ declare namespace ApplicationInsights {
1154
1245
  * @since 3.3.2
1155
1246
  */
1156
1247
  expCfg?: IExceptionConfig;
1248
+ /**
1249
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
1250
+ * @defaultValue true
1251
+ */
1252
+ redactUrls?: boolean;
1253
+ /**
1254
+ * [Optional] Additional query parameters to redact beyond the default set.
1255
+ * Use this to specify custom parameters that contain sensitive information.
1256
+ * These will be combined with the default parameters that are redacted.
1257
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
1258
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
1259
+ */
1260
+ redactQueryParams?: string[];
1261
+ /**
1262
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
1263
+ * the service timing headers or meta tags from the initial page load.
1264
+ * @defaultValue eTraceHeadersMode.All
1265
+ */
1266
+ traceHdrMode?: eTraceHeadersMode;
1157
1267
  }
1158
1268
 
1159
1269
  interface ICookieMgr {
@@ -1357,8 +1467,13 @@ declare namespace ApplicationInsights {
1357
1467
  */
1358
1468
  getName(): string;
1359
1469
  /**
1360
- * Sets the current name of the page
1470
+ * Sets the current name of the page, also updates the name for any parent context.
1471
+ * This is used to identify the page in the telemetry data.
1472
+ * @remarks This function updates the current and ALL parent contexts with the new name,
1473
+ * to just update the name of the current context, use the `pageName` property.
1361
1474
  * @param pageName - The name of the page
1475
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
1476
+ * parent contexts.
1362
1477
  */
1363
1478
  setName(pageName: string): void;
1364
1479
  /**
@@ -1371,6 +1486,12 @@ declare namespace ApplicationInsights {
1371
1486
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1372
1487
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1373
1488
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1489
+ *
1490
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
1491
+ * for the current context only, use the `traceId` property.
1492
+ * @param newValue - The traceId to set
1493
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
1494
+ * parent contexts.
1374
1495
  */
1375
1496
  setTraceId(newValue: string): void;
1376
1497
  /**
@@ -1382,6 +1503,12 @@ declare namespace ApplicationInsights {
1382
1503
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1383
1504
  * Also know as the parentId, used to link requests together
1384
1505
  * https://www.w3.org/TR/trace-context/#parent-id
1506
+ *
1507
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
1508
+ * the current context only, use the `spanId` property.
1509
+ * @param newValue - The spanId to set
1510
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
1511
+ * parent contexts.
1385
1512
  */
1386
1513
  setSpanId(newValue: string): void;
1387
1514
  /**
@@ -1390,9 +1517,80 @@ declare namespace ApplicationInsights {
1390
1517
  getTraceFlags(): number | undefined;
1391
1518
  /**
1392
1519
  * https://www.w3.org/TR/trace-context/#trace-flags
1520
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
1521
+ * flags for the current context only, use the `traceFlags` property.
1393
1522
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
1523
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
1524
+ * parent contexts.
1394
1525
  */
1395
1526
  setTraceFlags(newValue?: number): void;
1527
+ /**
1528
+ * Returns the current name of the page
1529
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
1530
+ * use the `setName` method.
1531
+ * @default undefined
1532
+ * @since 3.4.0
1533
+ */
1534
+ pageName: string;
1535
+ /**
1536
+ * The current ID of the trace that this span belongs to. It is worldwide unique
1537
+ * with practically sufficient probability by being made as 16 randomly
1538
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
1539
+ * 128 bits.
1540
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1541
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
1542
+ * @since 3.4.0
1543
+ */
1544
+ traceId: string;
1545
+ /**
1546
+ * The ID of the Span. It is globally unique with practically sufficient
1547
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
1548
+ * lowercase hex characters corresponding to 64 bits.
1549
+ * If you update this value, it will only update for the current context, not the parent context.
1550
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1551
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
1552
+ * @since 3.4.0
1553
+ */
1554
+ spanId: string;
1555
+ /**
1556
+ * Returns true if the current context was initialized (propagated) from a remote parent.
1557
+ * @since 3.4.0
1558
+ * @default false
1559
+ * @returns True if the context was propagated from a remote parent
1560
+ */
1561
+ readonly isRemote: boolean;
1562
+ /**
1563
+ * Trace flags to propagate.
1564
+ *
1565
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
1566
+ * sampled or not. When set, the least significant bit documents that the
1567
+ * caller may have recorded trace data. A caller who does not record trace
1568
+ * data out-of-band leaves this flag unset.
1569
+ *
1570
+ * see {@link eW3CTraceFlags} for valid flag values.
1571
+ *
1572
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1573
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
1574
+ * @since 3.4.0
1575
+ */
1576
+ traceFlags?: number;
1577
+ /**
1578
+ * Returns the current trace state which will be used to propgate context across different services.
1579
+ * Updating (adding / removing keys) of the trace state will modify the current context.
1580
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
1581
+ * modify it directly you do not need to reassign the new value to this property.
1582
+ * @since 3.4.0
1583
+ */
1584
+ readonly traceState: IW3cTraceState;
1585
+ /**
1586
+ * Provides access to the parent context of the current context.
1587
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
1588
+ * modify the current context. If you need to modify the parent context, you need to do it through the
1589
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
1590
+ * @default null
1591
+ * @since 3.4.0
1592
+ */
1593
+ readonly parentCtx?: IDistributedTraceContext | null;
1396
1594
  }
1397
1595
 
1398
1596
  /**
@@ -2121,23 +2319,6 @@ declare namespace ApplicationInsights {
2121
2319
  finally(onfinally?: FinallyPromiseHandler): IPromise<T>;
2122
2320
  }
2123
2321
 
2124
- interface IPropertiesConfig {
2125
- readonly accountId: string;
2126
- readonly sessionRenewalMs: number;
2127
- readonly samplingPercentage: number;
2128
- readonly sessionExpirationMs: number;
2129
- readonly cookieDomain: string;
2130
- readonly sdkExtension: string;
2131
- readonly isBrowserLinkTrackingEnabled: boolean;
2132
- readonly appId: string;
2133
- readonly getSessionId: string;
2134
- readonly namePrefix: string;
2135
- readonly sessionCookiePostfix: string;
2136
- readonly userCookiePostfix: string;
2137
- readonly idLength: number;
2138
- readonly getNewId: (idLength?: number) => string;
2139
- }
2140
-
2141
2322
  interface IPropertiesPlugin {
2142
2323
  readonly context: ITelemetryContext;
2143
2324
  }
@@ -2252,6 +2433,8 @@ declare namespace ApplicationInsights {
2252
2433
  readonly location: ILocation;
2253
2434
  /**
2254
2435
  * The object describing a operation tracked by this object.
2436
+ * @deprecated Use the core getTraceCtx method instead to get / set the current trace context, this is required to
2437
+ * support distributed tracing and allows the core to manage the trace context.
2255
2438
  */
2256
2439
  readonly telemetryTrace: ITelemetryTrace;
2257
2440
  /**
@@ -2339,9 +2522,10 @@ declare namespace ApplicationInsights {
2339
2522
  */
2340
2523
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2341
2524
  /**
2342
- * Set next extension for telemetry processing, this is not optional as plugins should use the
2525
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
2343
2526
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2344
2527
  * now for backward compatibility only.
2528
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
2345
2529
  */
2346
2530
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2347
2531
  /**
@@ -2391,6 +2575,11 @@ declare namespace ApplicationInsights {
2391
2575
  update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2392
2576
  }
2393
2577
 
2578
+ /**
2579
+ * Interface for telemetry trace context.
2580
+ * @deprecated Use the core getTraceCtx method instead to get / set the current trace context, this is required to
2581
+ * support distributed tracing and allows the core to manage the trace context.
2582
+ */
2394
2583
  interface ITelemetryTrace {
2395
2584
  /**
2396
2585
  * Trace id
@@ -2400,11 +2589,6 @@ declare namespace ApplicationInsights {
2400
2589
  * Parent id
2401
2590
  */
2402
2591
  parentID?: string;
2403
- /**
2404
- * @deprecated Never Used
2405
- * Trace state
2406
- */
2407
- traceState?: ITraceState;
2408
2592
  /**
2409
2593
  * An integer representation of the W3C TraceContext trace-flags. https://www.w3.org/TR/trace-context/#trace-flags
2410
2594
  */
@@ -2628,9 +2812,6 @@ declare namespace ApplicationInsights {
2628
2812
  enabled: boolean;
2629
2813
  }
2630
2814
 
2631
- interface ITraceState {
2632
- }
2633
-
2634
2815
  /**
2635
2816
  * An interface which provides automatic removal during unloading of the component
2636
2817
  */
@@ -2691,6 +2872,76 @@ declare namespace ApplicationInsights {
2691
2872
  update(userId?: string): void;
2692
2873
  }
2693
2874
 
2875
+ /**
2876
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
2877
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
2878
+ * list is ordered and the order is important as it determines the processing order.
2879
+ *
2880
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
2881
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
2882
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
2883
+ * instance.
2884
+ *
2885
+ * @since 3.4.0
2886
+ */
2887
+ interface IW3cTraceState {
2888
+ /**
2889
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
2890
+ * required processing order and if this instance has a parent the keys from the parent will be included
2891
+ * unless they have been removed (deleted) from the child instance.
2892
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
2893
+ * the OpenTelemetry implementation which creates a new instance for each call.
2894
+ * @returns A readonly array of the current keys associated with the trace state
2895
+ */
2896
+ readonly keys: string[];
2897
+ /**
2898
+ * Check if the trace state list is empty, meaning it has no keys or values.
2899
+ * This exists to allow for quick checks without needing to create a new array of keys.
2900
+ * @since 3.4.0
2901
+ * @returns true if the trace state list is empty, false otherwise
2902
+ */
2903
+ readonly isEmpty: boolean;
2904
+ /**
2905
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
2906
+ * @param key - The key to lookup
2907
+ * @returns The value for the key, or undefined if not found
2908
+ */
2909
+ get(key: string): string | undefined;
2910
+ /**
2911
+ * Set the value for the specified key for this instance, returning its new location within the list.
2912
+ * - 0 is the front of the list
2913
+ * - -1 not set because the key/value pair is invalid
2914
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
2915
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
2916
+ * not modify the parent value.
2917
+ * @param key - The key to set
2918
+ * @param value - The value to set
2919
+ * @returns 0 if successful, -1 if not
2920
+ */
2921
+ set(key: string, value: string): number;
2922
+ /**
2923
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
2924
+ * this instance but will still be available directly from the parent.
2925
+ * @param key - The key to delete
2926
+ */
2927
+ del(key: string): void;
2928
+ /**
2929
+ * Format the trace state list into a strings where each string can be used as a header value.
2930
+ * This will return an empty array if the trace state list is empty.
2931
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
2932
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
2933
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
2934
+ * @returns An array of strings that can be used for the header values, if the trace state list is empty an empty array will be returned
2935
+ */
2936
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
2937
+ /**
2938
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
2939
+ * and values from this instance but any changes made to the child will not affect this instance.
2940
+ * @returns A new instance of IW3cTraceState which is a child of this instance
2941
+ */
2942
+ child(): IW3cTraceState;
2943
+ }
2944
+
2694
2945
  interface IWatchDetails<T = IConfiguration> {
2695
2946
  /**
2696
2947
  * The current config object
@@ -2867,43 +3118,8 @@ declare namespace ApplicationInsights {
2867
3118
  [key: string]: any;
2868
3119
  }
2869
3120
 
2870
- class TelemetryContext implements IPropTelemetryContext {
2871
- application: IApplication;
2872
- device: IDevice;
2873
- location: ILocation;
2874
- telemetryTrace: ITelemetryTrace;
2875
- user: IUserContext;
2876
- internal: IInternal;
2877
- session: ISession;
2878
- sessionManager: ISessionManager;
2879
- os: IOperatingSystem;
2880
- web: IWeb;
2881
- appId: () => string;
2882
- getSessionId: () => string;
2883
- constructor(core: IAppInsightsCore, defaultConfig: IPropertiesConfig, previousTraceCtx?: IDistributedTraceContext, unloadHookContainer?: IUnloadHookContainer);
2884
- applySessionContext(evt: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2885
- applyOperatingSystemContxt(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2886
- applyApplicationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2887
- applyDeviceContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2888
- applyInternalContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2889
- applyLocationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2890
- applyOperationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2891
- applyWebContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2892
- applyUserContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2893
- cleanUp(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
2894
- }
2895
-
2896
3121
  type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2897
3122
 
2898
- class TelemetryTrace implements ITelemetryTrace {
2899
- traceID: string;
2900
- parentID: string;
2901
- traceState: ITraceState;
2902
- traceFlags: number;
2903
- name: string;
2904
- constructor(id?: string, parentId?: string, name?: string, logger?: IDiagnosticLogger);
2905
- }
2906
-
2907
3123
  /**
2908
3124
  * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2909
3125
  */