From 2e888c5ba81881a391366f28a54183ca9f66cc4e Mon Sep 17 00:00:00 2001
From: siyuniu-ms <123212536+siyuniu-ms@users.noreply.github.com>
Date: Tue, 25 Mar 2025 14:53:43 -0700
Subject: [PATCH 01/72] [Main] Increase CDN Deprecation Message Sampling Rate
to 40% (#2492)
---
tools/config/config.json | 4 ++--
tools/config/package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/config/config.json b/tools/config/config.json
index 0512a51b5..bbc78e247 100644
--- a/tools/config/config.json
+++ b/tools/config/config.json
@@ -1,5 +1,5 @@
{
- "version": "1.0.4",
+ "version": "1.0.5",
"enabled": true,
"featureOptIn": {
"iKeyUsage": {
@@ -53,7 +53,7 @@
"110": {
"disabled": false,
"limit": {
- "samplingRate": 300000,
+ "samplingRate": 400000,
"maxSendNumber": 1
},
"interval": {
diff --git a/tools/config/package.json b/tools/config/package.json
index 8af471eb1..3acad6576 100644
--- a/tools/config/package.json
+++ b/tools/config/package.json
@@ -1,7 +1,7 @@
{
"name": "applicationinsights-web-config",
"description": "Application Insights JavaScript SDK - Web Config for CfgSync Plugin",
- "version": "1.0.4",
+ "version": "1.0.5",
"copyright": "(c) Microsoft and contributors. All rights reserved.",
"author": "Microsoft Application Insights Team",
"repository": {
From 8fe338926a342abcb21c0c000eb5a77fe7fee3fe Mon Sep 17 00:00:00 2001
From: Nev Wylie <54870357+MSNev@users.noreply.github.com>
Date: Tue, 25 Mar 2025 17:23:18 -0700
Subject: [PATCH 02/72] [beta] Merge [main] into [beta] and set next release to
minor
---
version.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/version.json b/version.json
index 266e69773..a1922a127 100644
--- a/version.json
+++ b/version.json
@@ -2,7 +2,7 @@
"description": "The release value identifies the base version that will be applied via the tools/release-tools/setVersion.js",
"usage": "When creating a new release you should update this value directly or via the eg. 'npm run setVersion -- 3.2.0' or 'npm run setVersion -- -patch' or 'npm run setVersion -- -minor'",
"release": "3.3.6",
- "next": "patch",
+ "next": "minor",
"pkgs": {
"@microsoft/applicationinsights-web": {
"package": "package.json",
From 8728e90215fde2bc49b229219a3203ead8182759 Mon Sep 17 00:00:00 2001
From: Nev <54870357+MSNev@users.noreply.github.com>
Date: Wed, 26 Mar 2025 09:34:43 -0700
Subject: [PATCH 03/72] Update AISKU/Tests/Unit/src/AISKUSize.Tests.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---
AISKU/Tests/Unit/src/AISKUSize.Tests.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/AISKU/Tests/Unit/src/AISKUSize.Tests.ts b/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
index a1a231906..2343d0056 100644
--- a/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
+++ b/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
@@ -85,8 +85,8 @@ export class AISKUSizeCheck extends AITestClass {
}
public testCleanup() {
- utlRemoveSessionStorage(null as any, "AI_sentBuffer", );
- utlRemoveSessionStorage(null as any, "AI_buffer", );
+ utlRemoveSessionStorage(null as any, "AI_sentBuffer");
+ utlRemoveSessionStorage(null as any, "AI_buffer");
}
public registerTests() {
From 3097337f5df484870bf332339dad5859e11a030b Mon Sep 17 00:00:00 2001
From: Nev <54870357+MSNev@users.noreply.github.com>
Date: Wed, 26 Mar 2025 09:34:52 -0700
Subject: [PATCH 04/72] Update AISKU/Tests/Perf/src/AISKUPerf.Tests.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---
AISKU/Tests/Perf/src/AISKUPerf.Tests.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/AISKU/Tests/Perf/src/AISKUPerf.Tests.ts b/AISKU/Tests/Perf/src/AISKUPerf.Tests.ts
index dfa43312e..b3ab253a9 100644
--- a/AISKU/Tests/Perf/src/AISKUPerf.Tests.ts
+++ b/AISKU/Tests/Perf/src/AISKUPerf.Tests.ts
@@ -152,8 +152,8 @@ export class AISKUPerf extends AITestClass {
}
public testCleanup() {
- utlRemoveSessionStorage(null as any, "AI_sentBuffer", );
- utlRemoveSessionStorage(null as any, "AI_buffer", );
+ utlRemoveSessionStorage(null as any, "AI_sentBuffer");
+ utlRemoveSessionStorage(null as any, "AI_buffer");
}
public registerTests() {
From 9946ed43837cdcabe49abf2f7f8040cca8f0331b Mon Sep 17 00:00:00 2001
From: Nev <54870357+MSNev@users.noreply.github.com>
Date: Tue, 1 Apr 2025 17:01:57 -0700
Subject: [PATCH 05/72] [main] Add stale bot for assigned issues and prs
(#2495)
---
.github/workflows/stale-assigned.yml | 30 ++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 .github/workflows/stale-assigned.yml
diff --git a/.github/workflows/stale-assigned.yml b/.github/workflows/stale-assigned.yml
new file mode 100644
index 000000000..7aceb75ca
--- /dev/null
+++ b/.github/workflows/stale-assigned.yml
@@ -0,0 +1,30 @@
+name: 'Stale issue handler'
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '0 7 * * *'
+
+permissions:
+ actions: write
+ issues: write
+ pull-requests: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v9
+ id: stale
+ with:
+ 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-close: 30
+ stale-issue-label: 'stale'
+ stale-pr-label: 'stale'
+ close-issue-label: 'closed'
+ close-pr-label: 'closed'
+ exempt-issue-labels: 'bug,enhancement,documentation,waiting,keep'
+ exempt-pr-labels: 'waiting,keep'
+ include-only-assigned: true
\ No newline at end of file
From ffbd877438608fa6c187259c0cb7d09642829b38 Mon Sep 17 00:00:00 2001
From: siyuniu-ms <123212536+siyuniu-ms@users.noreply.github.com>
Date: Wed, 2 Apr 2025 12:31:13 -0700
Subject: [PATCH 06/72] move to beta again (#2496)
Co-authored-by: Nev <54870357+MSNev@users.noreply.github.com>
---
tools/github-page-script-injection/injectScript.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/github-page-script-injection/injectScript.js b/tools/github-page-script-injection/injectScript.js
index 47dbea078..be1a15e4b 100644
--- a/tools/github-page-script-injection/injectScript.js
+++ b/tools/github-page-script-injection/injectScript.js
@@ -31,8 +31,8 @@ let scriptContent = fs.readFileSync(scriptFilePath, 'utf8');
// Replace the placeholder string with the actual connection string
//const connectionString = 'InstrumentationKey=1ae9e7ce-18f1-4e14-8fc0-acbf0ed28895;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/';
let iKeyForCfgSync = "1ae9e7ce-18f1-4e14-8fc0-acbf0ed28895";
-//let cfgUrl = "https://js.monitor.azure.com/beta/ai.config.1.cfg.json";
-let cfgUrl = "https://js.monitor.azure.com/nightly/ai_test.config.1-nightly3.cfg.json";
+let cfgUrl = "https://js.monitor.azure.com/beta/ai.config.1.cfg.json";
+// let cfgUrl = "https://js.monitor.azure.com/nightly/ai_test.config.1-nightly3.cfg.json";
scriptContent = scriptContent.replace(`connectionString: "YOUR_CONNECTION_STRING"`, `instrumentationKey: "${iKeyForCfgSync}",\n \texpCfg: {\n\t\tinclScripts: true,\n\t\t\n\t\tmaxLogs: 100},\n \t\textensionConfig: {\n\t\t\t"AppInsightsCfgSyncPlugin": {\n\t\t\t\tcfgUrl:"${cfgUrl}"\n\t\t\t}\n\t\t}`);
//scriptContent = scriptContent.replace('YOUR_CONNECTION_STRING', connectionString);
scriptContent = ``;
From 9a33ccd01542250f01aed2f992f82a3b9636fdfc Mon Sep 17 00:00:00 2001
From: Nev <54870357+MSNev@users.noreply.github.com>
Date: Wed, 2 Apr 2025 13:43:56 -0700
Subject: [PATCH 07/72] [beta] Update publishing scripts for nightly beta
releases (#2498)
---
AISKU/scripts/publishAzReleaseToCdn.ps1 | 2 +-
AISKU/scripts/setAzActiveCdnVersion.ps1 | 2 +-
.../scripts/publishAzReleaseToCdn.ps1 | 2 +-
.../scripts/setAzActiveCdnVersion.ps1 | 2 +-
.../scripts/publishAzReleaseToCdn.ps1 | 2 +-
.../scripts/setAzActiveCdnVersion.ps1 | 2 +-
.../scripts/publishAzReleaseToCdn.ps1 | 2 +-
.../scripts/setAzActiveCdnVersion.ps1 | 2 +-
tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 | 2 +-
tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 | 2 +-
tools/config/scripts/publishAzReleaseToCdn.ps1 | 2 +-
tools/config/scripts/setAzActiveCdnVersion.ps1 | 2 +-
tools/release-tools/setVersion.js | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/AISKU/scripts/publishAzReleaseToCdn.ps1 b/AISKU/scripts/publishAzReleaseToCdn.ps1
index 99aacadc3..4367b754a 100644
--- a/AISKU/scripts/publishAzReleaseToCdn.ps1
+++ b/AISKU/scripts/publishAzReleaseToCdn.ps1
@@ -139,7 +139,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite
}
diff --git a/AISKU/scripts/setAzActiveCdnVersion.ps1 b/AISKU/scripts/setAzActiveCdnVersion.ps1
index c83e1680e..97472c382 100644
--- a/AISKU/scripts/setAzActiveCdnVersion.ps1
+++ b/AISKU/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1
index 3b55f7908..df287b003 100644
--- a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1
+++ b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1
@@ -138,7 +138,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite
}
diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1
index 012f0088c..513f093a2 100644
--- a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1
+++ b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1
index aacdf5cff..d25ac9548 100644
--- a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1
+++ b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1
@@ -138,7 +138,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite
}
diff --git a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1
index 856208956..a968001e0 100644
--- a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1
+++ b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1
index a9b9b1051..e166a7e43 100644
--- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1
+++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1
@@ -138,7 +138,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite
}
diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1
index bb7e033ec..6a489cc64 100644
--- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1
+++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1
index 9b96d2002..0bdc2dd93 100644
--- a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1
+++ b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1
@@ -127,7 +127,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)/tools" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly/tools" $cacheControl1Year $contentType $overwrite
}
diff --git a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1
index f2412bbb4..91cc80821 100644
--- a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1
+++ b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/tools/config/scripts/publishAzReleaseToCdn.ps1 b/tools/config/scripts/publishAzReleaseToCdn.ps1
index 99f0db08c..404dcf5b2 100644
--- a/tools/config/scripts/publishAzReleaseToCdn.ps1
+++ b/tools/config/scripts/publishAzReleaseToCdn.ps1
@@ -153,7 +153,7 @@ elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
PublishFiles $testFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
}
-elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+elseif ($version.type -like "nightly*") {
# Publish to release nightly folder folder
# PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite
PublishFiles $testFiles "nightly" $cacheControl1Year $contentType $overwrite
diff --git a/tools/config/scripts/setAzActiveCdnVersion.ps1 b/tools/config/scripts/setAzActiveCdnVersion.ps1
index 4e5684ddb..afdcdad40 100644
--- a/tools/config/scripts/setAzActiveCdnVersion.ps1
+++ b/tools/config/scripts/setAzActiveCdnVersion.ps1
@@ -87,7 +87,7 @@ Function Validate-Params
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
}
- elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
+ elseif ($version.type -like "nightly*") {
if ("nightly" -ne $container) {
Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]"
}
diff --git a/tools/release-tools/setVersion.js b/tools/release-tools/setVersion.js
index dde02a3f3..c750c1479 100644
--- a/tools/release-tools/setVersion.js
+++ b/tools/release-tools/setVersion.js
@@ -406,7 +406,7 @@ function updatePublishConfig(package, newVersion) {
}
// Set the publishing tag
- if (details.type === "nightly" || details.type === "dev" || details.type === "beta" || details.type === "alpha") {
+ if (details.type === "nightly" || details.type === "nightlybeta" || details.type === "dev" || details.type === "beta" || details.type === "alpha") {
console.log(` Type - [${details.type}] - ${majorVersion}`);
package.publishConfig.tag = details.type + (majorVersion !== "0" ? majorVersion : "");
} else {
From 82c7981fbcc6cd7f851f3e6967ac015fa05b47a4 Mon Sep 17 00:00:00 2001
From: siyuniu-ms <123212536+siyuniu-ms@users.noreply.github.com>
Date: Wed, 2 Apr 2025 13:57:52 -0700
Subject: [PATCH 08/72] [main] support adding cross origin resource policy for
#1851 (#2423)
* add header
* add test
* Update IConfiguration.ts
* rename
* based on comment
* Update Sender.tests.ts
* local variable
* Update Sender.ts
* slight change test
* Update Sender.ts
---
.../Tests/Unit/src/Sender.tests.ts | 71 +++++++++++++++++++
.../src/Interfaces.ts | 14 ++++
.../src/Sender.ts | 13 +++-
3 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts b/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts
index 4ebd8e378..cb7431121 100644
--- a/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts
+++ b/channels/applicationinsights-channel-js/Tests/Unit/src/Sender.tests.ts
@@ -2739,6 +2739,77 @@ export class SenderTests extends AITestClass {
}
});
+ this.testCase({
+ name: 'Users could set the cross-origin header via request',
+ useFakeTimers: true,
+ test: () => {
+ let core = new AppInsightsCore();
+ let id = this._sender.identifier;
+ let coreConfig = {
+ instrumentationKey: 'abc',
+ isBeaconApiDisabled: true,
+ extensionConfig: {
+ [this._sender.identifier]: {
+ corsPolicy: "cross-origin",
+ }
+ }
+ }
+ core.initialize(coreConfig, [this._sender]);
+
+ let sendBeaconCalled = false;
+ this.hookSendBeacon((url: string) => {
+ sendBeaconCalled = true;
+ return true;
+ });
+
+ const telemetryItem: ITelemetryItem = {
+ name: 'fake item',
+ iKey: 'iKey',
+ baseType: 'some type',
+ baseData: {}
+ };
+
+ try {
+ this._sender.processTelemetry(telemetryItem);
+ this.clock.tick(30000);
+ } catch(e) {
+ QUnit.assert.ok(false);
+ }
+ const CrossOriginResourcePolicyHeader: string = "X-Set-Cross-Origin-Resource-Policy";
+ QUnit.assert.equal(1, this._getXhrRequests().length, "xhr sender is called");
+ let headers = this._getXhrRequests()[0].requestHeaders;
+ QUnit.assert.ok(headers.hasOwnProperty(CrossOriginResourcePolicyHeader));
+ QUnit.assert.equal(headers[CrossOriginResourcePolicyHeader], 'cross-origin');
+ QUnit.assert.notOk(this._getXhrRequests()[0].requestHeaders.hasOwnProperty('testHeader'));
+
+ // dynamic change
+ core.config.extensionConfig[this._sender.identifier].corsPolicy = "same-origin";
+ this.clock.tick(1);
+ try {
+ this._sender.processTelemetry(telemetryItem);
+ this.clock.tick(30000);
+ } catch(e) {
+ QUnit.assert.ok(false);
+ }
+ headers = this._getXhrRequests()[1].requestHeaders;
+ QUnit.assert.ok(headers.hasOwnProperty(CrossOriginResourcePolicyHeader));
+ QUnit.assert.equal(headers[CrossOriginResourcePolicyHeader], 'same-origin');
+ QUnit.assert.notOk(this._getXhrRequests()[1].requestHeaders.hasOwnProperty('testHeader'));
+
+ // dynamic change to null
+ core.config.extensionConfig[this._sender.identifier].corsPolicy = null;
+ this.clock.tick(1);
+ try {
+ this._sender.processTelemetry(telemetryItem);
+ this.clock.tick(30000);
+ } catch(e) {
+ QUnit.assert.ok(false);
+ }
+ headers = this._getXhrRequests()[2].requestHeaders;
+ QUnit.assert.notOk(this._getXhrRequests()[2].requestHeaders.hasOwnProperty(CrossOriginResourcePolicyHeader));
+ }
+ });
+
this.testCase({
name: 'Users are allowed to add customHeaders when endpointUrl is not Breeze.',
test: () => {
diff --git a/channels/applicationinsights-channel-js/src/Interfaces.ts b/channels/applicationinsights-channel-js/src/Interfaces.ts
index 1df9c6625..3a0d975ef 100644
--- a/channels/applicationinsights-channel-js/src/Interfaces.ts
+++ b/channels/applicationinsights-channel-js/src/Interfaces.ts
@@ -166,6 +166,20 @@ export interface ISenderConfig {
* @since 3.2.0
*/
maxRetryCnt?: number;
+
+ /**
+ * [Optional] Specifies the Cross-Origin Resource Policy (CORP) for the endpoint.
+ * This value is included in the response header as `Cross-Origin-Resource-Policy`,
+ * which helps control how resources can be shared across different origins.
+ *
+ * Possible values:
+ * - `same-site`: Allows access only from the same site.
+ * - `same-origin`: Allows access only from the same origin (protocol, host, and port).
+ * - `cross-origin`: Allows access from any origin.
+ *
+ * @since 3.3.7
+ */
+ corsPolicy?: string;
}
export interface IBackendResponse {
diff --git a/channels/applicationinsights-channel-js/src/Sender.ts b/channels/applicationinsights-channel-js/src/Sender.ts
index 992520ecc..9e76c676d 100644
--- a/channels/applicationinsights-channel-js/src/Sender.ts
+++ b/channels/applicationinsights-channel-js/src/Sender.ts
@@ -78,9 +78,12 @@ const defaultAppInsightsChannelConfig: IConfigDefaults = objDeepF
alwaysUseXhrOverride: cfgDfBoolean(),
transports: UNDEFINED_VALUE,
retryCodes: UNDEFINED_VALUE,
+ corsPolicy: UNDEFINED_VALUE,
maxRetryCnt: {isVal: isNumber, v:10}
});
+const CrossOriginResourcePolicyHeader: string = "X-Set-Cross-Origin-Resource-Policy";
+
function _chkSampling(value: number) {
return !isNaN(value) && value > 0 && value <= 100;
}
@@ -268,7 +271,6 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
let ctx = createProcessTelemetryContext(null, config, core);
// getExtCfg only finds undefined values from core
let senderConfig = ctx.getExtCfg(identifier, defaultAppInsightsChannelConfig);
-
let curExtUrl = senderConfig.endpointUrl;
// if it is not inital change (_endpointUrl has value)
// if current sender endpoint url is not changed directly
@@ -283,6 +285,15 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
}
}
+ let corsPolicy = senderConfig.corsPolicy;
+ if (corsPolicy){
+ if (corsPolicy === "same-origin" || corsPolicy === "same-site" || corsPolicy === "cross-origin") {
+ this.addHeader(CrossOriginResourcePolicyHeader, corsPolicy);
+ }
+ } else {
+ delete _headers[CrossOriginResourcePolicyHeader];
+ }
+
if(isPromiseLike(senderConfig.instrumentationKey)) {
// if it is promise, means the endpoint url is from core.endpointurl
senderConfig.instrumentationKey = config.instrumentationKey as any;
From a864ed59e64429d3bb532072e16362f161e0e727 Mon Sep 17 00:00:00 2001
From: Karlie-777 <79606506+Karlie-777@users.noreply.github.com>
Date: Wed, 2 Apr 2025 15:30:56 -0700
Subject: [PATCH 09/72] [Main][Task]31248254: Add Monitor Tests for CDN OPTIONS
Calls (#2491)
* add cdn montioring tests
* update
* update
* update
* update
* update
* update
---
.../Unit/src/applicationinsights.e2e.tests.ts | 150 ++++++++++++++++++
1 file changed, 150 insertions(+)
diff --git a/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts b/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts
index e4448490e..14cac09ed 100644
--- a/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts
+++ b/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts
@@ -9,6 +9,7 @@ import { createAsyncResolvedPromise } from '@nevware21/ts-async';
import { CONFIG_ENDPOINT_URL } from '../../../src/InternalConstants';
import { OfflineChannel } from '@microsoft/applicationinsights-offlinechannel-js';
import { IStackFrame } from '@microsoft/applicationinsights-common/src/Interfaces/Contracts/IStackFrame';
+import { utcNow } from '@nevware21/ts-utils';
function _checkExpectedFrame(expectedFrame: IStackFrame, actualFrame: IStackFrame, index: number) {
Assert.equal(expectedFrame.assembly, actualFrame.assembly, index + ") Assembly is not as expected");
@@ -160,6 +161,7 @@ export class ApplicationInsightsTests extends AITestClass {
this.addDependencyPluginTests();
this.addPropertiesPluginTests();
this.addCDNOverrideTests();
+ this.addCdnMonitorTests();
}
public addGenericE2ETests(): void {
@@ -725,6 +727,154 @@ export class ApplicationInsightsTests extends AITestClass {
});
}
+ public addCdnMonitorTests(): void {
+ this.testCaseAsync({
+ name: "E2E.GenericTests: Fetch Current CDN V3",
+ stepDelay: 1,
+ useFakeServer: false,
+ useFakeFetch: false,
+ fakeFetchAutoRespond: false,
+ steps: [() => {
+ // Use beta endpoint to pre-test any changes before public V3 cdn
+ let random = utcNow();
+ // Under Cors Mode, Options request will be auto-triggered
+ try {
+ fetch(`https://js.monitor.azure.com/beta/ai.3.gbl.min.js?${random}`, {
+ method: "GET"
+ }).then((res) => {
+ this._ctx.res = res;
+ res.text().then((val) => {
+ this._ctx.val = val;
+ });
+ });
+ } catch (e) {
+ Assert.ok(false, "Fetch Error: " + e);
+ }
+
+ }].concat(PollingAssert.createPollingAssert(() => {
+
+ if (this._ctx && this._ctx.res && this._ctx.val) {
+ let res = this._ctx.res;
+ let status = res.status;
+ if (status === 200) {
+ // for Response headers:
+ // content-type: text/javascript; charset=utf-8
+ // x-ms-meta-aijssdksrc: should present
+ // x-ms-meta-aijssdkver should present
+ let headers = res.headers;
+ let headerCnt = 0;
+ headers.forEach((val, key) => {
+ if (key === "content-type") {
+ Assert.deepEqual(val, "text/javascript; charset=utf-8", "should have correct content-type response header");
+ headerCnt ++;
+ }
+ if (key === "x-ms-meta-aijssdksrc") {
+ Assert.ok(val, "should have sdk src response header");
+ headerCnt ++;
+ }
+ if (key === "x-ms-meta-aijssdkver") {
+ Assert.ok(val, "should have version number for response header");
+ headerCnt ++;
+ }
+ });
+ Assert.equal(headerCnt, 3, "all expected headers should be present");
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
+ });
+
+ this.testCaseAsync({
+ name: "E2E.GenericTests: Fetch Current CDN V2",
+ stepDelay: 1,
+ useFakeServer: false,
+ useFakeFetch: false,
+ fakeFetchAutoRespond: false,
+ steps: [() => {
+ // Use public endpoint for V2
+ let random = utcNow();
+ // Under Cors Mode, Options request will be triggered
+ fetch(`https://js.monitor.azure.com/scripts/b/ai.2.gbl.min.js?${random}`, {
+ method: "GET"
+ }).then((res) => {
+ this._ctx.res = res;
+ res.text().then((val) => {
+ this._ctx.val = val;
+ });
+ });
+
+ }].concat(PollingAssert.createPollingAssert(() => {
+ if (this._ctx && this._ctx.res && this._ctx.val) {
+ let res = this._ctx.res;
+ let status = res.status;
+ if (status === 200) {
+ // for Response headers:
+ // content-type: text/javascript; charset=utf-8
+ // x-ms-meta-aijssdksrc: should present
+ // x-ms-meta-aijssdkver should present
+ let headers = res.headers;
+ let headerCnt = 0;
+ headers.forEach((val, key) => {
+ if (key === "content-type") {
+ Assert.deepEqual(val, "text/javascript; charset=utf-8", "should have correct content-type response header");
+ headerCnt ++;
+ }
+ if (key === "x-ms-meta-aijssdksrc") {
+ Assert.ok(val, "should have sdk src response header");
+ headerCnt ++;
+ }
+ if (key === "x-ms-meta-aijssdkver") {
+ Assert.ok(val, "should have version number for response header");
+ headerCnt ++;
+ }
+ });
+ Assert.equal(headerCnt, 3, "all expected headers should be present");
+ return true;
+ }
+ return false;
+ }
+ return false;
+ }, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
+ });
+
+ this.testCaseAsync({
+ name: "E2E.GenericTests: Fetch Static Web CDN V3",
+ stepDelay: 1,
+ useFakeServer: false,
+ useFakeFetch: false,
+ fakeFetchAutoRespond: false,
+ steps: [() => {
+ // Use beta endpoint to pre-test any changes before public V3 cdn
+ let random = utcNow();
+ // Under Cors Mode, Options request will be auto-triggered
+ try {
+ fetch(`https://js0.tst.applicationinsights.io/scripts/b/ai.3.gbl.min.js?${random}`, {
+ method: "GET"
+ }).then((res) => {
+ this._ctx.res = res;
+ if (res.ok) {
+ res.text().then((val) => {
+ this._ctx.val = val;
+ });
+ }
+ }).catch((e) => {
+ this._ctx.err = e.message;
+ })
+ } catch (e) {
+ this._ctx.err = e;
+ }
+ }].concat(PollingAssert.createPollingAssert(() => {
+
+ if (this._ctx && this._ctx.err) {
+ return true;
+ }
+ return false;
+ }, "Wait for response" + new Date().toISOString(), 60, 1000) as any)
+ });
+ }
+
public addAsyncTests(): void {
this.testCaseAsync({
name: "E2E.GenericTests: Send events with offline support",
From 6258457d60cabbfd34348187b9aa21f166508250 Mon Sep 17 00:00:00 2001
From: Nev <54870357+MSNev@users.noreply.github.com>
Date: Fri, 4 Apr 2025 15:52:36 -0700
Subject: [PATCH 10/72] [main] Minor fixes for handling ikey promises with
dynamic changes (#2500)
- Additional Minification improvements
---
AISKU/src/AISku.ts | 82 +++---
.../src/JavaScriptSDK/AppInsightsCore.ts | 234 +++++++++---------
2 files changed, 162 insertions(+), 154 deletions(-)
diff --git a/AISKU/src/AISku.ts b/AISKU/src/AISku.ts
index 84b93fa73..4efcf6eef 100644
--- a/AISKU/src/AISku.ts
+++ b/AISKU/src/AISku.ts
@@ -103,12 +103,27 @@ function _chkDiagLevel(value: number) {
return value && value > 0;
}
+function _parseCs(config: IConfiguration & IConfig, configCs: string | IPromise) {
+ return createSyncPromise((resolve, reject) => {
+ doAwaitResponse(configCs, (res) => {
+ let curCs = res && res.value;
+ let parsedCs = null;
+ if (!res.rejected && curCs) {
+ // replace cs with resolved values in case of circular promises
+ config.connectionString = curCs;
+ parsedCs = parseConnectionString(curCs);
+ }
+
+ // if can't resolve cs promise, null will be returned
+ resolve(parsedCs);
+ });
+ });
+}
+
/**
* Application Insights API
* @group Entrypoint
* @group Classes
- * @class Initialization
- * @implements {IApplicationInsights}
*/
export class AppInsightsSku implements IApplicationInsights {
public snippet: Snippet;
@@ -200,60 +215,47 @@ export class AppInsightsSku implements IApplicationInsights {
// Will get recalled if any referenced values are changed
_addUnloadHook(onConfigChange(cfgHandler, () => {
- let configCs = _config.connectionString;
-
- function _parseCs() {
- return createSyncPromise((resolve, reject) => {
- doAwaitResponse(configCs, (res) => {
- let curCs = res && res.value;
- let parsedCs = null;
- if (!res.rejected && curCs) {
- // replace cs with resolved values in case of circular promises
- _config.connectionString = curCs;
- parsedCs = parseConnectionString(curCs);
- }
- // if can't resolve cs promise, null will be returned
- resolve(parsedCs);
- });
- });
-
- }
+ let configCs = _config.connectionString;
if (isPromiseLike(configCs)) {
let ikeyPromise = createSyncPromise((resolve, reject) => {
- _parseCs().then((cs) => {
- let ikey = _config.instrumentationKey;
- ikey = cs && cs.instrumentationkey || ikey;
- resolve(ikey);
- }).catch((e) => {
- // parseCs will always resolve(unless timeout)
- // return null in case any error happens
- resolve(null);
+ doAwaitResponse(_parseCs(_config, configCs), (rsp) => {
+ if (!rsp.rejected) {
+ let ikey = _config.instrumentationKey;
+ let cs = rsp.value;
+ ikey = cs && cs.instrumentationkey || ikey;
+ resolve(ikey);
+ } else {
+ // parseCs will always resolve(unless timeout)
+ // return null in case any error happens
+ resolve(null);
+ }
});
-
});
let url: IPromise | string = _config.userOverrideEndpointUrl;
if (isNullOrUndefined(url)) {
url = createSyncPromise((resolve, reject) => {
- _parseCs().then((cs) => {
- let url = _config.endpointUrl;
- let ingest = cs && cs.ingestionendpoint;
- url = ingest? ingest + DEFAULT_BREEZE_PATH : url;
- resolve(url);
- }).catch((e) => {
- // parseCs will always resolve(unless timeout)
- // return null in case any error happens
- resolve(null);
+ doAwaitResponse(_parseCs(_config, configCs), (rsp) => {
+ if (!rsp.rejected) {
+ let url = _config.endpointUrl;
+ let cs = rsp.value;
+ let ingest = cs && cs.ingestionendpoint;
+ url = ingest? ingest + DEFAULT_BREEZE_PATH : url;
+ resolve(url);
+ } else {
+ // parseCs will always resolve(unless timeout)
+ // return null in case any error happens
+ resolve(null);
+ }
});
-
});
}
_config.instrumentationKey = ikeyPromise;
_config.endpointUrl = url;
-
}
+
if (isString(configCs) && configCs) {
// confirm if promiselike function present
// handle cs promise here
diff --git a/shared/AppInsightsCore/src/JavaScriptSDK/AppInsightsCore.ts b/shared/AppInsightsCore/src/JavaScriptSDK/AppInsightsCore.ts
index 8c06d42db..53801d16c 100644
--- a/shared/AppInsightsCore/src/JavaScriptSDK/AppInsightsCore.ts
+++ b/shared/AppInsightsCore/src/JavaScriptSDK/AppInsightsCore.ts
@@ -348,121 +348,11 @@ export class AppInsightsCore im
// This will be "re-run" if the referenced config properties are changed
_addUnloadHook(_configHandler.watch((details) => {
let rootCfg = details.cfg;
-
- let isPending = _activeStatus === eActiveStatus.PENDING;
-
- if (isPending){
- // means waiting for previous promises to be resolved, won't apply new changes
- return;
- }
_initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize;
- // app Insights core only handle ikey and endpointurl, aisku will handle cs
- let ikey = rootCfg.instrumentationKey;
- let endpointUrl = rootCfg.endpointUrl; // do not need to validate endpoint url, if it is null, default one will be set by sender
-
- if (isNullOrUndefined(ikey)) {
- _instrumentationKey = null;
- // if new ikey is null, set status to be inactive, all new events will be saved in memory or dropped
- _activeStatus = ActiveStatus.INACTIVE;
- let msg = "Please provide instrumentation key";
-
- if (!_isInitialized) {
- // only throw error during initialization
- throwError(msg);
- } else {
- _throwInternal(_logger, eLoggingSeverity.CRITICAL, _eInternalMessageId.InvalidInstrumentationKey, msg);
- _releaseQueues();
- }
- return;
-
- }
-
- let promises: IPromise[] = [];
- if (isPromiseLike(ikey)) {
- promises.push(ikey);
- _instrumentationKey = null; // reset current local ikey variable (otherwise it will always be the previous ikeys if timeout is called before promise cb)
- } else {
- // string
- _instrumentationKey = ikey;
- }
-
- if (isPromiseLike(endpointUrl)) {
- promises.push(endpointUrl);
- _endpoint = null; // reset current local endpoint variable (otherwise it will always be the previous urls if timeout is called before promise cb)
- } else {
- // string or null
- _endpoint = endpointUrl;
- }
-
- // at least have one promise
- if (promises.length) {
- // reset to false for new dynamic changes
- _isStatusSet = false;
- _activeStatus = eActiveStatus.PENDING;
- let initTimeout = isNotNullOrUndefined(rootCfg.initTimeOut)? rootCfg.initTimeOut : maxInitTimeout; // rootCfg.initTimeOut could be 0
- let allPromises = createSyncAllSettledPromise(promises);
- _initTimer = scheduleTimeout(() => {
- // set _isStatusSet to true
- // set active status
- // release queues
- _initTimer = null;
- if (!_isStatusSet) {
- _setStatus();
- }
-
- }, initTimeout);
-
- doAwaitResponse(allPromises, (response) => {
- try {
- if (_isStatusSet) {
- // promises take too long to resolve, ignore them
- // active status should be set by timeout already
- return;
- }
-
- if (!response.rejected) {
- let values = response.value;
- if (values && values.length) {
- // ikey
- let ikeyRes = values[0];
- _instrumentationKey = ikeyRes && ikeyRes.value;
-
- // endpoint
- if (values.length > 1) {
- let endpointRes = values[1];
- _endpoint = endpointRes && endpointRes.value;
-
- }
-
- }
- if (_instrumentationKey) {
- // if ikey is null, no need to trigger extra dynamic changes for extensions
- config.instrumentationKey = _instrumentationKey; // set config.instrumentationKey for extensions to consume
- config.endpointUrl = _endpoint; // set config.endpointUrl for extensions to consume
- }
-
- }
-
- // set _isStatusSet to true
- // set active status
- // release queues
- _setStatus();
-
- } catch (e) {
- if (!_isStatusSet){
- _setStatus();
- }
- }
-
- });
- } else {
- // means no promises
- _setStatus();
-
- }
+
+ _handleIKeyEndpointPromises(rootCfg);
- //_instrumentationKey = details.cfg.instrumentationKey;
// Mark the extensionConfig and all first level keys as referenced
// This is so that calls to getExtCfg() will always return the same object
// Even when a user may "re-assign" the plugin properties (or it's unloaded/reloaded)
@@ -470,8 +360,6 @@ export class AppInsightsCore im
objForEachKey(extCfg, (key) => {
details.ref(extCfg, key);
});
-
-
}));
_notificationManager = notificationManager;
@@ -647,6 +535,124 @@ export class AppInsightsCore im
return _startLogPoller(true);
};
+ function _handleIKeyEndpointPromises(theConfig: IConfiguration) {
+ // app Insights core only handle ikey and endpointurl, aisku will handle cs
+ // But we want to reference these config values so that if any future changes are made
+ // this will trigger the re-run of the watch function
+ // and the ikey and endpointUrl will be set to the new values
+ let ikey = theConfig.instrumentationKey;
+ let endpointUrl = theConfig.endpointUrl; // do not need to validate endpoint url, if it is null, default one will be set by sender
+
+ // Check if we are waiting for previous promises to be resolved, won't apply new changes
+ if (_activeStatus !== eActiveStatus.PENDING) {
+ if (isNullOrUndefined(ikey)) {
+ _instrumentationKey = null;
+
+ // if new ikey is null, set status to be inactive, all new events will be saved in memory or dropped
+ _activeStatus = ActiveStatus.INACTIVE;
+ let msg = "Please provide instrumentation key";
+
+ if (!_isInitialized) {
+ // only throw error during initialization
+ throwError(msg);
+ } else {
+ _throwInternal(_logger, eLoggingSeverity.CRITICAL, _eInternalMessageId.InvalidInstrumentationKey, msg);
+ _releaseQueues();
+ }
+
+ return;
+ }
+
+ let promises: IPromise[] = [];
+ if (isPromiseLike(ikey)) {
+ promises.push(ikey);
+ _instrumentationKey = null; // reset current local ikey variable (otherwise it will always be the previous ikeys if timeout is called before promise cb)
+ } else {
+ // string
+ _instrumentationKey = ikey;
+ }
+
+ if (isPromiseLike(endpointUrl)) {
+ promises.push(endpointUrl);
+ _endpoint = null; // reset current local endpoint variable (otherwise it will always be the previous urls if timeout is called before promise cb)
+ } else {
+ // string or null
+ _endpoint = endpointUrl;
+ }
+
+ // at least have one promise
+ if (promises.length) {
+ _waitForInitPromises(theConfig, promises);
+ } else {
+ // means no promises
+ _setStatus();
+ }
+ }
+ }
+
+ function _waitForInitPromises(theConfig: IConfiguration, promises: IPromise[]) {
+ // reset to false for new dynamic changes
+ _isStatusSet = false;
+ _activeStatus = eActiveStatus.PENDING;
+ let initTimeout = isNotNullOrUndefined(theConfig.initTimeOut)? theConfig.initTimeOut : maxInitTimeout; // theConfig.initTimeOut could be 0
+ let allPromises = createSyncAllSettledPromise(promises);
+
+ if (_initTimer) {
+ // Stop any previous timer
+ _initTimer.cancel();
+ }
+
+ _initTimer = scheduleTimeout(() => {
+ // set _isStatusSet to true
+ // set active status
+ // release queues
+ _initTimer = null;
+ if (!_isStatusSet) {
+ _setStatus();
+ }
+ }, initTimeout);
+
+ doAwaitResponse(allPromises, (response) => {
+ try {
+ if (_isStatusSet) {
+ // promises take too long to resolve, ignore them
+ // active status should be set by timeout already
+ return;
+ }
+
+ if (!response.rejected) {
+ let values = response.value;
+ if (values && values.length) {
+ // ikey
+ let ikeyRes = values[0];
+ _instrumentationKey = ikeyRes && ikeyRes.value;
+
+ // endpoint
+ if (values.length > 1) {
+ let endpointRes = values[1];
+ _endpoint = endpointRes && endpointRes.value;
+ }
+ }
+
+ if (_instrumentationKey) {
+ // if ikey is null, no need to trigger extra dynamic changes for extensions
+ theConfig.instrumentationKey = _instrumentationKey; // set config.instrumentationKey for extensions to consume
+ theConfig.endpointUrl = _endpoint; // set config.endpointUrl for extensions to consume
+ }
+ }
+
+ // set _isStatusSet to true
+ // set active status
+ // release queues
+ _setStatus();
+ } catch (e) {
+ if (!_isStatusSet){
+ _setStatus();
+ }
+ }
+ });
+ }
+
function _setStatus() {
_isStatusSet = true;
if (isNullOrUndefined(_instrumentationKey)) {
From 10053b1bad32796e22d663573d6d88ebc52e9662 Mon Sep 17 00:00:00 2001
From: siyuniu-ms <123212536+siyuniu-ms@users.noreply.github.com>
Date: Wed, 9 Apr 2025 15:52:46 -0700
Subject: [PATCH 11/72] [chrome debug tool] publish 0.8.0 for manifect V3
(#2499)
---
tools/chrome-debug-extension/package.json | 2 +-
version.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/chrome-debug-extension/package.json b/tools/chrome-debug-extension/package.json
index 2adc08d3b..895fafbed 100644
--- a/tools/chrome-debug-extension/package.json
+++ b/tools/chrome-debug-extension/package.json
@@ -1,6 +1,6 @@
{
"name": "@microsoft/applicationinsights-chrome-debug-extension",
- "version": "0.7.6",
+ "version": "0.8.0",
"description": "A chrome based browser extension that provides a real time view of what's happening in Application Insights including what telemetry is being logged by the web application",
"homepage": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/tools/chrome-debug-extension#readme",
"keywords": [
diff --git a/version.json b/version.json
index 266e69773..b8c988482 100644
--- a/version.json
+++ b/version.json
@@ -58,7 +58,7 @@
},
"@microsoft/applicationinsights-chrome-debug-extension": {
"package": "tools/chrome-debug-extension/package.json",
- "release": "0.7.6"
+ "release": "0.8.0"
},
"applicationinsights-web-config": {
"package": "tools/config/package.json",
From a8d229e1d8c21d3a3906ee9db936f17db1cad216 Mon Sep 17 00:00:00 2001
From: Karlie-777 <79606506+Karlie-777@users.noreply.github.com>
Date: Wed, 16 Apr 2025 18:37:29 -0700
Subject: [PATCH 12/72] [Main][Task]31233527:Change Default
RequestSizeLimitBytes (#2501)
* add post channel config
* update
* udpate
* update
* update
* update
* udpate
* update
* update
* update
---
AISKU/Tests/Unit/src/AISKUSize.Tests.ts | 4 +-
.../Tests/Unit/src/AISKULightSize.Tests.ts | 4 +-
channels/1ds-post-js/src/HttpManager.ts | 2 +-
channels/1ds-post-js/src/Serializer.ts | 3 +-
common/config/rush/npm-shrinkwrap.json | 258 ++++++++++--------
.../Unit/src/AnalyticsExtensionSize.tests.ts | 2 +-
.../test/Unit/src/FileSizeCheckTest.ts | 2 +-
.../Unit/src/AppInsightsCoreSize.Tests.ts | 4 +-
8 files changed, 151 insertions(+), 128 deletions(-)
diff --git a/AISKU/Tests/Unit/src/AISKUSize.Tests.ts b/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
index a1a231906..638a76ce8 100644
--- a/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
+++ b/AISKU/Tests/Unit/src/AISKUSize.Tests.ts
@@ -54,8 +54,8 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}
export class AISKUSizeCheck extends AITestClass {
- private readonly MAX_RAW_SIZE = 145;
- private readonly MAX_BUNDLE_SIZE = 145;
+ 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 rawFilePath = "../dist/es5/applicationinsights-web.min.js";
diff --git a/AISKULight/Tests/Unit/src/AISKULightSize.Tests.ts b/AISKULight/Tests/Unit/src/AISKULightSize.Tests.ts
index 80cf44a22..ab5e74f0b 100644
--- a/AISKULight/Tests/Unit/src/AISKULightSize.Tests.ts
+++ b/AISKULight/Tests/Unit/src/AISKULightSize.Tests.ts
@@ -51,8 +51,8 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}
export class AISKULightSizeCheck extends AITestClass {
- private readonly MAX_RAW_SIZE = 91;
- private readonly MAX_BUNDLE_SIZE = 91;
+ private readonly MAX_RAW_SIZE = 92;
+ private readonly MAX_BUNDLE_SIZE = 92;
private readonly MAX_RAW_DEFLATE_SIZE = 38;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 38;
private readonly rawFilePath = "../dist/es5/applicationinsights-web-basic.min.js";
diff --git a/channels/1ds-post-js/src/HttpManager.ts b/channels/1ds-post-js/src/HttpManager.ts
index bb3caf047..a27121ede 100644
--- a/channels/1ds-post-js/src/HttpManager.ts
+++ b/channels/1ds-post-js/src/HttpManager.ts
@@ -774,7 +774,7 @@ export class HttpManager {
// Make sure we have a payload object
thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous, isReducedPayload, sendReason, sendType);
-
+
// Add the batch to the current payload
if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {
// Entire batch was not added so send the payload and retry adding this batch
diff --git a/channels/1ds-post-js/src/Serializer.ts b/channels/1ds-post-js/src/Serializer.ts
index 821eb0b91..8b688eca6 100644
--- a/channels/1ds-post-js/src/Serializer.ts
+++ b/channels/1ds-post-js/src/Serializer.ts
@@ -30,7 +30,8 @@ import { mathMin, strSubstr } from "@nevware21/ts-utils";
*/
const _MAX_STRING_JOINS = 20;
-const RequestSizeLimitBytes = 3984588; // approx 3.8 Mb
+// Max Size set by One Collector: https://msazure.visualstudio.com/OneDsCollector/_git/Collector?path=/Services/Azure/CollectorWorkerRoleAzure/ServiceConfiguration.Cloud.cscfg
+const RequestSizeLimitBytes = 3145728; // approx 3.15 Mb
const BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)
const MaxRecordSize = 2000000; // approx 2 Mb
const MaxBeaconRecordSize = mathMin(MaxRecordSize, BeaconRequestSizeLimitBytes);
diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json
index 6ae4cff99..b843d7618 100644
--- a/common/config/rush/npm-shrinkwrap.json
+++ b/common/config/rush/npm-shrinkwrap.json
@@ -183,9 +183,9 @@
}
},
"node_modules/@eslint-community/eslint-utils": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz",
- "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==",
+ "version": "4.6.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.6.1.tgz",
+ "integrity": "sha512-KTsJMmobmbrFLe3LDh0PC2FXpcSYJt/MLjlkh/9LEnmKYLSYmT/0EW9JWANjeoemiuZrmogti0tW5Ch+qNUYDw==",
"peer": true,
"dependencies": {
"eslint-visitor-keys": "^3.4.3"
@@ -210,9 +210,9 @@
}
},
"node_modules/@eslint/config-array": {
- "version": "0.19.2",
- "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz",
- "integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==",
+ "version": "0.20.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.20.0.tgz",
+ "integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==",
"peer": true,
"dependencies": {
"@eslint/object-schema": "^2.1.6",
@@ -235,6 +235,15 @@
"node": "*"
}
},
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.1.tgz",
+ "integrity": "sha512-RI17tsD2frtDu/3dmI7QRrD4bedNKPM08ziRYaC5AhkGrzIAJelm9kJU1TznK+apx6V+cqRz8tfpEeG3oIyjxw==",
+ "peer": true,
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
"node_modules/@eslint/core": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.12.0.tgz",
@@ -248,9 +257,9 @@
}
},
"node_modules/@eslint/eslintrc": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.0.tgz",
- "integrity": "sha512-yaVPAiNAalnCZedKLdR21GOGILMLKPyqSLWaAjQFvYA2i/ciDi8ArYVr69Anohb6cH2Ukhqti4aFnYyPm8wdwQ==",
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz",
+ "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==",
"peer": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -305,9 +314,9 @@
}
},
"node_modules/@eslint/js": {
- "version": "9.21.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.21.0.tgz",
- "integrity": "sha512-BqStZ3HX8Yz6LvsF5ByXYrtigrV5AXADWLAGc7PH/1SxOb7/FIYYMszZZWiUou/GB9P2lXWk2SV4d+Z8h0nknw==",
+ "version": "9.24.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.24.0.tgz",
+ "integrity": "sha512-uIY/y3z0uvOGX8cp1C2fiC4+ZmBhp6yZWkojtHL1YEMnRt1Y63HB9TM17proGEmeG7HeUY+UP36F0aknKYTpYA==",
"peer": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -323,18 +332,30 @@
}
},
"node_modules/@eslint/plugin-kit": {
- "version": "0.2.7",
- "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.7.tgz",
- "integrity": "sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==",
+ "version": "0.2.8",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.8.tgz",
+ "integrity": "sha512-ZAoA40rNMPwSm+AeHpCq8STiNAwzWLJuP8Xv4CHIc9wv/PSuExjMrmjfYNj682vW0OOiZ1HKxzvjQr9XZIisQA==",
"peer": true,
"dependencies": {
- "@eslint/core": "^0.12.0",
+ "@eslint/core": "^0.13.0",
"levn": "^0.4.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
+ "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
+ "version": "0.13.0",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.13.0.tgz",
+ "integrity": "sha512-yfkgDw1KR66rkT5A8ci4irzDysN7FRpq3ttJolR88OqQikAWqwA8j5VZyas+vjyBNFIJ7MfybJ9plMILI2UrCw==",
+ "peer": true,
+ "dependencies": {
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@@ -402,42 +423,42 @@
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="
},
"node_modules/@microsoft/api-extractor": {
- "version": "7.51.1",
- "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.51.1.tgz",
- "integrity": "sha512-VoFvIeYXme8QctXDkixy1KIn750kZaFy2snAEOB3nhDFfbBcJNEcvBrpCIQIV09MqI4g9egKUkg+/12WMRC77w==",
+ "version": "7.52.3",
+ "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.52.3.tgz",
+ "integrity": "sha512-QEs6l8h7p9eOSHrQ9NBBUZhUuq+j/2QKcRgigbSs2YQepKz8glvsqmsUOp+nvuaY60ps7KkpVVYQCj81WLoMVQ==",
"dependencies": {
- "@microsoft/api-extractor-model": "7.30.3",
+ "@microsoft/api-extractor-model": "7.30.5",
"@microsoft/tsdoc": "~0.15.1",
"@microsoft/tsdoc-config": "~0.17.1",
- "@rushstack/node-core-library": "5.11.0",
+ "@rushstack/node-core-library": "5.13.0",
"@rushstack/rig-package": "0.5.3",
- "@rushstack/terminal": "0.15.0",
- "@rushstack/ts-command-line": "4.23.5",
+ "@rushstack/terminal": "0.15.2",
+ "@rushstack/ts-command-line": "4.23.7",
"lodash": "~4.17.15",
"minimatch": "~3.0.3",
"resolve": "~1.22.1",
"semver": "~7.5.4",
"source-map": "~0.6.1",
- "typescript": "5.7.3"
+ "typescript": "5.8.2"
},
"bin": {
"api-extractor": "bin/api-extractor"
}
},
"node_modules/@microsoft/api-extractor-model": {
- "version": "7.30.3",
- "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.30.3.tgz",
- "integrity": "sha512-yEAvq0F78MmStXdqz9TTT4PZ05Xu5R8nqgwI5xmUmQjWBQ9E6R2n8HB/iZMRciG4rf9iwI2mtuQwIzDXBvHn1w==",
+ "version": "7.30.5",
+ "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.30.5.tgz",
+ "integrity": "sha512-0ic4rcbcDZHz833RaTZWTGu+NpNgrxVNjVaor0ZDUymfDFzjA/Uuk8hYziIUIOEOSTfmIQqyzVwlzxZxPe7tOA==",
"dependencies": {
"@microsoft/tsdoc": "~0.15.1",
"@microsoft/tsdoc-config": "~0.17.1",
- "@rushstack/node-core-library": "5.11.0"
+ "@rushstack/node-core-library": "5.13.0"
}
},
"node_modules/@microsoft/api-extractor/node_modules/typescript": {
- "version": "5.7.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
- "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
+ "version": "5.8.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
+ "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -516,9 +537,9 @@
}
},
"node_modules/@nevware21/ts-utils": {
- "version": "0.11.8",
- "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.11.8.tgz",
- "integrity": "sha512-62Y1mHgSu99IK4BRKC3sxdj/uIBHy6SDof3WUd29jom2HQy8sGCUdbYtFwMOkbUS6rahkL11Eg/ImtwsQsCnyw=="
+ "version": "0.12.1",
+ "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.12.1.tgz",
+ "integrity": "sha512-rAoErmxI9IW5BKGp8WK1FPG6dqGmxDjArgMxAf+It/+z8FQ5y9d/yDcPNNBfwY6QGpHqSaHRHFt083+L9uh7eg=="
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
@@ -1404,9 +1425,9 @@
}
},
"node_modules/@rushstack/node-core-library": {
- "version": "5.11.0",
- "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.11.0.tgz",
- "integrity": "sha512-I8+VzG9A0F3nH2rLpPd7hF8F7l5Xb7D+ldrWVZYegXM6CsKkvWc670RlgK3WX8/AseZfXA/vVrh0bpXe2Y2UDQ==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.13.0.tgz",
+ "integrity": "sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg==",
"dependencies": {
"ajv": "~8.13.0",
"ajv-draft-04": "~1.0.0",
@@ -1451,11 +1472,11 @@
}
},
"node_modules/@rushstack/terminal": {
- "version": "0.15.0",
- "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.15.0.tgz",
- "integrity": "sha512-vXQPRQ+vJJn4GVqxkwRe+UGgzNxdV8xuJZY2zem46Y0p3tlahucH9/hPmLGj2i9dQnUBFiRnoM9/KW7PYw8F4Q==",
+ "version": "0.15.2",
+ "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.15.2.tgz",
+ "integrity": "sha512-7Hmc0ysK5077R/IkLS9hYu0QuNafm+TbZbtYVzCMbeOdMjaRboLKrhryjwZSRJGJzu+TV1ON7qZHeqf58XfLpA==",
"dependencies": {
- "@rushstack/node-core-library": "5.11.0",
+ "@rushstack/node-core-library": "5.13.0",
"supports-color": "~8.1.1"
},
"peerDependencies": {
@@ -1468,11 +1489,11 @@
}
},
"node_modules/@rushstack/ts-command-line": {
- "version": "4.23.5",
- "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.5.tgz",
- "integrity": "sha512-jg70HfoK44KfSP3MTiL5rxsZH7X1ktX3cZs9Sl8eDu1/LxJSbPsh0MOFRC710lIuYYSgxWjI5AjbCBAl7u3RxA==",
+ "version": "4.23.7",
+ "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.7.tgz",
+ "integrity": "sha512-Gr9cB7DGe6uz5vq2wdr89WbVDKz0UeuFEn5H2CfWDe7JvjFFaiV15gi6mqDBTbHhHCWS7w8mF1h3BnIfUndqdA==",
"dependencies": {
- "@rushstack/terminal": "0.15.0",
+ "@rushstack/terminal": "0.15.2",
"@types/argparse": "1.0.38",
"argparse": "~1.0.9",
"string-argv": "~0.3.1"
@@ -1620,9 +1641,9 @@
}
},
"node_modules/@types/estree": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
+ "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="
},
"node_modules/@types/file-saver": {
"version": "2.0.7",
@@ -1730,9 +1751,9 @@
"integrity": "sha512-II+C1wgzUia0g+tGAH+PBb4XiTm8/C/i6sN23r21NNskBYOYrv+qnW0tFQ/IxZzKVwrK4CTglf8YO3poJUclQA=="
},
"node_modules/@types/react": {
- "version": "16.14.62",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.62.tgz",
- "integrity": "sha512-BWf7hqninZav6nerxXj+NeZT/mTpDeG6Lk2zREHAy63CrnXoOGPGtNqTFYFN/sqpSaREDP5otVV88axIXmKfGA==",
+ "version": "16.14.63",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.63.tgz",
+ "integrity": "sha512-s83gano0fRBVEw3ejdLpjgvU83F0LIeeuXqdxfPZF/Sc2bhr60tEqCK1zZ+aLirBwRSD6V5zCtOsEjcwKow3JQ==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "^0.16",
@@ -1785,16 +1806,16 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.26.0.tgz",
- "integrity": "sha512-cLr1J6pe56zjKYajK6SSSre6nl1Gj6xDp1TY0trpgPzjVbgDwd09v2Ws37LABxzkicmUjhEeg/fAUjPJJB1v5Q==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.30.1.tgz",
+ "integrity": "sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==",
"peer": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
- "@typescript-eslint/scope-manager": "8.26.0",
- "@typescript-eslint/type-utils": "8.26.0",
- "@typescript-eslint/utils": "8.26.0",
- "@typescript-eslint/visitor-keys": "8.26.0",
+ "@typescript-eslint/scope-manager": "8.30.1",
+ "@typescript-eslint/type-utils": "8.30.1",
+ "@typescript-eslint/utils": "8.30.1",
+ "@typescript-eslint/visitor-keys": "8.30.1",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@@ -1814,15 +1835,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.26.0.tgz",
- "integrity": "sha512-mNtXP9LTVBy14ZF3o7JG69gRPBK/2QWtQd0j0oH26HcY/foyJJau6pNUez7QrM5UHnSvwlQcJXKsk0I99B9pOA==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.30.1.tgz",
+ "integrity": "sha512-H+vqmWwT5xoNrXqWs/fesmssOW70gxFlgcMlYcBaWNPIEWDgLa4W9nkSPmhuOgLnXq9QYgkZ31fhDyLhleCsAg==",
"peer": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "8.26.0",
- "@typescript-eslint/types": "8.26.0",
- "@typescript-eslint/typescript-estree": "8.26.0",
- "@typescript-eslint/visitor-keys": "8.26.0",
+ "@typescript-eslint/scope-manager": "8.30.1",
+ "@typescript-eslint/types": "8.30.1",
+ "@typescript-eslint/typescript-estree": "8.30.1",
+ "@typescript-eslint/visitor-keys": "8.30.1",
"debug": "^4.3.4"
},
"engines": {
@@ -1838,13 +1859,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.26.0.tgz",
- "integrity": "sha512-E0ntLvsfPqnPwng8b8y4OGuzh/iIOm2z8U3S9zic2TeMLW61u5IH2Q1wu0oSTkfrSzwbDJIB/Lm8O3//8BWMPA==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.30.1.tgz",
+ "integrity": "sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==",
"peer": true,
"dependencies": {
- "@typescript-eslint/types": "8.26.0",
- "@typescript-eslint/visitor-keys": "8.26.0"
+ "@typescript-eslint/types": "8.30.1",
+ "@typescript-eslint/visitor-keys": "8.30.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1855,13 +1876,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.26.0.tgz",
- "integrity": "sha512-ruk0RNChLKz3zKGn2LwXuVoeBcUMh+jaqzN461uMMdxy5H9epZqIBtYj7UiPXRuOpaALXGbmRuZQhmwHhaS04Q==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.30.1.tgz",
+ "integrity": "sha512-64uBF76bfQiJyHgZISC7vcNz3adqQKIccVoKubyQcOnNcdJBvYOILV1v22Qhsw3tw3VQu5ll8ND6hycgAR5fEA==",
"peer": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "8.26.0",
- "@typescript-eslint/utils": "8.26.0",
+ "@typescript-eslint/typescript-estree": "8.30.1",
+ "@typescript-eslint/utils": "8.30.1",
"debug": "^4.3.4",
"ts-api-utils": "^2.0.1"
},
@@ -1878,9 +1899,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.26.0.tgz",
- "integrity": "sha512-89B1eP3tnpr9A8L6PZlSjBvnJhWXtYfZhECqlBl1D9Lme9mHO6iWlsprBtVenQvY1HMhax1mWOjhtL3fh/u+pA==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.30.1.tgz",
+ "integrity": "sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==",
"peer": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1891,13 +1912,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.26.0.tgz",
- "integrity": "sha512-tiJ1Hvy/V/oMVRTbEOIeemA2XoylimlDQ03CgPPNaHYZbpsc78Hmngnt+WXZfJX1pjQ711V7g0H7cSJThGYfPQ==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.30.1.tgz",
+ "integrity": "sha512-kQQnxymiUy9tTb1F2uep9W6aBiYODgq5EMSk6Nxh4Z+BDUoYUSa029ISs5zTzKBFnexQEh71KqwjKnRz58lusQ==",
"peer": true,
"dependencies": {
- "@typescript-eslint/types": "8.26.0",
- "@typescript-eslint/visitor-keys": "8.26.0",
+ "@typescript-eslint/types": "8.30.1",
+ "@typescript-eslint/visitor-keys": "8.30.1",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@@ -1953,15 +1974,15 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.26.0.tgz",
- "integrity": "sha512-2L2tU3FVwhvU14LndnQCA2frYC8JnPDVKyQtWFPf8IYFMt/ykEN1bPolNhNbCVgOmdzTlWdusCTKA/9nKrf8Ig==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.30.1.tgz",
+ "integrity": "sha512-T/8q4R9En2tcEsWPQgB5BQ0XJVOtfARcUvOa8yJP3fh9M/mXraLxZrkCfGb6ChrO/V3W+Xbd04RacUEqk1CFEQ==",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
- "@typescript-eslint/scope-manager": "8.26.0",
- "@typescript-eslint/types": "8.26.0",
- "@typescript-eslint/typescript-estree": "8.26.0"
+ "@typescript-eslint/scope-manager": "8.30.1",
+ "@typescript-eslint/types": "8.30.1",
+ "@typescript-eslint/typescript-estree": "8.30.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1976,12 +1997,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "8.26.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.26.0.tgz",
- "integrity": "sha512-2z8JQJWAzPdDd51dRQ/oqIJxe99/hoLIqmf8RMCAJQtYDc535W/Jt2+RTP4bP0aKeBG1F65yjIZuczOXCmbWwg==",
+ "version": "8.30.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.30.1.tgz",
+ "integrity": "sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==",
"peer": true,
"dependencies": {
- "@typescript-eslint/types": "8.26.0",
+ "@typescript-eslint/types": "8.30.1",
"eslint-visitor-keys": "^4.2.0"
},
"engines": {
@@ -2015,9 +2036,9 @@
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"node_modules/acorn": {
- "version": "8.14.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
- "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
+ "version": "8.14.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
+ "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
"peer": true,
"bin": {
"acorn": "bin/acorn"
@@ -2450,9 +2471,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001701",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz",
- "integrity": "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw==",
+ "version": "1.0.30001714",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001714.tgz",
+ "integrity": "sha512-mtgapdwDLSSBnCI3JokHM7oEQBLxiJKVRtg10AxM1AyeiKcM96f0Mkbqeq+1AbiCtvMcHRulAAEMu693JrSWqg==",
"funding": [
{
"type": "opencollective",
@@ -2898,9 +2919,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
- "version": "1.5.110",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.110.tgz",
- "integrity": "sha512-/p/OvOm6AfLtQteAHTUWwf+Vhh76PlluagzQlSnxMoOJ4R6SmAScWBrVev6rExJoUhP9zudN9+lBxoYUEmC1HQ=="
+ "version": "1.5.137",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.137.tgz",
+ "integrity": "sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA=="
},
"node_modules/emoji-regex-xs": {
"version": "1.0.0",
@@ -2968,17 +2989,18 @@
}
},
"node_modules/eslint": {
- "version": "9.21.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.21.0.tgz",
- "integrity": "sha512-KjeihdFqTPhOMXTt7StsDxriV4n66ueuF/jfPNC3j/lduHwr/ijDwJMsF+wyMJethgiKi5wniIE243vi07d3pg==",
+ "version": "9.24.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.24.0.tgz",
+ "integrity": "sha512-eh/jxIEJyZrvbWRe4XuVclLPDYSYYYgLy5zXGGxD6j8zjSAxFEzI2fL/8xNq6O2yKqVt+eF2YhV+hxjV6UKXwQ==",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.12.1",
- "@eslint/config-array": "^0.19.2",
+ "@eslint/config-array": "^0.20.0",
+ "@eslint/config-helpers": "^0.2.0",
"@eslint/core": "^0.12.0",
- "@eslint/eslintrc": "^3.3.0",
- "@eslint/js": "9.21.0",
+ "@eslint/eslintrc": "^3.3.1",
+ "@eslint/js": "9.24.0",
"@eslint/plugin-kit": "^0.2.7",
"@humanfs/node": "^0.16.6",
"@humanwhocodes/module-importer": "^1.0.1",
@@ -2990,7 +3012,7 @@
"cross-spawn": "^7.0.6",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
- "eslint-scope": "^8.2.0",
+ "eslint-scope": "^8.3.0",
"eslint-visitor-keys": "^4.2.0",
"espree": "^10.3.0",
"esquery": "^1.5.0",
@@ -3054,9 +3076,9 @@
}
},
"node_modules/eslint-scope": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz",
- "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==",
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz",
+ "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==",
"peer": true,
"dependencies": {
"esrecurse": "^4.3.0",
@@ -6560,9 +6582,9 @@
}
},
"node_modules/ts-api-utils": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz",
- "integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
+ "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
"peer": true,
"engines": {
"node": ">=18.12"
@@ -6653,9 +6675,9 @@
}
},
"node_modules/typedoc/node_modules/yaml": {
- "version": "2.7.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz",
- "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==",
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz",
+ "integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==",
"bin": {
"yaml": "bin.mjs"
},
diff --git a/extensions/applicationinsights-analytics-js/Tests/Unit/src/AnalyticsExtensionSize.tests.ts b/extensions/applicationinsights-analytics-js/Tests/Unit/src/AnalyticsExtensionSize.tests.ts
index d72053af7..f61505caf 100644
--- a/extensions/applicationinsights-analytics-js/Tests/Unit/src/AnalyticsExtensionSize.tests.ts
+++ b/extensions/applicationinsights-analytics-js/Tests/Unit/src/AnalyticsExtensionSize.tests.ts
@@ -51,7 +51,7 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}
export class AnalyticsExtensionSizeCheck extends AITestClass {
- private readonly MAX_DEFLATE_SIZE = 24;
+ private readonly MAX_DEFLATE_SIZE = 25;
private readonly rawFilePath = "../dist/es5/applicationinsights-analytics-js.min.js";
private readonly prodFilePaath = "../browser/es5/applicationinsights-analytics-js.min.js"
diff --git a/shared/1ds-core-js/test/Unit/src/FileSizeCheckTest.ts b/shared/1ds-core-js/test/Unit/src/FileSizeCheckTest.ts
index bac557272..d2fa9d3ac 100644
--- a/shared/1ds-core-js/test/Unit/src/FileSizeCheckTest.ts
+++ b/shared/1ds-core-js/test/Unit/src/FileSizeCheckTest.ts
@@ -51,7 +51,7 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}
export class FileSizeCheckTest extends AITestClass {
- private readonly MAX_BUNDLE_SIZE = 68;
+ private readonly MAX_BUNDLE_SIZE = 69;
private readonly MAX_DEFLATE_SIZE = 29;
private readonly bundleFilePath = "../bundle/es5/ms.core.min.js";
diff --git a/shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts b/shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts
index a624e8008..c8da7b41d 100644
--- a/shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts
+++ b/shared/AppInsightsCore/Tests/Unit/src/AppInsightsCoreSize.Tests.ts
@@ -51,8 +51,8 @@ function _checkSize(checkType: string, maxSize: number, size: number, isNightly:
}
export class AppInsightsCoreSizeCheck extends AITestClass {
- private readonly MAX_RAW_SIZE = 65;
- private readonly MAX_BUNDLE_SIZE = 65;
+ private readonly MAX_RAW_SIZE = 67;
+ private readonly MAX_BUNDLE_SIZE = 67;
private readonly MAX_RAW_DEFLATE_SIZE = 28;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 28;
private readonly rawFilePath = "../dist/es5/applicationinsights-core-js.min.js";
From bb528091da3e21186ee3a7233171e9259db90858 Mon Sep 17 00:00:00 2001
From: siyuniu-ms <123212536+siyuniu-ms@users.noreply.github.com>
Date: Thu, 24 Apr 2025 15:37:25 -0700
Subject: [PATCH 13/72] [main][stats beat] implement stats beat in application
insights (#2489)
---
AISKU/Tests/Manual/testVersionConflict.html | 10 +-
.../Unit/src/applicationinsights.e2e.tests.ts | 2 +-
.../Tests/Unit/src/StatsBeat.tests.ts | 255 ++++++++++++++++
.../Tests/Unit/src/aichannel.tests.ts | 2 +
.../src/SendBuffer.ts | 2 +
.../src/Sender.ts | 92 ++++--
.../Tests/Unit/src/cfgsynchelper.tests.ts | 8 +-
.../Tests/Unit/src/StatsBeat.Tests.ts | 280 ++++++++++++++++++
.../Tests/Unit/src/aiunittests.ts | 3 +
.../IAppInsightsCore.ts | 3 +
.../IConfiguration.ts | 19 ++
.../JavaScriptSDK.Interfaces/IStatsBeat.ts | 16 +
.../IStatsBeatEvent.ts | 10 +
.../JavaScriptSDK.Interfaces/IXHROverride.ts | 1 -
.../src/JavaScriptSDK/AppInsightsCore.ts | 36 ++-
.../src/JavaScriptSDK/NetworkStatsbeat.ts | 22 ++
.../src/JavaScriptSDK/SenderPostManager.ts | 28 +-
.../src/JavaScriptSDK/StatsBeat.ts | 203 +++++++++++++
.../src/applicationinsights-core-js.ts | 2 +
19 files changed, 952 insertions(+), 42 deletions(-)
create mode 100644 channels/applicationinsights-channel-js/Tests/Unit/src/StatsBeat.tests.ts
create mode 100644 shared/AppInsightsCore/Tests/Unit/src/StatsBeat.Tests.ts
create mode 100644 shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/IStatsBeat.ts
create mode 100644 shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/IStatsBeatEvent.ts
create mode 100644 shared/AppInsightsCore/src/JavaScriptSDK/NetworkStatsbeat.ts
create mode 100644 shared/AppInsightsCore/src/JavaScriptSDK/StatsBeat.ts
diff --git a/AISKU/Tests/Manual/testVersionConflict.html b/AISKU/Tests/Manual/testVersionConflict.html
index 2b7f4ca0e..1e1b5e997 100644
--- a/AISKU/Tests/Manual/testVersionConflict.html
+++ b/AISKU/Tests/Manual/testVersionConflict.html
@@ -10,7 +10,8 @@
Microsoft Application Insights JavaScript SDK - AISKU
-
+ -->