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

Stats response has "Id" field instead of "id" #17869

Closed
kierendavies opened this issue Mar 21, 2023 · 0 comments · Fixed by #17890
Closed

Stats response has "Id" field instead of "id" #17869

kierendavies opened this issue Mar 21, 2023 · 0 comments · Fixed by #17890
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.

Comments

@kierendavies
Copy link

Issue Description

The stats API JSON response is inconsistent with Docker, because it incorrectly capitalises the "id" field. I discovered this when using the Rust crate Bollard, which reported that the "id" field was missing.

Steps to reproduce the issue

curl  --unix-socket /var/run/docker.sock "http://d/containers/$SOME_CONTAINER_ID/stats"
# {...,"id":"...",...}
curl --unix-socket /run/user/1000/podman/podman.sock "http://d/containers/$SOME_CONTAINER_ID/stats"
# {...,"Id":"...",...}

Describe the results you received

JSON response contains "Id" field, but no "id".

Describe the results you expected

JSON response should contain "id" field.

podman info output

host:
  arch: amd64
  buildahVersion: 1.29.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.1.7-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: f633919178f6c8ee4fb41b848a056ec33f8d707d'
  cpuUtilization:
    idlePercent: 79.35
    systemPercent: 5.16
    userPercent: 15.48
  cpus: 8
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: REDACTED
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.2.6-arch1-1
  linkmode: dynamic
  logDriver: journald
  memFree: 813850624
  memTotal: 24844115968
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.8.1-1
    path: /usr/bin/crun
    version: |-
      crun version 1.8.1
      commit: f8a096be060b22ccd3d5f3ebe44108517fbf6c30
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.2.0-1
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.4
  swapFree: 34215489536
  swapTotal: 34359734272
  uptime: 140h 28m 48.00s (Approximately 5.83 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/REDACTED/.config/containers/storage.conf
  containerStore:
    number: 8
    paused: 0
    running: 8
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/REDACTED/.local/share/containers/storage
  graphRootAllocated: 476673212416
  graphRootUsed: 276004855808
  graphStatus:
    Backing Filesystem: f2fs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 202
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/REDACTED/.local/share/containers/storage/volumes
version:
  APIVersion: 4.4.2
  Built: 1677255177
  BuiltTime: Fri Feb 24 17:12:57 2023
  GitCommit: 74afe26887f814d1c39925a1624851ef3590e79c-dirty
  GoVersion: go1.20.1
  Os: linux
  OsArch: linux/amd64
  Version: 4.4.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@kierendavies kierendavies added the kind/bug Categorizes issue or PR as related to a bug. label Mar 21, 2023
kierendavies added a commit to kierendavies/podman that referenced this issue Mar 21, 2023
Fixes containers#17869

[NO NEW TESTS NEEDED]

Signed-off-by: Kieren Davies <[email protected]>
Luap99 added a commit to Luap99/libpod that referenced this issue Mar 22, 2023
We use the same endpoint for libpod and docker compat API. However as
reported docker returns "id" lowercase. Because we cannot break the
libpod API right now keep the output for the libpod endpoint and only
change the docker one.

To do so simply use two types that we can cast with different JSON tags.

Fixes containers#17869

Signed-off-by: Paul Holzinger <[email protected]>
@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 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 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.
Projects
None yet
1 participant