本文整理汇总了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);
}
});
示例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());
});
示例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)
}
}
示例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()
}