-
Notifications
You must be signed in to change notification settings - Fork 670
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
Filterable Health Tags #1304
Filterable Health Tags #1304
Conversation
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.
Just small stuff
api/health/handler.go
Outdated
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
// Make sure the content type is set before writing the header. | ||
w.Header().Set("Content-Type", "application/json") | ||
|
||
checks, healthy := reporter() | ||
subnetIDs := r.URL.Query()["subnetID"] |
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.
Kinda weird that the key is subnetID
and it returns subnetIDs
... But I do think this is the best way to do this with the query params...
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.
yea and it's even weirder that r.URL.Query().Get("subnetID")
returns the first value for the key... alternatively we can use plural subnetIDs
(now tags
) and split string value by comas. but I probably would prefer singular key names (i.e tag
over tags
).
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.
just a few more nits. Once these are done LGTM
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.
1 final nit otherwise LGTM
Why this should be merged
global
tag for those checks like db/network. Global health checks are always returned regardless of filters.tags
optional param to Post request. Ex:tag
optional query param. Supports multipletag
params. Ex:Closes: #1264
How this works
expands the Health result/register interface by adding input of optional tags to Register and Result methods.
Tracks tags > names map in the worker
How this was tested
Added unit tests