Skip to content

Conversation

@lobsterkatie
Copy link
Member

This is various bits of refactoring pulled from upcoming PRs to keep them focused and easy to review. No behavior changes.

  • Server-side fingerprinting is unrelated to stacktrace normalization for enhancements rule processing. Remove a comment which suggests otherwise, and move server-side fingerprinting to happen before the normalization, so both stacktrace processes happen together.
  • Refactor the _update_frame helper used in normalization by moving the few in-app-related lines directly into the normalization function and simplifying the rest. Rename the function from _update_frame to _trim_function_name to reflect it's now-singular purpose.
  • Separate out one of the conditionals in the stacktrace strategy code, so it can be handled differently by different configs.
  • Add a comment about the EnhancementsConfigData type.
  • In grouping snapshot tests, always test configs in the same order.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 12, 2025
@lobsterkatie lobsterkatie marked this pull request as ready for review November 13, 2025 00:01
@lobsterkatie lobsterkatie requested a review from a team as a code owner November 13, 2025 00:01
@lobsterkatie lobsterkatie merged commit 3e99f96 into master Nov 13, 2025
65 checks passed
@lobsterkatie lobsterkatie deleted the kmclb-more-small-new-grouping-config-refactors branch November 13, 2025 18:00
lobsterkatie added a commit that referenced this pull request Nov 17, 2025
This fixes a bug caused by #103268, which moved server-side fingerprinting before the call to `normalize_stacktraces_for_grouping`[1]. While it's 99% true that they're unrelated processes (and therefore can happen in any order), the one exception to that is the handling of custom fingerprints which also include title information. In cases where the custom title includes any of the frame variables (`function`, `module`, `package`, or `abs_path`), the frame that gets used is the top in-app frame in the stacktrace. But in-app rules are applied as part of `normalize_stacktraces_for_grouping`, so having it not run until after the custom title is set is obviously a problem.

To fix this, the handling of such titles (in other words, the filling-in of the variables and adding of the result to the event) has been moved to live alongside the filling-in-of-the-variables which we do for the fingerprint itself, which is after in-app rules have been applied.  A snapshot test illustrating the fix has also been added, showing that it's not the top frame but the top in-app frame which is used for the title.

(Why didn't I just switch the order of the two operations back, you ask? Because switching the order was the first step towards absorbing the normalization into variant calculation call which comes immediately after it[2], so server-side fingerprinting needed to get out of its original spot between them.)


[1] https://github.com/getsentry/sentry/blob/6812bc023ceb6695bf6b0096852fc184feb82509/src/sentry/grouping/ingest/hashing.py#L58-L66
[2] https://github.com/getsentry/sentry/blob/6812bc023ceb6695bf6b0096852fc184feb82509/src/sentry/grouping/ingest/hashing.py#L68-L69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants