fix(ecs): Improve debug messaging for task health
MODIFY
clouddriver-ecs/src/main/java/com/netflix/spinnaker/clouddriver/ecs/provider/agent/TaskHealthCachingAgent.java
clouddriver-ecs/src/main/java/com/netflix/spinnaker/clouddriver/ecs/provider/agent/TaskHealthCachingAgent.java
@@ -104,6 +104,7 @@ public class TaskHealthCachingAgent extends AbstractEcsCachingAgent<TaskHealth>
Collection<Task> tasks = taskCacheClient.getAll(accountName, region);
if (tasks != null) {
+ log.debug("Found {} tasks to retrieve health for.", tasks.size());
for (Task task : tasks) {
String containerInstanceCacheKey =
Keys.getContainerInstanceKey(accountName, region, task.getContainerInstanceArn());
@@ -117,6 +118,10 @@ public class TaskHealthCachingAgent extends AbstractEcsCachingAgent<TaskHealth>
if (service == null) {
String taskEvictionKey = Keys.getTaskKey(accountName, region, task.getTaskId());
taskEvictions.add(taskEvictionKey);
+ log.debug(
+ "Service '{}' for task '{}' is null. Will not retrieve health.",
+ serviceName,
+ task.getTaskArn());
continue;
}
@@ -125,6 +130,8 @@ public class TaskHealthCachingAgent extends AbstractEcsCachingAgent<TaskHealth>
TaskDefinition taskDefinition = taskDefinitionCacheClient.get(taskDefinitionCacheKey);
if (isContainerMissingNetworking(task)) {
+ log.debug(
+ "Task '{}' is missing networking. Will not retrieve health.", task.getTaskArn());
continue;
}
@@ -157,6 +164,8 @@ public class TaskHealthCachingAgent extends AbstractEcsCachingAgent<TaskHealth>
}
log.debug("TaskHealthList contains the following elements: {}", taskHealthList);
}
+ } else {
+ log.debug("Task list is null. No healths to describe.");
}
return taskHealthList;
@@ -170,7 +179,7 @@ public class TaskHealthCachingAgent extends AbstractEcsCachingAgent<TaskHealth>
TaskDefinition taskDefinition) {
if (taskDefinition == null) {
- log.debug("Provided task definition is null.");
+ log.debug("Provided task definition is null for task '{}'.", task.getTaskArn());
return null;
}

fix(ecs): Improve debug messaging for task health (#4431)