jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: svn commit: r1852777 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java xdocs/changes.xml
Date Sat, 02 Feb 2019 11:24:01 GMT
Hi Philippe,

a small remark to the code (see inline)

Am 01.02.19 um 23:59 schrieb pmouawad@apache.org:
> Author: pmouawad
> Date: Fri Feb  1 22:59:06 2019
> New Revision: 1852777
>
> URL: http://svn.apache.org/viewvc?rev=1852777&view=rev
> Log:
> Bug 63138 - InfluxDB BackendListenerClient: In case of error, log is in debug, it should
be in error
> Bugzilla Id: 63138
>
> Modified:
>      jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java
>      jmeter/trunk/xdocs/changes.xml
>
> Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java?rev=1852777&r1=1852776&r2=1852777&view=diff
> ==============================================================================
> --- jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java
(original)
> +++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/backend/influxdb/HttpMetricsSender.java
Fri Feb  1 22:59:06 2019
> @@ -40,6 +40,8 @@ import org.apache.http.impl.nio.conn.Poo
>   import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
>   import org.apache.http.impl.nio.reactor.IOReactorConfig;
>   import org.apache.http.nio.reactor.ConnectingIOReactor;
> +import org.apache.http.util.EntityUtils;
> +import org.apache.jmeter.report.utils.MetricUtils;
>   import org.apache.jmeter.util.JMeterUtils;
>   import org.slf4j.Logger;
>   import org.slf4j.LoggerFactory;
> @@ -180,12 +182,12 @@ class HttpMetricsSender extends Abstract
>                            * could not understand the request. 5xx: The system is
>                            * overloaded or significantly impaired.
>                            */
> -                        if(log.isDebugEnabled()) {
> -                            if(code == 204) {
> +                        if (MetricUtils.isSuccessCode(code)) {
> +                            if(log.isDebugEnabled()) {
>                                   log.debug("Success, number of metrics written: {}",
copyMetrics.size());
> -                            } else {
> -                                log.debug("Error writing metrics to influxDB Url: {},
responseCode: {}", url, code);
> -                            }
> +                            }
> +                        } else {
> +                            log.error("Error writing metrics to influxDB Url: {}, responseCode:
{}, responseBody: {}", url, code, getBody(response));


There seems to have crept in a nbsp after "responseBody:"


>                           }
>                       }
>                       @Override
> @@ -204,7 +206,22 @@ class HttpMetricsSender extends Abstract
>                   copyMetrics.clear();
>               }
>           }
> -
> +    }
> +
> +    /**
> +     * @param response HttpResponse
> +     * @return String entity Body if any
> +     */
> +    private static String getBody(final HttpResponse response) {
> +        String body= "";
> +        try {
> +            if(response != null && response.getEntity() != null) {
> +                body = EntityUtils.toString(response.getEntity());


We could return the value directly and get rid of the local variable 
body (return ""; at the end of the method).

Regards,

  Felix


> +            }
> +        } catch (Exception e) {
> +            // NOOP
> +        }
> +        return body;
>       }
>   
>       /**
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1852777&r1=1852776&r2=1852777&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Fri Feb  1 22:59:06 2019
> @@ -220,6 +220,7 @@ containing a fix to this issue, we decid
>   <ul>
>       <li><bug>62770</bug>Aggregate Graph throws <code>ArrayIndexOutOfBoundsException</code></li>
>       <li><bug>63069</bug>ResultCollector does not write end of XML
file if user exits while a Recording or a test is running. Contributed by Ubik Load Pack (support
at ubikloadpack.com)</li>
> +    <li><bug>63138</bug>InfluxDB BackendListenerClient: In case of
error, log is in debug, it should be in error</li>
>   </ul>
>   
>   <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
>
>

Mime
View raw message