@@ -7,26 +7,26 @@ Feature Management Application Insights Plugin for Node provides a solution for
77### Prerequisites
88
99- Node.js LTS version
10+ - ` applicationinsights ` SDK v2(classic)
1011
1112### Usage
1213
1314``` 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 ();
1717
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 " );
2020
2121const publishTelemetry = createTelemetryPublisher (appInsights .defaultClient );
2222const provider = new ConfigurationObjectFeatureFlagProvider (jsonObject);
2323const featureManager = new FeatureManager (provider, {onFeatureEvaluated: publishTelemetry});
2424
2525// 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*/ });
2727
2828// Emit a custom event with targeting id attached.
29- trackEvent (appInsights .defaultClient , TARGETING_ID , {name: " TestEvent" });
29+ trackEvent (appInsights .defaultClient , " < TARGETING_ID> " , {name: " TestEvent" });
3030```
3131
3232## Contributing
0 commit comments