Skip to content

Commit

Permalink
feat(BRIDGE-204): removed unneccessary noisy sentry events
Browse files Browse the repository at this point in the history
- Failed to parse IMAP command
- Failed to create mailbox
- Failed to delete mailbox
- Failed to copy messages
- Failed to move messages from mailbox
- Failed to remove deleted messages
- Failed to commit database transaction
- Failed to insert message into recovery mailbox (not enough space)
  • Loading branch information
ElectroNafta committed Sep 23, 2024
1 parent 79cdd0f commit e319bf6
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 53 deletions.
4 changes: 0 additions & 4 deletions internal/backend/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ func newUser(

if err := user.deleteAllMessagesMarkedDeleted(ctx); err != nil {
log.WithError(err).Error("Failed to remove deleted messages")
reporter.MessageWithContext(ctx,
"Failed to remove deleted messages",
reporter.Context{"error": err},
)
}

if err := user.cleanupStaleStoreData(ctx); err != nil {
Expand Down
9 changes: 0 additions & 9 deletions internal/db_impl/sqlite3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/ProtonMail/gluon/db"
"github.com/ProtonMail/gluon/imap"
"github.com/ProtonMail/gluon/internal/db_impl/sqlite3/utils"
gluon_utils "github.com/ProtonMail/gluon/internal/utils"
"github.com/ProtonMail/gluon/reporter"
"github.com/google/uuid"
_ "github.com/mattn/go-sqlite3"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -193,13 +191,6 @@ func (c *Client) wrapTx(ctx context.Context, op func(context.Context, *sql.Tx, *
}

if err := tx.Commit(); err != nil {
if !errors.Is(err, context.Canceled) {
reporter.MessageWithContext(ctx,
"Failed to commit database transaction",
reporter.Context{"error": err, "type": gluon_utils.ErrCause(err)},
)
}

if c.debug {
entry.Debugf("Failed to commit Transaction")
}
Expand Down
6 changes: 0 additions & 6 deletions internal/session/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ProtonMail/gluon/imap/command"
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/logging"
"github.com/ProtonMail/gluon/reporter"
"github.com/ProtonMail/gluon/rfcparser"
)

Expand Down Expand Up @@ -63,11 +62,6 @@ func (s *Session) startCommandReader(ctx context.Context) <-chan commandResult {
}

s.log.WithError(err).WithField("type", parser.LastParsedCommand()).Error("Failed to parse IMAP command")

reporter.MessageWithContext(ctx,
"Failed to parse IMAP command",
reporter.Context{"error": err, "cmd": parser.LastParsedCommand()},
)
} else {
s.log.Debug(cmd.SanitizedString())
}
Expand Down
8 changes: 0 additions & 8 deletions internal/session/handle_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/internal/state"
"github.com/ProtonMail/gluon/profiling"
"github.com/ProtonMail/gluon/reporter"
)

func (s *Session) handleCopy(ctx context.Context, tag string, cmd *command.Copy, mailbox *state.Mailbox, ch chan response.Response) (response.Response, error) {
Expand Down Expand Up @@ -38,13 +37,6 @@ func (s *Session) handleCopy(ctx context.Context, tag string, cmd *command.Copy,
} else if errors.Is(err, state.ErrNoSuchMailbox) {
return response.No(tag).WithError(err).WithItems(response.ItemTryCreate()), nil
} else if err != nil {
if shouldReportIMAPCommandError(err) {
reporter.MessageWithContext(ctx,
"Failed to copy messages",
reporter.Context{"error": err, "mailbox_to": nameUTF8, "mailbox_from": mailbox.Name()},
)
}

return nil, err
}

Expand Down
8 changes: 0 additions & 8 deletions internal/session/handle_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/ProtonMail/gluon/imap/command"
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/profiling"
"github.com/ProtonMail/gluon/reporter"
)

func (s *Session) handleCreate(ctx context.Context, tag string, cmd *command.Create, ch chan response.Response) error {
Expand All @@ -25,13 +24,6 @@ func (s *Session) handleCreate(ctx context.Context, tag string, cmd *command.Cre
}

if err := s.state.Create(ctx, nameUTF8); err != nil {
if shouldReportIMAPCommandError(err) {
reporter.MessageWithContext(ctx,
"Failed to create mailbox",
reporter.Context{"error": err, "mailbox": nameUTF8},
)
}

return err
}

Expand Down
8 changes: 0 additions & 8 deletions internal/session/handle_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/ProtonMail/gluon/imap/command"
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/profiling"
"github.com/ProtonMail/gluon/reporter"
)

func (s *Session) handleDelete(ctx context.Context, tag string, cmd *command.Delete, ch chan response.Response) error {
Expand All @@ -26,13 +25,6 @@ func (s *Session) handleDelete(ctx context.Context, tag string, cmd *command.Del

selectedDeleted, err := s.state.Delete(ctx, nameUTF8)
if err != nil {
if shouldReportIMAPCommandError(err) {
reporter.MessageWithContext(ctx,
"Failed to delete mailbox",
reporter.Context{"error": err, "mailbox": nameUTF8},
)
}

return err
}

Expand Down
8 changes: 0 additions & 8 deletions internal/session/handle_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/internal/state"
"github.com/ProtonMail/gluon/profiling"
"github.com/ProtonMail/gluon/reporter"
)

func (s *Session) handleMove(ctx context.Context, tag string, cmd *command.Move, mailbox *state.Mailbox, ch chan response.Response) (response.Response, error) {
Expand All @@ -36,13 +35,6 @@ func (s *Session) handleMove(ctx context.Context, tag string, cmd *command.Move,
} else if errors.Is(err, state.ErrNoSuchMailbox) {
return response.No(tag).WithError(err).WithItems(response.ItemTryCreate()), nil
} else if err != nil {
if shouldReportIMAPCommandError(err) {
reporter.MessageWithContext(ctx,
"Failed to move messages from mailbox",
reporter.Context{"error": err, "mailbox_to": nameUTF8, "mailbox_from": mailbox.Name()},
)
}

return nil, err
}

Expand Down
2 changes: 0 additions & 2 deletions internal/state/mailbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ProtonMail/gluon/imap/command"
"github.com/ProtonMail/gluon/internal/ids"
"github.com/ProtonMail/gluon/internal/response"
"github.com/ProtonMail/gluon/reporter"
"github.com/ProtonMail/gluon/rfc822"
"github.com/bradenaw/juniper/xslices"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -251,7 +250,6 @@ func (m *Mailbox) Append(ctx context.Context, literal []byte, flags imap.FlagSet
})
if recoverErr != nil && !knownMessage {
m.log.WithError(recoverErr).Error("Failed to insert message into recovery mailbox")
reporter.ExceptionWithContext(ctx, "Failed to insert message into recovery mailbox", reporter.Context{"error": recoverErr})
}

if knownMessage {
Expand Down

0 comments on commit e319bf6

Please sign in to comment.