Skip to content

Commit f716ae0

Browse files
authored
Merge pull request #513 from adrobisch/scaling-operation-logs
Add logs for the scaling operation
2 parents 17e9822 + fd9b4dd commit f716ae0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

operator/autoscaler.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ func (as *AutoScaler) GetScalingOperation() (*ScalingOperation, error) {
150150

151151
managedIndices := as.getManagedIndices(esIndices, esShards)
152152
managedNodes := as.getManagedNodes(as.pods, esNodes)
153+
154+
as.logger.Debugf("Calculating scaling operation for: hint=%s, managedIndices=%d, managedNodes=%d",
155+
direction,
156+
len(managedIndices),
157+
len(managedNodes),
158+
)
159+
153160
return as.calculateScalingOperation(managedIndices, managedNodes, direction), nil
154161
}
155162

@@ -214,6 +221,19 @@ func (as *AutoScaler) calculateScalingOperation(managedIndices map[string]ESInde
214221
return noopScalingOperation(fmt.Sprintf("Scaling would violate the minimum required disk free percent: %.2f", 75.0))
215222
}
216223

224+
as.logger.Infof("Scaling operation: direction=%s, nodeReplicas=%s, indexReplicaChanges=%d, targetIndexReplicas=%v, description=%s",
225+
scalingOperation.ScalingDirection,
226+
func() string {
227+
if scalingOperation.NodeReplicas == nil {
228+
return "unset"
229+
}
230+
return fmt.Sprintf("%d", *scalingOperation.NodeReplicas)
231+
}(),
232+
len(scalingOperation.IndexReplicas),
233+
scalingOperation.IndexReplicas,
234+
scalingOperation.Description,
235+
)
236+
217237
return scalingOperation
218238
}
219239

0 commit comments

Comments
 (0)