Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9946ed4
[main] Add stale bot for assigned issues and prs (#2495)
MSNev Apr 2, 2025
ffbd877
move to beta again (#2496)
siyuniu-ms Apr 2, 2025
82c7981
[main] support adding cross origin resource policy for #1851 (#2423)
siyuniu-ms Apr 2, 2025
a864ed5
[Main][Task]31248254: Add Monitor Tests for CDN OPTIONS Calls (#2491)
Karlie-777 Apr 2, 2025
6258457
[main] Minor fixes for handling ikey promises with dynamic changes (#…
MSNev Apr 4, 2025
10053b1
[chrome debug tool] publish 0.8.0 for manifect V3 (#2499)
siyuniu-ms Apr 9, 2025
a8d229e
[Main][Task]31233527:Change Default RequestSizeLimitBytes (#2501)
Karlie-777 Apr 17, 2025
bb52809
[main][stats beat] implement stats beat in application insights (#2489)
siyuniu-ms Apr 24, 2025
fc2ee8d
[main] Handle race condition during unload (#2507)
MSNev Apr 28, 2025
188c755
Drop correlation header to be passed on the dependency (#2506)
aimbrenda Apr 29, 2025
6e315f1
[main] enable compress api in 1ds-post-channel and applicationinsight…
siyuniu-ms Apr 30, 2025
b5a24d5
[main] [Click analytics] not logging no native html input elements #…
siyuniu-ms Apr 30, 2025
4f7f645
[Main][Task]31233527: Add a Config to Allow Users to Change RequestSi…
Karlie-777 May 1, 2025
93a3713
Address issues with isFeatureEnabled changes (#2514)
MSNev May 3, 2025
629d8bf
Add additional SendPostManager tests (#2515)
MSNev May 5, 2025
e0f21e0
Reduce Stale period (#2519)
MSNev May 5, 2025
4ec25ca
[Main][Task]32698211: Add a Config to Allow Users to Change Max Numbe…
Karlie-777 May 6, 2025
72fd702
Remove Generated docs from the repo (#2518)
MSNev May 6, 2025
123ba4c
Update Components to address governance issues (#2517)
MSNev May 6, 2025
1647e6f
[Release] Increase version to 3.3.7 (#2520)
Karlie-777 May 7, 2025
6f6c4d5
Merge remote-tracking branch 'origin/main' into MSNev/beta
MSNev May 8, 2025
3f5ffbe
[beta] Merge [main] (3.3.7) to beta branch
MSNev May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .aiAutoMinify.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"_eInternalMessageId",
"SendRequestReason",
"TransportType",
"eStatsType",
"TelemetryUnloadReason",
"TelemetryUpdateReason"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale-assigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
stale-issue-message: 'This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.'
stale-pr-message: 'This PR will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.'
operations-per-run: 200
days-before-stale: 360
days-before-stale: 300
days-before-close: 30
stale-issue-label: 'stale'
stale-pr-label: 'stale'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
stale-issue-message: 'This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.'
stale-pr-message: 'This PR will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.'
operations-per-run: 200
days-before-stale: 300
days-before-stale: 240
days-before-close: 30
stale-issue-label: 'stale'
stale-pr-label: 'stale'
Expand Down
1 change: 1 addition & 0 deletions AISKU/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ See [Breaking Changes](https://microsoft.github.io/ApplicationInsights-JS/upgrad
| Version | Full Size | Raw Minified | GZip Size
|---------|-----------|--------------|-------------
| [<nightly3>](https://github.com/microsoft/ApplicationInsights-JS/tree/main/AISKU) | [![full size size](https://js.monitor.azure.com/nightly/ai.3-nightly3.js.svg)](https://js.monitor.azure.com/nightly/ai.3-nightly3.js.svg)| ![minified size size](https://js.monitor.azure.com/nightly/ai.3-nightly3.min.js.svg) | ![gzip size](https://js.monitor.azure.com/nightly/ai.3-nightly3.min.js.gzip.svg)
| 3.3.7: | [![full size size](https://js.monitor.azure.com/scripts/b/ai.3.3.7.js.svg)](https://js.monitor.azure.com/scripts/b/ai.3.3.7.js.svg)| ![minified size size](https://js.monitor.azure.com/scripts/b/ai.3.3.7.min.js.svg) | ![gzip size](https://js.monitor.azure.com/scripts/b/ai.3.3.7.min.js.gzip.svg)
| 3.3.6: | [![full size size](https://js.monitor.azure.com/scripts/b/ai.3.3.6.js.svg)](https://js.monitor.azure.com/scripts/b/ai.3.3.6.js.svg)| ![minified size size](https://js.monitor.azure.com/scripts/b/ai.3.3.6.min.js.svg) | ![gzip size](https://js.monitor.azure.com/scripts/b/ai.3.3.6.min.js.gzip.svg)
| 3.3.5: | [![full size size](https://js.monitor.azure.com/scripts/b/ai.3.3.5.js.svg)](https://js.monitor.azure.com/scripts/b/ai.3.3.5.js.svg)| ![minified size size](https://js.monitor.azure.com/scripts/b/ai.3.3.5.min.js.svg) | ![gzip size](https://js.monitor.azure.com/scripts/b/ai.3.3.5.min.js.gzip.svg)
| 3.3.4: | [![full size size](https://js.monitor.azure.com/scripts/b/ai.3.3.4.js.svg)](https://js.monitor.azure.com/scripts/b/ai.3.3.4.js.svg)| ![minified size size](https://js.monitor.azure.com/scripts/b/ai.3.3.4.min.js.svg) | ![gzip size](https://js.monitor.azure.com/scripts/b/ai.3.3.4.min.js.gzip.svg)
Expand Down
2 changes: 1 addition & 1 deletion AISKU/Tests/Perf/src/AISKUPerf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class AppInsightsInitPerfTestClass {
* should update version after new release
* version with doperf(): after 2.5.6
* */
var defaultVer = "3.3.6";
var defaultVer = "3.3.7";
this.version = ver? ver:this._getQueryParameterVersion(defaultVer);
this.perfEventsBuffer = [];
this.perfEventWaitBuffer = [];
Expand Down
10 changes: 5 additions & 5 deletions AISKU/Tests/Unit/src/AISKUSize.Tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}

export class AISKUSizeCheck extends AITestClass {
private readonly MAX_RAW_SIZE = 146;
private readonly MAX_BUNDLE_SIZE = 146;
private readonly MAX_RAW_DEFLATE_SIZE = 58;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 58;
private readonly MAX_RAW_SIZE = 147;
private readonly MAX_BUNDLE_SIZE = 147;
private readonly MAX_RAW_DEFLATE_SIZE = 59;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 59;
private readonly rawFilePath = "../dist/es5/applicationinsights-web.min.js";
// Automatically updated by version scripts
private readonly currentVer = "3.3.6";
private readonly currentVer = "3.3.7";
private readonly prodFilePath = `../browser/es5/ai.${this.currentVer[0]}.min.js`;

public testInitialize() {
Expand Down
2 changes: 1 addition & 1 deletion AISKU/Tests/Unit/src/CdnPackaging.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const enum CdnFormat {

export class CdnPackagingChecks extends AITestClass {
// Automatically updated by version scripts
private readonly currentVer = "3.3.6";
private readonly currentVer = "3.3.7";

public testInitialize() {
}
Expand Down
45 changes: 42 additions & 3 deletions AISKU/Tests/Unit/src/CdnThrottle.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ export class CdnThrottle extends AITestClass {
offCfg: {
"throttleMgrCfg.106.disabled":true,
"throttleMgrCfg.109.disabled":true,
}
}},
}},
["zipPayload"]: {
mode: CdnFeatureMode.enable},
},
config: {
maxMessageLimit: 10,
throttleMgrCfg: throttleCfgDisable
throttleMgrCfg: throttleCfgDisable,

}
} as ICfgSyncConfig;
doc["res"] = new (doc as any).Response(JSON.stringify(cdnCfg), {
Expand Down Expand Up @@ -245,6 +248,42 @@ export class CdnThrottle extends AITestClass {
}, "response received", 60, 1000) as any)
});

this.testCaseAsync({
name: "CfgSyncPlugin: customer didn't set feature opt in, successfully get aisku default and fetch from config url, get disable zip config to be true",
stepDelay: 10,
useFakeTimers: true,
steps: [ () => {
let doc = getGlobal();
hookFetch((resolve) => { // global instance cannot access test private instance
AITestClass.orgSetTimeout(function() {
resolve( doc["res2"]);
}, 0);
});

let noSetconfig = {
instrumentationKey: TestInstrumentationKey,
extensionConfig : {["AppInsightsCfgSyncPlugin"] : {
syncMode: ICfgSyncMode.Receive,
cfgUrl: "testurl"
}}
};

this.fetchStub = this.sandbox.spy((doc as any), "fetch");
this.init = new ApplicationInsights({
config: noSetconfig,
});
this.init.loadAppInsights();
this._ai = this.init;
}].concat(PollingAssert.createPollingAssert(() => {
if (this.fetchStub.called){
let newCfg = this._ai.config;
Assert.equal(newCfg.featureOptIn["zipPayload"]["mode"], FeatureOptInMode.enable); // aisku default is none, overwrite to true by cdn config
return true;
}
return false;
}, "response received", 60, 1000) as any)
});

this.testCaseAsync({
name: "CfgSyncPlugin: customer set throttle config, new config fetch from config url could overwrite original one",
stepDelay: 10,
Expand Down
6 changes: 3 additions & 3 deletions AISKU/Tests/es6-module-type-check/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/applicationinsights-test-module-type-check",
"author": "Microsoft Application Insights Team and Contributors",
"version": "3.3.6",
"version": "3.3.7",
"description": "Microsoft Application Insights ES6 Module and Type check Example",
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
"keywords": [
Expand Down Expand Up @@ -32,7 +32,7 @@
"tslib": ">= 1.0.0"
},
"dependencies": {
"@microsoft/applicationinsights-common": "3.3.6",
"@microsoft/applicationinsights-web": "3.3.6"
"@microsoft/applicationinsights-common": "3.3.7",
"@microsoft/applicationinsights-web": "3.3.7"
}
}
20 changes: 10 additions & 10 deletions AISKU/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/applicationinsights-web",
"version": "3.3.6",
"version": "3.3.7",
"description": "Microsoft Application Insights JavaScript SDK - Web",
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
"author": "Microsoft Application Insights Team",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@microsoft/ai-test-framework": "0.0.1",
"@microsoft/applicationinsights-offlinechannel-js": "0.3.6",
"@microsoft/applicationinsights-offlinechannel-js": "0.3.7",
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
"@microsoft/applicationinsights-rollup-es5": "1.0.2",
"sinon": "^7.3.1",
Expand All @@ -57,21 +57,21 @@
"typedoc": "^0.26.6",
"typescript": "^4.9.3",
"tslib": "^2.0.0",
"puppeteer": "19.2.0"
"puppeteer": "22.12.1"
},
"peerDependencies": {
"tslib": ">= 1.0.0"
},
"dependencies": {
"@microsoft/dynamicproto-js": "^2.0.3",
"@microsoft/applicationinsights-shims": "3.0.1",
"@microsoft/applicationinsights-analytics-js": "3.3.6",
"@microsoft/applicationinsights-channel-js": "3.3.6",
"@microsoft/applicationinsights-cfgsync-js": "3.3.6",
"@microsoft/applicationinsights-common": "3.3.6",
"@microsoft/applicationinsights-core-js": "3.3.6",
"@microsoft/applicationinsights-dependencies-js": "3.3.6",
"@microsoft/applicationinsights-properties-js": "3.3.6",
"@microsoft/applicationinsights-analytics-js": "3.3.7",
"@microsoft/applicationinsights-channel-js": "3.3.7",
"@microsoft/applicationinsights-cfgsync-js": "3.3.7",
"@microsoft/applicationinsights-common": "3.3.7",
"@microsoft/applicationinsights-core-js": "3.3.7",
"@microsoft/applicationinsights-dependencies-js": "3.3.7",
"@microsoft/applicationinsights-properties-js": "3.3.7",
"@nevware21/ts-utils": ">= 0.11.8 < 2.x",
"@nevware21/ts-async": ">= 0.5.4 < 2.x"
},
Expand Down
10 changes: 6 additions & 4 deletions AISKU/src/AISku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const _ignoreUpdateSnippetProperties = [
const IKEY_USAGE = "iKeyUsage";
const CDN_USAGE = "CdnUsage";
const SDK_LOADER_VER = "SdkLoaderVer";
const ZIP_PAYLOAD = "zipPayload";

const UNDEFINED_VALUE: undefined = undefined;

Expand Down Expand Up @@ -80,7 +81,8 @@ const defaultConfigValues: IConfigDefaults<IConfiguration & IConfig> = {
featureOptIn:{
[IKEY_USAGE]: {mode: FeatureOptInMode.enable}, //for versions after 3.1.2 (>= 3.2.0)
[CDN_USAGE]: {mode: FeatureOptInMode.disable},
[SDK_LOADER_VER]: {mode: FeatureOptInMode.disable}
[SDK_LOADER_VER]: {mode: FeatureOptInMode.disable},
[ZIP_PAYLOAD]: {mode: FeatureOptInMode.none}
},
throttleMgrCfg: cfgDfMerge<{[key:number]: IThrottleMgrConfig}>(
{
Expand Down Expand Up @@ -375,17 +377,17 @@ export class AppInsightsSku implements IApplicationInsights {
_throttleMgr.onReadyState(true);
}

if (!_iKeySentMessage && !_config.connectionString && isFeatureEnabled(IKEY_USAGE, _config)) {
if (!_iKeySentMessage && !_config.connectionString && isFeatureEnabled(IKEY_USAGE, _config, true)) {
_throttleMgr.sendMessage( _eInternalMessageId.InstrumentationKeyDeprecation, "See Instrumentation key support at aka.ms/IkeyMigrate");
_iKeySentMessage = true;
}

if (!_cdnSentMessage && _self.context.internal.sdkSrc && _self.context.internal.sdkSrc.indexOf("az416426") != -1 && isFeatureEnabled(CDN_USAGE, _config)) {
if (!_cdnSentMessage && _self.context.internal.sdkSrc && _self.context.internal.sdkSrc.indexOf("az416426") != -1 && isFeatureEnabled(CDN_USAGE, _config, true)) {
_throttleMgr.sendMessage( _eInternalMessageId.CdnDeprecation, "See Cdn support notice at aka.ms/JsActiveCdn");
_cdnSentMessage = true;
}

if (!_sdkVerSentMessage && parseInt(_snippetVersion) < 6 && isFeatureEnabled(SDK_LOADER_VER, _config)) {
if (!_sdkVerSentMessage && parseInt(_snippetVersion) < 6 && isFeatureEnabled(SDK_LOADER_VER, _config, true)) {
_throttleMgr.sendMessage( _eInternalMessageId.SdkLdrUpdate, "An updated Sdk Loader is available, see aka.ms/SnippetVer");
_sdkVerSentMessage = true;
}
Expand Down
6 changes: 3 additions & 3 deletions AISKULight/Tests/Unit/src/AISKULightSize.Tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}

export class AISKULightSizeCheck extends AITestClass {
private readonly MAX_RAW_SIZE = 92;
private readonly MAX_BUNDLE_SIZE = 92;
private readonly MAX_RAW_SIZE = 93;
private readonly MAX_BUNDLE_SIZE = 93;
private readonly MAX_RAW_DEFLATE_SIZE = 38;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 38;
private readonly rawFilePath = "../dist/es5/applicationinsights-web-basic.min.js";
private readonly currentVer = "3.3.6";
private readonly currentVer = "3.3.7";
private readonly prodFilePath = `../browser/es5/aib.${this.currentVer[0]}.min.js`;

public testInitialize() {
Expand Down
90 changes: 87 additions & 3 deletions AISKULight/Tests/Unit/src/dynamicconfig.tests.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { AITestClass, Assert, PollingAssert } from "@microsoft/ai-test-framework";
import { IConfig } from "@microsoft/applicationinsights-common";
import { IConfiguration, isString, newId } from "@microsoft/applicationinsights-core-js";
import { IConfiguration, IPayloadData, isString, ITelemetryItem, IXHROverride, newId } from "@microsoft/applicationinsights-core-js";
import { ApplicationInsights, ISenderConfig } from "../../../src/index";
import { createAsyncResolvedPromise } from "@nevware21/ts-async";

import { SinonSpy } from 'sinon';
export class ApplicationInsightsDynamicConfigTests extends AITestClass {
private static readonly _instrumentationKey = "b7170927-2d1c-44f1-acec-59f4e1751c11";
private static readonly _connectionString = `InstrumentationKey=${ApplicationInsightsDynamicConfigTests._instrumentationKey}`;
private _ai: ApplicationInsights;
private _sessionPrefix: string = newId();
private _config: IConfiguration & IConfig;
static registerTests: any;
private genericSpy: SinonSpy;
private _ctx: any;

private xhrOverride: IXHROverride;
constructor(testName?: string) {
super(testName || "AISKU Dynamic Config");
}
Expand All @@ -30,6 +31,7 @@ export class ApplicationInsightsDynamicConfigTests extends AITestClass {

this._ai = new ApplicationInsights(this._config);
this._ctx = {};
this.xhrOverride = new AutoCompleteXhrOverride();
} catch (e) {
console.error("Failed to initialize", e);
}
Expand Down Expand Up @@ -137,6 +139,80 @@ export class ApplicationInsightsDynamicConfigTests extends AITestClass {
return false;
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
});

this.testCaseAsync({
name: "zip test: gzip encode is working and content-encode header is set (feature opt-in)",
stepDelay: 10,
useFakeTimers: true,
useFakeServer: true,
steps: [
() => {
this.genericSpy = this.sandbox.spy(this.xhrOverride, 'sendPOST');
this._ai.config.featureOptIn["zipPayload"] = { mode: 3 };
this._ai.config.extensionConfig["AppInsightsChannelPlugin"] = {
httpXHROverride: this.xhrOverride,
alwaysUseXhrOverride: true
}
this.clock.tick(10);
const telemetryItem: ITelemetryItem = {
name: 'fake item with some really long name to take up space quickly',
iKey: 'iKey',
baseType: 'some type',
baseData: {}
};

this._ai.track(telemetryItem);
this._ai.flush();
this.clock.tick(10);
}].concat(PollingAssert.createPollingAssert(() => {
if (this.genericSpy.called){
let request = this.genericSpy.getCall(0).args[0];
let gzipData = request.data;
QUnit.assert.ok(gzipData, "data should be set");
QUnit.assert.equal(true, gzipData[0] === 0x1F && gzipData[1] === 0x8B, "telemetry should be gzip encoded");
QUnit.assert.equal(request.headers["Content-Encoding"], "gzip", "telemetry should be gzip encoded");
return true;
}
return false;
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
});

this.testCaseAsync({
name: "zip test: gzip encode will not working (feature opt-in is not set)",
stepDelay: 10,
useFakeTimers: true,
useFakeServer: true,
steps: [
() => {
this.genericSpy = this.sandbox.spy(this.xhrOverride, 'sendPOST');
this._ai.config.extensionConfig["AppInsightsChannelPlugin"] = {
httpXHROverride: this.xhrOverride,
alwaysUseXhrOverride: true
}
this.clock.tick(10);
const telemetryItem: ITelemetryItem = {
name: 'fake item with some really long name to take up space quickly',
iKey: 'iKey',
baseType: 'some type',
baseData: {}
};

this._ai.track(telemetryItem);
this._ai.flush();
this.clock.tick(10);
}].concat(PollingAssert.createPollingAssert(() => {
if (this.genericSpy.called){
let request = this.genericSpy.getCall(0).args[0];
let gzipData = request.data;
QUnit.assert.ok(gzipData, "data should be set");
QUnit.assert.equal(false, gzipData[0] === 0x1F && gzipData[1] === 0x8B, "telemetry should not be gzip encoded");
QUnit.assert.equal(request.headers["Content-Encoding"], undefined, "telemetry should not be gzip encoded");
return true;
}
return false;
}, "Wait for promise response" + new Date().toISOString(), 60, 1000) as any)
});

}

public addApiTests(): void {
Expand All @@ -153,4 +229,12 @@ export class ApplicationInsightsDynamicConfigTests extends AITestClass {
});
}

}

class AutoCompleteXhrOverride {

public sendPOST(payload: IPayloadData, oncomplete: (status: number, headers: { [headerName: string]: string }) => void, sync?: boolean) {
console.log("AutoCompleteXhrOverride.sendPOST called with payload: ", payload);
oncomplete(200, null);
}
}
Loading
Loading