Skip to content

Merge pull request #156 from rdkcentral/shanshan_dev#164

Merged
yeswanth2420 merged 1 commit into
mainfrom
cherrypick_featureControlRuleBase
May 21, 2026
Merged

Merge pull request #156 from rdkcentral/shanshan_dev#164
yeswanth2420 merged 1 commit into
mainfrom
cherrypick_featureControlRuleBase

Conversation

@yeswanth2420
Copy link
Copy Markdown
Contributor

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 ruleEvalReasons array 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:

  • Introduced a ruleEvalReasons slice in GetFeatureControlSettingsHandler to 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:

  • Refactored generatePrecookDataChangedMetrics to 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:

  • Changed log messages related to precook data mismatches and absence from Info to Debug level to reduce log noise and focus attention on more actionable events. [1] [2] [3] [4]

Precook Response Handling:

  • Ensured that when a precook response is returned, the ruleEvalReasons is 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:

  • Moved the instantiation of featureControlRuleBase to 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.

Reduce logs related to preprocessing
Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ruleEvalReasons tracking in GetFeatureControlSettingsHandler and persisted it into log/audit fields as ruleEval.
  • Refactored generatePrecookDataChangedMetrics to return change reasons (in addition to emitting metrics) and adjusted multiple precook-related logs from Info to Debug.
  • 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.

Comment thread dataapi/feature_control_handler.go
Comment thread dataapi/feature_control_handler.go
Comment thread dataapi/feature_control_handler.go
@yeswanth2420 yeswanth2420 merged commit 599bdb7 into main May 21, 2026
9 of 10 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants