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

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.
package/src/ajax.ts CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  IConfig, ITelemetryContext, PropertiesPluginIdentifier, eDistributedTracingModes, IRequestContext, isInternalApplicationInsightsEndpoint
8
8
  } from "@microsoft/applicationinsights-common";
9
9
  import {
10
- isNullOrUndefined, arrForEach, isString, strTrim, isFunction, LoggingSeverity, _InternalMessageId,
10
+ isNullOrUndefined, arrForEach, isString, strTrim, isFunction, eLoggingSeverity, _eInternalMessageId,
11
11
  IAppInsightsCore, BaseTelemetryPlugin, ITelemetryPluginChain, IConfiguration, IPlugin, ITelemetryItem, IProcessTelemetryContext,
12
12
  getLocation, getGlobal, strPrototype, IInstrumentCallDetails, InstrumentFunc, InstrumentProto, getPerformance,
13
13
  IInstrumentHooksCallbacks, objForEachKey, generateW3CId, getIEVersion, dumpObj, ICustomProperties, isXhrSupported, eventOn,
@@ -74,7 +74,7 @@ function _supportsAjaxMonitoring(ajaxMonitorInstance:AjaxMonitor): boolean {
74
74
  // We can't decorate the xhr object so disable monitoring
75
75
  result = false;
76
76
  _throwInternalCritical(ajaxMonitorInstance,
77
- _InternalMessageId.FailedMonitorAjaxOpen,
77
+ _eInternalMessageId.FailedMonitorAjaxOpen,
78
78
  "Failed to enable XMLHttpRequest monitoring, extension is not supported",
79
79
  {
80
80
  exception: dumpObj(e)
@@ -102,17 +102,17 @@ function _getFailedAjaxDiagnosticsMessage(xhr: XMLHttpRequestInstrumented): stri
102
102
  }
103
103
 
104
104
  /** @ignore */
105
- function _throwInternalCritical(ajaxMonitorInstance:AjaxMonitor, msgId: _InternalMessageId, message: string, properties?: Object, isUserAct?: boolean): void {
106
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
105
+ function _throwInternalCritical(ajaxMonitorInstance:AjaxMonitor, msgId: _eInternalMessageId, message: string, properties?: Object, isUserAct?: boolean): void {
106
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](eLoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
107
107
  }
108
108
 
109
109
  /** @ignore */
110
- function _throwInternalWarning(ajaxMonitorInstance:AjaxMonitor, msgId: _InternalMessageId, message: string, properties?: Object, isUserAct?: boolean): void {
111
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);
110
+ function _throwInternalWarning(ajaxMonitorInstance:AjaxMonitor, msgId: _eInternalMessageId, message: string, properties?: Object, isUserAct?: boolean): void {
111
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](eLoggingSeverity.WARNING, msgId, message, properties, isUserAct);
112
112
  }
113
113
 
114
114
  /** @Ignore */
115
- function _createErrorCallbackFunc(ajaxMonitorInstance:AjaxMonitor, internalMessage:_InternalMessageId, message:string) {
115
+ function _createErrorCallbackFunc(ajaxMonitorInstance:AjaxMonitor, internalMessage: _eInternalMessageId, message:string) {
116
116
  // tslint:disable-next-line
117
117
  return function (args:IInstrumentCallDetails) {
118
118
  _throwInternalCritical(ajaxMonitorInstance,
@@ -340,7 +340,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
340
340
  _self.core.track(item);
341
341
  } else if (_trackAjaxAttempts === _maxAjaxCallsPerView) {
342
342
  _throwInternalCritical(_self,
343
- _InternalMessageId.MaxAjaxPerPVExceeded,
343
+ _eInternalMessageId.MaxAjaxPerPVExceeded,
344
344
  "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",
345
345
  true);
346
346
  }
@@ -494,7 +494,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
494
494
  }
495
495
  },
496
496
  // Create an error callback to report any hook errors
497
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen,
497
+ hkErr: _createErrorCallbackFunc(_self, _eInternalMessageId.FailedMonitorAjaxOpen,
498
498
  "Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.")
499
499
  }));
500
500
 
@@ -546,7 +546,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
546
546
  }
547
547
  }
548
548
  },
549
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxOpen,
549
+ hkErr: _createErrorCallbackFunc(_self, _eInternalMessageId.FailedMonitorAjaxOpen,
550
550
  "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")
551
551
  });
552
552
 
@@ -565,7 +565,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
565
565
  }
566
566
  }
567
567
  },
568
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSend,
568
+ hkErr: _createErrorCallbackFunc(_self, _eInternalMessageId.FailedMonitorAjaxSend,
569
569
  "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")
570
570
  });
571
571
 
@@ -582,7 +582,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
582
582
  }
