@microsoft/applicationinsights-channel-js 2.8.18-nightly.2402-07 → 2.8.18

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/applicationinsights-channel-js.integrity.json +9 -9
  2. package/browser/applicationinsights-channel-js.js +12 -6
  3. package/browser/applicationinsights-channel-js.js.map +1 -1
  4. package/browser/applicationinsights-channel-js.min.js +2 -2
  5. package/browser/applicationinsights-channel-js.min.js.map +1 -1
  6. package/dist/applicationinsights-channel-js.api.json +1 -1
  7. package/dist/applicationinsights-channel-js.d.ts +5 -1
  8. package/dist/applicationinsights-channel-js.js +12 -6
  9. package/dist/applicationinsights-channel-js.js.map +1 -1
  10. package/dist/applicationinsights-channel-js.min.js +2 -2
  11. package/dist/applicationinsights-channel-js.min.js.map +1 -1
  12. package/dist/applicationinsights-channel-js.rollup.d.ts +5 -1
  13. package/dist-esm/EnvelopeCreator.js +2 -2
  14. package/dist-esm/EnvelopeCreator.js.map +1 -1
  15. package/dist-esm/Interfaces.js +1 -1
  16. package/dist-esm/InternalConstants.js +1 -1
  17. package/dist-esm/Offline.js +1 -1
  18. package/dist-esm/SendBuffer.js +3 -3
  19. package/dist-esm/SendBuffer.js.map +1 -1
  20. package/dist-esm/Sender.js +13 -5
  21. package/dist-esm/Sender.js.map +1 -1
  22. package/dist-esm/Serializer.js +1 -1
  23. package/dist-esm/TelemetryProcessors/Sample.js +1 -1
  24. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  25. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  26. package/dist-esm/__DynamicConstants.js +3 -2
  27. package/dist-esm/__DynamicConstants.js.map +1 -1
  28. package/dist-esm/applicationinsights-channel-js.js +1 -1
  29. package/package.json +61 -61
  30. package/src/Interfaces.ts +5 -0
  31. package/src/Sender.ts +15 -5
  32. package/src/__DynamicConstants.ts +2 -1
  33. package/types/Interfaces.d.ts +4 -0
  34. package/types/__DynamicConstants.d.ts +1 -0
  35. package/types/tsdoc-metadata.json +1 -1
package/src/Sender.ts CHANGED
@@ -7,9 +7,9 @@ import {
7
7
  import {
8
8
  BaseTelemetryPlugin, IAppInsightsCore, IConfiguration, IDiagnosticLogger, INotificationManager, IPlugin, IProcessTelemetryContext,
9
9
  IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPluginChain, ITelemetryUnloadState, SendRequestReason, _eInternalMessageId,
10
- _throwInternal, _warnToConsole, arrForEach, createUniqueNamespace, dateNow, dumpObj, eLoggingSeverity, getExceptionName, getIEVersion,
11
- getJSON, getNavigator, getWindow, isArray, isBeaconsSupported, isFetchSupported, isNullOrUndefined, isXhrSupported, mergeEvtNamespace,
12
- objForEachKey, objKeys, useXDomainRequest
10
+ _throwInternal, _warnToConsole, arrForEach, arrIndexOf, createUniqueNamespace, dateNow, dumpObj, eLoggingSeverity, getExceptionName,
11
+ getIEVersion, getJSON, getNavigator, getWindow, isArray, isBeaconsSupported, isFetchSupported, isNullOrUndefined, isXhrSupported,
12
+ mergeEvtNamespace, objForEachKey, objKeys, useXDomainRequest
13
13
  } from "@microsoft/applicationinsights-core-js";
14
14
  import {
15
15
  DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator,
@@ -63,7 +63,8 @@ function _getDefaultAppInsightsChannelConfig(): ISenderConfig {
63
63
  samplingPercentage: () => 100,
64
64
  customHeaders: () => defaultCustomHeaders,
65
65
  convertUndefined: () => defaultValue,
66
- eventsLimitInMem: () => 10000
66
+ eventsLimitInMem: () => 10000,
67
+ retryCodes: () => null
67
68
  }
68
69
  }
69
70
 
@@ -140,6 +141,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
140
141
  let _syncUnloadSender: SenderFunction; // The identified sender to use for the synchronous unload stage
141
142
  let _offlineListener: IOfflineListener;
142
143
  let _evtNamespace: string | string[];
144
+ let _retryCodes: number[];
143
145
 
144
146
  dynamicProto(Sender, this, (_self, _base) => {
145
147
 
@@ -232,6 +234,8 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
232
234
  }
233
235
  });
234
236
 
237
+ _retryCodes = _self._senderConfig.retryCodes();
238
+
235
239
  if (config.storagePrefix){
236
240
  utlSetStoragePrefix(config.storagePrefix);
237
241
  }
@@ -946,8 +950,14 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
946
950
  * @param statusCode
947
951
  */
948
952
  function _isRetriable(statusCode: number): boolean {
953
+ // retryCodes = [] means should not retry
954
+ if (!isNullOrUndefined(_retryCodes)) {
955
+ return _retryCodes.length && arrIndexOf(_retryCodes, statusCode) > -1;
956
+ }
957
+
949
958
  return statusCode === 401 // Unauthorized
950
- || statusCode === 403 // Forbidden
959
+ // Removing as private links can return a 403 which causes excessive retries and session storage usage
960
+ //|| statusCode === 403 // Forbidden
951
961
  || statusCode === 408 // Timeout
952
962
  || statusCode === 429 // Too many requests.
953
963
  || statusCode === 500 // Internal server error.
@@ -15,7 +15,7 @@ export const _DYN_DEVICE_TYPE = "deviceType"; // Count: 3
15
15
  export const _DYN_DATA = "data"; // Count: 13
16
16
  export const _DYN_NAME = "name"; // Count: 8
17
17
  export const _DYN_TRACE_ID = "traceID"; // Count: 5
18
- export const _DYN_LENGTH = "length"; // Count: 36
18
+ export const _DYN_LENGTH = "length"; // Count: 37
19
19
  export const _DYN_STRINGIFY = "stringify"; // Count: 5
20
20
  export const _DYN_MEASUREMENTS = "measurements"; // Count: 7
21
21
  export const _DYN_DATA_TYPE = "dataType"; // Count: 10
@@ -25,6 +25,7 @@ export const _DYN_ON_LINE = "onLine"; // Count: 4
25
25
  export const _DYN_IS_ONLINE = "isOnline"; // Count: 3
26
26
  export const _DYN_ENQUEUE = "enqueue"; // Count: 5
27
27
  export const _DYN_COUNT = "count"; // Count: 6
28
+ export const _DYN_EVENTS_LIMIT_IN_MEM = "eventsLimitInMem"; // Count: 2
28
29
  export const _DYN_PUSH = "push"; // Count: 6
29
30
  export const _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson"; // Count: 3
30
31
  export const _DYN_CLEAR = "clear"; // Count: 6
@@ -70,6 +70,10 @@ export interface ISenderConfig {
70
70
  * (Optional) The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
71
71
  */
72
72
  eventsLimitInMem: () => number;
73
+ /**
74
+ * (Optional) The specific error codes that will cause a retry of sending data to the backend.
75
+ */
76
+ retryCodes: () => number[];
73
77
  }
74
78
  export interface IBackendResponse {
75
79
  /**
@@ -13,6 +13,7 @@ export declare const _DYN_ON_LINE = "onLine";
13
13
  export declare const _DYN_IS_ONLINE = "isOnline";
14
14
  export declare const _DYN_ENQUEUE = "enqueue";
15
15
  export declare const _DYN_COUNT = "count";
16
+ export declare const _DYN_EVENTS_LIMIT_IN_MEM = "eventsLimitInMem";
16
17
  export declare const _DYN_PUSH = "push";
17
18
  export declare const _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson";
18
19
  export declare const _DYN_CLEAR = "clear";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.40.0"
8
+ "packageVersion": "7.42.3"
9
9
  }
10
10
  ]
11
11
  }