Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 62 additions & 9 deletions opentelemetry/proto/profiles/v1development/profiles.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Copy link
Copy Markdown

@tsint tsint Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aalexand
As you said here, have you considered adding a field to indicate the personalized attributes of single samples?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I may have been unclear. There are no plans to add ability to specify different attributes to timestamps within a sample. All timestamps within a sample correspond to the same stack and attributes. What I meant is that with a single field fo referencing the stack the sizeof(Sample) is smaller.

// entry in Profile.sample_type. All samples must have the same
// number of values, the same as the length of Profile.sample_type.
Expand Down
Loading