Skip to content

Commit

Permalink
Add ClickHouse http client timeout (ClickHouse#27)
Browse files Browse the repository at this point in the history
30 seconds for each request is long enough for ClickHouse to
respond under any conditions, but short enough to close stuck
connections.

Making it configurable means breaking `NewExporter` clients.
Or, a new interface for creating exporters has to be created.

Closes ClickHouse#25 which is most likely caused by
ClickHouse/ClickHouse#4060.
  • Loading branch information
nvartolomei authored and f1yegor committed Jan 29, 2019
1 parent 638809a commit 1038e72
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"unicode"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -73,6 +74,7 @@ func NewExporter(uri url.URL, insecure bool, user, password string) *Exporter {
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},
},
Timeout: 30 * time.Second,
},
user: user,
password: password,
Expand Down

0 comments on commit 1038e72

Please sign in to comment.