smallrye / smallrye-health

Home Page:https://smallrye.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should return http status 500 if health check get failed

viniciusfcf opened this issue · comments

According to the specification, if a health Check Request processing failed (i.e. error in procedure), the http status must be 500, and not 503.

Test using Quarkus


@Liveness
@ApplicationScoped
public class MyHealth implements HealthCheck {

	@Override
	public HealthCheckResponse call() {
		throw new RuntimeException();
	}
    
}

@viniciusfcf @nderwin Sorry I didn't get to this sooner. Basically, the 500 status code is reserved for situations where we can't control the outcome of the health request. i.e. we can't construct the correct JSON response to be returned with 200 or 503 status code. For instance, if OOME happens. But in the case we can catch the exception we will create a DOWN 503 response because we don't want to kill your application when this happens. This is correct and aligned with the specification. Would you like to have a config that switches this processing off? We can add that but of course, you will kill your application on /health/* calls if exceptions will be propagated.

Thanks @xstefank, you are right. My bad. I read the specification again