aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.49k stars 403 forks source link

feature: add task level metrics like CPU/Mem utilization to svc status output #2459

Open adamjkeller opened 3 years ago

adamjkeller commented 3 years ago

When running copilot svc status, it would be helpful to see the task level metrics to catch any tasks running hot as well as just to have general insight into how they are performing.

Screen_Shot_2021-06-14_at_2_08_54_PM

hariohmprasath commented 3 years ago

Hi @adamjkeller & @efekarakus, This is a neat feature, would love to contribute to this. Before that I have a question around the expected behavior:

In order to get any metrics granular than ECS service we need to enable ContainerInsights on cluster level. When ContainerInsights gets enabled, we can get metics like MemoryUtilized, CpuUtilized on TaskDefinitionFamily level rather than individual task's level. So let's say if we have 10 tasks running for the same task definition (with same version) you will see the same metrics 10 times. Just want to understand are you expecting the same behavior when you run this command? Thanks

efekarakus commented 3 years ago

Hi @hariohmprasath !

we need to enable ContainerInsights on cluster level.

Like you mentioned, Copilot does not enable ContainerInsights by default. I'd rather not do that by default due to cost implications and instead think of a way of allowing customers to specify it later. For now I think we'll have to only display a service level metrics (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-metrics.html)

Just want to understand are you expecting the same behavior when you run this command?

The new service status displays a Task Summary section:

Task Summary

  Running      ██████████  1/1 desired tasks are running
  Deployments  ██████████  1/1 running tasks for primary (rev 43)
  Health       ██████████  1/1 passes HTTP health checks (rev 43)

I think we can maybe leverage that section maybe for metrics:

Summary

  Running      ██████████  1/1 desired tasks are running
  Deployments  ██████████  1/1 running tasks for primary (rev 43)
  Health       ██████████  1/1 passes HTTP health checks (rev 43)
  CPU
  Memory
  HTTP Codes?

It'd be good if we can first use this issue to establish mocks for the end design to display metrics

hariohmprasath commented 3 years ago

Hi @hariohmprasath !

we need to enable ContainerInsights on cluster level.

Like you mentioned, Copilot does not enable ContainerInsights by default. I'd rather not do that by default due to cost implications and instead think of a way of allowing customers to specify it later. For now I think we'll have to only display a service level metrics (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-metrics.html)

Just want to understand are you expecting the same behavior when you run this command?

The new service status displays a Task Summary section:

Task Summary

  Running      ██████████  1/1 desired tasks are running
  Deployments  ██████████  1/1 running tasks for primary (rev 43)
  Health       ██████████  1/1 passes HTTP health checks (rev 43)

I think we can maybe leverage that section maybe for metrics:

Summary

  Running      ██████████  1/1 desired tasks are running
  Deployments  ██████████  1/1 running tasks for primary (rev 43)
  Health       ██████████  1/1 passes HTTP health checks (rev 43)
  CPU
  Memory
  HTTP Codes?

It'd be good if we can first use this issue to establish mocks for the end design to display metrics

Sounds good @efekarakus I really love to get some mocks and designs flushed out, before coding. I am with you on this. Its also nice to group metrics based on ECS Service level that way we don't even need to enable ContainerInsights for this.