| 188 | } |
| 189 | |
| 190 | func (c *monitor) getContainerSummary(event events.Message) (*api.ContainerSummary, error) { |
| 191 | ctr := &api.ContainerSummary{ |
| 192 | ID: event.Actor.ID, |
| 193 | Name: event.Actor.Attributes["name"], |
| 194 | Project: c.project, |
| 195 | Service: event.Actor.Attributes[api.ServiceLabel], |
| 196 | Labels: event.Actor.Attributes, // More than just labels, but that'c the closest the API gives us |
| 197 | } |
| 198 | if ec, ok := event.Actor.Attributes["exitCode"]; ok { |
| 199 | exitCode, err := strconv.Atoi(ec) |
| 200 | if err != nil { |
| 201 | return nil, err |
| 202 | } |
| 203 | ctr.ExitCode = exitCode |
| 204 | } |
| 205 | return ctr, nil |
| 206 | } |
| 207 | |
| 208 | func (c *monitor) withListener(listener api.ContainerEventListener) { |
| 209 | c.listeners = append(c.listeners, listener) |