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

[Feature Request] Parsing response content of Non HTTP 200 response #874

Open
beirtipol opened this issue Jun 10, 2024 · 3 comments
Open

Comments

@beirtipol
Copy link

The Spring boot /acuator/health endpoint will return a 503 error code if any of the components it is monitoring report a status of DOWN. The response body still contains valid JSON, but infinity doesn't attempt to parse it, it just says 'No data'.

This should still work, regardless of the response code.

Here's some sample JSON

{
    "status": "UP",
    "components": {
        "clientConfigServer": {
            "status": "UP",
            "details": {
                "propertySources": [
                    "configserver:[email protected]:MyCompany/myapp-config.git/thisapp/thisapp-uat.yaml",
                    "configClient"
                ]
            }
        },
        "diskSpace": {
            "status": "UP",
            "details": {
                "total": 107317563392,
                "free": 24000552960,
                "threshold": 10485760,
                "path": "/application/.",
                "exists": true
            }
        },
        "someCustomCheck": {
            "status": "DOWN",
            "details": {
                "everything is": "awful"
            }
        },
        "livenessState": {
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        },
        "readinessState": {
            "status": "UP"
        },
        "refreshScope": {
            "status": "UP"
        }
    },
    "groups": [
        "liveness",
        "readiness"
    ]
}
@yesoreyeram
Copy link
Collaborator

This is the expected behaviour of the plugin. How do you differentiate the 503 by the API error vs 503 of the underlying application health?

I would consider this as a feature request but not a bug.

@yesoreyeram yesoreyeram changed the title [Bug] Non-200 HTTP responses shouldn't stop infinity from working [Feature Request] Parsing response content of Non HTTP 200 response Jun 10, 2024
@yesoreyeram
Copy link
Collaborator

actually this piece of code considers anything greater than HTTP 400 as error.

if res.StatusCode >= http.StatusBadRequest {
return nil, res.StatusCode, duration, errors.New(res.Status)
}

We can accept something like ignoreHttpStatusCode: true in query then ignore http status codes in such cases

@beirtipol
Copy link
Author

beirtipol commented Jun 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants