Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Access] Log script exec mismatches as error #5194

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions engine/access/rpc/backend/script_comparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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)
Expand All @@ -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 {
Expand Down
Loading