@microsoft/applicationinsights-channel-js 2.8.0-beta.2203-08 → 2.8.0-beta.2203-11
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/browser/applicationinsights-channel-js.integrity.json +9 -9
- package/browser/applicationinsights-channel-js.js +20 -8
- package/browser/applicationinsights-channel-js.js.map +1 -1
- package/browser/applicationinsights-channel-js.min.js +2 -2
- package/browser/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.api.json +1 -30
- package/dist/applicationinsights-channel-js.api.md +0 -2
- package/dist/applicationinsights-channel-js.d.ts +1 -2
- package/dist/applicationinsights-channel-js.js +20 -8
- package/dist/applicationinsights-channel-js.js.map +1 -1
- package/dist/applicationinsights-channel-js.min.js +2 -2
- package/dist/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.rollup.d.ts +1 -2
- package/dist-esm/EnvelopeCreator.js +2 -2
- package/dist-esm/EnvelopeCreator.js.map +1 -1
- package/dist-esm/Interfaces.js +1 -1
- package/dist-esm/Offline.js +1 -1
- package/dist-esm/SendBuffer.js +1 -1
- package/dist-esm/Sender.js +4 -2
- package/dist-esm/Sender.js.map +1 -1
- package/dist-esm/Serializer.js +1 -1
- package/dist-esm/TelemetryProcessors/Sample.js +3 -3
- package/dist-esm/TelemetryProcessors/Sample.js.map +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
- package/dist-esm/applicationinsights-channel-js.js +1 -1
- package/package.json +4 -4
- package/src/EnvelopeCreator.ts +2 -2
- package/src/Sender.ts +14 -14
- package/src/Serializer.ts +4 -8
- package/src/TelemetryProcessors/Sample.ts +1 -1
- package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +3 -1
- package/types/Sender.d.ts +0 -1
- package/types/TelemetryProcessors/Sample.d.ts +2 -2
- package/types/tsdoc-metadata.json +1 -1
package/src/Sender.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
getWindow, getNavigator, getJSON, BaseTelemetryPlugin, ITelemetryPluginChain, INotificationManager,
|
|
20
20
|
SendRequestReason, objForEachKey, isNullOrUndefined, arrForEach, dateNow, dumpObj, getExceptionName, getIEVersion, objKeys,
|
|
21
21
|
isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, isArray, createUniqueNamespace, mergeEvtNamespace,
|
|
22
|
-
IProcessTelemetryUnloadContext, ITelemetryUnloadState, _throwInternal
|
|
22
|
+
IProcessTelemetryUnloadContext, ITelemetryUnloadState, _throwInternal, throwError
|
|
23
23
|
} from "@microsoft/applicationinsights-core-js";
|
|
24
24
|
import { createOfflineListener, IOfflineListener } from "./Offline";
|
|
25
25
|
import { Sample } from "./TelemetryProcessors/Sample"
|
|
@@ -202,6 +202,10 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
_self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain): void => {
|
|
205
|
+
if (_self.isInitialized()) {
|
|
206
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender is already initialized");
|
|
207
|
+
}
|
|
208
|
+
|
|
205
209
|
_base.initialize(config, core, extensions, pluginChain);
|
|
206
210
|
let ctx = _self._getTelCtx();
|
|
207
211
|
let identifier = _self.identifier;
|
|
@@ -588,9 +592,9 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
588
592
|
|
|
589
593
|
function _checkAndUpdateEndPointUrl(responseUrl: string) {
|
|
590
594
|
// Maximum stamp specific redirects allowed(uncomment this when breeze is ready with not allowing redirects feature)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
595
|
+
if(_stamp_specific_redirects >= 10) {
|
|
596
|
+
// _self._senderConfig.endpointUrl = () => Sender._getDefaultAppInsightsChannelConfig().endpointUrl()+"/?redirect=false";
|
|
597
|
+
// _stamp_specific_redirects = 0;
|
|
594
598
|
return false;
|
|
595
599
|
}
|
|
596
600
|
if(!isNullOrUndefined(responseUrl) && responseUrl !== "") {
|
|
@@ -724,16 +728,16 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
724
728
|
* @param payload {string} - The data payload to be sent.
|
|
725
729
|
* @param isAsync {boolean} - not used
|
|
726
730
|
*/
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
731
|
+
function _fetchSender(payload: string[], isAsync: boolean) {
|
|
732
|
+
_doFetchSender(payload, true);
|
|
733
|
+
}
|
|
730
734
|
|
|
731
735
|
/**
|
|
732
736
|
* Send fetch API request
|
|
733
737
|
* @param payload {string} - The data payload to be sent.
|
|
734
738
|
* @param isAsync {boolean} - For fetch this identifies whether we are "unloading" (false) or a normal request
|
|
735
739
|
*/
|
|
736
|
-
|
|
740
|
+
function _doFetchSender(payload: string[], isAsync: boolean) {
|
|
737
741
|
const endPointUrl = _self._senderConfig.endpointUrl();
|
|
738
742
|
const batch = _self._buffer.batchPayloads(payload);
|
|
739
743
|
const plainTextBatch = new Blob([batch], { type: "application/json" });
|
|
@@ -964,7 +968,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
964
968
|
_InternalMessageId.TransmissionFailed, ". " +
|
|
965
969
|
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
966
970
|
|
|
967
|
-
|
|
971
|
+
buffer.clear();
|
|
968
972
|
return;
|
|
969
973
|
}
|
|
970
974
|
|
|
@@ -1081,10 +1085,6 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
1081
1085
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
1082
1086
|
}
|
|
1083
1087
|
|
|
1084
|
-
public teardown(): void {
|
|
1085
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
1088
|
public initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain): void {
|
|
1089
1089
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
1090
1090
|
}
|
|
@@ -1142,7 +1142,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
|
|
1142
1142
|
* @param name - Header name.
|
|
1143
1143
|
* @param value - Header value.
|
|
1144
1144
|
*/
|
|
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
|
@@ -139,12 +139,10 @@ export class Serializer {
|
|
|
139
139
|
output[field] = "null";
|
|
140
140
|
} else if (!value.toString) {
|
|
141
141
|
output[field] = "invalid field: toString() is not defined.";
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
142
|
+
} else {
|
|
144
143
|
output[field] = value.toString();
|
|
145
144
|
}
|
|
146
|
-
}
|
|
147
|
-
else if (expectedType === "number") {
|
|
145
|
+
} else if (expectedType === "number") {
|
|
148
146
|
if (value === undefined) {
|
|
149
147
|
output[field] = "undefined";
|
|
150
148
|
} else if (value === null) {
|
|
@@ -153,13 +151,11 @@ export class Serializer {
|
|
|
153
151
|
const num = parseFloat(value);
|
|
154
152
|
if (isNaN(num)) {
|
|
155
153
|
output[field] = "NaN";
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
154
|
+
} else {
|
|
158
155
|
output[field] = num;
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
158
|
+
} else {
|
|
163
159
|
output[field] = "invalid field: " + name + " is of unknown type.";
|
|
164
160
|
logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
|
|
165
161
|
}
|
|
@@ -27,7 +27,7 @@ export class Sample implements ISample {
|
|
|
27
27
|
this.samplingScoreGenerator = new SamplingScoreGenerator();
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
31
|
* Determines if an envelope is sampled in (i.e. will be sent) or not (i.e. will be dropped).
|
|
32
32
|
*/
|
|
33
33
|
public isSampledIn(envelope: ITelemetryItem): boolean {
|
package/types/Sender.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export declare class Sender extends BaseTelemetryPlugin implements IChannelContr
|
|
|
47
47
|
* Will not flush if the Send has been paused.
|
|
48
48
|
*/
|
|
49
49
|
onunloadFlush(): void;
|
|
50
|
-
teardown(): void;
|
|
51
50
|
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
52
51
|
processTelemetry(telemetryItem: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
53
52
|
/**
|
|
@@ -6,7 +6,7 @@ export declare class Sample implements ISample {
|
|
|
6
6
|
private samplingScoreGenerator;
|
|
7
7
|
constructor(sampleRate: number, logger?: IDiagnosticLogger);
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Determines if an envelope is sampled in (i.e. will be sent) or not (i.e. will be dropped).
|
|
10
|
+
*/
|
|
11
11
|
isSampledIn(envelope: ITelemetryItem): boolean;
|
|
12
12
|
}
|