ref(issue detection): Update conditions for segment-based occurrence creation (#122907)
This changes the way we decide whether or not to create issue occurrences from the performance problems we detect using the fake-transaction-event shim in the segment processing pipeline. Until now, it's been solely based on the presence of a `_performance_issues_spans` flag added to the segment span by Relay, which is in turn based on Relay's cached value of the `organizations:performance-issues-spans` feature flag. The problem is, Relay only sets this flag on segments which it's created as copies of incoming transaction events; segments which are created by the span buffer out of standalone spans don't get the flag. At the same time, it's not enough to just add a direct feature flag check (of that same feature flag) for span buffer segments, because as we're rolling this out, and feature flag values are getting flipped, Relay's cached values and flagpole's values will be out of sync. The `projects:discard-transaction` flag also comes into play here: Even if the `_performance_issues_spans` flag set by Relay implies that it should be `save_transaction_events` which does occurrence creation, that obviously can't happen if the transaction is discarded before it gets there, in which case we want the segment processor to know it needs to take up the slack. All of this together means that currently, only projects which are both sending transactions and not having them discarded are able to collect performance issues. This PR therefore adjusts the conditions under which the segment processor creates occurrences so that a) segment-first and discarded-transaction projects can again get performance issues, and b) we can continue to gate that using the organization feature flag. To account for the time before feature flag values get synced after they're changed, if there's even the possibility of a transaction event already having created the occurrence, the segment processor will choose not to, because briefly not recording occurrences is better than recording two copies of the same occurrence. Finally, in order to make the `organizations:performance-issues-spans` feature flag controllable from options-automator, it switches it from an internal feature flag to a flagpole one. Note: The test changes look bigger than they are - parameterized tests are incompatible with our way of doing class-based ones, so I had to move an existing test class helper method out to module scope and make it a function instead, and then update all the existing calls.
K
Katie Byers committed
41f87d6457e32a0297b6562d3199e8850ba61790
Parent: b49a3ef
Committed by GitHub <noreply@github.com>
on 8/28/2026, 5:25:52 PM