Skip to content

chore(rq): migrate rq to events API - #20105

Open
Hanane-Laassilia wants to merge 7 commits into
update-rqfrom
rq-eventsAPI
Open

chore(rq): migrate rq to events API#20105
Hanane-Laassilia wants to merge 7 commits into
update-rqfrom
rq-eventsAPI

Conversation

@Hanane-Laassilia

@Hanane-Laassilia Hanane-Laassilia commented Sep 7, 2026

Copy link
Copy Markdown

Introduce shared messaging producer/process events and migrate RQ enqueue and worker processing to core.context_with_event(), preserving the existing span contract. Future PRs can reuse these messaging events in similar integrations.

@Hanane-Laassilia Hanane-Laassilia added the changelog/no-changelog A changelog entry is not required for this PR. label Sep 7, 2026
@datadog-official

datadog-official Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b895b6e | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Sep 7, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-07 16:57:47

Comparing candidate commit b895b6e in PR branch rq-eventsAPI with baseline commit 0524cf1 in branch update-rq.

📊 Benchmarking dashboard

Found 0 performance improvements and 5 performance regressions! Performance is the same for 372 metrics, 9 unstable metrics, 1 known flaky benchmarks, 4 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:httppropagationextract-tracecontext_headers

  • 🟥 execution_time [+2.301µs; +2.505µs] or [+7.157%; +7.789%]

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.463µs; +2.608µs] or [+14.913%; +15.786%]

scenario:otelspan-start

  • 🟥 execution_time [+2.383ms; +3.394ms] or [+7.577%; +10.792%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+554.425ns; +604.197ns] or [+20.299%; +22.121%]

scenario:tracer-small

  • 🟥 execution_time [+42.455µs; +44.925µs] or [+13.117%; +13.881%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-751.026ns; +734.426ns] or [-6.762%; +6.612%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-32.007ns; +33.172ns] or [-5.256%; +5.447%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1667.937ns; +1613.593ns] or [-9.847%; +9.526%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1255.844ns; +1217.934ns] or [-9.686%; +9.394%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-332.331ns; +317.362ns] or [-9.099%; +8.689%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-249.339ns; +256.734ns] or [-8.590%; +8.845%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-73.759ns; +71.310ns] or [-6.527%; +6.311%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3954.620ns; +4075.665ns] or [-9.617%; +9.911%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-697.861ns; +860.313ns] or [-8.603%; +10.606%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:span-start

  • 🟥 execution_time [+1.581ms; +1.731ms] or [+11.129%; +12.187%]

Known flaky benchmarks without significant changes:

  • scenario:errortrackingflasksqli-baseline
  • scenario:flasksimple-iast-get
  • scenario:sethttpmeta-all-enabled
  • scenario:telemetryaddmetric-record-100-metrics

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against update-rq using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

.claude/skills/apm-integrations/references/reference-integrations.md    @DataDog/python-guild
ddtrace/_trace/subscribers/__init__.py                                  @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/_trace/subscribers/_base.py                                     @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/_trace/subscribers/messaging.py                                 @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/_trace/trace_handlers.py                                        @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/_events/messaging.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/rq/patch.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/rq/test_rq.py                                             @DataDog/apm-core-python @DataDog/apm-idm-python

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 3 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 7, 2026

Copy link
Copy Markdown

Dependency direction analysis

📈 Existing violations got worse

40 pre-existing violation(s) increased in severity (e.g. their target became more depended-on, or got pulled into an import cycle), though the edge itself isn't new:

Show violations that got worse (showing 5 of 40 highest severity)
ddtrace.llmobs._integrations.llama_index -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133, +1 vs base)
ddtrace.aiguard._api_client -×-> ddtrace.trace  (product:aiguard -> product:tracing, score=133, +1 vs base)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133, +1 vs base)
ddtrace.llmobs._integrations.claude_agent_sdk -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133, +1 vs base)
ddtrace.appsec._listeners -×-> ddtrace.trace  (product:appsec -> product:tracing, score=133, +1 vs base)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

⚠️ Existing dependency direction violations

There are 230 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 230 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.profiling.scheduler -×-> ddtrace.trace  (product:profiling -> product:tracing, score=133)
ddtrace.llmobs._integrations.litellm -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.opentelemetry.trace -×-> ddtrace.trace  (product:opentelemetry -> product:tracing, score=133)
ddtrace.llmobs._integrations.langgraph -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@Hanane-Laassilia
Hanane-Laassilia marked this pull request as ready for review September 7, 2026 16:02
@Hanane-Laassilia
Hanane-Laassilia requested review from a team as code owners September 7, 2026 16:02
@Hanane-Laassilia
Hanane-Laassilia requested review from brettlangdon, dubloom and mabdinur and removed request for a team September 7, 2026 16:02

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6444230127

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ddtrace/contrib/_events/messaging.py
Comment thread ddtrace/contrib/internal/rq/patch.py Outdated
@Hanane-Laassilia
Hanane-Laassilia requested a review from a team as a code owner September 7, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant