Let apps shape the fingerprint, so a message with a per-request id doesn't split one error into many
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 1-2 天
- 新手友好度
- 54/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 領域
- backend, observability
研究方向
Start by reading Subscriber#report and the fingerprint configuration path; the issue names these as the likely change points but does not give file paths or tests. Compare the proposed configurable fingerprint hook with the narrower message-normalizing option, then check the README and existing subscriber tests. Done means the chosen option groups messages with changing request IDs while retaining the reported message, with configuration documented and tests covering the behavior.
由索引模型根據 Issue 內容生成。
描述
An error's fingerprint is a hash of its class, message, severity and source. When a message embeds something that changes with every occurrence, such as a request id, a record id or a timestamp, each occurrence becomes an error of its own. The dashboard fills with near-identical errors that each have one occurrence. That hides a real outage, which looks like hundreds of new errors rather than one error with hundreds of occurrences, and since every one is "new", each one is emailed.
The case we hit is API client errors that end with the provider's request id:
Anthropic::Errors::InternalServerError: Internal server error (request_id: req_011CT8...)
What we do today is wrap the subscriber. We unsubscribe SolidErrors::Subscriber and subscribe one that rewrites the exception's message, replacing req_... with a placeholder and moving the id into the context, before handing it on. It works, but it means replacing the gem's subscriber and redefining #message on the exception.
A possible shape: an optional hook that turns the attributes into the fingerprint, defaulting to what happens now:
config.solid_errors.fingerprint = ->(error:, attributes:) {
message = attributes[:message].gsub(/\breq_[A-Za-z0-9]+/, "req_*")
[attributes[:exception_class], message, attributes[:severity], attributes[:source]].join
}
The stored message would stay as reported, so the id is still there to quote, and only the grouping would change. A narrower alternative is a message-normalizing proc that applies only to the fingerprint.
Would something like this be welcome? If so, I can send a small PR: the config option, the call in Subscriber#report, a README section and tests.
- 主要語言
- Ruby
- 星號
- 498
- 分支
- 36
- 平均合併
- 12 小時 38 分鐘
- 30 天內合併 PR
- 20
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
account: profile
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 5 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
bug good first issue help wanted
難度 2/5 1-3 小時 新手友好度 90/100
ysb3996-blip/oops#24 ·
維護者通常 1 天內回覆