fix: changed log level of provider state change transition messages to debug#1987
fix: changed log level of provider state change transition messages to debug#1987jarebudev wants to merge 2 commits into
Conversation
Signed-off-by: jarebudev <23311805+jarebudev@users.noreply.github.com>
📝 WalkthroughWalkthrough
ChangesProvider state logging
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1987 +/- ##
============================================
+ Coverage 92.23% 93.21% +0.97%
- Complexity 669 672 +3
============================================
Files 59 59
Lines 1635 1635
Branches 186 186
============================================
+ Hits 1508 1524 +16
+ Misses 80 66 -14
+ Partials 47 45 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| providerName = delegate.getMetadata().getName(); | ||
| } | ||
| log.info("Provider {} transitioned from state {} to state {}", providerName, oldState, state); | ||
| log.debug("Provider {} transitioned from state {} to state {}", providerName, oldState, state); |
There was a problem hiding this comment.
Should we have a higher log level when we transition into and out of the error state?
There was a problem hiding this comment.
Yes I think it's reasonable to log transitions into ERROR and FATAL states at warn/error, and going from ERROR to READY at info. Everything else at debug?
That should reduce the amount of logging noise from every state change being at info, but still having visibility of the more important provider event transitions.
There was a problem hiding this comment.
I agree with this. I'm fine with debug for all state changes that do not involve ERROR.
Signed-off-by: jarebudev <23311805+jarebudev@users.noreply.github.com>
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/dev/openfeature/sdk/FeatureProviderStateManager.java`:
- Around line 77-88: Update logProviderStateTransition to base severity on both
oldState and newState: log FATAL transitions at least at ERROR level, keep
ERROR-level transitions at ERROR, and log recoveries from ERROR or FATAL to a
non-failure state at INFO so they remain visible. Preserve DEBUG logging for
ordinary transitions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 91f9e087-2b8d-49a0-8a46-745e2c2f61f8
📒 Files selected for processing (1)
src/main/java/dev/openfeature/sdk/FeatureProviderStateManager.java
| private void logProviderStateTransition(String providerName, ProviderState oldState, ProviderState newState) { | ||
| var logMessage = "Provider {} transitioned from state {} to state {}"; | ||
| switch (newState) { | ||
| case ERROR: | ||
| log.error(logMessage, providerName, oldState, newState); | ||
| break; | ||
| case FATAL: | ||
| log.warn(logMessage, providerName, oldState, newState); | ||
| break; | ||
| default: | ||
| log.debug(logMessage, providerName, oldState, newState); | ||
| break; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major
Keep FATAL at least as severe as ERROR and preserve recovery visibility.
FATAL currently logs at WARN while ERROR logs at ERROR, so fatal provider failures can miss error-level alerts. Because this helper considers only newState, transitions such as ERROR -> READY are also downgraded to DEBUG, contrary to the prior review guidance to keep recovery from ERROR visible at INFO. Base the policy on both states, or confirm that this severity policy intentionally changed.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/dev/openfeature/sdk/FeatureProviderStateManager.java` around
lines 77 - 88, Update logProviderStateTransition to base severity on both
oldState and newState: log FATAL transitions at least at ERROR level, keep
ERROR-level transitions at ERROR, and log recoveries from ERROR or FATAL to a
non-failure state at INFO so they remain visible. Preserve DEBUG logging for
ordinary transitions.



This PR
Changes the logging level of provider state change transition messages from info to debug to reduce logging noise.
Related Issues
Fixes #1986