fix(rq): replace removed Job.get_id() with Job.id property#16682
Draft
gferrate wants to merge 4 commits intoDataDog:mainfrom
Draft
fix(rq): replace removed Job.get_id() with Job.id property#16682gferrate wants to merge 4 commits intoDataDog:mainfrom
gferrate wants to merge 4 commits intoDataDog:mainfrom
Conversation
RQ v2.x removed the standalone `get_id()` method, which causes a `AttributeError` when the integration is enabled. The `id` property has been available since v1.8.1 (the minimum supported version) and is the canonical way to access job IDs across all supported versions. Updates the tested max version in the registry to reflect v2.7.0 compatibility.
Add explicit assertions that job.id is set correctly on all three instrumented span types (enqueue, worker.perform_job, job.perform), including a test with a user-supplied custom job ID. The existing snapshot tests ignored meta.job.id, so they would not have caught the job.get_id() removal in RQ 2.x at the assertion level.
RQ 2.0 is the first major version with breaking changes (removed Job.get_id()). Pin it explicitly alongside 1.8.1 and 1.10.0 so regressions at the 1.x→2.x boundary are caught independently of whatever latest resolves to.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes an `AttributeError` in the RQ integration that occurs when using RQ 2.x. The `Job.get_id()` method was removed in RQ 2.0; the integration was calling it in three places when tagging spans with the job ID.
Motivation
RQ 2.0 was released in October 2024 and RQ 2.7.0 (the current latest) was released in February 2026. Any user who has upgraded RQ to 2.x will get an `AttributeError` on every traced job enqueue or execution, breaking their instrumentation entirely.
Change
Replace all three `job.get_id()` calls with `job.id`. The `id` property has been available since RQ 1.8.1 (our minimum supported version) — in 1.x it was literally `id = property(get_id, set_id)`, so this change is fully backwards compatible across the supported range (1.8.1 → 2.7.0).
Also updates `registry.yaml` to reflect the tested max version as 2.7.0.
Tests
The existing snapshot tests ignored `meta.job.id`, so they would not have caught this at the assertion level — only at the `AttributeError` level when running against RQ 2.x.
Risks
Backport
This is a critical fix for all users on RQ 2.x. Backport to the most recent release branch is recommended.