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

chore(zipkin): adds span serializer for different formats. #3

Closed
wants to merge 2 commits into from

Conversation

jcchavezs
Copy link
Collaborator

@jcchavezs jcchavezs commented May 16, 2019

Integrating span serializer.

In a next PR I will move all the serialization from the span into the serializators.

Ping @adriancole @dio

return stringified_json_array;
}

std::string SpanBuffer::toStringifiedJsonArray(SpanSerializer& span_serialier) {

This comment was marked as outdated.

@jcchavezs jcchavezs changed the title chore(zipkin): adds span serializer for different formats. [WIP] chore(zipkin): adds span serializer for different formats. May 16, 2019
stringified_json_array += "]";

return stringified_json_array;
std::string SpanBuffer::serialize(SpanSerializer& serializer) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was always curious about a good example for visitor pattern. I think this one is a good one.

*/
std::string toStringifiedJsonArray();
std::string serialize(SpanSerializer& serializer)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now SpanBuffer does not have to be aware of proto or json serialization.

@jcchavezs jcchavezs force-pushed the adds_span_serializer branch from a603178 to e77f39e Compare May 17, 2019 10:39
@@ -15,31 +15,33 @@ TEST(ZipkinSpanBufferTest, defaultConstructorEndToEnd) {
SpanBuffer buffer(envoy::config::trace::v2::ZipkinConfig::HTTP_JSON_V1);

EXPECT_EQ(0ULL, buffer.pendingSpans());
EXPECT_EQ("[]", buffer.toStringifiedJsonArray());
// tests are commented out for now, I will move them to serialization once
// have more expertise with tests.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

☝️

@@ -126,18 +126,75 @@ Tracing::SpanPtr Driver::startSpan(const Tracing::Config& config, Http::HeaderMa
return active_span;
}

HTTPSpanSerializerV1::HTTPSpanSerializerV1() {}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dio is it OK if I move this into another file? I guess yes (as long as that file is part of the compilation like in C) but I want to double check.

*/
virtual std::string serialize(std::vector<Span> spans);

virtual std::string contentType();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The serializer is the one that knows the content type so it makes sense we get that information from here.

@jcchavezs jcchavezs changed the title [WIP] chore(zipkin): adds span serializer for different formats. chore(zipkin): adds span serializer for different formats. May 17, 2019
@dio
Copy link

dio commented May 17, 2019

OK, this is interesting. I have pushed the "base" PR for us to work on (I'll fix the build problem if that exists).

@dio
Copy link

dio commented May 17, 2019

This is the corresponding branch in this repo: https://github.com/envoy-zipkin/envoy/tree/zipkin-proto3

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