emit(appSpec);
}
private void deleteMetrics(String account, String application, Iterable<String> flows) throws IOException {
Iterable<Discoverable> discoverables = this.discoveryServiceClient.discover(Constants.Service.GATEWAY);
Discoverable discoverable = new TimeLimitEndpointStrategy(new RandomEndpointStrategy(discoverables),
DISCOVERY_TIMEOUT_SECONDS, TimeUnit.SECONDS).pick();
if (discoverable == null) {
LOG.error("Fail to get any metrics endpoint for deleting metrics.");
return;
}
LOG.debug("Deleting metrics for application {}", application);
for (MetricsScope scope : MetricsScope.values()) {
for (String flow : flows) {
String url = String.format("http://%s:%d%s/metrics/%s/apps/%s/flows/%s",
discoverable.getSocketAddress().getHostName(),
discoverable.getSocketAddress().getPort(),
Constants.Gateway.GATEWAY_VERSION,
scope.name().toLowerCase(),
application, flow);
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder()