Skip to content
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

JSONSpanSerializer add ToEscaped while serializing serviceName, span.Name, binaryAnnotation.Value #157

Merged
merged 3 commits into from
Nov 3, 2017

Conversation

anthonywanted
Copy link
Contributor

JSONSpanSerializer add ToEscaped while serializing serviceName, span.Name, binaryAnnotation.Value
Fix bug #156

Copy link
Collaborator

@fedj fedj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR. I only have 1 thing to change and a question

@@ -46,7 +46,7 @@ private void SerializeSpan(StreamWriter writer, Span span)
writer.Write(openingBrace);
writer.WriteField(id, NumberUtils.EncodeLongToLowerHexString(span.SpanState.SpanId));
writer.Write(comma);
writer.WriteField(name, span.Name ?? SerializerUtils.DefaultRpcMethodName);
writer.WriteField(name, span.Name == null ? SerializerUtils.ToEscaped(span.Name) : SerializerUtils.DefaultRpcMethodName);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant the opposite. If the name is not null then escape it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad

@@ -126,7 +126,7 @@ private static void SerializeEndPoint(StreamWriter writer, IPEndPoint endPoint,
writer.Write(comma);
writer.WriteField(port, (short)endPoint.Port);
writer.Write(comma);
writer.WriteField(JSONSpanSerializer.serviceName, serviceName);
writer.WriteField(JSONSpanSerializer.serviceName, SerializerUtils.ToEscaped(serviceName));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also escape annotation.value on line 115 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the same problem in serviceName too, so I add it too
I thought annotation.Value is fully controlled by us, so I didn't add it
I commit again

@fedj fedj merged commit 341c237 into openzipkin:master Nov 3, 2017
@fedj
Copy link
Collaborator

fedj commented Nov 3, 2017

Thanks a lot @anthonywanted !

fedj pushed a commit that referenced this pull request Jan 16, 2019
…Name, annotation.Value, binaryAnnotation.Value (#157)

* JSONSpanSerializer Add ToEscaped while serializing serviceName, span.Name, annotation.Value, binaryAnnotation.Value

* Add test

* JSONSpanSerializer escape annotation.Value too.
Fix a stupid mistake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants