本文整理汇总了TypeScript中applicationinsights.defaultClient.trackEvent方法的典型用法代码示例。如果您正苦于以下问题:TypeScript defaultClient.trackEvent方法的具体用法?TypeScript defaultClient.trackEvent怎么用?TypeScript defaultClient.trackEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类applicationinsights.defaultClient
的用法示例。
在下文中一共展示了defaultClient.trackEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: trackCustomEvent
export function trackCustomEvent (eventName: string, trackingProperties: {}) {
try {
if (appInsights.defaultClient) {
appInsights.defaultClient.trackEvent({
name: eventName,
properties: trackingProperties
})
}
} catch (err) {
logger.logError(err.stack)
}
}
示例2: 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);
}
});
示例3: 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());
});