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

coordinator: add the operator cost time in log field #1748

Merged
merged 2 commits into from
Sep 11, 2019
Merged
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
8 changes: 4 additions & 4 deletions server/schedule/operator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (oc *OperatorController) Dispatch(region *core.RegionInfo, source string) {
changes > uint64(op.ConfVerChanged(region)) {

if oc.RemoveOperator(op) {
log.Info("stale operator", zap.Uint64("region-id", region.GetID()),
log.Info("stale operator", zap.Uint64("region-id", region.GetID()), zap.Duration("takes", op.RunningTime()),
zap.Reflect("operator", op), zap.Uint64("diff", changes))
operatorCounter.WithLabelValues(op.Desc(), "stale").Inc()
oc.opRecords.Put(op, pdpb.OperatorStatus_CANCEL)
Expand All @@ -123,14 +123,14 @@ func (oc *OperatorController) Dispatch(region *core.RegionInfo, source string) {
return
}
if op.IsFinish() && oc.RemoveOperator(op) {
log.Info("operator finish", zap.Uint64("region-id", region.GetID()), zap.Reflect("operator", op))
log.Info("operator finish", zap.Uint64("region-id", region.GetID()), zap.Duration("takes", op.RunningTime()), zap.Reflect("operator", op))
operatorCounter.WithLabelValues(op.Desc(), "finish").Inc()
operatorDuration.WithLabelValues(op.Desc()).Observe(op.RunningTime().Seconds())
oc.pushHistory(op)
oc.opRecords.Put(op, pdpb.OperatorStatus_SUCCESS)
oc.PromoteWaitingOperator()
} else if timeout && oc.RemoveOperator(op) {
log.Info("operator timeout", zap.Uint64("region-id", region.GetID()), zap.Reflect("operator", op))
log.Info("operator timeout", zap.Uint64("region-id", region.GetID()), zap.Duration("takes", op.RunningTime()), zap.Reflect("operator", op))
operatorCounter.WithLabelValues(op.Desc(), "timeout").Inc()
oc.opRecords.Put(op, pdpb.OperatorStatus_TIMEOUT)
oc.PromoteWaitingOperator()
Expand Down Expand Up @@ -319,7 +319,7 @@ func (oc *OperatorController) addOperatorLocked(op *operator.Operator) bool {
// already.
if old, ok := oc.operators[regionID]; ok {
_ = oc.removeOperatorLocked(old)
log.Info("replace old operator", zap.Uint64("region-id", regionID), zap.Reflect("operator", old))
log.Info("replace old operator", zap.Uint64("region-id", regionID), zap.Duration("takes", old.RunningTime()), zap.Reflect("operator", old))
operatorCounter.WithLabelValues(old.Desc(), "replace").Inc()
oc.opRecords.Put(old, pdpb.OperatorStatus_REPLACE)
}
Expand Down