@microsoft/applicationinsights-channel-js 2.8.5-nightly.2206-02 → 2.8.5-nightly.2206-06

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 (51) hide show
  1. package/browser/applicationinsights-channel-js.integrity.json +9 -9
  2. package/browser/applicationinsights-channel-js.js +1468 -1286
  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 +55 -23
  7. package/dist/applicationinsights-channel-js.d.ts +1 -1
  8. package/dist/applicationinsights-channel-js.js +1468 -1286
  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 +1 -1
  13. package/dist-esm/EnvelopeCreator.js +64 -63
  14. package/dist-esm/EnvelopeCreator.js.map +1 -1
  15. package/dist-esm/Interfaces.js +1 -1
  16. package/dist-esm/InternalConstants.js +13 -0
  17. package/dist-esm/InternalConstants.js.map +1 -0
  18. package/dist-esm/Offline.js +7 -6
  19. package/dist-esm/Offline.js.map +1 -1
  20. package/dist-esm/SendBuffer.js +61 -50
  21. package/dist-esm/SendBuffer.js.map +1 -1
  22. package/dist-esm/Sender.js +178 -172
  23. package/dist-esm/Sender.js.map +1 -1
  24. package/dist-esm/Serializer.js +16 -10
  25. package/dist-esm/Serializer.js.map +1 -1
  26. package/dist-esm/TelemetryProcessors/Sample.js +6 -5
  27. package/dist-esm/TelemetryProcessors/Sample.js.map +1 -1
  28. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +4 -3
  29. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js.map +1 -1
  30. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +11 -10
  31. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js.map +1 -1
  32. package/dist-esm/__DynamicConstants.js +70 -0
  33. package/dist-esm/__DynamicConstants.js.map +1 -0
  34. package/dist-esm/applicationinsights-channel-js.js +1 -1
  35. package/package.json +7 -4
  36. package/src/EnvelopeCreator.ts +19 -24
  37. package/src/InternalConstants.ts +11 -0
  38. package/src/Offline.ts +5 -3
  39. package/src/SendBuffer.ts +9 -6
  40. package/src/Sender.ts +46 -46
  41. package/src/Serializer.ts +7 -7
  42. package/src/TelemetryProcessors/Sample.ts +10 -10
  43. package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +4 -4
  44. package/src/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.ts +8 -8
  45. package/src/__DynamicConstants.ts +68 -0
  46. package/types/EnvelopeCreator.d.ts +1 -1
  47. package/types/InternalConstants.d.ts +1 -0
  48. package/types/Sender.d.ts +3 -3
  49. package/types/Serializer.d.ts +1 -1
  50. package/types/__DynamicConstants.d.ts +56 -0
  51. package/types/tsdoc-metadata.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SamplingScoreGenerator.js.map","sources":["SamplingScoreGenerator.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { HashCodeScoreGenerator } from \"./HashCodeScoreGenerator\";\r\nimport { ContextTagKeys } from \"@microsoft/applicationinsights-common\";\r\nvar SamplingScoreGenerator = /** @class */ (function () {\r\n function SamplingScoreGenerator() {\r\n var _self = this;\r\n var hashCodeGenerator = new HashCodeScoreGenerator();\r\n var keys = new ContextTagKeys();\r\n _self.getSamplingScore = function (item) {\r\n var score = 0;\r\n if (item.tags && item.tags[keys.userId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item.tags[keys.userId]);\r\n }\r\n else if (item.ext && item.ext.user && item.ext.user.id) {\r\n score = hashCodeGenerator.getHashCodeScore(item.ext.user.id);\r\n }\r\n else if (item.tags && item.tags[keys.operationId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item.tags[keys.operationId]);\r\n }\r\n else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace.traceID) {\r\n score = hashCodeGenerator.getHashCodeScore(item.ext.telemetryTrace.traceID);\r\n }\r\n else {\r\n // tslint:disable-next-line:insecure-random\r\n score = (Math.random() * 100);\r\n }\r\n return score;\r\n };\r\n }\r\n return SamplingScoreGenerator;\r\n}());\r\nexport { SamplingScoreGenerator };\r\n//# sourceMappingURL=SamplingScoreGenerator.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"SamplingScoreGenerator.js.map","sources":["SamplingScoreGenerator.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ContextTagKeys } from \"@microsoft/applicationinsights-common\";\r\nimport { _DYN_GET_HASH_CODE_SCORE, _DYN_GET_SAMPLING_SCORE, _DYN_TAGS, _DYN_TRACE_ID } from \"../../__DynamicConstants\";\r\nimport { HashCodeScoreGenerator } from \"./HashCodeScoreGenerator\";\r\nvar SamplingScoreGenerator = /** @class */ (function () {\r\n function SamplingScoreGenerator() {\r\n var _self = this;\r\n var hashCodeGenerator = new HashCodeScoreGenerator();\r\n var keys = new ContextTagKeys();\r\n _self[_DYN_GET_SAMPLING_SCORE /* @min:%2egetSamplingScore */] = function (item) {\r\n var score = 0;\r\n if (item[_DYN_TAGS /* @min:%2etags */] && item[_DYN_TAGS /* @min:%2etags */][keys.userId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item[_DYN_TAGS /* @min:%2etags */][keys.userId]);\r\n }\r\n else if (item.ext && item.ext.user && item.ext.user.id) {\r\n score = hashCodeGenerator[_DYN_GET_HASH_CODE_SCORE /* @min:%2egetHashCodeScore */](item.ext.user.id);\r\n }\r\n else if (item[_DYN_TAGS /* @min:%2etags */] && item[_DYN_TAGS /* @min:%2etags */][keys.operationId]) { // search in tags first, then ext\r\n score = hashCodeGenerator.getHashCodeScore(item[_DYN_TAGS /* @min:%2etags */][keys.operationId]);\r\n }\r\n else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace[_DYN_TRACE_ID /* @min:%2etraceID */]) {\r\n score = hashCodeGenerator.getHashCodeScore(item.ext.telemetryTrace[_DYN_TRACE_ID /* @min:%2etraceID */]);\r\n }\r\n else {\r\n // tslint:disable-next-line:insecure-random\r\n score = (Math.random() * 100);\r\n }\r\n return score;\r\n };\r\n }\r\n return SamplingScoreGenerator;\r\n}());\r\nexport { SamplingScoreGenerator };\r\n//# sourceMappingURL=SamplingScoreGenerator.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Application Insights JavaScript SDK - Channel, 2.8.5-nightly.2206-06
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+
6
+
7
+ // @skip-file-minify
8
+ // ##############################################################
9
+ // AUTO GENERATED FILE: This file is Auto Generated during build.
10
+ // ##############################################################
11
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
+ // Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
13
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
+ export var _DYN_TAGS = "tags"; // Count: 17
15
+ export var _DYN_DEVICE_TYPE = "deviceType"; // Count: 3
16
+ export var _DYN_DATA = "data"; // Count: 13
17
+ export var _DYN_NAME = "name"; // Count: 8
18
+ export var _DYN_TRACE_ID = "traceID"; // Count: 5
19
+ export var _DYN_LENGTH = "length"; // Count: 36
20
+ export var _DYN_STRINGIFY = "stringify"; // Count: 5
21
+ export var _DYN_MEASUREMENTS = "measurements"; // Count: 7
22
+ export var _DYN_DATA_TYPE = "dataType"; // Count: 10
23
+ export var _DYN_ENVELOPE_TYPE = "envelopeType"; // Count: 7
24
+ export var _DYN_TO_STRING = "toString"; // Count: 7
25
+ export var _DYN_ON_LINE = "onLine"; // Count: 4
26
+ export var _DYN_ENQUEUE = "enqueue"; // Count: 5
27
+ export var _DYN_COUNT = "count"; // Count: 6
28
+ export var _DYN_PUSH = "push"; // Count: 6
29
+ export var _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson"; // Count: 3
30
+ export var _DYN_CLEAR = "clear"; // Count: 6
31
+ export var _DYN_BATCH_PAYLOADS = "batchPayloads"; // Count: 5
32
+ export var _DYN_MARK_AS_SENT = "markAsSent"; // Count: 6
33
+ export var _DYN_CLEAR_SENT = "clearSent"; // Count: 5
34
+ export var _DYN__BUFFER__KEY = "BUFFER_KEY"; // Count: 5
35
+ export var _DYN__SENT__BUFFER__KEY = "SENT_BUFFER_KEY"; // Count: 7
36
+ export var _DYN__MAX__BUFFER__SIZE = "MAX_BUFFER_SIZE"; // Count: 5
37
+ export var _DYN_NAME_PREFIX = "namePrefix"; // Count: 6
38
+ export var _DYN_MAX_BATCH_SIZE_IN_BY1 = "maxBatchSizeInBytes"; // Count: 3
39
+ export var _DYN_TRIGGER_SEND = "triggerSend"; // Count: 6
40
+ export var _DYN_DIAG_LOG = "diagLog"; // Count: 15
41
+ export var _DYN_ONUNLOAD_DISABLE_BEA2 = "onunloadDisableBeacon"; // Count: 2
42
+ export var _DYN_IS_BEACON_API_DISABL3 = "isBeaconApiDisabled"; // Count: 3
43
+ export var _DYN__SENDER = "_sender"; // Count: 5
44
+ export var _DYN__SENDER_CONFIG = "_senderConfig"; // Count: 4
45
+ export var _DYN__BUFFER = "_buffer"; // Count: 7
46
+ export var _DYN_ENABLE_SESSION_STORA4 = "enableSessionStorageBuffer"; // Count: 2
47
+ export var _DYN_SAMPLING_PERCENTAGE = "samplingPercentage"; // Count: 2
48
+ export var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; // Count: 4
49
+ export var _DYN_ENDPOINT_URL = "endpointUrl"; // Count: 8
50
+ export var _DYN_CUSTOM_HEADERS = "customHeaders"; // Count: 4
51
+ export var _DYN_DISABLE_XHR = "disableXhr"; // Count: 5
52
+ export var _DYN_ONUNLOAD_DISABLE_FET5 = "onunloadDisableFetch"; // Count: 2
53
+ export var _DYN_DISABLE_TELEMETRY = "disableTelemetry"; // Count: 2
54
+ export var _DYN_BASE_TYPE = "baseType"; // Count: 4
55
+ export var _DYN_SAMPLE_RATE = "sampleRate"; // Count: 4
56
+ export var _DYN_CONVERT_UNDEFINED = "convertUndefined"; // Count: 2
57
+ export var _DYN__XHR_READY_STATE_CHA6 = "_xhrReadyStateChange"; // Count: 2
58
+ export var _DYN__ON_ERROR = "_onError"; // Count: 11
59
+ export var _DYN__ON_PARTIAL_SUCCESS = "_onPartialSuccess"; // Count: 3
60
+ export var _DYN__ON_SUCCESS = "_onSuccess"; // Count: 6
61
+ export var _DYN_ITEMS_ACCEPTED = "itemsAccepted"; // Count: 5
62
+ export var _DYN_ITEMS_RECEIVED = "itemsReceived"; // Count: 6
63
+ export var _DYN_IS_RETRY_DISABLED = "isRetryDisabled"; // Count: 5
64
+ export var _DYN_SET_REQUEST_HEADER = "setRequestHeader"; // Count: 3
65
+ export var _DYN_MAX_BATCH_INTERVAL = "maxBatchInterval"; // Count: 2
66
+ export var _DYN_EVENTS_SEND_REQUEST = "eventsSendRequest"; // Count: 2
67
+ export var _DYN_DISABLE_INSTRUMENTAT7 = "disableInstrumentationKeyValidation"; // Count: 2
68
+ export var _DYN_GET_SAMPLING_SCORE = "getSamplingScore"; // Count: 2
69
+ export var _DYN_GET_HASH_CODE_SCORE = "getHashCodeScore"; // Count: 4
70
+ //# sourceMappingURL=__DynamicConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_TAGS = \"tags\"; // Count: 17\r\nexport var _DYN_DEVICE_TYPE = \"deviceType\"; // Count: 3\r\nexport var _DYN_DATA = \"data\"; // Count: 13\r\nexport var _DYN_NAME = \"name\"; // Count: 8\r\nexport var _DYN_TRACE_ID = \"traceID\"; // Count: 5\r\nexport var _DYN_LENGTH = \"length\"; // Count: 36\r\nexport var _DYN_STRINGIFY = \"stringify\"; // Count: 5\r\nexport var _DYN_MEASUREMENTS = \"measurements\"; // Count: 7\r\nexport var _DYN_DATA_TYPE = \"dataType\"; // Count: 10\r\nexport var _DYN_ENVELOPE_TYPE = \"envelopeType\"; // Count: 7\r\nexport var _DYN_TO_STRING = \"toString\"; // Count: 7\r\nexport var _DYN_ON_LINE = \"onLine\"; // Count: 4\r\nexport var _DYN_ENQUEUE = \"enqueue\"; // Count: 5\r\nexport var _DYN_COUNT = \"count\"; // Count: 6\r\nexport var _DYN_PUSH = \"push\"; // Count: 6\r\nexport var _DYN_EMIT_LINE_DELIMITED_0 = \"emitLineDelimitedJson\"; // Count: 3\r\nexport var _DYN_CLEAR = \"clear\"; // Count: 6\r\nexport var _DYN_BATCH_PAYLOADS = \"batchPayloads\"; // Count: 5\r\nexport var _DYN_MARK_AS_SENT = \"markAsSent\"; // Count: 6\r\nexport var _DYN_CLEAR_SENT = \"clearSent\"; // Count: 5\r\nexport var _DYN__BUFFER__KEY = \"BUFFER_KEY\"; // Count: 5\r\nexport var _DYN__SENT__BUFFER__KEY = \"SENT_BUFFER_KEY\"; // Count: 7\r\nexport var _DYN__MAX__BUFFER__SIZE = \"MAX_BUFFER_SIZE\"; // Count: 5\r\nexport var _DYN_NAME_PREFIX = \"namePrefix\"; // Count: 6\r\nexport var _DYN_MAX_BATCH_SIZE_IN_BY1 = \"maxBatchSizeInBytes\"; // Count: 3\r\nexport var _DYN_TRIGGER_SEND = \"triggerSend\"; // Count: 6\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 15\r\nexport var _DYN_ONUNLOAD_DISABLE_BEA2 = \"onunloadDisableBeacon\"; // Count: 2\r\nexport var _DYN_IS_BEACON_API_DISABL3 = \"isBeaconApiDisabled\"; // Count: 3\r\nexport var _DYN__SENDER = \"_sender\"; // Count: 5\r\nexport var _DYN__SENDER_CONFIG = \"_senderConfig\"; // Count: 4\r\nexport var _DYN__BUFFER = \"_buffer\"; // Count: 7\r\nexport var _DYN_ENABLE_SESSION_STORA4 = \"enableSessionStorageBuffer\"; // Count: 2\r\nexport var _DYN_SAMPLING_PERCENTAGE = \"samplingPercentage\"; // Count: 2\r\nexport var _DYN_INSTRUMENTATION_KEY = \"instrumentationKey\"; // Count: 4\r\nexport var _DYN_ENDPOINT_URL = \"endpointUrl\"; // Count: 8\r\nexport var _DYN_CUSTOM_HEADERS = \"customHeaders\"; // Count: 4\r\nexport var _DYN_DISABLE_XHR = \"disableXhr\"; // Count: 5\r\nexport var _DYN_ONUNLOAD_DISABLE_FET5 = \"onunloadDisableFetch\"; // Count: 2\r\nexport var _DYN_DISABLE_TELEMETRY = \"disableTelemetry\"; // Count: 2\r\nexport var _DYN_BASE_TYPE = \"baseType\"; // Count: 4\r\nexport var _DYN_SAMPLE_RATE = \"sampleRate\"; // Count: 4\r\nexport var _DYN_CONVERT_UNDEFINED = \"convertUndefined\"; // Count: 2\r\nexport var _DYN__XHR_READY_STATE_CHA6 = \"_xhrReadyStateChange\"; // Count: 2\r\nexport var _DYN__ON_ERROR = \"_onError\"; // Count: 11\r\nexport var _DYN__ON_PARTIAL_SUCCESS = \"_onPartialSuccess\"; // Count: 3\r\nexport var _DYN__ON_SUCCESS = \"_onSuccess\"; // Count: 6\r\nexport var _DYN_ITEMS_ACCEPTED = \"itemsAccepted\"; // Count: 5\r\nexport var _DYN_ITEMS_RECEIVED = \"itemsReceived\"; // Count: 6\r\nexport var _DYN_IS_RETRY_DISABLED = \"isRetryDisabled\"; // Count: 5\r\nexport var _DYN_SET_REQUEST_HEADER = \"setRequestHeader\"; // Count: 3\r\nexport var _DYN_MAX_BATCH_INTERVAL = \"maxBatchInterval\"; // Count: 2\r\nexport var _DYN_EVENTS_SEND_REQUEST = \"eventsSendRequest\"; // Count: 2\r\nexport var _DYN_DISABLE_INSTRUMENTAT7 = \"disableInstrumentationKeyValidation\"; // Count: 2\r\nexport var _DYN_GET_SAMPLING_SCORE = \"getSamplingScore\"; // Count: 2\r\nexport var _DYN_GET_HASH_CODE_SCORE = \"getHashCodeScore\"; // Count: 4\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Channel, 2.8.5-nightly.2206-02
2
+ * Application Insights JavaScript SDK - Channel, 2.8.5-nightly.2206-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export { Sender } from "./Sender";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-channel-js",
3
- "version": "2.8.5-nightly.2206-02",
3
+ "version": "2.8.5-nightly.2206-06",
4
4
  "description": "Microsoft Application Insights JavaScript SDK Channel",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -16,9 +16,12 @@
