From d1998b19f0c2a32dbf0b96752a68e1390f435fcc Mon Sep 17 00:00:00 2001 From: Peter Argue <89119817+peterargue@users.noreply.github.com> Date: Wed, 3 Jan 2024 10:12:58 -0800 Subject: [PATCH] [Access] Log script exec mismatches as error --- engine/access/rpc/backend/script_comparer.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/engine/access/rpc/backend/script_comparer.go b/engine/access/rpc/backend/script_comparer.go index 4bd219c4c96..e7ec9f3c489 100644 --- a/engine/access/rpc/backend/script_comparer.go +++ b/engine/access/rpc/backend/script_comparer.go @@ -53,7 +53,7 @@ func (c *scriptResultComparison) compare(execResult, localResult *scriptResult) if isOutOfRangeError(localResult.err) { c.metrics.ScriptExecutionNotIndexed() c.logComparison(execResult, localResult, - "script execution results do not match EN because data is not indexed yet") + "script execution results do not match EN because data is not indexed yet", false) return false } @@ -66,7 +66,7 @@ func (c *scriptResultComparison) compare(execResult, localResult *scriptResult) c.metrics.ScriptExecutionErrorMismatch() c.logComparison(execResult, localResult, - "cadence errors from local execution do not match and EN") + "cadence errors from local execution do not match EN", true) return false } @@ -77,12 +77,12 @@ func (c *scriptResultComparison) compare(execResult, localResult *scriptResult) c.metrics.ScriptExecutionResultMismatch() c.logComparison(execResult, localResult, - "script execution results from local execution do not match EN") + "script execution results from local execution do not match EN", true) return false } // logScriptExecutionComparison logs the script execution comparison between local execution and execution node -func (c *scriptResultComparison) logComparison(execResult, localResult *scriptResult, msg string) { +func (c *scriptResultComparison) logComparison(execResult, localResult *scriptResult, msg string, useError bool) { args := make([]string, len(c.request.arguments)) for i, arg := range c.request.arguments { args[i] = string(arg) @@ -109,7 +109,11 @@ func (c *scriptResultComparison) logComparison(execResult, localResult *scriptRe lgCtx = lgCtx.Dur("local_duration_ms", localResult.duration) lg := lgCtx.Logger() - lg.Debug().Msg(msg) + if useError { + lg.Error().Msg(msg) + } else { + lg.Debug().Msg(msg) + } } func isOutOfRangeError(err error) bool {