Skip to content

log caught redis_version_cached exception#7538

Merged
adamsachs merged 4 commits intomainfrom
asachs/log-redis-version-cache-exceptions
Mar 2, 2026
Merged

log caught redis_version_cached exception#7538
adamsachs merged 4 commits intomainfrom
asachs/log-redis-version-cache-exceptions

Conversation

@adamsachs
Copy link
Copy Markdown
Contributor

Description Of Changes

We're swallowing caught Exceptions with only a DEBUG log that doesn't include the underlying exception information.

Code Changes

  • log at EXCEPTION level to include full stack trace of underlying exception
  • for production environments, I think the stack trace is suppressed - so long top-level exception summary within log message.

Steps to Confirm

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Mar 2, 2026 4:44pm
fides-privacy-center Ignored Ignored Mar 2, 2026 4:44pm

Request Review

@adamsachs adamsachs marked this pull request as ready for review March 2, 2026 16:41
@adamsachs adamsachs requested a review from a team as a code owner March 2, 2026 16:41
@adamsachs adamsachs requested review from johnewart and removed request for a team March 2, 2026 16:41
Copy link
Copy Markdown
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

ship it!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR improves exception logging in the Redis version cache utility by upgrading from DEBUG to EXCEPTION level logging. The changes ensure that when Redis becomes unavailable, the full exception details and stack traces are properly captured in logs, making debugging production issues significantly easier.

Key changes:

  • Changed logger.debug() to logger.exception() for Redis connection failures
  • Added exception object capture (except Exception as e) to include exception details in log messages
  • Maintains backward compatibility - the fallback behavior (returning stale cache or calling function directly) remains unchanged

Impact:

  • Better observability in production environments where Redis connectivity issues occur
  • No functional changes to the caching mechanism or fallback logic
  • Follows existing logging patterns used elsewhere in the codebase (e.g., memory_watchdog.py, rate_limit.py)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • This is a straightforward logging improvement with no functional changes to the caching logic. The modified code is well-tested with comprehensive test coverage, and the logging pattern follows existing conventions in the codebase. The change only affects observability and debugging capabilities without altering any business logic or error handling behavior.
  • No files require special attention

Important Files Changed

Filename Overview
src/fides/api/util/redis_version_cache.py Changed exception logging from DEBUG to EXCEPTION level to capture full stack traces and exception details when Redis is unavailable

Last reviewed commit: a5854db

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +90 to 94
logger.exception(
"redis_version_cache '{}': Redis unavailable, returning stale cached value. Exception: {}",
cache_key,
e,
)
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.

inconsistent string formatting - remove f prefix to match codebase pattern

Suggested change
logger.exception(
"redis_version_cache '{}': Redis unavailable, returning stale cached value. Exception: {}",
cache_key,
e,
)
logger.exception(
"redis_version_cache '{}': Redis unavailable, returning stale cached value. Exception: {}",
cache_key,
e,
)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +96 to 100
logger.exception(
"redis_version_cache '{}': Redis unavailable and no cached value, calling function directly. Exception: {}",
cache_key,
e,
)
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.

inconsistent string formatting - remove f prefix to match codebase pattern

Suggested change
logger.exception(
"redis_version_cache '{}': Redis unavailable and no cached value, calling function directly. Exception: {}",
cache_key,
e,
)
logger.exception(
"redis_version_cache '{}': Redis unavailable and no cached value, calling function directly. Exception: {}",
cache_key,
e,
)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@adamsachs
Copy link
Copy Markdown
Contributor Author

@greptile

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@adamsachs adamsachs enabled auto-merge March 2, 2026 16:52
@adamsachs adamsachs removed the request for review from johnewart March 2, 2026 16:53
@adamsachs
Copy link
Copy Markdown
Contributor Author

bypassing merge queue and branch protection rules (at least, attempting to!) in order to get this into main ASAP. this will give us more insight into the problem on our nightly environment, which may also be impacting a production customer environment

@adamsachs adamsachs disabled auto-merge March 2, 2026 17:06
@adamsachs adamsachs merged commit 99a0cfb into main Mar 2, 2026
53 of 54 checks passed
@adamsachs adamsachs deleted the asachs/log-redis-version-cache-exceptions branch March 2, 2026 17:06
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.

2 participants