adam bien's blog

Quarkus, Health, Metrics,OpenAPI: Moved Permanently (301) 📎

Quarkus release 1.11.0 (January 20, 2021) introduced the Dev UI /q/dev. To avoid conflicts, all non-application endpoints (e.g. /health, /metrics) were moved to the new root /q.

Now, the health endpoint is available under: /q/health and metrics are available under /q/metrics

Quarkus automatically redirects the non-application endpoints to the new location:


> curl -i localhost:8080/health
HTTP/1.1 301 Moved Permanently
location: http://localhost:8080/q/health    
and

> curl -i localhost:8080/metrics
HTTP/1.1 301 Moved Permanently
location: http://localhost:8080/q/metrics    

I'm using MicroProfile metrics after torture tests for threshold verification. The release +1.11.* broke the asserts, because JAX-RS / MicroProfile REST client didn't follow the redirects.

Starting with the release: 1.11.2+, also the health endpoint was moved to the new location. Kubernetes expects http status codes: 200-400, so 301 is still considered as 'healthy'.

However: in kubernetes-like environments, the developer may be in charge to specify the health command. Then 301 (redirect) might be problematic.

The /q prefix can be removed with the following property:


quarkus.http.non-application-root-path=/    

The endpoints are defined in the microprofile health and microprofile metrics specifications.

Seems like Quarkus is the first microprofile runtime which moved the endpoints to a different location.

See also related issue: MicroProfile Metrics, Health, OpenAPI URI changed #15030