Skip to content

feat(ruby): add job extensions and shared instrumentation - #3129

Open
solnic wants to merge 1 commit into
masterfrom
feat/3117-public-backend-extension-registry-for-background-job-integrations
Open

solnic wants to merge 1 commit into
masterfrom
feat/3117-public-backend-extension-registry-for-background-job-integrations

Conversation

@solnic

@solnic solnic commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

This introduces a public API for queue systems (ActiveJob, Sidekiq, GoodJob, SolidQueue etc.) to integrate with Sentry by subclassing Sentry::JobExtensions::Extension:

module MyBackend
  class SentryExtension < Sentry::JobExtensions::Extension
    def initialize
      super(name: "my_backend", integration: MyBackend::SentryIntegration, origin: "auto.queue.my_backend")
    end

    def scope_data(job:, **)
      { tags: { queue: job.queue_name } }
    end

    def messaging_data(job:, **)
      { system: "my_backend", message_id: job.job_id, destination: job.queue_name }
    end
  end
end

Integrations call the extension around enqueueing and performing a job:

extension.instrument_enqueue(job: job) { enqueue }

transaction = extension.start_job(scope: scope, job: job)
# perform the job
extension.finish_job(transaction: transaction, status: 200)

extension.capture_exception(job: job, exception: error) if extension.report_exception?(job: job, exception: error)

These record the queue.publish span and the queue.process transaction, and capture the job's exceptions. The data they record comes from hooks the subclass overrides, such as scope_data, error_data, messaging_data, will_retry?, report_exception?, record_publish_span?, extract_trace_headers, inject_trace_headers, transaction_name and span_origin.

Hooks take keyword arguments and accept keywords they don't read, so integrations can pass extra context. A failing hook is logged and the job runs without its data.


Closes #3117
Closes #3123

@solnic
solnic added this pull request to stack #3135 October 13, 2026 13:17
@solnic
solnic marked this pull request as draft October 13, 2026 13:25
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch from 120f7a3 to 24621bb Compare October 14, 2026 09:17
@solnic
solnic marked this pull request as ready for review October 14, 2026 09:49
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 3 times, most recently from 18edb4c to 605bebc Compare October 14, 2026 11:42
@solnic
solnic removed this pull request from stack #3135 October 14, 2026 11:44
@solnic solnic changed the title feat(ruby): add public backend-extension registry feat(ruby): add job extensions and shared instrumentation Oct 14, 2026
@solnic
solnic added this pull request to stack #3137 October 14, 2026 11:44
cursor[bot]

This comment was marked as resolved.

@solnic
solnic marked this pull request as draft October 15, 2026 08:25
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 3 times, most recently from 2cddb72 to 3fa983c Compare October 15, 2026 11:00
@solnic
solnic marked this pull request as ready for review October 15, 2026 12:19
cursor[bot]

This comment was marked as resolved.

@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 2 times, most recently from 27970e7 to e3ade51 Compare October 15, 2026 12:51
cursor[bot]

This comment was marked as resolved.

@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch from 5eaa1a5 to 77e02b1 Compare October 15, 2026 13:37
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 3 times, most recently from 35fb71a to 0df0bb8 Compare October 23, 2026 11:49
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch from 0df0bb8 to f5eee4a Compare November 2, 2026 15:56
@solnic
solnic marked this pull request as draft November 2, 2026 15:57
@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 3 times, most recently from a213bfd to 7e7b39b Compare November 3, 2026 12:01
@solnic
solnic marked this pull request as ready for review November 3, 2026 14:29

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch 2 times, most recently from 8c54390 to f9f7593 Compare November 4, 2026 10:25

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f9f7593. Configure here.

@solnic
solnic force-pushed the feat/3117-public-backend-extension-registry-for-background-job-integrations branch from b51df03 to bf6aff9 Compare November 4, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared queue instrumentation helpers Public backend-extension registry for background job integrations

1 participant