Skip to content

Commit

Permalink
reverse_proxy: add placeholder http.reverse_proxy.retries (#6553)
Browse files Browse the repository at this point in the history
* Add placeholder http.reverse_proxy.lb.retries

* Renamed placeholder to http.reverse_proxy.retries
  • Loading branch information
steffenbusch authored Aug 30, 2024
1 parent 5c47c2f commit c050a37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/caddyhttp/reverseproxy/reverseproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func init() {
// `{http.reverse_proxy.upstream.duration_ms}` | Same as 'upstream.duration', but in milliseconds.
// `{http.reverse_proxy.duration}` | Total time spent proxying, including selecting an upstream, retries, and writing response.
// `{http.reverse_proxy.duration_ms}` | Same as 'duration', but in milliseconds.
// `{http.reverse_proxy.retries}` | The number of retries actually performed to communicate with an upstream.
type Handler struct {
// Configures the method of transport for the proxy. A transport
// is what performs the actual "round trip" to the backend.
Expand Down Expand Up @@ -443,6 +444,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
retries++
}

// number of retries actually performed
repl.Set("http.reverse_proxy.retries", retries)

if proxyErr != nil {
return statusError(proxyErr)
}
Expand Down

0 comments on commit c050a37

Please sign in to comment.