jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1796400 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java xdocs/changes.xml
Date Sat, 27 May 2017 14:23:12 GMT
Author: pmouawad
Date: Sat May 27 14:23:12 2017
New Revision: 1796400

URL: http://svn.apache.org/viewvc?rev=1796400&view=rev
Log:
Bug 61121 - InfluxdbBackendListenerClient: Only all percentiles are sent, not KO and OK 
Rename constants to make code clearer and to use English
Rename statut= to status=
Bugzilla Id: 61121

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java?rev=1796400&r1=1796399&r2=1796400&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
Sat May 27 14:23:12 2017
@@ -20,7 +20,6 @@ package org.apache.jmeter.visualizers.ba
 
 import java.text.DecimalFormat;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -63,23 +62,23 @@ public class InfluxdbBackendListenerClie
 
     private static final String TAG_TRANSACTION = ",transaction=";
 
-    private static final String TAG_STATUT = ",statut=";
+    private static final String TAG_STATUS = ",status=";
     private static final String TAG_APPLICATION = ",application=";
 
     private static final String METRIC_COUNT = "count=";
-    private static final String METRIC_COUNT_ERREUR = "countError=";
+    private static final String METRIC_COUNT_ERROR = "countError=";
     private static final String METRIC_MIN = "min=";
     private static final String METRIC_MAX = "max=";
     private static final String METRIC_AVG = "avg=";
 
     private static final String METRIC_HIT = "hit=";
-    private static final String METRIC_PCT = "pct";
+    private static final String METRIC_PCT_PREFIX = "pct";
 
-    private static final String METRIC_MAXAT = "maxAT=";
-    private static final String METRIC_MINAT = "minAT=";
-    private static final String METRIC_MEANAT = "meanAT=";
-    private static final String METRIC_STARTEDT = "startedT=";
-    private static final String METRIC_ENDEDT = "endedT=";
+    private static final String METRIC_MAX_ACTIVE_THREADS = "maxAT=";
+    private static final String METRIC_MIN_ACTIVE_THREADS = "minAT=";
+    private static final String METRIC_MEAN_ACTIVE_THREADS = "meanAT=";
+    private static final String METRIC_STARTED_THREADS = "startedT=";
+    private static final String METRIC_ENDED_THREADS = "endedT=";
 
     private static final String TAG_OK = "ok";
     private static final String TAG_KO = "ko";
@@ -142,17 +141,21 @@ public class InfluxdbBackendListenerClie
         tag.append(TAG_APPLICATION).append(application);
         tag.append(TAG_TRANSACTION).append("internal");
         StringBuilder field = new StringBuilder(80);
-        field.append(METRIC_MINAT).append(userMetrics.getMinActiveThreads()).append(",");
-        field.append(METRIC_MAXAT).append(userMetrics.getMaxActiveThreads()).append(",");
-        field.append(METRIC_MEANAT).append(userMetrics.getMeanActiveThreads()).append(",");
-        field.append(METRIC_STARTEDT).append(userMetrics.getStartedThreads()).append(",");
-        field.append(METRIC_ENDEDT).append(userMetrics.getFinishedThreads());
+        field.append(METRIC_MIN_ACTIVE_THREADS).append(userMetrics.getMinActiveThreads()).append(",");
+        field.append(METRIC_MAX_ACTIVE_THREADS).append(userMetrics.getMaxActiveThreads()).append(",");
+        field.append(METRIC_MEAN_ACTIVE_THREADS).append(userMetrics.getMeanActiveThreads()).append(",");
+        field.append(METRIC_STARTED_THREADS).append(userMetrics.getStartedThreads()).append(",");
+        field.append(METRIC_ENDED_THREADS).append(userMetrics.getFinishedThreads());
 
         influxdbMetricsManager.addMetric(measurement, tag.toString(), field.toString());
 
         influxdbMetricsManager.writeAndSendMetrics();
     }
 
