@Test @SuppressWarnings("unchecked") public void getMetricsOutput() throws URISyntaxException, IOException { final MockHttpResponse response = get(MicroServiceMetricsAPI.BASE_URI, MediaType.APPLICATION_JSON_TYPE); assertEquals(HttpStatus.SC_OK, response.getStatus()); final Map<String, ?> json = json(response); System.out.println(json); assertEquals("mock-api", json.get("name")); final Map<String, ?> metrics = (Map<String, ?>) json.get("metrics"); assertEquals("3.0.0", metrics.get("version")); }
@Override public Response getMetricsOutput() { StreamingOutput stream = outputStream -> mapper .writerWithDefaultPrettyPrinter() .writeValue(outputStream, getMicroServiceApplication().getMicroServiceContext().getMetricsRegistry()); return Response .ok(stream, MediaType.APPLICATION_JSON_TYPE) .header("Cache-Control", "must-revalidate,no-cache,no-store") .build(); }
MicroServiceMetricsResource extends MicroServiceResource implements MicroServiceMetricsAPI { @Override public Response getMetricsOutput() { StreamingOutput stream = outputStream -> mapper .writerWithDefaultPrettyPrinter() .writeValue(outputStream, getMicroServiceApplication().getMicroServiceContext().getMetricsRegistry()); return Response .ok(stream, MediaType.APPLICATION_JSON_TYPE) .header("Cache-Control", "must-revalidate,no-cache,no-store") .build(); } }
MicroServiceMetricsResource extends MicroServiceResource implements MicroServiceMetricsAPI { @Override public Response getMetricsOutput() { StreamingOutput stream = outputStream -> mapper .writerWithDefaultPrettyPrinter() .writeValue(outputStream, getMicroServiceApplication().getMicroServiceContext().getMetricsRegistry()); return Response .ok(stream, MediaType.APPLICATION_JSON_TYPE) .header("Cache-Control", "must-revalidate,no-cache,no-store") .build(); } MicroServiceMetricsResource(); }
MicroServiceMetricsResource extends MicroServiceResource implements MicroServiceMetricsAPI { @Override public Response getMetricsOutput() { StreamingOutput stream = outputStream -> mapper .writerWithDefaultPrettyPrinter() .writeValue(outputStream, getMicroServiceApplication().getMicroServiceContext().getMetricsRegistry()); return Response .ok(stream, MediaType.APPLICATION_JSON_TYPE) .header("Cache-Control", "must-revalidate,no-cache,no-store") .build(); } MicroServiceMetricsResource(); @Override Response getMetricsOutput(); @Override Map<String, List> getDsMetrics(@PathParam("ds") String ds); }
MicroServiceMetricsResource extends MicroServiceResource implements MicroServiceMetricsAPI { @Override public Response getMetricsOutput() { StreamingOutput stream = outputStream -> mapper .writerWithDefaultPrettyPrinter() .writeValue(outputStream, getMicroServiceApplication().getMicroServiceContext().getMetricsRegistry()); return Response .ok(stream, MediaType.APPLICATION_JSON_TYPE) .header("Cache-Control", "must-revalidate,no-cache,no-store") .build(); } MicroServiceMetricsResource(); @Override Response getMetricsOutput(); @Override Map<String, List> getDsMetrics(@PathParam("ds") String ds);  }