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

TSPS-345 Mute sentry alerts for HttpRequestMethodNotSupportedException #206

Conversation

mmorgantaylor
Copy link
Collaborator

Description

We get Sentry alerts often for seemingly spam/bot calls to existing paths with invalid methods (POST, PROPFIND). Similar to #89, we don't send these to Sentry but do log that we did so.

Jira Ticket

https://broadworkbench.atlassian.net/browse/TSPS-345

Checklist (provide links to changes)

  • Updated external documentation (if applicable)
  • Updated internal documentation (if applicable)
  • Planned non patch version bump (if applicable)
  • Updated CLI PR (if applicable)

@@ -41,7 +41,6 @@ public ResponseEntity<ApiErrorReport> errorReportHandler(ErrorReportException ex
// -- validation exceptions - we don't control the exception raised
@ExceptionHandler({
MethodArgumentTypeMismatchException.class,
HttpRequestMethodNotSupportedException.class,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this makes me a little nervous. we don't have any instances of this error in Sentry in dev in the last 30 days but this would be like a user doing something wrong, so not sure if this is going to mask something that the user is doing. but I think that it'll be ok - if that's the case, the user will still get the 4xx response and we can investigate logs if it's confusing to them

Copy link
Collaborator

Choose a reason for hiding this comment

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

how come we're removing this from here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

my understanding is if we keep it, those errors will always be caught by this rather than later on and we'll still get sentry alerts for it. unless we move the sentry filtering thing into this method, maybe that's the answer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah i misunderstood, you're totally right - will revert this

Copy link
Collaborator

@jsotobroad jsotobroad left a comment

Choose a reason for hiding this comment

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

😈

@@ -41,7 +41,6 @@ public ResponseEntity<ApiErrorReport> errorReportHandler(ErrorReportException ex
// -- validation exceptions - we don't control the exception raised
@ExceptionHandler({
MethodArgumentTypeMismatchException.class,
HttpRequestMethodNotSupportedException.class,
Copy link
Collaborator

Choose a reason for hiding this comment

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

how come we're removing this from here?

@@ -115,9 +114,11 @@ private ResponseEntity<ApiErrorReport> buildApiErrorReport(
@Nullable String messageForApiErrorReport) {
// logging 4** & 5** errors to sentry
if (statusCode.is5xxServerError() || statusCode.is4xxClientError()) {
if (ex.getClass() == NoResourceFoundException.class) {
if (ex instanceof NoResourceFoundException
|| ex instanceof HttpRequestMethodNotSupportedException) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we want we can still send this error to sentry and just change sentry to not alert on it ever (or not as often) if we're worried about not seeing errors

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

seems we should pick one place to ignore sentry errors, either here or in sentry, but not both.

Copy link
Collaborator

@jsotobroad jsotobroad left a comment

Choose a reason for hiding this comment

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

chatted in person

@mmorgantaylor mmorgantaylor merged commit da55ad1 into main Feb 26, 2025
15 checks passed
@mmorgantaylor mmorgantaylor deleted the TSPS-345_mute_sentry_for_HttpRequestMethodNotSupportedException branch February 26, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants