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

Add Protobuf support #41

Closed
wants to merge 7 commits into from
Closed

Conversation

isaachier
Copy link
Contributor

Decided to spend some time on this. Not sure if we should do this now, but I'd love to swap out Thrift/UDP in the C++ client library in favor of Protobuf/gRPC.

int32 max_traces_per_seconds = 1;
}

message SamplingStrategy {
Copy link
Member

Choose a reason for hiding this comment

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

I think this isn't a top level type, make sure you do proper nesting to minimize visibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

}

service SamplingManager {
rpc GetSamplingStrategy (ServiceRequest) returns (SamplingStrategyResponse);
Copy link
Member

Choose a reason for hiding this comment

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

with grpc it would make sense to use streaming for these comms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I was wondering in these types of cases where the request/response cycle is periodic but not exactly streaming. I guess it still works as long as we know we call it repeatedly.


message Empty {};

message ServiceRequest {
Copy link
Member

Choose a reason for hiding this comment

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

can we keep this cleaner that thrift by separating data model from service definitions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I would really call this common.proto. oneway isn't supported in gRPC (grpc/grpc#2147), so need a way to return nothing. Regarding ServiceRequest, Protobuf does not support request or response types that are not defined as message types beforehand, so no rpc Request(string service_name) returns (Response). Had to come up with this to wrap the string in two services (see baggage.proto and sampling.proto).

}
Type type = 1;
uint64 trace_id_high = 2;
uint64 trace_id_low = 3;
Copy link
Member

Choose a reason for hiding this comment

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

I think I would prefer these two fields to be encapsulated into a TradeId struct, however there is a question of efficiency in the generated Go types. For example, Thrift would define traceId field as a pointer in such case, which requires an additional allocation for no reason.

This is actually a more general question. Before committing the IDLs, we should really run perf tests to compare thrift/tchannel vs. proto/grpc, in terms of throughput, latency, memory, CPU.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting question. For sure agree about the benchmarking. Actually started this change after reading about the different encoding/decoding benchmarks where it seems Protobuf has the best performance in Go, and presumably elsewhere. To set the record straight, when it comes to Go, there is the "fast" generator gogo/protobuf vs. the standard generator golang/protobuf. The reputation for speed is only true for the fast generator that I use throughout.

int32 max_traces_per_seconds = 1;
}

message OperationSamplingStrategy {
Copy link
Member

Choose a reason for hiding this comment

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

this can be embedded in PerOperationSamplingStrategy, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guess so. I just copied this from Thrift. Then again, I suppose Thrift didn't support nesting.

double default_sampling_probability = 1;
double default_lower_bound_traces_per_second = 2;
repeated OperationSamplingStrategy per_operation_strategy = 3;
double default_upper_bound_traces_per_second = 4;
Copy link
Member

Choose a reason for hiding this comment

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

nit: group with other primitive fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this is one of the more interesting issues with Protobuf v3. I think in Thrift, the defaultUpperBoundTracesPerSecond field is the only one marked as optional. Protobuf v3 makes all fields optional, so it makes sense. This default optional behavior may affect how we handle zero values.

syntax = "proto3";
package jaegertracing.protobuf.crossdock;

enum Transport {
Copy link
Member

Choose a reason for hiding this comment

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

do you actually need this file right now? it's no longer an official Jaeger API, but a payload for crossdock tests, and those don't use proto/grpc. I would suggest leaving this out of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I don't. Just used it as an opportunity to port everything to Protobuf. Will remove for now.

@isaachier
Copy link
Contributor Author

Found out you can run clang-format on protobuf files so I did that now.

isaachier and others added 7 commits April 8, 2018 11:33
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
Signed-off-by: Isaac Hier <ihier@uber.com>
Signed-off-by: Isaac Hier <isaachier@gmail.com>
@zkanda
Copy link

zkanda commented Apr 15, 2018

Hello @yurishkuro

What do we need to move this PR forward?

I'd like to contribute on getting grpc integrated to Jaeger and this seems like one of the low hanging fruit.

Cheers!

@yurishkuro
Copy link
Member

@zkanda @isaachier this PR is premature, please see jaegertracing/jaeger#773

I think we should still keep this open since it contains useful build enhancements, and we can revisit it once some of the decisions are made in the above issue.

@yurishkuro yurishkuro mentioned this pull request Mar 16, 2020
@yurishkuro
Copy link
Member

replaced by #61

@yurishkuro yurishkuro closed this Mar 16, 2020
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.

3 participants