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

"/health/service/X?passing" is missing services #241

Closed
mmeinardi opened this issue Jul 4, 2014 · 1 comment
Closed

"/health/service/X?passing" is missing services #241

mmeinardi opened this issue Jul 4, 2014 · 1 comment

Comments

@mmeinardi
Copy link

Sometimes requesting a list of healthy services (by using ?passing parameter) is missing the ones that pass all the health checks.

Example:

Query 1:
http://localhost:8500/v1/health/service/some-service

{
    "Checks": [
        {
            "CheckID": "service:92bcd373e541",
            "Name": "Service 'some-service' check",
            "Node": "consul-192.168.3.223",
            "Notes": "",
            "Output": "",
            "ServiceID": "92bcd373e541",
            "ServiceName": "some-service",
            "Status": "passing"
        },
        {
            "CheckID": "serfHealth",
            "Name": "Serf Health Status",
            "Node": "consul-192.168.3.223",
            "Notes": "",
            "Output": "Agent not live or unreachable",
            "ServiceID": "",
            "ServiceName": "",
            "Status": "critical"
        }
    ],
    "Node": {
        "Address": "192.168.3.223",
        "Node": "consul-192.168.3.223"
    },
    "Service": {
        "ID": "92bcd373e541",
        "Port": 4001,
        "Service": "some-service"
    }
},
{
    "Checks": [
        {
            "CheckID": "service:4a1c7d1b374f",
            "Name": "Service 'some-service' check",
            "Node": "consul-192.168.3.165",
            "Notes": "",
            "Output": "Exception: () \n",
            "ServiceID": "4a1c7d1b374f",
            "ServiceName": "some-service",
            "Status": "critical"
        },
        {
            "CheckID": "serfHealth",
            "Name": "Serf Health Status",
            "Node": "consul-192.168.3.165",
            "Notes": "",
            "Output": "Agent not live or unreachable",
            "ServiceID": "",
            "ServiceName": "",
            "Status": "critical"
        }
    ],
    "Node": {
        "Address": "192.168.3.165",
        "Node": "consul-192.168.3.165"
    },
    "Service": {
        "ID": "4a1c7d1b374f",
        "Port": 49154,
        "Service": "some-service"
    }
},
{
    "Checks": [
        {
            "CheckID": "service:e64e53ec404f",
            "Name": "Service 'some-service' check",
            "Node": "consul-192.168.3.129",
            "Notes": "",
            "Output": "",
            "ServiceID": "e64e53ec404f",
            "ServiceName": "some-service",
            "Status": "passing"
        },
        {
            "CheckID": "serfHealth",
            "Name": "Serf Health Status",
            "Node": "consul-192.168.3.129",
            "Notes": "",
            "Output": "Agent alive and reachable",
            "ServiceID": "",
            "ServiceName": "",
            "Status": "passing"
        }
    ],
    "Node": {
        "Address": "192.168.3.129",
        "Node": "consul-192.168.3.129"
    },
    "Service": {
        "ID": "e64e53ec404f",
        "Port": 4001,
        "Service": "some-service"
    }
}

Query 2:
http://localhost:8500/v1/health/service/some-service?passing

[]

But the 3rd service is clearly ok.

The bug seems to exist in this function:
https://github.com/hashicorp/consul/blob/master/command/agent/health_endpoint.go#L118
After finding out that one of the health check is not passing we should remove the service from the output and break - moving on to next services.

@armon armon closed this as completed in 135c409 Jul 5, 2014
@armon
Copy link
Member

armon commented Jul 5, 2014

Good catch! Thanks!

duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
@hashicorp hashicorp deleted a comment Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants