UNPKG

@pnp/cli-microsoft365

Version:

Manage Microsoft 365 and SharePoint Framework projects on any platform

43 lines 2.2 kB
// disable automatic third-party instrumentation for Application Insights // speeds up execution by preventing loading unnecessary dependencies process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 'none'; // prevents tests from hanging process.env.APPLICATION_INSIGHTS_NO_STATSBEAT = 'true'; // suppress all logging process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = 'NONE'; import appInsights from 'applicationinsights'; import crypto from 'crypto'; import fs from 'fs'; import os from 'os'; import path from 'path'; import url from 'url'; import { app } from './utils/app.js'; const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); appInsights .setup('InstrumentationKey=6b908c80-d09f-4cf6-8274-e54349a0149a;IngestionEndpoint=https://westeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=d42020c6-da32-44f7-bbb7-666f0b3a664d') .setAutoCollectRequests(false) .setAutoCollectPerformance(false, false) .setAutoCollectExceptions(false) .setAutoCollectDependencies(false) .setAutoCollectConsole(false, false) .setAutoCollectPreAggregatedMetrics(false) .setSendLiveMetrics(false) .enableWebInstrumentation(false) .setInternalLogging(false, false); // append -dev to the version number when ran locally // to distinguish production and dev version of the CLI // in the telemetry const version = `${app.packageJson().version}${fs.existsSync(path.join(__dirname, `..${path.sep}src`)) ? '-dev' : ''}`; const env = process.env.CLIMICROSOFT365_ENV !== undefined ? process.env.CLIMICROSOFT365_ENV : ''; const appInsightsClient = appInsights.defaultClient; appInsightsClient.commonProperties = { version: version, node: process.version, env: env, ci: Boolean(process.env.CI).toString() }; appInsightsClient.context.tags[appInsightsClient.context.keys.cloudRoleInstance] = crypto.createHash('sha256').update(os.hostname()).digest('hex'); delete appInsightsClient.context.tags[appInsightsClient.context.keys.cloudRole]; delete appInsightsClient.context.tags['ai.cloud.roleName']; export default appInsightsClient; //# sourceMappingURL=appInsights.js.map