Skip to content

Conversation

@lobsterkatie
Copy link
Member

This makes four small simplifying changes to our fingerprinting code:

  • In get_grouping_variants_for_event, default fingerprint_info to {}, thus ensuring it always has a value. This in turn means that it doesn't have to be defaulted to None in the CustomFingerprintVariant and SaltedComponentVariant constructors.

  • Remove the default None value for fingerprint_info in expose_fingerprint_dict as well. (This in fact never needed the default, even before the above change, since it's called on the above classes' .info attribute, to which the constructors have always given a value.)

  • In expose_fingerprint_dict, remove the if not info: check, since
    a) the above changes mean info is never None, and
    b) in fact, it's never even empty, because expose_fingerprint_dict is only called by the aforementioned classes, and said classes are only ever used in the presence of either a client fingerprint or a matched server fingerprint rule (the two pieces of data which info can contain).

  • Also in expose_fingerprint_dict, stop creating an instance of FingerprintRule just to get the rule's textual form, since as of ref(grouping): Improve representation of grouping objects #79231 that data is included straight in the matched_rule dictionary.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 18, 2024
@lobsterkatie lobsterkatie marked this pull request as ready for review November 20, 2024 13:53
@lobsterkatie lobsterkatie requested a review from a team as a code owner November 20, 2024 13:53
@lobsterkatie lobsterkatie merged commit ecffb85 into master Nov 20, 2024
50 checks passed
@lobsterkatie lobsterkatie deleted the kmclb-clean-up-fingerprint-info-related-code branch November 20, 2024 13:53
@sentry
Copy link

sentry bot commented Nov 20, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ KeyError: 'text' /api/0/projects/{organization_id_or_slug}/{proj... View Issue

Did you find this useful? React with a 👍 or 👎

lobsterkatie added a commit that referenced this pull request Nov 20, 2024
In #80935, we switched from calculating fingerprinting rule text in the `expose_fingerprint_dict` helper to reading it from the fingerprint info, since as of #79231 we store it there. This works fine for new events, but this code also runs when someone opens the grouping info section of the issue details page, and if they do that on an event from before we started storing the rule text, it results in a key error.

This fixes that by partially undoing the change made in #80935 - it doesn't switch back to always re-calculating the the rule text, but does fall back to doing so when it's not found in the stored data.
harshithadurai pushed a commit that referenced this pull request Nov 25, 2024
This makes four small simplifying changes to our fingerprinting code:

- In `get_grouping_variants_for_event`, default `fingerprint_info` to `{}`, thus ensuring it always has a value. This in turn means that it doesn't have to be defaulted to `None` in the `CustomFingerprintVariant` and `SaltedComponentVariant` constructors.

- Remove the default `None` value for `fingerprint_info` in `expose_fingerprint_dict` as well. (This in fact never needed the default, even before the above change, since it's called on the above classes' `.info` attribute, to which the constructors have always given a value.)

- In `expose_fingerprint_dict`, remove the `if not info:` check, since 
  a) the above changes mean `info` is never `None`, and 
  b) in fact, it's never even empty, because `expose_fingerprint_dict` is only called by the aforementioned classes, and said classes are only ever used in the presence of either a client fingerprint or a matched server fingerprint rule (the two pieces of data which `info` can contain).

- Also in `expose_fingerprint_dict`, stop creating an instance of `FingerprintRule` just to get the rule's textual form, since as of #79231 that data is included straight in the `matched_rule` dictionary.
harshithadurai pushed a commit that referenced this pull request Nov 25, 2024
In #80935, we switched from calculating fingerprinting rule text in the `expose_fingerprint_dict` helper to reading it from the fingerprint info, since as of #79231 we store it there. This works fine for new events, but this code also runs when someone opens the grouping info section of the issue details page, and if they do that on an event from before we started storing the rule text, it results in a key error.

This fixes that by partially undoing the change made in #80935 - it doesn't switch back to always re-calculating the the rule text, but does fall back to doing so when it's not found in the stored data.
evanh pushed a commit that referenced this pull request Nov 25, 2024
In #80935, we switched from calculating fingerprinting rule text in the `expose_fingerprint_dict` helper to reading it from the fingerprint info, since as of #79231 we store it there. This works fine for new events, but this code also runs when someone opens the grouping info section of the issue details page, and if they do that on an event from before we started storing the rule text, it results in a key error.

This fixes that by partially undoing the change made in #80935 - it doesn't switch back to always re-calculating the the rule text, but does fall back to doing so when it's not found in the stored data.
andrewshie-sentry pushed a commit that referenced this pull request Dec 2, 2024
This makes four small simplifying changes to our fingerprinting code:

- In `get_grouping_variants_for_event`, default `fingerprint_info` to `{}`, thus ensuring it always has a value. This in turn means that it doesn't have to be defaulted to `None` in the `CustomFingerprintVariant` and `SaltedComponentVariant` constructors.

- Remove the default `None` value for `fingerprint_info` in `expose_fingerprint_dict` as well. (This in fact never needed the default, even before the above change, since it's called on the above classes' `.info` attribute, to which the constructors have always given a value.)

- In `expose_fingerprint_dict`, remove the `if not info:` check, since 
  a) the above changes mean `info` is never `None`, and 
  b) in fact, it's never even empty, because `expose_fingerprint_dict` is only called by the aforementioned classes, and said classes are only ever used in the presence of either a client fingerprint or a matched server fingerprint rule (the two pieces of data which `info` can contain).

- Also in `expose_fingerprint_dict`, stop creating an instance of `FingerprintRule` just to get the rule's textual form, since as of #79231 that data is included straight in the `matched_rule` dictionary.
andrewshie-sentry pushed a commit that referenced this pull request Dec 2, 2024
In #80935, we switched from calculating fingerprinting rule text in the `expose_fingerprint_dict` helper to reading it from the fingerprint info, since as of #79231 we store it there. This works fine for new events, but this code also runs when someone opens the grouping info section of the issue details page, and if they do that on an event from before we started storing the rule text, it results in a key error.

This fixes that by partially undoing the change made in #80935 - it doesn't switch back to always re-calculating the the rule text, but does fall back to doing so when it's not found in the stored data.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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