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

missing online CPU information w/ compat REST API #15754

Closed
benoitf opened this issue Sep 12, 2022 · 5 comments · Fixed by #15867
Closed

missing online CPU information w/ compat REST API #15754

benoitf opened this issue Sep 12, 2022 · 5 comments · Fixed by #15867
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop

Comments

@benoitf
Copy link
Contributor

benoitf commented Sep 12, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Looking at Compat API
https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerStats

it says number_cpus = length(cpu_stats.cpu_usage.percpu_usage) or cpu_stats.online_cpus

and

If either precpu_stats.online_cpus or cpu_stats.online_cpus is nil then for compatibility with older daemons the length of the corresponding cpu_usage.percpu_usage array should be used.

but it seems podman is not providing any of percpu_usage or online_cpus

Steps to reproduce the issue:

  1. launch a container like httpd
myContainer=$(podman run -d docker.io/library/httpd)

grab cpu_stats

$ curl --silent --unix-socket /Users/benoitf/.local/share/containers/podman/machine/podman-machine-default/podman.sock "http:/v1.41/containers/$myContainer/stats?stream=false"  | jq .cpu_stats
{
  "cpu_usage": {
    "total_usage": 192517000,
    "usage_in_kernelmode": 167090,
    "usage_in_usermode": 192349910
  },
  "system_cpu_usage": 2518699606000,
  "cpu": 0,
  "throttling_data": {
    "periods": 0,
    "throttled_periods": 0,
    "throttled_time": 0
  }
}

or pre_cpu_stats

$ curl --silent --unix-socket /Users/benoitf/.local/share/containers/podman/machine/podman-machine-default/podman.sock "http:/v1.41/containers/$myContainer/stats?stream=false"  | jq .precpu_stats
{
  "cpu_usage": {
    "total_usage": 0,
    "usage_in_kernelmode": 0,
    "usage_in_usermode": 0
  },
  "cpu": 0,
  "throttling_data": {
    "periods": 0,
    "throttled_periods": 0,
    "throttled_time": 0
  }
}

Describe the results you received:

I don't see the number of cpus

Describe the results you expected:

I can get get the number of cpus and compute cpu usage

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

4.2.1 / macOS

Output of podman info:

(paste your output here)

Package info (e.g. output of rpm -q podman or apt list podman):

(paste your output here)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes/No

Additional environment details (AWS, VirtualBox, physical, etc.):

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Nov 18, 2022

This continues to be worked on.

@github-actions
Copy link

github-actions bot commented Jan 4, 2023

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jan 4, 2023

Getting closer.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 31, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants