hashicorp / hashicorp/consul

[RFC] Query Endpints allows sorting by "Near" but DNS still does randomize the result

Open
#9,802 0 comments 0 reactions 0 assignees View on GitHub
theme/dns
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Feature Description

The [query](https://www.consul.io/api-docs/query) endpoint allows to create more complex queries to consul HTTP but as well via [DNS](https://www.consul.io/docs/discovery/dns#prepared-query-lookups). For any reason (I don't understand) the powerful feature "[Near](https://www.consul.io/api-docs/query#near)" allows sorting results. Anyway the DNS interface does not honor this sorting and still randomize the result. This is also noted in the [documentation](https://www.consul.io/docs/discovery/dns#prepared-query-lookups):

"To allow for simple load balancing, the set of nodes returned is randomized each time."

But this sounds fishy to me. Why would someone using the "Near" feature expect DNS results in unsorted/randomized order? This is inconsistent behavior and should be fixed. If someone needs the result unsorted in DNS there should be a bool to configure that behavior.

#### Use Case(s)

In most use cases I don't the any reason to sort the HTTP output but not the DNS output.

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.