Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(grouping): Delete old configurations and snapshots #79677

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions src/sentry/apidocs/examples/project_examples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from drf_spectacular.utils import OpenApiExample

from sentry.projectoptions.defaults import DEFAULT_GROUPING_CONFIG, LEGACY_GROUPING_CONFIG

KEY_RATE_LIMIT = {
"id": "60120449b6b1d5e45f75561e6dabd80b",
"name": "Liked Pegasus",
Expand Down Expand Up @@ -129,11 +131,11 @@
"sentry:scrub_data": False,
"sentry:token": "e84c8c0fb1c121e988558785885f9cde",
"sentry:resolve_age": 168,
"sentry:grouping_config": "newstyle:2023-01-11",
"sentry:grouping_config": DEFAULT_GROUPING_CONFIG,
"quotas:spike-protection-disabled": False,
"sentry:store_crash_reports": 5,
"digests:mail:minimum_delay": 180,
"sentry:secondary_grouping_config": "newstyle:2019-10-29",
"sentry:secondary_grouping_config": LEGACY_GROUPING_CONFIG,
"sentry:secondary_grouping_expiry": 147555024,
"sentry:builtin_symbol_sources": ["ios", "android", "chromium"],
"sentry:origins": ["getsentry.com", "app.getsentry.com", "www.getsentry.com", "sentry.io"],
Expand Down Expand Up @@ -166,11 +168,11 @@
"verifySSL": True,
"scrubIPAddresses": False,
"scrapeJavaScript": True,
"groupingConfig": "newstyle:2023-01-11",
"groupingConfig": DEFAULT_GROUPING_CONFIG,
"groupingEnhancements": "",
"groupingEnhancementsBase": None,
"secondaryGroupingExpiry": 1687010243,
"secondaryGroupingConfig": "newstyle:2019-10-29",
"secondaryGroupingConfig": LEGACY_GROUPING_CONFIG,
"fingerprintingRules": "",
"uptimeAutodetection": True,
"organization": {
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/eventstore/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def get_grouping_variants(
from sentry.grouping.strategies.base import StrategyConfiguration

if isinstance(force_config, str):
# A string like `"newstyle:2023-01-11"`
# A string like `"newstyle:YYYY-MM-DD"`
stored_config = self.get_grouping_config()
grouping_config = stored_config.copy()
grouping_config["id"] = force_config
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/grouping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@
This for instance is how one of the configurations is defined::

register_strategy_config(
id="newstyle:2019-10-29",
base="newstyle:2019-05-08",
id="newstyle:SomeDate",
base="newstyle:AnotherDate",
delegates=["frame:v4"],
risk=RISK_LEVEL_MEDIUM,
changelog="...",
)

The configuration ID (`newstyle:2019-10-29`) is defined in the project
The configuration ID (`newstyle:SomeDate`) is defined in the project
options and then becomes the strategy configuration of choice for all new
events. Because in this case it inherits from another strategy, the default
configurations from that strategy are reused. Here the `frame` is changed
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions src/sentry/grouping/fingerprinting/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ To add one or more of these rule configs

```python
register_strategy_config(
id="newstyle:2024-01-11",
base="newstyle:2023-01-11,
id="newstyle:YYYY-MM-DD",
base="newstyle:YYYY-MM-DD", # Some other existing config
risk=RISK_LEVEL_MEDIUM,
changelog="""
* Added built-in fingerprinting for Foo
* Added built-in fingerprinting for Bar
""",
fingerprinting_bases=["foo@2024-01-11", "bar@2024-01-11"],
fingerprinting_bases=["foo@YYYY-MM-DD", "bar@YYYY-MM-DD"],
)
```

Expand Down
50 changes: 7 additions & 43 deletions src/sentry/grouping/strategies/configurations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from sentry.grouping.strategies.base import (
RISK_LEVEL_HIGH,
RISK_LEVEL_MEDIUM,
StrategyConfiguration,
create_strategy_configuration,
)
Expand Down Expand Up @@ -70,35 +69,9 @@ def register_strategy_config(id: str, **kwargs) -> type[StrategyConfiguration]:
return rv


# Legacy groupings
#
# These we do not plan on changing much, but bugfixes here might still go
# into new grouping versions.

register_strategy_config(
id="legacy:2019-03-12",
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this configuration and all related snapshots.

strategies=[
"threads:legacy",
"stacktrace:legacy",
"chained-exception:legacy",
],
delegates=["frame:legacy", "stacktrace:legacy", "single-exception:legacy"],
changelog="""
* Traditional grouping algorithm
* Some known weaknesses with regards to grouping of native frames
""",
initial_context={
"normalize_message": False,
},
enhancements_base="legacy:2019-03-12",
Copy link
Member Author

Choose a reason for hiding this comment

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

This will remove the [email protected] file.

)

# Simple newstyle grouping
#
# This is a grouping strategy that applies very simple rules and will
# become the new default at one point. Optimized for native and
# javascript but works for all platforms.
# Configurations

# This is left behind in order to have less changes happen in one pull request.
Copy link
Member Author

Choose a reason for hiding this comment

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

Some tests depend on having a legacy configuration to update from.

register_strategy_config(
id="newstyle:2019-05-08",
risk=RISK_LEVEL_HIGH,
Expand All @@ -124,32 +97,23 @@ def register_strategy_config(id: str, **kwargs) -> type[StrategyConfiguration]:
enhancements_base="common:2019-03-23",
)

# This is the grouping strategy used for new projects.
register_strategy_config(
id="newstyle:2019-10-29",
Copy link
Member Author

Choose a reason for hiding this comment

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

Dropping this configuration and all related snapshots.

id="newstyle:2023-01-11",
base="newstyle:2019-05-08",
risk=RISK_LEVEL_MEDIUM,
risk=RISK_LEVEL_HIGH,
changelog="""
* Better rules for when to take context lines into account for
JavaScript platforms for grouping purposes.
* Better support for PHP7 anonymous classes.
""",
initial_context={
"php_detect_anonymous_classes": True,
"with_context_line_file_origin_bug": False,
Copy link
Member Author

Choose a reason for hiding this comment

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

These will be moved to the latest configuration.
image

},
)

register_strategy_config(
id="newstyle:2023-01-11",
base="newstyle:2019-10-29",
risk=RISK_LEVEL_MEDIUM,
changelog="""
* Added new language/platform specific stack trace grouping enhancements rules
that should make the default grouping experience better.
This includes JavaScript, Python, PHP, Go, Java and Kotlin.
* Added ChukloadErrors via new built-in fingerprinting support.
""",
initial_context={
"php_detect_anonymous_classes": True,
"with_context_line_file_origin_bug": False,
"java_cglib_hibernate_logic": True,
},
enhancements_base="newstyle:2023-01-11",
Expand Down
5 changes: 2 additions & 3 deletions src/sentry/projectoptions/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# TODO: we might instead want to fall back to the latest of the project's
# epoch instead.
LEGACY_GROUPING_CONFIG = "legacy:2019-03-12"
LEGACY_GROUPING_CONFIG = "newstyle:2019-05-08"
DEFAULT_GROUPING_CONFIG = "newstyle:2023-01-11"
# NOTE: this is empty for now to migrate projects off the deprecated
# `mobile` strategy via grouping auto-updates.
Expand All @@ -22,8 +22,7 @@
register(
key="sentry:grouping_config",
epoch_defaults={
1: LEGACY_GROUPING_CONFIG,
3: "newstyle:2019-05-08",
3: LEGACY_GROUPING_CONFIG,
4: DEFAULT_GROUPING_CONFIG,
},
)
Expand Down
9 changes: 4 additions & 5 deletions tests/sentry/eventstore/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from sentry.interfaces.user import User
from sentry.issues.issue_occurrence import IssueOccurrence
from sentry.models.environment import Environment
from sentry.projectoptions.defaults import DEFAULT_GROUPING_CONFIG
from sentry.snuba.dataset import Dataset
from sentry.testutils.cases import PerformanceIssueTestCase, TestCase
from sentry.testutils.helpers.datetime import before_now, iso_format
Expand All @@ -23,8 +24,6 @@

pytestmark = [requires_snuba]

NEWSTYLE_GROUPING_CONFIG = "newstyle:2023-01-11"


class EventTest(TestCase, PerformanceIssueTestCase):
def test_pickling_compat(self):
Expand Down Expand Up @@ -376,7 +375,7 @@ def test_grouping_reset(self):
)
grouping_config: GroupingConfig = {
"enhancements": enhancement.dumps(),
"id": NEWSTYLE_GROUPING_CONFIG,
"id": DEFAULT_GROUPING_CONFIG,
}

event1 = Event(
Expand Down Expand Up @@ -412,7 +411,7 @@ def test_get_hashes_pulls_existing_hashes(self):
assert event.get_hashes() == hashes

def test_get_hashes_gets_hashes_and_variants_if_none_on_event(self):
self.project.update_option("sentry:grouping_config", NEWSTYLE_GROUPING_CONFIG)
self.project.update_option("sentry:grouping_config", DEFAULT_GROUPING_CONFIG)
event = Event(
event_id="11212012123120120415201309082013",
data={"message": "Dogs are great!"},
Expand All @@ -433,7 +432,7 @@ def test_get_hashes_gets_hashes_and_variants_if_none_on_event(self):
default_variant = variants["default"]

assert isinstance(default_variant, ComponentVariant)
assert default_variant.config.id == NEWSTYLE_GROUPING_CONFIG
assert default_variant.config.id == DEFAULT_GROUPING_CONFIG
assert default_variant.component.id == "default"
assert len(default_variant.component.values) == 1
assert default_variant.component.values[0].id == "message"
Expand Down
12 changes: 6 additions & 6 deletions tests/sentry/grouping/ingest/test_hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
_calculate_secondary_hashes,
)
from sentry.models.group import Group
from sentry.projectoptions.defaults import LEGACY_GROUPING_CONFIG
from sentry.projectoptions.defaults import DEFAULT_GROUPING_CONFIG, LEGACY_GROUPING_CONFIG
from sentry.testutils.cases import TestCase
from sentry.testutils.skips import requires_snuba

Expand Down Expand Up @@ -91,15 +91,15 @@ def test_background_grouping_can_be_disabled_via_sample_rate(
class SecondaryGroupingTest(TestCase):
def test_applies_secondary_grouping(self):
project = self.project
project.update_option("sentry:grouping_config", "legacy:2019-03-12")
project.update_option("sentry:grouping_config", LEGACY_GROUPING_CONFIG)

timestamp = time()
manager = EventManager({"message": "foo 123", "timestamp": timestamp})
manager.normalize()
event = manager.save(project.id)

project.update_option("sentry:grouping_config", "newstyle:2023-01-11")
project.update_option("sentry:secondary_grouping_config", "legacy:2019-03-12")
project.update_option("sentry:grouping_config", DEFAULT_GROUPING_CONFIG)
project.update_option("sentry:secondary_grouping_config", LEGACY_GROUPING_CONFIG)
project.update_option("sentry:secondary_grouping_expiry", timestamp + 3600)

# Switching to newstyle grouping changes the hash because now '123' will be parametrized
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_handles_errors_with_secondary_grouping(
mock_capture_exception: MagicMock,
) -> None:
secondary_grouping_error = Exception("nope")
secondary_grouping_config = "legacy:2019-03-12"
secondary_grouping_config = LEGACY_GROUPING_CONFIG

def mock_calculate_event_grouping(project, event, grouping_config):
# We only want `_calculate_event_grouping` to error inside of `_calculate_secondary_hash`,
Expand All @@ -153,7 +153,7 @@ def mock_calculate_event_grouping(project, event, grouping_config):
return _calculate_event_grouping(project, event, grouping_config)

project = self.project
project.update_option("sentry:grouping_config", "newstyle:2023-01-11")
project.update_option("sentry:grouping_config", DEFAULT_GROUPING_CONFIG)
project.update_option("sentry:secondary_grouping_config", secondary_grouping_config)
project.update_option("sentry:secondary_grouping_expiry", time() + 3600)

Expand Down
Loading
Loading