Skip to content

Commit 93b6eea

Browse files
authored
ref(deletions): Use the same transaction name (#102661)
This allows errors within processes and the main script to report using the same transaction. This will help with not requiring multiple views and different alerts.
1 parent a96ff6f commit 93b6eea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/sentry/runner/commands/cleanup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
logger = logging.getLogger(__name__)
2626

27+
TRANSACTION_PREFIX = "cleanup"
28+
2729
if TYPE_CHECKING:
2830
from sentry.db.models.base import BaseModel
2931

@@ -119,7 +121,9 @@ def multiprocess_worker(task_queue: _WorkQueue) -> None:
119121
return
120122

121123
try:
122-
with sentry_sdk.start_transaction(op="cleanup", name="multiprocess_worker"):
124+
with sentry_sdk.start_transaction(
125+
op="cleanup", name=f"{TRANSACTION_PREFIX}.multiprocess_worker"
126+
):
123127
model = import_string(model_name)
124128
task = deletions.get(
125129
model=model,
@@ -222,7 +226,9 @@ def _cleanup(
222226
# Start transaction AFTER creating the multiprocessing pool to avoid
223227
# transaction context issues in child processes. This ensures only the
224228
# main process tracks the overall cleanup operation performance.
225-
with sentry_sdk.start_transaction(op="cleanup", name="cleanup") as transaction:
229+
with sentry_sdk.start_transaction(
230+
op="cleanup", name=f"{TRANSACTION_PREFIX}.main"
231+
) as transaction:
226232
try:
227233
# Check if cleanup should be aborted before starting
228234
if options.get("cleanup.abort_execution"):

0 commit comments

Comments
 (0)