@microsoft/applicationinsights-dependencies-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-04

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights XHR dependencies plugin, 2.8.0-nightly.2202-06
2
+ * Microsoft Application Insights XHR dependencies plugin, 2.8.0-nightly.2204-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -33,7 +33,6 @@ export declare class AjaxPlugin extends BaseTelemetryPlugin implements IDependen
33
33
  priority: number;
34
34
  constructor();
35
35
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
36
- teardown(): void;
37
36
  processTelemetry(item: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
38
37
  /**
39
38
  * Logs dependency call
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2204-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { generateW3CId } from "@microsoft/applicationinsights-core-js";
package/dist-esm/ajax.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2204-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { __assignFn as __assign, __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
8
- import { RequestHeaders, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, dateTimeUtilsNow, DisabledPropertyName, PropertiesPluginIdentifier, DistributedTracingModes, isInternalApplicationInsightsEndpoint } from "@microsoft/applicationinsights-common";
9
- import { isNullOrUndefined, arrForEach, isString, strTrim, isFunction, LoggingSeverity, _InternalMessageId, BaseTelemetryPlugin, getLocation, getGlobal, strPrototype, InstrumentFunc, InstrumentProto, getPerformance, objForEachKey, generateW3CId, getIEVersion, dumpObj, isXhrSupported, attachEvent } from "@microsoft/applicationinsights-core-js";
8
+ import { RequestHeaders, CorrelationIdHelper, TelemetryItemCreator, RemoteDependencyData, dateTimeUtilsNow, DisabledPropertyName, PropertiesPluginIdentifier, isInternalApplicationInsightsEndpoint } from "@microsoft/applicationinsights-common";
9
+ import { isNullOrUndefined, arrForEach, isString, strTrim, isFunction, LoggingSeverity, _InternalMessageId, BaseTelemetryPlugin, getLocation, getGlobal, strPrototype, InstrumentFunc, InstrumentProto, getPerformance, objForEachKey, generateW3CId, getIEVersion, dumpObj, isXhrSupported, eventOn, mergeEvtNamespace, createUniqueNamespace, createProcessTelemetryContext } from "@microsoft/applicationinsights-core-js";
10
10
  import { ajaxRecord } from "./ajaxRecord";
11
11
  import { Traceparent } from "./TraceParent";
12
12
  import dynamicProto from "@microsoft/dynamicproto-js";
@@ -15,6 +15,7 @@ var strDiagLog = "diagLog";
15
15
  var strAjaxData = "ajaxData";
16
16
  var strThrowInternal = "throwInternal";
17
17
  var strFetch = "fetch";
18
+ var strTrackDependencyDataInternal = "trackDependencyDataInternal"; // Using string to help with minification
18
19
  // Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)
19
20
  var _markCount = 0;
20
21
  /** @Ignore */
@@ -110,81 +111,41 @@ var AjaxMonitor = /** @class */ (function (_super) {
110
111
  var _this = _super.call(this) || this;
111
112
  _this.identifier = AjaxMonitor.identifier;
112
113
  _this.priority = 120;
113
- var strTrackDependencyDataInternal = "trackDependencyDataInternal"; // Using string to help with minification
114
- var location = getLocation();
115
- var _fetchInitialized = false; // fetch monitoring initialized
116
- var _xhrInitialized = false; // XHR monitoring initialized
117
- var _currentWindowHost = location && location.host && location.host.toLowerCase();
118
- var _config = AjaxMonitor.getEmptyConfig();
119
- var _enableRequestHeaderTracking = false;
120
- var _enableAjaxErrorStatusText = false;
121
- var _trackAjaxAttempts = 0;
114
+ var _fetchInitialized; // fetch monitoring initialized
115
+ var _xhrInitialized; // XHR monitoring initialized
116
+ var _currentWindowHost;
117
+ var _config;
118
+ var _enableRequestHeaderTracking;
119
+ var _enableAjaxErrorStatusText;
120
+ var _trackAjaxAttempts;
122
121
  var _context;
123
122
  var _isUsingW3CHeaders;
124
123
  var _isUsingAIHeaders;
125
124
  var _markPrefix;
126
- var _enableAjaxPerfTracking = false;
127
- var _maxAjaxCallsPerView = 0;
128
- var _enableResponseHeaderTracking = false;
129
- var _hooks = [];
130
- var _disabledUrls = {};
125
+ var _enableAjaxPerfTracking;
126
+ var _maxAjaxCallsPerView;
127
+ var _enableResponseHeaderTracking;
128
+ var _disabledUrls;
129
+ var _disableAjaxTracking;
130
+ var _disableFetchTracking;
131
131
  var _excludeRequestFromAutoTrackingPatterns;
132
132
  var _addRequestContext;
133
- dynamicProto(AjaxMonitor, _this, function (_self, base) {
133
+ var _evtNamespace;
134
+ dynamicProto(AjaxMonitor, _this, function (_self, _base) {
135
+ var _addHook = _base._addHook;
136
+ _initDefaults();
134
137
  _self.initialize = function (config, core, extensions, pluginChain) {
135
138
  if (!_self.isInitialized()) {
136
- base.initialize(config, core, extensions, pluginChain);
137
- var ctx_1 = _self._getTelCtx();
138
- var defaultConfig = AjaxMonitor.getDefaultConfig();
139
- objForEachKey(defaultConfig, function (field, value) {
140
- _config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
141
- });
142
- var distributedTracingMode = _config.distributedTracingMode;
143
- _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
144
- _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
145
- _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;
146
- _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;
147
- _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
148
- _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
149
- _addRequestContext = _config.addRequestContext;
150
- _isUsingAIHeaders = distributedTracingMode === DistributedTracingModes.AI || distributedTracingMode === DistributedTracingModes.AI_AND_W3C;
151
- _isUsingW3CHeaders = distributedTracingMode === DistributedTracingModes.AI_AND_W3C || distributedTracingMode === DistributedTracingModes.W3C;
152
- if (_enableAjaxPerfTracking) {
153
- var iKey = config.instrumentationKey || "unkwn";
154
- if (iKey.length > 5) {
155
- _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + ".";
156
- }
157
- else {
158
- _markPrefix = AJAX_MONITOR_PREFIX + iKey + ".";
159
- }
160
- }
161
- if (_config.disableAjaxTracking === false) {
162
- _instrumentXhr();
163
- }
139
+ _base.initialize(config, core, extensions, pluginChain);
140
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
141
+ _populateDefaults(config);
142
+ _instrumentXhr();
164
143
  _instrumentFetch();
165
- if (extensions.length > 0 && extensions) {
166
- var propExt = void 0, extIx = 0;
167
- while (!propExt && extIx < extensions.length) {
168
- if (extensions[extIx] && extensions[extIx].identifier === PropertiesPluginIdentifier) {
169
- propExt = extensions[extIx];
170
- }
171
- extIx++;
172
- }
173
- if (propExt) {
174
- _context = propExt.context; // we could move IPropertiesPlugin to common as well
175
- }
176
- }
144
+ _populateContext();
177
145
  }
178
146
  };
179
- _self.teardown = function () {
180
- // Remove all instrumentation hooks
181
- arrForEach(_hooks, function (fn) {
182
- fn.rm();
183
- });
184
- _hooks = [];
185
- _fetchInitialized = false;
186
- _xhrInitialized = false;
187
- _self.setInitialized(false);
147
+ _self._doTeardown = function () {
148
+ _initDefaults();
188
149
  };
189
150
  _self.trackDependencyData = function (dependency, properties) {
190
151
  _self[strTrackDependencyDataInternal](dependency, properties);
@@ -258,8 +219,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
258
219
  // Hack since expected format in w3c mode is |abc.def.
259
220
  // Non-w3c format is |abc.def
260
221
  // @todo Remove if better solution is available, e.g. handle in portal
261
- if ((_config.distributedTracingMode === DistributedTracingModes.W3C
262
- || _config.distributedTracingMode === DistributedTracingModes.AI_AND_W3C)
222
+ if ((_config.distributedTracingMode === 2 /* W3C */
223
+ || _config.distributedTracingMode === 1 /* AI_AND_W3C */)
263
224
  && typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
264
225
  dependency.id += ".";
265
226
  }
@@ -274,6 +235,65 @@ var AjaxMonitor = /** @class */ (function (_super) {
274
235
  }
275
236
  ++_trackAjaxAttempts;
276
237
  };
238
+ function _initDefaults() {
239
+ var location = getLocation();
240
+ _fetchInitialized = false; // fetch monitoring initialized
241
+ _xhrInitialized = false; // XHR monitoring initialized
242
+ _currentWindowHost = location && location.host && location.host.toLowerCase();
243
+ _config = AjaxMonitor.getEmptyConfig();
244
+ _enableRequestHeaderTracking = false;
245
+ _enableAjaxErrorStatusText = false;
246
+ _trackAjaxAttempts = 0;
247
+ _context = null;
248
+ _isUsingW3CHeaders = false;
249
+ _isUsingAIHeaders = false;
250
+ _markPrefix = null;
251
+ _enableAjaxPerfTracking = false;
252
+ _maxAjaxCallsPerView = 0;
253
+ _enableResponseHeaderTracking = false;
254
+ _disabledUrls = {};
255
+ _disableAjaxTracking = false;
256
+ _disableFetchTracking = true;
257
+ _excludeRequestFromAutoTrackingPatterns = null;
258
+ _addRequestContext = null;
259
+ _evtNamespace = null;
260
+ }
261
+ function _populateDefaults(config) {
262
+ var ctx = createProcessTelemetryContext(null, config, _self.core);
263
+ // Reset to the empty config
264
+ _config = AjaxMonitor.getEmptyConfig();
265
+ var defaultConfig = AjaxMonitor.getDefaultConfig();
266
+ objForEachKey(defaultConfig, function (field, value) {
267
+ _config[field] = ctx.getConfig(AjaxMonitor.identifier, field, value);
268
+ });
269
+ var distributedTracingMode = _config.distributedTracingMode;
270
+ _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
271
+ _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
272
+ _enableAjaxPerfTracking = _config.enableAjaxPerfTracking;
273
+ _maxAjaxCallsPerView = _config.maxAjaxCallsPerView;
274
+ _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
275
+ _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
276
+ _addRequestContext = _config.addRequestContext;
277
+ _isUsingAIHeaders = distributedTracingMode === 0 /* AI */ || distributedTracingMode === 1 /* AI_AND_W3C */;
278
+ _isUsingW3CHeaders = distributedTracingMode === 1 /* AI_AND_W3C */ || distributedTracingMode === 2 /* W3C */;
279
+ if (_enableAjaxPerfTracking) {
280
+ var iKey = config.instrumentationKey || "unkwn";
281
+ if (iKey.length > 5) {
282
+ _markPrefix = AJAX_MONITOR_PREFIX + iKey.substring(iKey.length - 5) + ".";
283
+ }
284
+ else {
285
+ _markPrefix = AJAX_MONITOR_PREFIX + iKey + ".";
286
+ }
287
+ }
288
+ _disableAjaxTracking = !!_config.disableAjaxTracking;
289
+ _disableFetchTracking = !!_config.disableFetchTracking;
290
+ }
291
+ function _populateContext() {
292
+ var propExt = _self.core.getPlugin(PropertiesPluginIdentifier);
293
+ if (propExt) {
294
+ _context = propExt.plugin.context; // we could move IPropertiesPlugin to common as well
295
+ }
296
+ }
277
297
  // discard the header if it's defined as ignoreHeaders in ICorrelationConfig
278
298
  function _canIncludeHeaders(header) {
279
299
  var rlt = true;
@@ -295,12 +315,13 @@ var AjaxMonitor = /** @class */ (function (_super) {
295
315
  }
296
316
  var global = getGlobal();
297
317
  var isPolyfill = fetch.polyfill;
298
- if (_config.disableFetchTracking === false) {
299
- _hooks.push(InstrumentFunc(global, strFetch, {
318
+ if (!_disableFetchTracking && !_fetchInitialized) {
319
+ _addHook(InstrumentFunc(global, strFetch, {
320
+ ns: _evtNamespace,
300
321
  // Add request hook
301
322
  req: function (callDetails, input, init) {
302
323
  var fetchData;
303
- if (_fetchInitialized &&
324
+ if (!_disableFetchTracking && _fetchInitialized &&
304
325
  !_isDisabledRequest(null, input, init) &&
305
326
  // If we have a polyfil and XHR instrumented then let XHR report otherwise we get duplicates
306
327
  !(isPolyfill && _xhrInitialized)) {
@@ -314,32 +335,34 @@ var AjaxMonitor = /** @class */ (function (_super) {
314
335
  }
315
336
  },
316
337
  rsp: function (callDetails, input) {
317
- var fetchData = callDetails.ctx().data;
318
- if (fetchData) {
319
- // Replace the result with the new promise from this code
320
- callDetails.rslt = callDetails.rslt.then(function (response) {
321
- _reportFetchMetrics(callDetails, (response || {}).status, input, response, fetchData, function () {
322
- var ajaxResponse = {
323
- statusText: response.statusText,
324
- headerMap: null,
325
- correlationContext: _getFetchCorrelationContext(response)
326
- };
327
- if (_enableResponseHeaderTracking) {
328
- var responseHeaderMap_1 = {};
329
- response.headers.forEach(function (value, name) {
330
- if (_canIncludeHeaders(name)) {
331
- responseHeaderMap_1[name] = value;
332
- }
333
- });
334
- ajaxResponse.headerMap = responseHeaderMap_1;
335
- }
336
- return ajaxResponse;
338
+ if (!_disableFetchTracking) {
339
+ var fetchData_1 = callDetails.ctx().data;
340
+ if (fetchData_1) {
341
+ // Replace the result with the new promise from this code
342
+ callDetails.rslt = callDetails.rslt.then(function (response) {
343
+ _reportFetchMetrics(callDetails, (response || {}).status, input, response, fetchData_1, function () {
344
+ var ajaxResponse = {
345
+ statusText: response.statusText,
346
+ headerMap: null,
347
+ correlationContext: _getFetchCorrelationContext(response)
348
+ };
349
+ if (_enableResponseHeaderTracking) {
350
+ var responseHeaderMap_1 = {};
351
+ response.headers.forEach(function (value, name) {
352
+ if (_canIncludeHeaders(name)) {
353
+ responseHeaderMap_1[name] = value;
354
+ }
355
+ });
356
+ ajaxResponse.headerMap = responseHeaderMap_1;
357
+ }
358
+ return ajaxResponse;
359
+ });
360
+ return response;
361
+ })["catch"](function (reason) {
362
+ _reportFetchMetrics(callDetails, 0, input, null, fetchData_1, null, { error: reason.message });
363
+ throw reason;
337
364
  });
338
- return response;
339
- })["catch"](function (reason) {
340
- _reportFetchMetrics(callDetails, 0, input, null, fetchData, null, { error: reason.message });
341
- throw reason;
342
- });
365
+ }
343
366
  }
344
367
  },
345
368
  // Create an error callback to report any hook errors
@@ -354,7 +377,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
354
377
  // Note: Polyfill implementations that don't support the "poyyfill" tag are not supported
355
378
  // the workaround is to add a polyfill property to your fetch implementation before initializing
356
379
  // App Insights
357
- _hooks.push(InstrumentFunc(global, strFetch, {
380
+ _addHook(InstrumentFunc(global, strFetch, {
381
+ ns: _evtNamespace,
358
382
  req: function (callDetails, input, init) {
359
383
  // Just call so that we record any disabled URL
360
384
  _isDisabledRequest(null, input, init);
@@ -368,64 +392,74 @@ var AjaxMonitor = /** @class */ (function (_super) {
368
392
  }
369
393
  }
370
394
  function _hookProto(target, funcName, callbacks) {
371
- _hooks.push(InstrumentProto(target, funcName, callbacks));
395
+ _addHook(InstrumentProto(target, funcName, callbacks));
372
396
  }
373
397
  function _instrumentXhr() {
374
- if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
398
+ if (_supportsAjaxMonitoring(_self) && !_disableAjaxTracking && !_xhrInitialized) {
375
399
  // Instrument open
376
400
  _hookProto(XMLHttpRequest, "open", {
401
+ ns: _evtNamespace,
377
402
  req: function (args, method, url, async) {
378
- var xhr = args.inst;
379
- var ajaxData = xhr[strAjaxData];
380
- if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true)) {
381
- if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) {
382
- // Only create a single ajaxData (even when multiple AI instances are running)
383
- _openHandler(xhr, method, url, async);
403
+ if (!_disableAjaxTracking) {
404
+ var xhr = args.inst;
405
+ var ajaxData = xhr[strAjaxData];
406
+ if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, true)) {
407
+ if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) {
408
+ // Only create a single ajaxData (even when multiple AI instances are running)
409
+ _openHandler(xhr, method, url, async);
410
+ }
411
+ // always attach to the on ready state change (required for handling multiple instances)
412
+ _attachToOnReadyStateChange(xhr);
384
413
  }
385
- // always attach to the on ready state change (required for handling multiple instances)
386
- _attachToOnReadyStateChange(xhr);
387
414
  }
388
415
  },
389
416
  hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen, "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")
390
417
  });
391
418
  // Instrument send
392
419
  _hookProto(XMLHttpRequest, "send", {
420
+ ns: _evtNamespace,
393
421
  req: function (args, context) {
394
- var xhr = args.inst;
395
- var ajaxData = xhr[strAjaxData];
396
- if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {
397
- _createMarkId("xhr", ajaxData);
398
- ajaxData.requestSentTime = dateTimeUtilsNow();
399
- _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);
400
- ajaxData.xhrMonitoringState.sendDone = true;
422
+ if (!_disableAjaxTracking) {
423
+ var xhr = args.inst;
424
+ var ajaxData = xhr[strAjaxData];
425
+ if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.sendDone) {
426
+ _createMarkId("xhr", ajaxData);
427
+ ajaxData.requestSentTime = dateTimeUtilsNow();
428
+ _self.includeCorrelationHeaders(ajaxData, undefined, undefined, xhr);
429
+ ajaxData.xhrMonitoringState.sendDone = true;
430
+ }
401
431
  }
402
432
  },
403
433
  hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSend, "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")
404
434
  });
405
435
  // Instrument abort
406
436
  _hookProto(XMLHttpRequest, "abort", {
437
+ ns: _evtNamespace,
407
438
  req: function (args) {
408
- var xhr = args.inst;
409
- var ajaxData = xhr[strAjaxData];
410
- if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {
411
- ajaxData.aborted = 1;
412
- ajaxData.xhrMonitoringState.abortDone = true;
439
+ if (!_disableAjaxTracking) {
440
+ var xhr = args.inst;
441
+ var ajaxData = xhr[strAjaxData];
442
+ if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState.abortDone) {
443
+ ajaxData.aborted = 1;
444
+ ajaxData.xhrMonitoringState.abortDone = true;
445
+ }
413
446
  }
414
447
  },
415
448
  hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxAbort, "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")
416
449
  });
417
450
  // Instrument setRequestHeader
418
- if (_enableRequestHeaderTracking) {
419
- _hookProto(XMLHttpRequest, "setRequestHeader", {
420
- req: function (args, header, value) {
451
+ _hookProto(XMLHttpRequest, "setRequestHeader", {
452
+ ns: _evtNamespace,
453
+ req: function (args, header, value) {
454
+ if (!_disableAjaxTracking && _enableRequestHeaderTracking) {
421
455
  var xhr = args.inst;
422
456
  if (_isMonitoredXhrInstance(xhr) && _canIncludeHeaders(header)) {
423
457
  xhr[strAjaxData].requestHeaders[header] = value;
424
458
  }
425
- },
426
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
427
- });
428
- }
459
+ }
460
+ },
461
+ hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader, "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
462
+ });
429
463
  _xhrInitialized = true;
430
464
  }
431
465
  }
@@ -510,7 +544,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
510
544
  xhr[strAjaxData] = ajaxData;
511
545
  }
512
546
  function _attachToOnReadyStateChange(xhr) {
513
- xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = attachEvent(xhr, "readystatechange", function () {
547
+ xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
514
548
  try {
515
549
  if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
516
550
  _onAjaxComplete(xhr);
@@ -526,7 +560,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
526
560
  });
527
561
  }
528
562
  }
529
- });
563
+ }, _evtNamespace);
530
564
  }
531
565
  function _getResponseText(xhr) {
532
566
  try {
@@ -824,7 +858,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
824
858
  disableFetchTracking: true,
825
859
  excludeRequestFromAutoTrackingPatterns: undefined,
826
860
  disableCorrelationHeaders: false,
827
- distributedTracingMode: DistributedTracingModes.AI_AND_W3C,
861
+ distributedTracingMode: 1 /* AI_AND_W3C */,
828
862
  correlationHeaderExcludedDomains: [
829
863
  "*.blob.core.windows.net",
830
864
  "*.blob.core.chinacloudapi.cn",
@@ -858,7 +892,6 @@ var AjaxMonitor = /** @class */ (function (_super) {
858
892
  return emptyConfig;
859
893
  };
860
894
  // Removed Stub for AjaxMonitor.prototype.initialize.
861
- // Removed Stub for AjaxMonitor.prototype.teardown.
862
895
  AjaxMonitor.prototype.processTelemetry = function (item, itemCtx) {
863
896
  this.processNext(item, itemCtx);
864
897
  };