Skip to content
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

not getting CPU metrics ecs_cpu_seconds_total #74

Closed
pranaysahare opened this issue Mar 28, 2024 · 2 comments · Fixed by #81
Closed

not getting CPU metrics ecs_cpu_seconds_total #74

pranaysahare opened this issue Mar 28, 2024 · 2 comments · Fixed by #81

Comments

@pranaysahare
Copy link

I am using image URL “quay.io/prometheuscommunity/ecs-exporter:latest” , for ecs-exporter container. when I checked it exposing all the metrics or not, I saw it was not showing the CPU metrics.
 
got the same issue with the main and v0.2.1 images.
cpu_metric_issue

@isker
Copy link
Contributor

isker commented Oct 6, 2024

Seems to be missing only when running on EC2. Fargate is fine.

It must be the case that the task stats API endpoint does not return per CPU usage when running on EC2, and that's what we're relying on:

for i, cpuUsage := range s.CPUStats.CPUUsage.PercpuUsage {
cpu := fmt.Sprintf("%d", i)
ch <- prometheus.MustNewConstMetric(
cpuTotalDesc,
prometheus.CounterValue,
float64(cpuUsage)/nanoSeconds,
append(labelVals, cpu)...,
)
}

If that's really the case, the exporter should either degrade to the total CPU usage metrics on EC2, or it should only use those in both EC2 and Fargate. I say that because I'm not sure what the use is of getting per-CPU numbers in general here. cAdvisor agrees: google/cadvisor@ec6da3a.

@isker
Copy link
Contributor

isker commented Oct 6, 2024

Looks like this might have worked on EC2 in the past but stopped when cgroups v2 support was added here: aws/amazon-ecs-agent#3161.

Cgroups v2 no longer can provide per-cpu usage stats, so this validation was removed since we never used it either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants