本文整理汇总了TypeScript中applicationinsights.setup函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setup函数的具体用法?TypeScript setup怎么用?TypeScript setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: ensureAIEngineIsInitialized
function ensureAIEngineIsInitialized(): void {
if (_initialized === false) {
// we need to pass some fake key, otherwise AI throws an exception
appInsights.setup('2588e01f-f6c9-4cd6-a348-143741f8d702')
.setAutoCollectConsole(false)
.setAutoCollectExceptions(false)
.setAutoCollectPerformance(false)
.setAutoCollectRequests(false);
_initialized = true;
}
}
开发者ID:Buildsoftwaresphere,项目名称:vscode,代码行数:12,代码来源:aiAdapter.ts
示例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);
}
});
开发者ID:PKRoma,项目名称:vscode,代码行数:47,代码来源:stats.ts
示例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());
});
开发者ID:developers23,项目名称:vscode,代码行数:19,代码来源:stats.ts
示例4: init
export function init() {
loadConfig();
let extversion: String = vscode.extensions.getExtension('julialang.language-julia').packageJSON.version;
// The Application Insights Key
let key = '';
if (vscode.env.machineId == "someValue.machineId") {
// Use the debug environment
key = '82cf1bd4-8560-43ec-97a6-79847395d791';
}
else if (extversion.includes('-')) {
// Use the dev environment
key = '94d316b7-bba0-4d03-9525-81e25c7da22f';
}
else {
// Use the production environment
key = 'ca1fb443-8d44-4a06-91fe-0235cfdf635f';
}
appInsights.setup(key)
.setAutoDependencyCorrelation(false)
.setAutoCollectRequests(false)
.setAutoCollectPerformance(false)
.setAutoCollectExceptions(false) // TODO try to get this working
.setAutoCollectDependencies(false)
.setAutoCollectConsole(false)
.setUseDiskRetryCaching(true)
.start();
extensionClient = appInsights.defaultClient;
extensionClient.addTelemetryProcessor(filterTelemetry);
extensionClient.commonProperties["vscodemachineid"] = vscode.env.machineId;
extensionClient.commonProperties["vscodesessionid"] = vscode.env.sessionId;
extensionClient.commonProperties["vscodeversion"] = vscode.version;
extensionClient.commonProperties["extversion"] = extversion;
extensionClient.context.tags[extensionClient.context.keys.cloudRole] = "Extension";
extensionClient.context.tags[extensionClient.context.keys.cloudRoleInstance] = "";
extensionClient.context.tags[extensionClient.context.keys.sessionId] = vscode.env.sessionId;
extensionClient.context.tags[extensionClient.context.keys.userId] = vscode.env.machineId;
}
开发者ID:JuliaEditorSupport,项目名称:julia-vscode,代码行数:42,代码来源:telemetry.ts
示例5: 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
示例6: bunyanLogger
import 'reflect-metadata';
import * as routes from './routes';
import * as appInsights from 'applicationinsights';
import { InversifyExpressServer } from 'inversify-express-utils';
import { container } from './ioc/ioc-container';
import './controllers';
import { bunyanLogger } from './logger';
import { requestLogger } from './middleware';
if (process.env.APPINSIGHTS_INSTRUMENTATIONKEY) {
appInsights.setup();
appInsights.start();
}
const logger = bunyanLogger();
const server = new InversifyExpressServer(container);
server.setConfig(a => {
a.use(requestLogger(logger));
routes.init(a);
});
const app = server.build();
app.set('port', process.env.PORT || 3001);
console.log('Going to try port ' + app.get('port'));
app.listen(app.get('port'), () => {
console.log('Express server listening on port ' + app.get('port'));
});
开发者ID:eliakaris,项目名称:blog,代码行数:28,代码来源:server.ts
示例7: express
import * as cors from "cors";
import * as bodyParser from "body-parser";
import ensureAdmin from './middleware/ensure-admin';
import eventbriteSync from "./middleware/eventbrite-sync";
import * as config from "./config";
import reviver from "./middleware/reviver";
import addDataContext from "./middleware/add-data-context";
import * as eventApi from "./middleware/events-api";
import * as participantsApi from "./middleware/participants-api";
import * as sessions from "./middleware/sessionpicker-api";
import setupDb from "./middleware/db-setup-api";
import * as appinsights from "applicationinsights";
import * as jwt from "express-jwt";
import apiKeyAuth from "./middleware/key-auth";
appinsights.setup(config.APP_INSIGHTS_KEY).start();
var app = express();
const jwtCheck = jwt({ secret: config.AUTH0_SECRET, audience: config.AUTH0_CLIENT });
const jwtOptionalCheck = jwt({ secret: config.AUTH0_SECRET, audience: config.AUTH0_CLIENT, credentialsRequired: false });
const jwtCheckSessionpicker = jwt({ secret: config.AUTH0_SECRET_SESSIONPICKER, audience: config.AUTH0_CLIENT_SESSIONPICKER });
// Create express server
app.use(cors());
var bodyParserOptions = { reviver: reviver };
app.use(bodyParser.json(bodyParserOptions));
// Endpoint for initializing the DB. Will return an error if DB already initialized
app.get("/admin/db-setup", jwtCheck, setupDb);
// Endpoint for triggering Eventbrite sync
开发者ID:coderdojo-linz,项目名称:participants-management-service,代码行数:31,代码来源:server.ts
示例8: Error
import * as appInsights from "applicationinsights";
// basic use
appInsights.setup("<instrumentation_key>").start();
// basic use with auto-collection configuration
appInsights.setup("<instrumentation_key>")
.setAutoCollectRequests(false)
.setAutoCollectPerformance(false)
.setAutoCollectExceptions(false)
// no telemetry will be sent until .start() is called
// this prevents any of the auto-collectors from initializing
.enableVerboseLogging()
.start();
appInsights.client.trackEvent("custom event", {customProperty: "custom property value"});
appInsights.client.trackException(new Error("handled exceptions can be logged with this method"));
appInsights.client.trackMetric("custom metric", 3);
appInsights.client.trackTrace("trace message");
appInsights.client.trackDependency("dependency name", "commandName", 500, true);
// assign common properties to all telemetry
appInsights.client.commonProperties = {
environment: "dev"
};
// send any pending data and log the response
appInsights.client.sendPendingData(function (response) {
console.log(response);
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:30,代码来源:applicationinsights-tests.ts
示例9: express
ďťżimport * as express from 'express';
import * as path from 'path';
import * as cookieParser from 'cookie-parser';
import * as bodyParser from 'body-parser';
import * as appInsights from "applicationinsights";
import {appInsightsKey} from 'src/options';
import googleActions from 'src/routes/googleActions';
appInsights.setup(appInsightsKey);
appInsights.start();
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', googleActions);
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + server.address().port);
});
开发者ID:Swimburger,项目名称:CommuteStatus,代码行数:22,代码来源:app.ts
注:本文中的applicationinsights.setup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论