Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Allow overriding health endpoint check in handler #1177

Conversation

tjcelaya
Copy link
Contributor

Addresses #1171 by allowing users to supply a func (string) bool which can be used to determine if the path is a health-check, falling back to the existing solution if no func is supplied.

Test copied from TestIgnoreHealthz to supply the new parameter but I'd be happy to merge them or modify the cases.

plugin/ochttp/server.go Outdated Show resolved Hide resolved
plugin/ochttp/server_test.go Show resolved Hide resolved
// incoming HTTP request should be considered a health check. This is in
// addition to the private isHealthEndpoint func which may also indicate
// tracing should be skipped.
IsHealthEndpoint func(string) bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description looks good now.

It might be better to pass http.Request rather than just Path. For example, decision could be made on a header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes perfect sense since the other funcs also accept the http.Request, I feel silly for not having considered it sooner. Thanks for the suggestion!

@rghetia rghetia merged commit f58a717 into census-instrumentation:master Oct 1, 2019
@tjcelaya tjcelaya deleted the feature/ochttp-handler-custom-health-endpoints branch October 10, 2019 23:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants