[AI][Task]17099792: Add sample and doc to dependency plugin (#1989)
* add sample and doc to dependency plugin * update dependency doc * update * add aisku sample * update * update examples * update * update example links
This commit is contained in:
Родитель
67f7ab1c1d
Коммит
044384b9b6
|
@ -26,6 +26,8 @@
|
|||
"@rush-temp/applicationinsights-core-js": "file:./projects/applicationinsights-core-js.tgz",
|
||||
"@rush-temp/applicationinsights-debugplugin-js": "file:./projects/applicationinsights-debugplugin-js.tgz",
|
||||
"@rush-temp/applicationinsights-dependencies-js": "file:./projects/applicationinsights-dependencies-js.tgz",
|
||||
"@rush-temp/applicationinsights-example-aisku": "file:./projects/applicationinsights-example-aisku.tgz",
|
||||
"@rush-temp/applicationinsights-example-dependencies": "file:./projects/applicationinsights-example-dependencies.tgz",
|
||||
"@rush-temp/applicationinsights-example-shared-worker": "file:./projects/applicationinsights-example-shared-worker.tgz",
|
||||
"@rush-temp/applicationinsights-js-release-tools": "file:./projects/applicationinsights-js-release-tools.tgz",
|
||||
"@rush-temp/applicationinsights-perfmarkmeasure-js": "file:./projects/applicationinsights-perfmarkmeasure-js.tgz",
|
||||
|
@ -169,9 +171,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
|
||||
"integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz",
|
||||
"integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
|
@ -191,6 +193,15 @@
|
|||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.35.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz",
|
||||
"integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
"version": "0.11.8",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||
|
@ -269,9 +280,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@microsoft/dynamicproto-js": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.7.tgz",
|
||||
"integrity": "sha512-SK3D3aVt+5vOOccKPnGaJWB5gQ8FuKfjboUJHedMP7gu54HqSCXX5iFXhktGD8nfJb0Go30eDvs/UDoTnR2kOA=="
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.8.tgz",
|
||||
"integrity": "sha512-j4ZgOZRtX0LTUgKq+4tRQotgwH03HH/mLkYbcgFBBJ9XKTDc4NIGzZeam2UQMzwz+5IVN0SXexNbbsz5B0b/og=="
|
||||
},
|
||||
"node_modules/@microsoft/tsdoc": {
|
||||
"version": "0.14.2",
|
||||
|
@ -684,6 +695,40 @@
|
|||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@rush-temp/applicationinsights-example-aisku": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "file:projects/applicationinsights-example-aisku.tgz",
|
||||
"integrity": "sha512-NKyLLswyBdbbBDSg6EVg9SmAkqelnNxUpZB8QQD2Lzw/SAmbEkAxscC18qJj6M9oug5MToNWwt5u8+NZBcCcPw==",
|
||||
"dependencies": {
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"rollup": "^2.32.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"tslib": "*",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@rush-temp/applicationinsights-example-dependencies": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "file:projects/applicationinsights-example-dependencies.tgz",
|
||||
"integrity": "sha512-CgGUBftKLCSJ4wgb5zFZVIPjIzjSOSc1QuXGn7VxZV7o/tRtQ6Jz7RYwviR/IRgI/cMjUmrOwVrBg7IxA1sFeQ==",
|
||||
"dependencies": {
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"rollup": "^2.32.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"tslib": "*",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@rush-temp/applicationinsights-example-shared-worker": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "file:projects/applicationinsights-example-shared-worker.tgz",
|
||||
|
@ -1176,14 +1221,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
|
||||
"integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz",
|
||||
"integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/type-utils": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/type-utils": "5.54.0",
|
||||
"@typescript-eslint/utils": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"grapheme-splitter": "^1.0.4",
|
||||
"ignore": "^5.2.0",
|
||||
|
@ -1210,14 +1255,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz",
|
||||
"integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.0.tgz",
|
||||
"integrity": "sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1237,13 +1282,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz",
|
||||
"integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz",
|
||||
"integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0"
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/visitor-keys": "5.54.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
|
@ -1254,13 +1299,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz",
|
||||
"integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz",
|
||||
"integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"@typescript-eslint/utils": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
|
@ -1281,9 +1326,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz",
|
||||
"integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz",
|
||||
"integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
|
@ -1294,13 +1339,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz",
|
||||
"integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz",
|
||||
"integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/visitor-keys": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
|
@ -1321,16 +1366,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz",
|
||||
"integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz",
|
||||
"integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.9",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0",
|
||||
"semver": "^7.3.7"
|
||||
|
@ -1347,12 +1392,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz",
|
||||
"integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz",
|
||||
"integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -1741,9 +1786,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001457",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz",
|
||||
"integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==",
|
||||
"version": "1.0.30001458",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz",
|
||||
"integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
|
@ -2099,9 +2144,9 @@
|
|||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.4.311",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.311.tgz",
|
||||
"integrity": "sha512-RoDlZufvrtr2Nx3Yx5MB8jX3aHIxm8nRWPJm3yVvyHmyKaRvn90RjzB6hNnt0AkhS3IInJdyRfQb4mWhPvUjVw=="
|
||||
"version": "1.4.315",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.315.tgz",
|
||||
"integrity": "sha512-ndBQYz3Eyy3rASjjQ9poMJGoAlsZ/aZnq6GBsGL4w/4sWIAwiUHVSsMuADbxa8WJw7pZ0oxLpGbtoDt4vRTdCg=="
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2145,12 +2190,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.34.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz",
|
||||
"integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
|
||||
"version": "8.35.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz",
|
||||
"integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint/eslintrc": "^1.4.1",
|
||||
"@eslint/eslintrc": "^2.0.0",
|
||||
"@eslint/js": "8.35.0",
|
||||
"@humanwhocodes/config-array": "^0.11.8",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
@ -2164,7 +2210,7 @@
|
|||
"eslint-utils": "^3.0.0",
|
||||
"eslint-visitor-keys": "^3.3.0",
|
||||
"espree": "^9.4.0",
|
||||
"esquery": "^1.4.0",
|
||||
"esquery": "^1.4.2",
|
||||
"esutils": "^2.0.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-entry-cache": "^6.0.1",
|
||||
|
@ -5526,9 +5572,9 @@
|
|||
}
|
||||
},
|
||||
"@eslint/eslintrc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
|
||||
"integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz",
|
||||
"integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"ajv": "^6.12.4",
|
||||
|
@ -5542,6 +5588,12 @@
|
|||
"strip-json-comments": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"@eslint/js": {
|
||||
"version": "8.35.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz",
|
||||
"integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==",
|
||||
"peer": true
|
||||
},
|
||||
"@humanwhocodes/config-array": {
|
||||
"version": "0.11.8",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||
|
@ -5602,9 +5654,9 @@
|
|||
}
|
||||
},
|
||||
"@microsoft/dynamicproto-js": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.7.tgz",
|
||||
"integrity": "sha512-SK3D3aVt+5vOOccKPnGaJWB5gQ8FuKfjboUJHedMP7gu54HqSCXX5iFXhktGD8nfJb0Go30eDvs/UDoTnR2kOA=="
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.8.tgz",
|
||||
"integrity": "sha512-j4ZgOZRtX0LTUgKq+4tRQotgwH03HH/mLkYbcgFBBJ9XKTDc4NIGzZeam2UQMzwz+5IVN0SXexNbbsz5B0b/og=="
|
||||
},
|
||||
"@microsoft/tsdoc": {
|
||||
"version": "0.14.2",
|
||||
|
@ -5957,6 +6009,38 @@
|
|||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"@rush-temp/applicationinsights-example-aisku": {
|
||||
"version": "file:projects\\applicationinsights-example-aisku.tgz",
|
||||
"integrity": "sha512-NKyLLswyBdbbBDSg6EVg9SmAkqelnNxUpZB8QQD2Lzw/SAmbEkAxscC18qJj6M9oug5MToNWwt5u8+NZBcCcPw==",
|
||||
"requires": {
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"rollup": "^2.32.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"tslib": "*",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"@rush-temp/applicationinsights-example-dependencies": {
|
||||
"version": "file:projects\\applicationinsights-example-dependencies.tgz",
|
||||
"integrity": "sha512-CgGUBftKLCSJ4wgb5zFZVIPjIzjSOSc1QuXGn7VxZV7o/tRtQ6Jz7RYwviR/IRgI/cMjUmrOwVrBg7IxA1sFeQ==",
|
||||
"requires": {
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"rollup": "^2.32.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"tslib": "*",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
"@rush-temp/applicationinsights-example-shared-worker": {
|
||||
"version": "file:projects\\applicationinsights-example-shared-worker.tgz",
|
||||
"integrity": "sha512-o1I1cJXIk3Fpt5WZ172SZfSZu1glVFqtR9Iz5I+KqCSwpil+KfJk+/rPGg6tNIfi2glHlqHigsS350k4bPGJ2Q==",
|
||||
|
@ -6421,14 +6505,14 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
|
||||
"integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz",
|
||||
"integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/type-utils": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/type-utils": "5.54.0",
|
||||
"@typescript-eslint/utils": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"grapheme-splitter": "^1.0.4",
|
||||
"ignore": "^5.2.0",
|
||||
|
@ -6439,53 +6523,53 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz",
|
||||
"integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.0.tgz",
|
||||
"integrity": "sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"debug": "^4.3.4"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz",
|
||||
"integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz",
|
||||
"integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0"
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/visitor-keys": "5.54.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/type-utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz",
|
||||
"integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz",
|
||||
"integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"@typescript-eslint/utils": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"tsutils": "^3.21.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/types": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz",
|
||||
"integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz",
|
||||
"integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==",
|
||||
"peer": true
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz",
|
||||
"integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz",
|
||||
"integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/visitor-keys": "5.54.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
|
@ -6494,28 +6578,28 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz",
|
||||
"integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz",
|
||||
"integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.9",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.0",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0",
|
||||
"semver": "^7.3.7"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz",
|
||||
"integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==",
|
||||
"version": "5.54.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz",
|
||||
"integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.0",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
}
|
||||
},
|
||||
|
@ -6783,9 +6867,9 @@
|
|||
"peer": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001457",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz",
|
||||
"integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA=="
|
||||
"version": "1.0.30001458",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz",
|
||||
"integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w=="
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
|
@ -7045,9 +7129,9 @@
|
|||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.4.311",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.311.tgz",
|
||||
"integrity": "sha512-RoDlZufvrtr2Nx3Yx5MB8jX3aHIxm8nRWPJm3yVvyHmyKaRvn90RjzB6hNnt0AkhS3IInJdyRfQb4mWhPvUjVw=="
|
||||
"version": "1.4.315",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.315.tgz",
|
||||
"integrity": "sha512-ndBQYz3Eyy3rASjjQ9poMJGoAlsZ/aZnq6GBsGL4w/4sWIAwiUHVSsMuADbxa8WJw7pZ0oxLpGbtoDt4vRTdCg=="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
|
@ -7079,12 +7163,13 @@
|
|||
"peer": true
|
||||
},
|
||||
"eslint": {
|
||||
"version": "8.34.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz",
|
||||
"integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
|
||||
"version": "8.35.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz",
|
||||
"integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@eslint/eslintrc": "^1.4.1",
|
||||
"@eslint/eslintrc": "^2.0.0",
|
||||
"@eslint/js": "8.35.0",
|
||||
"@humanwhocodes/config-array": "^0.11.8",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
@ -7098,7 +7183,7 @@
|
|||
"eslint-utils": "^3.0.0",
|
||||
"eslint-visitor-keys": "^3.3.0",
|
||||
"espree": "^9.4.0",
|
||||
"esquery": "^1.4.0",
|
||||
"esquery": "^1.4.2",
|
||||
"esutils": "^2.0.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-entry-cache": "^6.0.1",
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
# Microsoft Application Insights JavaScript SDK - Dependencies Plugin
|
||||
|
||||
Dependencies Plugin for the Application Insights Javascript SDK
|
||||
|
||||
## Configuration
|
||||
|
||||
[`ICorrelationConfig`](../../shared/AppInsightsCommon/src/Interfaces/ICorrelationConfig.ts)
|
||||
|
||||
## Functions
|
||||
|
||||
### Dependency Listeners
|
||||
|
||||
`addDependencyListener(dependencyListener: DependencyListenerFunction): IDependencyListenerHandler`
|
||||
|
||||
A [dependency listener](../API-reference.md#adddependencylistener) is a callback function that **allows you to perform additional manipulation of the request details before the request is performed**.
|
||||
|
||||
This includes :-
|
||||
|
||||
- Complete access to either the XMLHttpRequest instance or the fetch API `input` and `init` arguments.
|
||||
- Ability to get/set the properties used to generate the W3C `traceparent` header (`traceId`, `spanId,`traceFlags)
|
||||
- Set values in the object context container for other listeners called after the current one, as well as this context object is also made available to all dependency initializers.
|
||||
|
||||
```javascript
|
||||
public addDependencyListener(dependencyListener: (dependencyDetails: IDependencyListenerDetails) => void): IDependencyListenerHandler;
|
||||
|
||||
// Example Usage
|
||||
let handler = appInsights.addDependencyListener((details) => {
|
||||
// You have complete access to the xhr instance
|
||||
// details.xhr: XMLHttpRequest;
|
||||
|
||||
// Or if a fetch request you have complete access to the input and init objects
|
||||
// details.input: Request | string;
|
||||
// details.init: RequestInit;
|
||||
|
||||
// Access or change the W3C traceId that will be added to the outbound request
|
||||
details.traceId = "";
|
||||
|
||||
// Access or change the W3C spanId that will be added to the outbound request
|
||||
details.spanId = "";
|
||||
|
||||
// Access or change the W3C traceflags that will be added to the outbound request
|
||||
details.traceFlags = 1;
|
||||
|
||||
// Add additional context values (any) that can be used by other listeners and is
|
||||
// also passed to any dependency initializers
|
||||
details.context.someValue = 1234;
|
||||
});
|
||||
|
||||
// [Optional] Remove the dependency initializer
|
||||
handler.remove();
|
||||
```
|
||||
|
||||
### Dependency Initializers
|
||||
|
||||
`addDependencyInitializer(dependencyInitializer: DependencyInitializerFunction): IDependencyInitializerHandler`
|
||||
|
||||
A [Dependency Initializer](../API-reference.md#adddependencyinitializer) is very similar to a [Telemetry Initializer](https://github.com/Microsoft/ApplicationInsights-JS#telemetry-initializers) in that it **allows you modify the contents of collected telemetry before being sent from the user's browser**. And you can also returning `false` to cause the event to not be emitted.
|
||||
|
||||
The differences between a telemetry initializer and a dependency initializer are :-
|
||||
|
||||
- A Dependency Initializer is called "before" the event is processed by the pipeline, as such it will NOT (yet) contain the automatically populated properties that are applied later;
|
||||
- When a dependency initializer returns `false` to drop the event the event does NOT count against the `maxAjaxCallsPerView` as this blocks the event call from being tracked, and while returning `false` from a [Telemetry Initializer](https://github.com/Microsoft/ApplicationInsights-JS#telemetry-initializers) will also stop the event from being reported because this is further down the processing pipeline the dependency event IS counted against the `maxAjaxCallsPerView` limit.
|
||||
- It has access to an optional "context" `{ [key: string]: any }` object that is also available to the Dependency Listeners. This allows a listener to add additional details to the context (before the XHR/fetch request is sent), and the initializer will be called after the request has completed.
|
||||
|
||||
```javascript
|
||||
public addDependencyInitializer(dependencyInitializer: (item: IDependencyInitializerDetails) => boolean | void): IDependencyInitializerHandler
|
||||
|
||||
// Example Usage
|
||||
let handler = appInsights.addDependencyInitializer((details) => {
|
||||
details.item.xxxx = ""; // item is the telemetry event "before" it's been processed
|
||||
|
||||
// [Optional] To stop any event from being reported you can
|
||||
// return false;
|
||||
});
|
||||
|
||||
|
||||
// [Optional] Remove the dependency initializer
|
||||
handler.remove();
|
||||
```
|
||||
|
||||
### Track Dependency
|
||||
|
||||
`trackDependencyData(dependency:` `IDependencyTelemetry``, properties?: { [key: string]: any }): void`
|
||||
|
||||
[TrackDependencyData](../API-reference.md#trackdependencydata) function allows you to manually log a dependency call.
|
||||
|
||||
```javascript
|
||||
appInsights.trackDependencyData({absoluteUrl: 'some url', responseCode: 200, method: 'GET', id: 'some id'});
|
||||
```
|
||||
|
||||
## Sample
|
||||
|
||||
A [sample](./../examples/dependency/README.md) is provided to show how to filter, modify, block and disable dependency data.
|
|
@ -0,0 +1,44 @@
|
|||
# Application Insights JavaScript SDK
|
||||
|
||||
## AISKU Sample
|
||||
|
||||
This Sample shows how to track [`pageview`](../../API-reference.md#trackpageview), [`event`](../../API-reference.md#trackevent), [`trace`](../../API-reference.md#tracktrace), [`metric`](../../API-reference.md#trackmetric), [`exception`](../../API-reference.md#trackexception), get cookies details by using `cookieMgr` and record event duration manually by using `startTrackEvent` and `stopTrackEvent`.
|
||||
|
||||
## Sample Build
|
||||
|
||||
- Build the repository before running this example.
|
||||
- Run `npm run serve` under root folder.
|
||||
- Open `http://localhost:9001/examples/AISKU/`.
|
||||
|
||||
## Description
|
||||
|
||||
- button `Change Config` will change config dynamically.
|
||||
- button `Create Pageview` will trigger a pageview telemetry.
|
||||
- button `Create Event` will trigger an event telemetry.
|
||||
- button `Create Trace` will trigger a trace telemetry.
|
||||
- button `Create Metric` will trigger a metric telemetry.
|
||||
- button `Create Exception` will trigger an exception telemetry.
|
||||
- button `Start Tracking event` will start timing an event with given name `manual_record_event`
|
||||
- button `Stop Tracking event` will stop timing the previous event with given name `manual_record_event`.
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit <https://cla.microsoft.com>.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
|
||||
|
||||
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
|
||||
|
||||
## Data Collection
|
||||
|
||||
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
|
||||
|
||||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at [here](https://go.microsoft.com/fwlink/?LinkID=824704). You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
||||
|
||||
## Trademarks
|
||||
|
||||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
|
@ -0,0 +1,30 @@
|
|||
<!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"/>
|
||||
|
||||
<!-- use this section for snippet Initialization -->
|
||||
<!-- <script type="text/javascript">!function(T,l,y){var S=T.location,k="script",D="instrumentationKey",C="ingestionendpoint",I="disableExceptionTracking",E="ai.device.",b="toLowerCase",w="crossOrigin",N="POST",e="appInsightsSDK",t=y.name||"appInsights";(y.name||T[e])&&(T[e]=t);var n=T[t]||function(d){var g=!1,f=!1,m={initialize:!0,queue:[],sv:"5",version:2,config:d};function v(e,t){var n={},a="Browser";return n[E+"id"]=a[b](),n[E+"type"]=a,n["ai.operation.name"]=S&&S.pathname||"_unknown_",n["ai.internal.sdkVersion"]="javascript:snippet_"+(m.sv||m.version),{time:function(){var e=new Date;function t(e){var t=""+e;return 1===t.length&&(t="0"+t),t}return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}(),iKey:e,name:"Microsoft.ApplicationInsights."+e.replace(/-/g,"")+"."+t,sampleRate:100,tags:n,data:{baseData:{ver:2}}}}var h=d.url||y.src;if(h){function a(e){var t,n,a,i,r,o,s,c,u,p,l;g=!0,m.queue=[],f||(f=!0,t=h,s=function(){var e={},t=d.connectionString;if(t)for(var n=t.split(";"),a=0;a<n.length;a++){var i=n[a].split("=");2===i.length&&(e[i[0][b]()]=i[1])}if(!e[C]){var r=e.endpointsuffix,o=r?e.location:null;e[C]="https://"+(o?o+".":"")+"dc."+(r||"services.visualstudio.com")}return e}(),c=s[D]||d[D]||"",u=s[C],p=u?u+"/v2/track":d.endpointUrl,(l=[]).push((n="SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)",a=t,i=p,(o=(r=v(c,"Exception")).data).baseType="ExceptionData",o.baseData.exceptions=[{typeName:"SDKLoadFailed",message:n.replace(/\./g,"-"),hasFullStack:!1,stack:n+"\nSnippet failed to load ["+a+"] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: "+(S&&S.pathname||"_unknown_")+"\nEndpoint: "+i,parsedStack:[]}],r)),l.push(function(e,t,n,a){var i=v(c,"Message"),r=i.data;r.baseType="MessageData";var o=r.baseData;return o.message='AI (Internal): 99 message:"'+("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) ("+n+")").replace(/\"/g,"")+'"',o.properties={endpoint:a},i}(0,0,t,p)),function(e,t){if(JSON){var n=T.fetch;if(n&&!y.useXhr)n(t,{method:N,body:JSON.stringify(e),mode:"cors"});else if(XMLHttpRequest){var a=new XMLHttpRequest;a.open(N,t),a.setRequestHeader("Content-type","application/json"),a.send(JSON.stringify(e))}}}(l,p))}function i(e,t){f||setTimeout(function(){!t&&m.core||a()},500)}var e=function(){var n=l.createElement(k);n.src=h;var e=y[w];return!e&&""!==e||"undefined"==n[w]||(n[w]=e),n.onload=i,n.onerror=a,n.onreadystatechange=function(e,t){"loaded"!==n.readyState&&"complete"!==n.readyState||i(0,t)},n}();y.ld<0?l.getElementsByTagName("head")[0].appendChild(e):setTimeout(function(){l.getElementsByTagName(k)[0].parentNode.appendChild(e)},y.ld||0)}try{m.cookie=l.cookie}catch(p){}function t(e){for(;e.length;)!function(t){m[t]=function(){var e=arguments;g||m.queue.push(function(){m[t].apply(m,e)})}}(e.pop())}var n="track",r="TrackPage",o="TrackEvent";t([n+"Event",n+"PageView",n+"Exception",n+"Trace",n+"DependencyData",n+"Metric",n+"PageViewPerformance","start"+r,"stop"+r,"start"+o,"stop"+o,"addTelemetryInitializer","setAuthenticatedUserContext","clearAuthenticatedUserContext","flush"]),m.SeverityLevel={Verbose:0,Information:1,Warning:2,Error:3,Critical:4};var s=(d.extensionConfig||{}).ApplicationInsightsAnalytics||{};if(!0!==d[I]&&!0!==s[I]){var c="onerror";t(["_"+c]);var u=T[c];T[c]=function(e,t,n,a,i){var r=u&&u(e,t,n,a,i);return!0!==r&&m["_"+c]({message:e,url:t,lineNumber:n,columnNumber:a,error:i}),r},d.autoExceptionInstrumented=!0}return m}(y.cfg);function a(){y.onInit&&y.onInit(n)}(T[t]=n).queue&&0===n.queue.length?(n.queue.push(a),n.trackPageView({})):a()}(window,document,{
|
||||
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source for the CDN
|
||||
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
|
||||
cfg: { // Application Insights Configuration
|
||||
connectionString: "InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE"
|
||||
}});
|
||||
</script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Microsoft Application Insights JavaScript SDK - AISKU</h1>
|
||||
<!-- this script is only used for local build testing -->
|
||||
<!-- <script src="../../AISKU/dist/applicationinsights-web.js"></script>
|
||||
<script>
|
||||
let appInsights = new Microsoft.ApplicationInsights.ApplicationInsights({ config: {connectionString: "InstrumentationKey=key123", disableInstrumentationKeyValidation: true}});
|
||||
appInsights.loadAppInsights();
|
||||
window.appInsights = appInsights;
|
||||
</script> -->
|
||||
<script src="./browser/aisku-example-index.gbl.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "@microsoft/applicationinsights-example-aisku",
|
||||
"author": "Microsoft Application Insights Team",
|
||||
"version": "2.8.10",
|
||||
"description": "Microsoft Application Insights AISKU Example",
|
||||
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
||||
"keywords": [
|
||||
"azure",
|
||||
"cloud",
|
||||
"script errors",
|
||||
"microsoft",
|
||||
"application insights",
|
||||
"browser performance monitoring",
|
||||
"web analytics",
|
||||
"example"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "grunt clean",
|
||||
"build": "npm run build:esm && npm run build:browser",
|
||||
"build:esm": "grunt example-aisku",
|
||||
"build:browser": "rollup -c rollup.config.js",
|
||||
"rebuild": "npm run build",
|
||||
"test": "",
|
||||
"mintest": "",
|
||||
"perftest": "",
|
||||
"lint": "tslint -p tsconfig.json",
|
||||
"ai-min": "",
|
||||
"ai-restore": ""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore"
|
||||
},
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
||||
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup": "^2.32.0",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tslib": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/applicationinsights-shims": "2.0.2",
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@microsoft/applicationinsights-web": "2.8.10",
|
||||
"@microsoft/applicationinsights-core-js": "2.8.10"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import { uglify } from "@microsoft/applicationinsights-rollup-plugin-uglify3-js";
|
||||
import replace from "@rollup/plugin-replace";
|
||||
import cleanup from "rollup-plugin-cleanup";
|
||||
import dynamicRemove from "@microsoft/dynamicproto-js/tools/rollup/node/removedynamic";
|
||||
import { es3Poly, es3Check, importCheck } from "@microsoft/applicationinsights-rollup-es3";
|
||||
import { updateDistEsmFiles } from "../../tools/updateDistEsm/updateDistEsm";
|
||||
|
||||
const version = require("./package.json").version;
|
||||
|
||||
const workerName = "aisku-example-index";
|
||||
|
||||
const banner = [
|
||||
"/*!",
|
||||
` * Application Insights JavaScript SDK Example - Shared Worker, ${version}`,
|
||||
" * Copyright (c) Microsoft and contributors. All rights reserved.",
|
||||
" */"
|
||||
].join("\n");
|
||||
|
||||
const replaceValues = {
|
||||
"// Copyright (c) Microsoft Corporation. All rights reserved.": "",
|
||||
"// Licensed under the MIT License.": ""
|
||||
};
|
||||
|
||||
function doCleanup() {
|
||||
return cleanup({
|
||||
comments: [
|
||||
'some',
|
||||
/^.\s*@DynamicProtoStub/i,
|
||||
/^\*\*\s*@class\s*$/
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
const browserRollupConfigFactory = (name, isProduction, format = "umd", extension = "") => {
|
||||
const browserRollupConfig = {
|
||||
input: `dist-esm/${name}.js`,
|
||||
output: {
|
||||
file: `browser/${name}${extension ? "." +extension : ""}.js`,
|
||||
banner: banner,
|
||||
format: format,
|
||||
name: "Microsoft.ApplicationInsights.Example",
|
||||
extend: true,
|
||||
freeze: false,
|
||||
sourcemap: true
|
||||
},
|
||||
treeshake: {
|
||||
propertyReadSideEffects: false,
|
||||
moduleSideEffects: false,
|
||||
tryCatchDeoptimization: false,
|
||||
correctVarValueBeforeDeclaration: false
|
||||
},
|
||||
plugins: [
|
||||
dynamicRemove(),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
delimiters: ["", ""],
|
||||
values: replaceValues
|
||||
}),
|
||||
// This just makes sure we are importing the example dependencies correctly
|
||||
importCheck({ exclude: [ "aisku-example-index" ] }),
|
||||
nodeResolve({
|
||||
module: true,
|
||||
browser: true,
|
||||
preferBuiltins: false
|
||||
}),
|
||||
doCleanup(),
|
||||
es3Poly(),
|
||||
es3Check()
|
||||
]
|
||||
};
|
||||
|
||||
if (isProduction) {
|
||||
browserRollupConfig.output.file = `browser/${name}${extension ? "." +extension : ""}.min.js`;
|
||||
browserRollupConfig.plugins.push(
|
||||
uglify({
|
||||
ie8: false,
|
||||
ie: true,
|
||||
compress: {
|
||||
ie: true,
|
||||
passes:3,
|
||||
unsafe: true,
|
||||
},
|
||||
output: {
|
||||
ie: true,
|
||||
preamble: banner,
|
||||
webkit:true
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return browserRollupConfig;
|
||||
};
|
||||
|
||||
updateDistEsmFiles(replaceValues, banner);
|
||||
|
||||
export default [
|
||||
browserRollupConfigFactory(workerName, false, "iife", "gbl")
|
||||
];
|
|
@ -0,0 +1,80 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { addTelemetryInitializer, eventItem, getCookieManager, initApplicationInsights, metricItem, pageviewItem, startTrackEvent, stopTrackEvent, traceItem, trackEvent, trackMetric, trackPageView, trackTrace } from "./aisku-init";
|
||||
import { ai_session, ai_user, buttonSectionId, clearDetailsList, cookieWatchList, createButton, createContainers, createDetailList, detailsContainerId, detailsWatchList, manual_event, triggerException } from "./utils";
|
||||
import { arrForEach } from "@microsoft/applicationinsights-core-js";
|
||||
|
||||
function createPageviewTracks() {
|
||||
trackPageView(pageviewItem);
|
||||
}
|
||||
|
||||
function createEventTracks() {
|
||||
trackEvent(eventItem, {prop2: "prop2"});
|
||||
}
|
||||
|
||||
function startEvent() {
|
||||
startTrackEvent(manual_event);
|
||||
}
|
||||
|
||||
|
||||
function stopEvent() {
|
||||
stopTrackEvent(manual_event, {prop:"prop"}, {metric: 1});
|
||||
}
|
||||
|
||||
function createTraceTracks() {
|
||||
trackTrace(traceItem);
|
||||
}
|
||||
|
||||
function createMetricTracks() {
|
||||
trackMetric(metricItem, {prop2: "prop2"});
|
||||
}
|
||||
|
||||
function getCookieMgrdetails() {
|
||||
let cookieMgr = getCookieManager();
|
||||
if(cookieMgr) {
|
||||
let details = {
|
||||
isEnabled: cookieMgr.isEnabled(),
|
||||
ai_session: cookieMgr.get(ai_session),
|
||||
ai_user: cookieMgr.get(ai_user)
|
||||
} as any;
|
||||
createDetailList(cookieWatchList, details, detailsContainerId, "Cookie");
|
||||
}
|
||||
}
|
||||
|
||||
function addTelemetryListener() {
|
||||
addTelemetryInitializer((env: any) => {
|
||||
console.log("The following Event is triggered.");
|
||||
console.log(env);
|
||||
|
||||
createDetailList(detailsWatchList, env, detailsContainerId, "Telemetry");
|
||||
});
|
||||
}
|
||||
|
||||
function createButtonSection() {
|
||||
let container = document.getElementById(buttonSectionId);
|
||||
let pageviewButton = createButton("Create Pageview", createPageviewTracks);
|
||||
let eventButton = createButton("Create Event", createEventTracks);
|
||||
let startButton = createButton("Start Tracking Event", startEvent);
|
||||
let stopButton = createButton("Stop Tracking Event", stopEvent);
|
||||
let traceButton = createButton("Create Trace", createTraceTracks);
|
||||
let metricButton = createButton("Create Metric", createMetricTracks);
|
||||
let exceptionButton = createButton("Create Exception", triggerException);
|
||||
let cookieButton = createButton("Get Cookie", getCookieMgrdetails);
|
||||
let clearButton = createButton("Clear Details", clearDetailsList);
|
||||
let buttons = [pageviewButton, eventButton, traceButton, metricButton, startButton, stopButton, exceptionButton, cookieButton, clearButton];
|
||||
arrForEach(buttons, (button) => {
|
||||
container?.appendChild(button);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function analyticsSample() {
|
||||
initApplicationInsights();
|
||||
createContainers();
|
||||
addTelemetryListener();
|
||||
createButtonSection();
|
||||
}
|
||||
analyticsSample();
|
||||
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { ApplicationInsights, IConfiguration, IEventTelemetry, IMetricTelemetry, IPageViewTelemetry, ITraceTelemetry } from "@microsoft/applicationinsights-web";
|
||||
|
||||
|
||||
// ***********************************************************************************************************
|
||||
// NPM Initialization
|
||||
// Use this section to initialize Application Insights with NPM
|
||||
|
||||
// Cache the previously initialized instance to avoid creating multiple instances
|
||||
let _appInsights: ApplicationInsights | null;
|
||||
|
||||
export function initApplicationInsights(config?: IConfiguration) {
|
||||
|
||||
if (!_appInsights) {
|
||||
// Make sure we have a configuration object
|
||||
config = config || {};
|
||||
if (!config.instrumentationKey || !config.connectionString) {
|
||||
config.connectionString = "InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE";
|
||||
}
|
||||
|
||||
_appInsights = new ApplicationInsights({
|
||||
config: config
|
||||
});
|
||||
|
||||
_appInsights.loadAppInsights();
|
||||
_appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview
|
||||
|
||||
return _appInsights;
|
||||
}
|
||||
|
||||
return _appInsights;
|
||||
}
|
||||
// **************************************************************************************************************
|
||||
|
||||
|
||||
/**
|
||||
* Unload the SDK if it has been initialized
|
||||
* @returns
|
||||
*/
|
||||
export function unloadApplicationInsights() {
|
||||
if (_appInsights) {
|
||||
_appInsights.unload();
|
||||
_appInsights = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a page view request if the SDK has been initialized
|
||||
*/
|
||||
export function trackPageView(pageView?: IPageViewTelemetry) {
|
||||
if (_appInsights) {
|
||||
_appInsights.trackPageView(pageView);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a custom event if the SDK has been initialized
|
||||
*/
|
||||
export function trackEvent(event: IEventTelemetry, customProperties?: {[key: string]: any;} ) {
|
||||
if (_appInsights) {
|
||||
_appInsights.trackEvent(event, customProperties);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start timing an event with given name if the SDK has been initialized
|
||||
*/
|
||||
export function startTrackEvent(name?: string) {
|
||||
if (_appInsights) {
|
||||
_appInsights.startTrackEvent(name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop timing an event with given name if the SDK has been initialized
|
||||
*/
|
||||
export function stopTrackEvent(name: string, properties?: { [key: string]: string; }, measurements?: { [key: string]: number; }) {
|
||||
if (_appInsights) {
|
||||
_appInsights.stopTrackEvent(name, properties, measurements);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log traces if the SDK has been initialized
|
||||
* Typically used to send regular reports of performance indicators
|
||||
*/
|
||||
export function trackTrace(trace: ITraceTelemetry) {
|
||||
if (_appInsights) {
|
||||
_appInsights.trackTrace(trace);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log Metric if the SDK has been initialized
|
||||
*/
|
||||
export function trackMetric(metric: IMetricTelemetry, customProperties?: {[name: string]: any}) {
|
||||
if (_appInsights) {
|
||||
_appInsights.trackMetric(metric, customProperties);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a telemetry initializer to the collection if the SDK has been initialized
|
||||
* Telemetry initializers will be called before the telemetry item is pushed for sending
|
||||
*/
|
||||
export function addTelemetryInitializer(telemetryInitializer: (item: any) => boolean | void) {
|
||||
if (_appInsights) {
|
||||
|
||||
_appInsights.addTelemetryInitializer(telemetryInitializer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use getCookieMgr to get cookie details if the SDK has been initialized
|
||||
* cookieMgr can be used to del, get, purge, set cookies
|
||||
*/
|
||||
export function getCookieManager(): any {
|
||||
if (_appInsights) {
|
||||
return _appInsights.getCookieMgr();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* An example of customized pageview item
|
||||
*/
|
||||
export const pageviewItem = {
|
||||
name: "pageviewWithproperities", // Defaults to the document title
|
||||
uri: "https://pageview",
|
||||
refUri: "https://sample",
|
||||
pageType: "type",
|
||||
isLoggedIn: false,
|
||||
properties: {
|
||||
duration: 100, // pre-defined property
|
||||
prop: "prop",
|
||||
prop1: {prop1:"prop1"}
|
||||
},
|
||||
measurements: {
|
||||
metric: 1
|
||||
}
|
||||
} as IPageViewTelemetry;
|
||||
|
||||
/**
|
||||
* An example of customized event item
|
||||
*/
|
||||
export const eventItem = {
|
||||
name: "eventWithproperities",
|
||||
properties: {
|
||||
prop: {prop1:"prop1"}
|
||||
},
|
||||
measurements: {
|
||||
metirc: 1
|
||||
}
|
||||
} as IEventTelemetry;
|
||||
|
||||
/**
|
||||
* An example of customized trace item
|
||||
*/
|
||||
export const traceItem = {
|
||||
message: "trace",
|
||||
SeverityLevel: 1,
|
||||
properties: {
|
||||
prop: {prop1:"prop1"}
|
||||
},
|
||||
measurements: {
|
||||
metirc: 1
|
||||
}
|
||||
} as ITraceTelemetry;
|
||||
|
||||
/**
|
||||
* An example of customized metric item
|
||||
*/
|
||||
export const metricItem = {
|
||||
name: "metric",
|
||||
average: 1.2,
|
||||
//default to 1
|
||||
sampleCount: 2,
|
||||
//default to average
|
||||
min: 1,
|
||||
//default to average
|
||||
max: 2,
|
||||
// default to 0
|
||||
stdDev: 1.23,
|
||||
properties: {
|
||||
prop: {prop1:"prop1"}
|
||||
},
|
||||
measurements: {
|
||||
metirc: 1
|
||||
}
|
||||
} as IMetricTelemetry;
|
||||
|
||||
|
||||
// // ******************************************************************************************************************************
|
||||
// // Snippet Initialization
|
||||
// let _appInsights: any;
|
||||
|
||||
// export function initApplicationInsights() {
|
||||
|
||||
// if (!_appInsights) {
|
||||
// _appInsights = (window as any).appInsights;
|
||||
// return _appInsights;
|
||||
// }
|
||||
|
||||
// return _appInsights;
|
||||
// }
|
||||
|
||||
// // ***********************************************************************************************************************************
|
|
@ -0,0 +1,105 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { arrForEach } from "@microsoft/applicationinsights-core-js";
|
||||
|
||||
export const detailsContainerId = "details-container";
|
||||
export const detailsWatchList = ["baseType", "name", "time", "properties"];
|
||||
export const ajaxDetails: string[] = ["disabbleFetchTracking", "disableExceptionTracking", "enableAutoRouteTracking"];
|
||||
export const analyticsDetails: string[] = ["autoTrackPageVisitTime", "appId", "enableAjaxPerfTracking", "enableCorsCorrelation"];
|
||||
export const buttonSectionId = "button-section";
|
||||
export const containerId = "aisku-container";
|
||||
export const ai_session = "ai_session";
|
||||
export const ai_user = "ai_user";
|
||||
export const manual_event = "manual_record_event";
|
||||
export const cookieWatchList = ["isEnabled", ai_session, ai_user];
|
||||
|
||||
|
||||
export function randomBoolean() {
|
||||
if (Math.random() > 0.5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function clearEle(id: string) {
|
||||
let ele = document.getElementById(id);
|
||||
if (ele) {
|
||||
ele.innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
export function clearDetailsList() {
|
||||
clearEle(detailsContainerId);
|
||||
}
|
||||
|
||||
export function createSubContainer(id: string, className?: string) {
|
||||
let ele = document.createElement("div");
|
||||
ele.className = className || "container-main";
|
||||
ele.id = id;
|
||||
return ele;
|
||||
}
|
||||
|
||||
export function createButton(buttontextContent: string, buttobuttononclickFn: any, id?: string): HTMLButtonElement {
|
||||
let btn = document.createElement("button");
|
||||
if (id) {
|
||||
btn.id = id;
|
||||
}
|
||||
btn.innerHTML = buttontextContent;
|
||||
btn.onclick = buttobuttononclickFn;
|
||||
return btn;
|
||||
}
|
||||
|
||||
export function createDetailList(propsToWatch: string[], details: any, id: string, title: string) {
|
||||
let container = document.getElementById(id);
|
||||
let ele = document.createElement("div");
|
||||
ele.className = "list";
|
||||
let list = "";
|
||||
if (details) {
|
||||
list += `
|
||||
<h6>${title} Details</h6>
|
||||
<p>Not all auto-captured events and details are displayed here.</p>
|
||||
<p>Check console and network trace for complete details</p>
|
||||
`;
|
||||
arrForEach(propsToWatch, (prop) => {
|
||||
let obj;
|
||||
|
||||
if (details["baseData"]) {
|
||||
obj = details["baseData"][prop] || details[prop] || details["baseData"];
|
||||
} else {
|
||||
obj = details[prop] || details["baseData"];
|
||||
}
|
||||
if (prop === "item") {
|
||||
obj = {name: obj.name, target: obj.target};
|
||||
}
|
||||
|
||||
obj = (obj === undefined)? "undefined" : obj;
|
||||
|
||||
if (typeof obj === "object") {
|
||||
obj = JSON.stringify(obj);
|
||||
}
|
||||
list += `<li>${prop}: ${obj}</li>`;
|
||||
|
||||
});
|
||||
|
||||
list += "<div>-------------------------</div>";
|
||||
ele.innerHTML = list;
|
||||
container?.appendChild(ele);
|
||||
}
|
||||
}
|
||||
|
||||
export function createContainers() {
|
||||
let container = document.createElement("div");
|
||||
container.className = "container";
|
||||
container.id = containerId;
|
||||
let buttonSection = createSubContainer(buttonSectionId, "container");
|
||||
container.appendChild(buttonSection);
|
||||
let detailsSection = createSubContainer(detailsContainerId);
|
||||
container.appendChild(detailsSection);
|
||||
document.body.append(container);
|
||||
}
|
||||
|
||||
export function triggerException() {
|
||||
// This will trigger exception telemetry automatically
|
||||
throw new Error("error is triggered");
|
||||
}
|
|
@ -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: 550px;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "es6",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist-esm",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": false,
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"declarationDir": "./types",
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": [
|
||||
"./src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
|
@ -7,6 +7,10 @@ but may not be executed as part of any automated test pass -- this may change/va
|
|||
|
||||
[Shared Worker](./shared-worker/README.md)
|
||||
|
||||
[AISKU](./AISKU/README.md)
|
||||
|
||||
[Dependency](./dependency/README.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
# Application Insights JavaScript SDK
|
||||
|
||||
## Dependency Sample
|
||||
|
||||
This Sample shows how to filter, modify, block and disable dependency data with [`addDependencyListener`](../../API-reference.md#adddependencylistener) and [`addDependencyInitializer`](../../API-reference.md#adddependencyinitializer).
|
||||
|
||||
## Sample Build
|
||||
|
||||
- Build the repository before running this example.
|
||||
- Run `npm run serve` under root folder.
|
||||
- Open `http://localhost:9001/examples/dependency/`.
|
||||
|
||||
## Description
|
||||
|
||||
- button `change-config` will change config dynamically.
|
||||
|
||||
- button `add-handlers` will add a dependencyListener with the following changes:
|
||||
|
||||
```javascript
|
||||
context.listener = "dependency-listener-context";
|
||||
traceFlags = 0;
|
||||
```
|
||||
|
||||
and a dependencyInitializer with the following changes:
|
||||
|
||||
```javascript
|
||||
item.name = "dependency-name";
|
||||
item.properties.url = item.target;
|
||||
context.initializer = "dependency-initializer-context";
|
||||
```
|
||||
|
||||
- button `stop-dependency-event` will block all dependency events.
|
||||
|
||||
- button `remove-all-handlers` will remove all previously added dependency initializers and listeners.
|
||||
|
||||
- button `create-fetch-request` will trigger a fetch request.
|
||||
|
||||
- button `create-xhr-request` will trigger a xhr request.
|
||||
|
||||
- button `untrack-fetch-request` will trigger a fetch request that will be blocked.
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit <https://cla.microsoft.com>.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
|
||||
|
||||
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
|
||||
|
||||
## Data Collection
|
||||
|
||||
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
|
||||
|
||||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at [here](https://go.microsoft.com/fwlink/?LinkID=824704). You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
||||
|
||||
## Trademarks
|
||||
|
||||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dependency Sample</title>
|
||||
<link rel="stylesheet" href="style/style.css"/>
|
||||
|
||||
<!-- use this section for snippet Initialization -->
|
||||
<!-- <script type="text/javascript">!function(T,l,y){var S=T.location,k="script",D="instrumentationKey",C="ingestionendpoint",I="disableExceptionTracking",E="ai.device.",b="toLowerCase",w="crossOrigin",N="POST",e="appInsightsSDK",t=y.name||"appInsights";(y.name||T[e])&&(T[e]=t);var n=T[t]||function(d){var g=!1,f=!1,m={initialize:!0,queue:[],sv:"5",version:2,config:d};function v(e,t){var n={},a="Browser";return n[E+"id"]=a[b](),n[E+"type"]=a,n["ai.operation.name"]=S&&S.pathname||"_unknown_",n["ai.internal.sdkVersion"]="javascript:snippet_"+(m.sv||m.version),{time:function(){var e=new Date;function t(e){var t=""+e;return 1===t.length&&(t="0"+t),t}return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}(),iKey:e,name:"Microsoft.ApplicationInsights."+e.replace(/-/g,"")+"."+t,sampleRate:100,tags:n,data:{baseData:{ver:2}}}}var h=d.url||y.src;if(h){function a(e){var t,n,a,i,r,o,s,c,u,p,l;g=!0,m.queue=[],f||(f=!0,t=h,s=function(){var e={},t=d.connectionString;if(t)for(var n=t.split(";"),a=0;a<n.length;a++){var i=n[a].split("=");2===i.length&&(e[i[0][b]()]=i[1])}if(!e[C]){var r=e.endpointsuffix,o=r?e.location:null;e[C]="https://"+(o?o+".":"")+"dc."+(r||"services.visualstudio.com")}return e}(),c=s[D]||d[D]||"",u=s[C],p=u?u+"/v2/track":d.endpointUrl,(l=[]).push((n="SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)",a=t,i=p,(o=(r=v(c,"Exception")).data).baseType="ExceptionData",o.baseData.exceptions=[{typeName:"SDKLoadFailed",message:n.replace(/\./g,"-"),hasFullStack:!1,stack:n+"\nSnippet failed to load ["+a+"] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: "+(S&&S.pathname||"_unknown_")+"\nEndpoint: "+i,parsedStack:[]}],r)),l.push(function(e,t,n,a){var i=v(c,"Message"),r=i.data;r.baseType="MessageData";var o=r.baseData;return o.message='AI (Internal): 99 message:"'+("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) ("+n+")").replace(/\"/g,"")+'"',o.properties={endpoint:a},i}(0,0,t,p)),function(e,t){if(JSON){var n=T.fetch;if(n&&!y.useXhr)n(t,{method:N,body:JSON.stringify(e),mode:"cors"});else if(XMLHttpRequest){var a=new XMLHttpRequest;a.open(N,t),a.setRequestHeader("Content-type","application/json"),a.send(JSON.stringify(e))}}}(l,p))}function i(e,t){f||setTimeout(function(){!t&&m.core||a()},500)}var e=function(){var n=l.createElement(k);n.src=h;var e=y[w];return!e&&""!==e||"undefined"==n[w]||(n[w]=e),n.onload=i,n.onerror=a,n.onreadystatechange=function(e,t){"loaded"!==n.readyState&&"complete"!==n.readyState||i(0,t)},n}();y.ld<0?l.getElementsByTagName("head")[0].appendChild(e):setTimeout(function(){l.getElementsByTagName(k)[0].parentNode.appendChild(e)},y.ld||0)}try{m.cookie=l.cookie}catch(p){}function t(e){for(;e.length;)!function(t){m[t]=function(){var e=arguments;g||m.queue.push(function(){m[t].apply(m,e)})}}(e.pop())}var n="track",r="TrackPage",o="TrackEvent";t([n+"Event",n+"PageView",n+"Exception",n+"Trace",n+"DependencyData",n+"Metric",n+"PageViewPerformance","start"+r,"stop"+r,"start"+o,"stop"+o,"addTelemetryInitializer","setAuthenticatedUserContext","clearAuthenticatedUserContext","flush"]),m.SeverityLevel={Verbose:0,Information:1,Warning:2,Error:3,Critical:4};var s=(d.extensionConfig||{}).ApplicationInsightsAnalytics||{};if(!0!==d[I]&&!0!==s[I]){var c="onerror";t(["_"+c]);var u=T[c];T[c]=function(e,t,n,a,i){var r=u&&u(e,t,n,a,i);return!0!==r&&m["_"+c]({message:e,url:t,lineNumber:n,columnNumber:a,error:i}),r},d.autoExceptionInstrumented=!0}return m}(y.cfg);function a(){y.onInit&&y.onInit(n)}(T[t]=n).queue&&0===n.queue.length?(n.queue.push(a),n.trackPageView({})):a()}(window,document,{
|
||||
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source for the CDN
|
||||
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
|
||||
cfg: { // Application Insights Configuration
|
||||
connectionString: "InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE"
|
||||
}});
|
||||
</script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Microsoft Application Insights JavaScript SDK - Dependencies</h1>
|
||||
<!-- this section is only for local build testing -->
|
||||
<!-- <script src="../../AISKU/dist/applicationinsights-web.js"></script>
|
||||
<script>
|
||||
let appInsights = new Microsoft.ApplicationInsights.ApplicationInsights({ config: {connectionString: "InstrumentationKey=key123"}});
|
||||
appInsights.loadAppInsights();
|
||||
window.appInsights = appInsights;
|
||||
</script> -->
|
||||
<script src="./browser/dependencies-example-index.gbl.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "@microsoft/applicationinsights-example-dependencies",
|
||||
"author": "Microsoft Application Insights Team",
|
||||
"version": "2.8.10",
|
||||
"description": "Microsoft Application Insights Dependencies Example",
|
||||
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
||||
"keywords": [
|
||||
"azure",
|
||||
"cloud",
|
||||
"script errors",
|
||||
"microsoft",
|
||||
"application insights",
|
||||
"browser performance monitoring",
|
||||
"web analytics",
|
||||
"example"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "grunt clean",
|
||||
"build": "npm run build:esm && npm run build:browser",
|
||||
"build:esm": "grunt example-dependency",
|
||||
"build:browser": "rollup -c rollup.config.js",
|
||||
"rebuild": "npm run build",
|
||||
"test": "",
|
||||
"mintest": "",
|
||||
"perftest": "",
|
||||
"lint": "tslint -p tsconfig.json",
|
||||
"ai-min": "",
|
||||
"ai-restore": ""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore"
|
||||
},
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
||||
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-replace": "^2.3.3",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup": "^2.32.0",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tslib": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/applicationinsights-shims": "2.0.2",
|
||||
"@microsoft/dynamicproto-js": "^1.1.7",
|
||||
"@microsoft/applicationinsights-web": "2.8.10",
|
||||
"@microsoft/applicationinsights-dependencies-js": "2.8.10",
|
||||
"@microsoft/applicationinsights-core-js": "2.8.10"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import { uglify } from "@microsoft/applicationinsights-rollup-plugin-uglify3-js";
|
||||
import replace from "@rollup/plugin-replace";
|
||||
import cleanup from "rollup-plugin-cleanup";
|
||||
import dynamicRemove from "@microsoft/dynamicproto-js/tools/rollup/node/removedynamic";
|
||||
import { es3Poly, es3Check, importCheck } from "@microsoft/applicationinsights-rollup-es3";
|
||||
import { updateDistEsmFiles } from "../../tools/updateDistEsm/updateDistEsm";
|
||||
|
||||
const version = require("./package.json").version;
|
||||
|
||||
const workerName = "dependencies-example-index";
|
||||
|
||||
const banner = [
|
||||
"/*!",
|
||||
` * Application Insights JavaScript SDK Example - Shared Worker, ${version}`,
|
||||
" * Copyright (c) Microsoft and contributors. All rights reserved.",
|
||||
" */"
|
||||
].join("\n");
|
||||
|
||||
const replaceValues = {
|
||||
"// Copyright (c) Microsoft Corporation. All rights reserved.": "",
|
||||
"// Licensed under the MIT License.": ""
|
||||
};
|
||||
|
||||
function doCleanup() {
|
||||
return cleanup({
|
||||
comments: [
|
||||
'some',
|
||||
/^.\s*@DynamicProtoStub/i,
|
||||
/^\*\*\s*@class\s*$/
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
const browserRollupConfigFactory = (name, isProduction, format = "umd", extension = "") => {
|
||||
const browserRollupConfig = {
|
||||
input: `dist-esm/${name}.js`,
|
||||
output: {
|
||||
file: `browser/${name}${extension ? "." +extension : ""}.js`,
|
||||
banner: banner,
|
||||
format: format,
|
||||
name: "Microsoft.ApplicationInsights.Example",
|
||||
extend: true,
|
||||
freeze: false,
|
||||
sourcemap: true
|
||||
},
|
||||
treeshake: {
|
||||
propertyReadSideEffects: false,
|
||||
moduleSideEffects: false,
|
||||
tryCatchDeoptimization: false,
|
||||
correctVarValueBeforeDeclaration: false
|
||||
},
|
||||
plugins: [
|
||||
dynamicRemove(),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
delimiters: ["", ""],
|
||||
values: replaceValues
|
||||
}),
|
||||
// This just makes sure we are importing the example dependencies correctly
|
||||
importCheck({ exclude: [ "dependencies-example-index" ] }),
|
||||
nodeResolve({
|
||||
module: true,
|
||||
browser: true,
|
||||
preferBuiltins: false
|
||||
}),
|
||||
doCleanup(),
|
||||
es3Poly(),
|
||||
es3Check()
|
||||
]
|
||||
};
|
||||
|
||||
if (isProduction) {
|
||||
browserRollupConfig.output.file = `browser/${name}${extension ? "." +extension : ""}.min.js`;
|
||||
browserRollupConfig.plugins.push(
|
||||
uglify({
|
||||
ie8: false,
|
||||
ie: true,
|
||||
compress: {
|
||||
ie: true,
|
||||
passes:3,
|
||||
unsafe: true,
|
||||
},
|
||||
output: {
|
||||
ie: true,
|
||||
preamble: banner,
|
||||
webkit:true
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return browserRollupConfig;
|
||||
};
|
||||
|
||||
updateDistEsmFiles(replaceValues, banner);
|
||||
|
||||
export default [
|
||||
browserRollupConfigFactory(workerName, false, "iife", "gbl")
|
||||
];
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { ApplicationInsights, IConfiguration } from "@microsoft/applicationinsights-web";
|
||||
import { DependencyListenerFunction, DependencyInitializerFunction, IDependencyInitializerHandler, IDependencyListenerHandler } from "@microsoft/applicationinsights-dependencies-js";
|
||||
|
||||
// Cache the previously initialized instance to avoid creating multiple instances
|
||||
let _appInsights: ApplicationInsights;
|
||||
|
||||
export function initApplicationInsights(config?: IConfiguration) {
|
||||
|
||||
if (!_appInsights) {
|
||||
// Make sure we have a configuration object
|
||||
config = config || {};
|
||||
if (!config.connectionString) {
|
||||
config.connectionString = "InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE";
|
||||
}
|
||||
|
||||
_appInsights = new ApplicationInsights({
|
||||
config: config
|
||||
});
|
||||
|
||||
_appInsights.loadAppInsights();
|
||||
_appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview
|
||||
|
||||
return _appInsights;
|
||||
}
|
||||
|
||||
return _appInsights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use addDependencyListener to modify dependencyDetails if the SDK has been initialized
|
||||
*/
|
||||
export function addDependencyListener(dependencyListener: DependencyListenerFunction): IDependencyInitializerHandler | null {
|
||||
if (_appInsights) {
|
||||
return _appInsights.addDependencyListener(dependencyListener);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use addDependencyInitializer to modify dependencyInitializerDetails if the SDK has been initialized
|
||||
*/
|
||||
export function addDependencyInitializer(dependencyInitializer: DependencyInitializerFunction): IDependencyListenerHandler | null {
|
||||
if (_appInsights) {
|
||||
return _appInsights.addDependencyInitializer(dependencyInitializer);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use addDependencyInitializer to block any event from being reported
|
||||
*/
|
||||
export function stopDependencyEvent() {
|
||||
if (_appInsights) {
|
||||
_appInsights.addDependencyInitializer((details: any) => {
|
||||
// Check console to view details
|
||||
console.log("dependency event tracking is stopped, the following event will not be reported");
|
||||
console.log(details);
|
||||
// To stop any event from being reported
|
||||
return false;
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// // ******************************************************************************************************************************
|
||||
// // Snippet Initialization
|
||||
// let _appInsights: any;
|
||||
|
||||
// export function initApplicationInsights() {
|
||||
|
||||
// if (!_appInsights) {
|
||||
// _appInsights = (window as any).appInsights;
|
||||
// return _appInsights;
|
||||
// }
|
||||
|
||||
// return _appInsights;
|
||||
// }
|
||||
|
||||
// // ***********************************************************************************************************************************
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { arrForEach } from "@microsoft/applicationinsights-core-js";
|
||||
import { addDependencyListener, addDependencyInitializer, stopDependencyEvent, initApplicationInsights } from "./appinsights-init";
|
||||
import { addHandlersButtonId, buttonSectionId, clearDetailsButtonId, clearDetailsList, createButton, createContainers, createDetailList, createFetchRequest, createUnTrackRequest, createXhrRequest, dependencyInitializerDetails, dependencyInitializerDetailsContainerId, dependencyListenerButtonId, dependencyListenerDetails, dependencyListenerDetailsContainerId, fetchCallId, fetchXhrId, removeAllHandlersId, stopDependencyEventButtonId, untrackFetchRequestId } from "./utils";
|
||||
|
||||
let dependencyListenerHandler: any = null;
|
||||
let dependencyInitializerHandler: any = null;
|
||||
|
||||
// This function is an example of using addDependencyListener to modify dependencyDetails
|
||||
function addDependencyListenerOnclick() {
|
||||
dependencyListenerHandler = addDependencyListener((details: any) => {
|
||||
// Check console to view details
|
||||
console.log("The folloing event is passed to addDependencyListener");
|
||||
console.log(details);
|
||||
// Add additional context values (any) that can be used by other listeners and is also passed to any dependency initializers
|
||||
details.context.listener = "dependency-listener-context";
|
||||
details.traceFlags = 0;
|
||||
|
||||
createDetailList(dependencyListenerDetails, details, dependencyListenerDetailsContainerId, "Listener");
|
||||
});
|
||||
}
|
||||
|
||||
// This function is an example of using addDependencyInitializer to modify dependencyInitializerDetails
|
||||
function addDependencyInitializerOnClick() {
|
||||
dependencyInitializerHandler = addDependencyInitializer((details: any) => {
|
||||
// Check console to view details
|
||||
console.log("The folloing event is passed to addDependencyInitializer");
|
||||
console.log(details);
|
||||
// Events from https://api.npms.io/v2/search?q=angular&size=1 will not be reported
|
||||
if (details.item?.target === "https://api.npms.io/v2/search?q=angular&size=1") {
|
||||
return false;
|
||||
}
|
||||
// Change properties of telemetry event "before" it's been processed
|
||||
details.item.name = "dependency-name";
|
||||
details.item.properties.url = details.item?.target;
|
||||
details.context.initializer = "dependency-initializer-context";
|
||||
|
||||
createDetailList(dependencyInitializerDetails, details, dependencyInitializerDetailsContainerId, "Initializer");
|
||||
});
|
||||
}
|
||||
|
||||
// This function is an example of removing addDependencyInitializer and addDependencyListener
|
||||
function removeAllHandlers() {
|
||||
if (dependencyInitializerHandler) {
|
||||
// Remove the dependency initializer
|
||||
dependencyInitializerHandler.remove();
|
||||
console.log("dependencyInitializerHandler is removed");
|
||||
}
|
||||
|
||||
if (dependencyListenerHandler) {
|
||||
// Remove the dependency Listener
|
||||
dependencyListenerHandler.remove();
|
||||
console.log("dependencyListenerHandler is removed");
|
||||
}
|
||||
}
|
||||
|
||||
function onAddHandlersClick() {
|
||||
addDependencyListenerOnclick();
|
||||
addDependencyInitializerOnClick();
|
||||
}
|
||||
|
||||
function createButtonSection() {
|
||||
let container = document.getElementById(buttonSectionId);
|
||||
let handlersBtn = createButton(addHandlersButtonId, onAddHandlersClick, dependencyListenerButtonId);
|
||||
let fetchButton = createButton(fetchCallId, createFetchRequest);
|
||||
let xhrButton = createButton(fetchXhrId, createXhrRequest);
|
||||
let untrackRequestButton = createButton(untrackFetchRequestId, createUnTrackRequest);
|
||||
let stopEventButton = createButton(stopDependencyEventButtonId, stopDependencyEvent);
|
||||
let removeHandlersButton = createButton(removeAllHandlersId, removeAllHandlers);
|
||||
let clearBtn = createButton(clearDetailsButtonId, clearDetailsList);
|
||||
let buttons = [handlersBtn, fetchButton, xhrButton, untrackRequestButton, stopEventButton, removeHandlersButton, clearBtn];
|
||||
arrForEach(buttons, (button) => {
|
||||
container?.appendChild(button);
|
||||
});
|
||||
}
|
||||
|
||||
function dependencySample() {
|
||||
initApplicationInsights();
|
||||
createContainers();
|
||||
createButtonSection();
|
||||
}
|
||||
dependencySample();
|
|
@ -0,0 +1,125 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import { arrForEach } from "@microsoft/applicationinsights-core-js";
|
||||
|
||||
export const containerId = "dependency-sample-container";
|
||||
export const dependencyListenerButtonId = "dependency-listener-button";
|
||||
export const dependencyListenerDetailsContainerId = "dependency-listener-detail-container";
|
||||
export const dependencyInitializerDetailsContainerId = "dependency-initializer-detail-container";
|
||||
export const stopDependencyEventButtonId = "stop-dependency-events";
|
||||
export const fetchCallId = "create-fetch-request";
|
||||
export const fetchXhrId = "create-xhr-request";
|
||||
export const untrackFetchRequestId = "create-untrack-fetch-request";
|
||||
export const removeAllHandlersId = "remove-all-handlers";
|
||||
export const buttonSectionId = "button-section";
|
||||
export const clearDetailsButtonId = "clear-all-details";
|
||||
export const addHandlersButtonId = "add-handlers";
|
||||
export const dependencyListenerDetails: string[] = ["input","traceId","spanId","traceFlags","context"]; // check full details in console
|
||||
export const dependencyInitializerDetails: string[] = ["item","properties","sysProperties","context"]; // check full details in console
|
||||
export const ajaxDetails: string[] = ["disabbleFetchTracking", "disableExceptionTracking", "enableAutoRouteTracking"];
|
||||
export const analyticsDetails: string[] = ["autoTrackPageVisitTime", "appId", "enableAjaxPerfTracking", "enableCorsCorrelation"];
|
||||
|
||||
|
||||
export function createFetchRequest() {
|
||||
fetch("https://api.npms.io/v2/search?q=react&size=1").then(() =>{
|
||||
console.log("a fetch call triggered");
|
||||
});
|
||||
}
|
||||
|
||||
export function createXhrRequest() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "https://api.npms.io/v2/search?q=react&size=1");
|
||||
xhr.onload = function() {
|
||||
console.log("a xhr call triggered");
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
export function createUnTrackRequest() {
|
||||
fetch("https://api.npms.io/v2/search?q=angular&size=1").then(() =>{
|
||||
console.log("a untracked fetch call triggered");
|
||||
});
|
||||
}
|
||||
|
||||
export function randomBoolean() {
|
||||
if (Math.random() > 0.5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function createDetailList(propsToWatch: string[], details: any, id: string, title: string) {
|
||||
let container = document.getElementById(id);
|
||||
let ele = document.createElement("div");
|
||||
ele.className = "list";
|
||||
let date = new Date();
|
||||
let list = "";
|
||||
if (details) {
|
||||
list += `
|
||||
<h6>Dependency ${title} Details After Modifications</h6>
|
||||
<div>Check console for details before modifications and network trace for complete details</div>
|
||||
<div class="time">Date: ${date}</div>
|
||||
`;
|
||||
|
||||
arrForEach(propsToWatch, (prop) => {
|
||||
let obj = details[prop];
|
||||
if (prop === "item") {
|
||||
obj = {name: obj.name, target: obj.target};
|
||||
}
|
||||
obj = (obj === undefined)? "undefined" : obj;
|
||||
if (typeof obj === "object") {
|
||||
obj = JSON.stringify(obj);
|
||||
}
|
||||
list += `<li>${prop}: ${obj}</li>`;
|
||||
|
||||
});
|
||||
|
||||
list += "<div>-------------------------</div>";
|
||||
ele.innerHTML = list;
|
||||
container?.appendChild(ele);
|
||||
}
|
||||
}
|
||||
|
||||
export function createContainers() {
|
||||
let container = document.createElement("div");
|
||||
container.className = "container";
|
||||
container.id = containerId;
|
||||
let buttonSection = createSubContainer(buttonSectionId, "container");
|
||||
container.appendChild(buttonSection);
|
||||
let ListenerSection = createSubContainer(dependencyListenerDetailsContainerId);
|
||||
container.appendChild(ListenerSection);
|
||||
let initializerSection = createSubContainer(dependencyInitializerDetailsContainerId);
|
||||
container.appendChild(initializerSection);
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
export function createSubContainer(id: string, className?: string) {
|
||||
let ele = document.createElement("div");
|
||||
ele.className = className || "container-main";
|
||||
ele.id = id;
|
||||
return ele
|
||||
}
|
||||
|
||||
export function createButton(buttonTextContent: string, buttonOnclickFn: any, id?: string): HTMLButtonElement {
|
||||
let btn = document.createElement("button");
|
||||
if (id) {
|
||||
btn.id = id;
|
||||
}
|
||||
btn.innerHTML = buttonTextContent
|
||||
btn.onclick = buttonOnclickFn;
|
||||
return btn;
|
||||
}
|
||||
|
||||
export function clearEle(id: string) {
|
||||
let ele = document.getElementById(id);
|
||||
if (ele) {
|
||||
ele.innerHTML = "";
|
||||
}
|
||||
}
|
||||
|
||||
export function clearDetailsList() {
|
||||
clearEle(dependencyListenerDetailsContainerId);
|
||||
clearEle(dependencyInitializerDetailsContainerId);
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: "Segoe UI", sans-serif;
|
||||
font-size: 16px;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
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: 0.67rem 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 0.5rem;
|
||||
}
|
||||
|
||||
.container-main {
|
||||
justify-content: space-between;
|
||||
font-size: 0.9rem;
|
||||
position: relative;
|
||||
margin: 1.5rem auto;
|
||||
padding-left: 0.5rem;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
background-color: azure;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-weight: bold;
|
||||
font-size: 0.8rem;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "es6",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist-esm",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": false,
|
||||
"importHelpers": true,
|
||||
"declaration": true,
|
||||
"declarationDir": "./types",
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": [
|
||||
"./src"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
|
@ -5,15 +5,17 @@
|
|||
|
||||
Dependencies Plugin for the Application Insights Javascript SDK
|
||||
|
||||
## Build:
|
||||
```
|
||||
## Build
|
||||
|
||||
``` javascript
|
||||
npm install -g grunt-cli
|
||||
npm install
|
||||
npm run build --silent
|
||||
```
|
||||
|
||||
## Run unit tests:
|
||||
```
|
||||
## Run unit tests
|
||||
|
||||
```javascript
|
||||
npm run test
|
||||
```
|
||||
|
||||
|
@ -22,7 +24,7 @@ npm run test
|
|||
This project welcomes contributions and suggestions. Most contributions require you to
|
||||
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
|
||||
and actually do, grant us the rights to use your contribution. For details, visit
|
||||
https://cla.microsoft.com.
|
||||
<https://cla.microsoft.com>.
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether you need
|
||||
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
|
||||
|
@ -36,7 +38,7 @@ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any addi
|
|||
|
||||
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
|
||||
|
||||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
||||
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
||||
|
||||
## Trademarks
|
||||
|
||||
|
|
14
gruntfile.js
14
gruntfile.js
|
@ -444,6 +444,17 @@ module.exports = function (grunt) {
|
|||
path: "./examples/shared-worker",
|
||||
testHttp: false
|
||||
},
|
||||
"example-aisku": {
|
||||
autoMinify: false,
|
||||
path: "./examples/AISKU",
|
||||
testHttp: false
|
||||
},
|
||||
|
||||
"example-dependency": {
|
||||
autoMinify: false,
|
||||
path: "./examples/dependency",
|
||||
testHttp: false
|
||||
},
|
||||
// Tools
|
||||
"rollupuglify": {
|
||||
autoMinify: false,
|
||||
|
@ -760,6 +771,9 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask("tst-framework", tsBuildActions("tst-framework"));
|
||||
grunt.registerTask("serve", ["connect:server:keepalive"]);
|
||||
|
||||
grunt.registerTask("example-aisku", tsBuildActions("example-aisku"));
|
||||
grunt.registerTask("example-dependency", tsBuildActions("example-dependency"));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error("stack: '" + e.stack + "', message: '" + e.message + "', name: '" + e.name + "'");
|
||||
|
|
12
rush.json
12
rush.json
|
@ -103,6 +103,16 @@
|
|||
"packageName": "@microsoft/applicationinsights-example-shared-worker",
|
||||
"projectFolder": "examples/shared-worker",
|
||||
"shouldPublish": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"packageName": "@microsoft/applicationinsights-example-aisku",
|
||||
"projectFolder": "examples/AISKU",
|
||||
"shouldPublish": false
|
||||
},
|
||||
{
|
||||
"packageName": "@microsoft/applicationinsights-example-dependencies",
|
||||
"projectFolder": "examples/dependency",
|
||||
"shouldPublish": false
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче