fix different traceId with istio sidecar proxy and spring boot sleuth - spring

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 ?

Related

Spring Boot actuator for backend application

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.

Spring Opentracing Jaeger header forwarding with Istio

I'm running Spring with the opentracing-spring-jaeger-web-starter in Istio with jaeger, even when I enable b3-propagation and w3c-propagation, jaeger is breaking the spans.
Is there a way to validate what the sidecar receives? I tried using WebClient and RestTemplate, same result with both. I don't want to forward the header manually in the controller.

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.

Turbine stream double port binding issue

I'm using Spring Boot 1.5.4 and Spring Cloud Dalston SR4 to stand up a Turbine server on Cloud Foundry and aggregate my application Hystrix streams. In addition I want to add Spring Boot Actuator monitoring and management to the Turbine server. I realize there is ample documentation on how to do this in a local environment and I do have it working locally. However it is a different matter when deploying to Cloud Foundry where I cannot use port numbers in a Url binding.
The issue is that the Turbine stream is provided by an RxNetty server on one port and the Actuator endpoints are provided by via Tomcat on another port. In Cloud Foundry I can only bind my Url to RxNetty endpoint or the Tomcat endpoint, not both.
No combination of management.port and turbine.stream.port allows me to access the turbine stream and the actuator endpoints from one host binding. The following is an example of what I would expect to be able to do:-
https://myapp.mydomain.com/info (to report actuator info details)
https://myapp.mydomain.com/turbine.stream (to stream turbine metrics)
Note: There are no port numbers in these Urls.
Requests to your app on Cloud Foundry go through the Cloud Foundry Go Router, which uses the http host header to direct traffic to all the container instances running your app. The http based gorouter expecter only one port to be opened by the app to forward http traffic to. However, the gorouter also support tcp routing which should allow you to have multiple ports open. see the docsfor an explanation of tcp vs. http routes on cloud foundry.
If you are running on Pivotal Cloud Foundry you can use the Circuit Breaker Dashboard provided by Spring Cloud Serviecs for PCF then you won't need to setup the turbine stream. The Spring Cloud Services Dashboard uses RabbitMQ instead of SSE events see SCS docs for details
Just getting back to this now. As noted by spencergibb, moving to springboot 2.0 and cloud Finchley works.

Spring Boot health checks for non-web apps

After reading up on the Spring Boot Actuator features, specifically the health endpoint, I've found it quite useful for implementing docker container health checks for some of my services.
However some of my services are not webapps, and it seems like overkill to enable HTTP just to allow the container to check the app is up and running. Looking through the options, actuator seems to support HTTP endpoints, JMX, and SSH/Telnet, though that last one apparently requires you to be running a JDK, and is going away in boot 2.0.
Are there any established ways of doing container healthchecks for non-web spring boot apps?

Resources