-
Notifications
You must be signed in to change notification settings - Fork 88
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
Conversation
…Name, binaryAnnotation.Value
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.
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); |
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 you meant the opposite. If the name is not null then escape it
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.
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)); |
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.
Shouldn't we also escape annotation.value on line 115 ?
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 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
Fix a stupid mistake
Thanks a lot @anthonywanted ! |
…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
JSONSpanSerializer add ToEscaped while serializing serviceName, span.Name, binaryAnnotation.Value
Fix bug #156