@@ -611,91 +611,72 @@ def assemble_stacktrace_component(
611
611
"""
612
612
613
613
with metrics .timer ("grouping.enhancements.get_contributes_and_hint" ) as metrics_timer_tags :
614
- metrics_timer_tags .update ({"split" : False , "variant" : variant_name })
614
+ metrics_timer_tags .update ({"split" : True , "variant" : variant_name })
615
615
616
- # TODO: Fix this type to list[MatchFrame] once it's fixed in ophio
617
- match_frames : list [Any ] = [create_match_frame (frame , platform ) for frame in frames ]
618
-
619
- rust_frames = [RustFrame (contributes = c .contributes ) for c in frame_components ]
620
616
rust_exception_data = make_rust_exception_data (exception_data )
621
617
622
- # Modify the rust frames by applying +group/-group rules and getting hints for both those
623
- # changes and the `in_app` changes applied by earlier in the ingestion process by
624
- # `apply_category_and_updated_in_app_to_frames`. Also, get `hint` and `contributes` values
625
- # for the overall stacktrace (returned in `rust_results`).
626
- rust_stacktrace_results = self .rust_enhancements .assemble_stacktrace_component (
627
- match_frames , rust_exception_data , rust_frames
628
- )
629
-
630
- if self .run_split_enhancements :
631
- with metrics .timer (
632
- "grouping.enhancements.get_contributes_and_hint"
633
- ) as metrics_timer_tags :
634
- metrics_timer_tags .update ({"split" : True , "variant" : variant_name })
635
-
636
- # Create a set of rust frames to which we can ask rust to add in-app hints. (We know all
637
- # hints generated by classifier enhancements are in-app by definition.)
638
- in_app_rust_frames = [EmptyRustFrame () for frame in frames ]
639
- # Only spend the time to get in-app hints if we might use them
640
- if variant_name == "app" :
641
- self .classifier_rust_enhancements .assemble_stacktrace_component (
642
- match_frames , rust_exception_data , in_app_rust_frames
643
- )
644
-
645
- # Do the same for contributes hints, this time using the contributes enhancements. These
646
- # rust frames will also collect `contributes` values, along with the `contributes` and
647
- # `hint` values for the stacktrace.
648
- contributes_rust_frames = [
649
- RustFrame (contributes = c .contributes ) for c in frame_components
650
- ]
651
- contributes_match_frames = [
652
- # We don't want to include `orig_in_app` here because otherwise +/-group hints can
653
- # get clobbered by +/-app hints
654
- {** match_frame , "orig_in_app" : None }
655
- for match_frame in match_frames
656
- ]
657
- rust_stacktrace_results_split = (
658
- self .contributes_rust_enhancements .assemble_stacktrace_component (
659
- contributes_match_frames , rust_exception_data , contributes_rust_frames
660
- )
618
+ # Create a set of rust frames to which we can ask rust to add in-app hints. (We know all
619
+ # hints generated by classifier enhancements are in-app by definition.)
620
+ in_app_rust_frames = [EmptyRustFrame () for frame in frames ]
621
+ # TODO: Fix this type to list[MatchFrame] once it's fixed in ophio
622
+ in_app_match_frames : list [Any ] = [
623
+ create_match_frame (frame , platform ) for frame in frames
624
+ ]
625
+ # Only spend the time to get in-app hints if we might use them
626
+ if variant_name == "app" :
627
+ self .classifier_rust_enhancements .assemble_stacktrace_component (
628
+ in_app_match_frames , rust_exception_data , in_app_rust_frames
661
629
)
662
630
663
- else :
664
- # We need to give these values so the zip below will work, but we're not going to use
665
- # them if we're not running split enhancements, so we can just reuse the regular results
666
- in_app_rust_frames = contributes_rust_frames = rust_frames
667
- rust_stacktrace_results_split = rust_stacktrace_results
631
+ # Do the same for contributes hints, this time using the contributes enhancements. These
632
+ # rust frames will also collect `contributes` values, along with the `contributes` and
633
+ # `hint` values for the stacktrace.
634
+ contributes_rust_frames = [
635
+ RustFrame (contributes = c .contributes ) for c in frame_components
636
+ ]
637
+ contributes_match_frames = [
638
+ # We don't want to include `orig_in_app` here because otherwise +/-group hints can
639
+ # get clobbered by +/-app hints
640
+ {** match_frame , "orig_in_app" : None }
641
+ for match_frame in in_app_match_frames
642
+ ]
643
+ rust_stacktrace_results = (
644
+ self .contributes_rust_enhancements .assemble_stacktrace_component (
645
+ contributes_match_frames , rust_exception_data , contributes_rust_frames
646
+ )
647
+ )
668
648
669
649
# Tally the number of each type of frame in the stacktrace. Later on, this will allow us to
670
650
# both collect metrics and use the information in decisions about whether to send the event
671
651
# to Seer
672
652
frame_counts : Counter [str ] = Counter ()
673
653
674
654
# Update frame components with results from rust
675
- for frame , frame_component , rust_frame , in_app_rust_frame , contributes_rust_frame in zip (
676
- frames , frame_components , rust_frames , in_app_rust_frames , contributes_rust_frames
655
+ for frame , frame_component , in_app_rust_frame , contributes_rust_frame in zip (
656
+ frames , frame_components , in_app_rust_frames , contributes_rust_frames
677
657
):
678
658
# System frames should never contribute in the app variant, so if that's what we have,
679
659
# force `contribtues=False`, regardless of the rust results
680
660
if variant_name == "app" and not frame_component .in_app :
681
661
contributes = False
682
662
else :
683
- contributes = rust_frame .contributes
663
+ contributes = bool ( # bool-ing this to please mypy
664
+ contributes_rust_frame .contributes
665
+ )
684
666
685
667
frame_component .update (contributes = contributes )
686
668
687
- hint = get_hint_for_frame (variant_name , frame , frame_component , rust_frame )
688
- if self .run_split_enhancements :
689
- split_in_app_hint = (
690
- get_hint_for_frame (
691
- variant_name , frame , frame_component , in_app_rust_frame , "in-app"
692
- )
693
- if variant_name == "app"
694
- else None # In-app hints don't apply to the system stacktrace
695
- )
696
- split_contributes_hint = get_hint_for_frame (
697
- variant_name , frame , frame_component , contributes_rust_frame , "contributes"
669
+ in_app_hint = (
670
+ get_hint_for_frame (
671
+ variant_name , frame , frame_component , in_app_rust_frame , "in-app"
698
672
)
673
+ if variant_name == "app"
674
+ else None # In-app hints don't apply to the system stacktrace
675
+ )
676
+ contributes_hint = get_hint_for_frame (
677
+ variant_name , frame , frame_component , contributes_rust_frame , "contributes"
678
+ )
679
+ hint = _combine_hints (variant_name , frame_component , in_app_hint , contributes_hint )
699
680
700
681
frame_component .update (hint = hint )
701
682
0 commit comments