|
8 | 8 | from typing import TYPE_CHECKING, Any |
9 | 9 |
|
10 | 10 | from sentry.grouping.component import ( |
11 | | - BaseGroupingComponent, |
12 | 11 | ChainedExceptionGroupingComponent, |
13 | 12 | ContextLineGroupingComponent, |
14 | 13 | ErrorTypeGroupingComponent, |
|
23 | 22 | NSErrorDomainGroupingComponent, |
24 | 23 | NSErrorGroupingComponent, |
25 | 24 | StacktraceGroupingComponent, |
26 | | - ThreadNameGroupingComponent, |
27 | 25 | ThreadsGroupingComponent, |
28 | 26 | ) |
29 | 27 | from sentry.grouping.strategies.base import ( |
@@ -615,10 +613,19 @@ def single_exception( |
615 | 613 | ) |
616 | 614 |
|
617 | 615 | values: list[ExceptionGroupingComponentChildren] = [] |
| 616 | + |
618 | 617 | if ns_error_component is not None: |
619 | | - values = [stacktrace_component, type_component, ns_error_component, value_component] |
| 618 | + values = [type_component, value_component, ns_error_component, stacktrace_component] |
620 | 619 | else: |
621 | | - values = [stacktrace_component, type_component, value_component] |
| 620 | + values = [type_component, value_component, stacktrace_component] |
| 621 | + |
| 622 | + # TODO: Once we're fully transitioned off of the `newstyle:2023-01-11` config, the code here |
| 623 | + # (and the option controlling it) can be deleted |
| 624 | + if context.get("use_legacy_exception_subcomponent_order"): |
| 625 | + if ns_error_component is not None: |
| 626 | + values = [stacktrace_component, type_component, ns_error_component, value_component] |
| 627 | + else: |
| 628 | + values = [stacktrace_component, type_component, value_component] |
622 | 629 |
|
623 | 630 | exception_components_by_variant[variant_name] = ExceptionGroupingComponent( |
624 | 631 | values=values, frame_counts=stacktrace_component.frame_counts |
@@ -875,46 +882,24 @@ def threads( |
875 | 882 | def _get_thread_components( |
876 | 883 | threads: list[dict[str, Any]], event: Event, context: GroupingContext, **kwargs: dict[str, Any] |
877 | 884 | ) -> ComponentsByVariant | None: |
878 | | - # Only process single-thread scenarios (existing behavior) |
879 | | - # Multiple threads are ambiguous for grouping |
880 | 885 | if len(threads) != 1: |
881 | 886 | return None |
882 | 887 |
|
883 | | - thread = threads[0] |
884 | | - stacktrace = thread.get("stacktrace") |
885 | | - |
886 | | - # Check if config enables thread name in grouping via initial_context |
887 | | - include_thread_name = context.get("include_thread_name_in_grouping", False) |
888 | | - |
889 | | - # Collect thread metadata components (only thread name, as IDs are random) |
890 | | - thread_metadata: list[BaseGroupingComponent[str]] = [] |
891 | | - if include_thread_name and thread.get("name"): |
892 | | - thread_metadata.append( |
893 | | - ThreadNameGroupingComponent( |
894 | | - values=[thread["name"]], |
895 | | - contributes=True, |
896 | | - hint="thread name included in grouping", |
897 | | - ) |
898 | | - ) |
899 | | - |
900 | | - # If no stacktrace, return early (thread metadata can't group without frames) |
| 888 | + stacktrace = threads[0].get("stacktrace") |
901 | 889 | if not stacktrace: |
902 | 890 | return { |
903 | 891 | "app": ThreadsGroupingComponent( |
904 | 892 | contributes=False, hint="ignored because thread has no stacktrace" |
905 | 893 | ) |
906 | 894 | } |
907 | 895 |
|
908 | | - # Build stacktrace components for each variant with thread metadata |
909 | 896 | thread_components_by_variant = {} |
910 | 897 |
|
911 | 898 | for variant_name, stacktrace_component in context.get_grouping_components_by_variant( |
912 | 899 | stacktrace, event=event, **kwargs |
913 | 900 | ).items(): |
914 | 901 | thread_components_by_variant[variant_name] = ThreadsGroupingComponent( |
915 | | - values=[stacktrace_component], |
916 | | - frame_counts=stacktrace_component.frame_counts, |
917 | | - metadata=thread_metadata, |
| 902 | + values=[stacktrace_component], frame_counts=stacktrace_component.frame_counts |
918 | 903 | ) |
919 | 904 |
|
920 | 905 | return thread_components_by_variant |
|
0 commit comments