+    @FunctionalInterface
+    private interface PercentileProvider {
+        public double getPercentileValue(double percentile);
+    }
     /**
      * Add request metrics to metrics manager.
      * 
@@ -161,22 +164,24 @@ public class InfluxdbBackendListenerClie
      */
     private void addMetrics(String transaction, SamplerMetric metric) {
         // FOR ALL STATUS
-        addMetric(transaction, metric, metric.getTotal(), false, TAG_ALL, metric.getAllMean(),
metric.getAllMinTime(),
-                metric.getAllMaxTime(), allPercentiles.values());
+        addMetric(transaction, metric.getTotal(), false, TAG_ALL, metric.getAllMean(), metric.getAllMinTime(),
+                metric.getAllMaxTime(), allPercentiles.values(), metric::getAllPercentile);
         // FOR OK STATUS
-        addMetric(transaction, metric, metric.getSuccesses(), false, TAG_OK, metric.getOkMean(),
metric.getOkMinTime(),
-                metric.getOkMaxTime(), Collections.<Float> emptySet());
+        addMetric(transaction, metric.getSuccesses(), false, TAG_OK, metric.getOkMean(),
metric.getOkMinTime(),
+                metric.getOkMaxTime(), okPercentiles.values(), metric::getOkPercentile);
         // FOR KO STATUS
-        addMetric(transaction, metric, metric.getFailures(), true, TAG_KO, metric.getKoMean(),
metric.getKoMinTime(),
-                metric.getKoMaxTime(), Collections.<Float> emptySet());
+        addMetric(transaction, metric.getFailures(), true, TAG_KO, metric.getKoMean(), metric.getKoMinTime(),
+                metric.getKoMaxTime(), koPercentiles.values(), metric::getKoPercentile);
     }
 
-    private void addMetric(String transaction, SamplerMetric metric, int count, boolean includeResponseCode,
-            String statut, double mean, double minTime, double maxTime, Collection<Float>
pcts) {
+
+    private void addMetric(String transaction, int count, boolean includeResponseCode,
+            String statut, double mean, double minTime, double maxTime, 
+            Collection<Float> pcts, PercentileProvider percentileProvider) {
         if (count > 0) {
             StringBuilder tag = new StringBuilder(70);
             tag.append(TAG_APPLICATION).append(application);
-            tag.append(TAG_STATUT).append(statut);
+            tag.append(TAG_STATUS).append(statut);
             tag.append(TAG_TRANSACTION).append(transaction);
             StringBuilder field = new StringBuilder(80);
             field.append(METRIC_COUNT).append(count);
@@ -190,7 +195,8 @@ public class InfluxdbBackendListenerClie
                 field.append(",").append(METRIC_MAX).append(maxTime);
             }
             for (Float pct : pcts) {
-                field.append(",").append(METRIC_PCT).append(pct).append("=").append(metric.getAllPercentile(pct));
+                field.append(",").append(METRIC_PCT_PREFIX).append(pct).append("=").append(
+                        percentileProvider.getPercentileValue(pct));
             }
             influxdbMetricsManager.addMetric(measurement, tag.toString(), field.toString());
         }
@@ -204,10 +210,10 @@ public class InfluxdbBackendListenerClie
             Collection<Float> pcts = allPercentiles.values();
             tag.append(TAG_APPLICATION).append(application);
             tag.append(TAG_TRANSACTION).append(CUMULATED_METRICS);
-            tag.append(TAG_STATUT).append(CUMULATED_METRICS);
-
+            tag.append(TAG_STATUS).append(CUMULATED_METRICS);
+            
             field.append(METRIC_COUNT).append(total);
-            field.append(",").append(METRIC_COUNT_ERREUR).append(metric.getFailures());
+            field.append(",").append(METRIC_COUNT_ERROR).append(metric.getFailures());
 
             if (!Double.isNaN(metric.getOkMean())) {
                 field.append(",").append(METRIC_AVG).append(Double.toString(metric.getOkMean()));
@@ -221,7 +227,7 @@ public class InfluxdbBackendListenerClie
 
             field.append(",").append(METRIC_HIT).append(metric.getHits());
             for (Float pct : pcts) {
-                field.append(",").append(METRIC_PCT).append(pct).append("=").append(Double.toString(metric.getAllPercentile(pct)));
+                field.append(",").append(METRIC_PCT_PREFIX).append(pct).append("=").append(Double.toString(metric.getAllPercentile(pct)));
             }
             field.append(",").append(METRIC_HIT).append(metric.getHits());
             influxdbMetricsManager.addMetric(measurement, tag.toString(), field.toString());

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1796400&r1=1796399&r2=1796400&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat May 27 14:23:12 2017
@@ -76,6 +76,7 @@ Summary
 
 <ch_section>Incompatible changes</ch_section>
 
+<li>In InfluxDbBackendListenerClient, statut property has been renamed to status</li>
 <h3>Removed elements or functions</h3>
 
 <h3>Logging changes</h3>
@@ -147,6 +148,7 @@ Summary
 <h3>Listeners</h3>
 <ul>
     <li><bug>61005</bug>View Results Tree - Browser Response Data is not
clearing</li>
+    <li><bug>61121</bug>InfluxdbBackendListenerClient: Only all percentiles
are sent, not KO and OK</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>



Mime
View raw message