code: @PUT
      @Path("metadata")
      public Response updateMetadata(@Context UriInfo uriInfo) {
          try {
              InstanceInfo instanceInfo = registry.getInstanceByAppAndId(app.getName(), id);
              // ReplicationInstance information is not found, generate an error
              if (instanceInfo == null) {
                  logger.warn("Cannot find instance while updating metadata for instance {}/{}", app.getName(), id);
                  return Response.status(Status.NOT_FOUND).build();
              }
              MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
              Set<Entry<String, List<String>>> entrySet = queryParams.entrySet();
              Map<String, String> metadataMap = instanceInfo.getMetadata();
              // Metadata map is empty - create a new map
              if (Collections.emptyMap().getClass().equals(metadataMap.getClass())) {
                  metadataMap = new ConcurrentHashMap<>();
                  InstanceInfo.Builder builder = new InstanceInfo.Builder(instanceInfo);
                  builder.setMetadata(metadataMap);
                  instanceInfo = builder.build();
              }
              // Add all the user supplied entries to the map
              for (Entry<String, List<String>> entry : entrySet) {
                  metadataMap.put(entry.getKey(), entry.getValue().get(0));
              }
              registry.register(instanceInfo, false);
              return Response.ok().build();
          } catch (Throwable e) {
              logger.error("Error updating metadata for instance {}", id, e);
              return Response.serverError().build();
          }
  
      }
docs: Updates user-specific metadata information. If the key is already available, its value will be overwritten.
  If not, it will be added.
  @param uriInfo - URI information generated by jersey.
  @return response indicating whether the operation was a success or
  failure.