jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1815981 - /jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/InfluxdbBackendListenerClient.java
Date Tue, 21 Nov 2017 20:20:21 GMT
Author: fschumacher
Date: Tue Nov 21 20:20:20 2017
New Revision: 1815981

URL: http://svn.apache.org/viewvc?rev=1815981&view=rev
Log:
Use a StringBuilder to concatenate Strings in a loop.

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

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=1815981&r1=1815980&r2=1815981&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
Tue Nov 21 20:20:20 2017
@@ -335,16 +335,23 @@ public class InfluxdbBackendListenerClie
             }
         }
         // Check if more row which started with 'TAG_' are filled ( corresponding to user
tag )
-        userTag = "";
+        StringBuilder userTagBuilder = new StringBuilder();
         context.getParameterNamesIterator().forEachRemaining(name -> {
             if (StringUtils.isNotBlank(name) && !defaultArgs.containsKey(name.trim())
                     && name.startsWith("TAG_")
                     && StringUtils.isNotBlank(context.getParameter(name))) {
-                userTag += "," + AbstractInfluxdbMetricsSender.tagToStringValue(name.trim().substring(4))
+ "="
-                        + AbstractInfluxdbMetricsSender.tagToStringValue(context.getParameter(name).trim());
-                log.debug("Adding '{}' tag with '{}' value ", name.trim().substring(4), context.getParameter(name).trim());
+                final String tagName = name.trim().substring(4);
+                final String tagValue = context.getParameter(name).trim();
+                userTagBuilder.append(',')
+                        .append(AbstractInfluxdbMetricsSender
+                                .tagToStringValue(tagName))
+                        .append('=')
+                        .append(AbstractInfluxdbMetricsSender.tagToStringValue(
+                                tagValue));
+                log.debug("Adding '{}' tag with '{}' value ", tagName, tagValue);
             }
         });
+        userTag = userTagBuilder.toString();
 
         Class<?> clazz = Class.forName(influxdbMetricsSender);
         this.influxdbMetricsManager = (InfluxdbMetricsSender) clazz.newInstance();



Mime
View raw message