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 }