Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Add agent trace service proto definitions.#79

Merged
songy23 merged 3 commits intocensus-instrumentation:masterfrom
songy23:agent
Aug 28, 2018
Merged

Add agent trace service proto definitions.#79
songy23 merged 3 commits intocensus-instrumentation:masterfrom
songy23:agent

Conversation

@songy23
Copy link
Copy Markdown
Contributor

@songy23 songy23 commented Aug 25, 2018

Also add java_grpc_library build 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

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";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How come the Java package is versioned by the Go one isn't versioned?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch - that's a typo made by me. Fixed.

// TODO(songya): add rate limiting sampler.
}

message Node {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should go in a agent.common.v1 namespace because it will be shared.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me.

// 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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same for this, should be in a common package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

message TraceConfig {

// The global default Sampler.
Sampler sampler = 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oneof sampler {
ProbabilityConfig
AlwaysSampleConfig
NeverSampleConfig
RateLimitingConfig
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

// TODO(songya): add rate limiting sampler.
}

message Node {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, added. (I would prefer to use an Enum here.)

message ProcessIdentifier {

// The host name.
string host_name = 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is a good example of host_name: machine/container name/ip address? Service name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Currently we use machine/container name, added some example.

Copy link
Copy Markdown

@lmolkova lmolkova Aug 27, 2018

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That makes sense to me, we can add another service_name field to Node. WDYT @odeke-em @bogdandrutu

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SG, added a ServiceInfo message.

message LibraryInfo {

enum Language {
UNKNOWN = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we add python now, and I'll be using it right away in the python exporter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, added.

RateLimitingSampler rate_limiting_sampler = 4;
}

// TODO(songya): add more fields and move this to trace.proto.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should put it in a config.proto in the trace package. Can you do that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Contributor

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use alphabetical order to avoid any discussion about ordering here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

ProcessIdentifier identifier = 1;

// Information on the OpenCensus Library who initiates the stream.
LibraryInfo LibraryInfo = 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use the proto style guide. variable names are not like java (cpp style is used): library_info

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it, fixed.

string name = 1;

// Version of the service.
string version = 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Version was just an example. Please don't add it for the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

oneof sampler {
ProbabilitySampler probability_sampler = 1;

AlwaysSampler always_sampler = 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me.

Copy link
Copy Markdown
Contributor Author

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

Post #80 for trace_config and #81 for agent/common.

oneof sampler {
ProbabilitySampler probability_sampler = 1;

AlwaysSampler always_sampler = 2;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me.

ProcessIdentifier identifier = 1;

// Information on the OpenCensus Library who initiates the stream.
LibraryInfo LibraryInfo = 2;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it, fixed.

PYTHON = 3;
RUBY = 4;
PHP = 5;
C_SHARP = 6;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

string name = 1;

// Version of the service.
string version = 2;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@songy23
Copy link
Copy Markdown
Contributor Author

songy23 commented Aug 27, 2018

Please review #80 and #81 first, I'll rebase and update this PR once those two are merged.

}

message ConfigTraceServiceRequest {
// Identifier data effectively is a structured metadata. This is required only in the first message on the stream.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use 80 characters everywhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed locally, will rebase and push after merging #81.

@songy23 songy23 force-pushed the agent branch 2 times, most recently from 3eef94e to ef3af70 Compare August 28, 2018 16:34
@songy23
Copy link
Copy Markdown
Contributor Author

songy23 commented Aug 28, 2018

Rebased, PTAL.

@songy23 songy23 changed the title Start adding proto definitions for Agent protocol. Add agent trace service proto definitions. Aug 28, 2018

load("@grpc_java//:java_grpc_library.bzl", "java_grpc_library")

proto_library(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@songy23 songy23 self-assigned this Aug 28, 2018
@songy23
Copy link
Copy Markdown
Contributor Author

songy23 commented Aug 28, 2018

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants