Merge pull request #16228 from duglin/ContextualizeEvents

Add context.RequestID to event stream
This commit is contained in:
David Calavera 2015-09-24 14:16:22 -07:00
commit c0bd79f3f8

View file

@ -92,6 +92,7 @@ func (p *JSONProgress) String() string {
// the created time, where it from, status, ID of the // the created time, where it from, status, ID of the
// message. It's used for docker events. // message. It's used for docker events.
type JSONMessage struct { type JSONMessage struct {
RequestID string `json:"reqid,omitempty"`
Stream string `json:"stream,omitempty"` Stream string `json:"stream,omitempty"`
Status string `json:"status,omitempty"` Status string `json:"status,omitempty"`
Progress *JSONProgress `json:"progressDetail,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"`
@ -127,6 +128,9 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
} else if jm.Time != 0 { } else if jm.Time != 0 {
fmt.Fprintf(out, "%s ", time.Unix(jm.Time, 0).Format(timeutils.RFC3339NanoFixed)) fmt.Fprintf(out, "%s ", time.Unix(jm.Time, 0).Format(timeutils.RFC3339NanoFixed))
} }
if jm.RequestID != "" {
fmt.Fprintf(out, "[reqid: %s] ", jm.RequestID)
}
if jm.ID != "" { if jm.ID != "" {
fmt.Fprintf(out, "%s: ", jm.ID) fmt.Fprintf(out, "%s: ", jm.ID)
} }