UaaMetricsEmitter { @Scheduled(fixedRate = 5000, initialDelay = 1000) public void emitUrlGroupRequestMetrics() throws Exception { try { UaaMetrics metrics = metricsUtils.getUaaMetrics(server); emitUrlGroupRequestMetrics(metrics); } catch (Exception x) { throwIfOtherThanNotFound(x); } } UaaMetricsEmitter(MetricsUtils metricsUtils, StatsDClient statsDClient, MBeanServerConnection server); @Scheduled(fixedRate = 5000, initialDelay = 0) void emitMetrics(); @Scheduled(fixedRate = 5000, initialDelay = 1000) void emitGlobalRequestMetrics(); @Scheduled(fixedRate = 5000, initialDelay = 1000) void emitUrlGroupRequestMetrics(); void emitGlobalServerStats(UaaMetrics metrics); void emitGlobalRequestMetrics(UaaMetrics metrics); @Scheduled(fixedRate = 5000, initialDelay = 2000) void emitVmVitals(); @Scheduled(fixedRate = 5000, initialDelay = 3000) void emitJvmVitals(); void throwIfOtherThanNotFound(Exception x); Number getValueFromBean(Object mbean, String getter); Object getValueFromMap(Map<String, ?> map, String path); void enableNotification(); long getMetricDelta(String name, long gaugeValue); boolean isNotificationEnabled();  }
@Test void perUrlGroup_request_metrics() throws Exception { Mockito.when(metricsUtils.getUaaMetrics(any())).thenReturn(uaaMetrics1); uaaMetricsEmitter.emitUrlGroupRequestMetrics(); Mockito.verify(statsDClient).gauge(eq("requests.ui.completed.count"), gt(0L)); Mockito.verify(statsDClient).gauge(eq("requests.ui.completed.time"), geq(300L)); Mockito.verify(statsDClient).gauge(eq("requests.static-content.completed.count"), gt(0L)); Mockito.verify(statsDClient).gauge(eq("requests.static-content.completed.time"), geq(23L)); }