Spring Boot actuator for backend application - spring

I use Spring-boot 2.2.x for my backend application - spring-kafka + streams. My service will be deployed in Kubernetes as Docker image. I would like to add spring-boot-starter-acutator, but as I checked, from Spring-boot 2.x actuator requires spring-boog-starter-web. And there is a question what is a proper way to use actuator over http and use http server only actuator - management scope/context?
I know that I can use jmx instead of http but I would prefer http.

Related

fix different traceId with istio sidecar proxy and spring boot sleuth

Spring boot apps with Sleuth are deployed in pods with istio sidecar injected alongside.
istio virtual service ingresses traffic into the mesh and proxies the request to pods correctly.
Both logs are seen in kibana - one for istio-proxy (sidecar) and another for the spring app using logback + sleuth.
However I would like to see same traceId (x-request-id) header for both requests. Is this a good practice or is rather what is the right way to join/tie these request logs ?
I did one test and found out that istio-proxy is sending 'x-request-id' which corresponds to the value of traceId. However spring creates a new traceId and wondering if there is a way to make them same ?

Any chance Spring Zuul updated for Spring boot 2.4.x?

TLDR
Any chance of getting spring cloud netflix zuul 1 running on spring boot 2.4?
Context:
We have an app that uses spring zuul 1 and runs on spring boot 2.3.x
zuul simply "doesn't work" on spring boot 2.4.x, i.e. wasn't updated to run on spring 2.4.x.
I would have expected to see 'deprecation' or 'end of life' warnings. Maybe I missed them.
Why we care
Spring boot 2.4.x adds nice functionality for building docker images; this functionaltiy doesn't work on spring 2.3.x .
e.g..
The generated image can be published to a Docker registry by enabling a publish option and configuring authentication for the registry using docker.publishRegistry properties.
https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/
Question
Any chance that zuul 1 maintainers will updat zuul 1 to run on spring 2.4? If so, when?
Any documentation on "migrating from zuul1 to spring cloud gateway"
We ran into a few 'gotchas' with zuul--so know that switching from zuul to spring cloud gateway might require non-trivial work.
Thanks!

How to cope with x-forwarded-headers in Spring Boot 2.2.0? (Spring Web MVC behind reverse proxy)

My Spring Boot 2.2.0 application with Spring Web MVC is running behind a reverse proxy. How can Spring cope properly with X-Forwarded-{Prefix,Host,Proto}-headers to recognize the actual request made to the server?
With Spring Boot <= 2.1.x you had to provide a ForwardedHeaderFilter-Bean. Since Spring Boot 2.2.0 you don't have to do this anymore. Just add server.forward-headers-strategy=NATIVE or server.forward-headers-strategy=FRAMEWORK to your application.properties-file.
NATIVE means that the servlet container (e.g. undertow, tomcat) is resolving the x-forwarded-*-headers which is fine in most cases. If you rely on X-Forwarded-Prefix than you must use FRAMEWORK so that request.getContextPath() is set properly.
Example:
User types into browser: https://mydomain.tld/my-microservice/actuator
the microservice "my-microservice" (e.g. user-service) shall handle the request; it's running on localhost:8080
reverse-proxy forwards the request like this:
// Forwarded-Request from Reverse Proxy to your microservice
GET http://localhost:8080/actuator/
X-Forwarded-Host: mydomain.tld
X-Forwarded-Proto: https
X-Forwarded-Prefix: /my-microservice
Debugging into a HttpServletRequest will result in:
request.getRequestURL(): "https://mydomain.tld/my-microservice/actuator/"
request.getScheme(): "https"
request.getContextPath(): "/my-microservice"
new UrlPathHelper().getPathWithinApplication(request): "/actuator"

How we can integrate Springboot 2.x with Zuul 2

We have a springboot application which is currently having gateway as Zuul 1. Our application is running in Springboot 2.0.0.M2. We are trying to upgrade our Zuul gateway to Zuul 2. We created a springboot application with Zuul 2 dependency and added webflux dependency to get Netty server. The server starts fine, but we are still unclear that how the springboot application will understand that this is a gateway and filters needs to be executed. Although we have created Routes filter, but the same is not getting invoked.
Thanks in advance,
Ron
if you go through the video "https://www.youtube.com/watch?v=9wocKqF15B8" at 18:00 from spring developers. They clearly stated that zuul2 is not going to be supported by the spring ecosystem. Also, the replacement of zuul2 (non-blocking calls) is a spring cloud gateway which is also non-blocking calls.

Spring Boot Actuator + Java Melody

I'm using the actuator sub project in my spring boot application. I configured the address and the port of the actuator management functions in the application.properties to separate the monitoring traffic from the production traffic.
management.address=127.0.0.1
management.port=8081
Additionally I want to use java melody and I want to provide the java melody dashboard on the same connection pool as the actuator endpoints. So finally the java melody dashboard should be provided by localhost:8081/monitoring, not(!) by localhost:8080/monitoring.
How can I do that?
You can now use the spring-boot management port (e.g. 8081) for the monitoring page instead of the application http port (e.g. 8080), since javamelody-spring-boot-starter 1.76.
See doc:
https://github.com/javamelody/javamelody/wiki/SpringBootStarter#configuration-in-case-of-management-port

Resources