hudl / fargo

Golang client for Netflix Eureka
MIT License
133 stars 53 forks source link

Accommodate data center info metadata for types other than "Amazon" #42

Closed seh closed 8 years ago

seh commented 8 years ago

Fargo allows one to specify and retrieve Amazon-specific data center metadata, but does not accommodate any such metadata for other types of data centers. The Eureka XML schema for instance registration is loose here; it mentions that the Amazon-specific schema for the dataCenterInfo element's metadata element applies only when the name element is "Amazon".

metadata is only required if name is Amazon

That says that it's only required; what it really should say is that anything is tolerated, at the discretion of the data center-specific Java type that parses this metadata in the Eureka server. What actually happens is that the Eureka server parses the metadata element into a Map<String, String> and allows types implementing com.netflix.appinfo.DataCenterInfo to interpret that mapping as they see fit. It just so happens that the Eureka authors were only concerned with one concrete kind of data center. My company has implemented several more data center types in our Eureka fork.

I propose adding a field to fargo.DataCenterInfo—called "AlternateMetadata" of type map[string]string—that allows callers to send and receive this metadata for data center types other than "Amazon". Doing so is necessary for clients to decide on an instance ID that the server will accept. Without this concession, the server always uses the submitted host name. (See #39 for related discussion.)

I will submit a PR that takes care of the marshaling, but first I thought that we might like to discuss the need for and merits of this approach here first.

seh commented 8 years ago

I will submit a PR that takes care of the marshaling

To that end, see #44.

seh commented 8 years ago

With #44 merged, I consider this issue to be resolved.