From 46828d62abf930118a161f63d903af737119e7da Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 10 May 2023 16:00:23 -0700 Subject: [PATCH] Remove applicationinsights (#673) Based on an analysis of azure usage with @RyanCavanaugh. This hasn't worked for a long time, because there's a bug in the publish notification code that runs before the logging. I'm not sure whether to delete that or to fix it. Publication has been reliable (and predictable!--since the Functions changeover) for a long time so neither the stats nor the notification are as necessary as they once were. --- packages/publisher/package.json | 1 - packages/publisher/src/full.ts | 5 - .../publisher/src/get-definitely-typed.ts | 5 - packages/publisher/src/main.ts | 9 -- packages/publisher/src/publish-packages.ts | 20 --- yarn.lock | 118 +----------------- 6 files changed, 3 insertions(+), 155 deletions(-) diff --git a/packages/publisher/package.json b/packages/publisher/package.json index 8277c4960e..e2f22ea076 100644 --- a/packages/publisher/package.json +++ b/packages/publisher/package.json @@ -15,7 +15,6 @@ "@definitelytyped/typescript-versions": "^0.0.159", "@definitelytyped/utils": "^0.0.159", "@octokit/rest": "^16.1.0", - "applicationinsights": "^2", "fs-extra": "^9.1.0", "fstream": "^1.0.12", "hh-mm-ss": "^1.2.0", diff --git a/packages/publisher/src/full.ts b/packages/publisher/src/full.ts index 9274001241..bd7258ca2b 100644 --- a/packages/publisher/src/full.ts +++ b/packages/publisher/src/full.ts @@ -1,4 +1,3 @@ -import applicationinsights = require("applicationinsights"); import * as yargs from "yargs"; import calculateVersions from "./calculate-versions"; @@ -11,10 +10,6 @@ import { numberOfOsProcesses } from "./util/util"; import { defaultLocalOptions } from "./lib/common"; if (!module.parent) { - if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) { - applicationinsights.setup(); - applicationinsights.start(); - } const dry = !!yargs.argv.dry; logUncaughtErrors( full(dry, process.env.GH_API_TOKEN || "", new Fetcher(), defaultLocalOptions, loggerWithErrors()[0]) diff --git a/packages/publisher/src/get-definitely-typed.ts b/packages/publisher/src/get-definitely-typed.ts index 1e919b216c..794908e476 100644 --- a/packages/publisher/src/get-definitely-typed.ts +++ b/packages/publisher/src/get-definitely-typed.ts @@ -1,15 +1,10 @@ import assert from "assert"; import yargs from "yargs"; -import applicationinsights from "applicationinsights"; import { logUncaughtErrors, loggerWithErrors } from "@definitelytyped/utils"; import { getDefinitelyTyped } from "@definitelytyped/definitions-parser"; import { defaultLocalOptions, defaultRemoteOptions } from "./lib/common"; if (!module.parent) { - if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) { - applicationinsights.setup(); - applicationinsights.start(); - } const dry = !!yargs.argv.dry; console.log("gettingDefinitelyTyped: " + (dry ? "from github" : "locally")); logUncaughtErrors(async () => { diff --git a/packages/publisher/src/main.ts b/packages/publisher/src/main.ts index 9c28375f63..fd30ceaf62 100644 --- a/packages/publisher/src/main.ts +++ b/packages/publisher/src/main.ts @@ -1,4 +1,3 @@ -import applicationinsights = require("applicationinsights"); import * as yargs from "yargs"; import { pathExists, writeFile, remove } from "fs-extra"; import { getSecret, Secret } from "./lib/secrets"; @@ -16,10 +15,6 @@ export default function main() { console.log("The environment variable GITHUB_ACCESS_TOKEN must be set."); } else { console.log(`=== ${dry ? "DRY" : "PRODUCTION"} RUN ===`); - if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) { - applicationinsights.setup().start(); - console.log("Done initialising App Insights"); - } const fetcher = new Fetcher(); const log = loggerWithErrors()[0]; log.info(""); @@ -61,10 +56,6 @@ export async function withFileLock(lockFilePath: string, cb: () => Promise () => remove(lockFilePath), async (error) => { console.error(error?.stack || error?.message || error); - applicationinsights.defaultClient.trackException({ - exception: error, - }); - await remove(lockFilePath); process.exit(1); } diff --git a/packages/publisher/src/publish-packages.ts b/packages/publisher/src/publish-packages.ts index 5b7b168526..a7bc4f0b66 100644 --- a/packages/publisher/src/publish-packages.ts +++ b/packages/publisher/src/publish-packages.ts @@ -1,4 +1,3 @@ -import applicationinsights = require("applicationinsights"); import * as yargs from "yargs"; import { defaultLocalOptions } from "./lib/common"; @@ -86,8 +85,6 @@ export default async function publishPackages( githubAccessToken, fetcher )) as { merged_at: string }; - const latency = Date.now() - new Date(latest.merged_at).valueOf(); - const commitlatency = Date.now() - new Date(commits[0].commit.author.date).valueOf(); log("Current date is " + new Date(Date.now()).toString()); log(" Merge date is " + new Date(latest.merged_at).toString()); @@ -106,23 +103,6 @@ export default async function publishPackages( ); log("From github: " + JSON.stringify(commented).slice(0, 200)); } - if (dry) { - log("(dry) Not logging latency"); - } else { - applicationinsights.defaultClient.trackEvent({ - name: "publish package", - properties: { - name: cp.pkg.desc, - latency: latency.toString(), - commitLatency: commitlatency.toString(), - authorCommit: commits[0].sha, - pr: latestPr.toString(), - }, - }); - applicationinsights.defaultClient.trackMetric({ name: "publish latency", value: latency }); - applicationinsights.defaultClient.trackMetric({ name: "author commit latency", value: commitlatency }); - log("Done logging latency"); - } } } diff --git a/yarn.lock b/yarn.lock index 062fd27ffb..7fd26b411b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,7 +63,7 @@ dependencies: tslib "^2.2.0" -"@azure/core-rest-pipeline@^1.1.0", "@azure/core-rest-pipeline@^1.10.0", "@azure/core-rest-pipeline@^1.3.0", "@azure/core-rest-pipeline@^1.8.0", "@azure/core-rest-pipeline@^1.9.1": +"@azure/core-rest-pipeline@^1.1.0", "@azure/core-rest-pipeline@^1.3.0", "@azure/core-rest-pipeline@^1.8.0", "@azure/core-rest-pipeline@^1.9.1": version "1.10.1" resolved "https://registry.yarnpkg.com/@azure/core-rest-pipeline/-/core-rest-pipeline-1.10.1.tgz#348290847ca31b9eecf9cf5de7519aaccdd30968" integrity sha512-Kji9k6TOFRDB5ZMTw8qUf2IJ+CeJtsuMdAHox9eqpTf1cefiNMpzrfnF6sINEBZJsaVaWgQ0o48B6kcUH68niA== @@ -1537,11 +1537,6 @@ npmlog "^4.1.2" write-file-atomic "^3.0.3" -"@microsoft/applicationinsights-web-snippet@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@microsoft/applicationinsights-web-snippet/-/applicationinsights-web-snippet-1.0.1.tgz#6bb788b2902e48bf5d460c38c6bb7fedd686ddd7" - integrity sha512-2IHAOaLauc8qaAitvWS+U931T+ze+7MNWrDHY47IENP5y2UA0vqJDu67kWZDdpCN1fFC77sfgfB+HV7SrKshnQ== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1841,40 +1836,11 @@ dependencies: "@octokit/openapi-types" "^12.11.0" -"@opentelemetry/api@^1.0.0", "@opentelemetry/api@^1.0.4": +"@opentelemetry/api@^1.0.0": version "1.4.0" resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.4.0.tgz#2c91791a9ba6ca0a0f4aaac5e45d58df13639ac8" integrity sha512-IgMK9i3sFGNUqPMbjABm0G26g0QCKCUBfglhQ7rQq6WcxbKfEHRcmwsoER4hZcuYqJgkYn2OeuoJIv7Jsftp7g== -"@opentelemetry/core@1.9.1", "@opentelemetry/core@^1.0.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-1.9.1.tgz#e343337e1a7bf30e9a6aef3ef659b9b76379762a" - integrity sha512-6/qon6tw2I8ZaJnHAQUUn4BqhTbTNRS0WP8/bA0ynaX+Uzp/DDbd0NS0Cq6TMlh8+mrlsyqDE7mO50nmv2Yvlg== - dependencies: - "@opentelemetry/semantic-conventions" "1.9.1" - -"@opentelemetry/resources@1.9.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.9.1.tgz#5ad3d80ba968a3a0e56498ce4bc82a6a01f2682f" - integrity sha512-VqBGbnAfubI+l+yrtYxeLyOoL358JK57btPMJDd3TCOV3mV5TNBmzvOfmesM4NeTyXuGJByd3XvOHvFezLn3rQ== - dependencies: - "@opentelemetry/core" "1.9.1" - "@opentelemetry/semantic-conventions" "1.9.1" - -"@opentelemetry/sdk-trace-base@^1.0.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.9.1.tgz#c349491b432a7e0ae7316f0b48b2d454d79d2b84" - integrity sha512-Y9gC5M1efhDLYHeeo2MWcDDMmR40z6QpqcWnPCm4Dmh+RHAMf4dnEBBntIe1dDpor686kyU6JV1D29ih1lZpsQ== - dependencies: - "@opentelemetry/core" "1.9.1" - "@opentelemetry/resources" "1.9.1" - "@opentelemetry/semantic-conventions" "1.9.1" - -"@opentelemetry/semantic-conventions@1.9.1", "@opentelemetry/semantic-conventions@^1.0.1": - version "1.9.1" - resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.9.1.tgz#ad3367684a57879392513479e0a436cb2ac46dad" - integrity sha512-oPQdbFDmZvjXk5ZDoBGXG8B4tSB/qW5vQunJWQMFUBp7Xe8O1ByPANueJ+Jzg58esEBegyyxZ7LRmfJr7kFcFg== - "@qiwi/npm-registry-client@^8.9.1": version "8.9.1" resolved "https://registry.yarnpkg.com/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz#1769f6501a436ec39c496ca0a9a2fab9db7718df" @@ -2475,23 +2441,6 @@ anymatch@^3.0.3: normalize-path "^3.0.0" picomatch "^2.0.4" -applicationinsights@^2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-2.4.2.tgz#e51f9a27dc8333abad0d22f33ceb96ded5c57db9" - integrity sha512-cFI5r2JA4JhPvxLKwWzHgryrRc/3X2gR36iE7OWvdX4neltFzJyrYWXraWYMHpHqQojhmcX++Q7bT0XR8tzegA== - dependencies: - "@azure/core-auth" "^1.4.0" - "@azure/core-rest-pipeline" "^1.10.0" - "@microsoft/applicationinsights-web-snippet" "^1.0.1" - "@opentelemetry/api" "^1.0.4" - "@opentelemetry/core" "^1.0.1" - "@opentelemetry/sdk-trace-base" "^1.0.1" - "@opentelemetry/semantic-conventions" "^1.0.1" - cls-hooked "^4.2.2" - continuation-local-storage "^3.2.1" - diagnostic-channel "1.1.0" - diagnostic-channel-publishers "1.0.5" - aproba@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -2619,21 +2568,6 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-hook-jl@^1.7.6: - version "1.7.6" - resolved "https://registry.yarnpkg.com/async-hook-jl/-/async-hook-jl-1.7.6.tgz#4fd25c2f864dbaf279c610d73bf97b1b28595e68" - integrity sha512-gFaHkFfSxTjvoxDMYqDuGHlcRyUuamF8s+ZTtJdDzqjws4mCt7v0vuV79/E2Wr2/riMQgtG4/yUtXWs1gZ7JMg== - dependencies: - stack-chain "^1.3.7" - -async-listener@^0.6.0: - version "0.6.10" - resolved "https://registry.yarnpkg.com/async-listener/-/async-listener-0.6.10.tgz#a7c97abe570ba602d782273c0de60a51e3e17cbc" - integrity sha512-gpuo6xOyF4D5DE5WvyqZdPA3NGhiT6Qf07l7DCB0wwDEsLvDIbCr6j9S5aj5Ch96dLace5tXVzWBZkxU/c5ohw== - dependencies: - semver "^5.3.0" - shimmer "^1.1.0" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -3085,15 +3019,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== -cls-hooked@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/cls-hooked/-/cls-hooked-4.2.2.tgz#ad2e9a4092680cdaffeb2d3551da0e225eae1908" - integrity sha512-J4Xj5f5wq/4jAvcdgoGsL3G103BtWpZrMo8NEinRltN+xpTZdI+M38pyQqhuFU/P792xkMFvnKSf+Lm81U1bxw== - dependencies: - async-hook-jl "^1.7.6" - emitter-listener "^1.0.1" - semver "^5.4.1" - cmd-shim@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-4.1.0.tgz#b3a904a6743e9fede4148c6f3800bf2a08135bdd" @@ -3211,14 +3136,6 @@ console-control-strings@^1.0.0, console-control-strings@^1.1.0, console-control- resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== -continuation-local-storage@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/continuation-local-storage/-/continuation-local-storage-3.2.1.tgz#11f613f74e914fe9b34c92ad2d28fe6ae1db7ffb" - integrity sha512-jx44cconVqkCEEyLSKWwkvUXwO561jXMa3LPjTPsm5QR22PA0/mhe33FT4Xb5y74JDvt/Cq+5lm8S8rskLv9ZA== - dependencies: - async-listener "^0.6.0" - emitter-listener "^1.1.1" - conventional-changelog-angular@^5.0.12: version "5.0.13" resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz#896885d63b914a70d4934b59d2fe7bde1832b28c" @@ -3496,18 +3413,6 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" -diagnostic-channel-publishers@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/diagnostic-channel-publishers/-/diagnostic-channel-publishers-1.0.5.tgz#df8c317086c50f5727fdfb5d2fce214d2e4130ae" - integrity sha512-dJwUS0915pkjjimPJVDnS/QQHsH0aOYhnZsLJdnZIMOrB+csj8RnZhWTuwnm8R5v3Z7OZs+ksv5luC14DGB7eg== - -diagnostic-channel@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/diagnostic-channel/-/diagnostic-channel-1.1.0.tgz#6985e9dfedfbc072d91dc4388477e4087147756e" - integrity sha512-fwujyMe1gj6rk6dYi9hMZm0c8Mz8NDMVl2LB4iaYh3+LIAThZC8RKFGXWG0IML2OxAit/ZFRgZhMkhQ3d/bobQ== - dependencies: - semver "^5.3.0" - diff-sequences@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" @@ -3583,13 +3488,6 @@ electron-to-chromium@^1.4.284: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.314.tgz#33e4ad7a2ca2ddbe2e113874cc0c0e2a00cb46bf" integrity sha512-+3RmNVx9hZLlc0gW//4yep0K5SYKmIvB5DXg1Yg6varsuAHlHwTeqeygfS8DWwLCsNOWrgj+p9qgM5WYjw1lXQ== -emitter-listener@^1.0.1, emitter-listener@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/emitter-listener/-/emitter-listener-1.1.2.tgz#56b140e8f6992375b3d7cb2cab1cc7432d9632e8" - integrity sha512-Bt1sBAGFHY9DKY+4/2cV6izcKJUf5T7/gkdmkxzX/qv9CcGH8xSwVRW5mtX03SWJtRTWSOpzCuWN9rBFYZepZQ== - dependencies: - shimmer "^1.2.0" - emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -7539,7 +7437,7 @@ safe-regex-test@^1.0.0: dependencies: lru-cache "^6.0.0" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.1: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.6.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -7585,11 +7483,6 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shimmer@^1.1.0, shimmer@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.2.1.tgz#610859f7de327b587efebf501fb43117f9aff337" - integrity sha512-sQTKC1Re/rM6XyFM6fIAGHRPVGvyXfgzIDvzoq608vM+jeyVD0Tu1E6Np0Kc2zAIFWIj963V2800iF/9LPieQw== - side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -7808,11 +7701,6 @@ ssri@^9.0.0: dependencies: minipass "^3.1.1" -stack-chain@^1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/stack-chain/-/stack-chain-1.3.7.tgz#d192c9ff4ea6a22c94c4dd459171e3f00cea1285" - integrity sha512-D8cWtWVdIe/jBA7v5p5Hwl5yOSOrmZPWDPe2KxQ5UAGD+nxbxU0lKXA4h85Ta6+qgdKVL3vUxsbIZjc1kBG7ug== - stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f"