Skip to content

fix: changed log level of provider state change transition messages to debug#1987

Open
jarebudev wants to merge 2 commits into
open-feature:mainfrom
jarebudev:1986_log_level_change
Open

fix: changed log level of provider state change transition messages to debug#1987
jarebudev wants to merge 2 commits into
open-feature:mainfrom
jarebudev:1986_log_level_change

Conversation

@jarebudev

Copy link
Copy Markdown
Contributor

This PR

Changes the logging level of provider state change transition messages from info to debug to reduce logging noise.

Related Issues

Fixes #1986

Signed-off-by: jarebudev <23311805+jarebudev@users.noreply.github.com>
@jarebudev jarebudev requested review from a team as code owners July 7, 2026 21:05
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

FeatureProviderStateManager now delegates provider state transition logging to a helper that selects error, warn, or debug based on the target state.

Changes

Provider state logging

Layer / File(s) Summary
State transition logging
src/main/java/dev/openfeature/sdk/FeatureProviderStateManager.java
setState delegates transition logging to a helper that logs ERROR at error level, FATAL at warn level, and other states at debug level while preserving the message and values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: aepfli, chrfwow

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: provider state transition logs were changed to debug.
Description check ✅ Passed The description matches the code change and the linked issue about reducing provider transition log noise.
Linked Issues check ✅ Passed The PR addresses #1986 by reducing provider state transition log noise with lower-severity logging.
Out of Scope Changes check ✅ Passed The only change is the provider state transition logging logic in FeatureProviderStateManager.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.21%. Comparing base (a7d4e8a) to head (9bfc15b).

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     
Flag Coverage Δ
unittests 93.21% <100.00%> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we have a higher log level when we transition into and out of the error state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with this. I'm fine with debug for all state changes that do not involve ERROR.

@toddbaert toddbaert requested a review from chrfwow July 13, 2026 16:52
Signed-off-by: jarebudev <23311805+jarebudev@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfc15b and deed1a1.

📒 Files selected for processing (1)
  • src/main/java/dev/openfeature/sdk/FeatureProviderStateManager.java

Comment on lines +77 to +88
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can this logger be changed from INFO to DEBUG or TRACE.

3 participants