Skip to content

Commit 8789be6

Browse files
authored
Reduce log severity for searchcache cache misses (#4545)
The searchcache service returns a 422 Unprocessable Entity status when one or more requested test runs are not in its in-memory index. This is a cache-miss scenario, not a critical error. This change reduces the log severity for these specific 422 responses from ERROR to WARNING to avoid unnecessary noise in the error logs.
1 parent 1eb13f5 commit 8789be6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/query/search.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ func (sh structuredSearchHandler) useSearchcache(_ http.ResponseWriter, r *http.
196196
msg = fmt.Sprintf("%s: %s", msg, string(errBody))
197197
resp.Body = io.NopCloser(bytes.NewBuffer(errBody))
198198
}
199-
logger.Errorf(msg)
199+
if resp.StatusCode == http.StatusUnprocessableEntity {
200+
logger.Warningf(msg)
201+
} else {
202+
logger.Errorf(msg)
203+
}
200204
}
201205

202206
return resp, nil

0 commit comments

Comments
 (0)