-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: implement local service health check #240
Conversation
Still unsure how to test if a service is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still unsure how to test if a service is critical or warning.
It is going to be tricky. I've implemented a test showing how to do it but it doesn't work.
The reason is that local health API returns an unsuccessful status code when at least one check is in a warning or critical state (https://developer.hashicorp.com/consul/api-docs/agent/service#get-local-service-health). Therefore we get an exception instead of a regular response. Not sure how to overcome this API inconsistency.
I am also having trouble trying to deserialise the AggregatedStatus enum. Is it even possible to deserialise pure strings with ConsulClient?
Just use HealthStatus
class. I think that a simple enum would work just fine, but we don't need another enum class as the AggregatedStatus has the same possible values as health status, or doesn't it?
Co-authored-by: Marcin Krystianc <[email protected]>
Co-authored-by: Marcin Krystianc <[email protected]>
Co-authored-by: Marcin Krystianc <[email protected]>
Haha, try-catch maybe? |
Well, it is better to avoid exceptions in the regular execution path. I think we have already an example of how to implement a special case for unsuccessful status codes, see consuldotnet/Consul/Client_PutRequests.cs Lines 345 to 347 in 53be496
You could implement a similar special case in the https://github.com/G-Research/consuldotnet/blob/master/Consul/Client_GetRequests.cs#L82 |
Whoops, marked this for review on accident. |
Sorry for the long delay! I was really busy with school and exams. Finally got around to working on it. @marcin-krystianc do let me know if I need to make any more changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @winstxnhdw, I've left some comments. I think there was an actual bug in the GetLocalServiceHealthByID
method.
Co-authored-by: Marcin Krystianc <[email protected]>
Co-authored-by: Marcin Krystianc <[email protected]>
Seems like I misunderstood the docs. I have removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one simple suggestion to rename variable in a test to avoid confusion.
Co-authored-by: Marcin Krystianc <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/agent/health/service