-
Notifications
You must be signed in to change notification settings - Fork 34
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
Ensures X-Ray json has parent_id if type=segment #63
Conversation
thanks for the help! can you rebase this over master as #59 is in which adds a test class. Would be nice to have a test for this. |
@@ -51,11 +51,13 @@ | |||
.append(span.traceId(), 0, 8) | |||
.append('-') | |||
.append(span.traceId(), 8, 32).toString()); | |||
if (span.parentId() != null) writer.name("parent_id").value(span.parentId()); | |||
writer.name("id").value(span.id()); | |||
if (span.kind() == null | |||
|| span.kind() != Span.Kind.SERVER && span.kind() != Span.Kind.CONSUMER) { |
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.
@adriancole I am not sure why span.kind()
has to affect whether the trace is subsegment
or not. I think we should only check for parentId
. i.e move the block on line 57 outside this block.
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.
In brave all spans have a parent except for the root. A span of type Server or Consumer would be a Segment in X-Ray terms because these are the initial span in a service
I figured out my changes are also wrong. I ended up writing my own zipkin to xray conversion logic. I defined classes that represents XRay model, to ensure I can't construct an illegal json. The code is here, supports Zipkin and Jaeger, but it is written in Scala https://github.com/tabdulradi/opentracing-xray |
To fix this PR, we should always write the Unfortunately, I don't have the time to update this PR. You can close it if no one wants to own it. |
I got the following error from X-Ray agent
The json document seems to have
"type":"subsegment"
but noparent_id
, which is illegal.This PR ensures we either write both fields or none of them.