Skip to content

Commit 5df8231

Browse files
author
Hoosein Safdari
committed
Add debug logs to monitor retry in waitForEmptyEsNode
1 parent 54dc371 commit 5df8231

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

operator/es_client.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,13 @@ func (c *ESClient) waitForEmptyEsNode(ctx context.Context, pod *v1.Pod) error {
365365
default:
366366
// Process response as normal if context is not done.
367367
var shards []ESShard
368-
err := json.Unmarshal(r.Body(), &shards)
368+
body := r.Body()
369+
c.logger().Debugf("Request to %s/_cat/shards?h=index,ip&format=json status code %d - %s on %s/%s (%s)",
370+
c.Endpoint.String(), r.StatusCode(), string(body[:]), pod.Namespace, pod.Name, podIP)
371+
err := json.Unmarshal(body, &shards)
369372
if err != nil {
373+
c.logger().Debugf("Error unmarshalling ES shards on %s/%s (%s) - %v",
374+
pod.Namespace, pod.Name, podIP, err)
370375
return true, err
371376
}
372377
// shardIP := make(map[string]bool)
@@ -382,6 +387,8 @@ func (c *ESClient) waitForEmptyEsNode(ctx context.Context, pod *v1.Pod) error {
382387
if remainingShards > 0 {
383388
err = c.excludePodIP(pod)
384389
if err != nil {
390+
c.logger().Debugf("Error with excluding pod ip on %s/%s (%s) - %v",
391+
pod.Namespace, pod.Name, podIP, err)
385392
return true, err
386393
}
387394
}

0 commit comments

Comments
 (0)