envoyproxy / envoyproxy/envoy

redis key_formatter should handle cases where client keys contain hash tag

Open
#30,905 6 comments 0 reactions 0 assignees View on GitHub
area/redis enhancement help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: *redis key_formatter should handle cases where client keys contain hash tag*

*Description*:
Redis supports hash tag feature which can be used to to take a curly braces wrapped substring for key hash.
Consider a scenario where user specify a key_formatter that uses hash tag, e.g. `prefix-{%KEY%}`, and the client key contains hash tag as well, e.g. `foo-{bar}`. The formatted key becomes `prefix-{foo-{bar}}` and `foo-{bar` will be used for hash instead of`bar` intended by client.
The proposed change is to add an option for key_formatter to prefer client key's hash tag if present. If the feature is enabled and the first pair of curly braces in key_formatter wraps %KEY% which also contains hash tag, the key_formatter will be stripped off of the pair of curly braces. In the above example, the formatted key becomes `prefix-foo-{bar}`.

[optional *Relevant Links*:]
[redis hash tag](https://redis.io/docs/reference/cluster-spec/#:~:text=Hash-,tags,-There%20is%20an)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.