-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add GetPodStats to varlink #1319
Conversation
pod, err := i.Runtime.LookupPod(name) | ||
if err != nil { | ||
return call.ReplyPodNotFound(name) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be vetting that the container is running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently GetContainerStats doesn't. If you think it should, both should be updated. WDYT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the container isn't running it just returns all 0s. I'm thinking filtering on running is probably best for both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
bot, retest this please |
1 similar comment
bot, retest this please |
Signed-off-by: haircommander <pehunt@redhat.com>
8f6eb84
to
9792eb7
Compare
cmd/podman/varlink/io.podman.varlink
Outdated
@@ -441,7 +441,7 @@ method ExportContainer(name: string, path: string) -> (tarfile: string) | |||
|
|||
# GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which | |||
# contains attributes like memory and cpu usage. If the container cannot be found, a | |||
# [ContainerNotFound](#ContainerNotFound) error will be returned. | |||
# [ContainerNotFound](#ContainerNotFound) error will be returned. If the container is not running, an error will be returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to document which error was returned if container is not running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
a1ea209
to
0e4b75a
Compare
This results in some functionality changes: If a ErrCtrStateInvalid is returned to GetPodStats, the container is ommitted from the stats. As such, if an empty slice of Container stats are returned to GetPodStats in varlink, an error will occur. GetContainerStats will return the ErrCtrStateInvalid as well. Finally, if ErrCtrStateInvalid is returned to the podman stats call, the container will be ommitted from the stats. Signed-off-by: haircommander <pehunt@redhat.com>
0e4b75a
to
b7a9bf4
Compare
Happy tests and comments addressed. @mheon @baude @TomSweeneyRedHat @jwhonce @rhatdan @umohnani8 PTAL :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
📌 Commit b7a9bf4 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit b7a9bf4 has been approved by |
This results in some functionality changes: If a ErrCtrStateInvalid is returned to GetPodStats, the container is ommitted from the stats. As such, if an empty slice of Container stats are returned to GetPodStats in varlink, an error will occur. GetContainerStats will return the ErrCtrStateInvalid as well. Finally, if ErrCtrStateInvalid is returned to the podman stats call, the container will be ommitted from the stats. Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1319 Approved by: baude
☀️ Test successful - status-papr |
Signed-off-by: haircommander pehunt@redhat.com