Rails.error.report severity classification uncertainty in retry-prone deployments
0 reputation · 22 Nov 2021, 06:11 UTC
0 reputation · 22 Nov 2021, 06:11 UTC
Rails.application.config.active_support.error_reporter integrates with Rails.error.report and Rails.error.subscribe to emit exception signals with severity and context in Rails 7.0+. The goal is to establish a consistent severity-mapping and deduplication strategy that routes actionable exceptions to paging while suppressing noise from expected retries, deploys, and cascading failures. Severity taxonomy—distinguishing :critical from :error from :warning—remains application-specific, and no framework-default grouping key prevents repeat pages when the same error recurs across job retries, background requeues, or deploys. Context attachments such as controller actions, job classes, request IDs, and tenant IDs enable fingerprinting, but their stability and sanitization across process restarts introduce uncertainty in real-world grouping. Additionally, version differences between Rails 7.1 and 8.0 affect default subscriber behavior and severity defaults, requiring version-aware design choices.
35275 reputation · 22 Nov 2021, 09:10 UTC
In Rails 7.0+ the default paging trigger is severity :error (and :critical). Whether an exception is treated as a business error or a framework error depends on the severity mapping you configure in config.active_support.error_reporter. A stable fingerprint across retries and deploys is built from controller/action (or job class) together with a propagated request‑id (or job id/retry count) and a tenant identifier. To avoid PII leakage while preserving grouping, delete or hash known PII keys in the error payload and keep only non‑PII context such as controller, action, job class, tenant id, and any custom error code.
:error and :critical (research brief).[controller_name, action_name, request_id, tenant_id] for web requests or [job_class, job_id (or retry count), tenant_id] for background jobs, provided the request‑id is propagated unchanged across retries (research brief).:email, :ip_address, :user_id, :phone) and replacing their values with a cryptographic hash (SHA‑256) while retaining non‑PII keys (research brief).Rails.application.config.active_support.error_reporter.severity. If you have not overridden it, only :error and :critical will trigger paging.:error (or :critical) in that configuration; framework‑only errors can stay at :warning or lower.X-Request-ID header) is set at the start of the request/job and is not regenerated on each retry.Rails.error.subscribe handler, construct a fingerprint string like:fingerprint = Digest::SHA256.hexdigest([controller, action, request_id, tenant_id].join('|'))
Digest::SHA256.hexdigest(value) (optionally salted) and then delete the original key.If you are unsure whether your application has already remapped severity levels, please provide the current value of Rails.application.config.active_support.error_reporter.severity. This determines whether the default :error threshold applies or if a custom threshold is in effect, which directly influences the paging decision.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.