Skip to content

Commit 0ccbe5e

Browse files
committed
Add task stop verification ack to ecs-agent module
1 parent 0be8253 commit 0ccbe5e

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

agent/vendor/github.com/aws/amazon-ecs-agent/ecs-agent/metrics/constants.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,20 @@ func (r *taskStopVerificationACKResponder) handleTaskStopVerificationACK(message
6363
return errors.New("Invalid messageID received: " + ackMessageID + " Manifest Message ID: " + manifestMessageID)
6464
}
6565

66+
// Reset the message id so that the message with same message id is not processed twice.
67+
r.messageIDAccessor.SetMessageID("")
68+
6669
// Loop through all tasks in the verified stop list and set the desired status of each one to STOPPED.
6770
tasksToStop := message.StopTasks
6871
for _, task := range tasksToStop {
6972
taskARN := aws.StringValue(task.TaskArn)
70-
metricFields := map[string]interface{}{
73+
metricFields := logger.Fields{
7174
"MessageID": aws.StringValue(message.MessageId),
7275
"TaskARN": taskARN,
7376
}
7477
r.metricsFactory.New(metrics.TaskStoppedMetricName).WithFields(metricFields).Done(nil)
7578

76-
// Send request to the task stopper to stop the task this will be executed asynchronously
77-
// in the context of the task stopper's message channel.
79+
// Send request to the task stopper to stop the task.
7880
logger.Info("Sending message to task stopper to stop task", logger.Fields{
7981
field.TaskARN: taskARN,
8082
})

ecs-agent/metrics/constants.go

+8
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ const (
2626
// AttachResourceResponder
2727
attachResourceResponderNamespace = "ResourceAttachment"
2828
ResourceValidationMetricName = attachResourceResponderNamespace + ".Validation"
29+
30+
// TaskManifestResponder
31+
taskManifestResponderNamespace = "TaskManifestResponder"
32+
TaskManifestHandlingDuration = taskManifestResponderNamespace + ".Duration"
33+
34+
// TaskStopVerificationACKResponder
35+
taskStopVerificationACKResponderNamespace = "TaskStopVeificationACKResponder"
36+
TaskStoppedMetricName = taskStopVerificationACKResponderNamespace + ".TaskStopped"
2937
)

0 commit comments

Comments
 (0)