@microsoft/applicationinsights-dependencies-js 3.0.0-beta.2208-04 → 3.0.0-beta.2208-14

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 (31) hide show
  1. package/browser/applicationinsights-dependencies-js.integrity.json +9 -9
  2. package/browser/applicationinsights-dependencies-js.js +216 -75
  3. package/browser/applicationinsights-dependencies-js.js.map +1 -1
  4. package/browser/applicationinsights-dependencies-js.min.js +2 -2
  5. package/browser/applicationinsights-dependencies-js.min.js.map +1 -1
  6. package/dist/applicationinsights-dependencies-js.api.json +87 -10
  7. package/dist/applicationinsights-dependencies-js.api.md +10 -6
  8. package/dist/applicationinsights-dependencies-js.d.ts +27 -4
  9. package/dist/applicationinsights-dependencies-js.js +216 -75
  10. package/dist/applicationinsights-dependencies-js.js.map +1 -1
  11. package/dist/applicationinsights-dependencies-js.min.js +2 -2
  12. package/dist/applicationinsights-dependencies-js.min.js.map +1 -1
  13. package/dist/applicationinsights-dependencies-js.rollup.d.ts +27 -4
  14. package/dist-esm/DependencyListener.js +1 -1
  15. package/dist-esm/InternalConstants.js +1 -1
  16. package/dist-esm/__DynamicConstants.js +27 -20
  17. package/dist-esm/__DynamicConstants.js.map +1 -1
  18. package/dist-esm/ajax.js +53 -52
  19. package/dist-esm/ajax.js.map +1 -1
  20. package/dist-esm/ajaxRecord.js +38 -9
  21. package/dist-esm/ajaxRecord.js.map +1 -1
  22. package/dist-esm/ajaxUtils.js +1 -1
  23. package/dist-esm/applicationinsights-dependencies-js.js +1 -1
  24. package/package.json +3 -3
  25. package/src/__DynamicConstants.ts +26 -19
  26. package/src/ajax.ts +6 -7
  27. package/src/ajaxRecord.ts +62 -5
  28. package/types/__DynamicConstants.d.ts +24 -17
  29. package/types/ajax.d.ts +2 -2
  30. package/types/ajaxRecord.d.ts +24 -2
  31. package/types/tsdoc-metadata.json +1 -1
@@ -13,30 +13,33 @@
13
13
  export const _DYN_REQUEST_URL = "requestUrl"; // Count: 12
14
14
  export const _DYN_INST = "inst"; // Count: 5
15
15
  export const _DYN_LENGTH = "length"; // Count: 9
16
- export const _DYN_TRACE_ID = "traceID"; // Count: 8
16
+ export const _DYN_TRACE_ID = "traceID"; // Count: 9
17
17
  export const _DYN_SPAN_ID = "spanID"; // Count: 8
18
- export const _DYN_TRACE_FLAGS = "traceFlags"; // Count: 8
18
+ export const _DYN_TRACE_FLAGS = "traceFlags"; // Count: 13
19
19
  export const _DYN_CORE = "core"; // Count: 6
20
+ export const _DYN_TRACE_ID0 = "traceId"; // Count: 5
21
+ export const _DYN_SPAN_ID1 = "spanId"; // Count: 5
20
22
  export const _DYN_GET_DEFAULT_CONFIG = "getDefaultConfig"; // Count: 2
21
- export const _DYN_INCLUDE_CORRELATION_0 = "includeCorrelationHeaders"; // Count: 4
22
- export const _DYN_CAN_INCLUDE_CORRELAT1 = "canIncludeCorrelationHeader"; // Count: 2
23
+ export const _DYN_TRACK_DEPENDENCY_DAT2 = "trackDependencyDataInternal"; // Count: 4
24
+ export const _DYN_INCLUDE_CORRELATION_3 = "includeCorrelationHeaders"; // Count: 4
25
+ export const _DYN_CAN_INCLUDE_CORRELAT4 = "canIncludeCorrelationHeader"; // Count: 2
23
26
  export const _DYN_GET_ABSOLUTE_URL = "getAbsoluteUrl"; // Count: 3
24
27
  export const _DYN_HEADERS = "headers"; // Count: 6
25
28
  export const _DYN_REQUEST_HEADERS = "requestHeaders"; // Count: 13
