Skip to content

Commit

Permalink
add status field for log status with json
Browse files Browse the repository at this point in the history
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
  • Loading branch information
Leavrth authored and ti-chi-bot committed Dec 27, 2024
1 parent 287f27e commit 3746645
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 @@ -97,6 +97,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 @@ -194,6 +204,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 @@ -223,6 +234,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 3746645

Please sign in to comment.