Add service limit to prepared query #4473
Labels
theme/prepared-query
Anything related to prepared queries
type/enhancement
Proposed improvement or new feature
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
andlimit: 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.The text was updated successfully, but these errors were encountered: