@microsoft/applicationinsights-analytics-js 3.4.0-nightlybeta3.2505-35 → 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 (35) hide show
  1. package/browser/es5/applicationinsights-analytics-js.cjs.js +471 -422
  2. package/browser/es5/applicationinsights-analytics-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-analytics-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-analytics-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-analytics-js.gbl.js +473 -424
  6. package/browser/es5/applicationinsights-analytics-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-analytics-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-analytics-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-analytics-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-analytics-js.js +473 -424
  11. package/browser/es5/applicationinsights-analytics-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-analytics-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-analytics-js.min.js.map +1 -1
  14. package/dist/es5/applicationinsights-analytics-js.js +471 -422
  15. package/dist/es5/applicationinsights-analytics-js.js.map +1 -1
  16. package/dist/es5/applicationinsights-analytics-js.min.js +2 -2
  17. package/dist/es5/applicationinsights-analytics-js.min.js.map +1 -1
  18. package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js +40 -41
  19. package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js.map +1 -1
  20. package/dist-es5/JavaScriptSDK/Interfaces/IAnalyticsConfig.js +8 -0
  21. package/dist-es5/JavaScriptSDK/Interfaces/IAnalyticsConfig.js.map +1 -0
  22. package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js +175 -178
  23. package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
  24. package/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +86 -96
  25. package/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
  26. package/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +85 -92
  27. package/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
  28. package/dist-es5/JavaScriptSDK/Timing.js +18 -15
  29. package/dist-es5/JavaScriptSDK/Timing.js.map +1 -1
  30. package/dist-es5/__DynamicConstants.js +7 -4
  31. package/dist-es5/__DynamicConstants.js.map +1 -1
  32. package/dist-es5/applicationinsights-analytics-js.js +1 -1
  33. package/package.json +5 -5
  34. package/types/applicationinsights-analytics-js.d.ts +100 -1
  35. package/types/applicationinsights-analytics-js.namespaced.d.ts +381 -14
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights JavaScript SDK - Web Analytics, 3.4.0-nightlybeta3.2505-35
2
+ * Microsoft Application Insights JavaScript SDK - Web Analytics, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -160,9 +160,12 @@ declare namespace ApplicationInsights {
160
160
  */
161
161
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
162
162
  /**
163
- * Set next extension for telemetry processing
163
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
164
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
165
+ * now for backward compatibility only.
166
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
164
167
  */
165
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
168
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
166
169
  /**
167
170
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
168
171
  * assigned a new default one will be created and returned.
@@ -260,17 +263,78 @@ declare namespace ApplicationInsights {
260
263
 
261
264
  const enum eDistributedTracingModes {
262
265
  /**
263
- * (Default) Send Application Insights correlation headers
266
+ * Send only the legacy Application Insights correlation headers
267
+ *
268
+ * Headers Sent:
269
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
270
+ *
271
+ * Config Decimal Value: `0` (Zero)
264
272
  */
265
273
  AI = 0,
266
274
  /**
267
- * Send both W3C Trace Context headers and back-compatibility Application Insights headers
275
+ * (Default) Send both W3C Trace parent header and back-compatibility Application Insights headers
276
+ * - `Request-Id`
277
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
278
+ *
279
+ * Config Decimal Value: `1` (One)
268
280
  */
269
281
  AI_AND_W3C = 1,
270
282
  /**
271
- * Send W3C Trace Context headers
283
+ * Send Only the W3C Trace parent header
284
+ *
285
+ * Headers Sent:
286
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
287
+ *
288
+ * Config Decimal Value: `2` (Two)
289
+ */
290
+ W3C = 2,
291
+ /**
292
+ * @internal
293
+ * Bitwise mask used to separate the base distributed tracing mode from the additional optional
294
+ * tracing modes.
295
+ * @since 3.4.0
272
296
  */
273
- W3C = 2
297
+ _BaseMask = 15,
298
+ /**
299
+ * @internal
300
+ * Enabling this bit will send the W3C Trace State header, it is not intended to be used directly
301
+ * or on its own. The code may assume that if this bit is set, then the W3C Trace Context headers
302
+ * will also be included.
303
+ *
304
+ * Config Decimal Value: `16` (Sixteen in decimal)
305
+ * @since 3.4.0
306
+ */
307
+ _W3CTraceState = 16,
308
+ /**
309
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers and back-compatibility
310
+ * Application Insights headers.
311
+ *
312
+ * Currently sent headers:
313
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
314
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
315
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
316
+ *
317
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
318
+ * to include additional headers.
319
+ *
320
+ * Config Decimal Value: `17` (Seventeen in decimal)
321
+ * @since 3.4.0
322
+ */
323
+ AI_AND_W3C_TRACE = 17,
324
+ /**
325
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers.
326
+ *
327
+ * Currently sent headers:
328
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
329
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
330
+ *
331
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
332
+ * to include additional headers.
333
+ *
334
+ * Config Decimal Value: `18` (Eighteen in decimal)
335
+ * @since 3.4.0
336
+ */
337
+ W3C_TRACE = 18
274
338
  }
