@microsoft/applicationinsights-core-js 2.8.4-nightly.2205-07 → 2.8.4-nightly.2205-10

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 (102) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +2008 -1811
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.api.json +1302 -199
  7. package/dist/applicationinsights-core-js.api.md +54 -0
  8. package/dist/applicationinsights-core-js.d.ts +174 -1
  9. package/dist/applicationinsights-core-js.js +2008 -1811
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +174 -1
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +2 -2
  15. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseCore.js +25 -12
  17. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +3 -3
  19. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  20. package/dist-esm/JavaScriptSDK/ChannelController.js +3 -3
  21. package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  23. package/dist-esm/JavaScriptSDK/CookieMgr.js +2 -2
  24. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  25. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  26. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  27. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  28. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  29. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +6 -6
  30. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  31. package/dist-esm/JavaScriptSDK/EnvUtils.js +40 -1
  32. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  33. package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
  34. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  35. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +6 -6
  36. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  37. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  38. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  39. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  40. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +6 -6
  41. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  42. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  43. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +54 -6
  44. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  45. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +2 -2
  46. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
  47. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +2 -2
  48. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
  49. package/dist-esm/JavaScriptSDK/W3cTraceParent.js +172 -0
  50. package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -0
  51. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +7 -7
  53. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
  54. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +86 -86
  55. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  56. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +8 -0
  66. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js.map +1 -0
  67. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  73. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  75. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  76. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  77. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  78. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  79. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +8 -0
  80. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js.map +1 -0
  81. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  82. package/dist-esm/applicationinsights-core-js.js +3 -2
  83. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  84. package/package.json +2 -2
  85. package/src/JavaScriptSDK/BaseCore.ts +32 -1
  86. package/src/JavaScriptSDK/DataCacheHelper.ts +1 -1
  87. package/src/JavaScriptSDK/EnvUtils.ts +45 -0
  88. package/src/JavaScriptSDK/TelemetryHelpers.ts +57 -5
  89. package/src/JavaScriptSDK/W3cTraceParent.ts +196 -0
  90. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +12 -0
  91. package/src/JavaScriptSDK.Interfaces/IDistributedTraceContext.ts +54 -0
  92. package/src/JavaScriptSDK.Interfaces/ITraceParent.ts +38 -0
  93. package/tsconfig.json +1 -2
  94. package/types/JavaScriptSDK/BaseCore.d.ts +10 -0
  95. package/types/JavaScriptSDK/EnvUtils.d.ts +10 -0
  96. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +7 -0
  97. package/types/JavaScriptSDK/W3cTraceParent.d.ts +59 -0
  98. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +10 -0
  99. package/types/JavaScriptSDK.Interfaces/IDistributedTraceContext.d.ts +43 -0
  100. package/types/JavaScriptSDK.Interfaces/ITraceParent.d.ts +32 -0
  101. package/types/applicationinsights-core-js.d.ts +4 -1
  102. package/types/tsdoc-metadata.json +1 -1
