Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiles: Make mapping in Profile optional #556

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

florianl
Copy link
Contributor

@florianl florianl commented May 3, 2024

As commented in 0 and discussed in the OTel Profiling SIG meeting, there are situations where a main binary for a Profile can not be identified. For these cases mark the field optional.

FYI: @brancz @petethepig @open-telemetry/profiling-maintainers

As commented in [0] and discussed in the OTel Profiling SIG meeting, there are
situations where a main binary for a Profile can not be identified.
For these cases mark the field optional.

[0]: open-telemetry#534 (comment)

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
@florianl florianl requested a review from a team as a code owner May 3, 2024 10:01
Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
@florianl florianl requested a review from a team as a code owner May 8, 2024 08:40
@@ -79,6 +79,8 @@ message Profile {
repeated Sample sample = 2;
// Mapping from address ranges to the image/binary/library mapped
// into that address range. mapping[0] will be the main binary.
// If multiple binaries contribute to the Profile and no main
// binary can be identified, mapping[0] has no special meaning.
Copy link

@aalexand aalexand May 18, 2024

Choose a reason for hiding this comment

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

One aspect to discuss I think is how pprofextended expresses nil references to entities like mapping. Locaiton.mapping_index is an index and it's not marked as "optional" proto3 field, so there there is no presence bit. Which means that if the mapping array is empty and mapping_index is not set then effectively it's zero and effectively it's an out of bound reference. Are we saying that any out of bound reference is considered a nil reference? I think this needs to be discussed and spelled out. Because an alternative would be have a mapping entity at index zero but have it distinguishably empty - no name, all fields are zero etc.

Note that in the original pprof proto this is handled differently since the field is Location.mapping_id (rather than mapping_index), so the references were through this additional ID indirection and it is required that the IDs are positive integers, so the ID of 0 is unambiguously a nil reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that the non existence of an element, is not well defined in both protocols. The intention of this PR is to improve on that front for pprofextended.
I might have missed the part, where the original pprof requires _id to be a positive value (which includes the implicit 0 value to be interpreted as non existence?)
While the original pprof uses _id the naming changed to _index with pprofextended.

Because an alternative would be have a mapping entity at index zero but have it distinguishably empty - no name, all fields are zero etc.

From my perspective that is the best way to continue, while keeping backwards/forwards compatability between pprof and pprofextended.

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

Blocking temporarily until #559 is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants