This is an automated email from the ASF dual-hosted git repository. pmouawad pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit 027b3ce15d30dd6a5aedee84b8efb638ef21bddf Author: pmouawad <[email protected]> AuthorDate: Tue Sep 17 23:20:10 2019 +0200 Replace forEarch by regular map iteration, mention pr in changes.xml --- .../graphite/GraphiteBackendListenerClient.java | 33 +++++++++++++--------- xdocs/changes.xml | 1 + 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java b/src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java index 4ee0442..615d29e 100644 --- a/src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java +++ b/src/components/src/main/java/org/apache/jmeter/visualizers/backend/graphite/GraphiteBackendListenerClient.java @@ -151,7 +151,9 @@ public class GraphiteBackendListenerClient extends AbstractBackendListenerClient // Need to convert millis to seconds for Graphite long timestampInSeconds = TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS); synchronized (LOCK) { - getMetricsPerSampler().forEach((key, metric) -> { + for (Map.Entry<String, SamplerMetric> entry : getMetricsPerSampler().entrySet()) { + final String key = entry.getKey(); + final SamplerMetric metric = entry.getValue(); if (key.equals(CUMULATED_METRICS)) { addMetrics(timestampInSeconds, ALL_CONTEXT_NAME, metric); } else { @@ -159,7 +161,7 @@ public class GraphiteBackendListenerClient extends AbstractBackendListenerClient } // We are computing on interval basis so cleanup metric.resetForTimeInterval(); - }); + } } UserMetric userMetric = getUserMetrics(); graphiteMetricsManager.addMetric(timestampInSeconds, TEST_CONTEXT_NAME, @@ -219,10 +221,11 @@ public class GraphiteBackendListenerClient extends AbstractBackendListenerClient graphiteMetricsManager.addMetric(timestampInSeconds, contextName, METRIC_OK_AVG_RESPONSE_TIME, Double.toString(metric.getOkMean())); - okPercentiles.forEach((key, value) -> - graphiteMetricsManager.addMetric(timestampInSeconds, contextName, - key, - Double.toString(metric.getOkPercentile(value.floatValue())))); + for (Map.Entry<String, Float> entry : okPercentiles.entrySet()) { + graphiteMetricsManager.addMetric(timestampInSeconds, contextName, + entry.getKey(), + Double.toString(metric.getOkPercentile(entry.getValue().floatValue()))); + } } if (metric.getFailures() > 0) { graphiteMetricsManager.addMetric(timestampInSeconds, @@ -234,10 +237,11 @@ public class GraphiteBackendListenerClient extends AbstractBackendListenerClient graphiteMetricsManager.addMetric(timestampInSeconds, contextName, METRIC_KO_AVG_RESPONSE_TIME, Double.toString(metric.getKoMean())); - koPercentiles.forEach((key, value) -> - graphiteMetricsManager.addMetric(timestampInSeconds, contextName, - key, - Double.toString(metric.getKoPercentile(value.floatValue())))); + for (Map.Entry<String, Float> entry : koPercentiles.entrySet()) { + graphiteMetricsManager.addMetric(timestampInSeconds, contextName, + entry.getKey(), + Double.toString(metric.getKoPercentile(entry.getValue().floatValue()))); + } } graphiteMetricsManager.addMetric(timestampInSeconds, contextName, METRIC_ALL_MIN_RESPONSE_TIME, @@ -248,10 +252,11 @@ public class GraphiteBackendListenerClient extends AbstractBackendListenerClient graphiteMetricsManager.addMetric(timestampInSeconds, contextName, METRIC_ALL_AVG_RESPONSE_TIME, Double.toString(metric.getAllMean())); - allPercentiles.forEach((key, value) -> - graphiteMetricsManager.addMetric(timestampInSeconds, contextName, - key, - Double.toString(metric.getAllPercentile(value.floatValue())))); + for (Map.Entry<String, Float> entry : allPercentiles.entrySet()) { + graphiteMetricsManager.addMetric(timestampInSeconds, contextName, + entry.getKey(), + Double.toString(metric.getAllPercentile(entry.getValue().floatValue()))); + } } /** @return the samplersList */ diff --git a/xdocs/changes.xml b/xdocs/changes.xml index 4969c6c..ceeb021 100644 --- a/xdocs/changes.xml +++ b/xdocs/changes.xml @@ -143,6 +143,7 @@ to view the last release notes of version 5.1.1. <li><bug>63529</bug>Add more unit tests for org.apache.jorphan.util.JOrphanUtils. Contributed by John Bergqvist(John.Bergqvist at diffblue.com)</li> <li>Updated to latest checkstyle (version 8.22)</li> <li>Clean-up of code in <code>CompareAssertion</code> and other locations. Based on patch by Graham Russell (graham at ham1.co.uk)</li> + <li><pr>491</pr>Increase Graphite metrics coverage. Contributed by Graham Russell (graham at ham1.co.uk)</li> </ul> <!-- =================== Bug fixes =================== -->