16
16
  "build:browser": "rollup -c",
17
17
  "rebuild": "npm run build",
18
18
  "test": "grunt aichanneltest",
19
+ "mintest": "grunt aichannel-mintest",
19
20
  "lint": "tslint -p tsconfig.json",
20
21
  "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights JavaScript SDK Channel\"",
21
- "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js"
22
+ "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
23
+ "ai-min": "grunt aichannel-min",
24
+ "ai-restore": "grunt aichannel-restore"
22
25
  },
23
26
  "devDependencies": {
24
27
  "@microsoft/ai-test-framework": "0.0.1",
@@ -47,8 +50,8 @@
47
50
  "dependencies": {
48
51
  "@microsoft/dynamicproto-js": "^1.1.6",
49
52
  "@microsoft/applicationinsights-shims": "2.0.1",
50
- "@microsoft/applicationinsights-core-js": "2.8.5-nightly.2206-02",
51
- "@microsoft/applicationinsights-common": "2.8.5-nightly.2206-02"
53
+ "@microsoft/applicationinsights-core-js": "2.8.5-nightly.2206-06",
54
+ "@microsoft/applicationinsights-common": "2.8.5-nightly.2206-06"
52
55
  },
53
56
  "license": "MIT",
54
57
  "publishConfig": {
@@ -1,18 +1,14 @@
1
- import {
2
- IEnvelope, Data, Envelope,
3
- RemoteDependencyData, Event, Exception,
4
- Metric, PageView, Trace, PageViewPerformance, IDependencyTelemetry,
5
- IPageViewPerformanceTelemetry, CtxTagKeys,
6
- HttpMethod, IPageViewTelemetryInternal, IWeb,
7
- IExceptionInternal,
8
- SampleRate,
9
- dataSanitizeString
10
- } from "@microsoft/applicationinsights-common";
11
- import {
12
- ITelemetryItem, IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, hasJSON, getJSON, objForEachKey,
13
- isNullOrUndefined, isNumber, isString, toISOString, setValue, isTruthy, optimizeObject, _throwInternal, _warnToConsole
14
- } from "@microsoft/applicationinsights-core-js";
15
-
1
+ import {
2
+ CtxTagKeys, Data, Envelope, Event, Exception, HttpMethod, IDependencyTelemetry, IEnvelope, IExceptionInternal,
3
+ IPageViewPerformanceTelemetry, IPageViewTelemetryInternal, IWeb, Metric, PageView, PageViewPerformance, RemoteDependencyData, SampleRate,
4
+ Trace, dataSanitizeString
5
+ } from "@microsoft/applicationinsights-common";
6
+ import {
7
+ IDiagnosticLogger, ITelemetryItem, _eInternalMessageId, _throwInternal, _warnToConsole, eLoggingSeverity, getJSON, hasJSON,
8
+ isNullOrUndefined, isNumber, isString, isTruthy, objForEachKey, optimizeObject, setValue, toISOString
9
+ } from "@microsoft/applicationinsights-core-js";
10
+ import { STR_DURATION } from "./InternalConstants";
11
+
16
12
  // these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload
17
13
  const strBaseType = "baseType";
18
14
  const strBaseData = "baseData";
@@ -175,7 +171,7 @@ function EnvelopeCreatorInit(logger: IDiagnosticLogger, telemetryItem: ITelemetr
175
171
  }
176
172
 
177
173
  export const EnvelopeCreator = {
178
- Version: "2.8.5-nightly.2206-02"
174
+ Version: "#version#"
179
175
  };
180
176
 
181
177
  export function DependencyEnvelopeCreator(logger: IDiagnosticLogger, telemetryItem: ITelemetryItem, customUndefinedValue?: any): IEnvelope {
@@ -263,18 +259,17 @@ export function PageViewEnvelopeCreator(logger: IDiagnosticLogger, telemetryItem
263
259
  EnvelopeCreatorInit(logger, telemetryItem);
264
260
 
265
261
  // Since duration is not part of the domain properties in Common Schema, extract it from part C
266
- let strDuration = "duration";
267
262
  let duration;
268
263
  let baseData = telemetryItem[strBaseData];
269
264
  if (!isNullOrUndefined(baseData) &&
270
265
  !isNullOrUndefined(baseData[strProperties]) &&
271
- !isNullOrUndefined(baseData[strProperties][strDuration])) { // from part B properties
272
- duration = baseData[strProperties][strDuration];
273
- delete baseData[strProperties][strDuration];
266
+ !isNullOrUndefined(baseData[strProperties][STR_DURATION])) { // from part B properties
267
+ duration = baseData[strProperties][STR_DURATION];
268
+ delete baseData[strProperties][STR_DURATION];
274
269
  } else if (!isNullOrUndefined(telemetryItem.data) &&
275
- !isNullOrUndefined(telemetryItem.data[strDuration])) { // from custom properties
276
- duration = telemetryItem.data[strDuration];
277
- delete telemetryItem.data[strDuration];
270
+ !isNullOrUndefined(telemetryItem.data[STR_DURATION])) { // from custom properties
271
+ duration = telemetryItem.data[STR_DURATION];
272
+ delete telemetryItem.data[STR_DURATION];
278
273
  }
279
274
 
280
275
  const bd = telemetryItem[strBaseData] as IPageViewTelemetryInternal;
@@ -353,4 +348,4 @@ export function TraceEnvelopeCreator(logger: IDiagnosticLogger, telemetryItem: I
353
348
  const baseData = new Trace(logger, message, severityLevel, props, measurements);
354
349
  const data = new Data<Trace>(Trace.dataType, baseData);
355
350
  return _createEnvelope<Trace>(logger, Trace.envelopeType, telemetryItem, data);
356
- }
351
+ }
@@ -0,0 +1,11 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5
+ // Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
6
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
+
8
+ // Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
9
+ // as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
10
+
11
+ export const STR_DURATION = "duration";
package/src/Offline.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { getWindow, getDocument, getNavigator, isUndefined, isNullOrUndefined, createUniqueNamespace, mergeEvtNamespace, eventOn, eventOff } from "@microsoft/applicationinsights-core-js";
2
-
1
+ import {
2
+ createUniqueNamespace, eventOff, eventOn, getDocument, getNavigator, getWindow, isNullOrUndefined, isUndefined, mergeEvtNamespace
3
+ } from "@microsoft/applicationinsights-core-js";
4
+
3
5
  export interface IOfflineListener {
4
6
  isOnline: () => boolean;
5
7
  isListening: () => boolean;
@@ -101,4 +103,4 @@ export function createOfflineListener(parentEvtNamespace?: string | string[]): I
101
103
  isListening: () => _isListening,
102
104
  unload: _unload
103
105
  };
104
- }
106
+ }
package/src/SendBuffer.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { utlGetSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
2
- import { IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, getJSON, arrForEach, isFunction, arrIndexOf, isString, dumpObj, isArray, getExceptionName, _throwInternal } from "@microsoft/applicationinsights-core-js";
3
- import { ISenderConfig } from "./Interfaces";
4
- import dynamicProto from "@microsoft/dynamicproto-js";
5
-
1
+ import dynamicProto from "@microsoft/dynamicproto-js";
2
+ import { utlGetSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
3
+ import {
4
+ IDiagnosticLogger, _eInternalMessageId, _throwInternal, arrForEach, arrIndexOf, dumpObj, eLoggingSeverity, getExceptionName, getJSON,
5
+ isArray, isFunction, isString
6
+ } from "@microsoft/applicationinsights-core-js";
7
+ import { ISenderConfig } from "./Interfaces";
8
+
6
9
  export interface ISendBuffer {
7
10
  /**
8
11
  * Enqueue the payload
@@ -341,4 +344,4 @@ export class SessionStorageSendBuffer extends BaseSendBuffer implements ISendBuf
341
344
  public clearSent(payload: string[]) {
342
345
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
343
346
  }
344
- }
347
+ }
package/src/Sender.ts CHANGED
@@ -1,30 +1,26 @@
1
- import { ISenderConfig, XDomainRequest as IXDomainRequest, IBackendResponse } from "./Interfaces";
2
- import { ISendBuffer, SessionStorageSendBuffer, ArraySendBuffer } from "./SendBuffer";
3
- import {
4
- DependencyEnvelopeCreator, EventEnvelopeCreator,
5
- ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator,
6
- PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator
7
- } from "./EnvelopeCreator";
8
- import { Serializer } from "./Serializer"; // todo move to channel
9
- import {
10
- DisabledPropertyName, RequestHeaders, IEnvelope, PageView, Event,
11
- Trace, Exception, Metric, PageViewPerformance, RemoteDependencyData,
12
- IChannelControlsAI, IConfig, ProcessLegacy, BreezeChannelIdentifier,
13
- SampleRate, isInternalApplicationInsightsEndpoint, utlCanUseSessionStorage,
14
- ISample
15
- } from "@microsoft/applicationinsights-common";
16
- import {
17
- ITelemetryItem, IProcessTelemetryContext, IConfiguration,
18
- _eInternalMessageId, eLoggingSeverity, IDiagnosticLogger, IAppInsightsCore, IPlugin,
19
- getWindow, getNavigator, getJSON, BaseTelemetryPlugin, ITelemetryPluginChain, INotificationManager,
20
- SendRequestReason, objForEachKey, isNullOrUndefined, arrForEach, dateNow, dumpObj, getExceptionName, getIEVersion, objKeys,
21
- isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, isArray, createUniqueNamespace, mergeEvtNamespace,
22
- IProcessTelemetryUnloadContext, ITelemetryUnloadState, _throwInternal, _warnToConsole
23
- } from "@microsoft/applicationinsights-core-js";
24
- import { createOfflineListener, IOfflineListener } from "./Offline";
25
- import { Sample } from "./TelemetryProcessors/Sample"
26
- import dynamicProto from "@microsoft/dynamicproto-js";
27
-
1
+ import dynamicProto from "@microsoft/dynamicproto-js";
2
+ import {
3
+ BreezeChannelIdentifier, DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH, DisabledPropertyName, Event, Exception, IChannelControlsAI,
4
+ IConfig, IEnvelope, ISample, Metric, PageView, PageViewPerformance, ProcessLegacy, RemoteDependencyData, RequestHeaders, SampleRate,
5
+ Trace, eRequestHeaders, isInternalApplicationInsightsEndpoint, utlCanUseSessionStorage
6
+ } from "@microsoft/applicationinsights-common";
7
+ import {
8
+ BaseTelemetryPlugin, IAppInsightsCore, IConfiguration, IDiagnosticLogger, INotificationManager, IPlugin, IProcessTelemetryContext,
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
13
+ } from "@microsoft/applicationinsights-core-js";
14
+ import {
15
+ DependencyEnvelopeCreator, EventEnvelopeCreator, ExceptionEnvelopeCreator, MetricEnvelopeCreator, PageViewEnvelopeCreator,
16
+ PageViewPerformanceEnvelopeCreator, TraceEnvelopeCreator
17
+ } from "./EnvelopeCreator";
18
+ import { IBackendResponse, ISenderConfig, XDomainRequest as IXDomainRequest } from "./Interfaces";
19
+ import { IOfflineListener, createOfflineListener } from "./Offline";
20
+ import { ArraySendBuffer, ISendBuffer, SessionStorageSendBuffer } from "./SendBuffer";
21
+ import { Serializer } from "./Serializer";
22
+ import { Sample } from "./TelemetryProcessors/Sample";
23
+
28
24
  const FetchSyncRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)
29
25
 
30
26
  declare var XDomainRequest: {
@@ -45,9 +41,12 @@ function _getResponseText(xhr: XMLHttpRequest | IXDomainRequest) {
45
41
  }
46
42
 
47
43
  function _getDefaultAppInsightsChannelConfig(): ISenderConfig {
44
+ let defaultValue: string;
45
+ let defaultCustomHeaders: [{header: string, value: string}];
46
+
48
47
  // set default values
49
48
  return {
50
- endpointUrl: () => "https://dc.services.visualstudio.com/v2/track",
49
+ endpointUrl: () => DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH,
51
50
  emitLineDelimitedJson: () => false,
52
51
  maxBatchInterval: () => 15000,
53
52
  maxBatchSizeInBytes: () => 102400, // 100kb
@@ -58,11 +57,11 @@ function _getDefaultAppInsightsChannelConfig(): ISenderConfig {
58
57
  disableXhr: () => false,
59
58
  onunloadDisableFetch: () => false,
60
59
  onunloadDisableBeacon: () => false,
61
- instrumentationKey: () => undefined, // Channel doesn't need iKey, it should be set already
62
- namePrefix: () => undefined,
60
+ instrumentationKey: () => defaultValue, // Channel doesn't need iKey, it should be set already
61
+ namePrefix: () => defaultValue,
63
62
  samplingPercentage: () => 100,
64
- customHeaders: () => undefined,
65
- convertUndefined: () => undefined,
63
+ customHeaders: () => defaultCustomHeaders,
64
+ convertUndefined: () => defaultValue,
66
65
  eventsLimitInMem: () => 10000
67
66
  }
68
67
  }
@@ -279,6 +278,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
279
278
 
280
279
  _self.processTelemetry = (telemetryItem: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {
281
280
  itemCtx = _self._getTelCtx(itemCtx);
281
+ let diagLogger = itemCtx.diagLog();
282
282
 
283
283
  try {
284
284
  // if master off switch is set, don't send any data
@@ -289,13 +289,13 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
289
289
 
290
290
  // validate input
291
291
  if (!telemetryItem) {
292
- _throwInternal(itemCtx.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
292
+ _throwInternal(diagLogger, eLoggingSeverity.CRITICAL, _eInternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
293
293
  return;
294
294
  }
295
295
 
296
296
  // validate event
297
297
  if (telemetryItem.baseData && !telemetryItem.baseType) {
298
- _throwInternal(itemCtx.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
298
+ _throwInternal(diagLogger, eLoggingSeverity.CRITICAL, _eInternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
299
299
  return;
300
300
  }
301
301
 
@@ -306,14 +306,14 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
306
306
 
307
307
  // ensure a sender was constructed
308
308
  if (!_self._sender) {
309
- _throwInternal(itemCtx.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.SenderNotInitialized, "Sender was not initialized");
309
+ _throwInternal(diagLogger, eLoggingSeverity.CRITICAL, _eInternalMessageId.SenderNotInitialized, "Sender was not initialized");
310
310
  return;
311
311
  }
312
312
 
313
313
  // check if this item should be sampled in, else add sampleRate tag
314
314
  if (!_isSampledIn(telemetryItem)) {
315
315
  // Item is sampled out, do not send it
316
- _throwInternal(itemCtx.diagLog(), eLoggingSeverity.WARNING, _eInternalMessageId.TelemetrySampledAndNotSent,
316
+ _throwInternal(diagLogger, eLoggingSeverity.WARNING, _eInternalMessageId.TelemetrySampledAndNotSent,
317
317
  "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
318
318
  return;
319
319
  } else {
@@ -324,9 +324,9 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
324
324
  // construct an envelope that Application Insights endpoint can understand
325
325
  // if ikey of telemetry is provided and not empty, envelope will use this iKey instead of senderConfig iKey
326
326
  let defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
327
- let aiEnvelope = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
327
+ let aiEnvelope = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, diagLogger, convertUndefined);
328
328
  if (!aiEnvelope) {
329
- _throwInternal(itemCtx.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
329
+ _throwInternal(diagLogger, eLoggingSeverity.CRITICAL, _eInternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
330
330
  return;
331
331
  }
332
332
 
@@ -337,12 +337,12 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
337
337
  try {
338
338
  if (callBack && callBack(aiEnvelope) === false) {
339
339
  doNotSendItem = true;
340
- _warnToConsole(itemCtx.diagLog(), "Telemetry processor check returns false");
340
+ _warnToConsole(diagLogger, "Telemetry processor check returns false");
341
341
  }
342
342
  } catch (e) {
343
343
  // log error but dont stop executing rest of the telemetry initializers
344
344
  // doNotSendItem = true;
345
- _throwInternal(itemCtx.diagLog(),
345
+ _throwInternal(diagLogger,
346
346
  eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e),
347
347
  { exception: dumpObj(e) }, true);
348
348
  }
@@ -372,7 +372,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
372
372
  _setupTimer();
373
373
 
374
374
  } catch (e) {
375
- _throwInternal(itemCtx.diagLog(),
375
+ _throwInternal(diagLogger,
376
376
  eLoggingSeverity.WARNING,
377
377
  _eInternalMessageId.FailedAddingTelemetryToBuffer,
378
378
  "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e),
@@ -462,8 +462,8 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
462
462
  * partial success handler
463
463
  */
464
464
  _self._onPartialSuccess = (payload: string[], results: IBackendResponse) => {
465
- const failed = [];
466
- const retry = [];
465
+ const failed: string[] = [];
466
+ const retry: string[] = [];
467
467
 
468
468
  // Iterate through the reversed array of errors so that splicing doesn't have invalid indexes after the first item.
469
469
  const errors = results.errors.reverse();
@@ -686,7 +686,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
686
686
 
687
687
  // append Sdk-Context request header only in case of breeze endpoint
688
688
  if (isInternalApplicationInsightsEndpoint(endPointUrl)) {
689
- xhr.setRequestHeader(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);
689
+ xhr.setRequestHeader(RequestHeaders[eRequestHeaders.sdkContextHeader], RequestHeaders[eRequestHeaders.sdkContextHeaderAppIdRequest]);
690
690
  }
691
691
 
692
692
  arrForEach(objKeys(_headers), (headerName) => {
@@ -748,7 +748,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
748
748
 
749
749
  // append Sdk-Context request header only in case of breeze endpoint
750
750
  if (isInternalApplicationInsightsEndpoint(endPointUrl)) {
751
- requestHeaders.append(RequestHeaders.sdkContextHeader, RequestHeaders.sdkContextHeaderAppIdRequest);
751
+ requestHeaders.append(RequestHeaders[eRequestHeaders.sdkContextHeader], RequestHeaders[eRequestHeaders.sdkContextHeaderAppIdRequest]);
752
752
  }
753
753
 
754
754
  arrForEach(objKeys(_headers), (headerName) => {
@@ -1145,4 +1145,4 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
1145
1145
  public addHeader(name: string, value: string) {
1146
1146
  // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging
1147
1147
  }
1148
- }
1148
+ }
package/src/Serializer.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { ISerializable, FieldType } from "@microsoft/applicationinsights-common";
2
- import {
3
- IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, getJSON, objForEachKey, isFunction, isObject, isArray, _throwInternal
4
- } from "@microsoft/applicationinsights-core-js";
5
1
  import dynamicProto from "@microsoft/dynamicproto-js"
6
-
2
+ import {
3
+ IDiagnosticLogger, _eInternalMessageId, _throwInternal, eLoggingSeverity, getJSON, isArray, isFunction, isObject, objForEachKey
4
+ } from "@microsoft/applicationinsights-core-js";
5
+ import { FieldType, ISerializable } from "@microsoft/applicationinsights-common";
6
+
7
7
  export class Serializer {
8
8
 
9
9
  constructor(logger: IDiagnosticLogger) {
@@ -105,7 +105,7 @@ export class Serializer {
105
105
  }
106
106
 
107
107
  function _serializeArray(sources: ISerializable[], name: string): any[] {
108
- let output;
108
+ let output: any[];
109
109
 
110
110
  if (!!sources) {
111
111
  if (!isArray(sources)) {
@@ -174,4 +174,4 @@ export class Serializer {
174
174
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
175
175
  return null;
176
176
  }
177
- }
177
+ }
@@ -1,12 +1,12 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import { ISample, Metric } from "@microsoft/applicationinsights-common";
5
- import {
6
- IDiagnosticLogger, ITelemetryItem, _eInternalMessageId, eLoggingSeverity, safeGetLogger
7
- } from "@microsoft/applicationinsights-core-js";
8
- import { SamplingScoreGenerator } from "./SamplingScoreGenerators/SamplingScoreGenerator";
9
-
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { ISample, Metric } from "@microsoft/applicationinsights-common";
5
+ import {
6
+ IDiagnosticLogger, ITelemetryItem, _eInternalMessageId, eLoggingSeverity, safeGetLogger
7
+ } from "@microsoft/applicationinsights-core-js";
8
+ import { SamplingScoreGenerator } from "./SamplingScoreGenerators/SamplingScoreGenerator";
9
+
10
10
  export class Sample implements ISample {
11
11
  public sampleRate: number;
12
12
 
@@ -46,4 +46,4 @@ export class Sample implements ISample {
46
46
  isSampledIn = this.samplingScoreGenerator.getSamplingScore(envelope) < samplingPercentage;
47
47
  return isSampledIn;
48
48
  }
49
- }
49
+ }
@@ -1,6 +1,6 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
4
  // (Magic number) DJB algorithm can't work on shorter strings (results in poor distribution
5
5
  const MIN_INPUT_LENGTH: number = 8;
6
6
 
@@ -34,4 +34,4 @@ export class HashCodeScoreGenerator {
34
34
 
35
35
  return Math.abs(hash);
36
36
  }
37
- }
37
+ }
@@ -1,10 +1,10 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import { HashCodeScoreGenerator } from "./HashCodeScoreGenerator";
5
- import { ITelemetryItem } from "@microsoft/applicationinsights-core-js";
6
- import { ContextTagKeys } from "@microsoft/applicationinsights-common";
7
-
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { ContextTagKeys } from "@microsoft/applicationinsights-common";
5
+ import { ITelemetryItem } from "@microsoft/applicationinsights-core-js";
6
+ import { HashCodeScoreGenerator } from "./HashCodeScoreGenerator";
7
+
8
8
  export class SamplingScoreGenerator {
9
9
 
10
10
  public getSamplingScore: (item: ITelemetryItem) => number;
@@ -32,4 +32,4 @@ export class SamplingScoreGenerator {
32
32
  return score;
33
33
  }
34
34
  }
35
- }
35
+ }