Skip to content

Commit 57a8038

Browse files
authored
profiles: Clarify ProfilesDictionary table[0] element use docs. (#688)
Makes clear that all dictionary table fields should encode a 'null' element at index 0, such that optional fields pointing into the tables can use 0 value to indicate null.
1 parent edccbde commit 57a8038

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

opentelemetry/proto/profiles/v1development/profiles.proto

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,14 @@ option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1development";
9393
// ProfilesDictionary represents the profiles data shared across the
9494
// entire message being sent.
9595
message ProfilesDictionary {
96+
97+
// Note all fields in this message MUST have a zero value encoded as the first element.
98+
// This allows for _index fields pointing into the dictionary to use a 0 pointer value
99+
// to indicate 'null' / 'not set'. Unless otherwise defined, a 'zero value' message value
100+
// is one with all default field values, so as to minimize wire encoded size.
101+
96102
// Mappings from address ranges to the image/binary/library mapped
97103
// into that address range referenced by locations via Location.mapping_index.
98-
// mapping_table[0] must always be set to a zero value default mapping,
99-
// so that _index fields can use 0 to indicate null/unset.
100104
repeated Mapping mapping_table = 1;
101105

102106
// Locations referenced by samples via Profile.location_indices.
@@ -106,8 +110,6 @@ message ProfilesDictionary {
106110
repeated Function function_table = 3;
107111

108112
// Links referenced by samples via Sample.link_index.
109-
// link_table[0] must always be set to a zero value default link,
110-
// so that _index fields can use 0 to indicate null/unset.
111113
repeated Link link_table = 4;
112114

113115
// A common table for strings referenced by various messages.

0 commit comments

Comments
 (0)