Group Faraday errors in Sentry by host - #1034
Merged
Merged
Conversation
Test coverage93.7% line coverage reported by SimpleCov. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The integration task still uses Faraday directly, bypassing host recording and Sentry grouping.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Adds host-aware Sentry grouping for Faraday errors through a shared HTTP client and middleware.
Changes:
- Records request hosts on Faraday exceptions.
- Fingerprints errors by exception class and host.
- Migrates API clients and adds coverage.
| File | Summary | Review |
|---|---|---|
spec/lib/record_request_host_in_errors_spec.rb |
Tests host recording. | Reviewed |
spec/configuration/sentry_config_spec.rb |
Tests Sentry grouping. | Reviewed |
lib/user_info_api_client.rb |
Uses shared client. | Reviewed |
lib/scratch_config_importer.rb |
Uses shared client. | Reviewed |
lib/scratch_asset_importer.rb |
Uses shared client. | Reviewed |
lib/record_request_host_in_errors.rb |
Records hosts on errors. | Reviewed |
lib/profile_api_client.rb |
Uses shared client. | Reviewed |
lib/hydra_public_api_client.rb |
Uses shared client. | Reviewed |
lib/http_client.rb |
Provides shared Faraday client. | Moderate: remaining integration-test client bypasses this wrapper. |
config/initializers/sentry.rb |
Configures host-based fingerprints. | Moderate: integration-task failures bypass host-aware grouping. |
app/services/subscriptions/turnstile_verifier.rb |
Uses shared client. | Reviewed |
app/services/subscriptions/pardot_form_handler_submitter.rb |
Uses shared client. | Reviewed |
app/controllers/api/google_auth_controller.rb |
Uses shared client. | Reviewed |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
raspberrypiherokubot
temporarily deployed
to
editor-api-p-group-fara-urktqj
September 24, 2026 08:35
Inactive
A large proportion of the errors we get in Sentry are connection related errors from Faraday - two thirds of errors in the last 14 days. Currently Sentry tends to group them by controller error/action. This leads to many groups as there are certain APIs (profile and userinfo) that we use from many different controller actions. This makes it hard to see what APIs are having problems, and to set any ignore limits to allow for some failed requests for a given API. This change creates a Sentry middleware that records the host in the error since not all sentry errors had the host accessible. To make sure we use the middleware everywhere I've made a custom faraday client (HttpClient) and replaced our uses of faraday with that. See sentry fingerprinting docs for more: https://docs.sentry.io/platforms/ruby/usage/sdk-fingerprinting/ Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
zetter-rpf
force-pushed
the
group-faraday-sentry-errors
branch
from
September 24, 2026 09:10
cc90535 to
12bf7e1
Compare
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What's changed?
A large proportion of the errors we get in Sentry are HTTP related errors from Faraday - two thirds of errors in the last 14 days.
Currently Sentry tends to group them by controller error/action. This leads to many groups as there are certain APIs (profile and userinfo) that we use from many different controller actions. This makes it hard to see what APIs are having problems, and to set any ignore limits to allow for some failed requests for a given API.
This change creates a Sentry middleware that records the host in the error since not all sentry errors had the host accessible. To make sure we use the middleware everywhere I've made a custom faraday client (HttpClient) and replaced our uses of faraday with that.
See sentry fingerprinting docs for more.