private static String serializedForm(ApplicationId application, ClusterSpec.Id cluster) { return application.serializedForm() + ":" + cluster.value(); }
@GET @Produces(MediaType.APPLICATION_JSON) public ApplicationReferenceList getAllInstances() { List<ApplicationId> applications = new ArrayList<>(healthMonitorApi.getMonitoredApplicationIds()); applications.sort(Comparator.comparing(ApplicationId::serializedForm)); ApplicationReferenceList list = new ApplicationReferenceList(); list.applicationList = applications.stream().map(applicationId -> { UrlReference reference = new UrlReference(); reference.url = uriInfo.getBaseUriBuilder() .path(HealthResource.class) .path(applicationId.serializedForm()) .build() .toString(); return reference; }).collect(Collectors.toList()); return list; }
deployment.activate(); } catch (Exception e) { log.log(LogLevel.INFO, "Failed to redeploy " + app.serializedForm() + ", will be redeployed later by application maintainer", e);
public static byte[] toJson(Flag flag) { Slime slime = new Slime(); Cursor root = slime.setObject(); root.setString(featureField, flag.id().serializedValue()); root.setBool(enabledField, flag.isEnabled()); Cursor nodeArray = root.setArray(hostnamesField); flag.hostnames().forEach(nodeArray::addString); Cursor applicationArray = root.setArray(applicationsField); flag.applications().forEach(application -> applicationArray.addString(application.serializedForm())); try { return SlimeUtils.toJsonBytes(slime); } catch (IOException e) { throw new UncheckedIOException(e); } }
"host", node.hostname(), "tenantName", applicationId.tenant().value(), "applicationId", applicationId.serializedForm().replace(':', '.'), "app", toApp(applicationId), "clustertype", allocation.get().membership().cluster().type().name(),