Skip to content

Commit 017bccb

Browse files
authored
chore(opentelemetry): Update protobuf definitions to 1.4.0 (#26513)
1 parent 5ea3b63 commit 017bccb

8 files changed

Lines changed: 147 additions & 10 deletions

File tree

‎lib/codecs/src/decoding/format/otlp.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ mod tests {
275275
name: "test_metric".to_string(),
276276
description: String::new(),
277277
unit: String::new(),
278+
metadata: vec![],
278279
data: None,
279280
}],
280281
schema_url: String::new(),
@@ -300,6 +301,7 @@ mod tests {
300301
span_id: TEST_SPAN_ID.to_vec(),
301302
trace_state: String::new(),
302303
parent_span_id: vec![],
304+
flags: 0,
303305
name: "test_span".to_string(),
304306
kind: 0,
305307
start_time_unix_nano: 1234567890,

‎lib/opentelemetry-proto/src/metrics.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ pub fn metric_event_to_export_request(
882882
name,
883883
description: String::new(),
884884
unit: String::new(),
885+
metadata: vec![],
885886
data: Some(data),
886887
}],
887888
schema_url: String::new(),
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# OpenTelemetry protobuf definitions
22

33
Vendored from [`open-telemetry/opentelemetry-proto`](https://github.com/open-telemetry/opentelemetry-proto)
4-
[`opentelemetry/proto`](https://github.com/open-telemetry/opentelemetry-proto/tree/v1.0.0/opentelemetry/proto)
5-
at release [`v1.0.0`](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.0.0).
4+
[`opentelemetry/proto`](https://github.com/open-telemetry/opentelemetry-proto/tree/v1.4.0/opentelemetry/proto)
5+
at release [`v1.4.0`](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.4.0).
66

77
Files already present in this directory are refreshed from that release.
88

99
Refresh by running `cargo vdev update opentelemetry-proto` for the latest release,
10-
or `cargo vdev update opentelemetry-proto v1.0.0` to pin this tag again.
10+
or `cargo vdev update opentelemetry-proto v1.4.0` to pin this tag again.

‎lib/opentelemetry-proto/src/proto/opentelemetry-proto/opentelemetry/proto/logs/v1/logs.proto‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ message ResourceLogs {
5555
// A list of ScopeLogs that originate from a resource.
5656
repeated ScopeLogs scope_logs = 2;
5757

58+
// The Schema URL, if known. This is the identifier of the Schema that the resource data
59+
// is recorded in. To learn more about Schema URL see
60+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
5861
// This schema_url applies to the data in the "resource" field. It does not apply
5962
// to the data in the "scope_logs" field which have their own schema_url field.
6063
string schema_url = 3;
@@ -70,6 +73,9 @@ message ScopeLogs {
7073
// A list of log records.
7174
repeated LogRecord log_records = 2;
7275

76+
// The Schema URL, if known. This is the identifier of the Schema that the log data
77+
// is recorded in. To learn more about Schema URL see
78+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
7379
// This schema_url applies to all logs in the "logs" field.
7480
string schema_url = 3;
7581
}
@@ -104,9 +110,11 @@ enum SeverityNumber {
104110
SEVERITY_NUMBER_FATAL4 = 24;
105111
}
106112

107-
// LogRecordFlags is defined as a protobuf 'uint32' type and is to be used as
108-
// bit-fields. Each non-zero value defined in this enum is a bit-mask.
109-
// To extract the bit-field, for example, use an expression like:
113+
// LogRecordFlags represents constants used to interpret the
114+
// LogRecord.flags field, which is protobuf 'fixed32' type and is to
115+
// be used as bit-fields. Each non-zero value defined in this enum is
116+
// a bit-mask. To extract the bit-field, for example, use an
117+
// expression like:
110118
//
111119
// (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)
112120
//

‎lib/opentelemetry-proto/src/proto/opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto‎

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1";
2929
// storage, OR can be embedded by other protocols that transfer OTLP metrics
3030
// data but do not implement the OTLP protocol.
3131
//
32+
// MetricsData
33+
// └─── ResourceMetrics
34+
// ├── Resource
35+
// ├── SchemaURL
36+
// └── ScopeMetrics
37+
// ├── Scope
38+
// ├── SchemaURL
39+
// └── Metric
40+
// ├── Name
41+
// ├── Description
42+
// ├── Unit
43+
// └── data
44+
// ├── Gauge
45+
// ├── Sum
46+
// ├── Histogram
47+
// ├── ExponentialHistogram
48+
// └── Summary
49+
//
3250
// The main difference between this message and collector protocol is that
3351
// in this message there will not be any "control" or "metadata" specific to
3452
// OTLP protocol.
@@ -55,6 +73,9 @@ message ResourceMetrics {
5573
// A list of metrics that originate from a resource.
5674
repeated ScopeMetrics scope_metrics = 2;
5775

76+
// The Schema URL, if known. This is the identifier of the Schema that the resource data
77+
// is recorded in. To learn more about Schema URL see
78+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
5879
// This schema_url applies to the data in the "resource" field. It does not apply
5980
// to the data in the "scope_metrics" field which have their own schema_url field.
6081
string schema_url = 3;
@@ -70,6 +91,9 @@ message ScopeMetrics {
7091
// A list of metrics that originate from an instrumentation library.
7192
repeated Metric metrics = 2;
7293

94+
// The Schema URL, if known. This is the identifier of the Schema that the metric data
95+
// is recorded in. To learn more about Schema URL see
96+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
7397
// This schema_url applies to all metrics in the "metrics" field.
7498
string schema_url = 3;
7599
}
@@ -79,7 +103,6 @@ message ScopeMetrics {
79103
//
80104
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md
81105
//
82-
//
83106
// The data model and relation between entities is shown in the
84107
// diagram below. Here, "DataPoint" is the term used to refer to any
85108
// one of the specific data point value types, and "points" is the term used
@@ -91,7 +114,7 @@ message ScopeMetrics {
91114
// - DataPoint contains timestamps, attributes, and one of the possible value type
92115
// fields.
93116
//
94-
// Metric
117+
// Metric
95118
// +------------+
96119
// |name |
97120
// |description |
@@ -162,7 +185,7 @@ message ScopeMetrics {
162185
message Metric {
163186
reserved 4, 6, 8;
164187

165-
// name of the metric, including its DNS name prefix. It must be unique.
188+
// name of the metric.
166189
string name = 1;
167190

168191
// description of the metric, which can be used in documentation.
@@ -182,6 +205,15 @@ message Metric {
182205
ExponentialHistogram exponential_histogram = 10;
183206
Summary summary = 11;
184207
}
208+
209+
// Additional metadata attributes that describe the metric. [Optional].
210+
// Attributes are non-identifying.
211+
// Consumers SHOULD NOT need to be aware of these attributes.
212+
// These attributes MAY be used to encode information allowing
213+
// for lossless roundtrip translation to / from another data model.
214+
// Attribute keys MUST be unique (it is not allowed to have more than one
215+
// attribute with the same key).
216+
repeated opentelemetry.proto.common.v1.KeyValue metadata = 12;
185217
}
186218

187219
// Gauge represents the type of a scalar metric that always exports the
@@ -236,6 +268,9 @@ message ExponentialHistogram {
236268
// data type. These data points cannot always be merged in a meaningful way.
237269
// While they can be useful in some applications, histogram data points are
238270
// recommended for new applications.
271+
// Summary metrics do not have an aggregation temporality field. This is
272+
// because the count and sum fields of a SummaryDataPoint are assumed to be
273+
// cumulative values.
239274
message Summary {
240275
repeated SummaryDataPoint data_points = 1;
241276
}
@@ -574,7 +609,8 @@ message ExponentialHistogramDataPoint {
574609
}
575610

576611
// SummaryDataPoint is a single data point in a timeseries that describes the
577-
// time-varying values of a Summary metric.
612+
// time-varying values of a Summary metric. The count and sum fields represent
613+
// cumulative values.
578614
message SummaryDataPoint {
579615
reserved 1;
580616

‎lib/opentelemetry-proto/src/proto/opentelemetry-proto/opentelemetry/proto/trace/v1/trace.proto‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ message ResourceSpans {
5555
// A list of ScopeSpans that originate from a resource.
5656
repeated ScopeSpans scope_spans = 2;
5757

58+
// The Schema URL, if known. This is the identifier of the Schema that the resource data
59+
// is recorded in. To learn more about Schema URL see
60+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
5861
// This schema_url applies to the data in the "resource" field. It does not apply
5962
// to the data in the "scope_spans" field which have their own schema_url field.
6063
string schema_url = 3;
@@ -70,6 +73,9 @@ message ScopeSpans {
7073
// A list of Spans that originate from an instrumentation scope.
7174
repeated Span spans = 2;
7275

76+
// The Schema URL, if known. This is the identifier of the Schema that the span data
77+
// is recorded in. To learn more about Schema URL see
78+
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
7379
// This schema_url applies to all spans and span events in the "spans" field.
7480
string schema_url = 3;
7581
}
@@ -103,6 +109,29 @@ message Span {
103109
// field must be empty. The ID is an 8-byte array.
104110
bytes parent_span_id = 4;
105111

112+
// Flags, a bit field.
113+
//
114+
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
115+
// Context specification. To read the 8-bit W3C trace flag, use
116+
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
117+
//
118+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
119+
//
120+
// Bits 8 and 9 represent the 3 states of whether a span's parent
121+
// is remote. The states are (unknown, is not remote, is remote).
122+
// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
123+
// To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
124+
//
125+
// When creating span messages, if the message is logically forwarded from another source
126+
// with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD
127+
// be copied as-is. If creating from a source that does not have an equivalent flags field
128+
// (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST
129+
// be set to zero.
130+
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
131+
//
132+
// [Optional].
133+
fixed32 flags = 16;
134+
106135
// A description of the span's operation.
107136
//
108137
// For example, the name can be a qualified method name or a file name
@@ -236,6 +265,25 @@ message Span {
236265
// dropped_attributes_count is the number of dropped attributes. If the value is 0,
237266
// then no attributes were dropped.
238267
uint32 dropped_attributes_count = 5;
268+
269+
// Flags, a bit field.
270+
//
271+
// Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace
272+
// Context specification. To read the 8-bit W3C trace flag, use
273+
// `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
274+
//
275+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
276+
//
277+
// Bits 8 and 9 represent the 3 states of whether the link is remote.
278+
// The states are (unknown, is not remote, is remote).
279+
// To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
280+
// To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
281+
//
282+
// Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
283+
// When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.
284+
//
285+
// [Optional].
286+
fixed32 flags = 6;
239287
}
240288

241289
// links is a collection of Links, which are references from this span to a span
@@ -274,3 +322,34 @@ message Status {
274322
// The status code.
275323
StatusCode code = 3;
276324
}
325+
326+
// SpanFlags represents constants used to interpret the
327+
// Span.flags field, which is protobuf 'fixed32' type and is to
328+
// be used as bit-fields. Each non-zero value defined in this enum is
329+
// a bit-mask. To extract the bit-field, for example, use an
330+
// expression like:
331+
//
332+
// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
333+
//
334+
// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
335+
//
336+
// Note that Span flags were introduced in version 1.1 of the
337+
// OpenTelemetry protocol. Older Span producers do not set this
338+
// field, consequently consumers should not rely on the absence of a
339+
// particular flag bit to indicate the presence of a particular feature.
340+
enum SpanFlags {
341+
// The zero value for the enum. Should not be used for comparisons.
342+
// Instead use bitwise "and" with the appropriate mask as shown above.
343+
SPAN_FLAGS_DO_NOT_USE = 0;
344+
345+
// Bits 0-7 are used for trace flags.
346+
SPAN_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;
347+
348+
// Bits 8 and 9 are used to indicate that the parent span or link span is remote.
349+
// Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
350+
// Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
351+
SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 0x00000100;
352+
SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 0x00000200;
353+
354+
// Bits 10-31 are reserved for future use.
355+
}

‎src/sources/opentelemetry/integration_tests.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ async fn receive_trace() {
128128
trace_id: (1..17).collect_vec(), //trace_id [u8;16]
129129
span_id: (1..9).collect_vec(), // span_id [u8;8]
130130
parent_span_id: (1..9).collect_vec(), // parent_span_id [u8;8]
131+
flags: 0,
131132
name: "span".to_string(),
132133
kind: 1,
133134
start_time_unix_nano: 1713525203000000000,
@@ -223,6 +224,7 @@ async fn receive_metric() {
223224
name: "some.random.metric".to_string(),
224225
description: "Some random metric we use for test".to_string(),
225226
unit: "1".to_string(),
227+
metadata: vec![],
226228
data: Some(Data::Gauge(Gauge {
227229
data_points: vec![NumberDataPoint {
228230
attributes: vec![

‎src/sources/opentelemetry/tests.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ fn create_test_metrics_request() -> ExportMetricsServiceRequest {
130130
name: "some.random.metric".to_string(),
131131
description: "Some random metric we use for test".to_string(),
132132
unit: "1".to_string(),
133+
metadata: vec![],
133134
data: Some(Data::Summary(Summary {
134135
data_points: vec![SummaryDataPoint {
135136
attributes: vec![
@@ -183,6 +184,7 @@ fn create_test_traces_request() -> ExportTraceServiceRequest {
183184
trace_id: (1..17).collect::<Vec<u8>>(),
184185
span_id: (1..9).collect::<Vec<u8>>(),
185186
parent_span_id: (1..9).collect::<Vec<u8>>(),
187+
flags: 0,
186188
name: "span".to_string(),
187189
kind: 1,
188190
start_time_unix_nano: 1713525203000000000,
@@ -654,6 +656,7 @@ async fn receive_sum_metric() {
654656
name: "some.random.metric".to_string(),
655657
description: "Some random metric we use for test".to_string(),
656658
unit: "1".to_string(),
659+
metadata: vec![],
657660
data: Some(Data::Sum(Sum {
658661
data_points: vec![NumberDataPoint {
659662
attributes: vec![
@@ -746,6 +749,7 @@ async fn receive_sum_non_monotonic_metric() {
746749
name: "some.random.metric".to_string(),
747750
description: "Some random metric we use for test".to_string(),
748751
unit: "1".to_string(),
752+
metadata: vec![],
749753
data: Some(Data::Sum(Sum {
750754
data_points: vec![NumberDataPoint {
751755
attributes: vec![
@@ -838,6 +842,7 @@ async fn receive_gauge_metric() {
838842
name: "some.random.metric".to_string(),
839843
description: "Some random metric we use for test".to_string(),
840844
unit: "1".to_string(),
845+
metadata: vec![],
841846
data: Some(Data::Gauge(Gauge {
842847
data_points: vec![NumberDataPoint {
843848
attributes: vec![
@@ -927,6 +932,7 @@ async fn receive_histogram_metric() {
927932
name: "some.random.metric".to_string(),
928933
description: "Some random metric we use for test".to_string(),
929934
unit: "1".to_string(),
935+
metadata: vec![],
930936
data: Some(Data::Histogram(Histogram {
931937
aggregation_temporality: AggregationTemporality::Cumulative as i32,
932938
data_points: vec![HistogramDataPoint {
@@ -1054,6 +1060,7 @@ async fn receive_histogram_delta_metric() {
10541060
name: "some.random.metric".to_string(),
10551061
description: "Some random metric we use for test".to_string(),
10561062
unit: "1".to_string(),
1063+
metadata: vec![],
10571064
data: Some(Data::Histogram(Histogram {
10581065
aggregation_temporality: AggregationTemporality::Delta as i32,
10591066
data_points: vec![HistogramDataPoint {
@@ -1181,6 +1188,7 @@ async fn receive_exponential_histogram_metric() {
11811188
name: "some.random.metric".to_string(),
11821189
description: "Some random metric we use for test".to_string(),
11831190
unit: "1".to_string(),
1191+
metadata: vec![],
11841192
data: Some(Data::ExponentialHistogram(ExponentialHistogram {
11851193
aggregation_temporality: AggregationTemporality::Cumulative as i32,
11861194
data_points: vec![ExponentialHistogramDataPoint {
@@ -1321,6 +1329,7 @@ async fn receive_summary_metric() {
13211329
name: "some.random.metric".to_string(),
13221330
description: "Some random metric we use for test".to_string(),
13231331
unit: "1".to_string(),
1332+
metadata: vec![],
13241333
data: Some(Data::Summary(Summary {
13251334
data_points: vec![SummaryDataPoint {
13261335
attributes: vec![

0 commit comments

Comments
 (0)