@@ -67,19 +67,33 @@ public ClassNameFiltering getClassNameFiltering() {
6767 return classNameFiltering ;
6868 }
6969
70- public boolean createProbesForException (StackTraceElement [] stackTraceElements ) {
71- boolean created = false ;
72- int maxFrames = maxCapturedFrames ;
70+ static class CreationResult {
71+ final int probesCreated ;
72+ final int thirdPartyFrames ;
73+ final int nativeFrames ;
74+
75+ public CreationResult (int probesCreated , int thirdPartyFrames , int nativeFrames ) {
76+ this .probesCreated = probesCreated ;
77+ this .thirdPartyFrames = thirdPartyFrames ;
78+ this .nativeFrames = nativeFrames ;
79+ }
80+ }
81+
82+ public CreationResult createProbesForException (StackTraceElement [] stackTraceElements ) {
83+ int instrumentedFrames = 0 ;
84+ int nativeFrames = 0 ;
85+ int thirdPartyFrames = 0 ;
7386 for (StackTraceElement stackTraceElement : stackTraceElements ) {
74- if (maxFrames <= 0 ) {
87+ if (instrumentedFrames >= maxCapturedFrames ) {
7588 break ;
7689 }
7790 if (stackTraceElement .isNativeMethod () || stackTraceElement .getLineNumber () < 0 ) {
7891 // Skip native methods and lines without line numbers
79- // TODO log?
92+ nativeFrames ++;
8093 continue ;
8194 }
8295 if (classNameFiltering .isExcluded (stackTraceElement .getClassName ())) {
96+ thirdPartyFrames ++;
8397 continue ;
8498 }
8599 Where where =
@@ -89,11 +103,10 @@ public boolean createProbesForException(StackTraceElement[] stackTraceElements)
89103 null ,
90104 String .valueOf (stackTraceElement .getLineNumber ()));
91105 ExceptionProbe probe = createMethodProbe (this , where );
92- created = true ;
93106 probes .putIfAbsent (probe .getId (), probe );
94- maxFrames -- ;
107+ instrumentedFrames ++ ;
95108 }
96- return created ;
109+ return new CreationResult ( instrumentedFrames , thirdPartyFrames , nativeFrames ) ;
97110 }
98111
99112 void addFingerprint (String fingerprint ) {
0 commit comments