@@ -82,6 +82,7 @@ export class BaseCore implements IAppInsightsCore {
82
82
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
83
83
  // (undocumented)
84
84
  getProcessTelContext(): IProcessTelemetryContext;
85
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
85
86
  // (undocumented)
86
87
  getTransmissionControls(): IChannelControls[][];
87
88
  // (undocumented)
@@ -97,6 +98,7 @@ export class BaseCore implements IAppInsightsCore {
97
98
  setCookieMgr(cookieMgr: ICookieMgr): void;
98
99
  // (undocumented)
99
100
  setPerfMgr(perfMgr: IPerfManager): void;
101
+ setTraceCtx(newTracectx: IDistributedTraceContext): void;
100
102
  stopPollingInternalLogs(): void;
101
103
  // (undocumented)
102
104
  track(telemetryItem: ITelemetryItem): void;
@@ -157,6 +159,9 @@ export function createEnumStyle<E>(values: {
157
159
  // @public
158
160
  export function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
159
161
 
162
+ // @public
163
+ export function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent;
164
+
160
165
  // @public (undocumented)
161
166
  export function createUniqueNamespace(name: string, includeVersion?: boolean): string;
162
167
 
@@ -420,6 +425,18 @@ export const EventsDiscardedReason: EnumValue<typeof eEventsDiscardedReason>;
420
425
  // @public (undocumented)
421
426
  export type EventsDiscardedReason = number | eEventsDiscardedReason;
422
427
 
428
+ // @public
429
+ export function findMetaTag(name: string): any;
430
+
431
+ // @public
432
+ export function findNamedServerTiming(name: string): any;
433
+
434
+ // @public
435
+ export function findW3cTraceParent(): ITraceParent;
436
+
437
+ // @public
438
+ export function formatTraceParent(value: ITraceParent): string;
439
+
423
440
  // @public
424
441
  export function generateW3CId(): string;
425
442
 
@@ -521,6 +538,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
521
538
  getNotifyMgr(): INotificationManager;
522
539
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
523
540
  getProcessTelContext(): IProcessTelemetryContext;
541
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
524
542
  // (undocumented)
525
543
  getTransmissionControls(): IChannelControls[][];
526
544
  // (undocumented)
@@ -532,6 +550,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
532
550
  pollInternalLogs?(eventName?: string): number;
533
551
  removeNotificationListener?(listener: INotificationListener): void;
534
552
  setCookieMgr(cookieMgr: ICookieMgr): void;
553
+ setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
535
554
  // (undocumented)
536
555
  stopPollingInternalLogs?(): void;
537
556
  // (undocumented)
@@ -694,6 +713,18 @@ export interface IDiagnosticLogger {
694
713
  warnToConsole(message: string): void;
695
714
  }
696
715
 
716
+ // @public (undocumented)
717
+ export interface IDistributedTraceContext {
718
+ getName(): string;
719
+ getSpanId(): string;
720
+ getTraceFlags(): number | undefined;
721
+ getTraceId(): string;
722
+ setName(pageName: string): void;
723
+ setSpanId(newValue: string): void;
724
+ setTraceFlags(newValue?: number): void;
725
+ setTraceId(newValue: string): void;
726
+ }
727
+
697
728
  // @public (undocumented)
698
729
  export interface IEventHelper {
699
730
  Attach: (obj: any, eventNameWithoutOn: string, handlerRef: any) => boolean;
@@ -926,6 +957,9 @@ export function isReactNative(): boolean;
926
957
  // @public (undocumented)
927
958
  export function isSafari(userAgentStr?: string): boolean;
928
959
 
960
+ // @public
961
+ export function isSampledFlag(value: ITraceParent): boolean;
962
+
929
963
  // @public
930
964
  export function isString(value: any): value is string;
931
965
 
@@ -941,6 +975,15 @@ export function isTypeof(value: any, theType: string): boolean;
941
975
  // @public (undocumented)
942
976
  export function isUndefined(value: any): value is undefined;
943
977
 
978
+ // @public
979
+ export function isValidSpanId(value: string): boolean;
980
+
981
+ // @public
982
+ export function isValidTraceId(value: string): boolean;
983
+
984
+ // @public
985
+ export function isValidTraceParent(value: ITraceParent): boolean;
986
+
944
987
  // @public
945
988
  export function isXhrSupported(): boolean;
946
989
 
@@ -1004,6 +1047,14 @@ export interface ITelemetryUpdateState {
1004
1047
  removed?: IPlugin[];
1005
1048
  }
1006
1049
 
1050
+ // @public
1051
+ export interface ITraceParent {
1052
+ spanId: string;
1053
+ traceFlags: number;
1054
+ traceId: string;
1055
+ version: string;
1056
+ }
1057
+
1007
1058
  // @public (undocumented)
1008
1059
  export interface IUnloadableComponent {
1009
1060
  _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
@@ -1092,6 +1143,9 @@ export function objToString(obj: any): any;
1092
1143
  // @public
1093
1144
  export function optimizeObject<T>(theObject: T): T;
1094
1145
 
1146
+ // @public
1147
+ export function parseTraceParent(value: string): ITraceParent;
1148
+
1095
1149
  // @public (undocumented)
1096
1150
  export class PerfEvent implements IPerfEvent {
1097
1151
  constructor(name: string, payloadDetails: () => any, isAsync: boolean);
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.4-nightly.2205-07
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.4-nightly.2205-10
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -230,6 +230,15 @@ declare namespace ApplicationInsights {
230
230
  * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
231
231
  */
232
232
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
233
+ /**
234
+ * Gets the current distributed trace context for this instance if available
235
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
236
+ */
237
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
238
+ /**
239
+ * Sets the current distributed trace context for this instance if available
240
+ */
241
+ setTraceCtx(newTracectx: IDistributedTraceContext): void;
233
242
  protected releaseQueue(): void;
234
243
  /**
235
244
  * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
@@ -383,6 +392,16 @@ declare namespace ApplicationInsights {
383
392
  */
384
393
  function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
385
394
 
395
+ /**
396
+ * Create a new ITraceParent instance using the provided values.
397
+ * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.
398
+ * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.
399
+ * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid
400
+ * @param version - The version to used, defaults to version "01" if not supplied or invalid.
401
+ * @returns
402
+ */
403
+ function createTraceParent(traceId?: string, spanId?: string, flags?: number, version?: string): ITraceParent;
404
+
386
405
  function createUniqueNamespace(name: string, includeVersion?: boolean): string;
387
406
 
388
407
  function createUnloadHandlerContainer(): {
@@ -677,6 +696,34 @@ declare namespace ApplicationInsights {
677
696
 
678
697
  type EventsDiscardedReason = number | eEventsDiscardedReason;
679
698
 
699
+ /**
700
+ * Helper function to fetch the named meta-tag from the page.
701
+ * @param name
702
+ */
703
+ function findMetaTag(name: string): any;
704
+
705
+ /**
706
+ * Helper function to fetch the named server timing value from the page response (first navigation event).
707
+ * @param name
708
+ */
709
+ function findNamedServerTiming(name: string): any;
710
+
711
+ /**
712
+ * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
713
+ * @returns
714
+ */
715
+ function findW3cTraceParent(): ITraceParent;
716
+
717
+ /**
718
+ * Format the ITraceParent value as a string using the supported and know version formats.
719
+ * So even if the passed traceParent is a later version the string value returned from this
720
+ * function will convert it to only the known version formats.
721
+ * This currently only supports version "00" and invalid "ff"
722
+ * @param value - The parsed traceParent value
723
+ * @returns
724
+ */
725
+ function formatTraceParent(value: ITraceParent): string;
726
+
680
727
  /**
681
728
  * generate W3C trace id
682
729
  */
@@ -936,6 +983,15 @@ declare namespace ApplicationInsights {
936
983
  * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
937
984
  */
938
985
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
986
+ /**
987
+ * Gets the current distributed trace context for this instance if available
988
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
989
+ */
990
+ getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
991
+ /**
992
+ * Sets the current distributed trace context for this instance if available
993
+ */
994
+ setTraceCtx(newTraceCtx: IDistributedTraceContext | null | undefined): void;
939
995
  }
940
996
 
941
997
  interface IBaseProcessingContext {
@@ -1510,6 +1566,50 @@ declare namespace ApplicationInsights {
1510
1566
  logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
1511
1567
  }
1512
1568
 
1569
+ interface IDistributedTraceContext {
1570
+ /**
1571
+ * Returns the current name of the page
1572
+ */
1573
+ getName(): string;
1574
+ /**
1575
+ * Sets the current name of the page
1576
+ * @param pageName
1577
+ */
1578
+ setName(pageName: string): void;
1579
+ /**
1580
+ * Returns the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1581
+ * Must be read from incoming headers or generated according to the W3C TraceContext specification,
1582
+ * in a hex representation of 16-byte array. A.k.a. trace-id, TraceID or Distributed TraceID
1583
+ */
1584
+ getTraceId(): string;
1585
+ /**
1586
+ * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1587
+ * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1588
+ * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1589
+ */
1590
+ setTraceId(newValue: string): void;
1591
+ /**
1592
+ * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1593
+ * Also know as the parentId, used to link requests together
1594
+ */
1595
+ getSpanId(): string;
1596
+ /**
1597
+ * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1598
+ * Also know as the parentId, used to link requests together
1599
+ * https://www.w3.org/TR/trace-context/#parent-id
1600
+ */
1601
+ setSpanId(newValue: string): void;
1602
+ /**
1603
+ * An integer representation of the W3C TraceContext trace-flags.
1604
+ */
1605
+ getTraceFlags(): number | undefined;
1606
+ /**
1607
+ * https://www.w3.org/TR/trace-context/#trace-flags
1608
+ * @param newValue
1609
+ */
1610
+ setTraceFlags(newValue?: number): void;
1611
+ }
1612
+
1513
1613
  interface IEventHelper {
1514
1614
  /**
1515
1615
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
@@ -2059,6 +2159,13 @@ declare namespace ApplicationInsights {
2059
2159
 
2060
2160
  function isSafari(userAgentStr?: string): boolean;
2061
2161
 
2162
+ /**
2163
+ * Is the parsed traceParent indicating that the trace is currently sampled.
2164
+ * @param value - The parsed traceParent value
2165
+ * @returns
2166
+ */
2167
+ function isSampledFlag(value: ITraceParent): boolean;
2168
+
2062
2169
  /**
2063
2170
  * Checks if the type of value is a string.
2064
2171
  * @param {any} value - Value to be checked.
@@ -2080,6 +2187,31 @@ declare namespace ApplicationInsights {
2080
2187
 
2081
2188
  function isUndefined(value: any): value is undefined;
2082
2189
 
2190
+ /**
2191
+ * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character
2192
+ * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
2193
+ * If all characters are zero (0000000000000000) this is considered an invalid value.
2194
+ * @param value - The W3c span id to be validated
2195
+ * @returns true if valid otherwise false
2196
+ */
2197
+ function isValidSpanId(value: string): boolean;
2198
+
2199
+ /**
2200
+ * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string
2201
+ * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.
2202
+ * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.
2203
+ * @param value - The W3c trace Id to be validated
2204
+ * @returns true if valid otherwise false
2205
+ */
2206
+ function isValidTraceId(value: string): boolean;
2207
+
2208
+ /**
2209
+ * Validates that the provided ITraceParent instance conforms to the currently supported specifications
2210
+ * @param value
2211
+ * @returns
2212
+ */
2213
+ function isValidTraceParent(value: ITraceParent): boolean;
2214
+
2083
2215
  /**
2084
2216
  * Checks if XMLHttpRequest is supported
2085
2217
  * @returns True if supported, otherwise false
@@ -2229,6 +2361,39 @@ declare namespace ApplicationInsights {
2229
2361
  removed?: IPlugin[];
2230
2362
  }
2231
2363
 
2364
+ /**
2365
+ * This interface represents the components of a W3C traceparent header
2366
+ */
2367
+ interface ITraceParent {
2368
+ /**
2369
+ * The version of the definition, this MUST be a string with a length of 2 and only contain lowercase
2370
+ * hexadecimal characters. A value of 'ff' is considered to be an invalid version.
2371
+ */
2372
+ version: string;
2373
+ /**
2374
+ * This is the ID of the whole trace forest and is used to uniquely identify a distributed trace
2375
+ * through a system. It is represented as a 32-character string of lowercase hexadecimal characters,
2376
+ * for example, 4bf92f3577b34da6a3ce929d0e0e4736.
2377
+ * All characters as zero (00000000000000000000000000000000) is considered an invalid value.
2378
+ */
2379
+ traceId: string;
2380
+ /**
2381
+ * This is the ID of the current request as known by the caller (in some tracing systems, this is also
2382
+ * known as the parent-id, where a span is the execution of a client request). It is represented as an
2383
+ * 16-character string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
2384
+ * All bytes as zero (0000000000000000) is considered an invalid value.
2385
+ */
2386
+ spanId: string;
2387
+ /**
2388
+ * An 8-bit value of flags that controls tracing such as sampling, trace level, etc. These flags are
2389
+ * recommendations given by the caller rather than strict rules to follow.
2390
+ * As this is a bit field, you cannot interpret flags by decoding the hex value and looking at the resulting
2391
+ * number. For example, a flag 00000001 could be encoded as 01 in hex, or 09 in hex if present with the flag
2392
+ * 00001000. A common mistake in bit fields is forgetting to mask when interpreting flags.
2393
+ */
2394
+ traceFlags: number;
2395
+ }
2396
+
2232
2397
  interface IUnloadableComponent {
2233
2398
  /**
2234
2399
  * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
@@ -2407,6 +2572,14 @@ declare namespace ApplicationInsights {
2407
2572
  */
2408
2573
  function optimizeObject<T>(theObject: T): T;
2409
2574
 
2575
+ /**
2576
+ * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)
2577
+ *
2578
+ * @param value
2579
+ * @returns
2580
+ */
2581
+ function parseTraceParent(value: string): ITraceParent;
2582
+
2410
2583
  class PerfEvent implements IPerfEvent {
2411
2584
  static ParentContextKey: string;
2412
2585
  static ChildrenContextKey: string;