Closed alvassin closed 3 years ago
Are you facing any specific problem? We handle the signed int conversion in thrift.py id-to-int
@yurishkuro problem is that span/trace id reported from service to service by jaeger clients is different from span/trace id sent to (and stored in) jaeger collector.
Imagine somebody would like to write a new client for jaeger in some new language. Thrift contract declares that there is signed 64 int. So developer expect to receive serialized 64 signed int from parent span, but receives unsigned one and can't use this span in references for example w/o specific modifications. It is not clear.
Sorry, I don't follow. Jaeger IDs are just 64-bit binaries. We chose to represent them as i64 in Thrift for efficiency reasons. It doesn't matter that i64 is signed because it can still losslessly represent 64bit values, just with a different interpretation when you look at the values as actual ints.
If someone writes a new client, the Jaeger requirement is that it must handle full 64bit values, like all existing official Jaeger clients do.
Thank you for response
Thrift declares that
spanId
,traceIdLow
andtraceIdHigh
are 64-bit signed integers. (thrift has no support for unsigned types).So, i expected that
spanId
/traceIdLow
/traceIdHigh
would havebit_length()
for such numbers<= 63
.But jaeger python client use unsigned 64-bit integers when creating span:
span_id
is generated using 64 bitstrace_id
uses separate constant and also uses 64 bitsFinally, It is not possible to submit span using binary thrift protocol, referencing span reported by python client.
I would propose to generate 63 random bits for spanId, traceIdLow and traceIdHigh instead of 64.
Below you can see that if you try to report span generated by python client using binary thrift protocol (or use it or it's trace identifiers) - you'd get
struct.error: int too large to convert
error forreturn struct.pack("!q", i64)
operation.