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

Abierto
#3,217 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
54/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
ruby

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Ruby
Estrellas
990
Forks
553
Merge medio
1 d 19 h
PR fusionados (30 d)
31

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/sentry-ruby

Todos los issues de getsentry/sentry-ruby

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.