26
29
  export const _DYN_APP_ID = "appId"; // Count: 5
27
30
  export const _DYN_SET_REQUEST_HEADER = "setRequestHeader"; // Count: 3
28
- export const _DYN_DISTRIBUTED_TRACING_2 = "distributedTracingMode"; // Count: 3
31
+ export const _DYN_DISTRIBUTED_TRACING_5 = "distributedTracingMode"; // Count: 3
29
32
  export const _DYN_START_TIME = "startTime"; // Count: 6
30
33
  export const _DYN_TO_LOWER_CASE = "toLowerCase"; // Count: 6
31
- export const _DYN_ENABLE_REQUEST_HEADE3 = "enableRequestHeaderTracking"; // Count: 2
32
- export const _DYN_ENABLE_AJAX_ERROR_ST4 = "enableAjaxErrorStatusText"; // Count: 2
33
- export const _DYN_ENABLE_AJAX_PERF_TRA5 = "enableAjaxPerfTracking"; // Count: 2
34
- export const _DYN_MAX_AJAX_CALLS_PER_V6 = "maxAjaxCallsPerView"; // Count: 2
35
- export const _DYN_ENABLE_RESPONSE_HEAD7 = "enableResponseHeaderTracking"; // Count: 2
36
- export const _DYN_EXCLUDE_REQUEST_FROM8 = "excludeRequestFromAutoTrackingPatterns"; // Count: 2
34
+ export const _DYN_ENABLE_REQUEST_HEADE6 = "enableRequestHeaderTracking"; // Count: 2
35
+ export const _DYN_ENABLE_AJAX_ERROR_ST7 = "enableAjaxErrorStatusText"; // Count: 2
36
+ export const _DYN_ENABLE_AJAX_PERF_TRA8 = "enableAjaxPerfTracking"; // Count: 2
37
+ export const _DYN_MAX_AJAX_CALLS_PER_V9 = "maxAjaxCallsPerView"; // Count: 2
38
+ export const _DYN_ENABLE_RESPONSE_HEAD10 = "enableResponseHeaderTracking"; // Count: 2
39
+ export const _DYN_EXCLUDE_REQUEST_FROM11 = "excludeRequestFromAutoTrackingPatterns"; // Count: 2
37
40
  export const _DYN_ADD_REQUEST_CONTEXT = "addRequestContext"; // Count: 2
38
- export const _DYN_DISABLE_AJAX_TRACKIN9 = "disableAjaxTracking"; // Count: 2
39
- export const _DYN_DISABLE_FETCH_TRACKI10 = "disableFetchTracking"; // Count: 2
41
+ export const _DYN_DISABLE_AJAX_TRACKIN12 = "disableAjaxTracking"; // Count: 2
42
+ export const _DYN_DISABLE_FETCH_TRACKI13 = "disableFetchTracking"; // Count: 2
40
43
  export const _DYN_STATUS = "status"; // Count: 10
41
44
  export const _DYN_STATUS_TEXT = "statusText"; // Count: 8
42
45
  export const _DYN_HEADER_MAP = "headerMap"; // Count: 8
@@ -44,19 +47,23 @@ export const _DYN_OPEN_DONE = "openDone"; // Count: 3
44
47
  export const _DYN_SEND_DONE = "sendDone"; // Count: 3
45
48
  export const _DYN_REQUEST_SENT_TIME = "requestSentTime"; // Count: 9
46
49
  export const _DYN_ABORT_DONE = "abortDone"; // Count: 3
50
+ export const _DYN_GET_TRACE_ID = "getTraceId"; // Count: 3
51
+ export const _DYN_GET_TRACE_FLAGS = "getTraceFlags"; // Count: 3
47
52
  export const _DYN_METHOD = "method"; // Count: 10
48
53
  export const _DYN_ERROR_STATUS_TEXT = "errorStatusText"; // Count: 3
49
- export const _DYN_STATE_CHANGE_ATTACHE11 = "stateChangeAttached"; // Count: 2
54
+ export const _DYN_STATE_CHANGE_ATTACHE14 = "stateChangeAttached"; // Count: 2
50
55
  export const _DYN_RESPONSE_TEXT = "responseText"; // Count: 5
