etcdctl watch --from-key
- Dominant language
- Go
- Stars
- 52.3k
- Forks
- 10.5k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 44
Description
### What would you like to be added?
`etcdctl watch` is missing a `--from-key` flag, which `get` and `del` already have.
`--from-key` watches all keys that are byte-wise >= the given key, instead of an exact
key or a `--prefix`.
The server already fully implements this for Watch requests -- I traced the request path
end to end and found the RangeEnd sentinel handling for it already live in
`server/etcdserver/api/v3rpc/watch.go` (the `len(creq.RangeEnd) == 1 && creq.RangeEnd[0] == 0`
branch, with a comment literally saying "support >= key queries"). The client library
(`clientv3.WithFromKey()`) already documents itself as applying to 'Get', 'Delete', 'Watch'.
So the only thing missing is the etcdctl CLI flag itself.
### Why is this needed?
For consistency with `get`/`del`, and because there's no other way today to watch an
open-ended range starting from a key (only an exact key, or a bounded prefix/range).
Opening a PR with the implementation: [will link after PR is created]
Contributor guide
Research direction
Inspect the etcdctl watch command and compare its option handling with the existing get and del commands, which already expose --from-key. Use server/etcdserver/api/v3rpc/watch.go and clientv3.WithFromKey() to confirm the existing request behavior. Done means etcdctl watch accepts --from-key and watches keys byte-wise >= the supplied key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, distributed-systems
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 75/100