-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtelemetry.js
More file actions
22 lines (17 loc) · 804 Bytes
/
telemetry.js
File metadata and controls
22 lines (17 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
const config = require('./config');
const applicationInsights = require("applicationinsights");
const { createTargetingTelemetryProcessor } = require("@microsoft/feature-management-applicationinsights-node");
// Initialize Application Insights
const initializeAppInsights = (targetingContextAccessor) => {
applicationInsights.setup(config.appInsightsConnectionString).start();
// Use the targeting telemetry processor to attach targeting id to the telemetry data sent to Application Insights.
applicationInsights.defaultClient.addTelemetryProcessor(
createTargetingTelemetryProcessor(targetingContextAccessor)
);
return applicationInsights;
};
module.exports = {
initializeAppInsights
};