Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stablize v2 #76

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/feature-management-applicationinsights-browser",
"version": "2.0.0-preview.3",
"version": "2.0.0",
"description": "Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand All @@ -24,6 +24,9 @@
"url": "git+https://github.com/microsoft/FeatureManagement-JavaScript.git"
},
"license": "MIT",
"publishConfig": {
"tag": "stable"
},
"bugs": {
"url": "https://github.com/microsoft/FeatureManagement-JavaScript/issues"
},
Expand All @@ -42,7 +45,7 @@
},
"dependencies": {
"@microsoft/applicationinsights-web": "^3.3.2",
"@microsoft/feature-management": "2.0.0-preview.3"
"@microsoft/feature-management": "2.0.0"
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export const VERSION = "2.0.0-preview.3";
export const VERSION = "2.0.0";
7 changes: 5 additions & 2 deletions sdk/feature-management-applicationinsights-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/feature-management-applicationinsights-node",
"version": "2.0.0-preview.3",
"version": "2.0.0",
"description": "Feature Management Application Insights Plugin for Node.js provides a solution for sending feature flag evaluation events produced by the Feature Management library.",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
Expand All @@ -24,6 +24,9 @@
"url": "git+https://github.com/microsoft/FeatureManagement-JavaScript.git"
},
"license": "MIT",
"publishConfig": {
"tag": "stable"
},
"bugs": {
"url": "https://github.com/microsoft/FeatureManagement-JavaScript/issues"
},
Expand All @@ -42,7 +45,7 @@
},
"dependencies": {
"applicationinsights": "^2.9.6",
"@microsoft/feature-management": "2.0.0-preview.3"
"@microsoft/feature-management": "2.0.0"
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export const VERSION = "2.0.0-preview.3";
export const VERSION = "2.0.0";
2 changes: 1 addition & 1 deletion sdk/feature-management/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion sdk/feature-management/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/feature-management",
"version": "2.0.0-preview.3",
"version": "2.0.0",
"description": "Feature Management is a library for enabling/disabling features at runtime. Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
Expand All @@ -26,6 +26,9 @@
"url": "git+https://github.com/microsoft/FeatureManagement-JavaScript.git"
},
"license": "MIT",
"publishConfig": {
"tag": "stable"
},
"bugs": {
"url": "https://github.com/microsoft/FeatureManagement-JavaScript/issues"
},
Expand Down
29 changes: 1 addition & 28 deletions sdk/feature-management/src/telemetry/featureEvaluationEvent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { EvaluationResult, VariantAssignmentReason } from "../featureManager";
import { EvaluationResult } from "../featureManager";
import { EVALUATION_EVENT_VERSION } from "../version.js";

const VERSION = "Version";
Expand All @@ -10,8 +10,6 @@ const ENABLED = "Enabled";
const TARGETING_ID = "TargetingId";
const VARIANT = "Variant";
const VARIANT_ASSIGNMENT_REASON = "VariantAssignmentReason";
const DEFAULT_WHEN_ENABLED = "DefaultWhenEnabled";
const VARIANT_ASSIGNMENT_PERCENTAGE = "VariantAssignmentPercentage";
zhiyuanliang-ms marked this conversation as resolved.
Show resolved Hide resolved

export function createFeatureEvaluationEventProperties(result: EvaluationResult): any {
if (result.feature === undefined) {
Expand All @@ -28,31 +26,6 @@ export function createFeatureEvaluationEventProperties(result: EvaluationResult)
[VARIANT_ASSIGNMENT_REASON]: result.variantAssignmentReason,
};

if (result.feature.allocation?.default_when_enabled) {
eventProperties[DEFAULT_WHEN_ENABLED] = result.feature.allocation.default_when_enabled;
}

if (result.variantAssignmentReason === VariantAssignmentReason.DefaultWhenEnabled) {
let percentileAllocationPercentage = 0;
if (result.variant !== undefined && result.feature.allocation !== undefined && result.feature.allocation.percentile !== undefined) {
for (const percentile of result.feature.allocation.percentile) {
percentileAllocationPercentage += percentile.to - percentile.from;
}
}
eventProperties[VARIANT_ASSIGNMENT_PERCENTAGE] = (100 - percentileAllocationPercentage).toString();
}
else if (result.variantAssignmentReason === VariantAssignmentReason.Percentile) {
let percentileAllocationPercentage = 0;
if (result.variant !== undefined && result.feature.allocation !== undefined && result.feature.allocation.percentile !== undefined) {
for (const percentile of result.feature.allocation.percentile) {
if (percentile.variant === result.variant.name) {
percentileAllocationPercentage += percentile.to - percentile.from;
}
}
}
eventProperties[VARIANT_ASSIGNMENT_PERCENTAGE] = percentileAllocationPercentage.toString();
}

const metadata = result.feature.telemetry?.metadata;
if (metadata) {
for (const key in metadata) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/feature-management/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export const VERSION = "2.0.0-preview.3";
export const VERSION = "2.0.0";
export const EVALUATION_EVENT_VERSION = "1.0.0";
Loading