It seems like it would be cleaner for some use cases if the instance metadata could be setup first, and then just registered as payload in the instance registration. Adding additional metadata later would be fine as well, but in our case, we have a bunch of static values that we want to include with the instance for its whole lifespan.
I think the main task for this would be to track the instance registration state, and if not registered then skip the PUT part of AddMetadataString()
(I am also seeing some flakiness with the individual PUTs, and some metadata gets lost. Maybe Eureka propagating is sporadic, or setting individual values for an instance using different Eureka nodes is problematic. I need to debug this.)