@@ -16,6 +16,7 @@ syntax = "proto3";
1616
1717package opencensus.proto.trace.v1 ;
1818
19+ import "opencensus/proto/resource/v1/resource.proto" ;
1920import "google/protobuf/timestamp.proto" ;
2021import "google/protobuf/wrappers.proto" ;
2122
@@ -25,24 +26,35 @@ option java_outer_classname = "TraceProto";
2526
2627option 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.
3741message 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).
279318message 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
0 commit comments