From 691fb2623d2f6ff7029ce0528403d25f56fca4b9 Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Thu, 22 Oct 2020 15:06:16 -0700 Subject: [PATCH] MultiCluster Allocation: Cleanup on error logs (#1862) Just switching to .WithError() on the failure for multi cluster allocation, primarily to make it easier to use structured logs to catch this specific use case. Also fixed a typo. --- pkg/gameserverallocations/allocator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gameserverallocations/allocator.go b/pkg/gameserverallocations/allocator.go index 4958c89866..36b5c148a8 100644 --- a/pkg/gameserverallocations/allocator.go +++ b/pkg/gameserverallocations/allocator.go @@ -358,8 +358,8 @@ func (c *Allocator) allocateFromRemoteCluster(gsa *allocationv1.GameServerAlloca c.loggerForGameServerAllocationKey("remote-allocation").WithField("request", request).WithField("endpoint", endpoint).Debug("forwarding allocation request") allocationResponse, err = c.remoteAllocationCallback(ctx, endpoint, dialOpts, request) if err != nil { - c.baseLogger.Errorf("remote allocation failed with: %v", err) - // If there are multiple enpoints for the allocator connection and the current one is + c.baseLogger.WithError(err).Error("remote allocation failed with") + // If there are multiple endpoints for the allocator connection and the current one is // failing, try the next endpoint. Otherwise, return the error response. if (i + 1) < len(connectionInfo.AllocationEndpoints) { // If there is a server error try a different endpoint