summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Busch <37350514+steffenbusch@users.noreply.github.com>2024-08-30 19:53:56 +0200
committerGitHub <noreply@github.com>2024-08-30 11:53:56 -0600
commitc050a37e1c3228708a6716c8971361134243e941 (patch)
treeb11f33883b8f81fe54aa7a8a7dc4a526a2669077
parent5c47c2f147e5bef44fc8cb48a655d31f5a2a817c (diff)
reverse_proxy: add placeholder http.reverse_proxy.retries (#6553)
* Add placeholder http.reverse_proxy.lb.retries * Renamed placeholder to http.reverse_proxy.retries
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 1883ac07..44cc2f9d 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -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.
@@ -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)
}