openzipkin / brave

Java distributed tracing implementation compatible with Zipkin backend services.
Apache License 2.0
2.36k stars 713 forks source link

X-B3-ParentSpanId should be optional in propagation #1357

Open gviczai opened 1 year ago

gviczai commented 1 year ago

When using separate headers (MULTI mode) in request as input to Brave propagation, all the X-B3-TraceId, X-B3-SpanId and X-B3-ParentSpanId headers are mandatory, otherwise not processed, because of this condition triplet: https://github.com/openzipkin/brave/blob/5.14.1/brave/src/main/java/brave/propagation/B3Propagation.java#L320-L322

Whereas if propagation uses SINGLE mode, it accepts a header like this: b3: 3918a670ff714ce592959c91b0a8cbcb-e506eba76ec9cfff-1 Which is correct, as of https://github.com/openzipkin/b3-propagation#single-header which states that "...the last two fields are optional". I think this should be the case when the values arrive as separated headers as well.