-
Notifications
You must be signed in to change notification settings - Fork 3
Add feature filter usage tracing #108
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7d45d1c
wip
zhiyuanliang-ms 4db7392
WIP
zhiyuanliang-ms 067a849
add integration test
zhiyuanliang-ms 8d7cefd
fix lint
zhiyuanliang-ms 0d3b560
update port
zhiyuanliang-ms 4b64726
update port
zhiyuanliang-ms b5d0a60
update
zhiyuanliang-ms ed123ef
merge main
zhiyuanliang-ms 089d677
update
zhiyuanliang-ms db2c62b
resolve conflict
zhiyuanliang-ms 4ff6c57
Merge branch 'main' of https://github.com/Azure/AppConfiguration-Java…
zhiyuanliang-ms 68aee33
avoid create new featureFlagTracing object when request tracing is di…
zhiyuanliang-ms 178e543
merge main
zhiyuanliang-ms f0dabb5
update
zhiyuanliang-ms 4f4a223
resolve conflict
zhiyuanliang-ms fcfff03
update
zhiyuanliang-ms b276673
add variant and telemetry tracing
zhiyuanliang-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| import { TIME_WINDOW_FILTER_NAMES, TARGETING_FILTER_NAMES } from "../featureManagement/constants.js"; | ||
| import { CUSTOM_FILTER_KEY, TIME_WINDOW_FILTER_KEY, TARGETING_FILTER_KEY, FF_SEED_USED_TAG, FF_TELEMETRY_USED_TAG, DELIMITER } from "./constants.js"; | ||
|
|
||
| /** | ||
| * Tracing for tracking feature flag usage. | ||
| */ | ||
| export class FeatureFlagTracingOptions { | ||
| /** | ||
| * Built-in feature filter usage. | ||
| */ | ||
| usesCustomFilter: boolean = false; | ||
| usesTimeWindowFilter: boolean = false; | ||
| usesTargetingFilter: boolean = false; | ||
| usesTelemetry: boolean = false; | ||
| usesSeed: boolean = false; | ||
| maxVariants: number = 0; | ||
|
|
||
| resetFeatureFlagTracing(): void { | ||
zhiyuanliang-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.usesCustomFilter = false; | ||
| this.usesTimeWindowFilter = false; | ||
| this.usesTargetingFilter = false; | ||
| this.usesTelemetry = false; | ||
| this.usesSeed = false; | ||
| this.maxVariants = 0; | ||
| } | ||
|
|
||
| updateFeatureFilterTracing(filterName: string): void { | ||
| if (TIME_WINDOW_FILTER_NAMES.some(name => name === filterName)) { | ||
| this.usesTimeWindowFilter = true; | ||
| } else if (TARGETING_FILTER_NAMES.some(name => name === filterName)) { | ||
| this.usesTargetingFilter = true; | ||
| } else { | ||
| this.usesCustomFilter = true; | ||
| } | ||
| } | ||
|
|
||
| notifyMaxVariants(currentFFTotalVariants: number): void { | ||
| if (currentFFTotalVariants > this.maxVariants) { | ||
| this.maxVariants = currentFFTotalVariants; | ||
| } | ||
| } | ||
|
|
||
| usesAnyFeatureFilter(): boolean { | ||
| return this.usesCustomFilter || this.usesTimeWindowFilter || this.usesTargetingFilter; | ||
| } | ||
|
|
||
| usesAnyTracingFeature() { | ||
| return this.usesSeed || this.usesTelemetry; | ||
| } | ||
|
|
||
| createFeatureFiltersString(): string { | ||
| if (!this.usesAnyFeatureFilter()) { | ||
| return ""; | ||
| } | ||
|
|
||
| let result: string = ""; | ||
| if (this.usesCustomFilter) { | ||
| result += CUSTOM_FILTER_KEY; | ||
| } | ||
| if (this.usesTimeWindowFilter) { | ||
| if (result !== "") { | ||
| result += DELIMITER; | ||
| } | ||
| result += TIME_WINDOW_FILTER_KEY; | ||
| } | ||
| if (this.usesTargetingFilter) { | ||
| if (result !== "") { | ||
| result += DELIMITER; | ||
| } | ||
| result += TARGETING_FILTER_KEY; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| createFeaturesString(): string { | ||
| if (!this.usesAnyTracingFeature()) { | ||
| return ""; | ||
| } | ||
|
|
||
| let result: string = ""; | ||
| if (this.usesSeed) { | ||
| result += FF_SEED_USED_TAG; | ||
| } | ||
| if (this.usesTelemetry) { | ||
| if (result !== "") { | ||
| result += DELIMITER; | ||
| } | ||
| result += FF_TELEMETRY_USED_TAG; | ||
| } | ||
| return result; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.