New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support W3C - no relationship between parentid and spanid #1945
Comments
I adopted this class https://github.com/spring-cloud/spring-cloud-sleuth/blob/main/spring-cloud-sleuth-brave/src/main/java/org/springframework/cloud/sleuth/brave/bridge/W3CPropagation.java from https://github.com/open-telemetry/opentelemetry-java/blob/main/api/all/src/main/java/io/opentelemetry/api/trace/propagation/W3CTraceContextPropagator.java (I'm linking the current version, I have copied it a couple of months ago). I wonder if it has changed in the meantime, cause if it has then I have to adopt the changes too. Before we do a more thorough analysis of the issue. are you willing to do a short analysis of whether there are changes between the two? |
Hi Marcin, I have been checking the last couple of months and the only changes they seem to have introduced are related to some validations on the format of traceparent and tracestate and null control so they don't seem to affect the overall behavior. To try to clarify further, what I expected to receive on micro 2 was a traceparent header with the following value: 00-609a534e112b3e7b920264c8e933aae5-26e3ebadac5aeecc-01 Honestly, I don't know if this is an issue or not, in which case I have to understand that it has been implemented this way for some reason. The specification seems somewhat ambiguous on this point but there are references describing the expected behavior, e.g. -> https://sgryphon.wordpress.com/2020/11/16/a-guide-to-w3c-trace-context/ Thank you very much. |
Hi Varania, do you have a small sample that replicates this issue? I don't want to guess what the problem might be (what comes to my mind is that a client span for e.g. a |
Hi, I am getting the same error. I am using spring-cloud-starter-sleuth : 3.0.3. My scenario: To capture traceId, spanId and parentId, I am using Sleuth's @Autowired Tracer then tracer.currentSpan().context().traceId(), tracer.currentSpan().context().spanId() and tracer.currentSpan().context().parentId() respectively. Is this issue fixed or are there any alternatives? |
Nothing is fixed cause I don't understand what the problem is. Can someone actually create a simple sample that reproduces the problem? |
Hi Marcin, I will upload a simple sample this week. |
I have uploaded a sample here, https://github.com/sr325/kafka-tracer. Producer log Consumer log Use case I have simply used spring-cloud-sleuth to generate traces and @Autowired Sleuth's tracer to generate traceId, spanId and parentId. Thanks. |
I am communicating via Kafka 2.7.0 (kafka_2.12-2.7.0.tgz). Problem statement: Consumer log, traceId is 3a105242f3aa175d and parentId is 654c6c202519f923. Here parentId is not the spanId from producer as expected. I am using org.springframework.cloud.sleuth.Tracer to trace these ids. |
So parent 654... is from the |
Hello again Marcin, I apologize for not being able to respond until now. I have done a test with spring-boot 2.5.5 and spring-cloud 2020.0.4 and the W3C support seems to work correctly, the problem I see is that the behavior seems different from B3. When you enable B3 support: curl -si -H "x-b3-traceid: 765eee11cf9ac83a" -H "x-b3-spanid: 22658a5fa2373b1e" -H "x-b3-parentspanid: 33f77175916ae247" -H "x-b3-sampled: 1" -X GET http://localhost:8080/trace1 The same test with W3C support: curl -si -H "traceparent: 00-609a534e112b3e7b920264c8e933aae5-2f644cc2fbb7d434-01" -X GET http://localhost:8080/trace1 It seems that when W3C is enabled an additional span is added that with B3 is not. is this the expected behavior? Thank you very much. |
@marcingrzejszczak : could you please elaborate 'poll' span . Also as you can see w.r.t @sr325 comment, 654c6c202519f923( consumer parent id) != 3a105242f3aa175d(producer spanId). Want to understand how 654c6c202519f923 is pointing to span id that in your example is last one. Your last component has parent Id=98271bd42f0a4c2c which looks fine as it follows up with the listener container span id. But in case of @sr325, consumer parentId(654c6c202519f923) != producer spanId (3a105242f3aa175d). If possible can you the github link for the change you made. |
I haven't done additional changes. I've just used the latest versions. I'll look into the W3C example soon. |
It's been some time now but I think I remember what the problem was @subhajitgoswami . B3 always having a shared span. That means that you have the same span on the client and on the server side. With W3C the shared span is not allowed. That means that always a new span will be created on the server side. Here we're talking about Kafka but have you observed a similar "problem" with HTTP? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Hi guys. As @marcingrzejszczak said, W3C does not consider share de spanId. In my opinion, this is a really annoying limitation, because it makes it difficult or even impossible to correlate logs if an APM agent is tracking your service. The reason is that you don't have access to the context in which the spanId was created, so if you want to generate a correlated log to send to another log analysis platform than your APM, you can't. And I think this puts at risk one of the reasons why the W3C Trace Context was created: to open up traceability and avoid vendors locking. What do you think? Is there any way to raise this thought to the owners of the W3C Trace Context specification? |
Good afternoon,
In our project we have enabled W3C support for Sleuth. We have done some tests and we are surprised by the way the trace-id field of the traceparent is being generated.
Let's assume we have micro 1 and it receives the header:
The TraceContext is initialized with the following values:
Then micro1 invokes micro2 and receives:
The TraceContext associated with micro 2 will be:
It is observed that during the execution of micro 1, Sleuth generates (for the outgoing request) a completely new parentId, disregarding the current spainId.
Why is the parentId not generated based on the spainId in a similar way as B3 behaves?... because with B3 it is easy to trace the relationship between micro1 and micro2 because the parentId of micro2 is the same as the spainId of micro1, but with the current W3C implementation how can I establish this relationship?
Thank you very much.
The text was updated successfully, but these errors were encountered: