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

Commit 9f4a627

Browse files
authored
Regenerate ocagent proto files (#456)
1 parent ca97ca3 commit 9f4a627

File tree

5 files changed

+162
-44
lines changed

5 files changed

+162
-44
lines changed

packages/opencensus-exporter-ocagent/src/protos/opencensus/proto/agent/common/v1/common.proto

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@ option java_outer_classname = "CommonProto";
2727

2828
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1";
2929

30-
// Identifier metadata of the Node that connects to OpenCensus Agent.
30+
option ruby_package = "OpenCensus.Proto.Agent.Common.V1";
31+
32+
// Identifier metadata of the Node that produces the span or tracing data.
33+
// Note, this is not the metadata about the Node or service that is described by associated spans.
3134
// In the future we plan to extend the identifier proto definition to support
32-
// additional information (e.g cloud id, monitored resource, etc.)
35+
// additional information (e.g cloud id, etc.)
3336
message Node {
3437
// Identifier that uniquely identifies a process within a VM/container.
3538
ProcessIdentifier identifier = 1;
3639

37-
// Information on the OpenCensus Library who initiates the stream.
40+
// Information on the OpenCensus Library that initiates the stream.
3841
LibraryInfo library_info = 2;
3942

40-
// Additional informantion on service.
43+
// Additional information on service.
4144
ServiceInfo service_info = 3;
4245

4346
// Additional attributes.
@@ -59,8 +62,6 @@ message ProcessIdentifier {
5962

6063
// Start time of this ProcessIdentifier. Represented in epoch time.
6164
google.protobuf.Timestamp start_timestamp = 3;
62-
63-
// TODO(songya): Add more fields in the future as needed.
6465
}
6566

6667
// Information on OpenCensus Library.

packages/opencensus-exporter-ocagent/src/protos/opencensus/proto/agent/trace/v1/trace_service.proto

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ syntax = "proto3";
2020
package opencensus.proto.agent.trace.v1;
2121

2222
import "opencensus/proto/agent/common/v1/common.proto";
23+
import "opencensus/proto/resource/v1/resource.proto";
2324
import "opencensus/proto/trace/v1/trace.proto";
2425
import "opencensus/proto/trace/v1/trace_config.proto";
2526

@@ -29,38 +30,57 @@ option java_outer_classname = "TraceServiceProto";
2930

3031
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1";
3132

33+
option ruby_package = "OpenCensus.Proto.Agent.Trace.V1";
34+
35+
// Service that can be used to push spans and configs between one Application
36+
// instrumented with OpenCensus and an agent, or between an agent and a
37+
// central collector or config service (in this case spans and configs are
38+
// sent/received to/from multiple Applications).
3239
service TraceService {
33-
// After initialization, this RPC must be kept alive for the
34-
// entire life of the application. The agent pushes configs
35-
// down to applications via a stream.
40+
// After initialization, this RPC must be kept alive for the entire life of
41+
// the application. The agent pushes configs down to applications via a
42+
// stream.
3643
rpc Config(stream CurrentLibraryConfig) returns (stream UpdatedLibraryConfig) {}
3744

38-
// Allows applications to send spans to the agent.
3945
// For performance reasons, it is recommended to keep this RPC
4046
// alive for the entire life of the application.
4147
rpc Export(stream ExportTraceServiceRequest) returns (stream ExportTraceServiceResponse) {}
4248
}
4349

4450
message CurrentLibraryConfig {
45-
// Identifier data effectively is a structured metadata.
46-
// This is required only in the first message on the stream.
51+
// This is required only in the first message on the stream or if the
52+
// previous sent CurrentLibraryConfig message has a different Node (e.g.
53+
// when the same RPC is used to configure multiple Applications).
4754
opencensus.proto.agent.common.v1.Node node = 1;
4855

4956
// Current configuration.
5057
opencensus.proto.trace.v1.TraceConfig config = 2;
5158
}
5259

5360
message UpdatedLibraryConfig {
61+
// This field is ignored when the RPC is used to configure only one Application.
62+
// This is required only in the first message on the stream or if the
63+
// previous sent UpdatedLibraryConfig message has a different Node.
64+
opencensus.proto.agent.common.v1.Node node = 1;
65+
5466
// Requested updated configuration.
5567
opencensus.proto.trace.v1.TraceConfig config = 2;
5668
}
5769

5870
message ExportTraceServiceRequest {
59-
// Identifier data effectively is a structured metadata.
60-
// This is required only in the first message on the stream.
71+
// This is required only in the first message on the stream or if the
72+
// previous sent ExportTraceServiceRequest message has a different Node (e.g.
73+
// when the same RPC is used to send Spans from multiple Applications).
6174
opencensus.proto.agent.common.v1.Node node = 1;
6275

76+
// A list of Spans that belong to the last received Node.
6377
repeated opencensus.proto.trace.v1.Span spans = 2;
78+
79+
// The resource for the spans in this message that do not have an explicit
80+
// resource set.
81+
// If unset, the most recently set resource in the RPC stream applies. It is
82+
// valid to never be set within a stream, e.g. when no resource info is known.
83+
opencensus.proto.resource.v1.Resource resource = 3;
6484
}
6585

6686
message ExportTraceServiceResponse {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
package opencensus.proto.resource.v1;
18+
19+
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1";
20+
21+
option java_multiple_files = true;
22+
option java_package = "io.opencensus.proto.resource.v1";
23+
option java_outer_classname = "ResourceProto";
24+
25+
option ruby_package = "OpenCensus.Proto.Resource.V1";
26+
27+
// Resource information.
28+
message Resource {
29+
30+
// Type identifier for the resource.
31+
string type = 1;
32+
33+
// Set of labels that describe the resource.
34+
map<string,string> labels = 2;
35+
}

packages/opencensus-exporter-ocagent/src/protos/opencensus/proto/trace/v1/trace.proto

Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package opencensus.proto.trace.v1;
1818

19+
import "opencensus/proto/resource/v1/resource.proto";
1920
import "google/protobuf/timestamp.proto";
2021
import "google/protobuf/wrappers.proto";
2122

@@ -25,24 +26,35 @@ option java_outer_classname = "TraceProto";
2526

2627
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1";
2728

29+
option ruby_package = "OpenCensus.Proto.Trace.V1";
30+
2831
// A span represents a single operation within a trace. Spans can be
29-
// nested to form a trace tree. Often, a trace contains a root span
30-
// that describes the end-to-end latency, and one or more subspans for
31-
// its sub-operations. A trace can also contain multiple root spans,
32-
// or none at all. Spans do not need to be contiguous - there may be
33-
// gaps or overlaps between spans in a trace.
32+
// nested to form a trace tree. Spans may also be linked to other spans
33+
// from the same or different trace. And form graphs. Often, a trace
34+
// contains a root span that describes the end-to-end latency, and one
35+
// or more subspans for its sub-operations. A trace can also contain
36+
// multiple root spans, or none at all. Spans do not need to be
37+
// contiguous - there may be gaps or overlaps between spans in a trace.
3438
//
35-
// The next id is 16.
39+
// The next id is 17.
3640
// TODO(bdrutu): Add an example.
3741
message Span {
3842
// A unique identifier for a trace. All spans from the same trace share
39-
// the same `trace_id`. The ID is a 16-byte array.
43+
// the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes
44+
// is considered invalid.
45+
//
46+
// This field is semantically required. Receiver should generate new
47+
// random trace_id if empty or invalid trace_id was received.
4048
//
4149
// This field is required.
4250
bytes trace_id = 1;
4351

4452
// A unique identifier for a span within a trace, assigned when the span
45-
// is created. The ID is an 8-byte array.
53+
// is created. The ID is an 8-byte array. An ID with all zeroes is considered
54+
// invalid.
55+
//
56+
// This field is semantically required. Receiver should generate new
57+
// random span_id if empty or invalid span_id was received.
4658
//
4759
// This field is required.
4860
bytes span_id = 2;
@@ -82,6 +94,11 @@ message Span {
8294
// the same display name at the same call point in an application.
8395
// This makes it easier to correlate spans in different traces.
8496
//
97+
// This field is semantically required to be set to non-empty string.
98+
// When null or empty string received - receiver may use string "name"
99+
// as a replacement. There might be smarted algorithms implemented by
100+
// receiver to fix the empty span name.
101+
//
85102
// This field is required.
86103
TruncatableString name = 4;
87104

@@ -101,29 +118,43 @@ message Span {
101118
}
102119

103120
// Distinguishes between spans generated in a particular context. For example,
104-
// two spans with the same name may be distinguished using `CLIENT`
105-
// and `SERVER` to identify queueing latency associated with the span.
121+
// two spans with the same name may be distinguished using `CLIENT` (caller)
122+
// and `SERVER` (callee) to identify queueing latency associated with the span.
106123
SpanKind kind = 14;
107124

108125
// The start time of the span. On the client side, this is the time kept by
109126
// the local machine where the span execution starts. On the server side, this
110127
// is the time when the server's application handler starts running.
128+
//
129+
// This field is semantically required. When not set on receive -
130+
// receiver should set it to the value of end_time field if it was
131+
// set. Or to the current time if neither was set. It is important to
132+
// keep end_time > start_time for consistency.
133+
//
134+
// This field is required.
111135
google.protobuf.Timestamp start_time = 5;
112136

113137
// The end time of the span. On the client side, this is the time kept by
114138
// the local machine where the span execution ends. On the server side, this
115139
// is the time when the server application handler stops running.
140+
//
141+
// This field is semantically required. When not set on receive -
142+
// receiver should set it to start_time value. It is important to
143+
// keep end_time > start_time for consistency.
144+
//
145+
// This field is required.
116146
google.protobuf.Timestamp end_time = 6;
117147

118148
// A set of attributes, each with a key and a value.
119149
message Attributes {
120-
// The set of attributes. The value can be a string, an integer, or the
121-
// Boolean values `true` and `false`. For example:
150+
// The set of attributes. The value can be a string, an integer, a double
151+
// or the Boolean values `true` or `false`. Note, global attributes like
152+
// server name can be set as tags using resource API. Examples of attributes:
122153
//
123-
// "/instance_id": "my-instance"
124-
// "/http/user_agent": ""
154+
// "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
125155
// "/http/server_latency": 300
126156
// "abc.com/myattribute": true
157+
// "abc.com/score": 10.239
127158
map<string, AttributeValue> attribute_map = 1;
128159

129160
// The number of attributes that were discarded. Attributes can be discarded
@@ -217,12 +248,11 @@ message Span {
217248
// where a single batch handler processes multiple requests from different
218249
// traces or when the handler receives a request from a different project.
219250
message Link {
220-
// A unique identifier for a trace. All spans from the same trace share
221-
// the same `trace_id`. The ID is a 16-byte array.
251+
// A unique identifier of a trace that this linked span is part of. The ID is a
252+
// 16-byte array.
222253
bytes trace_id = 1;
223254

224-
// A unique identifier for a span within a trace, assigned when the span
225-
// is created. The ID is an 8-byte array.
255+
// A unique identifier for the linked span. The ID is an 8-byte array.
226256
bytes span_id = 2;
227257

228258
// The relationship of the current span relative to the linked span: child,
@@ -255,15 +285,24 @@ message Span {
255285
int32 dropped_links_count = 2;
256286
}
257287

258-
// The inclued links.
288+
// The included links.
259289
Links links = 10;
260290

261-
// An optional final status for this span.
291+
// An optional final status for this span. Semantically when Status
292+
// wasn't set it is means span ended without errors and assume
293+
// Status.Ok (code = 0).
262294
Status status = 11;
263295

264-
// A highly recommended but not required flag that identifies when a trace
265-
// crosses a process boundary. True when the parent_span belongs to the
266-
// same process as the current span.
296+
// An optional resource that is associated with this span. If not set, this span
297+
// should be part of a batch that does include the resource information, unless resource
298+
// information is unknown.
299+
opencensus.proto.resource.v1.Resource resource = 16;
300+
301+
// A highly recommended but not required flag that identifies when a
302+
// trace crosses a process boundary. True when the parent_span belongs
303+
// to the same process as the current span. This flag is most commonly
304+
// used to indicate the need to adjust time as clocks in different
305+
// processes may not be synchronized.
267306
google.protobuf.BoolValue same_process_as_parent_span = 12;
268307

269308
// An optional number of child spans that were generated while this span
@@ -277,7 +316,8 @@ message Span {
277316
// [google.rpc.Status](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto),
278317
// which is used by [gRPC](https://github.com/grpc).
279318
message Status {
280-
// The status code.
319+
// The status code. This is optional field. It is safe to assume 0 (OK)
320+
// when not set.
281321
int32 code = 1;
282322

283323
// A developer-facing error message, which should be in English.
@@ -294,6 +334,8 @@ message AttributeValue {
294334
int64 int_value = 2;
295335
// A Boolean value represented by `true` or `false`.
296336
bool bool_value = 3;
337+
// A double value.
338+
double double_value = 4;
297339
}
298340
}
299341

packages/opencensus-exporter-ocagent/src/protos/opencensus/proto/trace/v1/trace_config.proto

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ option java_outer_classname = "TraceConfigProto";
2222

2323
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1";
2424

25-
// Global configuration of the trace service.
25+
option ruby_package = "OpenCensus.Proto.Trace.V1";
26+
27+
// Global configuration of the trace service. All fields must be specified, or
28+
// the default (zero) values will be used for each type.
2629
message TraceConfig {
2730

2831
// The global default sampler used to make decisions on span sampling.
@@ -34,7 +37,17 @@ message TraceConfig {
3437
RateLimitingSampler rate_limiting_sampler = 3;
3538
}
3639

37-
// TODO(songya): add more fields.
40+
// The global default max number of attributes per span.
41+
int64 max_number_of_attributes = 4;
42+
43+
// The global default max number of annotation events per span.
44+
int64 max_number_of_annotations = 5;
45+
46+
// The global default max number of message events per span.
47+
int64 max_number_of_message_events = 6;
48+
49+
// The global default max number of link entries per span.
50+
int64 max_number_of_links = 7;
3851
}
3952

4053
// Sampler that tries to uniformly sample traces with a given probability.
@@ -45,12 +58,19 @@ message ProbabilitySampler {
4558
double samplingProbability = 1;
4659
}
4760

48-
// Sampler that makes a constant decision (either always "yes" or always "no")
49-
// on span sampling.
61+
// Sampler that always makes a constant decision on span sampling.
5062
message ConstantSampler {
5163

52-
// Whether spans should be always sampled, or never sampled.
53-
bool decision = 1;
64+
// How spans should be sampled:
65+
// - Always off
66+
// - Always on
67+
// - Always follow the parent Span's decision (off if no parent).
68+
enum ConstantDecision {
69+
ALWAYS_OFF = 0;
70+
ALWAYS_ON = 1;
71+
ALWAYS_PARENT = 2;
72+
}
73+
ConstantDecision decision = 1;
5474
}
5575

5676
// Sampler that tries to sample with a rate per time window.

0 commit comments

Comments
 (0)