Search code examples
jmeterhttpresponsegrafanainfluxdb

Jmeter + InfluxDB: Response Codes are missing


I have an InfluxDB v1.7.9 installation and my Jmeter v5.2 is correctly sending data to it through the default Backend Listener (org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender). I can see the data when querying the database. Sample here:

time                application                avg                count countError endedT hit max  maxAT meanAT min minAT pct10.0            pct90.0            pct95.0            pct99.0            rb      responseCode                                     responseMessage                          sb     startedT statut transaction
----                -----------                ---                ----- ---------- ------ --- ---  ----- ------ --- ----- -------            -------            -------            -------            --      ------------                                     ---------------                          --     -------- ------ -----------
1579001235935000000 grafanapoc-14-01-2020-1126                                     0               0     0          0                                                                                                                                                                                          0               internal
1579001240085000000 grafanapoc-14-01-2020-1126                                     0               0     0          0                                                                                                                                                                                          11              internal
1579001245091000000 grafanapoc-14-01-2020-1126 586.3529411764706  17    0                 195 1177              197       246.6              1126.6             1177               1177               6302301                                                                                           64159           all    all
1579001245098000000 grafanapoc-14-01-2020-1126 197                1                           197               197       197                197                197                197                10470                                                                                             633             all    GET - Page
1579001245100000000 grafanapoc-14-01-2020-1126 197                1                           197               197       197                197                197                197                                                                                                                                  ok     GET - Page
1579001245102000000 grafanapoc-14-01-2020-1126 259                1                           259               259       259                259                259                259                9827                                                                                              643             all    GET - Privacy
1579001245102000000 grafanapoc-14-01-2020-1126 259                1                           259               259       259                259                259                259                                                                                                                                  ok     GET - Privacy
1579001245104000000 grafanapoc-14-01-2020-1126 710.8333333333334  12                          1177              434       452.6              1158.1000000000001 1177               1177               6168994                                                                                           56448           all    GET - Homepage
1579001245106000000 grafanapoc-14-01-2020-1126 710.8333333333334  12                          1177              434       452.6              1158.1000000000001 1177               1177                                                                                                                                 ok     GET - Homepage
1579001245107000000 grafanapoc-14-01-2020-1126 327.3333333333333  3                           387               273       273                387                387                387                                                                                                                                  ok     GET - Contact
1579001245107000000 grafanapoc-14-01-2020-1126 327.3333333333333  3                           387               273       273                387                387                387                113010                                                                                            6435            all    GET - Contact
1579001245109000000 grafanapoc-14-01-2020-1126                                     0               23    18         12                                                                                                                                                                                         23              internal
1579001250083000000 grafanapoc-14-01-2020-1126 411.16666666666674 25    0                 197 1177              143       179                712.0000000000001  1059.7000000000005 1177               5350040                                                                                           69699           all    all

However, as you can see from this sample, the 'responseCode' column is empty and only displays data when an error occurs (500, 404, Non HTTP response code, etc). I am interested in recording all the Response Codes, not just errors.

I attempted to amend the jmeter.properties file defaults, without success. Can anyone help me identify the reason why the Response Codes for successful requests are not parsed over?


Solution

  • As per JMeter 5.2 response code and message are stored only for failed samplers:

    private void addErrorMetric(String transaction, ErrorMetric err, long count) { 
        //
        tag.append(TAG_RESPONSE_CODE).append(AbstractInfluxdbMetricsSender.tagToStringValue(err.getResponseCode()));
        tag.append(TAG_RESPONSE_MESSAGE).append(AbstractInfluxdbMetricsSender.tagToStringValue(err.getResponseMessage()));
        //
    

    Unfortunately this is not something you can control via JMeter Properties, if you want to change this behaviour you need to amend InfluxdbBackendListenerClient and rebuild JMeter from source code