Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br: add status field for log status with json (#58465) #58567

Open
wants to merge 1 commit into
base: release-6.5
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
return statusOK("NORMAL")
}

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

Check warning on line 107 in br/pkg/stream/stream_status.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/stream/stream_status.go#L100-L107

Added lines #L100 - L107 were not covered by tests
}

// GetCheckpoint calculates the checkpoint of the task.
func (t TaskStatus) GetMinStoreCheckpoint() Checkpoint {
initialized := false
Expand Down Expand Up @@ -194,6 +204,7 @@
Name string `json:"name"`
StartTS uint64 `json:"start_ts,omitempty"`
EndTS uint64 `json:"end_ts,omitempty"`
Status string `json:"status"`

Check warning on line 207 in br/pkg/stream/stream_status.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/stream/stream_status.go#L207

Added line #L207 was not covered by tests
TableFilter []string `json:"table_filter"`
Progress []storeProgress `json:"progress"`
Storage string `json:"storage"`
Expand Down Expand Up @@ -223,6 +234,7 @@
Name: t.Info.GetName(),
StartTS: t.Info.GetStartTs(),
EndTS: t.Info.GetEndTs(),
Status: t.statusString(),

Check warning on line 237 in br/pkg/stream/stream_status.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/stream/stream_status.go#L237

Added line #L237 was not covered by tests
TableFilter: t.Info.GetTableFilter(),
Progress: sp,
Storage: s.String(),
Expand Down
Loading