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

WFE: Track in-flight HTTP requests by endpoint using a gauge #7758

Merged
merged 5 commits into from
Oct 18, 2024

Conversation

beautifulentropy
Copy link
Member

No description provided.

@beautifulentropy beautifulentropy marked this pull request as ready for review October 16, 2024 22:10
@beautifulentropy beautifulentropy requested a review from a team as a code owner October 16, 2024 22:10
Copy link
Contributor

@jsha jsha left a comment

Choose a reason for hiding this comment

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

I think this would be better implemented in metrics/measured_http. That way we get automatic extraction of the endpoint, and the measurement code is more nicely separated from the WFE code. Also, we get the same benefit for other web servers in Boulder, i.e. the OCSP responder.

Copy link
Contributor

@mcpherrinm mcpherrinm left a comment

Choose a reason for hiding this comment

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

(edit: never mind, see jsha's comment)

mcpherrinm
mcpherrinm previously approved these changes Oct 16, 2024
@beautifulentropy
Copy link
Member Author

I think this would be better implemented in metrics/measured_http. That way we get automatic extraction of the endpoint, and the measurement code is more nicely separated from the WFE code. Also, we get the same benefit for other web servers in Boulder, i.e. the OCSP responder.

Thanks! I wish I had noticed this existed earlier.

@beautifulentropy beautifulentropy changed the title WFE: Track in-flight HTTP requests by method using a gauge WFE: Track in-flight HTTP requests by endpoint using a gauge Oct 16, 2024
metrics/measured_http/http.go Outdated Show resolved Hide resolved
}, "server", opts...)
}

func (h *MeasuredHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
begin := h.clk.Now()
rwws := &responseWriterWithStatus{w, 0}

subHandler, pattern := h.Handler(r)
if pattern != "/" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the exclusion for "/"?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're mostly concerned about endpoints that dispatch RPCs, I knew we could safely discard "/". We could probably discard others as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. I think on balance, having fewer lines lines of code is slightly more appealing than economizing on the one timeseries, but I can really go either way on this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. I think that excluding "/" makes sense if this were implemented in the WFE, where we could also exclude other endpoints we don't care about, like "/build". But here in this helper library that may be used by other webservers that do care about the root path, excluding it is likely to lead to confusion in the future.

jsha
jsha previously approved these changes Oct 16, 2024
Copy link
Contributor

@aarongable aarongable left a comment

Choose a reason for hiding this comment

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

LGTM, with a slight preference for addressing Jacob's comment.

}, "server", opts...)
}

func (h *MeasuredHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
begin := h.clk.Now()
rwws := &responseWriterWithStatus{w, 0}

subHandler, pattern := h.Handler(r)
if pattern != "/" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. I think that excluding "/" makes sense if this were implemented in the WFE, where we could also exclude other endpoints we don't care about, like "/build". But here in this helper library that may be used by other webservers that do care about the root path, excluding it is likely to lead to confusion in the future.

@beautifulentropy beautifulentropy merged commit d0c9aa3 into main Oct 18, 2024
12 checks passed
@beautifulentropy beautifulentropy deleted the wfe-inflight-http branch October 18, 2024 13:51
@beautifulentropy
Copy link
Member Author

beautifulentropy commented Oct 18, 2024

#7758 (comment)

@aarongable I agree with this argument. I want to get this merged before our next tag, I'll write a follow-up that can be merged whenever.

#7759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants