当前位置: 首页>>代码示例>>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;未经允许,请勿转载。