Disable storage of errors (#3066)

This is a temporary mitigation for the issue described in #3065.

The intent is to merge this, cut a 4.6.1 release, and then come up with
a more comprehensive solution for 4.7.0.
This commit is contained in:
Zach Wasserman 2021-11-21 21:02:20 -08:00 committed by GitHub
parent 0cca889dd3
commit e04f210f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -52,6 +52,13 @@ func NewHandler(ctx context.Context, pool fleet.RedisPool, logger kitlog.Logger,
ttl: ttl,
}
runHandler(ctx, eh)
// Clear out any records that exist.
// Temporary mitigation for #3065.
if _, err := eh.Flush(); err != nil {
level.Error(eh.logger).Log("err", err, "msg", "failed to flush redis errors")
}
return eh
}
@ -217,6 +224,12 @@ func (h *Handler) handleErrors(ctx context.Context) {
}
func (h *Handler) storeError(ctx context.Context, err error) {
// Skip storing errors due to SCAN issues with Redis (see #3065).
// if true here because otherwise we get linting errors for unreachable code.
if true {
return
}
errorHash, errorJson, err := hashAndMarshalError(err)
if err != nil {
level.Error(h.logger).Log("err", err, "msg", "hashErr failed")

View File

@ -152,6 +152,9 @@ func TestUnwrapAll(t *testing.T) {
}
func TestErrorHandler(t *testing.T) {
// Skipped until error publishing is re-enabled.
t.Skip()
t.Run("works if the error handler is down", func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel() // cancel immediately
@ -288,7 +291,6 @@ func testErrorHandlerCollectsDifferentErrors(t *testing.T, pool fleet.RedisPool,
"errorstore\.alwaysNewErrorTwo:%[1]s/errors_test\.go:\d+"
\]
\}`, wd)), jsonErr)
} else {
assert.Regexp(t, regexp.MustCompile(fmt.Sprintf(`\{
"root": \{
@ -301,10 +303,12 @@ func testErrorHandlerCollectsDifferentErrors(t *testing.T, pool fleet.RedisPool,
\}`, wd)), jsonErr)
}
}
}
func TestHttpHandler(t *testing.T) {
// Skipped until error publishing is re-enabled.
t.Skip()
pool := redistest.SetupRedis(t, false, false, false)
ctx, cancelFunc := context.WithCancel(context.Background())
defer cancelFunc()