Skip to content

Conversation

@xgoffin
Copy link
Contributor

@xgoffin xgoffin commented Nov 27, 2025

What does this PR do?

  • Sentry Reporter now has an array of funcs to check reported errors and build the level on Sentry based on these
  • Callers may create a Reporter with custom error checking funcs by adding to them or overwriting them

Fixes #

What are the observable changes?

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation
  • Properly labeled

Additional Notes


var (
defaultErrorLevelFuncs = []ErrorLevelFunc{
ErrorIsFunc(context.DeadlineExceeded, sentry.LevelWarning),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this hide some big errors ? Like deadlock or things like that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thankfully this doesn't hide them, simply marks them as severity "Warning", which will allow us to have 2 different boards (one for errors, one for warnings), which ought to filter a lot of the noise.
We'll still notice if we have 3000 warnings rise up all of a sudden 👀

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah ok nice :)

Copy link

@lordteka lordteka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvment, also nice effort on the doc/comment

}
}

// ErrorCauseTextContainsFunc an ErrorLevelFunc of the passed level that checks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a word here

Copy link

@karitham karitham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

}

// AppendErrorLevelFuncs adds the passed funcs to the ErrorLevelFuncs of the Reporter
func AppendErrorLevelFuncs(funcs []ErrorLevelFunc) Option {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func AppendErrorLevelFuncs(funcs []ErrorLevelFunc) Option {
func AppendErrorLevelFuncs(funcs ...ErrorLevelFunc) Option {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever man

Copy link

@karitham karitham Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX improvements through the roof.

You can do the replace one as well but I think that one is less important, and it makes sense there to pass nil to remove any filtering, wheras ReplaceErrorLevelFuncs() isn't really self-descriptive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, and I feel like it expects a "whole" array for replacement rather than a variadic
It most likely also won't be used much 😄

Copy link
Member

@AlexisMontagne AlexisMontagne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good!

}

ts := tags.GetTags(err)
errorTags := tags.GetTags(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: the repository is already named errors is the error part of errorTags really needed? could it simply be tags?

Same feedback for:

  • computeErrorLevel
  • errorLevelMappers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that tags is a symbol already (the import name for that package), and I really dislike it being called ts or t. Any other suggestion that does not make it illegible? 😓

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sends for errorTags, could you adjust the two others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, can do when I next get to work on this one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants