Skip to content

Commit

Permalink
ref(transactions): option for not doing transactions sampling in post…
Browse files Browse the repository at this point in the history
…_process (#81079)

in lockstep with #81077, stops
doing work in post_process on transactions. part of
#81065
  • Loading branch information
JoshFerge authored Nov 21, 2024
1 parent 6f9afa7 commit dfcb3a5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from sentry import features, projectoptions
from sentry.eventstream.types import EventStreamEventType
from sentry.exceptions import PluginError
from sentry.features.rollout import in_rollout_group
from sentry.issues.grouptype import GroupCategory
from sentry.issues.issue_occurrence import IssueOccurrence
from sentry.killswitches import killswitch_matches_context
Expand Down Expand Up @@ -611,7 +612,9 @@ def get_event_raise_exception() -> Event:
# Simplified post processing for transaction events.
# This should eventually be completely removed and transactions
# will not go through any post processing.
if is_transaction_event:
if is_transaction_event and not in_rollout_group(
"transactions.do_post_process_in_save", event.project_id
):
record_transaction_name_for_clustering(event.project, event.data)
with sentry_sdk.start_span(op="tasks.post_process_group.transaction_processed_signal"):
transaction_processed.send_robust(
Expand Down
35 changes: 35 additions & 0 deletions tests/sentry/tasks/test_post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2734,6 +2734,41 @@ def test_process_transaction_event_clusterer(
mock.call(ClustererNamespace.TRANSACTIONS, self.project, "foo")
]

@patch("sentry.ingest.transaction_clusterer.datasource.redis._record_sample")
@override_options({"transactions.do_post_process_in_save": 1.0})
def test_process_transaction_event_clusterer_flag_on(
self,
mock_store_transaction_name,
):
min_ago = before_now(minutes=1)
event = process_event(
data={
"project": self.project.id,
"event_id": "b" * 32,
"transaction": "foo",
"start_timestamp": str(min_ago),
"timestamp": str(min_ago),
"type": "transaction",
"transaction_info": {
"source": "url",
},
"contexts": {"trace": {"trace_id": "b" * 32, "span_id": "c" * 16, "op": ""}},
},
group_id=0,
)
cache_key = write_event_to_cache(event)
post_process_group(
is_new=False,
is_regression=False,
is_new_group_environment=False,
cache_key=cache_key,
group_id=None,
project_id=self.project.id,
eventstream_type=EventStreamEventType.Transaction,
)

assert mock_store_transaction_name.mock_calls == []


class PostProcessGroupGenericTest(
TestCase,
Expand Down

0 comments on commit dfcb3a5

Please sign in to comment.