Skip to content

Commit

Permalink
Log response' body from a call to Prometheus (proxied by apiserver).
Browse files Browse the repository at this point in the history
  • Loading branch information
oxddr committed Jan 23, 2020
1 parent 197beda commit 1130f71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clusterloader2/pkg/prometheus/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ func CheckTargetsReady(k8sClient kubernetes.Interface, selector func(Target) boo
ProxyGet("http", "prometheus-k8s", "9090", "api/v1/targets", nil /*params*/).
DoRaw()
if err != nil {
response := "(empty)"
if raw != nil {
response = string(raw)
}
// This might happen if prometheus server is temporary down, log error but don't return it.
klog.Warningf("error while calling prometheus api: %v", err)
klog.Warningf("error while calling prometheus api: %v, response: %q", err, response)
return false, nil
}
var response targetsResponse
Expand Down

0 comments on commit 1130f71

Please sign in to comment.