Add agent trace service proto definitions.#79
Add agent trace service proto definitions.#79songy23 merged 3 commits intocensus-instrumentation:masterfrom
Conversation
| option java_package = "io.opencensus.proto.agent.trace.v1"; | ||
| option java_outer_classname = "TraceServiceProto"; | ||
|
|
||
| option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/traceserviceproto"; |
There was a problem hiding this comment.
How come the Java package is versioned by the Go one isn't versioned?
There was a problem hiding this comment.
Good catch - that's a typo made by me. Fixed.
| // TODO(songya): add rate limiting sampler. | ||
| } | ||
|
|
||
| message Node { |
There was a problem hiding this comment.
This should go in a agent.common.v1 namespace because it will be shared.
| // Identifier that uniquely identifies a process within a VM/container. | ||
| // In the future we plan to extend the identifier proto definition to support | ||
| // additional information (e.g cloud id, monitored resource, service name, etc.) | ||
| message ProcessIdentifier { |
There was a problem hiding this comment.
same for this, should be in a common package.
| message TraceConfig { | ||
|
|
||
| // The global default Sampler. | ||
| Sampler sampler = 1; |
There was a problem hiding this comment.
oneof sampler {
ProbabilityConfig
AlwaysSampleConfig
NeverSampleConfig
RateLimitingConfig
}
| // TODO(songya): add rate limiting sampler. | ||
| } | ||
|
|
||
| message Node { |
There was a problem hiding this comment.
I think also would be good to have in the Node a:
message LibraryInfo {
enum Language {
UNKNOWN = 0;
GO_LANG = 1;
JAVA = 2;
...
}
Language language = 1; // we can also use string here. open for opinions here.
string version = 2;
}
There was a problem hiding this comment.
Sounds good, added. (I would prefer to use an Enum here.)
| message ProcessIdentifier { | ||
|
|
||
| // The host name. | ||
| string host_name = 1; |
There was a problem hiding this comment.
what is a good example of host_name: machine/container name/ip address? Service name?
There was a problem hiding this comment.
Currently we use machine/container name, added some example.
There was a problem hiding this comment.
Thanks for the explanation. I was thinking about it more and it seems service name is kind of essential: e.g. zipkin and jaeger exporters explicitly ask for it, stackdriver exporters get it from env var and AppInsights also heavily relies on it. Since everyone needs it, can we have service name right away?
There was a problem hiding this comment.
That makes sense to me, we can add another service_name field to Node. WDYT @odeke-em @bogdandrutu
There was a problem hiding this comment.
I think we should have a "ServiceInfo" message which currently contains just "name", this way we can extend more the message if needed. I can think of version, build informations and others.
There was a problem hiding this comment.
SG, added a ServiceInfo message.
| message LibraryInfo { | ||
|
|
||
| enum Language { | ||
| UNKNOWN = 0; |
There was a problem hiding this comment.
can we add python now, and I'll be using it right away in the python exporter?
| RateLimitingSampler rate_limiting_sampler = 4; | ||
| } | ||
|
|
||
| // TODO(songya): add more fields and move this to trace.proto. |
There was a problem hiding this comment.
We should put it in a config.proto in the trace package. Can you do that?
bogdandrutu
left a comment
There was a problem hiding this comment.
I think this PR got a bit longer than expected. Lets split it in 3:
- trace_config;
- agent/common;
- agent/trace;
I think it is harder to follow changes everywhere.
| PYTHON = 3; | ||
| RUBY = 4; | ||
| PHP = 5; | ||
| C_SHARP = 6; |
There was a problem hiding this comment.
Please use alphabetical order to avoid any discussion about ordering here.
| ProcessIdentifier identifier = 1; | ||
|
|
||
| // Information on the OpenCensus Library who initiates the stream. | ||
| LibraryInfo LibraryInfo = 2; |
There was a problem hiding this comment.
Please use the proto style guide. variable names are not like java (cpp style is used): library_info
| string name = 1; | ||
|
|
||
| // Version of the service. | ||
| string version = 2; |
There was a problem hiding this comment.
Version was just an example. Please don't add it for the moment.
| oneof sampler { | ||
| ProbabilitySampler probability_sampler = 1; | ||
|
|
||
| AlwaysSampler always_sampler = 2; |
There was a problem hiding this comment.
I think something like "ConstantSampler constant_sampler = 2;" can replace always/never and we have ConstantSampler {
boolean decision = 1;
}
This way we do not have empty sampler messages and I think will look better.
| oneof sampler { | ||
| ProbabilitySampler probability_sampler = 1; | ||
|
|
||
| AlwaysSampler always_sampler = 2; |
| ProcessIdentifier identifier = 1; | ||
|
|
||
| // Information on the OpenCensus Library who initiates the stream. | ||
| LibraryInfo LibraryInfo = 2; |
| PYTHON = 3; | ||
| RUBY = 4; | ||
| PHP = 5; | ||
| C_SHARP = 6; |
| string name = 1; | ||
|
|
||
| // Version of the service. | ||
| string version = 2; |
| } | ||
|
|
||
| message ConfigTraceServiceRequest { | ||
| // Identifier data effectively is a structured metadata. This is required only in the first message on the stream. |
There was a problem hiding this comment.
Use 80 characters everywhere.
There was a problem hiding this comment.
Fixed locally, will rebase and push after merging #81.
3eef94e to
ef3af70
Compare
|
Rebased, PTAL. |
|
|
||
| load("@grpc_java//:java_grpc_library.bzl", "java_grpc_library") | ||
|
|
||
| proto_library( |
There was a problem hiding this comment.
I think we should also have the go generated using bazel rules:
https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#example-grpc
There was a problem hiding this comment.
I think we're directly depending on the gen-go files in Go? @rakyll
Adding go_proto_library build rule will introduce a lot of transitive dependencies.
There was a problem hiding this comment.
I left a TODO here for adding the go_proto_library rule if needed. That will be a lot of code changes so I think it's better to do it in a separate PR.
|
Thanks! |
Also add
java_grpc_librarybuild rule so that the generated gRPC service can work with Java-Bazel build.I feel it's better to put the proto definitions under opencensus-proto, and use the gen-go files in the agent/service repo.
Next step: update the gen-go files.
/cc @rakyll @SergeyKanzhelev @lmolkova @draffensperger