Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,18 @@ api_go_proto_library(
],
)

api_proto_library(
name = "trace_service",
srcs = ["trace_service.proto"],
has_services = 1,
require_py = 0,
deps = [
":base",
":grpc_service",
"@io_opencensus_trace//:trace_model",
],
)

# TODO(htuch): Grow this to cover everything we want to generate docs for, so we can just invoke
# bazel build //api --aspects tools/protodoc/protodoc.bzl%proto_doc_aspect --output_groups=rst
proto_library(
Expand Down
47 changes: 47 additions & 0 deletions api/trace_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
syntax = "proto3";

// [#proto-status: draft]

package envoy.api.v2;

import "api/base.proto";
import "api/grpc_service.proto";
import "trace.proto";

import "google/api/annotations.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.

This line is not needed.


import "validate/validate.proto";

// Service for streaming traces to server that consumes the trace data. It
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 sentence can be simplified: An interface for streaming traces from a client to a server.

There is no need to mention "consumes the trace data". The server can just forward the data elsewhere. There is no need to speculate the usage.

// uses OpenCensus data model as a standard to represent trace information.
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.

Remove "as a standard", since it doesn't provide much value.

Please add a link to OpenCensus

service TraceService {
// Envoy will connect and send StreamTracesMessage messages forever. It does
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 interface can be used by different client, there is no need to mention Envoy. "forever" is also too strong. How about:

// The client will stream trace to the server continuously until either the client or the server terminates the stream.

// not expect any response to be sent as nothing would be done in the case
// of failure.
rpc StreamTraces(stream StreamTracesMessage) returns (StreamTracesResponse) {
}
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 ; instead of {}.

}

message StreamTracesResponse {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

StreamingTracesResponse would be a proper noun phrase.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

}

message StreamTracesMessage {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

s/StreamTracesMessage/StreamingTracesRequest?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ditto.

message Identifier {
// The node sending the access log messages over the stream.
Node node = 1 [(validate.rules).message.required = true];
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.

If you put the trace data into a data, the key should always be a string, the client should normalize the id into a string instead of asking server to do it.

}

// Identifier data effectively is a structured metadata.
// As a performance optimization this will only be sent in the first message
// on the stream.
Identifier identifier = 1;

// A list of Span entries
repeated opencensus.proto.trace.Span spans = 2;
}

// Configuration structure.
message TraceServiceConfig {
// The upstream gRPC cluster that hosts the metrics service.
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.

Why trace service has anything to do with metrics service? Do they share the schema?

GrpcService grpc_service = 1 [(validate.rules).message.required = true];
}
19 changes: 19 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GOOGLEAPIS_SHA = "5c6df0cd18c6a429eab739fb711c27f6e1393366" # May 14, 2017
GOGOPROTO_SHA = "342cbe0a04158f6dcb03ca0079991a51a4248c02" # Oct 7, 2017
PROMETHEUS_SHA = "6f3806018612930941127f2a7c6c453ba2c527d2" # Nov 02, 2017
OPENCENSUS_SHA = "993c711ba22a5f08c1d4de58a3c07466995ed962" # Dec 13, 2017

PGV_GIT_SHA = "bd6d057e957fe184dfe76805951803af153be497"

Expand Down Expand Up @@ -200,3 +201,21 @@ api_proto_library(
)
""",
)

native.new_http_archive(
name = "io_opencensus_trace",
strip_prefix = "opencensus-proto-" + OPENCENSUS_SHA + "/opencensus/proto/trace",
url = "https://github.com/census-instrumentation/opencensus-proto/archive/" + OPENCENSUS_SHA + ".tar.gz",
build_file_content = """
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library")

api_proto_library(
name = "trace_model",
srcs = [
"trace.proto",
],
)
""",
)