@Test public void testMetricsExample() throws ExecutionException, InterruptedException { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); assertThat("Counter " + counterName + " has not been 0", counter.getCount(), is(0L)); ClientMain.clientMetricsExample("http: .thenAccept(it -> assertThat("Counter " + counterName + " " + "has not been 1", counter.getCount(), is(1L))) .toCompletableFuture() .get(); }
static CompletionStage<Void> clientMetricsExample(String url, Config config) { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); System.out.println(counterName + ": " + counter.getCount()); WebClientService clientService = WebClientMetrics.counter() .methods(Http.Method.GET) .nameFormat("example.metric.%1$s.%2$s") .build(); WebClient webClient = WebClient.builder() .baseUri(url) .config(config) .addService(clientService) .build(); return performGetMethod(webClient) .thenAccept(s -> System.out.println(counterName + ": " + counter.getCount())); }
ClientMain { static CompletionStage<Void> clientMetricsExample(String url, Config config) { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); System.out.println(counterName + ": " + counter.getCount()); WebClientService clientService = WebClientMetrics.counter() .methods(Http.Method.GET) .nameFormat("example.metric.%1$s.%2$s") .build(); WebClient webClient = WebClient.builder() .baseUri(url) .config(config) .addService(clientService) .build(); return performGetMethod(webClient) .thenAccept(s -> System.out.println(counterName + ": " + counter.getCount())); } }
ClientMain { static CompletionStage<Void> clientMetricsExample(String url, Config config) { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); System.out.println(counterName + ": " + counter.getCount()); WebClientService clientService = WebClientMetrics.counter() .methods(Http.Method.GET) .nameFormat("example.metric.%1$s.%2$s") .build(); WebClient webClient = WebClient.builder() .baseUri(url) .config(config) .addService(clientService) .build(); return performGetMethod(webClient) .thenAccept(s -> System.out.println(counterName + ": " + counter.getCount())); } private  ClientMain(); }
ClientMain { static CompletionStage<Void> clientMetricsExample(String url, Config config) { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); System.out.println(counterName + ": " + counter.getCount()); WebClientService clientService = WebClientMetrics.counter() .methods(Http.Method.GET) .nameFormat("example.metric.%1$s.%2$s") .build(); WebClient webClient = WebClient.builder() .baseUri(url) .config(config) .addService(clientService) .build(); return performGetMethod(webClient) .thenAccept(s -> System.out.println(counterName + ": " + counter.getCount())); } private  ClientMain(); static void main(String[] args); }
ClientMain { static CompletionStage<Void> clientMetricsExample(String url, Config config) { String counterName = "example.metric.GET.localhost"; Counter counter = METRIC_REGISTRY.counter(counterName); System.out.println(counterName + ": " + counter.getCount()); WebClientService clientService = WebClientMetrics.counter() .methods(Http.Method.GET) .nameFormat("example.metric.%1$s.%2$s") .build(); WebClient webClient = WebClient.builder() .baseUri(url) .config(config) .addService(clientService) .build(); return performGetMethod(webClient) .thenAccept(s -> System.out.println(counterName + ": " + counter.getCount())); } private  ClientMain(); static void main(String[] args);  }