Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sentry/issues/status_change_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import Any

import sentry_sdk
from sentry_sdk.tracing import NoOpSpan, Span, Transaction

from sentry.integrations.tasks.kick_off_status_syncs import kick_off_status_syncs
Expand Down Expand Up @@ -294,6 +295,8 @@ def process_status_change_message(
return None
txn.set_tag("group_id", group.id)

sentry_sdk.set_tag("group_type", group.issue_type.slug)

Choose a reason for hiding this comment

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

P1 Badge Avoid setting global Sentry tag in message loop

The new sentry_sdk.set_tag("group_type", …) call writes to the global scope rather than the transaction that is already being passed around and tagged via txn.set_tag. In the Kafka consumer this scope persists across messages, so the last processed group’s type will remain attached to subsequent unrelated events and the tag will not appear on the transaction itself. Use txn.set_tag("group_type", group.issue_type.slug) (like the other tags above) to ensure the tag applies to the current message only.

Useful? React with 👍 / 👎.


with metrics.timer(
"occurrence_consumer._process_message.status_change.update_group_status",
tags={"occurrence_type": group.issue_type.type_id},
Expand Down