Skip to content

Commit 53b4bbd

Browse files
authored
profiles: improve attribute encoding in ProfilesDictionary (#672)
Subsequent to #659 (profiles: avoid 'optional' keyword usage) and in accordance with discussions in the profiling SIG, this PR updates the dictionary message docs to impose a more consistent handling of 'null pointer' semantics in the encoding pattern.
1 parent f50cd08 commit 53b4bbd

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

opentelemetry/proto/profiles/v1development/profiles.proto

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1development";
6767
// │ n-1
6868
// │ 1-n ┌───────────────────────────────────────┐
6969
// ▼ │ ▽
70-
// ┌──────────────────┐ 1-n ┌────────────── ┌──────────┐
71-
// │ Sample │ ──────▷ │ KeyValue │ │ Link │
72-
// └──────────────────┘ └────────────── └──────────┘
70+
// ┌──────────────────┐ 1-n ┌─────────────────┐ ┌──────────┐
71+
// │ Sample │ ──────▷ │ KeyValueAndUnit │ │ Link │
72+
// └──────────────────┘ └─────────────────┘ └──────────┘
7373
// │ 1-n △ △
7474
// │ 1-n ┌─────────────────┘ │ 1-n
7575
// ▽ │ │
@@ -124,9 +124,6 @@ message ProfilesDictionary {
124124
// "abc.com/myattribute": true
125125
// "abc.com/score": 10.239
126126
//
127-
// Attribute keys MUST be unique (it is not allowed to have more than one
128-
// attribute with the same key).
129-
//
130127
// The attribute values SHOULD NOT contain empty values.
131128
// The attribute values SHOULD NOT contain bytes values.
132129
// The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values,
@@ -136,10 +133,7 @@ message ProfilesDictionary {
136133
// These restrictions can change in a minor release.
137134
// The restrictions take origin from the OpenTelemetry specification:
138135
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute.
139-
repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 6;
140-
141-
// Represents a mapping between Attribute Keys and Units.
142-
repeated AttributeUnit attribute_units = 7;
136+
repeated KeyValueAndUnit attribute_table = 6;
143137
}
144138

145139
// ProfilesData represents the profiles data that can be stored in persistent storage,
@@ -296,14 +290,6 @@ message Profile {
296290
repeated int32 attribute_indices = 13;
297291
}
298292

299-
// Represents a mapping between Attribute Keys and Units.
300-
message AttributeUnit {
301-
// Index into string table.
302-
int32 attribute_key_strindex = 1;
303-
// Index into string table.
304-
int32 unit_strindex = 2;
305-
}
306-
307293
// A pointer from a profile Sample to a trace Span.
308294
// Connects a profile sample to a trace span, identified by unique trace and span IDs.
309295
message Link {
@@ -497,3 +483,12 @@ message Function {
497483
// Line number in source file. 0 means unset.
498484
int64 start_line = 4;
499485
}
486+
487+
// A custom 'dictionary native' style of encoding attributes which is more convenient
488+
// for profiles than opentelemetry.proto.common.v1.KeyValue
489+
// Specifically, uses the string table for keys and allows optional unit information.
490+
message KeyValueAndUnit {
491+
int32 key_strindex = 1;
492+
opentelemetry.proto.common.v1.AnyValue value = 2;
493+
int32 unit_strindex = 3; // zero indicates implicit (by semconv) or non-defined unit.
494+
}

0 commit comments

Comments
 (0)