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

Allow overriding health endpoint check in handler#1177

Merged
rghetia merged 7 commits intocensus-instrumentation:masterfrom
tjcelaya:feature/ochttp-handler-custom-health-endpoints
Oct 1, 2019
Merged

Allow overriding health endpoint check in handler#1177
rghetia merged 7 commits intocensus-instrumentation:masterfrom
tjcelaya:feature/ochttp-handler-custom-health-endpoints

Conversation

@tjcelaya
Copy link
Copy Markdown
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.

@tjcelaya tjcelaya requested review from a team, rakyll and rghetia as code owners September 25, 2019 19:46
// 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
Copy Markdown
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
Copy Markdown
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