Add service limit to prepared query
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
#### Feature Description
(A few commenters brought up this in #1584)
Currently, when you execute a prepared query it returns all of the available services and there's no way to limit the services returned to only 1. Some SRV client libraries randomize the results which will end up clashing with Consul's ordering (whether it's random or `Near: _agent`). Ideally there would be a way to set a limit on a prepared query to "top 1" (or even "top x") results so that only the first service that would've been listed is returned. Additionally, the size of the DNS responses will be smaller.
#### Use Case(s)
In the case of `Near: _agent` and `limit: 1` then the closest service instance will always be returned and irrespective of your particular SRV client's handling, you will always be using the closest instance.
Contributor guide
Assessment
This issue has not been assessed yet.