Skip to content

AO3-6910 Report Elasticsearch syntax errors to Sentry - #5976

Open
pmonfort wants to merge 3 commits into
otwcode:masterfrom
pmonfort:AO3-6910
Open

AO3-6910 Report Elasticsearch syntax errors to Sentry#5976
pmonfort wants to merge 3 commits into
otwcode:masterfrom
pmonfort:AO3-6910

Conversation

@pmonfort

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6910

Purpose

When an Elasticsearch BadRequest error occurs (e.g. from a search syntax error), the exception is rescued and a user-facing banner is shown, but nothing is reported to Sentry. This makes it difficult to debug what caused the error.

This PR adds Sentry.capture_exception calls in the two places where Elastic::Transport::Transport::Errors::BadRequest is rescued:

  • Query#search the main search path (works, bookmarks, tags, etc.)
  • AutocompleteController#noncanonical_tag noncanonical tag autocomplete

Both use if defined?(Sentry) since the Sentry gems are only loaded in staging/production.

Testing Instructions

  1. Go to https://archiveofourown.org/works?work_search[sort_column]=null&work_search[other_tag_names]=null&work_search[excluded_tag_names]=null&work_search[crossover]=null&work_search[complete]=null&work_search[words_from]=null&work_search[words_to]=null&work_search[date_from]=null&work_search[date_to]=null&work_search[query]=null&work_search[language_id]=null&commit=Sort%20and%20Filter&tag_id=Older%20Man*s*Younger%20Woman&page=2
  2. Verify the user still sees the syntax error banner
  3. Ask a Systems or Senior AD&T member to check Sentry for the new Elassport::Errors::BadRequest issue

Credit

Pablo Monfort (he/him)

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.

1 participant