Skip to content

Commit

Permalink
Clarify attribute key uniqueness requirement
Browse files Browse the repository at this point in the history
Attributes keys must be unique. The key/value pair list in the protocol
was always intended to model a map.

Contributes to open-telemetry/opentelemetry-specification#2245
  • Loading branch information
tigrannajaryan committed Jan 24, 2022
1 parent f8c59fe commit 4f2fb1d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions opentelemetry/proto/common/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ message ArrayValue {
message KeyValueList {
// A collection of key/value pairs of key-value pairs. The list may be empty (may
// contain 0 elements).
// The keys MUST be unique (it is not allowed to have more than one
// value with the same key).
repeated KeyValue values = 1;
}

Expand Down
2 changes: 2 additions & 0 deletions opentelemetry/proto/logs/v1/logs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ message LogRecord {
opentelemetry.proto.common.v1.AnyValue body = 5;

// Additional attributes that describe the specific event occurrence. [Optional].
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 6;
uint32 dropped_attributes_count = 7;

Expand Down
8 changes: 8 additions & 0 deletions opentelemetry/proto/metrics/v1/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ message NumberDataPoint {

// The set of key/value pairs that uniquely identify the timeseries from
// where this point belongs. The list may be empty (may contain 0 elements).
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;

// StartTimeUnixNano is optional but strongly encouraged, see the
Expand Down Expand Up @@ -380,6 +382,8 @@ message HistogramDataPoint {

// The set of key/value pairs that uniquely identify the timeseries from
// where this point belongs. The list may be empty (may contain 0 elements).
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;

// StartTimeUnixNano is optional but strongly encouraged, see the
Expand Down Expand Up @@ -451,6 +455,8 @@ message HistogramDataPoint {
message ExponentialHistogramDataPoint {
// The set of key/value pairs that uniquely identify the timeseries from
// where this point belongs. The list may be empty (may contain 0 elements).
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;

// StartTimeUnixNano is optional but strongly encouraged, see the
Expand Down Expand Up @@ -550,6 +556,8 @@ message SummaryDataPoint {

// The set of key/value pairs that uniquely identify the timeseries from
// where this point belongs. The list may be empty (may contain 0 elements).
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 7;

// StartTimeUnixNano is optional but strongly encouraged, see the
Expand Down
4 changes: 3 additions & 1 deletion opentelemetry/proto/resource/v1/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ option go_package = "github.com/open-telemetry/opentelemetry-proto/gen/go/resour

// Resource information.
message Resource {
// Set of labels that describe the resource.
// Set of attributes that describe the resource.
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;

// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
Expand Down
6 changes: 6 additions & 0 deletions opentelemetry/proto/trace/v1/trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ message Span {
//
// The OpenTelemetry API specification further restricts the allowed value types:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/common.md#attributes
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;

// dropped_attributes_count is the number of attributes that were discarded. Attributes
Expand All @@ -203,6 +205,8 @@ message Span {
string name = 2;

// attributes is a collection of attribute key/value pairs on the event.
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;

// dropped_attributes_count is the number of dropped attributes. If the value is 0,
Expand Down Expand Up @@ -233,6 +237,8 @@ message Span {
string trace_state = 3;

// attributes is a collection of attribute key/value pairs on the link.
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).
repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;

// dropped_attributes_count is the number of dropped attributes. If the value is 0,
Expand Down

0 comments on commit 4f2fb1d

Please sign in to comment.