@@ -7,26 +7,26 @@ Feature Management Application Insights Plugin for Node provides a solution for
7
7
### Prerequisites
8
8
9
9
- Node.js LTS version
10
+ - ` applicationinsights ` SDK v2(classic)
10
11
11
12
### Usage
12
13
13
14
``` javascript
14
- import appInsights from " applicationinsights" ;
15
- import { FeatureManager , ConfigurationObjectFeatureFlagProvider } from " @microsoft/feature-management" ;
16
- import { createTelemetryPublisher , trackEvent } from " @microsoft/feature-management-applicationinsights-node" ;
15
+ const appInsights = require (" applicationinsights" );
16
+ appInsights .setup (process .env .APPINSIGHTS_CONNECTION_STRING ).start ();
17
17
18
- appInsights . setup ( CONNECTION_STRING )
19
- . start ( );
18
+ const { FeatureManager , ConfigurationObjectFeatureFlagProvider } = require ( " @microsoft/feature-management " );
19
+ const { createTelemetryPublisher , trackEvent } = require ( " @microsoft/feature-management-applicationinsights-node " );
20
20
21
21
const publishTelemetry = createTelemetryPublisher (appInsights .defaultClient );
22
22
const provider = new ConfigurationObjectFeatureFlagProvider (jsonObject);
23
23
const featureManager = new FeatureManager (provider, {onFeatureEvaluated: publishTelemetry});
24
24
25
25
// FeatureEvaluation event will be emitted when a feature flag is evaluated
26
- featureManager .getVariant (" TestFeature" , {userId : TARGETING_ID }).then ((variant ) => { /* do something*/ });
26
+ featureManager .getVariant (" TestFeature" , {userId : " < TARGETING_ID> " }).then ((variant ) => { /* do something*/ });
27
27
28
28
// Emit a custom event with targeting id attached.
29
- trackEvent (appInsights .defaultClient , TARGETING_ID , {name: " TestEvent" });
29
+ trackEvent (appInsights .defaultClient , " < TARGETING_ID> " , {name: " TestEvent" });
30
30
```
31
31
32
32
## Contributing
0 commit comments