@Test public void testMetricManager_notPointInTime() throws Exception { MetricData metricCount1 = new MetricData("metric1", false); metricCount1.value = 123; metricCount1.prevPublishValue = 0; metricCount1.publishCount = 0; MetricData metricCount2 = new MetricData("metric1", false); metricCount2.value = 123; metricCount2.prevPublishValue = 100; metricCount2.publishCount = 0; MetricData metricCount3 = new MetricData("metric1", false); metricCount3.value = 99; metricCount3.prevPublishValue = 100; metricCount3.publishCount = 1; manager.useMetrics(Arrays.asList(metricCount1, metricCount2, metricCount3)); verify(mockClient); TimelineMetrics metrics = capture.getValue(); List<TimelineMetric> metricList = metrics.getMetrics(); assertEquals(metricList.size(), 1); TimelineMetric metric = metricList.get(0); assertEquals(metric.getAppId(), "logfeeder"); assertEquals(metric.getMetricName(), "metric1"); assertEquals(metric.getType(), "Long"); TreeMap<Long, Double> values = metric.getMetricValues(); assertEquals(values.size(), 1); assertEquals(values.firstEntry().getValue(), Double.valueOf(146.0)); }
public synchronized void useMetrics(List<MetricData> metricsList) { if (!isMetricsEnabled) { return; } logger.info("useMetrics() metrics.size=" + metricsList.size()); long currMS = System.currentTimeMillis(); gatherMetrics(metricsList, currMS); publishMetrics(currMS); }
MetricsManager { public synchronized void useMetrics(List<MetricData> metricsList) { if (!isMetricsEnabled) { return; } logger.info("useMetrics() metrics.size=" + metricsList.size()); long currMS = System.currentTimeMillis(); gatherMetrics(metricsList, currMS); publishMetrics(currMS); } }
MetricsManager { public synchronized void useMetrics(List<MetricData> metricsList) { if (!isMetricsEnabled) { return; } logger.info("useMetrics() metrics.size=" + metricsList.size()); long currMS = System.currentTimeMillis(); gatherMetrics(metricsList, currMS); publishMetrics(currMS); }  }
MetricsManager { public synchronized void useMetrics(List<MetricData> metricsList) { if (!isMetricsEnabled) { return; } logger.info("useMetrics() metrics.size=" + metricsList.size()); long currMS = System.currentTimeMillis(); gatherMetrics(metricsList, currMS); publishMetrics(currMS); }  @PostConstruct void init(); boolean isMetricsEnabled(); synchronized void useMetrics(List<MetricData> metricsList); void setAmsClient(LogFeederAMSClient amsClient); }
MetricsManager { public synchronized void useMetrics(List<MetricData> metricsList) { if (!isMetricsEnabled) { return; } logger.info("useMetrics() metrics.size=" + metricsList.size()); long currMS = System.currentTimeMillis(); gatherMetrics(metricsList, currMS); publishMetrics(currMS); }  @PostConstruct void init(); boolean isMetricsEnabled(); synchronized void useMetrics(List<MetricData> metricsList); void setAmsClient(LogFeederAMSClient amsClient);  }