Skip to content

feat(tasks) Add parameters to instrumented_task()#100536

Merged
markstory merged 2 commits into
masterfrom
feat-instrumented-task-slim
Oct 1, 2025
Merged

feat(tasks) Add parameters to instrumented_task()#100536
markstory merged 2 commits into
masterfrom
feat-instrumented-task-slim

Conversation

@markstory

@markstory markstory commented Sep 29, 2025

Copy link
Copy Markdown
Member

I'd like to deprecated and remove TaskworkerConfig. Before that can be done, we need to have parameters on instrumented_task.

Refs STREAM-435


Note

Extend instrumented_task to accept task parameters directly and refactor Sentry App tasks to specify silo_mode without TASK_OPTIONS; add tests covering new parameters.

  • Tasks Framework:
    • instrumented_task: Add direct parameters (namespace, retry, expires, processing_deadline_duration, at_most_once, wait_for_delivery, compression_type) and allow using either namespace or taskworker_config.
    • Update imports to include CompressionType, TaskNamespace, and Retry.
  • Sentry App Tasks (src/sentry/sentry_apps/tasks/sentry_apps.py):
    • Remove TASK_OPTIONS/CONTROL_TASK_OPTIONS usage; pass silo_mode=SiloMode.REGION|CONTROL directly on @instrumented_task across task definitions.
  • Tests:
    • Add test ensuring instrumented_task parameters are applied (verifies compression_type and retry settings).
    • Update test imports to use new Retry and registry APIs.

Written by Cursor Bugbot for commit 0d8a7bb. This will update automatically on new commits. Configure here.

I'd like to deprecated and remove `TaskworkerConfig`. Before that can be
done, we need to have parameters on `instrumented_task`.

Refs STREAM-435
@linear

linear Bot commented Sep 29, 2025

Copy link
Copy Markdown

@markstory markstory requested a review from a team September 29, 2025 20:05
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 29, 2025
Comment thread src/sentry/tasks/base.py
def instrumented_task(
name,
name: str,
namespace: TaskNamespace | None = None,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This None will be removed once all tasks have been updated.

@markstory markstory merged commit 62a44aa into master Oct 1, 2025
66 checks passed
@markstory markstory deleted the feat-instrumented-task-slim branch October 1, 2025 18:18
priscilawebdev pushed a commit that referenced this pull request Oct 1, 2025
I'd like to deprecated and remove `TaskworkerConfig`. Before that can be
done, we need to have parameters on `instrumented_task`.

Refs STREAM-435
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants