當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript applicationinsights.defaultClient類代碼示例

本文整理匯總了TypeScript中applicationinsights.defaultClient的典型用法代碼示例。如果您正苦於以下問題:TypeScript defaultClient類的具體用法?TypeScript defaultClient怎麽用?TypeScript defaultClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了defaultClient類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Promise

	return new Promise(resolve => {
		try {

			const sizes: any = {};
			const counts: any = {};
			for (const entry of sorted) {
				sizes[entry.name] = entry.totalSize;
				counts[entry.name] = entry.totalCount;
			}

			appInsights.setup(productJson.aiConfig.asimovKey)
				.setAutoCollectConsole(false)
				.setAutoCollectExceptions(false)
				.setAutoCollectPerformance(false)
				.setAutoCollectRequests(false)
				.setAutoCollectDependencies(false)
				.setAutoDependencyCorrelation(false)
				.start();

			appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';

			/* __GDPR__
				"monacoworkbench/packagemetrics" : {
					"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
					"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
					"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
				}
			*/
			appInsights.defaultClient.trackEvent({
				name: 'monacoworkbench/packagemetrics',
				properties: { commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
			});


			appInsights.defaultClient.flush({
				callback: () => {
					appInsights.dispose();
					resolve(true);
				}
			});

		} catch (err) {
			console.error('ERROR sending build stats as telemetry event!');
			console.error(err);
			resolve(false);
		}
	});
開發者ID:PKRoma,項目名稱:vscode,代碼行數:47,代碼來源:stats.ts

示例2: Promise

	return new Promise(resolve => {

		const measurements = Object.create(null);
		for (const entry of sorted) {
			measurements[`${entry.name}.size`] = entry.totalSize;
			measurements[`${entry.name}.count`] = entry.totalCount;
		}

		appInsights.setup(productJson.aiConfig.asimovKey)
			.setAutoCollectConsole(false)
			.setAutoCollectExceptions(false)
			.setAutoCollectPerformance(false)
			.setAutoCollectRequests(false)
			.start();

		appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
		appInsights.defaultClient.trackEvent(`bundleStats`, undefined, measurements);
		appInsights.defaultClient.sendPendingData(() => resolve());
	});
開發者ID:developers23,項目名稱:vscode,代碼行數:19,代碼來源:stats.ts

示例3: trackCustomEvent

export function trackCustomEvent (eventName: string, trackingProperties: {}) {
  try {
    if (appInsights.defaultClient) {
      appInsights.defaultClient.trackEvent({
        name: eventName,
        properties: trackingProperties
      })
    }
  } catch (err) {
    logger.logError(err.stack)
  }
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:12,代碼來源:customEventTracker.ts

示例4: enable

  static enable () {

    appInsights.setup(config.get<string>('secrets.cmc.AppInsightsInstrumentationKey'))
      .setAutoCollectConsole(true, true)
    appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.cloudRole] = config.get<string>('appInsights.roleName')

    appInsights.defaultClient.addTelemetryProcessor(function (envelope, contextObjects) {
      // hide UUID's in operationName URL's that are not static files, so they can be aggregated properly
      if (envelope.tags) {
        if (envelope.tags['ai.operation.name']) {
          envelope.tags['ai.operation.name'] = hideUuidInUrlIfNotStaticFile(envelope.tags['ai.operation.name'])
        }
      }

      // always send
      return true
    })

    appInsights.start()
  }
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:20,代碼來源:index.ts


注:本文中的applicationinsights.defaultClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。