Http status is 500 but the Global information count it as OK

Hello,
When the server respond with http status 500, the Global information still shows it is OK. which also incorrectly the response time. is there a way to specify what http status to be count as OK or not?

I am using the latest Versions.

Please provide your simulation.log file.

Hello @ygGatling,

  http("name").get("/")
  .check(status().is(200));

By default, Gatling have a list of valid statuses and 500 is not in this list.

References:

Thank you both for the quick response. @sbrevet, Yes I added the check, saved it in a variable and I can see the server is returning Http status 500 but the Global Information shows everything is OK.

================================================================================
---- Global Information --------------------------------------------------------

request count 16 (OK=16 KO=0 )
min response time 668 (OK=668 KO=- )
max response time 3524 (OK=3524 KO=- )
mean response time 2381 (OK=2381 KO=- )
std deviation 919 (OK=919 KO=- )
response time 50th percentile 2609 (OK=2609 KO=- )
response time 75th percentile 3221 (OK=3221 KO=- )
response time 95th percentile 3363 (OK=3363 KO=- )
response time 99th percentile 3492 (OK=3492 KO=- )
mean requests/sec 2.286 (OK=2.286 KO=- )
---- Response Time Distribution ------------------------------------------------
t < 800 ms 1 ( 6%)
800 ms <= t < 1200 ms 0 ( 0%)
t ≥ 1200 ms 15 ( 94%)
failed 0 ( 0%)
================================================================================

I tried to upload the simulation but i don’t think *.log or *.zip is supported to be attached. but if it helps, here is the content

RUN	computerdatabase.RecordedSimulation	recordedsimulation	1674619829084	 	3.9.0
USER	RecordedSimulation	START	1674619829856
USER	RecordedSimulation	START	1674619830094
USER	RecordedSimulation	START	1674619830345
USER	RecordedSimulation	START	1674619830595
USER	RecordedSimulation	START	1674619830845
USER	RecordedSimulation	START	1674619831096
USER	RecordedSimulation	START	1674619831346
USER	RecordedSimulation	START	1674619831596
USER	RecordedSimulation	START	1674619831846
REQUEST		request_0	1674619830597	1674619831995	OK	 
USER	RecordedSimulation	END	1674619832025
USER	RecordedSimulation	START	1674619832090
USER	RecordedSimulation	START	1674619832340
REQUEST		request_0	1674619831848	1674619832516	OK	 
USER	RecordedSimulation	END	1674619832518
USER	RecordedSimulation	START	1674619832591
USER	RecordedSimulation	START	1674619832841
USER	RecordedSimulation	START	1674619833089
REQUEST		request_0	1674619831347	1674619833167	OK	 
USER	RecordedSimulation	END	1674619833168
REQUEST		request_0	1674619829887	1674619833180	OK	 
USER	RecordedSimulation	END	1674619833183
REQUEST		request_0	1674619830096	1674619833300	OK	 
USER	RecordedSimulation	END	1674619833301
USER	RecordedSimulation	START	1674619833340
REQUEST		request_0	1674619831097	1674619833404	OK	 
USER	RecordedSimulation	END	1674619833407
REQUEST		request_0	1674619831597	1674619833568	OK	 
USER	RecordedSimulation	END	1674619833570
USER	RecordedSimulation	START	1674619833591
REQUEST		request_0	1674619830346	1674619833604	OK	 
USER	RecordedSimulation	END	1674619833605
REQUEST		request_0	1674619832341	1674619833631	OK	 
USER	RecordedSimulation	END	1674619833633
REQUEST		request_0	1674619832090	1674619833656	OK	 
USER	RecordedSimulation	END	1674619833658
REQUEST		request_0	1674619830846	1674619834055	OK	 
USER	RecordedSimulation	END	1674619834057
REQUEST		request_0	1674619832842	1674619834084	OK	 
USER	RecordedSimulation	END	1674619834086
REQUEST		request_0	1674619832592	1674619835502	OK	 
USER	RecordedSimulation	END	1674619835504
REQUEST		request_0	1674619833091	1674619836615	OK	 
USER	RecordedSimulation	END	1674619836616
REQUEST		request_0	1674619833342	1674619836651	OK	 
USER	RecordedSimulation	END	1674619836652
REQUEST		request_0	1674619833592	1674619836722	OK	 
USER	RecordedSimulation	END	1674619836724

No idea what you’re doing, but I really doubt there’s any issue with Gatling. You’re probably running a different test that the one you’re editing.

i really appreciate your willing to help, do you need more information to give you an idea where the problem might be? I added the request and response log here as well - with some omission, which shows that I am getting Http status 500. and i am sure i am running the correct test :slight_smile:

=========================
HTTP request:
POST <host>
headers:
	accept: */*
	content-type: application/json
	user-agent: insomnia/2022.6.0
	Proxy-Connection: Keep-Alive
	host: <host>
	content-length: 294
body:StringChunksRequestBody{charset=UTF-8, content={content}}
=========================
HTTP response:
status:
	500 
headers:
	Vary: Origin
	Vary: Access-Control-Request-Method
	Vary: Access-Control-Request-Headers
	Content-Type: text/plain;charset=UTF-8
	Content-Length: 839
	Date: Wed, 25 Jan 2023 04:10:33 GMT
	Connection: close

body:
{"errors":[]}
<<<<<<<<<<<<<<<<<<<<<<<<<

There’s no way to help if you don’t provide a reproducer, as explained here: How to Ask a Question

@ygGatling as I understand from your response you do a

check(status().is(500))

If yes, here you have mistake because in Gatling if you provide status in check the default behavior (set as KO) is override so HTTP 500 is mark as OK.

Thank you for the reply, I didn’t put a check to check status code earlier, I was just saving it in a variable and save it in a csv. I was thinking Gatling will handle it by itself. But I updated the code now to check for status code. The same us yours except it checks for 200, now the KO count is displayed correctly.

So as I suspected, the code you were executing was not the one you were editing.