@@ -102,7 +102,7 @@ message ProfilesDictionary {
102102  // into that address range referenced by locations via Location.mapping_index. 
103103  repeated  Mapping  mapping_table  =  1 ;
104104
105-   // Locations referenced by samples via Profile .location_indices. 
105+   // Locations referenced by samples via Stack .location_indices. 
106106  repeated  Location  location_table  =  2 ;
107107
108108  // Functions referenced by locations via Line.function_index. 
@@ -134,6 +134,9 @@ message ProfilesDictionary {
134134  // The restrictions take origin from the OpenTelemetry specification: 
135135  // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. 
136136  repeated  KeyValueAndUnit  attribute_table  =  6 ;
137+ 
138+   // Stacks referenced by samples via Sample.stack_index. 
139+   repeated  Stack  stack_table  =  7 ;
137140}
138141
139142// ProfilesData represents the profiles data that can be stored in persistent storage, 
@@ -214,18 +217,19 @@ message ScopeProfiles {
214217//   information present to determine the original sampled values. 
215218// 
216219// - The profile is represented as a set of samples, where each sample 
217- //   references a sequence  of locations, and where  each location belongs  
220+ //   references a stack trace which is a list  of locations, each belonging  
218221//   to a mapping. 
219- // - There is a N->1 relationship from sample.location_id  entries to 
220- //   locations. For every sample.location_id  entry there must be a 
222+ // - There is a N->1 relationship from Stack.location_indices  entries to 
223+ //   locations. For every Stack.location_indices  entry there must be a 
221224//   unique Location with that index. 
222225// - There is an optional N->1 relationship from locations to 
223226//   mappings. For every nonzero Location.mapping_id there must be a 
224227//   unique Mapping with that index. 
225228
226- // Represents a complete profile, including sample types, samples, 
227- // mappings to binaries, locations, functions, string table, and additional metadata. 
228- // It modifies and annotates pprof Profile with OpenTelemetry specific fields. 
229+ // Represents a complete profile, including sample types, samples, mappings to 
230+ // binaries, stacks, locations, functions, string table, and additional 
231+ // metadata. It modifies and annotates pprof Profile with OpenTelemetry 
232+ // specific fields. 
229233// 
230234// Note that whilst fields in this message retain the name and field id from pprof in most cases 
231235// for ease of understanding data migration, it is not intended that pprof:Profile and 
@@ -240,54 +244,51 @@ message Profile {
240244  // The set of samples recorded in this profile. 
241245  repeated  Sample  sample  =  2 ;
242246
243-   // References to locations in ProfilesDictionary.location_table. 
244-   repeated  int32  location_indices  =  3 ;
245- 
246-   // The following fields 4-14 are informational, do not affect 
247+   // The following fields 3-12 are informational, do not affect 
247248  // interpretation of results. 
248249
249250  // Time of collection (UTC) represented as nanoseconds past the epoch. 
250-   fixed64  time_unix_nano  =  4 ;
251+   fixed64  time_unix_nano  =  3 ;
251252  // Duration of the profile, if a duration makes sense. 
252-   uint64  duration_nano  =  5 ;
253+   uint64  duration_nano  =  4 ;
253254  // The kind of events between sampled occurrences. 
254255  // e.g [ "cpu","cycles" ] or [ "heap","bytes" ] 
255-   ValueType  period_type  =  6 ;
256+   ValueType  period_type  =  5 ;
256257  // The number of events between sampled occurrences. 
257-   int64  period  =  7 ;
258+   int64  period  =  6 ;
258259  // Free-form text associated with the profile. The text is displayed as is 
259260  // to the user by the tools that read profiles (e.g. by pprof). This field 
260261  // should not be used to store any machine-readable information, it is only 
261262  // for human-friendly content. The profile must stay functional if this field 
262263  // is cleaned. 
263-   repeated  int32  comment_strindices  =  8 ; // Indices into ProfilesDictionary.string_table. 
264+   repeated  int32  comment_strindices  =  7 ; // Indices into ProfilesDictionary.string_table. 
264265
265266  // A globally unique identifier for a profile. The ID is a 16-byte array. An ID with 
266267  // all zeroes is considered invalid. It may be used for deduplication and signal 
267268  // correlation purposes. It is acceptable to treat two profiles with different values 
268269  // in this field as not equal, even if they represented the same object at an earlier 
269270  // time. 
270271  // This field is optional; an ID may be assigned to an ID-less profile in a later step. 
271-   bytes  profile_id  =  9 ;
272+   bytes  profile_id  =  8 ;
272273
273274  // dropped_attributes_count is the number of attributes that were discarded. Attributes 
274275  // can be discarded because their keys are too long or because there are too many 
275276  // attributes. If this value is 0, then no attributes were dropped. 
276-   uint32  dropped_attributes_count  =  10 ;
277+   uint32  dropped_attributes_count  =  9 ;
277278
278279  // Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] 
279-   string  original_payload_format  =  11 ;
280+   string  original_payload_format  =  10 ;
280281
281282  // Original payload can be stored in this field. This can be useful for users who want to get the original payload. 
282283  // Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. 
283284  // Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. 
284285  // If the original payload is in pprof format, it SHOULD not be included in this field. 
285286  // The field is optional, however if it is present then equivalent converted data should be populated in other fields 
286287  // of this message as far as is practicable. 
287-   bytes  original_payload  =  12 ;
288+   bytes  original_payload  =  11 ;
288289
289290  // References to attributes in attribute_table. [optional] 
290-   repeated  int32  attribute_indices  =  13 ;
291+   repeated  int32  attribute_indices  =  12 ;
291292}
292293
293294// A pointer from a profile Sample to a trace Span. 
@@ -400,23 +401,20 @@ message ValueType {
400401//    values: [2, 2, 3, 3] 
401402//    timestamps_unix_nano: [1, 2, 3, 4] 
402403message  Sample  {
403-   // locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices. 
404-   int32  locations_start_index  =  1 ;
405-   // locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices. 
406-   // Supersedes location_index. 
407-   int32  locations_length  =  2 ;
404+   // Reference to stack in ProfilesDictionary.stack_table. 
405+   int32  stack_index  =  1 ;
408406  // The type and unit of each value is defined by Profile.sample_type. 
409-   repeated  int64  values  =  3 ;
407+   repeated  int64  values  =  2 ;
410408  // References to attributes in ProfilesDictionary.attribute_table. [optional] 
411-   repeated  int32  attribute_indices  =  4 ;
409+   repeated  int32  attribute_indices  =  3 ;
412410
413411  // Reference to link in ProfilesDictionary.link_table. [optional] 
414412  // It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value. 
415-   int32  link_index  =  5 ;
413+   int32  link_index  =  4 ;
416414
417415  // Timestamps associated with Sample represented in nanoseconds. These 
418416  // timestamps should fall within the Profile's time range. 
419-   repeated  fixed64  timestamps_unix_nano  =  6 ;
417+   repeated  fixed64  timestamps_unix_nano  =  4 ;
420418}
421419
422420// Describes the mapping of a binary in memory, including its address range, 
@@ -436,6 +434,13 @@ message Mapping {
436434  repeated  int32  attribute_indices  =  5 ;
437435}
438436
437+ // A Stack represents a stack trace as a list of locations. The first location 
438+ // is the leaf frame. 
439+ message  Stack  {
440+   // References to locations in ProfilesDictionary.location_table. 
441+   repeated  int32  location_indices  =  1 ;
442+ }
443+ 
439444// Describes function and line table debug information. 
440445message  Location  {
441446  // Reference to mapping in ProfilesDictionary.mapping_table. 
0 commit comments