fn: LB agent: reduce 'Too Busy' error logs (#1033)

With this PR, runner client translates too busy errors
from gRPC session and runner itself into Fn error type.
Placers now ignore this error message to reduce unnecessary
logging.
This commit is contained in:
Tolga Ceylan
2018-06-04 12:16:00 -07:00
committed by GitHub
parent 7261ddedcc
commit 1cd5894f41
3 changed files with 8 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ func (r *gRPCRunner) Address() string {
return r.address return r.address
} }
func isRetriable(err error) bool { func isTooBusy(err error) bool {
// A formal API error returned from pure-runner // A formal API error returned from pure-runner
if models.GetAPIErrorCode(err) == models.GetAPIErrorCode(models.ErrCallTimeoutServerBusy) { if models.GetAPIErrorCode(err) == models.GetAPIErrorCode(models.ErrCallTimeoutServerBusy) {
return true return true
@@ -144,7 +144,11 @@ func (r *gRPCRunner) TryExec(ctx context.Context, call pool.RunnerCall) (bool, e
logrus.Infof("Engagement Context ended ctxErr=%v", ctx.Err()) logrus.Infof("Engagement Context ended ctxErr=%v", ctx.Err())
return true, ctx.Err() return true, ctx.Err()
case recvErr := <-recvDone: case recvErr := <-recvDone:
return !isRetriable(recvErr), recvErr if isTooBusy(recvErr) {
// Try on next runner
return false, models.ErrCallTimeoutServerBusy
}
return true, recvErr
} }
} }

View File

@@ -52,7 +52,7 @@ func (p *chPlacer) PlaceCall(rp RunnerPool, ctx context.Context, call RunnerCall
placed, err := r.TryExec(tryCtx, call) placed, err := r.TryExec(tryCtx, call)
tryCancel() tryCancel()
if err != nil { if err != nil && err != models.ErrCallTimeoutServerBusy {
logrus.WithError(err).Error("Failed during call placement") logrus.WithError(err).Error("Failed during call placement")
} }
if placed { if placed {

View File

@@ -46,7 +46,7 @@ func (sp *naivePlacer) PlaceCall(rp RunnerPool, ctx context.Context, call Runner
placed, err := r.TryExec(tryCtx, call) placed, err := r.TryExec(tryCtx, call)
tryCancel() tryCancel()
if err != nil { if err != nil && err != models.ErrCallTimeoutServerBusy {
logrus.WithError(err).Error("Failed during call placement") logrus.WithError(err).Error("Failed during call placement")
} }
if placed { if placed {