Improve timeout in input plugins
This commit is contained in:
committed by
Cameron Sparr
parent
ea7cbc781e
commit
7416d6ea71
@@ -244,6 +244,11 @@ func (h *HttpJson) sendRequest(serverURL string) (string, float64, error) {
|
||||
|
||||
func init() {
|
||||
inputs.Add("httpjson", func() telegraf.Input {
|
||||
return &HttpJson{client: RealHTTPClient{client: &http.Client{}}}
|
||||
tr := &http.Transport{ResponseHeaderTimeout: time.Duration(3 * time.Second)}
|
||||
client := &http.Client{
|
||||
Transport: tr,
|
||||
Timeout: time.Duration(4 * time.Second),
|
||||
}
|
||||
return &HttpJson{client: RealHTTPClient{client: client}}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user