2

What is valid traceId in Brave? As I understand 16 and 32 length values are valid: https://github.com/openzipkin/brave/blob/master/brave/README.md#128-bit-trace-ids

If service receives 15 lengths (or less) traceId in the header. Is it valid for Brave? or leading 0 will be added in standard implementation? In other words, can I implement custom Propagation to pass 15 lengths (or less) traceId without leading 0 bit as per Brave specification?

Jonatan Ivanov
  • 4,895
  • 2
  • 15
  • 30
Vojik
  • 21
  • 2

1 Answers1

0

Brave behaves as if it the ID has the upper hex digits as zeros:

https://github.com/openzipkin/brave/blob/5be287b91c3d18da9fc7a597d71b12b27be6043c/brave/src/main/java/brave/propagation/TraceContext.java#L440

Calls:

https://github.com/openzipkin/brave/blob/5be287b91c3d18da9fc7a597d71b12b27be6043c/brave/src/main/java/brave/internal/codec/HexCodec.java#L53...L78

  • Thanks Brian. As I understand I can have my custom implementation of `TraceContext.Extractor` and I'd like to propagate some uncommon existing traceIDs from upstream services like `44a939f36383886` (15 length string) or `test` (4 length string) to downstream services. I don't want to use the default implementation which adds leading `0` to values: https://github.com/openzipkin/brave/blob/5be287b91c3d18da9fc7a597d71b12b27be6043c/brave/src/test/java/brave/propagation/TraceContextTest.java#L212 I just want to pass them as is and want to ensure that Brave platform doesn’t mind these trace ids too – Vojik Sep 15 '21 at 22:23