rails: add optional Good Job labels and concurrency key to ActiveJob error context

未關閉
#3,217 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
54/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
ruby

研究方向

Start by reading the current ActiveJobExtension context and error-data path; the issue explicitly says to use it rather than the removed SentryReporter.sentry_context. Check how that path builds contexts and handles optional job methods, then compare the result with the Good Job identity APIs in the specification. Done means the documented good_job context includes labels and any present legacy concurrency key, with neither field added as a tag.

由索引模型根據 Issue 內容生成。

描述

Feature Ruby Waiting for: Product Owner

Summary

When an ActiveJob instance exposes Good Job identity APIs, attach labels and legacy concurrency_key under a good_job context on error (and optionally on the job scope).

Motivation

Official ActiveJob / job-extension reporting already records queue, executions, latency, and messaging fields. It does not record Good Job's concurrency identity (good_job_labels, and on older 4.x good_job_concurrency_key). Those fields help explain why a job was limited or which concurrency cohort it belonged to.

Specification

  • Duck-type only:
    • if job.respond_to?(:good_job_labels) -> contexts.good_job.labels = Array(job.good_job_labels)
    • if job.respond_to?(:good_job_concurrency_key) and value present -> contexts.good_job.concurrency_key
  • Do not set these as tags (label cardinality).
  • Hook current ActiveJobExtension context / error-data path (not removed SentryReporter.sentry_context).
  • No-op when methods are absent.

Guide-level

A failing job that uses Good Job concurrency labels shows contexts.good_job.labels on the event. Hosts on Good Job 5+ without concurrency_key simply omit that field.

Drawbacks / alternatives

  • Adopt: small adapter-specific branch in a shared ActiveJob path.
  • Do nothing: lose concurrency cohort signal on errors.
  • Rejected: tags for labels.
  • Rejected: nest only under extra if contexts.good_job is unacceptable; prefer contexts for structured identity.

Prior art

  • Official Good Job cron / ActiveJob work: #3199, #3200
  • Community sentry-good_job ContextHelpers (prior art only)

Unresolved questions

  • Apply on successful transactions too, or only on captured exceptions?
  • Name the context key good_job vs extend active_job?

References

主要語言
Ruby
星號
990
分支
553
平均合併
1 天 19 小時
30 天內合併 PR
31

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-ruby 的其他 Issue

查看 getsentry/sentry-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。