diff --git a/opentelemetry/proto/profiles/v1development/profiles.proto b/opentelemetry/proto/profiles/v1development/profiles.proto index 28777aa6..f20d2bd2 100644 --- a/opentelemetry/proto/profiles/v1development/profiles.proto +++ b/opentelemetry/proto/profiles/v1development/profiles.proto @@ -132,8 +132,66 @@ message ProfilesData { // Represents a mapping between Attribute Keys and Units. repeated AttributeUnit attribute_units = 8; -} + // Stack tree encoded as two parallel arrays: one for the parent array, + // another for the ProfilesData.location_table index of the location + // corresponding to the given stack tree node. The two arrays must have the + // same length. The parent array uses -1 for the root nodes. + // + // For example, the following locations and stack tree data: + // + // +----------------+----------------+ + // | location index | location_table | + // +----------------+----------------+ + // | 0 | "" | + // | 1 | "main" | + // | 2 | "foo" | + // | 3 | "bar" | + // | 4 | "baz1" | + // | 5 | "baz2" | + // +----------------+----------------+ + // + // +-------------+--------------------+----------------------+ + // | stack index | stack_parent_array | stack_location_index | + // +-------------+--------------------+----------------------+ + // | 0 | -1 | 1 | + // | 1 | 0 | 2 | + // | 2 | 1 | 3 | + // | 3 | 2 | 4 | + // | 4 | 2 | 5 | + // | 5 | 1 | 5 | + // +-------------+--------------------+----------------------+ + // + // are encoding these stacks (the number is the stack index): + // + // main (0) + // └── foo (1) + // ├── bar (2) + // │ ├── baz1 (3) + // │ └── baz2 (4) + // └── baz2 (5) + // + // And here is an example of the operations to decode the stack trace + // "main->foo->bar->baz2" at stack index 4. + // + // 1. Lookup stack_location_index[4] = 5 + // 2. Lookup location_table[5] = "baz2" + // 3. Lookup stack_parent_array[4] = 2 + // + // 4. Lookup stack_location_index[2] = 3 + // 5. Lookup location_table[3] = "bar" + // 6. Lookup stack_parent_array[2] = 1 + // + // 7. Lookup stack_location_index[1] = 2 + // 8. Lookup location_table[2] = "foo" + // 9. Lookup stack_parent_array[1] = 0 + // + // 10. Lookup stack_location_index[0] = 1 + // 11. Lookup location_table[1] = "main" + // 12. Lookup stack_parent_array[0] = -1 + repeated int32 stack_parent_array = 9; + repeated int32 stack_location_index = 10; +} // A collection of ScopeProfiles from a Resource. message ResourceProfiles { @@ -217,9 +275,6 @@ message Profile { // The set of samples recorded in this profile. repeated Sample sample = 2; - // References to locations in ProfilesData.location_table. - repeated int32 location_indices = 3; - // The following fields 4-14 are informational, do not affect // interpretation of results. @@ -379,11 +434,9 @@ message ValueType { // augmented with auxiliary information like the thread-id, some // indicator of a higher level request being handled etc. message Sample { - // locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices. - int32 locations_start_index = 1; - // locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices. - // Supersedes location_index. - int32 locations_length = 2; + // Index into ProfilesData.{stack_parent_array, stack_location_index} stack + // table, representing the stack tree node of the sample. + int32 stack_index = 1; // The type and unit of each value is defined by the corresponding // entry in Profile.sample_type. All samples must have the same // number of values, the same as the length of Profile.sample_type.