25

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

phip1611
  • 2,860
  • 3
  • 20
  • 32

2 Answers2

51

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.

phip1611
  • 2,860
  • 3
  • 20
  • 32
3

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

ravthiru
  • 6,418
  • 2
  • 31
  • 44
  • Hi! Unfortunately this is not right. At least not for Spring Boot 2.2.0 and above. See release notes :)https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2.0-M3-Release-Notes#actuator-http-trace-and-auditing-are-disabled-by-default – phip1611 Jan 14 '20 at 07:12
  • What is not right, i have tested it with 2.2.2.RELEASE, i found the information from documentation https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints-exposing-endpoints – ravthiru Jan 14 '20 at 22:41
  • Well... strange .. according to the official 2.2.0 release notes one has to provide a bean and that's the only way I got it work (https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes) – phip1611 Jan 15 '20 at 10:24
  • this worked for me. thanks ravthiru, missleading post comment by phip1611... – Facundo Laxalde Apr 28 '20 at 14:38
  • @FacundoLaxalde @ravthiru I have an update on this. `management.endpoints.web.exposure.include: httptrace (or '*')` is definetly required, yes. But according to the release notes (and my own testing) `management.trace.http.enabled: true` is not required, although it can be used to disable this feature even if a HttpTraceRepository bean is present. Sorry for the circumstances! – phip1611 Jun 02 '20 at 12:45