-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Updating Missing Telemetry #48978
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
base: main
Are you sure you want to change the base?
Updating Missing Telemetry #48978
Changes from all commits
841f224
2cfb40f
4392b43
29089b0
13b5962
1473b26
ca9a20c
606e593
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,10 @@ public class FeatureFlagTracing { | |
|
|
||
| private static final String FILTER_TYPE_DELIMITER = "+"; | ||
|
|
||
| private static final String FEATURE_FLAG_USES_TELEMETRY_TAG = "Telemetry"; | ||
|
|
||
| private static final String FEATURE_FLAG_USES_SEED_TAG = "Seed"; | ||
|
|
||
| private static final List<String> PERCENTAGE_FILTER_NAMES = Arrays.asList("Percentage", "Microsoft.Percentage", | ||
| "PercentageFilter", "Microsoft.PercentageFilter"); | ||
|
|
||
|
|
@@ -34,6 +38,12 @@ public class FeatureFlagTracing { | |
|
|
||
| private Boolean usesTargetingFilter = false; | ||
|
|
||
| private Boolean usesTelemetry = false; | ||
|
|
||
| private Boolean usesSeed = false; | ||
|
|
||
| private Integer maxVariants = null; | ||
|
|
||
| boolean usesAnyFilter() { | ||
| return usesCustomFilter || usesPercentageFilter || usesTimeWindowFilter || usesTargetingFilter; | ||
| } | ||
|
|
@@ -43,6 +53,9 @@ public void resetFeatureFilterTelemetry() { | |
| usesPercentageFilter = false; | ||
| usesTimeWindowFilter = false; | ||
| usesTargetingFilter = false; | ||
| usesTelemetry = false; | ||
| usesSeed = false; | ||
| maxVariants = null; | ||
| } | ||
|
|
||
| public void updateFeatureFilterTelemetry(String filterName) { | ||
|
|
@@ -57,6 +70,58 @@ public void updateFeatureFilterTelemetry(String filterName) { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Sets whether telemetry is used. | ||
| * @param usesTelemetry whether telemetry is used | ||
| */ | ||
| public void setUsesTelemetry(Boolean usesTelemetry) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is all feature tracing being reset after each server call? This applies to any telemetry that is tracked on the key-value (or ff) level. App-level telemetry like "uses load balancing" or "uses key vault" doesn't change, so it doesn't need to be reset. But kv-level telemetry can change based on the value in AppConfig
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is FeatureManagement telemetry, not store wide.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, so this needs to be reset based on what feature flags are loaded by the application.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is reset via I'll create an issue to track this.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this might not be an issue. Here is how it works. we have a class called We then send the feature flag telemetry if and only if refresh is enabled. As we don't make any requests after this otherwise. We use to load feature flags first to solve this, but that broke when we added support for Snapshots if I remember correctly as snapshots have negative priority order for feature flags. |
||
| this.usesTelemetry = usesTelemetry; | ||
| } | ||
|
|
||
| /** | ||
| * Sets whether seed is used. | ||
| * @param usesSeed whether seed is used | ||
| */ | ||
| public void setUsesSeed(Boolean usesSeed) { | ||
| this.usesSeed = usesSeed; | ||
| } | ||
|
|
||
| /** | ||
| * Updates max variants if the new size is larger. | ||
| * @param size size of variants | ||
| */ | ||
| public void updateMaxVariants(int size) { | ||
| if (maxVariants == null || size > maxVariants) { | ||
| maxVariants = size; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Gets the max variants value. | ||
| * @return max variants or null if not set | ||
| */ | ||
| public Integer getMaxVariants() { | ||
| return maxVariants; | ||
| } | ||
|
|
||
| /** | ||
| * Creates the FFFeatures string for correlation context. | ||
| * @return FFFeatures string with telemetry and seed tags | ||
| */ | ||
| public String createFFFeaturesString() { | ||
| StringBuilder sb = new StringBuilder(); | ||
| if (Boolean.TRUE.equals(usesSeed)) { | ||
| sb.append(FEATURE_FLAG_USES_SEED_TAG); | ||
| } | ||
| if (Boolean.TRUE.equals(usesTelemetry)) { | ||
| if (sb.length() > 0) { | ||
| sb.append(FILTER_TYPE_DELIMITER); | ||
| } | ||
| sb.append(FEATURE_FLAG_USES_TELEMETRY_TAG); | ||
| } | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| StringBuilder sb = new StringBuilder(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.