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

(zipkin) adds span serializer #7119

Closed

Conversation

jcchavezs
Copy link
Contributor

Description: This PR adds the serializer interface to have better cohesion in the spans serializer
Risk Level: Low, since the default is still HTTP-JSON v1 based on https://github.com/apache/incubator-zipkin-api/blob/v0.2.1/zipkin-api.yaml.
Testing: Unit testing, manual integration test with real Zipkin collector server.
Docs Changes: none yet
Release Notes:

dio and others added 4 commits May 10, 2019 16:03
This commits enable sending spans in zipkin v2 formats.

Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Signed-off-by: José Carlos Chávez <jcchavezs@gmail.com>
Signed-off-by: José Carlos Chávez <jcchavezs@gmail.com>
…ffers.

Signed-off-by: José Carlos Chávez <jcchavezs@gmail.com>
@jcchavezs jcchavezs requested a review from htuch as a code owner May 31, 2019 12:14
@jcchavezs jcchavezs changed the title Adds span serializer (zipkin) adds span serializer May 31, 2019
@jmarantz
Copy link
Contributor

@jcchavezs needs master merge; that may fix the 'format' errors at least.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks @jcchavezs. Can you explain a bit more in depth what the goal is here? I'm not an expert in the tracing aspects of Envoy, it looks like you're trying to make use of com_github_apache_zipkinapi to improve the serialization? In any case, this PR needs a bit of work to fix build, format and also avoid including generator proto stubs and proto files that exist in external repos.
/wait

@@ -17,14 +20,19 @@ class SpanBuffer {
* Constructor that creates an empty buffer. Space needs to be allocated by invoking
* the method allocateBuffer(size).
*/
SpanBuffer() {}
SpanBuffer(const envoy::config::trace::v2::ZipkinConfig::CollectorEndpointVersion version)
Copy link
Member

Choose a reason for hiding this comment

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

Should these constructor args be const&?

private:
// We use a pre-allocated vector to improve performance
std::vector<Span> span_buffer_;
private :
Copy link
Member

Choose a reason for hiding this comment

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

Weird spacing..

@@ -0,0 +1,2705 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
Copy link
Member

Choose a reason for hiding this comment

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

How come you are checking in generated code? Ideally we use our *_proto_library rules to generate this on-the-fly, we don't have any pregenerated stubs elsewhere in Envoy.

@@ -183,7 +189,8 @@ class Annotation : public ZipkinBase {
*
* @return a stringified JSON.
*/
const std::string toJson() override;
const std::string toJson(const envoy::config::trace::v2::ZipkinConfig::CollectorEndpointVersion
Copy link
Member

Choose a reason for hiding this comment

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

All these args should be const&


buffer.clear();
EXPECT_EQ(0ULL, buffer.pendingSpans());
EXPECT_EQ("[]", buffer.toStringifiedJsonArray());
/*EXPECT_EQ("[]", buffer.toStringifiedJsonArray());*/
Copy link
Member

Choose a reason for hiding this comment

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

?

@@ -484,7 +504,7 @@ TEST(ZipkinCoreTypesSpanTest, defaultConstructor) {
R"({"key":"http.return_code","value":"400",)"
R"("endpoint":{"ipv4":"192.168.1.2","port":3306,)"
R"("serviceName":"my_service_name"}}]})",
span.toJson());
span.toJson(envoy::config::trace::v2::ZipkinConfig::HTTP_JSON_V1));
Copy link
Member

Choose a reason for hiding this comment

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

Are there any new tests?

switch (collector_endpoint) {
case envoy::config::trace::v2::ZipkinConfig::HTTP_JSON span_serializer =
new HTTPSpanSerializer() break;
case envoy::config::trace::v2::ZipkinConfig::HTTP_PROTO span_serializer =
Copy link
Member

Choose a reason for hiding this comment

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

All of this definitely needs fix_format..

const std::string& collector_endpoint) {
return ReporterPtr(new ReporterImpl(driver, dispatcher, collector_endpoint));
ReporterPtr
ReporterImpl::NewInstance(Driver& driver, Event::Dispatcher& dispatcher,
Copy link
Member

Choose a reason for hiding this comment

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

newInstance etc.

SpanSerializer span_serializer;

switch (collector_endpoint) {
case envoy::config::trace::v2::ZipkinConfig::HTTP_JSON span_serializer =
Copy link
Member

Choose a reason for hiding this comment

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

Does this compile?

//
syntax = "proto3";

package zipkin.proto3;
Copy link
Member

Choose a reason for hiding this comment

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

Why isn't this sourced from an external package?

@dio
Copy link
Member

dio commented Jun 4, 2019

@jcchavezs, sorry. Is there any reason for not iterating on top of #6985? I think you can also add these changes on top of #6985, which builds fine.

@htuch htuch requested a review from dio June 4, 2019 15:57
@htuch htuch assigned dio Jun 4, 2019
@stale
Copy link

stale bot commented Jun 11, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jun 11, 2019
@stale
Copy link

stale bot commented Jun 18, 2019

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale stalebot believes this issue/PR has not been touched recently waiting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants