[Fargate] [request]: CloudWatch metric for task exit status
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
I'd like a metric to report on container exist status. Support for scheduled tasks in Fargate is great, but I need to know when they don't work.
I opened a support request about this and learned ECS events can be used to cobble together a solution:
> For this purpose you can use the ecs events [1], specifically the task events [2] that are available for Fargate.
> You can use a lambda function to listening for these events and then this function can send them to CloudWatch logs. This document provides more details about how a lambda function can be configured to listen ecs events [3]. Then after having the events in CloudWatch Logs, they can be used to filter the data and create metrics as is done in the following example [4].
> Additionally, you can use the Lambda function to directly send the data to populate the metrics directly. In this way you don’t keep the data recorded in CloudWatch Logs. More details about this option can be found here [5].
This request is for Fargate... but perhaps it applies to ECS too(?).
Basically, the recommended solution is a bit complicated and could be fragile. If I'm left to write my own Lambda for this, now I have two things to monitor.
----
[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html
[2] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html#ecs_task_events
[3] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwet_handling.html
[4] https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CountingLogEventsExample.html
[5] https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html
```
Contributor guide
Research direction
Start with the ECS task events and CloudWatch metric documentation linked in the issue, then clarify whether the request applies to Fargate alone or ECS generally. Done means task exit status is available as a native CloudWatch metric without requiring a user-managed Lambda or log-filtering setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100