为什么 Consul 的服务不支持自定义字段?

Why are custom fields not supported in services in Consul?

我发现有几种情况可以方便地存储与特定服务相关的附加元数据,但是 services API 中似乎不支持自定义字段(仅基本 ID、名称、地址、端口).例如,数据库名称或负载均衡器权重。

我对设计决定很好奇 - 是否有最佳实践可以推广,或者这可能是未来可以进行的改进?

I understand that we one could use the KV store for extra info but it seems more convenient to bundle like-information together and not make multiple Consul lookups.

元数据应该进入 KV 存储。有您描述的用例。然而,Consul 是为 95% 的最常见用例设计的(Armon Dadger 的原话,Consul 的主要工程师)。任意元数据在 KV 存储中都很好。