mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 10:00:13 +00:00
probe: translate CRI container state
Use values consistent with what we use for Docker. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
@@ -56,11 +56,23 @@ func (r *Reporter) containerTopology() (report.Topology, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func containerStateString(s client.ContainerState) string {
|
||||
switch s {
|
||||
case client.ContainerState_CONTAINER_CREATED:
|
||||
return report.StateCreated
|
||||
case client.ContainerState_CONTAINER_RUNNING:
|
||||
return report.StateRunning
|
||||
case client.ContainerState_CONTAINER_EXITED:
|
||||
return report.StateExited
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func getNode(c *client.Container) report.Node {
|
||||
result := report.MakeNodeWith(report.MakeContainerNodeID(c.Id), map[string]string{
|
||||
docker.ContainerName: c.Metadata.Name,
|
||||
docker.ContainerID: c.Id,
|
||||
docker.ContainerState: fmt.Sprintf("%v", c.State),
|
||||
docker.ContainerState: containerStateString(c.State),
|
||||
docker.ContainerRestartCount: fmt.Sprintf("%v", c.Metadata.Attempt),
|
||||
docker.ImageID: c.ImageRef,
|
||||
docker.ImageName: c.Image.Image,
|
||||
|
||||
Reference in New Issue
Block a user