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

Normalize the job queue latency's value #21355

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
7 changes: 6 additions & 1 deletion src/controller/jobmonitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,15 @@ func (w *monitorController) ListQueues(ctx context.Context) ([]*jm.Queue, error)
if skippedUnusedJobType(queue.JobName) {
continue
}
// normalize latency, it sometimes return -1
var latency int64
if queue.Latency > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pause this PR for further discussion.

Personally, I don't think changing the negative number to 0 is the right approach. The latency should always be positive, and a negative value typically indicates a misconfiguration, such as when the system time on the worker node running harbor-core and harbor-jobservice are not synchronized with the same time server.

Adjusting the value to 0 might mask the underlying issue for the administrator. I prefer that we add a debug log to help identify the potential cause of this situation.

latency = queue.Latency
}
result = append(result, &jm.Queue{
JobType: queue.JobName,
Count: queue.Count,
Latency: queue.Latency,
Latency: latency,
Paused: statusMap[queue.JobName],
})
}
Expand Down
Loading