51
- export const _DYN_RESPONSE_FINISHED_TI12 = "responseFinishedTime"; // Count: 7
56
+ export const _DYN_RESPONSE_FINISHED_TI15 = "responseFinishedTime"; // Count: 7
52
57
  export const _DYN__CREATE_TRACK_ITEM = "CreateTrackItem"; // Count: 3
53
58
  export const _DYN_RESPONSE = "response"; // Count: 4
54
- export const _DYN_GET_ALL_RESPONSE_HEA13 = "getAllResponseHeaders"; // Count: 2
55
- export const _DYN_GET_CORRELATION_CONT14 = "getCorrelationContext"; // Count: 2
59
+ export const _DYN_GET_ALL_RESPONSE_HEA16 = "getAllResponseHeaders"; // Count: 2
60
+ export const _DYN_GET_PART_APROPS = "getPartAProps"; // Count: 3
61
+ export const _DYN_GET_CORRELATION_CONT17 = "getCorrelationContext"; // Count: 2
56
62
  export const _DYN_PERF_MARK = "perfMark"; // Count: 4
57
- export const _DYN_AJAX_PERF_LOOKUP_DEL15 = "ajaxPerfLookupDelay"; // Count: 2
63
+ export const _DYN_AJAX_PERF_LOOKUP_DEL18 = "ajaxPerfLookupDelay"; // Count: 2
58
64
  export const _DYN_NAME = "name"; // Count: 6
59
65
  export const _DYN_PERF_TIMING = "perfTiming"; // Count: 3
60
- export const _DYN_AJAX_DIAGNOSTICS_MES16 = "ajaxDiagnosticsMessage"; // Count: 3
66
+ export const _DYN_AJAX_DIAGNOSTICS_MES19 = "ajaxDiagnosticsMessage"; // Count: 3
61
67
  export const _DYN_CORRELATION_CONTEXT = "correlationContext"; // Count: 3
62
68
  export const _DYN_AJAX_TOTAL_DURATION = "ajaxTotalDuration"; // Count: 3
69
+ export const _DYN_EVENT_TRACE_CTX = "eventTraceCtx"; // Count: 3
package/src/ajax.ts CHANGED
@@ -23,7 +23,6 @@ const AJAX_MONITOR_PREFIX = "ai.ajxmn.";
23
23
  const strDiagLog = "diagLog";
24
24
  const strAjaxData = "ajaxData";
25
25
  const strFetch = "fetch";
26
- const strTrackDependencyDataInternal = "trackDependencyDataInternal"; // Using string to help with minification
27
26
 
28
27
  // Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)
29
28
  let _markCount: number = 0;
@@ -292,7 +291,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
292
291
  };
293
292
 
294
293
  _self.trackDependencyData = (dependency: IDependencyTelemetry, properties?: { [key: string]: any }) => {
295
- _self[strTrackDependencyDataInternal](dependency, properties);
294
+ _self.trackDependencyDataInternal(dependency, properties);
296
295
  }
297
296
 
298
297
  _self.includeCorrelationHeaders = (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented): any => {
@@ -378,7 +377,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
378
377
  return undefined;
379
378
  }
380
379
 
381
- _self[strTrackDependencyDataInternal] = (dependency: IDependencyTelemetry, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) => {
380
+ _self.trackDependencyDataInternal = (dependency: IDependencyTelemetry, properties?: { [key: string]: any }, systemProperties?: { [key: string]: any }) => {
382
381
  if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
383
382
  // Hack since expected format in w3c mode is |abc.def.
384
383
  // Non-w3c format is |abc.def
@@ -789,7 +788,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
789
788
  const traceID = (distributedTraceCtx && distributedTraceCtx.getTraceId()) || generateW3CId();
790
789
  const spanID = generateW3CId().substr(0, 16);
791
790
 
792
- const ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
791
+ const ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog](), _self.core?.getTraceCtx());
793
792
  ajaxData.traceFlags = distributedTraceCtx && distributedTraceCtx.getTraceFlags();
794
793
  ajaxData.method = method;
795
794
  ajaxData.requestUrl = url;
@@ -906,7 +905,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
906
905
  if (properties !== undefined) {
907
906
  dependency.properties = {...dependency.properties, ...properties};
908
907
  }
