Skip to content

Commit

Permalink
br: add status field for log status with json (#58465)
Browse files Browse the repository at this point in the history
close #57959
  • Loading branch information
Leavrth authored Dec 23, 2024
1 parent 874e0a3 commit ef7ade7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions br/pkg/stream/stream_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ func (t *TaskStatus) colorfulStatusString() string {
return statusOK("NORMAL")
}

func (t *TaskStatus) statusString() string {
if t.paused && len(t.LastErrors) > 0 {
return "ERROR"
}
if t.paused {
return "PAUSE"
}
return "NORMAL"
}

// GetCheckpoint calculates the checkpoint of the task.
func (t TaskStatus) GetMinStoreCheckpoint() Checkpoint {
initialized := false
Expand Down Expand Up @@ -195,6 +205,7 @@ func (p *printByJSON) PrintTasks() {
Name string `json:"name"`
StartTS uint64 `json:"start_ts,omitempty"`
EndTS uint64 `json:"end_ts,omitempty"`
Status string `json:"status"`
TableFilter []string `json:"table_filter"`
Progress []storeProgress `json:"progress"`
Storage string `json:"storage"`
Expand Down Expand Up @@ -224,6 +235,7 @@ func (p *printByJSON) PrintTasks() {
Name: t.Info.GetName(),
StartTS: t.Info.GetStartTs(),
EndTS: t.Info.GetEndTs(),
Status: t.statusString(),
TableFilter: t.Info.GetTableFilter(),
Progress: sp,
Storage: s.String(),
Expand Down

0 comments on commit ef7ade7

Please sign in to comment.