Merge pull request #156 from rdkcentral/shanshan_dev#164
Merged
Conversation
Reduce logs related to preprocessing
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
There was a problem hiding this comment.
Pull request overview
This pull request improves observability of the Feature Control “precook” evaluation path by collecting rule-evaluation reasons into a ruleEval field and reducing log noise by downgrading several precook mismatch logs to Debug.
Changes:
- Added
ruleEvalReasonstracking inGetFeatureControlSettingsHandlerand persisted it into log/audit fields asruleEval. - Refactored
generatePrecookDataChangedMetricsto return change reasons (in addition to emitting metrics) and adjusted multiple precook-related logs fromInfotoDebug. - Minor flow cleanups around precook 304 / precook response handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dataapi/feature_control_handler.go | Adds ruleEvalReasons collection and emits fields["ruleEval"] for request logging/metrics, plus adjusts some precook log behavior and flow. |
| dataapi/feature_control_context.go | Updates precook “data changed” metrics helper to return change-reason strings and downgrades several mismatch logs to Debug. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AravindhanBoopalan
approved these changes
May 21, 2026
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request enhances the logging and observability of the precook feature evaluation process in the feature control API. The main improvements are the introduction of a
ruleEvalReasonsarray to capture and propagate the reasons for key decision points throughout the request lifecycle, and the adjustment of log levels for less noisy output. These changes will make it easier to debug and analyze why certain feature control decisions were made, especially regarding precook data usage and mismatches.Key changes:
Improved Reason Tracking for Rule Evaluation:
ruleEvalReasonsslice inGetFeatureControlSettingsHandlerto accumulate reasons for why precook data is or isn't used (e.g., "precook-off", "mac-excluded", "first-contact", "model-change", "firmware-mismatch", etc.), and propagated this information through the request lifecycle. This array is now included in the logging fields under the"ruleEval"key for better observability. [1] [2] [3] [4] [5] [6]Metrics and Reason Extraction in Helper Function:
generatePrecookDataChangedMetricsto return a list of change reasons (like "model-change", "partner-change", "account-mismatched", etc.) in addition to incrementing metrics, so these can be logged and surfaced to the caller.Log Level Adjustments:
InfotoDebuglevel to reduce log noise and focus attention on more actionable events. [1] [2] [3] [4]Precook Response Handling:
ruleEvalReasonsis set to["precook"]to clearly indicate the path taken, and that fallback reasons are set appropriately depending on the evaluation path. [1] [2]Code Clean-up:
featureControlRuleBaseto just before its first use to improve code clarity. [1] [2]These changes collectively improve the transparency and traceability of feature control decisions, making it easier to diagnose issues and understand system behavior in production.