Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"httptrace" endpoint of Spring Boot Actuator doesn't exist anymore with Spring Boot 2.2.0

With Spring Boot 2.2.0 the "httptrace" Actuator endpoint doesn't exist anymore. How can I get this functionality back?

like image 760
phip1611 Avatar asked Nov 30 '19 11:11

phip1611


People also ask

Which endpoint is Spring Boot actuator?

We can use HTTP and JMX endpoints to manage and monitor the Spring Boot application. If we want to get production-ready features in an application, we should use the Spring Boot actuator.

Which endpoint is disabled by default in Spring Boot actuator?

In order to access the actuator endpoints using HTTP, we need to both enable and expose them. By default, all endpoints but /shutdown are enabled. Only the /health and /info endpoints are exposed by default.

How do I create a custom actuator endpoint in Spring Boot?

To create a custom actuator endpoints, Use @Endpoint annotation on a class. Then leverage @ReadOperation / @WriteOperation / @DeleteOperation annotations on the methods to expose them as actuator endpoint bean as needed.


2 Answers

The functionality has been removed by default in Spring Boot 2.2.0. To fix it, add this configuration to the Spring environment:

management.endpoints.web.exposure.include: httptrace 

and provide a HttpTraceRepository bean like this:

@Configuration // @Profile("actuator-endpoints") /* if you want: register bean only if profile is set */ public class HttpTraceActuatorConfiguration {      @Bean     public HttpTraceRepository httpTraceRepository() {         return new InMemoryHttpTraceRepository();     }  } 

http://localhost:8080/actuator/httptrace works again.

like image 186
phip1611 Avatar answered Sep 21 '22 01:09

phip1611


You need to enable httptrace by having following application properties. By default it is disabled

management.trace.http.enabled: true management.endpoints.web.exposure.include: httptrace 

and Requires an HttpTraceRepository bean. You can use Your own Custom implementation or InMemoryHttpTraceRepository

like image 31
ravthiru Avatar answered Sep 20 '22 01:09

ravthiru