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

オープン
#3,217 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
31

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-ruby のほかの issue

getsentry/sentry-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。