Skip to content

Commit

Permalink
change percentiles
Browse files Browse the repository at this point in the history
  • Loading branch information
m-yosefpor committed Dec 28, 2021
1 parent deeb1c7 commit eb766e0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions prober/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
prometheus.HistogramOpts{
Name: "health_http_dns_lookup_time_seconds",
Help: "The response time of dns lookup",
Buckets: []float64{0.001, 0.005, 0.01, 0.02, 0.03, 0.05, 0.075, 0.1, 0.2, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 4, 5},
Buckets: []float64{0.0005, 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.008, 0.01, 0.015, 0.02, 0.03, 0.05, 0.075, 0.1, 0.2, 0.5, 1},
},
[]string{"name", "status_code", "dns_error", "result", "url"},
)
Expand Down Expand Up @@ -144,16 +144,18 @@ func (h *HTTP) calculateInterval() time.Duration {
func (h *HTTP) sendRequest(ctx context.Context) HTTPResult {
var startTime time.Time
var dnsStartTime time.Time
var dnsDoneTime time.Time
var dnsLookupTime float64
var dnsError string
var dnsHost string
httpTrace := &httptrace.ClientTrace{
DNSStart: func(_ httptrace.DNSStartInfo) {
DNSStart: func(info httptrace.DNSStartInfo) {
dnsHost = info.Host
dnsStartTime = time.Now()
},
DNSDone: func(info httptrace.DNSDoneInfo) {
dnsDoneTime = time.Now()
dnsLookupTime = time.Since(dnsStartTime).Seconds()
if info.Err != nil {
klog.Infof("DNS Error: %v ", info.Err)
klog.Infof("DNS Error for %v in %v seconds: %v ", dnsHost, dnsLookupTime, info.Err)
dnsError = info.Err.Error()
}
},
Expand All @@ -167,7 +169,6 @@ func (h *HTTP) sendRequest(ctx context.Context) HTTPResult {
startTime = time.Now()
res, err := h.Client.Do(req)
responseTime := time.Since(startTime).Seconds()
dnsLookupTime := dnsDoneTime.Sub(dnsStartTime).Seconds()

if err != nil {
return HTTPResult{
Expand Down

0 comments on commit eb766e0

Please sign in to comment.