Merge pull request #16228 from duglin/ContextualizeEvents
Add context.RequestID to event stream
This commit is contained in:
commit
c0bd79f3f8
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue