From f84be211d76aced3aae239b1da4f1e02980a4704 Mon Sep 17 00:00:00 2001 From: Rodrigo Zhou Date: Thu, 29 Sep 2022 12:42:22 -0700 Subject: [PATCH] Log warning only when there is an error in SA size validation (#3443) Log error only when there is an error in SA size validation --- service/history/commandChecker.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/service/history/commandChecker.go b/service/history/commandChecker.go index 552e225a1da..e8532d77633 100644 --- a/service/history/commandChecker.go +++ b/service/history/commandChecker.go @@ -176,11 +176,18 @@ func (c *workflowSizeChecker) checkIfSearchAttributesSizeExceedsLimit( namespace namespace.Name, commandTypeTag metrics.Tag, ) error { - c.metricsScope.Tagged(commandTypeTag).RecordDistribution(metrics.SearchAttributesSize, searchAttributes.Size()) - + c.metricsScope.Tagged(commandTypeTag).RecordDistribution( + metrics.SearchAttributesSize, + searchAttributes.Size(), + ) err := c.searchAttributesValidator.ValidateSize(searchAttributes, namespace.String()) - c.logger.Warn("Search attributes size exceeds limits. Fail workflow.", tag.Error(err), tag.WorkflowNamespace(namespace.String())) - + if err != nil { + c.logger.Warn( + "Search attributes size exceeds limits. Fail workflow.", + tag.Error(err), + tag.WorkflowNamespace(namespace.String()), + ) + } return err }