-
Notifications
You must be signed in to change notification settings - Fork 250
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
Span id encoding #719
Span id encoding #719
Conversation
@@ -107,7 +110,7 @@ def to_header(self, span_context): | |||
|
|||
header = '{}/{};o={}'.format( | |||
trace_id, | |||
span_id, | |||
int(span_id, 16), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhindery please update CHANGELOG.md
if this is a breaking change. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_id
andgenerate_span_id
in 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.