-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Define project layout for Protobuf / gRPC / generated files #904
Comments
What's easier to consume, for someone on the outside? If it's easier to build a client sending data directly to the collector by following the Swagger output for
What's more usual in Go? I've seen the |
If you can add the links to where you saw v2 for proto I can investigate more. |
Sorry, I mean as Go imports. |
Envoy uses
If we generate multiple swagger files, then each of them will repeat the definition of the model types. So if you wanted to build an external JSON client that depends on both collector and query services, and you used separate swagger files to generate the code, you'd end up with two copies of the model classes, unless you tweak something. On that basis I think a single swagger file is easier to consume. But for consuming proto files, I don't think it matters if they are split or grouped. |
If that's the case, then it's clear that we do want a single file :) |
Haven't looked into swagger with protos. Does it support
At https://github.com/grpc/grpc/blob/master/src/proto/grpc/lb/v1/load_balancer.proto is an example directly from Google. |
Hi, Just bumping the discussion on this, as we proceed on #1307, should we separate |
Yes, we want to separate services files. |
About the discussion on multiple swagger files, So I managed to separate out query-service definitions from the ... took a while (and some makefiles) to figure out passing flags to
|
@yurishkuro could you let me know if this works for us? |
Yes it looks fine to me. |
Just a nit, should we go with -
or
|
the latter (api_v2) |
Addressed by #1427 |
As part of #773, we want to separate model definition and services API into different .proto files. There are several decisions that we need to make:
Proposal
Based on test implementation in #903.
Multiple .proto files
The
model.proto
should be separate because we want to aim it at themodel
package in the backend, which is not suitable for the APIs.The services files can be either separate like
collector.proto
,query.proto
, or combined into a single file likeapi_v2.proto
. I recommend the latter for now, for simplicity. It also results in a single swagger file, which would otherwise be split into multiple filesThe name of protobuf package
My WIP is using
package jaeger.api_v2;
Go package for the API definitions
proto-gen/api_v2
, except formodel.proto
which is generated undermodel
directly. Once we move all proto files tojaeger-idl
repository we may want to changego_package
inmodel.proto
toapi_v2
as well, so that when people generate classes for client libs they end up with everything under the same package name. In the backend repo we can rewrite that definition tomodel
before generating code.Go package for implementations
This one is tricky. Currently we separate implementations by the respective services that contain them, i.e. collector service is only implemented in
cmd/collector
, same for sampling / throttling service, while query service is incmd/query
. This is mostly an implementation detail that we can change later, so I would go with similar structure usingapi_v2
package, e.g.cmd/collector/app/api_v2
.Open Questions
api_v2
? I started withapi.v2
, but found it to be clunky, esp. in Go where the default package name is the last segment (sov2
).The text was updated successfully, but these errors were encountered: