getappmap / appmap-java

AppMap client agent for Java
Other
80 stars 14 forks source link

Spring Pet Clinic AppMaps show HTTP server requests separate from the request processing code #263

Open kgilpin opened 5 months ago

kgilpin commented 5 months ago

I'm adding some authentication logic to the Spring Pet Clinic. I've pushed the code here:

The AppMaps show the Spring doFilter logic in a kind of separate context from the request. It's hard to explain, here's what I mean:

Screen Shot 2024-03-05 at 8 46 16 AM

AppMap attached:

1709612302_179__login.appmap.json

apotterri commented 5 months ago

My comment from Slack thread:

Ok, I took a look at this. There's no thread-related weirdness here. The AppMap looks a little weird because you've asked to instrument some of the Spring internals. So, the agent starts recording when Spring tells it that an HTTP request is starting. Next, the call to Spring's org.springframework.security.web.authentication.logout.LogoutFilter.doFilter gets added to the recording. Finally, the call to javax.servlet.http.HttpServlet.service adds the http_server_request event. It's possible we could fix this by moving the creation of the http_server_request event into the listener that starts the recording. I'd need to do some investigation to be sure.