wavefrontHQ / wavefront-spring-boot

Spring Boot starter for Wavefront
Apache License 2.0
29 stars 31 forks source link

"/actuator/wavefront" does not work with Spring Reactive Web #121

Open yogendra opened 3 years ago

yogendra commented 3 years ago

Wavefront dashboard url redirection does not work on Spring Reactive Web project.

I created 2 projects (see links below) and added management.endpoints.web.exposure.include=health,info,wavefront to application.propoerties on both project. On accessting /actuator/wavefront location, on reactive web project, I am not redirected to Wavefront dashboard.

Reactive Web Project Starter: https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.1.RELEASE&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=catalog&name=catalog&description=Spring%20Boot%20Metrics%20and%20Tracing%20%2F%2F%20Catalog%20Service&packageName=com.example.catalog&dependencies=actuator,lombok,cloud-starter-sleuth,wavefront,devtools,webflux

Web Starter Project: https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.1.RELEASE&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=catalogweb&name=catalogweb&description=Spring%20Boot%20Metrics%20and%20Tracing%20%2F%2F%20Catalog%20Service&packageName=com.example.catalogweb&dependencies=actuator,lombok,cloud-starter-sleuth,wavefront,devtools,web

snicoll commented 3 years ago

@yogendra thanks for the report, I've reproduced a problem where with WebFlux I get a 404 instead of the redirection:

2021-06-24 06:46:16.005 DEBUG 14211 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] HTTP GET "/actuator/wavefront"
2021-06-24 06:46:16.043 DEBUG 14211 --- [ctor-http-nio-2] o.s.w.r.handler.SimpleUrlHandlerMapping  : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] Mapped to ResourceWebHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"]
2021-06-24 06:46:16.047 DEBUG 14211 --- [ctor-http-nio-2] o.s.w.r.resource.ResourceWebHandler      : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] Resource not found
2021-06-24 06:46:16.096 DEBUG 14211 --- [ctor-http-nio-2] a.w.r.e.AbstractErrorWebExceptionHandler : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] Resolved [ResponseStatusException: 404 NOT_FOUND] for HTTP GET /actuator/wavefront
2021-06-24 06:46:16.110 DEBUG 14211 --- [ctor-http-nio-2] o.s.core.codec.CharSequenceEncoder       : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] Writing "<html><body><h1>Whitelabel Error Page</h1><p>This application has no configured error view, so you  (truncated)...
2021-06-24 06:46:16.153 DEBUG 14211 --- [ctor-http-nio-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [44365fdb-1, L:/127.0.0.1:8080 - R:/127.0.0.1:57614] Completed 404 NOT_FOUND

I suspect a bug outside of this project so I'll experiment a bit more and report when I know more. Thanks again.

yogendra commented 3 years ago

Yeah. I suspect need to put GetMapping annotation on the url.

Thanks for responding

snicoll commented 3 years ago

The infrastructure relies on RestTemplate and backs off if that's not present. In a WebFlux app, a WebClient is provided so we'll have to adapt our arrangement to support both or rely on something common. I'll give it some more thoughts.

yogendra commented 3 years ago

I was trying to understand the code myself. Then I looked at the actuator project for reference. Perhaps a conditional configuration will be better. So we can setup one or the other.

linghengqian commented 2 years ago

This doesn't actually affect the use of Spring Reactive Web, right?

snicoll commented 2 years ago

No.