Transaction status incorrectly reports 500 (internal_error) instead of actual HTTP status code (eg. 404) when Rails handles exceptions
メンテナーはふだん 2 日以内に返信
評価
この issue はまだ評価されていません。
説明
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
- 主要言語
- Ruby
- スター
- 990
- フォーク
- 552
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 29
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-ruby のほかの issue
-
Bug Ruby
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-ruby#3211 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Events dropped client-side for size are only logged at debug level and not recorded as lost対応中かも @sentry-junior が今日担当しました。 オープンBug Junior: repro Ruby
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-ruby#3209 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
with_child_span drops spans when blocks exit via break, return, or throw対応中かも @itsrayeedscodespace が 1 日前に担当しました。 オープンBug Ruby Traces Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
getsentry/sentry-ruby#3206 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Let apps choose how the client IP on events is determined対応中かも @sl0thentr0py が 12 日前に担当しました。 オープンImprovement Ruby
getsentry/sentry-ruby#3180 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
breaking change Next Major
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
getsentry/sentry-ruby#3176 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
getsentry/sentry-ruby の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
internetee/registry#2984 ·
メンテナーはふだん 6 日以内に返信
-
interest-zsv
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
hitobito/hitobito_zsv#6 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ecosyste-ms/issues#862 ·
メンテナーはふだん 1 日以内に返信
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configured対応中かも @mimosa が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
riscv/riscv-unified-db#2829 ·
メンテナーはふだん 1 日以内に返信