-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
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 needs master merge; that may fix the 'format' errors at least. |
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 @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) |
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.
Should these constructor args be const&
?
private: | ||
// We use a pre-allocated vector to improve performance | ||
std::vector<Span> span_buffer_; | ||
private : |
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.
Weird spacing..
@@ -0,0 +1,2705 @@ | |||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
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.
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 |
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.
All these args should be const&
|
||
buffer.clear(); | ||
EXPECT_EQ(0ULL, buffer.pendingSpans()); | ||
EXPECT_EQ("[]", buffer.toStringifiedJsonArray()); | ||
/*EXPECT_EQ("[]", buffer.toStringifiedJsonArray());*/ |
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.
?
@@ -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)); |
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.
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 = |
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.
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, |
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.
newInstance
etc.
SpanSerializer span_serializer; | ||
|
||
switch (collector_endpoint) { | ||
case envoy::config::trace::v2::ZipkinConfig::HTTP_JSON span_serializer = |
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.
Does this compile?
// | ||
syntax = "proto3"; | ||
|
||
package zipkin.proto3; |
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.
Why isn't this sourced from an external package?
@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. |
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! |
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! |
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: