Don't tag processes with stopped container ids.

This commit is contained in:
Tom Wilkie
2015-11-13 11:16:09 +00:00
committed by Paul Bellamy
parent 310b2c8d07
commit 23be0d9aa9
2 changed files with 12 additions and 9 deletions

View File

@@ -84,6 +84,7 @@ type Container interface {
PID() int
Hostname() string
GetNode(string, []net.IP) report.Node
State() string
StartGatheringStats() error
StopGatheringStats()
@@ -131,6 +132,15 @@ func (c *container) Hostname() string {
c.container.Config.Domainname)
}
func (c *container) State() string {
if c.container.State.Paused {
return StatePaused
} else if c.container.State.Running {
return StateRunning
}
return StateStopped
}
func (c *container) StartGatheringStats() error {
c.Lock()
defer c.Unlock()
@@ -297,14 +307,7 @@ func (c *container) GetNode(hostID string, localAddrs []net.IP) report.Node {
ipsWithScopes = append(ipsWithScopes, report.MakeScopedAddressNodeID(hostID, ip))
}
var state string
if c.container.State.Paused {
state = StatePaused
} else if c.container.State.Running {
state = StateRunning
} else {
state = StateStopped
}
state := c.State()
result := report.MakeNodeWith(map[string]string{
ContainerID: c.ID(),

View File

@@ -78,7 +78,7 @@ func (t *Tagger) tag(tree process.Tree, topology *report.Topology) {
}
})
if c == nil {
if c == nil || c.State() == StateStopped || c.PID() == 1 {
continue
}