-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Engine seelog #1208
Engine seelog #1208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the changes are related to naming, I'm assuming all the tests will pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm, mostly nits about formatting, naming.
@@ -658,7 +665,7 @@ func (dg *dockerGoClient) stopContainer(ctx context.Context, dockerID string) Do | |||
err = client.StopContainerWithContext(dockerID, uint(dg.config.DockerStopTimeout/time.Second), ctx) | |||
metadata := dg.containerMetadata(dockerID) | |||
if err != nil { | |||
log.Debug("Error stopping container", "err", err, "id", dockerID) | |||
seelog.Infof("Error stopping container %s: %v", dockerID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DockerGoClient:
tag for this line
@@ -221,7 +221,7 @@ func (engine *DockerTaskEngine) MustInit(ctx context.Context) { | |||
err := engine.Init(ctx) | |||
if err != nil { | |||
errorOnce.Do(func() { | |||
log.Error("Could not connect to docker daemon", "err", err) | |||
seelog.Errorf("Task engine: could not connect to docker daemon: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we tag these as DockerTaskEngine
to keep parity with naming style as we have for DockerGoClient
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TL;DR I don't think so. Let me know what you think.
I used DockerGoClient
as I couldn't think of a better name for this. "Task engine"
distinguishes this from things like "Stats engine"
. I don't know if we need very strict rules about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay that's fine with me. I don't feel strongly either way. I'm guessing we'll have a better idea after a couple of weeks of log diving and debugging with these new changes 😛
agent/engine/docker_task_engine.go
Outdated
@@ -863,11 +906,13 @@ func (engine *DockerTaskEngine) buildCNIConfigFromTaskContainer(task *api.Task, | |||
} | |||
|
|||
func (engine *DockerTaskEngine) stopContainer(task *api.Task, container *api.Container) DockerContainerMetadata { | |||
seelog.Infof("Stopping container, container: %s, task: %s", container.String(), task.String()) | |||
seelog.Infof("Task engine[ %s]: stopping container [%s]", task.Arn, container.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing: Task engine[ %s]
agent/engine/docker_task_engine.go
Outdated
@@ -882,16 +927,17 @@ func (engine *DockerTaskEngine) stopContainer(task *api.Task, container *api.Con | |||
if container.Type == api.ContainerCNIPause { | |||
err := engine.cleanupPauseContainerNetwork(task, container) | |||
if err != nil { | |||
seelog.Errorf("Engine: cleanup pause container network namespace error, task: %s", task.String()) | |||
seelog.Errorf("Task engine[%s]: unable to cleanup pause container network namespace: %v", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing: Task engine[%s]
agent/engine/docker_task_engine.go
Outdated
} | ||
seelog.Infof("Cleaned pause container network namespace, task: %s", task.String()) | ||
seelog.Infof("Task engine[%s]: cleaned pause container network namespace", task.Arn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing: Task engine[%s]
@@ -165,17 +168,19 @@ func (mtask *managedTask) overseeTask() { | |||
if !mtask.GetKnownStatus().Terminal() { | |||
// If we aren't terminal and we aren't steady state, we should be | |||
// able to move some containers along. | |||
llog.Debug("Task not steady state or terminal; progressing it") | |||
seelog.Debugf("Managed task [%s]: task not steady state or terminal; progressing it", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: again to keep parity, should we make the tags ManagedTask
?
agent/engine/task_manager.go
Outdated
@@ -358,16 +366,17 @@ func (mtask *managedTask) handleContainerChange(containerChange dockerContainerC | |||
now := mtask.time().Now() | |||
ok := mtask.Task.SetExecutionStoppedAt(now) | |||
if ok { | |||
seelog.Infof("Recording execution stopped time for a task, essential container in task stopped, task %s, time: %s", | |||
mtask.Task.String(), now.String()) | |||
seelog.Infof("Managed task [%s]: recording execution stopped time. Essential container %s stopped at: %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: container [%s]
, I think there are few of these where formatting varies from line to line. Not sure if this was intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops meant to approve since mostly nits. thanks for going through this and making these changes. =]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for tags in logs
DependentContainerNotResolvedErr = errors.New("dependency graph: dependent container not in expected state") | ||
// ContainerPastDesiredStatusErr is the error where the container status is bigger than desired status | ||
ContainerPastDesiredStatusErr = errors.New("container transition: container status is equal or greater than desired status") | ||
volumeUnresolvedErr = errors.New("dependency graph: container volume dependency not resolved") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing comments
agent/engine/docker_task_engine.go
Outdated
@@ -336,7 +339,7 @@ func (engine *DockerTaskEngine) synchronizeContainerStatus(container *api.Docker | |||
func (engine *DockerTaskEngine) CheckTaskState(task *api.Task) { | |||
taskContainers, ok := engine.state.ContainerMapByArn(task.Arn) | |||
if !ok { | |||
seelog.Warnf("Could not check task state for task; no task in state: %s", task.Arn) | |||
seelog.Warnf("Task engine [%s]: could not check task state for task; no task in state", task.Arn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewording suggestion: could not check task state; no task in state
agent/engine/task_manager.go
Outdated
return | ||
} | ||
|
||
seelog.Infof("Managed task: sending container change event: %s", event.String()) | ||
seelog.Infof("Managed task [%s]: sending container change event [%s]: %s", | ||
mtask.Arn, container.Name, event.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this should be cont.Name
Move to seelog and a uniform logging structure in the task manager code
Switch logger to seelog for container and task engine files.
Added a mock for StopContainer in TestBatchContainerHappyPath. On slower machines, if the cleanup takes long, the task engine could invoke StopContainer and this would cause the unit test to fail. Example: https://travis-ci.org/aws/amazon-ecs-agent/builds/332087012?utm_source=github_status&utm_medium=notification
Renamed docker_container_engine.go to docker_client.go
Summary
Removed module logger and switched to
seelog
inengine
packageImplementation details
Testing
make release
)go build -out amazon-ecs-agent.exe ./agent
)make test
) passgo test -timeout=25s ./agent/...
) passmake run-integ-tests
) pass.\scripts\run-integ-tests.ps1
) passmake run-functional-tests
) pass.\scripts\run-functional-tests.ps1
) passNew tests cover the changes: yes
Description for the changelog
None
Licensing
This contribution is under the terms of the Apache 2.0 License: Yes