Skip to content

Commit

Permalink
Merge pull request #6 from fujiwara/all-status
Browse files Browse the repository at this point in the history
show all status of containers and a task.
  • Loading branch information
fujiwara authored Mar 1, 2022
2 parents d803c1f + 7099709 commit 7e03de9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,18 @@ func (t *Tracer) traceTask(cluster string, taskID string) (*ecs.Task, error) {

for _, c := range task.Containers {
containerName := *c.Name
msg := fmt.Sprintf(*c.LastStatus)
msg := fmt.Sprintf("LastStatus:%s HealthStatus:%s", *c.LastStatus, *c.HealthStatus)
if c.ExitCode != nil {
msg += fmt.Sprintf(" (exit code: %d)", *c.ExitCode)
}
if c.Reason != nil {
msg += fmt.Sprintf(" (reason: %s)", *c.Reason)
}
var ts *time.Time
switch aws.StringValue(c.LastStatus) {
case "STOPPED":
ts = task.StoppedAt
default:
ts = &t.now
}
t.AddEvent(ts, "CONTAINER:"+containerName, msg)
t.AddEvent(&t.now, "CONTAINER:"+containerName, msg)
}

t.AddEvent(&t.now, "TASK", "LastStatus:"+aws.StringValue(task.LastStatus))

return task, nil
}

Expand Down

0 comments on commit 7e03de9

Please sign in to comment.