Spring-cloud-sleuth: Improper order of

Created on 23 Mar 2018  Â·  18Comments  Â·  Source: spring-cloud/spring-cloud-sleuth

Sleuth v Finchley.M9
While processing request between Spring Cloud Gateway and final service Sleuth improperly ordered events. Please see attached screenshot.
screen shot 2018-03-23 at 08 18 19

To reproduce:
Use: https://github.com/czujnik81/api-gateway.git and https://github.com/czujnik81/final-service.git
Define ZIPKIN_URL env variable to point working ZIPKIN server (eg. http://localhost:9411) if api-gateway and final-service are running on different servers for gateway define also HOST env variable eg. localhost:9411. To run service url to eg. http://localhost:8080/contract/abc/file
Also notice improper client address on screenshot

bug feedback-provided icebox

All 18 comments

I looked at this and what you are seeing is likely explained by where measurements occur from. So, it isn't out-of-order, rather this is literally when the frameworks thought they were done.

On the client side, it is low-level netty bubbling up through reactor. The server is being measured from the servlet api. This is why you see the client think it is done a bit before the server did.

My guess is this isn't going to happen as much in practice as usually you will have different machines (which can likely wash out the 100us you are seeing here from client server on the same host).

While there are probably some things to slightly adjust in the servlet side, I wanted to give you an early answer that this isn't going to be handled with priority. If we get a lot of reports, we might, but right now it is explainable.

Hope this helps

I understand the reason, but the thing is that in the same runtime environment sometimes it's look like mentioned and sometimes it's properly ordered.
It's not high priority, but it's kind of deficiency.

anyway I will have a look, just wanted to warn you it might not resolve
today :P

PS thanks for the report. you did a good job

so the idea isn't lost.. one way to handle this it to move the server span lower on the stack, ex to netty for example. There would be some gotchas to handle (ex how to share http.route with netty), but it is possible (especially as brave has a netty filter already)

even if we don't recommend something like this routinely, it could make sense for gateways. cc @jkschneider

I ran into similar issue in testing environment with Finchley.BUILD-SNAPSHOT. Client side requests REST service, which is deployed on the same machine with client, by RestTemplate.getForObject(). And I see CR happens before SS.
image
However, sequence of SS and CR of feign client(@FeignClient) looks correct in the same scenario.

Any chance for a sample? Also does is always end like this for every request?

Yes, always the same for every request. Attached service-ribbon and service-hi project in my previous screenshot for your reference. Zipkin server jar file is the latest zipkin-server-2.8.3-exec.jar.
spring-cloud-client.zip
spring-cloud-service-ribbon.zip

Works on my machine ;)

screen shot 2018-05-23 at 12 04 04

I just unpacked and ran your examples. Should I do sth else to replicate the issue?

It is an extremely simple demo to help me learn spring cloud basic. I don't have any special configuration for eureka server and zipkin server.

My host OS is a windows 10 pro, and I launched these demo services from eclipse Mars version. Does that make difference with your test?

I have a mac and I've ran the apps from Intellij. I don't really know how to help you with this one since I can't replicate it :| Maybe if someone else has the same problem it will be easier to reproduce it.

Thanks all the same for your help. Maybe I will figure it out myself after deeper understanding of spring cloud :)

Is this still a problem?

Ok then, let's close it. We'll reopen it if someone confirms that the issue is back.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elgohr picture elgohr  Â·  21Comments

aasaru picture aasaru  Â·  23Comments

Diagoras picture Diagoras  Â·  19Comments

jackcat13 picture jackcat13  Â·  25Comments

marcingrzejszczak picture marcingrzejszczak  Â·  20Comments