909
- _self[strTrackDependencyDataInternal](dependency);
908
+ _self.trackDependencyDataInternal(dependency, null, ajaxData.getPartAProps());
910
909
  } else {
911
910
  _reportXhrError(null, {
912
911
  requestSentTime: ajaxData.requestSentTime,
@@ -1031,7 +1030,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
1031
1030
  const traceID = (distributedTraceCtx && distributedTraceCtx.getTraceId()) || generateW3CId();
1032
1031
  const spanID = generateW3CId().substr(0, 16);
1033
1032
 
1034
- let ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
1033
+ let ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog](), _self.core?.getTraceCtx());
1035
1034
  ajaxData.traceFlags = distributedTraceCtx && distributedTraceCtx.getTraceFlags();
1036
1035
  ajaxData.requestSentTime = dateTimeUtilsNow();
1037
1036
  ajaxData.errorStatusText = _enableAjaxErrorStatusText;
@@ -1126,7 +1125,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
1126
1125
  if (properties !== undefined) {
1127
1126
  dependency.properties = {...dependency.properties, ...properties};
1128
1127
  }
1129
- _self[strTrackDependencyDataInternal](dependency);
1128
+ _self.trackDependencyDataInternal(dependency, null, ajaxData.getPartAProps());
1130
1129
  } else {
1131
1130
  _reportFetchError(_eInternalMessageId.FailedMonitorAjaxDur, null,
1132
1131
  {
package/src/ajaxRecord.ts CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  import dynamicProto from "@microsoft/dynamicproto-js";
5
5
  import {
6
- IDependencyTelemetry, dataSanitizeUrl, dateTimeUtilsDuration, msToTimeSpan, urlGetAbsoluteUrl, urlGetCompleteUrl
6
+ Extensions, IDependencyTelemetry, dataSanitizeUrl, dateTimeUtilsDuration, msToTimeSpan, urlGetAbsoluteUrl, urlGetCompleteUrl
7
7
  } from "@microsoft/applicationinsights-common";
8
8
  import {
9
- IDiagnosticLogger, arrForEach, isNumber, isString, normalizeJsName, objForEachKey, objKeys
9
+ IDiagnosticLogger, IDistributedTraceContext, arrForEach, isNullOrUndefined, isNumber, isString, normalizeJsName, objForEachKey, objKeys
10
10
  } from "@microsoft/applicationinsights-core-js";
11
11
  import { STR_DURATION, STR_PROPERTIES } from "./InternalConstants";
12
12
 
@@ -19,6 +19,12 @@ export interface IAjaxRecordResponse {
19
19
  response?: Object
20
20
  }
21
21
 
22
+ interface ITraceCtx {
23
+ traceId: string;
24
+ spanId: string;
25
+ traceFlags: number;
26
+ }
27
+
22
28
  /** @ignore */
23
29
  function _calcPerfDuration(resourceEntry:PerformanceResourceTiming, start:string, end:string) {
24
30
  let result = 0;
@@ -237,11 +243,27 @@ export class ajaxRecord {
237
243
  // <summary>Determines whether or not JavaScript exception occured in xhr.onreadystatechange code. 1 if occured, otherwise 0.</summary>
238
244
  public clientFailure: number;
239
245
 
246
+ /**
247
+ * The traceId to use for the dependency call
248
+ */
240
249
  public traceID: string;
250
+
251
+ /**
252
+ * The spanId to use for the dependency call
253
+ */
241
254
  public spanID: string;
255
+
256
+ /**
257
+ * The traceFlags to use for the dependency call
258
+ */
242
259
  public traceFlags?: number;
243
260
 
244
- constructor(traceID: string, spanID: string, logger: IDiagnosticLogger) {
261
+ /**
262
+ * The trace context to use for reporting the remote dependency call
263
+ */
264
+ public eventTraceCtx: ITraceCtx;
265
+
266
+ constructor(traceId: string, spanId: string, logger: IDiagnosticLogger, traceCtx?: IDistributedTraceContext) {
245
267
  let self = this;
246
268
  let _logger: IDiagnosticLogger = logger;
247
269
  let strResponseText = "responseText";
@@ -269,8 +291,19 @@ export class ajaxRecord {
269
291
  self.xhrMonitoringState = new XHRMonitoringState();
270
292
  self.clientFailure = 0;
271
293
 
272
- self.traceID = traceID;
273
- self.spanID = spanID;
294
+ self.traceID = traceId;
295
+ self.spanID = spanId;
296
+ self.traceFlags = traceCtx?.getTraceFlags();
297
+
298
+ if (traceCtx) {
299
+ self.eventTraceCtx = {
300
+ traceId: traceCtx.getTraceId(),
301
+ spanId: traceCtx.getSpanId(),
302
+ traceFlags: traceCtx.getTraceFlags()
303
+ };
304
+ } else {
305
+ self.eventTraceCtx = null;
306
+ }
274
307
 
275
308
  dynamicProto(ajaxRecord, self, (self) => {
276
309
  self.getAbsoluteUrl= () => {
@@ -349,6 +382,25 @@ export class ajaxRecord {
349
382
 
350
383
  return dependency;
351
384
  }
385
+
386
+ self.getPartAProps = () => {
387
+ let partA: { [key: string]: any } = null;
388
+
389
+ let traceCtx = self.eventTraceCtx;
390
+ if (traceCtx && (traceCtx.traceId || traceCtx.spanId)) {
391
+ partA = {};
392
+ let traceExt = partA[Extensions.TraceExt] = {
393
+ traceID: traceCtx.traceId,
394
+ parentID: traceCtx.spanId
395
+ } as { [key: string]: any };
396
+
397
+ if (!isNullOrUndefined(traceCtx.traceFlags)) {
398
+ traceExt.traceFlags = traceCtx.traceFlags;
399
+ }
400
+ }
401
+
402
+ return partA
403
+ };
352
404
  });
353
405
  }
354
406
 
@@ -366,4 +418,9 @@ export class ajaxRecord {
366
418
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
367
419
  return null;
368
420
  }
421
+
422
+ public getPartAProps(): { [key: string]: any } {
423
+ // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
424
+ return null;
425
+ }
369
426
  }
@@ -5,26 +5,29 @@ export declare const _DYN_TRACE_ID = "traceID";
5
5
  export declare const _DYN_SPAN_ID = "spanID";
6
6
  export declare const _DYN_TRACE_FLAGS = "traceFlags";
7
7
  export declare const _DYN_CORE = "core";
8
+ export declare const _DYN_TRACE_ID0 = "traceId";
9
+ export declare const _DYN_SPAN_ID1 = "spanId";
8
10
  export declare const _DYN_GET_DEFAULT_CONFIG = "getDefaultConfig";
9
- export declare const _DYN_INCLUDE_CORRELATION_0 = "includeCorrelationHeaders";
10
- export declare const _DYN_CAN_INCLUDE_CORRELAT1 = "canIncludeCorrelationHeader";
11
+ export declare const _DYN_TRACK_DEPENDENCY_DAT2 = "trackDependencyDataInternal";
12
+ export declare const _DYN_INCLUDE_CORRELATION_3 = "includeCorrelationHeaders";
13
+ export declare const _DYN_CAN_INCLUDE_CORRELAT4 = "canIncludeCorrelationHeader";
11
14
  export declare const _DYN_GET_ABSOLUTE_URL = "getAbsoluteUrl";
12
15
  export declare const _DYN_HEADERS = "headers";
13
16
  export declare const _DYN_REQUEST_HEADERS = "requestHeaders";
14
17
  export declare const _DYN_APP_ID = "appId";
15
18
  export declare const _DYN_SET_REQUEST_HEADER = "setRequestHeader";
16
- export declare const _DYN_DISTRIBUTED_TRACING_2 = "distributedTracingMode";
19
+ export declare const _DYN_DISTRIBUTED_TRACING_5 = "distributedTracingMode";
17
20
  export declare const _DYN_START_TIME = "startTime";
18
21
  export declare const _DYN_TO_LOWER_CASE = "toLowerCase";
19
- export declare const _DYN_ENABLE_REQUEST_HEADE3 = "enableRequestHeaderTracking";
20
- export declare const _DYN_ENABLE_AJAX_ERROR_ST4 = "enableAjaxErrorStatusText";
21
- export declare const _DYN_ENABLE_AJAX_PERF_TRA5 = "enableAjaxPerfTracking";
22
- export declare const _DYN_MAX_AJAX_CALLS_PER_V6 = "maxAjaxCallsPerView";
23
- export declare const _DYN_ENABLE_RESPONSE_HEAD7 = "enableResponseHeaderTracking";
24
- export declare const _DYN_EXCLUDE_REQUEST_FROM8 = "excludeRequestFromAutoTrackingPatterns";
22
+ export declare const _DYN_ENABLE_REQUEST_HEADE6 = "enableRequestHeaderTracking";
23
+ export declare const _DYN_ENABLE_AJAX_ERROR_ST7 = "enableAjaxErrorStatusText";
24
+ export declare const _DYN_ENABLE_AJAX_PERF_TRA8 = "enableAjaxPerfTracking";
25
+ export declare const _DYN_MAX_AJAX_CALLS_PER_V9 = "maxAjaxCallsPerView";
26
+ export declare const _DYN_ENABLE_RESPONSE_HEAD10 = "enableResponseHeaderTracking";
27
+ export declare const _DYN_EXCLUDE_REQUEST_FROM11 = "excludeRequestFromAutoTrackingPatterns";
25
28
  export declare const _DYN_ADD_REQUEST_CONTEXT = "addRequestContext";
26
- export declare const _DYN_DISABLE_AJAX_TRACKIN9 = "disableAjaxTracking";
27
- export declare const _DYN_DISABLE_FETCH_TRACKI10 = "disableFetchTracking";
29
+ export declare const _DYN_DISABLE_AJAX_TRACKIN12 = "disableAjaxTracking";
30
+ export declare const _DYN_DISABLE_FETCH_TRACKI13 = "disableFetchTracking";
28
31
  export declare const _DYN_STATUS = "status";
29
32
  export declare const _DYN_STATUS_TEXT = "statusText";
30
33
  export declare const _DYN_HEADER_MAP = "headerMap";
@@ -32,19 +35,23 @@ export declare const _DYN_OPEN_DONE = "openDone";
32
35
  export declare const _DYN_SEND_DONE = "sendDone";
33
36
  export declare const _DYN_REQUEST_SENT_TIME = "requestSentTime";
34
37
  export declare const _DYN_ABORT_DONE = "abortDone";
38
+ export declare const _DYN_GET_TRACE_ID = "getTraceId";
39
+ export declare const _DYN_GET_TRACE_FLAGS = "getTraceFlags";
35
40
  export declare const _DYN_METHOD = "method";
36
41
  export declare const _DYN_ERROR_STATUS_TEXT = "errorStatusText";
37
- export declare const _DYN_STATE_CHANGE_ATTACHE11 = "stateChangeAttached";
42
+ export declare const _DYN_STATE_CHANGE_ATTACHE14 = "stateChangeAttached";
38
43
  export declare const _DYN_RESPONSE_TEXT = "responseText";
39
- export declare const _DYN_RESPONSE_FINISHED_TI12 = "responseFinishedTime";
44
+ export declare const _DYN_RESPONSE_FINISHED_TI15 = "responseFinishedTime";
40
45
  export declare const _DYN__CREATE_TRACK_ITEM = "CreateTrackItem";
41
46
  export declare const _DYN_RESPONSE = "response";
42
- export declare const _DYN_GET_ALL_RESPONSE_HEA13 = "getAllResponseHeaders";
43
- export declare const _DYN_GET_CORRELATION_CONT14 = "getCorrelationContext";
47
+ export declare const _DYN_GET_ALL_RESPONSE_HEA16 = "getAllResponseHeaders";
48
+ export declare const _DYN_GET_PART_APROPS = "getPartAProps";
49
+ export declare const _DYN_GET_CORRELATION_CONT17 = "getCorrelationContext";
44
50
  export declare const _DYN_PERF_MARK = "perfMark";
45
- export declare const _DYN_AJAX_PERF_LOOKUP_DEL15 = "ajaxPerfLookupDelay";
51
+ export declare const _DYN_AJAX_PERF_LOOKUP_DEL18 = "ajaxPerfLookupDelay";
46
52
  export declare const _DYN_NAME = "name";
47
53
  export declare const _DYN_PERF_TIMING = "perfTiming";
48
- export declare const _DYN_AJAX_DIAGNOSTICS_MES16 = "ajaxDiagnosticsMessage";
54
+ export declare const _DYN_AJAX_DIAGNOSTICS_MES19 = "ajaxDiagnosticsMessage";
49
55
  export declare const _DYN_CORRELATION_CONTEXT = "correlationContext";
50
56
  export declare const _DYN_AJAX_TOTAL_DURATION = "ajaxTotalDuration";
57
+ export declare const _DYN_EVENT_TRACE_CTX = "eventTraceCtx";
package/types/ajax.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IConfig, ICorrelationConfig, IDependencyTelemetry } from "@microsoft/applicationinsights-common";
2
2
  import { BaseTelemetryPlugin, IAppInsightsCore, IConfiguration, IPlugin, IProcessTelemetryContext, ITelemetryItem, ITelemetryPluginChain } from "@microsoft/applicationinsights-core-js";
3
3
  import { DependencyListenerFunction, IDependencyListenerContainer, IDependencyListenerHandler } from "./DependencyListener";
4
- import { _DYN_INCLUDE_CORRELATION_0 } from "./__DynamicConstants";
4
+ import { _DYN_INCLUDE_CORRELATION_3 } from "./__DynamicConstants";
5
5
  import { ajaxRecord } from "./ajaxRecord";
6
6
  export interface XMLHttpRequestInstrumented extends XMLHttpRequest {
7
7
  ajaxData: ajaxRecord;
@@ -15,7 +15,7 @@ export interface IDependenciesPlugin extends IDependencyListenerContainer {
15
15
  trackDependencyData(dependency: IDependencyTelemetry): void;
16
16
  }
17
17
  export interface IInstrumentationRequirements extends IDependenciesPlugin {
18
- [_DYN_INCLUDE_CORRELATION_0]: (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
18
+ [_DYN_INCLUDE_CORRELATION_3]: (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
19
19
  }
20
20
  export declare class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlugin, IInstrumentationRequirements {
21
21
  static identifier: string;
@@ -1,5 +1,5 @@
1
1
  import { IDependencyTelemetry } from "@microsoft/applicationinsights-common";
2
- import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
2
+ import { IDiagnosticLogger, IDistributedTraceContext } from "@microsoft/applicationinsights-core-js";
3
3
  import { _DYN_HEADER_MAP } from "./__DynamicConstants";
4
4
  export interface IAjaxRecordResponse {
5
5
  statusText: string;
@@ -9,6 +9,11 @@ export interface IAjaxRecordResponse {
9
9
  responseText?: string;
10
10
  response?: Object;
11
11
  }
12
+ interface ITraceCtx {
13
+ traceId: string;
14
+ spanId: string;
15
+ traceFlags: number;
16
+ }
12
17
  export declare class XHRMonitoringState {
13
18
  openDone: boolean;
14
19
  setRequestHeaderDone: boolean;
@@ -42,11 +47,28 @@ export declare class ajaxRecord {
42
47
  endTime: number;
43
48
  xhrMonitoringState: XHRMonitoringState;
44
49
  clientFailure: number;
50
+ /**
51
+ * The traceId to use for the dependency call
52
+ */
45
53
  traceID: string;
54
+ /**
55
+ * The spanId to use for the dependency call
56
+ */
46
57
  spanID: string;
58
+ /**
59
+ * The traceFlags to use for the dependency call
60
+ */
47
61
  traceFlags?: number;
48
- constructor(traceID: string, spanID: string, logger: IDiagnosticLogger);
62
+ /**
63
+ * The trace context to use for reporting the remote dependency call
64
+ */
65
+ eventTraceCtx: ITraceCtx;
66
+ constructor(traceId: string, spanId: string, logger: IDiagnosticLogger, traceCtx?: IDistributedTraceContext);
49
67
  getAbsoluteUrl(): string;
50
68
  getPathName(): string;
51
69
  CreateTrackItem(ajaxType: string, enableRequestHeaderTracking: boolean, getResponse: () => IAjaxRecordResponse): IDependencyTelemetry;
70
+ getPartAProps(): {
71
+ [key: string]: any;
72
+ };
52
73
  }
74
+ export {};
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.28.7"
8
+ "packageVersion": "7.29.0"
9
9
  }
10
10
  ]
11
11
  }