Skip to content

Commit fe55639

Browse files
committed
Revert grouping, leave fingerprinting
1 parent 75d03e7 commit fe55639

2 files changed

Lines changed: 1 addition & 183 deletions

File tree

src/sentry/grouping/component.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
"exception": "exception",
2020
"stacktrace": "stacktrace",
2121
"threads": "thread",
22-
"thread_id": "thread-id",
23-
"thread_name": "thread-name",
2422
"hostname": "hostname",
2523
"violation": "violation",
2624
"uri": "URL",
@@ -273,10 +271,6 @@ class NSErrorGroupingComponent(
273271
id: str = "ns_error"
274272

275273

276-
class ThreadNameGroupingComponent(BaseGroupingComponent[str]):
277-
id: str = "thread_name"
278-
279-
280274
FrameGroupingComponentChild = (
281275
ContextLineGroupingComponent
282276
| FilenameGroupingComponent
@@ -465,28 +459,16 @@ class ThreadsGroupingComponent(BaseGroupingComponent[StacktraceGroupingComponent
465459
id: str = "threads"
466460
key: str = "thread_stacktrace"
467461
frame_counts: Counter[str]
468-
metadata: list[BaseGroupingComponent[str]]
469462

470463
def __init__(
471464
self,
472465
values: Sequence[StacktraceGroupingComponent] | None = None,
473466
hint: str | None = None,
474467
contributes: bool | None = None,
475468
frame_counts: Counter[str] | None = None,
476-
metadata: list[BaseGroupingComponent[str]] | None = None,
477469
):
478470
super().__init__(hint=hint, contributes=contributes, values=values)
479471
self.frame_counts = frame_counts or Counter()
480-
self.metadata = metadata or []
481-
482-
def iter_values(self) -> Generator[str | int]:
483-
"""Include both stacktrace values and metadata in hash calculation."""
484-
# First yield values from stacktrace components
485-
yield from super().iter_values()
486-
# Then yield values from metadata components
487-
for meta in self.metadata:
488-
if meta.contributes:
489-
yield from meta.iter_values()
490472

491473

492474
class CSPGroupingComponent(

tests/sentry/grouping/test_strategies.py

Lines changed: 1 addition & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
import pytest
44

5-
from sentry.grouping.api import load_grouping_config
6-
from sentry.grouping.component import (
7-
StacktraceGroupingComponent,
8-
ThreadNameGroupingComponent,
9-
ThreadsGroupingComponent,
10-
)
5+
from sentry.grouping.component import StacktraceGroupingComponent
116
from sentry.grouping.strategies.base import GroupingContext, create_strategy_configuration_class
127
from sentry.services.eventstore.models import Event
138
from sentry.testutils.cases import TestCase
@@ -304,162 +299,3 @@ def test_stacktrace_contribution_values_no_contributing_frames(self) -> None:
304299
assert (
305300
system_stacktrace_component.hint == "ignored because it contains no contributing frames"
306301
)
307-
308-
309-
class ThreadGroupingTest(TestCase):
310-
"""Tests for thread metadata in automatic grouping"""
311-
312-
def test_thread_name_grouping_enabled(self) -> None:
313-
"""Test that thread name contributes to grouping when enabled"""
314-
# Create two events with same stacktrace but different thread names
315-
# Use threads-only (no exception) to test thread grouping
316-
event_main_thread = save_new_event(
317-
{
318-
"threads": {
319-
"values": [
320-
{
321-
"id": "1",
322-
"name": "MainThread",
323-
"crashed": True,
324-
"current": False,
325-
"stacktrace": {
326-
"frames": [
327-
{"function": "query", "module": "app.db", "in_app": True}
328-
]
329-
},
330-
}
331-
]
332-
},
333-
},
334-
self.project,
335-
)
336-
337-
event_worker_thread = save_new_event(
338-
{
339-
"threads": {
340-
"values": [
341-
{
342-
"id": "2",
343-
"name": "WorkerThread",
344-
"crashed": True,
345-
"current": False,
346-
"stacktrace": {
347-
"frames": [
348-
{"function": "query", "module": "app.db", "in_app": True}
349-
]
350-
},
351-
}
352-
]
353-
},
354-
},
355-
self.project,
356-
)
357-
358-
# With thread name grouping enabled
359-
config_with_threads = load_grouping_config(
360-
{"id": "newstyle:2025-with-threads", "enhancements": None}
361-
)
362-
363-
variants_main = event_main_thread.get_grouping_variants(force_config=config_with_threads)
364-
variants_worker = event_worker_thread.get_grouping_variants(
365-
force_config=config_with_threads
366-
)
367-
368-
# They should have different hashes because thread names differ
369-
assert variants_main["app"].get_hash() is not None, "Main thread variant should have a hash"
370-
assert (
371-
variants_worker["app"].get_hash() is not None
372-
), "Worker thread variant should have a hash"
373-
assert (
374-
variants_main["app"].get_hash() != variants_worker["app"].get_hash()
375-
), "Different thread names should produce different hashes"
376-
377-
def test_thread_name_grouping_disabled(self) -> None:
378-
"""Test that without thread grouping, threads don't affect grouping"""
379-
event_main_thread = save_new_event(
380-
{
381-
"threads": {
382-
"values": [
383-
{
384-
"id": "1",
385-
"name": "MainThread",
386-
"crashed": True,
387-
"stacktrace": {
388-
"frames": [
389-
{"function": "query", "module": "app.db", "in_app": True}
390-
]
391-
},
392-
}
393-
]
394-
},
395-
},
396-
self.project,
397-
)
398-
399-
event_worker_thread = save_new_event(
400-
{
401-
"threads": {
402-
"values": [
403-
{
404-
"id": "2",
405-
"name": "WorkerThread",
406-
"crashed": True,
407-
"stacktrace": {
408-
"frames": [
409-
{"function": "query", "module": "app.db", "in_app": True}
410-
]
411-
},
412-
}
413-
]
414-
},
415-
},
416-
self.project,
417-
)
418-
419-
# Default config without thread grouping
420-
config_default = load_grouping_config({"id": "newstyle:2023-01-11", "enhancements": None})
421-
422-
variants_main = event_main_thread.get_grouping_variants(force_config=config_default)
423-
variants_worker = event_worker_thread.get_grouping_variants(force_config=config_default)
424-
425-
# They should have the same hash - thread name doesn't matter without the config
426-
assert variants_main["app"].get_hash() == variants_worker["app"].get_hash()
427-
428-
def test_thread_metadata_component_structure(self) -> None:
429-
"""Test that thread metadata components are structured correctly"""
430-
event = save_new_event(
431-
{
432-
"threads": {
433-
"values": [
434-
{
435-
"name": "MainThread",
436-
"crashed": True,
437-
"stacktrace": {"frames": [{"function": "main", "in_app": True}]},
438-
}
439-
]
440-
},
441-
},
442-
self.project,
443-
)
444-
445-
config = load_grouping_config({"id": "newstyle:2025-with-threads", "enhancements": None})
446-
447-
variants = event.get_grouping_variants(force_config=config)
448-
threads_component = variants["app"].contributing_component
449-
450-
# The contributing component should be a ThreadsGroupingComponent
451-
assert isinstance(threads_component, ThreadsGroupingComponent)
452-
453-
# Check that thread metadata is accessible
454-
assert len(threads_component.metadata) > 0, "Thread metadata should be present"
455-
456-
# Find the ThreadNameGroupingComponent in metadata
457-
thread_name_component = next(
458-
(m for m in threads_component.metadata if isinstance(m, ThreadNameGroupingComponent)),
459-
None,
460-
)
461-
assert (
462-
thread_name_component is not None
463-
), "ThreadNameGroupingComponent not found in metadata"
464-
assert thread_name_component.values == ["MainThread"]
465-
assert thread_name_component.contributes is True

0 commit comments

Comments
 (0)