plugin/health: Bypass proxy in self health check (#5401)

* add detail to docs; bypass proxy in self health check

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver
2022-06-17 15:49:53 -04:00
committed by GitHub
parent dded10420b
commit 037e4920c2
2 changed files with 20 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package health
import (
"context"
"net"
"net/http"
"time"
@@ -13,9 +14,22 @@ import (
// overloaded queries the health end point and updates a metrics showing how long it took.
func (h *health) overloaded(ctx context.Context) {
bypassProxy := &http.Transport{
Proxy: nil,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
timeout := 3 * time.Second
client := http.Client{
Timeout: timeout,
Timeout: timeout,
Transport: bypassProxy,
}
url := "http://" + h.Addr + "/health"