583
583
  }
584
584
  },
585
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxAbort,
585
+ hkErr: _createErrorCallbackFunc(_self, _eInternalMessageId.FailedMonitorAjaxAbort,
586
586
  "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")
587
587
  });
588
588
 
@@ -597,7 +597,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
597
597
  }
598
598
  }
599
599
  },
600
- hkErr: _createErrorCallbackFunc(_self, _InternalMessageId.FailedMonitorAjaxSetRequestHeader,
600
+ hkErr: _createErrorCallbackFunc(_self, _eInternalMessageId.FailedMonitorAjaxSetRequestHeader,
601
601
  "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
602
602
  });
603
603
 
@@ -708,7 +708,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
708
708
  // ignore messages with c00c023f, as this a known IE9 XHR abort issue
709
709
  if (!exceptionText || _indexOf(exceptionText.toLowerCase(), "c00c023f") === -1) {
710
710
  _throwInternalCritical(_self,
711
- _InternalMessageId.FailedMonitorAjaxRSC,
711
+ _eInternalMessageId.FailedMonitorAjaxRSC,
712
712
  "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.",
713
713
  {
714
714
  ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
@@ -746,7 +746,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
746
746
  }
747
747
 
748
748
  _throwInternalWarning(_self,
749
- _InternalMessageId.FailedMonitorAjaxDur,
749
+ _eInternalMessageId.FailedMonitorAjaxDur,
750
750
  "Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.",
751
751
  errorProps
752
752
  );
@@ -794,7 +794,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
794
794
  }
795
795
  } catch (e) {
796
796
  _throwInternalWarning(_self,
797
- _InternalMessageId.FailedAddingCustomDefinedRequestContext,
797
+ _eInternalMessageId.FailedAddingCustomDefinedRequestContext,
798
798
  "Failed to add custom defined request context as configured call back may missing a null check.")
799
799
  }
800
800
 
@@ -834,7 +834,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
834
834
  }
835
835
  } catch (e) {
836
836
  _throwInternalWarning(_self,
837
- _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader,
837
+ _eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader,
838
838
  "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",
839
839
  {
840
840
  ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
@@ -972,7 +972,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
972
972
  }
973
973
  } catch (e) {
974
974
  _throwInternalCritical(_self,
975
- _InternalMessageId.FailedMonitorAjaxOpen,
975
+ _eInternalMessageId.FailedMonitorAjaxOpen,
976
976
  "Failed to grab failed fetch diagnostics message",
977
977
  { exception: dumpObj(e) }
978
978
  );
@@ -985,7 +985,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
985
985
  return;
986
986
  }
987
987
 
988
- function _reportFetchError(msgId: _InternalMessageId, e: any, failedProps?:Object) {
988
+ function _reportFetchError(msgId: _eInternalMessageId, e: any, failedProps?:Object) {
989
989
  let errorProps = failedProps||{};
990
990
  errorProps["fetchDiagnosticsMessage"] = _getFailedFetchDiagnosticsMessage(input);
991
991
  if (e) {
@@ -1011,7 +1011,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
1011
1011
  }
1012
1012
  } catch (e) {
1013
1013
  _throwInternalWarning(_self,
1014
- _InternalMessageId.FailedAddingCustomDefinedRequestContext,
1014
+ _eInternalMessageId.FailedAddingCustomDefinedRequestContext,
1015
1015
  "Failed to add custom defined request context as configured call back may missing a null check.")
1016
1016
  }
1017
1017
 
@@ -1021,14 +1021,14 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
1021
1021
  }
1022
1022
  _self[strTrackDependencyDataInternal](dependency);
1023
1023
  } else {
1024
- _reportFetchError(_InternalMessageId.FailedMonitorAjaxDur, null,
1024
+ _reportFetchError(_eInternalMessageId.FailedMonitorAjaxDur, null,
1025
1025
  {
1026
1026
  requestSentTime: ajaxData.requestSentTime,
1027
1027
  responseFinishedTime: ajaxData.responseFinishedTime
1028
1028
  });
1029
1029
  }
1030
1030
  }, (e) => {
1031
- _reportFetchError(_InternalMessageId.FailedMonitorAjaxGetCorrelationHeader, e, null);
1031
+ _reportFetchError(_eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader, e, null);
1032
1032
  });
1033
1033
  }
1034
1034
 
@@ -1039,7 +1039,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
1039
1039
  return CorrelationIdHelper.getCorrelationContext(responseHeader);
1040
1040
  } catch (e) {
1041
1041
  _throwInternalWarning(_self,
1042
- _InternalMessageId.FailedMonitorAjaxGetCorrelationHeader,
1042
+ _eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader,
1043
1043
  "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",
1044
1044
  {
1045
1045
  fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response),