Merge pull request #1729 from ipfs-cluster/fix/pins-error-negative
Fix: operationtracker metrics go negative
This commit is contained in:
commit
d2cbd8f910
|
@ -89,7 +89,6 @@ func newOperation(ctx context.Context, pin api.Pin, typ OperationType, ph Phase,
|
|||
ts: time.Now(),
|
||||
error: "",
|
||||
}
|
||||
tracker.recordMetricUnsafe(op, 1)
|
||||
return op
|
||||
}
|
||||
|
||||
|
@ -126,7 +125,6 @@ func (op *Operation) Context() context.Context {
|
|||
func (op *Operation) Cancel() {
|
||||
_, span := trace.StartSpan(op.ctx, "optracker/Cancel")
|
||||
op.cancel()
|
||||
op.tracker.recordMetric(op, -1)
|
||||
span.End()
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ func (opt *OperationTracker) TrackNewOperation(ctx context.Context, pin api.Pin,
|
|||
}
|
||||
// i.e. operations in error phase
|
||||
// i.e. pin operations that need to be canceled for unpinning
|
||||
op.tracker.recordMetric(op, -1)
|
||||
op.Cancel() // cancel ongoing operation and replace it
|
||||
}
|
||||
|
||||
|
@ -102,6 +103,7 @@ func (opt *OperationTracker) TrackNewOperation(ctx context.Context, pin api.Pin,
|
|||
}
|
||||
logger.Debugf("'%s' on cid '%s' has been created with phase '%s'", typ, pin.Cid, ph)
|
||||
opt.operations[pin.Cid] = op2
|
||||
opt.recordMetricUnsafe(op2, 1)
|
||||
return op2
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user