Span id encoding#719
Span id encoding#719songy23 merged 14 commits intocensus-instrumentation:masterfrom mhindery:span_id_encoding
Conversation
| header = '{}/{};o={}'.format( | ||
| trace_id, | ||
| span_id, | ||
| int(span_id, 16), |
There was a problem hiding this comment.
We probably need to update from_header as well.
@c24t FYI - this is a potential breaking change (e.g. if customers mix use old version and the latest version of OpenCensus Python SDK).
There was a problem hiding this comment.
the from_header has been updated, it contains
if span_id:
span_id = '{:016x}'.format(int(span_id))to do the conversion, or do you mean something additional?
There was a problem hiding this comment.
@mhindery please update CHANGELOG.md if this is a breaking change. Thanks.
There was a problem hiding this comment.
Adding @c24t to comment from Google side.
I cannot find the official spec for X-Cloud-Trace-Context, and I'm a bit worried that this change might break existing stuff for Google (considering there are system tests running as part of the CI, it is a bit surprising to me that we've been sending the wrong format to Stackdriver).
songy23
left a comment
There was a problem hiding this comment.
It makes sense to me to only update the encoding in google cloud format (AFAIK it's only used in AppEngine Standard). FYI in Java SpanID is also encoded as a number: https://github.com/census-instrumentation/opencensus-java/blob/52f38e48e2ac6cb65e28dcd97b4f7e9650357bba/contrib/appengine_standard_util/src/main/java/io/opencensus/contrib/appengine/standard/util/AppEngineCloudTraceContextUtils.java#L93.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
I don't get why the coverage claims the lines 65-68 of |
I guess the coverage is complaining about a missing branch coverage: What we need is two test cases to cover the branch statement:
|
|
Added some extra tests, now all checks pass. |
The span ID is currently a hex-encoded 16-char string, which shouldn't be the case. It should be a decimal, see census-ecosystem/opencensus-go-exporter-stackdriver#169 (comment)
This breaks compatibility between languages as (e.g. in my case) python and go don't propagate traces correctly.
I changed this by the modifying the
check_span_idandgenerate_span_idin the SpanContext class to not generate a hexadecimal representation, but just a decimal one. If that would be a problem for other parts of the code which require hex representation, it could be kept, and converted in the to_header() method of theGoogleCloudFormatPropagator, however, if it isn't necessary to actually have a hex representation then the conversion can be omitted altogether as it's simpler to just have it as decimal everywhere.