本文整理汇总了TypeScript中applicationinsights.getClient函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getClient函数的具体用法?TypeScript getClient怎么用?TypeScript getClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getClient函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getClient
export function getClient(aiKey: string): typeof appInsights.client {
ensureAIEngineIsInitialized();
const client = appInsights.getClient(aiKey);
client.channel.setOfflineMode(true);
client.context.tags[client.context.keys.deviceMachineName] = ''; //prevent App Insights from reporting machine name
if (aiKey.indexOf('AIF-') === 0) {
client.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
}
return client;
}
示例2: constructor
constructor(options: Options) {
this.name = options.name;
this.options = Object.assign({}, DEFAULT_LOGGING_OPTIONS, options.log);
this.options.messages = MessageLevel.parse(this.options.messages);
if (options.console) {
this.cClient = new ConsoleLogger(this.name, options.console);
}
if (options.telemetry) {
validateTelemetryProvider(options.telemetry);
this.tClient = ApplicationInsights.getClient(options.telemetry.key);
}
if (options.sources) {
if (!Array.isArray(options.sources)) throw new TypeError('sources option must be an array');
this.whitelist = new Set(options.sources);
}
}
示例3: getClient
function getClient(aiKey: string): typeof appInsights.client {
ensureAIEngineIsInitialized();
const client = appInsights.getClient(aiKey);
client.channel.setOfflineMode(true);
// {{SQL CARBON EDIT}}
// clear all ID fields from telemetry
client.context.tags[client.context.keys.deviceMachineName] = '';
client.context.tags[client.context.keys.cloudRoleInstance] = '';
// set envelope flags to suppress Vortex ingest header
client.addTelemetryProcessor((envelope, contextObjects) => {
envelope.flags = 0x200000;
return true;
});
if (aiKey.indexOf('AIF-') === 0) {
client.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
}
return client;
}
示例4: constructor
constructor(key: string) {
this.client = applicationinsights.getClient(key);
let sessionKey = this.client.context.keys.sessionId;
this.client.context.tags[sessionKey] = uuidv4();
}