Skip to content

Commit a13b16f

Browse files
Merge pull request #100 from microsoft/main
Merge main to release/v2
2 parents 63b1830 + f919243 commit a13b16f

File tree

15 files changed

+446
-691
lines changed

15 files changed

+446
-691
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@
22

33
[![feature-management](https://img.shields.io/npm/v/@microsoft/feature-management?label=@microsoft/feature-management)](https://www.npmjs.com/package/@microsoft/feature-management)
44

5-
Feature Management is a library for enabling/disabling features at runtime.
6-
Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.
5+
Feature management provides a way to develop and expose application functionality based on features. Many applications have special requirements when a new feature is developed such as when the feature should be enabled and under what conditions. This library provides a way to define these relationships, and also integrates into common .NET code patterns to make exposing these features possible.
76

87
## Getting Started
98

10-
### Prerequisites
9+
[Azure App Configuration Quickstart](https://learn.microsoft.com/azure/azure-app-configuration/quickstart-feature-flag-javascript): A quickstart guide about how to integrate feature flags from Azure App Configuration into your JavaScript applications.
1110

12-
- Node.js LTS version
11+
[Feature Overview](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-overview#feature-development-status): This document provides a feature status overview.
12+
13+
[Feature Reference](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference): This document provides a full feature rundown.
1314

1415
### Usage
1516

16-
You can use feature flags from the Azure App Configuration service, local files or any other sources.
17+
You can use feature flags from the Azure App Configuration service, local files or any other sources. For more information, please go to [Feature flag configuration](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference#feature-flag-configuration).
1718

1819
#### Use feature flags from Azure App Configuration
1920

2021
The App Configuration JavaScript provider provides feature flags in as a `Map` object.
2122
A builtin `ConfigurationMapFeatureFlagProvider` helps to load feature flags in this case.
2223

2324
```js
24-
const appConfig = await load(connectionString, {featureFlagOptions}); // load feature flags from Azure App Configuration service
25+
import { load } from "@azure/app-configuration-provider";
26+
import { FeatureManager, ConfigurationMapFeatureFlagProvider } from "@microsoft/feature-management";
27+
const appConfig = await load("<CONNECTION-STRING>", {featureFlagOptions}); // load feature flags from Azure App Configuration service
2528
const featureProvider = new ConfigurationMapFeatureFlagProvider(appConfig);
2629
const featureManager = new FeatureManager(featureProvider);
2730
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
@@ -54,13 +57,18 @@ Content of `sample.json`:
5457

5558
Load feature flags from `sample.json` file.
5659
```js
60+
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
5761
const config = JSON.parse(await fs.readFile("path/to/sample.json"));
5862
const featureProvider = new ConfigurationObjectFeatureFlagProvider(config);
5963
const featureManager = new FeatureManager(featureProvider);
6064
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
6165
console.log("Feature Alpha is:", isAlphaEnabled);
6266
```
6367

68+
## Examples
69+
70+
See code snippets under [examples/](./examples/) folder.
71+
6472
## Contributing
6573

6674
This project welcomes contributions and suggestions. Most contributions require you to agree to a

src/feature-management-applicationinsights-browser/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Microsoft Feature Management Application Insights Plugin for Browser
22

3-
Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.
3+
Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation telemetry produced by the [`@microsoft/feature-management`](https://www.npmjs.com/package/@microsoft/feature-management) library.
44

55
## Getting Started
66

7+
For more information, please go to [Feature reference](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference#application-insights-integration).
8+
79
### Usage
810

911
``` javascript
@@ -12,7 +14,7 @@ import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microso
1214
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-browser";
1315

1416
const appInsights = new ApplicationInsights({ config: {
15-
connectionString: CONNECTION_STRING
17+
connectionString: "<APPINSIGHTS_CONNECTION_STRING>"
1618
}});
1719
appInsights.loadAppInsights();
1820

src/feature-management-applicationinsights-browser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/feature-management-applicationinsights-browser",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.",
55
"main": "./dist/esm/index.js",
66
"module": "./dist/esm/index.js",
@@ -46,7 +46,7 @@
4646
},
4747
"dependencies": {
4848
"@microsoft/applicationinsights-web": "^3.3.2",
49-
"@microsoft/feature-management": "2.0.0"
49+
"@microsoft/feature-management": "2.0.1"
5050
}
5151
}
5252

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
export const VERSION = "2.0.0";
4+
export const VERSION = "2.0.1";

src/feature-management-applicationinsights-node/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
# Microsoft Feature Management Application Insights Plugin for Browser
1+
# Microsoft Feature Management Application Insights Plugin for Node
22

3-
Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.
3+
Feature Management Application Insights Plugin for Node provides a solution for sending feature flag evaluation telemetry produced by the [`@microsoft/feature-management`](https://www.npmjs.com/package/@microsoft/feature-management) library.
44

55
## Getting Started
66

7+
For more information, please go to [Feature reference](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference#application-insights-integration).
8+
79
### Prerequisites
810

911
- Node.js LTS version
12+
- `applicationinsights` SDK 2.x (classic)
1013

1114
### Usage
1215

1316
``` javascript
14-
import appInsights from "applicationinsights";
15-
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
16-
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-node";
17+
const appInsights = require("applicationinsights");
18+
appInsights.setup(process.env.APPINSIGHTS_CONNECTION_STRING).start();
1719

18-
appInsights.setup(CONNECTION_STRING)
19-
.start();
20+
const { FeatureManager, ConfigurationObjectFeatureFlagProvider } = require("@microsoft/feature-management");
21+
const { createTelemetryPublisher, trackEvent } = require("@microsoft/feature-management-applicationinsights-node");
2022

2123
const publishTelemetry = createTelemetryPublisher(appInsights.defaultClient);
2224
const provider = new ConfigurationObjectFeatureFlagProvider(jsonObject);
2325
const featureManager = new FeatureManager(provider, {onFeatureEvaluated: publishTelemetry});
2426

2527
// FeatureEvaluation event will be emitted when a feature flag is evaluated
26-
featureManager.getVariant("TestFeature", {userId : TARGETING_ID}).then((variant) => { /* do something*/ });
28+
featureManager.getVariant("TestFeature", {userId : "<TARGETING_ID>"}).then((variant) => { /* do something*/ });
2729

2830
// Emit a custom event with targeting id attached.
29-
trackEvent(appInsights.defaultClient, TARGETING_ID, {name: "TestEvent"});
31+
trackEvent(appInsights.defaultClient, "<TARGETING_ID>", {name: "TestEvent", properties: {"Tag": "Some Value"}});
3032
```
3133

3234
## Contributing

src/feature-management-applicationinsights-node/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/feature-management-applicationinsights-node",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Feature Management Application Insights Plugin for Node.js provides a solution for sending feature flag evaluation events produced by the Feature Management library.",
55
"main": "./dist/commonjs/index.js",
66
"module": "./dist/esm/index.js",
@@ -45,7 +45,7 @@
4545
},
4646
"dependencies": {
4747
"applicationinsights": "^2.9.6",
48-
"@microsoft/feature-management": "2.0.0"
48+
"@microsoft/feature-management": "2.0.1"
4949
}
5050
}
5151

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
export const VERSION = "2.0.0";
4+
export const VERSION = "2.0.1";

src/feature-management/README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@
22

33
[![feature-management](https://img.shields.io/npm/v/@microsoft/feature-management?label=@microsoft/feature-management)](https://www.npmjs.com/package/@microsoft/feature-management)
44

5-
Feature Management is a library for enabling/disabling features at runtime.
6-
Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.
5+
Feature management provides a way to develop and expose application functionality based on features. Many applications have special requirements when a new feature is developed such as when the feature should be enabled and under what conditions. This library provides a way to define these relationships, and also integrates into common .NET code patterns to make exposing these features possible.
76

87
## Getting Started
98

10-
### Prerequisites
9+
[Azure App Configuration Quickstart](https://learn.microsoft.com/azure/azure-app-configuration/quickstart-feature-flag-javascript): A quickstart guide about how to integrate feature flags from Azure App Configuration into your JavaScript applications.
1110

12-
- Node.js LTS version
11+
[Feature Overview](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-overview#feature-development-status): This document provides a feature status overview.
12+
13+
[Feature Reference](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference): This document provides a full feature rundown.
1314

1415
### Usage
1516

16-
You can use feature flags from the Azure App Configuration service, local files or any other sources.
17+
You can use feature flags from the Azure App Configuration service, local files or any other sources. For more information, please go to [Feature flag configuration](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference#feature-flag-configuration).
1718

1819
#### Use feature flags from Azure App Configuration
1920

2021
The App Configuration JavaScript provider provides feature flags in as a `Map` object.
2122
A builtin `ConfigurationMapFeatureFlagProvider` helps to load feature flags in this case.
2223

2324
```js
24-
const appConfig = load(connectionString, {featureFlagOptions}); // load feature flags from Azure App Configuration service
25+
import { load } from "@azure/app-configuration-provider";
26+
import { FeatureManager, ConfigurationMapFeatureFlagProvider } from "@microsoft/feature-management";
27+
const appConfig = await load("<CONNECTION-STRING>", {featureFlagOptions}); // load feature flags from Azure App Configuration service
2528
const featureProvider = new ConfigurationMapFeatureFlagProvider(appConfig);
2629
const featureManager = new FeatureManager(featureProvider);
2730
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
@@ -42,7 +45,7 @@ Content of `sample.json`:
4245
{
4346
"id": "Alpha",
4447
"description": "",
45-
"enabled": "true",
48+
"enabled": true,
4649
"conditions": {
4750
"client_filters": []
4851
}
@@ -54,13 +57,18 @@ Content of `sample.json`:
5457

5558
Load feature flags from `sample.json` file.
5659
```js
60+
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
5761
const config = JSON.parse(await fs.readFile("path/to/sample.json"));
5862
const featureProvider = new ConfigurationObjectFeatureFlagProvider(config);
5963
const featureManager = new FeatureManager(featureProvider);
6064
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
6165
console.log("Feature Alpha is:", isAlphaEnabled);
6266
```
6367

68+
## Examples
69+
70+
See code snippets under [examples/](./examples/) folder.
71+
6472
## Contributing
6573

6674
This project welcomes contributions and suggestions. Most contributions require you to agree to a

0 commit comments

Comments
 (0)