Improve timeout in input plugins

This commit is contained in:
Pierre Fersing
2016-02-29 17:52:58 +01:00
committed by Cameron Sparr
parent ea7cbc781e
commit 7416d6ea71
21 changed files with 184 additions and 21 deletions

View File

@@ -129,8 +129,11 @@ func (g *haproxy) Gather(acc telegraf.Accumulator) error {
func (g *haproxy) gatherServer(addr string, acc telegraf.Accumulator) error {
if g.client == nil {
client := &http.Client{}
tr := &http.Transport{ResponseHeaderTimeout: time.Duration(3 * time.Second)}
client := &http.Client{
Transport: tr,
Timeout: time.Duration(4 * time.Second),
}
g.client = client
}