Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

daemon: Daemon.stats: fill-in container ID and Name when collecting#51302

Merged
thaJeztah merged 2 commits into
moby:mastermoby/moby:masterfrom
thaJeztah:fix_one_shot_statsthaJeztah/docker:fix_one_shot_statsCopy head branch name to clipboard
Oct 27, 2025
Merged

daemon: Daemon.stats: fill-in container ID and Name when collecting#51302
thaJeztah merged 2 commits into
moby:mastermoby/moby:masterfrom
thaJeztah:fix_one_shot_statsthaJeztah/docker:fix_one_shot_statsCopy head branch name to clipboard

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Propagate these fields when collecting the data, instead of patching the result inside the router.

This also fixes a bug where the ID and Name fields were not set when using one-shot.

Before this patch, the "id" and "name" fields were not set in one-shot mode:

curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .id
"125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .name
"/foo"

curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
null
curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
null

With this patch, both are set:

curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
"125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
"/foo"

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

Fix a bug where collecting container stats in "one-shot" mode would not include the container's ID and Name.

- A picture of a cute animal (not mandatory but encouraged)

Propagate these fields when collecting the data, instead of patching the
result inside the router.

This also fixes a bug where the ID and Name fields were not set when using
one-shot.

Before this patch, the "id" and "name" fields were not set in one-shot mode:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .id
    "125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false' | jq .name
    "/foo"

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
    null
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
    null

With this patch, both are set:

    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .id
    "125d7f3df7919c33195fa4ec0636c27cdbe6d9b14339867d2920900565bcaf7e"
    curl -s --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/foo/stats?stream=false&one-shot=true' | jq .name
    "/foo"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah merged commit 6511d86 into moby:master Oct 27, 2025
285 of 288 checks passed
@thaJeztah
thaJeztah deleted the fix_one_shot_stats branch October 27, 2025 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.