Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Liveness probe doesn't work with @Path #10720

Closed
survivant opened this issue Jul 14, 2020 · 4 comments · Fixed by #10930
Closed

@Liveness probe doesn't work with @Path #10720

survivant opened this issue Jul 14, 2020 · 4 comments · Fixed by #10930
Labels
kind/bug Something isn't working
Milestone

Comments

@survivant
Copy link
Contributor

Quarkus 1.6.0.FINAL

the health probe annoted with @Liveness and @path won't be returned when we call http://localhost:8080/health/

I took the example : quarkus-quickstarts\microprofile-health-quickstart

and when I do

mvn quarkus:dev
http://localhost:8080/health/

the output is :

{
    "status": "UP",
    "checks": [
        {
            "name": "Simple health check",
            "status": "UP"
        },
        {
            "name": "Health check with data",
            "status": "UP",
            "data": {
                "bar": "barValue",
                "foo": "fooValue"
            }
        },
        {
            "name": "Database connection health check",
            "status": "UP"
        }
    ]
}

but if I add @path in a class : SimpleHealthCheck that have @Liveness, the output became


{
    "status": "UP",
    "checks": [
        {
            "name": "Health check with data",
            "status": "UP",
            "data": {
                "bar": "barValue",
                "foo": "fooValue"
            }
        },
        {
            "name": "Database connection health check",
            "status": "UP"
        }
    ]
}
@survivant survivant added the kind/bug Something isn't working label Jul 14, 2020
@mkouba
Copy link
Contributor

mkouba commented Jul 15, 2020

Hm, I wonder what is the use case for annotating a health check with @javax.ws.rs.Path? Anyway, you're right. I've been able to reproduce the issue locally.

@survivant
Copy link
Contributor Author

my usecase is that I have a variable that I used to set the return as UP and DOWN. Mostly for testing or disabling a probe. I use the endpoint to change that value

@mkouba
Copy link
Contributor

mkouba commented Jul 15, 2020

Anyway, I found the problem - JAX-RS root resources are automatically annotated with @javax.enterprise.inject.Typed(RootResource.class) to workaround some problems with JAX-RS sub-resource locators. And so the org.eclipse.microprofile.health.HealthCheck is removed from its set of bean types.

You'll need to use a separate bean for the healh check, inject the bean in the resource and change its state via the endpoint methods.

@geoand
Copy link
Contributor

geoand commented Jul 16, 2020

Perhaps we just want to log a warning when @Path is used together with @Liveness or @Readiness?

geoand added a commit to geoand/quarkus that referenced this issue Jul 23, 2020
It's not unreasonable for users to expect these annotations to work
together, so let's be explicit that they don't.

Resolves: quarkusio#10720
geoand added a commit to geoand/quarkus that referenced this issue Jul 23, 2020
It's not unreasonable for users to expect these annotations to work
together, so let's be explicit that they don't.

Resolves: quarkusio#10720
geoand added a commit to geoand/quarkus that referenced this issue Jul 23, 2020
It's not unreasonable for users to expect these annotations to work
together, so let's be explicit that they don't.

Resolves: quarkusio#10720
jmartisk added a commit that referenced this issue Jul 23, 2020
Warn when JAX-RS @path is used along with MP Health annotations
@gsmet gsmet added this to the 1.7.0 - master milestone Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants