Skip to content

fix(celery): clear task timing state after postrun#4504

Merged
lzchen merged 5 commits into
open-telemetry:mainfrom
diogosilva30:fix/celery-task-start-time-leak
May 13, 2026
Merged

fix(celery): clear task timing state after postrun#4504
lzchen merged 5 commits into
open-telemetry:mainfrom
diogosilva30:fix/celery-task-start-time-leak

Conversation

@diogosilva30
Copy link
Copy Markdown
Contributor

@diogosilva30 diogosilva30 commented Apr 29, 2026

Description

Split out of #4439.

This PR keeps the Celery fix narrowly focused on the task_id_to_start_time lifecycle:

  • keep the timing map instance-scoped while preserving singleton state across repeated CeleryInstrumentor() calls
  • reset it when instrumenting and uninstrumenting
  • remove completed task ids in _trace_postrun
  • add regression coverage that verifies completed tasks clear the timing cache

Testing

  • uv run tox -e py311-test-instrumentation-celery -- -q

@diogosilva30 diogosilva30 marked this pull request as draft April 29, 2026 16:35
@diogosilva30 diogosilva30 marked this pull request as ready for review May 5, 2026 14:22
@diogosilva30 diogosilva30 requested a review from a team as a code owner May 5, 2026 14:52
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Thanks @diogosilva30 👍🏻

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest May 11, 2026
Comment thread CHANGELOG.md Outdated
@aabmass aabmass moved this from Approved PRs to Ready for merge in Python PR digest May 11, 2026
@diogosilva30 diogosilva30 force-pushed the fix/celery-task-start-time-leak branch from dbccbb0 to 4c43e03 Compare May 12, 2026 21:17
@emdneto
Copy link
Copy Markdown
Member

emdneto commented May 12, 2026

Thanks for the PR!

Just a heads-up: we no longer update CHANGELOG.md directly. The changelog is now generated from changelog fragments using Towncrier.

Please add the appropriate changelog fragment for this change instead of editing CHANGELOG.md manually. You can find the instructions and expected format in CONTRIBUTING.md.

@lzchen lzchen enabled auto-merge (squash) May 13, 2026 15:57
@lzchen lzchen merged commit d2f396d into open-telemetry:main May 13, 2026
751 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for merge to Done in Python PR digest May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants