Browse Source

fix(profiling): Filter out system frame only stacks (#46192)

Showing stacks that only have system frames is not a good experience
because we collapse system frames and they're not immediately
actionable. This change removes stacks do not contain any application
frames.
Tony Xiao 1 year ago
parent
commit
419614ef32
1 changed files with 14 additions and 2 deletions
  1. 14 2
      static/app/components/events/interfaces/spans/spanProfileDetails.tsx

+ 14 - 2
static/app/components/events/interfaces/spans/spanProfileDetails.tsx

@@ -24,7 +24,7 @@ import {useProfileGroup} from 'sentry/views/profiling/profileGroupProvider';
 
 import {SpanType} from './types';
 
-const MAX_STACK_DEPTH = 16;
+const MAX_STACK_DEPTH = 8;
 const MAX_TOP_NODES = 5;
 const MIN_TOP_NODES = 3;
 const TOP_NODE_MIN_COUNT = 3;
@@ -81,7 +81,9 @@ export function SpanProfileDetails({event, span}: SpanProfileDetailsProps) {
       profile.unit
     );
 
-    return getTopNodes(profile, relativeStartTimestamp, relativeStopTimestamp);
+    return getTopNodes(profile, relativeStartTimestamp, relativeStopTimestamp).filter(
+      hasApplicationFrame
+    );
   }, [profile, span, event]);
 
   const [index, setIndex] = useState(0);
@@ -284,6 +286,16 @@ function sortByCount(a: CallTreeNode, b: CallTreeNode) {
   return b.count - a.count;
 }
 
+function hasApplicationFrame(node: CallTreeNode | null) {
+  while (node && !node.isRoot) {
+    if (node.frame.is_application) {
+      return true;
+    }
+    node = node.parent;
+  }
+  return false;
+}
+
 function extractFrames(node: CallTreeNode | null, platform: PlatformType): Frame[] {
   const frames: Frame[] = [];