-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pass Jaeger references with a 0 SpanID and TraceID #513
Conversation
Signed-off-by: Joe Elliott <number101010@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #513 +/- ##
==========================================
+ Coverage 76.05% 76.24% +0.18%
==========================================
Files 123 123
Lines 7639 7619 -20
==========================================
- Hits 5810 5809 -1
+ Misses 1553 1536 -17
+ Partials 276 274 -2
Continue to review full report at Codecov.
|
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
This reverts commit d621720.
@tigrannajaryan @owais There is another approach that I like a bit more conceptually, but will result in more code changes:
Thoughts? |
This is what I would do. Unclear why the code is not already written this way. I don't see why 0 trace ID is treated specially. 0 uint64 should convert to byte sequence of zeros and vice versa and that would happen if there were no explicit Perhaps there are edge cases where this matters? @owais are you aware of any? |
No, don't know of any issues this could cause. |
@pjanotti any thoughts on this? #513 (comment) |
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
@tigrannajaryan @owais
|
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.
@joe-elliott thank you for your patience.
// TODO: StackTrace: OpenTracing defines a semantic key for "stack", should we attempt to its content to StackTrace? | ||
TimeEvents: jProtoLogsToOCProtoTimeEvents(jspan.Logs), | ||
Links: jProtoReferencesToOCProtoLinks(jspan.References), | ||
Status: sStatus, | ||
} | ||
|
||
if jspan.ParentSpanID() != 0 { | ||
span.ParentSpanId = tracetranslator.UInt64ToByteSpanID(uint64(jspan.ParentSpanID())) |
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.
Is this special-cased because we want ParentSpanId in OC format to be nil when ParentSpanID in Jaeger format is 0?
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.
From what I see we already have a special-case in the reverse translation [1] so this looks good to me.
[1]
if len(ocSpan.ParentSpanId) != 0 { |
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.
So whenever we translate from a 0 trace/span ID we have to decide if that means a 0 id or a nil id. We've decided we feel like the default is all 0's which I like, but ParentSpanId is a special case because a nil ParentSpanId is common and correct.
There is a special case on the reverse translation back to Jaeger, but if we don't translate back to Jaeger then I believe we would want clearly flag "no parent id" with a nil instead of a 0's byte slice which might be confusing.
Another option is to go with back to my second attempt which was basically:
- Translate all 0 span/trace ids as nil
- When you translate any nil span/trace id back to Jaeger choose 0.
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.
I think this PR is good, no need to go back to the previous attempt.
@tigrannajaryan I don't recall any good reason for those... |
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.
LGTM. Thanks @joe-elliott!
@tigrannajaryan @joe-elliott ah I think it was because of this https://github.com/census-instrumentation/opencensus-proto/blob/master/gen-go/trace/v1/trace.pb.go#L139. That said this should not be purged in the pipeline by default (I already had some issues with it in the past). If someone wishes to enforce this OC policy they should not rely on the pipeline to do that. It can be a processor or an option on receiver/exporter. So I'm merging it :) |
Description:
This PR includes targeted changes to make the Jaeger pipeline tolerate references that have a Trace/Span ID of 0.
When translating from ocproto to jaeger a nil TraceID is returned and stored due to this code:
opentelemetry-collector/translator/trace/big_endian_converter.go
Lines 35 to 38 in 34b2459
When the reverse translation was performed the translation failed with
ErrNilTraceID
:opentelemetry-collector/translator/trace/big_endian_converter.go
Lines 53 to 56 in 34b2459
When the
ErrNilTraceID
andErrNilSpanID
are returned 0's are used instead of throwing an error.Changes have been tested manually to successfully pass bad references in a way consistent with the Jaeger pipeline/backend.
Fixes #491
Testing:
A reference with a 0 span and trace id was added to the protospan -> jaegerproto and protospan -> jaegerthrift tests.