Skip to content

[celery] Celery error callback behavior #13812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

wantsui
Copy link
Collaborator

@wantsui wantsui commented Jun 27, 2025

Demonstrates the issue in #13788 with a test within our Celery tests

I'm testing locally with:

DD_TRACE_AGENT_PORT=9126 riot -v run --pass-env -s 1509aa1 -k test_trace_with_task_error

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@wantsui wantsui changed the title Add test demonstrating on_error does not get picked up as its own span [celery]Add test demonstrating on_error does not get picked up as its own span Jun 27, 2025
@wantsui wantsui changed the title [celery]Add test demonstrating on_error does not get picked up as its own span [celery] Celery error callback behavior Jun 27, 2025
Copy link
Contributor

CODEOWNERS have been resolved as:

tests/contrib/celery/test_integration.py                                @DataDog/apm-core-python @DataDog/apm-idm-python

try:
t.get(timeout=self.ASYNC_GET_TIMEOUT)
except ValueError:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 Code Quality Violation

silent exception (...read more)

Using the pass statement in an exception block ignores the exception. Exceptions should never be ignored. Instead, the user must add code to notify an exception occurred and attempt to handle it or recover from it.

The exception to this rule is the use of StopIteration or StopAsyncIteration when implementing a custom iterator (as those errors are used to acknowledge the end of a successful iteration).

View in Datadog  Leave us feedback  Documentation

Copy link
Contributor

github-actions bot commented Jun 27, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 272 ± 2 ms.

The average import time from base is: 274 ± 1 ms.

The import time difference between this PR and base is: -1.91 ± 0.07 ms.

Import time breakdown

The following import paths have grown:

ddtrace.auto 0.019 ms (0.01%)
ddtrace.bootstrap.sitecustomize 0.019 ms (0.01%)
ddtrace.bootstrap.preload 0.019 ms (0.01%)
ddtrace.internal.remoteconfig._connectors 0.019 ms (0.01%)

The following import paths have shrunk:

ddtrace.auto 1.992 ms (0.73%)
ddtrace.bootstrap.sitecustomize 1.320 ms (0.48%)
ddtrace.bootstrap.preload 1.320 ms (0.48%)
ddtrace.internal.remoteconfig.client 0.643 ms (0.24%)
ddtrace 0.672 ms (0.25%)
ddtrace.internal._unpatched 0.032 ms (0.01%)
json 0.032 ms (0.01%)
json.decoder 0.032 ms (0.01%)
re 0.032 ms (0.01%)
enum 0.032 ms (0.01%)
types 0.032 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jun 28, 2025

Benchmarks

Benchmark execution time: 2025-06-28 00:15:08

Comparing candidate commit 21bbe43 in PR branch celery-error-callbacks with baseline commit 1cb2ea4 in branch main.

Found 0 performance improvements and 2 performance regressions! Performance is the same for 568 metrics, 2 unstable metrics.

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+861.296ns; +928.810ns] or [+20.442%; +22.045%]

scenario:iastaspectsospath-ospathnormcase_aspect

  • 🟥 execution_time [+344.502ns; +402.955ns] or [+9.791%; +11.453%]

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.

1 participant