Skip to content

log redis cache error#7540

Merged
adamsachs merged 5 commits intomainfrom
asachs/show-redis-cache-error
Mar 2, 2026
Merged

log redis cache error#7540
adamsachs merged 5 commits intomainfrom
asachs/show-redis-cache-error

Conversation

@adamsachs
Copy link
Copy Markdown
Contributor

Ticket []

Description Of Changes

Code Changes

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 6:19pm
fides-privacy-center Ignored Ignored Mar 2, 2026 6:19pm

Request Review

@adamsachs adamsachs marked this pull request as ready for review March 2, 2026 18:00
@adamsachs adamsachs requested a review from a team as a code owner March 2, 2026 18:00
@adamsachs adamsachs requested review from JadeCara, Linker44, erosselli and galvana and removed request for a team and JadeCara March 2, 2026 18:00
Comment on lines +310 to +320
# Log only essential connection details (host, port, db), exclude sensitive info
conn_kwargs = _connection._client.connection_kwargs
minimal_details = {
"host": conn_kwargs.get("host"),
"port": conn_kwargs.get("port"),
"db": conn_kwargs.get("db"),
"read_from_replicas": conn_kwargs.get("read_from_replicas"),
"username": conn_kwargs.get("username"),
"ssl": conn_kwargs.get("ssl"),
}
logger.debug("Redis connection details: {}", minimal_details)
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.

thought i'd throw this in since we're struggling to understand the current problem, but this may be too noisy and is also generally a bit 'fragile' if new connection args come in.

i don't want to blindly log connection_kwargs because of the password and ssl certs, etc.

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.

yeah -- maybe we can add it as a temporary log so we can diagnose nightly , and then remove it ?

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR adds improved error logging when Redis cache connection fails. The changes capture and log the exception along with minimal connection details (host, port, db, username, ssl settings) at debug level to help diagnose connection issues.

  • Added exception logging with connection details for debugging Redis connection failures
  • Minor update to error message wording from "unable to accept PrivacyRequests" to "redis cache is not available"

The implementation is straightforward but has minor inconsistencies with the read-only cache error handling.

Confidence Score: 4/5

  • Safe to merge - improves debugging capability with minimal risk
  • The changes are isolated to error handling and logging with no changes to core logic. While there are minor style concerns around username logging and inconsistent error handling patterns, these don't affect functionality or introduce bugs.
  • No files require special attention

Important Files Changed

Filename Overview
src/fides/api/util/cache.py Added detailed connection error logging for Redis cache failures with connection details at debug level

Last reviewed commit: eb08b4e

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

"port": conn_kwargs.get("port"),
"db": conn_kwargs.get("db"),
"read_from_replicas": conn_kwargs.get("read_from_replicas"),
"username": conn_kwargs.get("username"),
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.

logging username might be considered sensitive info despite the comment saying "exclude sensitive info"

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 2, 2026

Additional Comments (1)

src/fides/api/util/cache.py
inconsistent error handling - get_read_only_cache() uses bare except without detailed logging like get_cache() has on lines 308-320

Co-authored-by: Adrian Galvan <adrian@ethyca.com>
@adamsachs adamsachs enabled auto-merge March 2, 2026 18:09
@adamsachs adamsachs disabled auto-merge March 2, 2026 18:11
Adam Sachs added 2 commits March 2, 2026 13:12
@adamsachs adamsachs enabled auto-merge March 2, 2026 18:27
@adamsachs adamsachs added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit b148724 Mar 2, 2026
56 of 57 checks passed
@adamsachs adamsachs deleted the asachs/show-redis-cache-error branch March 2, 2026 18:59
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.

3 participants