Transaction status incorrectly reports 500 (internal_error) instead of actual HTTP status code (eg. 404) when Rails handles exceptions
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Issue Description
When Rails handles an exception internally and converts it to a specific HTTP status code (e.g., ActiveRecord::RecordNotFound -> 404), the Sentry transaction is incorrectly reported with status internal_error and http.response.status_code: 500 instead of the actual HTTP response status code.
This creates inaccurate reports, as all Rails-rescued exceptions appear as 500 errors in Sentry, even though the client receives the correct HTTP status code (404, 422, etc.).
The breadcrumbs in the transaction correctly show the actual status code (404), but the transaction-level status and span-level status codes are incorrect (500).
Even though version 6.0.0+ includes trace_ignore_status_codes which by default excludes 404s from being traced, this is a workaround rather than a fix. The underlying issue of incorrect status code reporting remains for any status codes that are not ignored.
Reproduction Steps
- Configure a Rails application with
sentry-railsversion5.27.0 - Enable tracing with
config.traces_sample_rate = 1.0 - Create a route that raises
ActiveRecord::RecordNotFoundor similar exception that Rails rescues and converts to a 404 response - Make a request to that route
- Examine the transaction in Sentry
Expected Behavior
- Span status should be "not_found"
- Span
data.http.response.status_codeshould be 404
Actual Behavior
- Span status is "internal_error"
- Span
data.http.response.status_codeis 500
Ruby Version
Ruby 3.4.4
SDK Version
sentry-ruby: 5.27.0
Integration and Its Version
No response
Sentry Config
No response
- Vorherrschende Sprache
- Ruby
- Sterne
- 990
- Forks
- 552
- Ø Merge
- 2 T. 16 Std.
- Gemergte PRs (30 T.)
- 29
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus getsentry/sentry-ruby
-
Bug Ruby
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
getsentry/sentry-ruby#3211 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Events dropped client-side for size are only logged at debug level and not recorded as lostEvtl. vergeben @sentry-junior hat das heute übernommen. OffenBug Junior: repro Ruby
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
getsentry/sentry-ruby#3209 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 2 Tagen
-
with_child_span drops spans when blocks exit via break, return, or throwEvtl. vergeben @itsrayeedscodespace hat das vor 1 Tag übernommen. OffenBug Ruby Traces Waiting for: Product Owner
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 38/100
getsentry/sentry-ruby#3206 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Let apps choose how the client IP on events is determinedEvtl. vergeben @sl0thentr0py hat das vor 12 Tagen übernommen. OffenImprovement Ruby
getsentry/sentry-ruby#3180 · 2 Kommentare · 1 Reaktion · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
breaking change Next Major
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 58/100
getsentry/sentry-ruby#3176 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in getsentry/sentry-ruby
Ähnliche Issues
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
internetee/registry#2984 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
interest-zsv
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
hitobito/hitobito_zsv#6 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
ecosyste-ms/issues#862 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configuredEvtl. vergeben @mimosa hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
riscv/riscv-unified-db#2829 ·
Maintainer antworten meist innerhalb von 1 Tag