Optional TLS and timeouts for statsServer
parent
7d4cc6e793
commit
b7e104ac94
|
@ -12,6 +12,9 @@ connection_string = "localhost:8086"
|
|||
database = "reports"
|
||||
user = "user"
|
||||
password = "pass"
|
||||
is_secure = false
|
||||
skip_verify = false
|
||||
timeout = "5s"
|
||||
|
||||
# A regular database, user, and password to read and write data on the cluster being benchmarked.
|
||||
[cluster_credentials]
|
||||
|
|
|
@ -2,10 +2,13 @@ package main
|
|||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"crypto/tls"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
@ -31,6 +34,9 @@ type statsServer struct {
|
|||
User string `toml:"user"`
|
||||
Password string `toml:"password"`
|
||||
Database string `toml:"database"`
|
||||
IsSecure bool `toml:"is_secure"`
|
||||
SkipVerify bool `toml:"skip_verify"`
|
||||
Timeout time.Duration `toml:"timeout"`
|
||||
}
|
||||
|
||||
type clusterCredentials struct {
|
||||
|
@ -197,7 +203,17 @@ func (self *BenchmarkHarness) reportClient() *influxdb.Client {
|
|||
Host: self.Config.StatsServer.ConnectionString,
|
||||
Database: self.Config.StatsServer.Database,
|
||||
Username: self.Config.StatsServer.User,
|
||||
Password: self.Config.StatsServer.Password}
|
||||
Password: self.Config.StatsServer.Password,
|
||||
IsSecure: self.Config.StatsServer.IsSecure,
|
||||
HttpClient: &http.Client{
|
||||
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: self.Config.StatsServer.SkipVerify},
|
||||
ResponseHeaderTimeout: self.Config.StatsServer.Timeout,
|
||||
Dial: func(network, address string) (net.Conn, error) {
|
||||
return net.DialTimeout(network, address, self.Config.StatsServer.Timeout)
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
client, _ := influxdb.NewClient(clientConfig)
|
||||
return client
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue