mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-24 14:36:54 +00:00
e5fc6f2022
Co-authored-by: Steve Faulkner <stfaul@microsoft.com>
22 lines
595 B
JavaScript
22 lines
595 B
JavaScript
let client;
|
|
const appInsightsKey = process.env.PORTAL_RUNNER_APP_INSIGHTS_KEY;
|
|
if (!appInsightsKey) {
|
|
console.warn(`PORTAL_RUNNER_APP_INSIGHTS_KEY env var not set. Runner telemetry will not be reported`);
|
|
} else {
|
|
const appInsights = require("applicationinsights");
|
|
appInsights.setup(process.env.PORTAL_RUNNER_APP_INSIGHTS_KEY).start();
|
|
client = appInsights.defaultClient;
|
|
}
|
|
|
|
module.exports.trackEvent = (...args) => {
|
|
if (client) {
|
|
client.trackEvent(...args);
|
|
}
|
|
};
|
|
|
|
module.exports.trackException = exception => {
|
|
if (client) {
|
|
client.trackException({ exception });
|
|
}
|
|
};
|