Profiling Springboot app does not show REST methods

Questions about YourKit Java Profiler
Post Reply
natnaelg
Posts: 2
Joined: Tue Dec 11, 2018 1:16 am

Profiling Springboot app does not show REST methods

Post by natnaelg »

When profiling Springboot app, REST method calls are not being displayed under CPU tab -> Method list.

For testing purpose, I wrote the following slow code and made request while profiling.

@RequestMapping(value = "/test", method = RequestMethod.GET)
public void testMethod() {
Set<String> list = new HashSet<>();
String str = "";
for(int j=0; j<5000; j++) {
str += java.util.UUID.randomUUID().toString();
list.add(str);
}
System.out.println(str);
}

When making request to the REST endpoint, testMethod() is not being displayed on method list.

Image

I also tried creating snapshot and searching for the respective method, but no luck.

Image


Thanks in advance for the support.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Could you please provide the snapshot file. Please send the download link to [email protected]
natnaelg
Posts: 2
Joined: Tue Dec 11, 2018 1:16 am

Re: Profiling Springboot app does not show REST methods

Post by natnaelg »

Hi Anton,

I have emailed the snapshot file to [email protected]

Thanks.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Hi,

We answered your email.

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Update: the problem was with default filters.
ravikgupta
Posts: 3
Joined: Wed Feb 09, 2022 4:12 pm

Re: Profiling Springboot app does not show REST methods

Post by ravikgupta »

I am also running into the same issue. Can you please point out the exact fix?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Please check the filters: https://www.yourkit.com/docs/java/help/filters.jsp

If changing the filters doesn't help, could you please describe your problem.

Which profiler version do you use?
Which profiling mode do you use (sampling, tracing)?
Which method is missing in your case?
ravikgupta
Posts: 3
Joined: Wed Feb 09, 2022 4:12 pm

Re: Profiling Springboot app does not show REST methods

Post by ravikgupta »

I disabled all the filters but no luck. Here is the information requested.

Which profiler version do you use?
2021.3-b235
Which profiling mode do you use (sampling, tracing)?
Sampling
Which method is missing in your case?
Spring REST controller method shows as JSP/Servlet calls without any option to further drill down. I added the agent to JVM startup arguments and connected YK to the running JVM.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Spring REST controller method shows as JSP/Servlet calls without any option to further drill down.
Do you mean the "Call tree" in CPU tab?

Event nodes such as for JSP calls are shown in the call tree as subnodes of the caller method. The methods called from the caller (the callees) are also shown as the caller's subnodes, i.e. alongside the event node(s) if any. (Do you see the callees?) There is no method call tree per particular event, so it's not possible to expand the event node itself. The call tree is always cumulative. Events in the call tree let immediately indicate methods with associated high level activities. Event detail can be found in the "Events" tab.
ravikgupta
Posts: 3
Joined: Wed Feb 09, 2022 4:12 pm

Re: Profiling Springboot app does not show REST methods

Post by ravikgupta »

Thanks, Anton.

If I have understood your explanation, the events and corresponding methods should all be part of the call tree. Events would be terminating node but it's the corresponding method ( let's say doGet of a servlet) as called methods.

If so, then I have a follow-up query. I see a lot of mismatches in the timings reported for the event and corresponding called methods. What else does event CPU time include?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Profiling Springboot app does not show REST methods

Post by Anton Katilin »

Yes, you understood correctly.

Did you use CPU sampling? With sampling, most method times are measured as CPU time by default:
https://www.yourkit.com/docs/java/help/times.jsp

Events are always measured as wall time which is naturally greater than corresponding CPU time. Because the event is shown in the tree, its caller method time is corrected to be not less than total time of its children, hence may be the difference.

Please try sampling with wall time for all methods by choosing corresponding preset in the sampling settings dialog to check if the difference is reduced or eliminated:
https://www.yourkit.com/docs/java/help/ ... ttings.jsp

Another explanation could be that not all events have been written for some reason.

Please also note that sampling time measurement accuracy is naturally lower than the event duration measurement accuracy. Sampled times are estimated with accuracy depending on the sampling interval, while an event duration can be measured exactly.
Post Reply