Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[main] test version conflict and wirte documentation #2123

Merged
merged 6 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AISKU/Tests/Manual/ai1.test.js

Large diffs are not rendered by default.

10,741 changes: 10,741 additions & 0 deletions AISKU/Tests/Manual/ai2.test.js

Large diffs are not rendered by default.

12,065 changes: 12,065 additions & 0 deletions AISKU/Tests/Manual/ai3.test.js

Large diffs are not rendered by default.

12,207 changes: 12,207 additions & 0 deletions AISKU/Tests/Manual/aisku-example-index.gbl.js

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions AISKU/Tests/Manual/style/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
body {
margin: 0;
}

h1 {
font-size: 1.875rem;
margin: 0.67rem 0;
}

h2 {
font-size: 1.5rem;
margin: 0.83rem 0;
}

h3 {
font-size: 1.25rem;
margin: 1rem 0;
}

h4 {
font-size: 1.05rem;
margin: 1.33rem 0;
}

h5 {
font-size: 1rem;
margin: 1.5rem 0;
}

h6 {
font-size: 0.875rem;
margin: 0.3rem 0;
}

.uppercase {
text-transform: uppercase;
}

pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}

ol,
ul {
margin: 1em 0;
}

.container {
max-width: 1600px;
padding: 0 2rem;
}

.container-main {
justify-content: space-between;
font-size: 0.9rem;
position: relative;
margin: 1rem auto;
padding-left: 1rem;
background-color: azure;
overflow: auto;
max-height: 350px;
}


body {
font-family: "Segoe UI", sans-serif;
font-size: 16px;
padding-left: 1rem;
}

code,
pre {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
padding: 0.2em;
margin: 0;
font-size: 0.875rem;
border-radius: 0.8em;
}
button {
font-family: "Segoe UI", sans-serif;
margin: 0.5rem;
padding: 0.2em;
}

p{
font-size: 12px;
margin: 0;
}
28 changes: 28 additions & 0 deletions AISKU/Tests/Manual/testVersionConflict.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html lang="en">
<head>
<meta charset="utf-8">
<title>AISKU Sample</title>
<link rel="stylesheet" href="style/style.css"/>
<script type="text/javascript">
var connectionString = "YOUR_CONNECTION_STRING";
</script>


<!-- <script src="./ai3.test.js"></script> -->
<!-- <script src="./ai2.test.js"></script> -->
<script src="./ai3.test.js"></script>


</head>
<body>
<h1>Microsoft Application Insights JavaScript SDK - AISKU</h1>
<script>
let appInsights = new Microsoft.ApplicationInsights.ApplicationInsights({ config: {connectionString: "InstrumentationKey=88888888", disableInstrumentationKeyValidation: true}});
appInsights.loadAppInsights();
window.appInsights = appInsights;
</script>
<!-- <script src="aisku-example-index.gbl.js"></script> -->
</body>
</html>
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ ES3 support has been removed from the latest version (v3.x), if required [see fo
| [2.x](https://github.com/microsoft/ApplicationInsights-JS/tree/master)<br/><sub>(master)</sub> | Feature freeze from March '2023, security fixes and critical bugs only.<br />Supports adding / removing extensions and full unloading/removal of the SDK after initialization. Last version to support ES3 (IE8+), also provides a v1.x compatible API proxy layer for upgrading from V1.x.
| [1.0.x](https://github.com/microsoft/ApplicationInsights-JS/tree/legacy-v1)<br/><sub>(legacy-v1)</sub> | No longer actively maintained -- please Upgrade. The documentation for `applicationinsights-js@1.0.x` has moved [here](https://github.com/microsoft/ApplicationInsights-JS/tree/master/legacy/README.md). If you are looking to upgrade to the new version of the SDK, please see the [Upgrade Guide](https://microsoft.github.io/ApplicationInsights-JS/upgrade/v2_UpgradeGuide.html). | Not actively maintained, please upgrade.


> :bulb: **Note**
> When multiple instances of Application Insights with different major version are active within a single session, errors may arise. For further details, please refer to the [version conflict doc](./versionConflict.md).

## Getting Started

1. Create an Application Insights resource in Azure by following [these instructions](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-javascript?toc=/azure/azure-monitor/toc.json).
Expand Down
21 changes: 21 additions & 0 deletions versionConflict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Running multiple version in one session


If multiple instances of different versions of Application Insights are running on the same page, errors may occur. In this talbe, we have identified several common error messages that you might encounter.

| Script Ver | Snippet Context sdkversion | Microsoft.ai | ERROR MESSAGE | |
|------------|----------------------------|---------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|---|
| 2 -> 3 | 2 | core utils, should be v2<br>Mod is all v2 | Uncaught TypeError: Cannot read properties of undefined (reading 'disabbleFetchTracking') | |
| 3 -> 2 | 2 | core utils, should be v2<br>Mod is all v2 | TypeError: Cannot read properties of undefined (reading 'disabbleFetchTracking') | |
| 1 -> 3 | 3 | m.ai.version = 1<br>Inside mode, only RequestHeaders: "---", all other v3 | Dynamic config change fail | |
| 3 -> 1 | 3 | Mod all v3,function location is 3 | Uncaught TypeError: Cannot assign to read only property 'CRITICAL' of object '#<Object>'<br><br>Dynamic config change fail | |
| 1 -> 2 | 2 | m.ai.version = 1, mod all v2 | TypeError: Cannot read properties of undefined (reading 'disabbleFetchTracking') | |
| 2 -> 1 | 2 | core utils, should be v2<br>Mod is all v2 | Uncaught TypeError: Cannot read properties of undefined (reading 'disabbleFetchTracking') | |


Typiocal Error in console log:
1. Uncaught TypeError: Cannot assign to read only property 'CRITICAL' of object '#<Object>'
2. When using Dynamic config, get error meesage:
Uncaught TypeError: Cannot set property config of #<AppInsightsSku> which has only a getter


Loading