feat: warn when multiple redis stream trim strategies are specified#4252
feat: warn when multiple redis stream trim strategies are specified#4252
Conversation
Signed-off-by: Eric Jacobson <eric.jacobson@grafana.com>
19ed97f to
58f8b40
Compare
There was a problem hiding this comment.
Pull request overview
Adds a warning and documentation updates to help operators avoid configuring mutually-exclusive Redis Streams trimming options (maxLenApprox vs streamTTL) in the Redis pubsub component, which can otherwise lead to one strategy being silently ignored depending on client behavior.
Changes:
- Log a warning during component initialization when both
maxLenApproxandstreamTTLare set. - Update the Redis pubsub component metadata docs to state the two options are mutually exclusive (and reflow the
maxLenApproxdescription formatting).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pubsub/redis/redis.go | Adds an init-time warning when both stream trimming strategies are configured. |
| pubsub/redis/metadata.yaml | Documents the mutual exclusivity between maxLenApprox and streamTTL (plus minor formatting). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@JoshVanL Happy to make copilot's suggested changes if you think they're appropriate, but two thoughts
Right now go-redis will fall back to
I wanted to avoid introducing a potentially breaking change if users are unknowingly passing both arguments, and didn't want to refactor the logic entirely to create a single setting. Let me know if this makes sense. |
|
Hey @erj826! Totally agree with you :) we can resolve those. I've started auto requesting from CoPilot as a sanity check & second pair of "eyes". |
Description
This is a bug/feature that I encountered while working with Dapr's Redis pubsub component. Redis supports either MAXLEN or MINID for XADD and XTRIM
The
go-redisclient quietly chooses MAXLEN when both are specified:Dapr let's me declare both in the
pubsub.rediscomponentand
streamTTLis ignored. I think the warning log and/or a docs update would be helpful.Issue reference
None -- can open if appropriate.
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: