Reading Operation Data: Non-persistent
Learn how to trace HTTP calls with /actuator/httptrace.
We'll cover the following
Tracing HTTP calls with /actuator/httptrace
Spring Boot Actuator provides a convenient way to see who’s making calls to our application. Along with that comes a whole host of questions.
-
What types of clients are most popular? Mobile? Or a certain browser?
-
Are people making requests in certain languages? Do we need internationalization?
-
Which endpoints are being hit the most? From where?
This is the type of data analysis that can help us tailor our site to match customer needs, and to switch it on in a snap!
Spring Boot provides the HttpTraceRepository
interface. Any registered bean that implements this interface is picked up and automatically used to service
calls to /actuator/httptrace
.
“Any registered bean” means that Spring Boot doesn’t automatically provide that type of bean. Instead, we must make the choice and create one.
To get familiar with this endpoint, we can use an out-of-the-box memory-based
version of this interface, the InMemoryHttpTraceRepository
.
We can easily add this bean definition to the class where we defined the Spring
Boot application runner:
Get hands-on with 1400+ tech skills courses.