275
339
 
276
340
  const enum _eInternalMessageId {
@@ -414,6 +478,30 @@ declare namespace ApplicationInsights {
414
478
  Critical = 4
415
479
  }
416
480
 
481
+ /**
482
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
483
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
484
+ * @since 3.4.0
485
+ */
486
+ const enum eTraceHeadersMode {
487
+ /**
488
+ * Don't look for any trace headers
489
+ */
490
+ None = 0,
491
+ /**
492
+ * Look for traceparent header/meta tag
493
+ */
494
+ TraceParent = 1,
495
+ /**
496
+ * Look for tracestate header/meta tag
497
+ */
498
+ TraceState = 2,
499
+ /**
500
+ * Look for both traceparent and tracestate headers/meta tags
501
+ */
502
+ All = 3
503
+ }
504
+
417
505
  const enum FeatureOptInMode {
418
506
  /**
419
507
  * not set, completely depends on cdn cfg
@@ -434,6 +522,104 @@ declare namespace ApplicationInsights {
434
522
  */
435
523
  type FinallyPromiseHandler = (() => void) | undefined | null;
436
524
 
525
+ /**
526
+ * Configuration interface specifically for AnalyticsPlugin
527
+ * This interface defines only the configuration properties that the Analytics plugin uses.
528
+ */
529
+ interface IAnalyticsConfig {
530
+ /**
531
+ * A session is logged if the user is inactive for this amount of time in milliseconds.
532
+ * @default 1800000 (30 minutes)
533
+ */
534
+ sessionRenewalMs?: number;
535
+ /**
536
+ * A session is logged if it has continued for this amount of time in milliseconds.
537
+ * @default 86400000 (24 hours)
538
+ */
539
+ sessionExpirationMs?: number;
540
+ /**
541
+ * If true, exceptions are not autocollected.
542
+ * @default false
543
+ */
544
+ disableExceptionTracking?: boolean;
545
+ /**
546
+ * If true, on a pageview, the previous instrumented page's view time is tracked and sent as telemetry and a new timer is started for the current pageview.
547
+ * @default false
548
+ */
549
+ autoTrackPageVisitTime?: boolean;
550
+ /**
551
+ * If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called.
552
+ * @default false
553
+ */
554
+ overridePageViewDuration?: boolean;
555
+ /**
556
+ * Define whether to track unhandled promise rejections and report as JS errors.
557
+ * @default false
558
+ */
559
+ enableUnhandledPromiseRejectionTracking?: boolean;
560
+ /**
561
+ * Internal flag to track if unhandled promise instrumentation is already set up.
562
+ * @default false
563
+ * @internal Internal use only
564
+ * @ignore INTERNAL ONLY
565
+ */
566
+ autoUnhandledPromiseInstrumented?: boolean;
567
+ /**
568
+ * Percentage of events that will be sent. Value must be between 0 and 100.
569
+ * @default 100
570
+ * @example 50 // Only send 50% of events
571
+ */
572
+ samplingPercentage?: number;
573
+ /**
574
+ * If true, the SDK will not store or read any data from local and session storage.
575
+ * @default false
576
+ */
577
+ isStorageUseDisabled?: boolean;
578
+ /**
579
+ * If true, the SDK will track all Browser Link requests.
580
+ * @default false
581
+ */
582
+ isBrowserLinkTrackingEnabled?: boolean;
583
+ /**
584
+ * Automatically track route changes in Single Page Applications (SPA). If true, each route change will send a new Pageview to Application Insights.
585
+ * @default false
586
+ */
587
+ enableAutoRouteTracking?: boolean;
588
+ /**
589
+ * An optional value that will be used as name postfix for localStorage and session cookie name.
590
+ * @default ""
591
+ * @example "MyApp" // Results in localStorage keys like "ai_session_MyApp"
592
+ */
593
+ namePrefix?: string;
594
+ /**
595
+ * If true, debugging data is thrown as an exception by the logger.
596
+ * @default false
597
+ */
598
+ enableDebug?: boolean;
599
+ /**
600
+ * If true, flush method will not be called when onBeforeUnload event triggers.
601
+ * @default false
602
+ */
603
+ disableFlushOnBeforeUnload?: boolean;
604
+ /**
605
+ * If true, flush method will not be called when onPageHide or onVisibilityChange (hidden state) event(s) trigger.
606
+ * @default false
607
+ */
608
+ disableFlushOnUnload?: boolean;
609
+ /**
610
+ * Internal flag to track if exception instrumentation is already set up.
611
+ * @default false
612
+ * @internal Internal use only
613
+ * @ignore INTERNAL ONLY
614
+ */
615
+ autoExceptionInstrumented?: boolean;
616
+ /**
617
+ * Exception configuration for additional exception handling options.
618
+ * @default { inclScripts: false, expLog: undefined, maxLogs: 50 }
619
+ */
620
+ expCfg?: IExceptionConfig;
621
+ }
622
+
437
623
  interface IAppInsights {
438
624
  /**
439
625
  * Get the current cookie manager for this instance
@@ -595,7 +781,7 @@ declare namespace ApplicationInsights {
595
781
  */
596
782
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
597
783
  /**
598
- * Gets the current distributed trace context for this instance if available
784
+ * Gets the current distributed trace active context for this instance
599
785
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
600
786
  */
601
787
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -696,9 +882,12 @@ declare namespace ApplicationInsights {
696
882
  */
697
883
  getCfg: () => IConfiguration;
698
884
  /**
699
- * Gets the named extension config
885
+ * Gets the named extension configuration
886
+ * @param identifier - The named extension identifier
887
+ * @param defaultValue - The default value(s) to return if no defined config exists
888
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
700
889
  */
701
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
890
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
702
891
  /**
703
892
  * Gets the named config from either the named identifier extension or core config if neither exist then the
704
893
  * default value is returned
@@ -1319,7 +1508,7 @@ declare namespace ApplicationInsights {
1319
1508
  * }
1320
1509
  * ```
1321
1510
  *
1322
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1511
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1323
1512
  */
1324
1513
  disablePageUnloadEvents?: string[];
1325
1514
  /**
@@ -1334,7 +1523,7 @@ declare namespace ApplicationInsights {
1334
1523
  * }
1335
1524
  * ```
1336
1525
  *
1337
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1526
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1338
1527
  */
1339
1528
  disablePageShowEvents?: string[];
1340
1529
  /**
@@ -1376,6 +1565,25 @@ declare namespace ApplicationInsights {
1376
1565
  * @since 3.3.2
1377
1566
  */
1378
1567
  expCfg?: IExceptionConfig;
1568
+ /**
1569
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
1570
+ * @defaultValue true
1571
+ */
1572
+ redactUrls?: boolean;
1573
+ /**
1574
+ * [Optional] Additional query parameters to redact beyond the default set.
1575
+ * Use this to specify custom parameters that contain sensitive information.
1576
+ * These will be combined with the default parameters that are redacted.
1577
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
1578
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
1579
+ */
1580
+ redactQueryParams?: string[];
1581
+ /**
1582
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
1583
+ * the service timing headers or meta tags from the initial page load.
1584
+ * @defaultValue eTraceHeadersMode.All
1585
+ */
1586
+ traceHdrMode?: eTraceHeadersMode;
1379
1587
  }
1380
1588
 
1381
1589
  interface ICookieMgr {
@@ -1556,8 +1764,13 @@ declare namespace ApplicationInsights {
1556
1764
  */
1557
1765
  getName(): string;
1558
1766
  /**
1559
- * Sets the current name of the page
1767
+ * Sets the current name of the page, also updates the name for any parent context.
1768
+ * This is used to identify the page in the telemetry data.
1769
+ * @remarks This function updates the current and ALL parent contexts with the new name,
1770
+ * to just update the name of the current context, use the `pageName` property.
1560
1771
  * @param pageName - The name of the page
1772
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
1773
+ * parent contexts.
1561
1774
  */
1562
1775
  setName(pageName: string): void;
1563
1776
  /**
@@ -1570,6 +1783,12 @@ declare namespace ApplicationInsights {
1570
1783
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1571
1784
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1572
1785
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1786
+ *
1787
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
1788
+ * for the current context only, use the `traceId` property.
1789
+ * @param newValue - The traceId to set
1790
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
1791
+ * parent contexts.
1573
1792
  */
1574
1793
  setTraceId(newValue: string): void;
1575
1794
  /**
@@ -1581,6 +1800,12 @@ declare namespace ApplicationInsights {
1581
1800
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1582
1801
  * Also know as the parentId, used to link requests together
1583
1802
  * https://www.w3.org/TR/trace-context/#parent-id
1803
+ *
1804
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
1805
+ * the current context only, use the `spanId` property.
1806
+ * @param newValue - The spanId to set
1807
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
1808
+ * parent contexts.
1584
1809
  */
1585
1810
  setSpanId(newValue: string): void;
1586
1811
  /**
@@ -1589,9 +1814,80 @@ declare namespace ApplicationInsights {
1589
1814
  getTraceFlags(): number | undefined;
1590
1815
  /**
1591
1816
  * https://www.w3.org/TR/trace-context/#trace-flags
1817
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
1818
+ * flags for the current context only, use the `traceFlags` property.
1592
1819
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
1820
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
1821
+ * parent contexts.
1593
1822
  */
1594
1823
  setTraceFlags(newValue?: number): void;
1824
+ /**
1825
+ * Returns the current name of the page
1826
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
1827
+ * use the `setName` method.
1828
+ * @default undefined
1829
+ * @since 3.4.0
1830
+ */
1831
+ pageName: string;
1832
+ /**
1833
+ * The current ID of the trace that this span belongs to. It is worldwide unique
1834
+ * with practically sufficient probability by being made as 16 randomly
1835
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
1836
+ * 128 bits.
1837
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1838
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
1839
+ * @since 3.4.0
1840
+ */
1841
+ traceId: string;
1842
+ /**
1843
+ * The ID of the Span. It is globally unique with practically sufficient
1844
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
1845
+ * lowercase hex characters corresponding to 64 bits.
1846
+ * If you update this value, it will only update for the current context, not the parent context.
1847
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1848
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
1849
+ * @since 3.4.0
1850
+ */
1851
+ spanId: string;
1852
+ /**
1853
+ * Returns true if the current context was initialized (propagated) from a remote parent.
1854
+ * @since 3.4.0
1855
+ * @default false
1856
+ * @returns True if the context was propagated from a remote parent
1857
+ */
1858
+ readonly isRemote: boolean;
1859
+ /**
1860
+ * Trace flags to propagate.
1861
+ *
1862
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
1863
+ * sampled or not. When set, the least significant bit documents that the
1864
+ * caller may have recorded trace data. A caller who does not record trace
1865
+ * data out-of-band leaves this flag unset.
1866
+ *
1867
+ * see {@link eW3CTraceFlags} for valid flag values.
1868
+ *
1869
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1870
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
1871
+ * @since 3.4.0
1872
+ */
1873
+ traceFlags?: number;
1874
+ /**
1875
+ * Returns the current trace state which will be used to propgate context across different services.
1876
+ * Updating (adding / removing keys) of the trace state will modify the current context.
1877
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
1878
+ * modify it directly you do not need to reassign the new value to this property.
1879
+ * @since 3.4.0
1880
+ */
1881
+ readonly traceState: IW3cTraceState;
1882
+ /**
1883
+ * Provides access to the parent context of the current context.
1884
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
1885
+ * modify the current context. If you need to modify the parent context, you need to do it through the
1886
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
1887
+ * @default null
1888
+ * @since 3.4.0
1889
+ */
1890
+ readonly parentCtx?: IDistributedTraceContext | null;
1595
1891
  }
1596
1892
 
1597
1893
  interface IEventTelemetry extends IPartC {
@@ -2572,9 +2868,10 @@ declare namespace ApplicationInsights {
2572
2868
  */
2573
2869
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2574
2870
  /**
2575
- * Set next extension for telemetry processing, this is not optional as plugins should use the
2871
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
2576
2872
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2577
2873
  * now for backward compatibility only.
2874
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
2578
2875
  */
2579
2876
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2580
2877
  /**
@@ -2871,6 +3168,76 @@ declare namespace ApplicationInsights {
2871
3168
  run: (logger?: IDiagnosticLogger) => void;
2872
3169
  }
2873
3170
 
3171
+ /**
3172
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
3173
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
3174
+ * list is ordered and the order is important as it determines the processing order.
3175
+ *
3176
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
3177
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
3178
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
3179
+ * instance.
3180
+ *
3181
+ * @since 3.4.0
3182
+ */
3183
+ interface IW3cTraceState {
3184
+ /**
3185
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
3186
+ * required processing order and if this instance has a parent the keys from the parent will be included
3187
+ * unless they have been removed (deleted) from the child instance.
3188
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
3189
+ * the OpenTelemetry implementation which creates a new instance for each call.
3190
+ * @returns A readonly array of the current keys associated with the trace state
3191
+ */
3192
+ readonly keys: string[];
3193
+ /**
3194
+ * Check if the trace state list is empty, meaning it has no keys or values.
3195
+ * This exists to allow for quick checks without needing to create a new array of keys.
3196
+ * @since 3.4.0
3197
+ * @returns true if the trace state list is empty, false otherwise
3198
+ */
3199
+ readonly isEmpty: boolean;
3200
+ /**
3201
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
3202
+ * @param key - The key to lookup
3203
+ * @returns The value for the key, or undefined if not found
3204
+ */
3205
+ get(key: string): string | undefined;
3206
+ /**
3207
+ * Set the value for the specified key for this instance, returning its new location within the list.
3208
+ * - 0 is the front of the list
3209
+ * - -1 not set because the key/value pair is invalid
3210
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
3211
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
3212
+ * not modify the parent value.
3213
+ * @param key - The key to set
3214
+ * @param value - The value to set
3215
+ * @returns 0 if successful, -1 if not
3216
+ */
3217
+ set(key: string, value: string): number;
3218
+ /**
3219
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
3220
+ * this instance but will still be available directly from the parent.
3221
+ * @param key - The key to delete
3222
+ */
3223
+ del(key: string): void;
3224
+ /**
3225
+ * Format the trace state list into a strings where each string can be used as a header value.
3226
+ * This will return an empty array if the trace state list is empty.
3227
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
3228
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
3229
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
3230
+ * @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
3231
+ */
3232
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
3233
+ /**
3234
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
3235
+ * and values from this instance but any changes made to the child will not affect this instance.
3236
+ * @returns A new instance of IW3cTraceState which is a child of this instance
3237
+ */
3238
+ child(): IW3cTraceState;
3239
+ }
3240
+
2874
3241
  interface IWatchDetails<T = IConfiguration> {
2875
3242
  /**
2876
3243
  * The current config object