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

Commit 3d9e99d

Browse files
authored
Add agent trace service proto definitions. (#79)
* Add agent trace service proto definitions. * Update BUILD and import. * Leave a TODO for adding go_proto_library rule.
1 parent ad5efe5 commit 3d9e99d

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed

WORKSPACE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414

1515
workspace(name = "opencensus_proto")
1616

17+
# Import gRPC git repo so that we can load java_grpc_library build.
18+
git_repository(
19+
name = "grpc_java",
20+
remote = "https://github.com/grpc/grpc-java.git",
21+
tag = "v1.10.1",
22+
)
23+
24+
load("@grpc_java//:repositories.bzl", "grpc_java_repositories")
25+
26+
grpc_java_repositories(
27+
# Omit to avoid conflicts.
28+
omit_com_google_protobuf=True,
29+
omit_com_google_protobuf_nano_protobuf_javanano=True,
30+
)
31+
1732
# proto_library rules implicitly depend on @com_google_protobuf//:protoc,
1833
# which is the proto-compiler.
1934
# This statement defines the @com_google_protobuf repo.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright 2018, OpenCensus Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
package(default_visibility = ["//visibility:public"])
16+
17+
load("@grpc_java//:java_grpc_library.bzl", "java_grpc_library")
18+
19+
proto_library(
20+
name = "trace_service_proto",
21+
srcs = ["trace_service.proto"],
22+
deps = [
23+
"//opencensus/proto/agent/common/v1:common_proto",
24+
"//opencensus/proto/trace/v1:trace_proto",
25+
"//opencensus/proto/trace/v1:trace_config_proto",
26+
],
27+
)
28+
29+
cc_proto_library(
30+
name = "trace_service_proto_cc",
31+
deps = [":trace_service_proto"],
32+
)
33+
34+
java_proto_library(
35+
name = "trace_service_proto_java",
36+
deps = [":trace_service_proto"],
37+
)
38+
39+
java_grpc_library(
40+
name = "trace_service_grpc_java",
41+
srcs = [":trace_service_proto"],
42+
deps = [":trace_service_proto_java"],
43+
)
44+
45+
# TODO(songya): resolve dependencies and add go_proto_library if it's needed.
46+
#go_proto_library(
47+
# name = "trace_service_proto_go",
48+
# compilers = ["@io_bazel_rules_go//proto:go_grpc"],
49+
# importpath =
50+
# "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1",
51+
# proto = ":trace_service_proto",
52+
# deps = [
53+
# ],
54+
#)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2018, OpenCensus Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
// NOTE: This proto is experimental and is subject to change at this point.
18+
// Please do not use it at the moment.
19+
20+
package opencensus.proto.agent.trace.v1;
21+
22+
import "opencensus/proto/agent/common/v1/common.proto";
23+
import "opencensus/proto/trace/v1/trace.proto";
24+
import "opencensus/proto/trace/v1/trace_config.proto";
25+
26+
option java_multiple_files = true;
27+
option java_package = "io.opencensus.proto.agent.trace.v1";
28+
option java_outer_classname = "TraceServiceProto";
29+
30+
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1";
31+
32+
service TraceService {
33+
34+
// After the initialization this RPC must be kept alive for the
35+
// entire life of the application. Agent pushes configs to the
36+
// application via a stream of responses.
37+
rpc Config(stream ConfigTraceServiceRequest) returns (stream ConfigTraceServiceResponse) {}
38+
39+
// Allow to export Spans.
40+
// For performance reason, it is recommended to keep this RPC
41+
// alive for the entire life of the application.
42+
rpc Export(stream ExportTraceServiceRequest) returns (stream ExportTraceServiceResponse) {}
43+
}
44+
45+
message ConfigTraceServiceRequest {
46+
// Identifier data effectively is a structured metadata.
47+
// This is required only in the first message on the stream.
48+
opencensus.proto.agent.common.v1.Node node = 1;
49+
50+
// Current configuration.
51+
opencensus.proto.trace.v1.TraceConfig config = 2;
52+
}
53+
54+
message ConfigTraceServiceResponse {
55+
// Requested updated configuration.
56+
opencensus.proto.trace.v1.TraceConfig config = 2;
57+
}
58+
59+
message ExportTraceServiceRequest {
60+
// Identifier data effectively is a structured metadata.
61+
// This is required only in the first message on the stream.
62+
opencensus.proto.agent.common.v1.Node node = 1;
63+
64+
repeated opencensus.proto.trace.v1.Span spans = 2;
65+
}
66+
67+
message ExportTraceServiceResponse {
68+
}

0 commit comments

Comments
 (0)